zhuliu vor 1 Jahr
Ursprung
Commit
3db2a41e93

+ 3 - 1
api/index.js

@@ -8,6 +8,7 @@ const pay = require('./pay.js')
 const follow = require('./follow')
 const searchRecord = require('./searchRecord')
 const common = require('./common')
+const patentExport = require('./patentExport')
 
 module.exports={ 
   
@@ -20,5 +21,6 @@ module.exports={
   ...work,
   ...pay,
   ...follow,
-  ...searchRecord
+  ...searchRecord,
+  ...patentExport
 }

+ 8 - 0
api/patentExport.js

@@ -0,0 +1,8 @@
+const request = require('../utils/request')
+
+module.exports={ 
+  //导出专利
+  exportPatent:(data)=>{
+    return request.post('/xiaoshi-weixinback/patent/exportPatent',data)
+  },
+ }

+ 3 - 0
myComponents/navBar/navBar.wxss

@@ -46,4 +46,7 @@
 }
 .nav-bar-buttom {
   height: 10rpx;
+}
+.myIconzhuye1{
+  font-size: 35rpx;
 }

+ 1 - 1
myComponents/popover2/popover.js

@@ -29,7 +29,7 @@ Component({
     showMenu(value){
       this.setData(
         {
-          show:value
+          show:!this.data.show
         }
       )
     },

+ 4 - 4
myComponents/product/product.js

@@ -55,7 +55,7 @@ Component({
       
       var {index} = e.currentTarget.dataset
       var dom = this.selectComponent('#myPopover'+index)
-      dom.showMenu(!this.data.show)
+      dom.showMenu()
     },
 
     // 响应popover组件中的子元素点击事件
@@ -65,7 +65,7 @@ Component({
       // 调用自定义组件 popover 中的 onHide 方法
       this[item.method](index)
       var dom = this.selectComponent('#myPopover'+index)
-      dom.showMenu(false)
+      dom.showMenu()
     },
     //查询已收藏的专利
     selectCollectPatent(index){
@@ -124,7 +124,7 @@ Component({
             message: '关注成功',
           }
           if(this.properties.isFollow){
-            obj.top = '90'
+            obj.top = wx.getStorageSync('height')
           }
           api.notify(obj)
           this.setData({
@@ -158,7 +158,7 @@ Component({
                   message: '取关成功',
                 }
                 if(this.properties.isFollow){
-                  obj.top = '90'
+                  obj.top = wx.getStorageSync('height')
                   this.triggerEvent('cancelFollow',index)
                 }
                 api.notify(obj)

+ 3 - 2
myComponents/table/table.wxss

@@ -10,8 +10,8 @@
   display: table;
   border-collapse: collapse;
   overflow-x: auto;
-  /* word-break: keep-all; */
-  /* white-space: nowrap; */
+  word-break: break-all;
+  white-space:nowrap;
   background-color: #FFFFFF;
   width: 90%;
   border-radius: 20rpx;
@@ -38,6 +38,7 @@
   padding: 0rpx 30rpx;
   display: table-cell;
   height: 60rpx;
+
   line-height: 60rpx;
   text-align: center;
   border: 1rpx solid #DDDDDD;

+ 25 - 2
pages/memberCenter/memberCenter.js

@@ -56,6 +56,29 @@ Page({
    */
   onLoad(options) {
     this.getUserinfo()
+  //   var thead= [
+  //     { key: 'orderNum', name: '订单编号' },
+  //     { key: 'machNum', name: '机器编号' },
+  //     { key: 'planeNum', name: '计划生产数量' },
+  //     { key: 'planeEndTime', name: '计划结束时间' },
+  //     { key: 'productName', name: '产品名称' }
+  // ]
+  // var data= [
+  //     { orderNum: '01234dsnfbujhcdsvfkudshcvjbsdkcbsdjkchbsdjkhb', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' },
+  //     { orderNum: '31234', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' },
+  //     { orderNum: '13455', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' },
+  //     { orderNum: '47867', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' },
+  //     { orderNum: '34565', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' },
+  //     { orderNum: '76809', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' },
+  //     { orderNum: '01034', machNum: '23', planeNum: '20', planeEndTime: '2022-08-08', productName: '8W0 864 733-B9_PA' }
+  // ]
+  // this.setData(
+  //   {
+  //     tableHead:thead,
+  //     tableData:data
+  //   }
+  // )
+
     this.queryAllVip()
     
   },
@@ -185,7 +208,7 @@ Page({
         {
           type:'warning',
           message:'请先选择需要开通会员的类型',
-          top:'90'
+          top:wx.getStorageSync('height')
         }
       )
     }
@@ -203,7 +226,7 @@ Page({
           {
             type:'success',
             message:'开通会员成功',
-            top:'90'
+            top:wx.getStorageSync('height')
           }
         )
         this.getUserinfo()

+ 1 - 1
pages/memberCenter/memberCenter.wxml

@@ -13,7 +13,7 @@
           <view class="description">请选择您要开通的会员等级</view>
         </view>
       </view>
-      <view class="type"> <text class="iconfont myIconrenyuan icon"></text> {{userinfo.vip.name}}</view>
+      <view class="type"> <text class="iconfont myIconrenyuan icon"></text> {{userinfo.vip.name || '普通用户'}}</view>
     </view>
     <view class="equity">
       <view class="equity_item" wx:for="{{equity}}" wx:key="index">

+ 1 - 1
pages/mine/mine.wxml

@@ -13,7 +13,7 @@
       <wux-avatar size="large" wx:else src="/static/image/unlogin.jpeg" bind:tap="editMessage"></wux-avatar>
       <view class="message">
         <view class="name">{{userinfo.name || userinfo.phoneNum}}</view>
-        <view class="type"> <text class="iconfont myIconrenyuan icon"></text> {{userinfo.vip.name}}</view>
+        <view class="type"> <text class="iconfont myIconrenyuan icon"></text> {{userinfo.vip.name|| '普通用户'}}</view>
       </view>
     </view>
     <view class="right" bind:tap="openVIP">

+ 1 - 1
pages/myWork/myWork.js

@@ -171,7 +171,7 @@ Page({
           {
             type:'success',
             message:'支付成功',
-            top:'90'
+            top:wx.getStorageSync('height')
           }
         )
         this.setData(

+ 31 - 6
pages/searchResults/searchResults.js

@@ -1,6 +1,7 @@
 // pages/searchResults/searchResults.js
 const app = getApp()
 const api = require('../../api/index')
+const downLoad = require('../../utils/downLoad')
 import { $startWuxRefresher, $stopWuxRefresher,$stopWuxLoader,$wuxGallery} from '../../miniprogram_npm/wux-weapp/index'
 Page({
 
@@ -258,7 +259,7 @@ Page({
       },
       success: function(res) {
         // 通过eventChannel向被打开页面传送数据
-        res.eventChannel.emit('acceptDataFromOpenerPage', { data: that.data.patentList })
+        res.eventChannel.emit('acceptDataFromOpenerPage', { data: that.data.patentList,patentNoList:that.data.patentNoList })
       }
     })
   },
@@ -306,7 +307,7 @@ Page({
         {
           type:'warning',
           message:'请选择关注类型',
-          top:'90'
+          top:wx.getStorageSync('height')
         }
       )
       return false
@@ -340,7 +341,7 @@ Page({
         var obj = {
           type: 'success', 
           message: '关注成功',
-          top:'90'
+          top:wx.getStorageSync('height')
         }
         api.notify(obj)
         that.setData({
@@ -395,7 +396,7 @@ Page({
                 message: '取关成功',
               }
               if(this.properties.isFollow){
-                obj.top = '90'
+                obj.top = wx.getStorageSync('height')
               }
               api.notify(obj)
               this.setData({
@@ -432,7 +433,6 @@ onClick(e){
 },
 //导出
 export(){
-
   if(!this.data.patentNoList || this.data.patentNoList.length==0){
     wx.showToast({
       title: '您未选择专利!',
@@ -441,7 +441,32 @@ export(){
     })
     return false
   }
-
+ 
+  var params = {
+    patentNos:this.data.patentNoList
+  }
+  wx.showLoading({
+    title: '导出中',
+  })
+  var that = this
+  api.exportPatent(params).then(res=>{
+    if(res.code == 200){
+      var url = that.data.imgHttp + res.data.data
+      wx.setClipboardData({
+        data: url,
+        success(res) {
+          wx.showToast({
+            title: '复制成功,快到浏览器打开/下载!',
+            icon: 'none',
+            duration: 3000
+          })
+        }
+      })
+      // downLoad.downLoadFile(res.data.data).then(res=>{
+        
+      // })
+    }
+  })
 },
 //我要查风险
 check(){

+ 41 - 1
pages/selectedPatents/selectedPatents.js

@@ -1,6 +1,7 @@
 // pages/selectedPatents/selectedPatents.js
 import { $wuxGallery} from '../../miniprogram_npm/wux-weapp/index'
 const app = getApp()
+const api = require('../../api/index')
 Page({
 
   /**
@@ -9,6 +10,7 @@ Page({
   data: {
     imgHttp:app.globalData.imghttp,
     tableData:[],
+    patentNoList:[]
   },
 
   /**
@@ -24,7 +26,8 @@ Page({
       console.log(data)
       that.setData(
         {
-          tableData:data.data
+          tableData:data.data,
+          patentNoList:data.patentNoList
         }
       )
     })
@@ -73,6 +76,43 @@ Page({
       url: '/pages/form/riskAssessment/riskAssessment',
     })
   },
+  //导出
+export(){
+  if(!this.data.patentNoList || this.data.patentNoList.length==0){
+    wx.showToast({
+      title: '您未选择专利!',
+      icon:'none',
+      duration: 2000
+    })
+    return false
+  }
+ 
+  var params = {
+    patentNos:this.data.patentNoList
+  }
+  wx.showLoading({
+    title: '导出中',
+  })
+  var that = this
+  api.exportPatent(params).then(res=>{
+    if(res.code == 200){
+      var url = that.data.imgHttp + res.data.data
+      wx.setClipboardData({
+        data: url,
+        success(res) {
+          wx.showToast({
+            title: '复制成功,快到浏览器打开/下载!',
+            icon: 'none',
+            duration: 3000
+          })
+        }
+      })
+      // downLoad.downLoadFile(res.data.data).then(res=>{
+        
+      // })
+    }
+  })
+},
 
 
   /**

+ 78 - 0
utils/downLoad.js

@@ -0,0 +1,78 @@
+import Notify from '../miniprogram_npm/@vant/weapp/notify/notify';
+const config = {  
+  // baseURL: 'http://192.168.1.2:8801', // 基础URL 
+  baseURL: 'https://www.xsip.cn', // 基础URL   
+  timeout: 30000, // 超时时间(单位ms)  
+  header: {  
+    // 'content-type': 'application/json', // 默认请求头  
+    // 其他全局请求头... 
+   
+  },  
+  // 其他全局配置...  
+  tabbar:["pages/index/index","pages/hotProduct/hotProduct","pages/mine/mine"] 
+}; 
+function getPages(){
+  var obj = {
+    type: 'danger'
+  }
+  var pages = getCurrentPages()
+  var route = pages[pages.length - 1]?.route
+  console.log(config.tabbar,route)
+  if(route && config.tabbar.indexOf(route)==-1){
+    obj.top = wx.getStorageSync('height')
+  }
+  return obj
+}
+function downLoad(url){
+   
+  return new Promise((resolve, reject)=>{
+    wx.downloadFile({
+        url:config.baseURL + '/fileManager/downloadFile?fileId=' + url,
+        // filePath: 'filePath',
+        // header: header,
+        // timeout: 0,
+        success: (result) => {
+          wx.hideLoading()
+          var obj = getPages()
+          if(obj.message){
+            Notify(obj)
+          }
+          console.log(result)
+          if (result.statusCode === 200) {
+            const tempFilePath = result.tempFilePath; // 临时文件路径
+            wx.saveFile({  
+              tempFilePath: tempFilePath, // 传入临时文件路径  
+              success(saveRes) {  
+                const savedFilePath = saveRes.savedFilePath;  
+                console.log('文件已保存到本地', savedFilePath);  
+                resolve(saveRes)
+                // 可以在这里做后续操作,如打开文件或通知用户  
+              },  
+              fail(error) {  
+                console.error('保存文件失败', error);  
+                reject('保存文件失败')
+              }  
+            })
+            
+          }
+          
+        },
+        fail: (res) => {
+          wx.hideLoading()
+          var obj = getPages()
+          if(obj.message){
+            Notify(obj)
+          }
+          reject('导出失败')
+         
+        },
+        complete: (res) => {},
+      })
+  })
+  
+}
+// 导出请求方法  
+module.exports = {  
+  downLoadFile: (url) => downLoad(url),  
+
+};

+ 25 - 23
utils/request.js

@@ -3,8 +3,8 @@ import Notify from '../miniprogram_npm/@vant/weapp/notify/notify';
 import { $startWuxRefresher, $stopWuxRefresher,$stopWuxLoader} from '../miniprogram_npm/wux-weapp/index';
 // 配置项  
 const config = {  
-  baseURL: 'http://192.168.1.6:8901', // 基础URL  
-  // baseURL: 'https://www.xsip.cn', // 基础URL  
+  // baseURL: 'http://192.168.1.2:8901', // 基础URL  
+  baseURL: 'https://www.xsip.cn', // 基础URL  
   timeout: 30000, // 超时时间(单位ms)  
   header: {  
     'content-type': 'application/json', // 默认请求头  
@@ -13,19 +13,23 @@ const config = {
   // 其他全局配置...  
   tabbar:["pages/index/index","pages/hotProduct/hotProduct","pages/mine/mine"]
 };  
-  
+
+function getPages(){
+  var obj = {
+    type: 'danger'
+  }
+  var pages = getCurrentPages()
+  var route = pages[pages.length - 1]?.route
+  console.log(config.tabbar,route)
+  if(route && config.tabbar.indexOf(route)==-1){
+    obj.top = wx.getStorageSync('height')
+  }
+  return obj
+}
+
 // 封装请求方法  
 function request(url, method = 'GET', data = {}, header = {},isLogin=true) {  
   return new Promise((resolve, reject) => {  
-    var obj = {
-      type: 'danger'
-    }
-    var pages = getCurrentPages()
-    var route = pages[pages.length - 1]?.route
-    console.log(config.tabbar,route)
-    if(route && config.tabbar.indexOf(route)==-1){
-      obj.top = wx.getStorageSync('height')
-    }
     var str = ''
     if(method === 'GET'){
       str ='?' + Object.keys(data).map(key => `${key}=${encodeURIComponent(data[key])}`).join('&')
@@ -41,11 +45,15 @@ function request(url, method = 'GET', data = {}, header = {},isLogin=true) {
       },  
       timeout: config.timeout,  
       success: function(res){  
+        var obj = getPages()
         wx.hideLoading()
         // 根据业务逻辑处理成功响应  
         if (res.data && res.data.code === 200) { // 假设服务器返回code为200表示成功 
           resolve(res.data);  
-        } else {  
+        }  else if(res.data && !res.data.code){
+          resolve(res.data);  
+        }
+        else {  
           switch(res.data.code){
             case 401:
               if(isLogin){
@@ -81,6 +89,7 @@ function request(url, method = 'GET', data = {}, header = {},isLogin=true) {
       fail: function(error) { 
         console.log(error) 
         wx.hideLoading()
+        var obj = getPages()
         // 处理请求失败 
         // wx.showToast({
         //   title: '请求失败',
@@ -101,15 +110,6 @@ function request(url, method = 'GET', data = {}, header = {},isLogin=true) {
   
 function upload(url="/fileManager/uploadNormalFile", path = '', header = {},formData={}) {  
   return new Promise((resolve, reject) => {  
-    var obj = {
-      type: 'danger'
-    }
-    var pages = getCurrentPages()
-    var route = pages[pages.length - 1]?.route
-    console.log(config.tabbar,route)
-    if(route && config.tabbar.indexOf(route)==-1){
-      obj.top = wx.getStorageSync('height')
-    }
     wx.uploadFile({  
       url: config.baseURL + url, //仅为示例,非真实的接口地址
       filePath: path,
@@ -123,13 +123,14 @@ function upload(url="/fileManager/uploadNormalFile", path = '', header = {},form
       timeout: config.timeout,  
       success: function(res){ 
         wx.hideLoading() 
+        var obj = getPages()
         if(res.data){
           res.data = JSON.parse(res.data)
         }
         // 根据业务逻辑处理成功响应  
         if (res.data && res.data.code === 200) { // 假设服务器返回code为200表示成功 
           resolve(res.data);  
-        } else {  
+        }else {  
           switch(res.data.code){
             case 401:
               if(isLogin){
@@ -165,6 +166,7 @@ function upload(url="/fileManager/uploadNormalFile", path = '', header = {},form
       fail: function(error) { 
         console.log(error) 
         wx.hideLoading()
+        var obj = getPages()
         // 处理请求失败 
         // wx.showToast({
         //   title: '请求失败',

+ 14 - 10
utils/upload.js

@@ -2,7 +2,6 @@
 import Notify from '../miniprogram_npm/@vant/weapp/notify/notify';
 import { $startWuxRefresher, $stopWuxRefresher,$stopWuxLoader} from '../miniprogram_npm/wux-weapp/index';
 const token = wx.getStorageSync('token')
-const app = getApp()
 const config = {  
   // baseURL: 'http://192.168.1.6:8802', // 基础URL 
   baseURL: 'https://www.xsip.cn', // 基础URL   
@@ -15,18 +14,21 @@ const config = {
   // 其他全局配置...  
   tabbar:["pages/index/index","pages/hotProduct/hotProduct","pages/mine/mine"] 
 };  
+function getPages(){
+  var obj = {
+    type: 'danger'
+  }
+  var pages = getCurrentPages()
+  var route = pages[pages.length - 1]?.route
+  console.log(config.tabbar,route)
+  if(route && config.tabbar.indexOf(route)==-1){
+    obj.top = wx.getStorageSync('height')
+  }
+  return obj
+}
 // 封装请求方法  
 function upload(url="/fileManager/uploadNormalFile", path = '', header = {},formData={}) {  
   return new Promise((resolve, reject) => {  
-    var obj = {
-      type: 'danger'
-    }
-    var pages = getCurrentPages()
-    var route = pages[pages.length - 1]?.route
-    console.log(config.tabbar,route)
-    if(route && config.tabbar.indexOf(route)==-1){
-      obj.top = app.globalData.navBarHeight
-    }
     wx.uploadFile({  
       url: config.baseURL + url, //仅为示例,非真实的接口地址
       filePath: path,
@@ -43,6 +45,7 @@ function upload(url="/fileManager/uploadNormalFile", path = '', header = {},form
       timeout: config.timeout,  
       success: function(res){  
         wx.hideLoading()
+        var obj = getPages()
         if(res.data){
           res.data = JSON.parse(res.data)
         }
@@ -85,6 +88,7 @@ function upload(url="/fileManager/uploadNormalFile", path = '', header = {},form
       fail: function(error) { 
         console.log(error) 
         wx.hideLoading()
+        var obj = getPages()
         // 处理请求失败 
         // wx.showToast({
         //   title: '请求失败',