Jelajahi Sumber

update code

zhuliu 1 tahun lalu
induk
melakukan
6527c9ca33
54 mengubah file dengan 823 tambahan dan 130 penghapusan
  1. 3 1
      api/index.js
  2. 20 0
      api/monitor.js
  3. 33 2
      app.js
  4. 4 2
      app.json
  5. 31 0
      myComponents/icon/icon.js
  6. 4 0
      myComponents/icon/icon.json
  7. 4 0
      myComponents/icon/icon.wxml
  8. 1 0
      myComponents/icon/icon.wxss
  9. 5 0
      myComponents/popover2/popover.js
  10. 1 1
      myComponents/popover2/popover.wxml
  11. 19 7
      myComponents/popover2/popover.wxss
  12. 135 19
      myComponents/product/product.js
  13. 0 1
      myComponents/product/product.json
  14. 19 3
      myComponents/product/product.wxml
  15. 1 1
      myComponents/product/product.wxss
  16. 70 62
      pages/form/addProduct/addProduct.js
  17. 13 0
      pages/form/addProduct/addProduct.wxml
  18. 1 1
      pages/index/index.wxss
  19. 80 2
      pages/monitor/monitor.js
  20. 1 1
      pages/monitor/monitor.wxml
  21. 170 0
      pages/monitor/monitoringRecord.js
  22. 7 0
      pages/monitor/monitoringRecord.json
  23. 22 0
      pages/monitor/monitoringRecord.wxml
  24. 12 0
      pages/monitor/monitoringRecord.wxss
  25. 6 0
      pages/myFollow/myFollow.js
  26. 1 1
      pages/myFollow/myFollow.wxml
  27. 134 16
      pages/searchResults/searchResults.js
  28. 7 7
      pages/searchResults/searchResults.wxml
  29. TEMPAT SAMPAH
      static/icon/14.png
  30. TEMPAT SAMPAH
      static/icon/a-yijiankong2x.png
  31. TEMPAT SAMPAH
      static/icon/anquanbangzhu.png
  32. TEMPAT SAMPAH
      static/icon/dajiaduzaimai-copy.png
  33. TEMPAT SAMPAH
      static/icon/dajiaduzaimai.png
  34. TEMPAT SAMPAH
      static/icon/daochu.png
  35. TEMPAT SAMPAH
      static/icon/fanhui.png
  36. TEMPAT SAMPAH
      static/icon/gongdan.png
  37. TEMPAT SAMPAH
      static/icon/group43.png
  38. TEMPAT SAMPAH
      static/icon/guanzhu.png
  39. TEMPAT SAMPAH
      static/icon/icon-test.png
  40. TEMPAT SAMPAH
      static/icon/monitor.png
  41. TEMPAT SAMPAH
      static/icon/rengongkefu.png
  42. TEMPAT SAMPAH
      static/icon/renyuan.png
  43. TEMPAT SAMPAH
      static/icon/sangedian-type-1.png
  44. TEMPAT SAMPAH
      static/icon/shangchuan.png
  45. TEMPAT SAMPAH
      static/icon/sousuo.png
  46. TEMPAT SAMPAH
      static/icon/weibiaoti-_huabanfuben.png
  47. TEMPAT SAMPAH
      static/icon/wode-copy.png
  48. TEMPAT SAMPAH
      static/icon/wode.png
  49. TEMPAT SAMPAH
      static/icon/zhaoxiangji.png
  50. TEMPAT SAMPAH
      static/icon/zhuye-copy.png
  51. TEMPAT SAMPAH
      static/icon/zhuye.png
  52. TEMPAT SAMPAH
      static/icon/zhuye1.png
  53. 18 2
      static/iconfont/iconfont.wxss
  54. 1 1
      utils/request.js

+ 3 - 1
api/index.js

@@ -9,6 +9,7 @@ const follow = require('./follow')
 const searchRecord = require('./searchRecord')
 const common = require('./common')
 const patentExport = require('./patentExport')
+const monitor = require('./monitor')
 
 module.exports={ 
   
@@ -22,5 +23,6 @@ module.exports={
   ...pay,
   ...follow,
   ...searchRecord,
-  ...patentExport
+  ...patentExport,
+  ...monitor
 }

+ 20 - 0
api/monitor.js

@@ -0,0 +1,20 @@
+const request = require('../utils/request')
+
+module.exports={ 
+  //添加监控
+	addMonitoring:(data)=>{
+		return request.post('/xiaoshi-weixinback/monitoring/addMonitoring',data)
+  },
+  //查询监控接口
+  selectMonitoring:(data)=>{
+		return request.post('/xiaoshi-weixinback/monitoring/selectMonitoring',data)
+  },
+  //取消监控接口
+  cancelMonitoring:(data)=>{
+		return request.post('/xiaoshi-weixinback/monitoring/cancelMonitoring',data)
+  },
+  //查询监控详情记录接口
+  selectMonitoringRecord:(data)=>{
+		return request.post('/xiaoshi-weixinback/monitoring/selectMonitoringRecord',data)
+  },
+ }

+ 33 - 2
app.js

@@ -22,13 +22,14 @@ App({
     that.globalData.menuHeight = menuButtonInfo.height;
     that.globalData.menuWidth = menuButtonInfo.width;
     wx.setStorageSync('height', that.globalData.navBarHeight)
-    this.getPersonRights()
+    this.getPersonRights()//获取用户权益
+    this.checkVersion()//检查小程序版本
 
     //静态图片地址
     var Path = {
       develop: {
         localImagePath:'',
-        imghttp:'http://192.168.1.16:8801/fileManager/downloadFile?fileId='
+        imghttp:'https://www.xsip.cn/fileManager/downloadFile?fileId='
       }, // 开发环境地址  
       trial: {
         localImagePath:'.',
@@ -65,4 +66,34 @@ App({
       }
     })
   },
+
+  checkVersion(){
+    const updateManager = wx.getUpdateManager()  
+    updateManager.onCheckForUpdate(function (res) {  
+      // 请求完新版本信息的回调  
+      if (res.hasUpdate) {  
+        // 有新版本  
+        updateManager.onUpdateReady(function () {  
+          wx.showModal({  
+            title: '更新提示',  
+            content: '新版本已经准备好,是否立即重启应用?',  
+            success: function (res) {  
+              if (res.confirm) {  
+                // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启  
+                updateManager.applyUpdate()  
+              }  
+            }  
+          })  
+        })  
+      
+        updateManager.onUpdateFailed(function () {  
+          // 新版本下载失败  
+          wx.showModal({  
+            title: '更新提示',  
+            content: '新版本下载失败,请您删除当前小程序,到微信 “发现-小程序” 页,重新搜索打开呦~',  
+          })  
+        })  
+      }  
+    })
+  }
 })

+ 4 - 2
app.json

@@ -22,7 +22,8 @@
     "pages/collectPatent/collectPatent",
     "pages/personalInformation/personalInformation",
     "pages/patentDetails/patentDetails",
-    "pages/showImageList/showImageList"
+    "pages/showImageList/showImageList",
+    "pages/monitor/monitoringRecord"
   ],
   "tabBar": {
     "list": [
@@ -66,7 +67,8 @@
     "wux-gallery": "/miniprogram_npm/wux-weapp/gallery/index",
     "wux-fab-button": "/miniprogram_npm/wux-weapp/fab-button/index",
     "van-icon": "/miniprogram_npm/@vant/weapp/icon/index",
-    "my-scroll-view": "/myComponents/scrollView/scrollView"
+    "my-scroll-view": "/myComponents/scrollView/scrollView",
+    "my-icon": "/myComponents/icon/icon"
   },
   "componentFramework": "glass-easel",
   "sitemapLocation": "sitemap.json",

+ 31 - 0
myComponents/icon/icon.js

@@ -0,0 +1,31 @@
+// myComponents/icon/icon.js
+Component({
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    icon:{
+      type:String,
+      value:''
+    },
+    customStyle:{
+      type:String,
+      value:"width:45rpx;height:45rpx"
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 4 - 0
myComponents/icon/icon.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 4 - 0
myComponents/icon/icon.wxml

@@ -0,0 +1,4 @@
+<!--myComponents/icon/icon.wxml-->
+<view style="{{customStyle}}">  
+  <image style="{{customStyle}}" src="{{icon}}" mode="aspectFit"/>
+</view>

+ 1 - 0
myComponents/icon/icon.wxss

@@ -0,0 +1 @@
+/* myComponents/icon/icon.wxss */

+ 5 - 0
myComponents/popover2/popover.js

@@ -13,6 +13,10 @@ Component({
     //   type:Boolean,
     //   value:false
     // }
+    position:{
+      type:String,
+      value:'bottom',
+    }
   },
 
   /**
@@ -26,6 +30,7 @@ Component({
    * 组件的方法列表
    */
   methods: {
+
     showMenu(value){
       this.setData(
         {

+ 1 - 1
myComponents/popover2/popover.wxml

@@ -1,6 +1,6 @@
 <!--myComponents/popover2/popover.wxml-->
 <view class="myPopover">
-  <view  wx:if="{{show}}" class="popoverView bottom">
+  <view  wx:if="{{show}}" id="myPopoverView" class="popoverView {{position}}">
     <slot name="menu"></slot>
   </view>
   <slot></slot>

+ 19 - 7
myComponents/popover2/popover.wxss

@@ -8,16 +8,23 @@
 .popoverView{
  width: auto;
  height: auto;
+ max-height: 100px;
  padding: 10px;
-  top: 35px;
-  right: calc(100% - 20px);
-  /* background-color: red; */
-  position: absolute;
+ position: absolute;
   background-color: white;
   box-shadow: 0 0 2px 2px #ddd;
   border-radius: 6rpx;
   z-index: 999999;
 }
+.popoverView.top{
+  bottom: 30px;
+  right: calc(100% - 20px);
+}
+.popoverView.bottom{
+  top: 35px;
+  right: calc(100% - 20px);
+  
+}
 .popoverView::before{
   position: absolute;
     display: inline-block;
@@ -41,11 +48,16 @@
     border-bottom-color: transparent;
     border-left-color: transparent;
 }
-.popoverView.bottom::before {
-  top: -6px;
+.popoverView.top::before {
+  bottom: -6px;
   right: 10px;
-  transform: rotate(-45deg);
+  transform: rotate(135deg);
 }
 .popoverView.left::before {
   right: 20px;
+}
+.popoverView.bottom::before {
+  top: -6px;
+  right: 10px;
+  transform: rotate(-45deg);
 }

+ 135 - 19
myComponents/product/product.js

@@ -25,6 +25,10 @@ Component({
     isFollow:{
       type:Boolean,
       value:false
+    },
+    menu:{
+      type:Array,
+      value:[]
     }
   },
 
@@ -38,13 +42,9 @@ Component({
       '1':'myIconanquanbangzhu',//白
       '2':'myIcongroup43'//灰
     },
-    menu:[
-      {
-        label:'收藏的专利',
-        method:'selectCollectPatent'
-      }
-    ],
-    show:false
+
+    show:false,
+    clickType:null,//1是关注,2是监控
   },
 
   /**
@@ -62,8 +62,18 @@ Component({
     onClickA: function (e) {
       const {item,index} = e.currentTarget.dataset
       console.log(item,index)
-      // 调用自定义组件 popover 中的 onHide 方法
-      this[item.method](index)
+      if(item.method == 'selectCollectPatent'){
+        this[item.method](index)
+      }else{
+        var data = {
+          method:item.method,
+          params:{
+            index:index
+          }
+        }
+        this.triggerEvent('click',data)
+      }
+      
       var dom = this.selectComponent('#myPopover'+index)
       dom.showMenu()
     },
@@ -95,25 +105,30 @@ Component({
       }
       var index = e.currentTarget.dataset.index
       this.setData({
-        ['tableData['+ index + '].show'] : true
+        ['tableData['+ index + '].show'] : true,
+        clickType:1
       })
     },
     //关闭关注类型
     cancel(e){
       var index = e.currentTarget.dataset.index
       this.setData({
-        ['tableData['+ index + '].show'] : false
+        ['tableData['+ index + '].show'] : false,
+        clickType:null
       })
     },
-    //关注
+    //关注或监控
     attention(e){
-      
       var {type,index} = e.currentTarget.dataset
       var product = this.data.tableData[index]
       var params = {
         productId:product.id,
         concernType:type
       }
+      if(this.data.clickType == 2){
+        this.addMonitoring(params,index,type)
+        return 
+      }
       wx.showLoading({
         title: '加载中',
       })
@@ -174,15 +189,116 @@ Component({
     },
     //监控
     control(e){
+      var key = api.isLogin()
+      if(!key){
+        return false
+      }
       var index = e.currentTarget.dataset.index
-      wx.showModal({
-        title: '提示',
-        content: '敬请期待!',
-        complete: (res) => {
-          if (res.cancel) {}
-          if (res.confirm) {}
+      var product = this.data.tableData[index]
+      if(product.concernType == 0 || product.concernType){
+        wx.showModal({
+          title: '提示',
+          content: '是否确定监控该产品?',
+          complete: (res) => {
+            if (res.cancel) {}
+            if (res.confirm) {
+              var params = {
+                productId:product.id
+              }
+              this.addMonitoring(params,index)
+            }
+          }
+        })
+        retrun 
+      }
+      this.setData({
+        ['tableData['+ index + '].show'] : true,
+        clickType:2
+      })
+    },
+    //监控产品接口
+    addMonitoring(product,index,type){
+      wx.showLoading({
+        title: '加载中',
+      })
+      api.addMonitoring(product).then(res=>{
+        var obj = {
+          type: 'success', 
+          message: '监控成功',
+        }
+        if(this.properties.isFollow){
+          obj.top = wx.getStorageSync('height')
+        }
+        api.notify(obj)
+        this.setData({
+          ['tableData['+ index + '].show'] : false,
+        })
+        if(type == 0 || type){
+          this.setData({
+            ['tableData['+ index + '].concernType'] : type,
+          })
+        }
+      })
+    },
+    //取消监控产品接口
+    cancelMonitoring(params,index,type){
+      wx.showLoading({
+        title: '取消中',
+      })
+      api.cancelMonitoring(params).then(res=>{
+        if(res.code == 200){
+          var obj = {
+            type: 'success', 
+            message: '取消监控成功',
+          }
+          if(this.properties.isFollow){
+            obj.top = wx.getStorageSync('height')
+          }
+          api.notify(obj)
+          this.setData(
+            {
+              ["tableData["+ index +"].iscon"]:false
+            }
+          )
+          if(type == 1){
+            this.setData(
+              {
+                ["tableData["+ index +"].concernType"]:null
+              }
+            )
+          }
+          this.triggerEvent('cancelMonitoring',index)
+        }
+      })
+    },
+    cancelControl(e){
+      var {index} = e.currentTarget.dataset
+      var product = this.data.tableData[index]
+      var params = {
+        productIds:[product.id],
+        ifCancelConcern:false
+      }
+      wx.showActionSheet({
+        itemList: ['只取消监控', '取消监控和关注', '关闭'],
+        success (res) {
+          console.log(res.tapIndex)
+          switch(res.tapIndex){
+            case 0:
+              this.cancelMonitoring(params,index,0)
+              break;
+            case 1:
+              params.ifCancelConcern = true
+              this.cancelMonitoring(params,index,1)
+              break;
+            case 2:
+              break
+          }
+        },
+        fail (res) {
+          console.log(res.errMsg)
         }
       })
+    
     },
     //加载更多
     loadMore(){

+ 0 - 1
myComponents/product/product.json

@@ -2,7 +2,6 @@
   "component": true,
   "usingComponents": {
     "van-empty":"/miniprogram_npm/@vant/weapp/empty",
-    "wux-image": "/miniprogram_npm/wux-weapp/image/index",
     "myPopover2":"/myComponents/popover2/popover"
   }
 }

+ 19 - 3
myComponents/product/product.wxml

@@ -19,11 +19,27 @@
       <view class="title">
         {{index + 1}}.{{item.name}}
       </view>
-      <view wx:if="{{item.concernType == 0 || item.concernType}}" class="icon">
+
+      <view class="icon">
+        <view wx:if="{{!isFollow && !item.iscon}}" class="iconfont myIconmonitor" data-index="{{index}}" catch:tap="control"></view>
+        <view wx:elif="{{item.iscon && !isFollow}}" class="iconfont myIcona-yijiankong2x" data-index="{{index}}" catch:tap="cancelControl"></view>
+
+        <view wx:if="{{item.concernType == 0 || item.concernType}}" class="icon1 iconfont {{concernType[item.concernType]}}" data-index="{{index}}" catch:tap="cancelFollow"></view>
+        <view wx:else class="iconfont myIconguanzhu" data-index="{{index}}" catch:tap="open"></view>
+
+        <myPopover2 wx:if="{{isFollow}}" id="myPopover{{index}}" position="top" show="{{item.showMenu}}">
+          <view slot="menu" class="menu">
+            <view class="menu_item" wx:for="{{menu}}" wx:for-item="menu" wx:for-index="ind" data-item="{{menu}}" data-index="{{index}}" catch:tap="onClickA">{{menu.label}}</view>
+          </view>
+          <view  class="iconfont myIconsangedian-type-1" data-index="{{index}}" catch:tap="moreMenu"></view>
+        </myPopover2>
+      </view>
+
+      <!-- <view wx:if="{{item.concernType == 0 || item.concernType}}" class="icon">
         <view wx:if="{{!isFollow}}" class="iconfont myIconmonitor" data-index="{{index}}" catch:tap="control"></view>
         <view  class="icon1 iconfont {{concernType[item.concernType]}}" data-index="{{index}}" catch:tap="cancelFollow"></view>
         
-        <myPopover2 wx:if="{{isFollow}}" id="myPopover{{index}}" show="{{item.showMenu}}">
+        <myPopover2 wx:if="{{isFollow}}" id="myPopover{{index}}" position="top" show="{{item.showMenu}}">
           <view slot="menu" class="menu">
             <view class="menu_item" wx:for="{{menu}}" wx:for-item="menu" wx:for-index="ind" data-item="{{menu}}" data-index="{{index}}" catch:tap="onClickA">{{menu.label}}</view>
           </view>
@@ -33,7 +49,7 @@
       <view wx:else class="icon">
         <view class="iconfont myIconmonitor" data-index="{{index}}" catch:tap="control"></view>
         <view class="iconfont myIconguanzhu" data-index="{{index}}" catch:tap="open"></view>
-      </view>
+      </view> -->
     </view>
     <block wx:if="{{item.show == true}}">
     <view  class="product_operate" >

+ 1 - 1
myComponents/product/product.wxss

@@ -29,7 +29,7 @@
 .product_content{
   display: flex;
   flex-wrap: wrap;
-  height: 100%;
+  /* height: 100%; */
 }
 .product_item{
   width: 45%;

+ 70 - 62
pages/form/addProduct/addProduct.js

@@ -15,8 +15,26 @@ Page({
     form:{
       
     },
+    funType:null,
     labelWidth:350,
     fileList:[],
+    concernType:[
+      {
+        type:1,
+        label:'白名单',
+        icon:'myIconanquanbangzhu'
+      },
+      {
+        type:2,
+        label:'灰名单',
+        icon:'myIcongroup43'
+      },
+      {
+        type:0,
+        label:'黑名单',
+        icon:'myIconicon-test'
+      },
+    ]
   },
 
   /**
@@ -28,7 +46,8 @@ Page({
     eventChannel.on('acceptDataFromOpenerPage', function(data) {
       var form = {
         searchCondition:data.key,
-        concernType:data.concernType
+        concernType:data.concernType,
+        monitorPeriod:'7天'
       }
       var file = []
       if(data.filePath){
@@ -43,7 +62,8 @@ Page({
       that.setData(
         {
           form:form,
-          fileList:file
+          fileList:file,
+          funType:data.method
         }
       )
       if(data.filePath){
@@ -83,6 +103,14 @@ Page({
     })
     console.log('onValuesChange \n', changedValues, allValues)
   },
+  //修改关注类型
+  changeConcernType(e){
+    this.setData(
+      {
+        ["form.concernType"]:e.detail
+      }
+    )
+  },
   //图片上传
   beforeUpload(e){
     console.log(e)
@@ -141,42 +169,7 @@ Page({
       }
     })
   },
-  //上传文件
-  // uploadFile(){
-  //   const that = this;  
-  //   wx.chooseMessageFile({  
-  //     count: 1, // 默认9,表示一次最多可以选择的文件个数  
-  //     type: 'file', // 可以指定是文件  
-  //     success(res) {  
-  //       console.log(res)
-  //       var obj = res.tempFiles[0]
-  //       var data = that.data.fileList
-  //       data.push(obj)
-  //       // that.setData(
-  //       //   {
-  //       //     fileList:data
-  //       //   }
-  //       // )
-  //       // 返回选定文件的本地文件路径列表,tempFilePath可以作为文件上传的标识  
-  //       const tempFilePaths = obj.path;  
-  //       upload.upload(tempFilePaths).then(res=>{
-  //         if(res.code == 200){
-  //           var arr = that.data.form.fileGuids
-  //           if(!arr){
-  //             arr = []
-  //           }
-  //           arr.push(res.data[0])
-  //           that.setData(
-  //             {
-  //               ["form.fileGuids"]:arr,
-  //               fileList:data
-  //             }
-  //           )
-  //         }
-  //       })
-  //     }  
-  //   }); 
-  // },
+  
   //输入备注
   changRemark(e){
     this.setData(
@@ -185,14 +178,7 @@ Page({
       }
     )
   },
-  //修改专利无法导出?
-  onChange(e){
-    this.setData(
-      {
-        ["form.patentExport"]:e.detail
-      }
-    )
-  },
+
   //提交工单
   submit(){
     var key = api.isLogin()
@@ -211,6 +197,11 @@ Page({
           ...this.data.form,
           fileGuids:fileGuids
         }
+        if(this.data.funType == '监控'){
+          this.addMonitoring(params)
+          return
+        }
+
         wx.showLoading({
           title: '加载中',
         })
@@ -223,21 +214,7 @@ Page({
                 icon: 'success',
                 duration: 2000
               })
-              var pages = getCurrentPages()
-              var prepage = pages[pages.length-2]
-              var product = {
-                concernType : params.concernType,
-                id:res.data[0],
-                key:params.searchCondition,
-                filePath:that.data.fileList[0]?.url
-              }
-              prepage.setData({
-                product : product,
-                showDialog:false,
-                followType:null,
-              })
-              prepage.collectPatent()
-              wx.navigateBack()
+             that.updateMessage(params,res.data[0])
             }
           })
         )
@@ -262,7 +239,38 @@ Page({
       }
     })
   },
-
+  //修改上一页信息
+  updateMessage(params,id){
+    var pages = getCurrentPages()
+    var prepage = pages[pages.length-2]
+    var product = {
+      concernType : params.concernType,
+      id:id,
+      key:params.searchCondition,
+      filePath:this.data.fileList[0]?.url
+    }
+    prepage.setData({
+      product : product,
+      showDialog:false,
+      followType:null,
+    })
+    prepage.collectPatent()
+    wx.navigateBack()
+  },
+  //监控产品接口
+  addMonitoring(product){
+    wx.showLoading({
+      title: '加载中',
+    })
+    api.addMonitoring(product).then(res=>{
+      wx.showToast({
+        title: '监控成功',
+        icon: 'success',
+        duration: 2000
+      })
+      this.updateMessage(params,res.data[0])
+    })
+  },
 
 
   /**

+ 13 - 0
pages/form/addProduct/addProduct.wxml

@@ -20,6 +20,19 @@
           <wux-input  placeholder="请输入产品名称" />
         </my-form-item>
       </wux-field>
+      <block wx:if="{{funType == '监控'}}">
+        <wux-field name="concernType" initialValue="{{''}}">
+          <my-form-item labelWidth="{{labelWidth}}" required custom-class="form_label">
+            <view slot="label" >
+              关注类型
+            </view>
+            <van-radio-group value="{{ form.concernType }}" bind:change="changeConcernType" >
+                <van-radio wx:for="{{concernType}}" wx:key="index" name="{{item.type}}">{{item.label}}</van-radio>
+            </van-radio-group>
+          </my-form-item>
+        </wux-field>
+      </block>
+      
       <wux-field name="searchCondition" initialValue="{{form.searchCondition}}">
         <my-form-item labelWidth="{{labelWidth}}" custom-class="form_label">
           <view slot="label" >

+ 1 - 1
pages/index/index.wxss

@@ -45,7 +45,7 @@ page {
   position: fixed !important;
   top: 0 !important;
   width: 100%;
-  z-index: 999;
+  z-index: 998;
 }
 
 .foot{

+ 80 - 2
pages/monitor/monitor.js

@@ -12,6 +12,12 @@ Page({
       size:10
     },
     total:0,
+    menu:[
+      {
+        label:'监控记录',
+        method:'monitoringRecord'
+      }
+    ],
     triggered:false,
     load:false,
     hasMore:true
@@ -66,8 +72,55 @@ Page({
     })
     this.init()
   },
-  //获取关注的产品
-  getMyMonitor(){},
+  //获取监控产品
+  getMyMonitor(type){
+    var params = {
+      ...this.data.queryParams
+    }
+    wx.showLoading({
+      title: '加载中',
+    })
+    api.selectMonitoring(params).then(res=>{
+      if(res.code == 200){
+        var data = this.data.tableData
+        wx.hideLoading()
+        if(type){
+            var startIndex = (this.data.queryParams.current-1)*this.data.queryParams.size
+            var endIndex = data.length
+            var len = endIndex - startIndex
+            data.splice(startIndex,len,...res.data.data)
+        }else{
+            data = data.concat(res.data.data)
+        }
+        this.setData(
+          {
+            tableData:data,
+            total:res.data.total,
+            triggered: false,
+            load:false
+          }
+        )
+        if(this.data.total<=data.length){
+          this.setData({
+            hasMore:false
+          })
+        }
+        api.notify(
+          {
+            type:'success',
+            message:'查询成功',
+            top:wx.getStorageSync('height')
+          }
+        )
+      }
+    }).catch(error=>{
+      wx.hideLoading()
+      this.setData({
+        triggered: false,
+        load:false
+      })
+    })
+  },
   //加载更多
   loadMore(){
     var current = this.data.queryParams.current
@@ -79,6 +132,31 @@ Page({
     )
     this.getMyMonitor()
   },
+  //取消监控
+  bindcancelMonitoring(e){
+    var index = e.detail
+    var data = this.data.tableData
+    data.splice(index,1)
+    this.setData(
+      {
+        tableData:data
+      }
+    )
+    this.getMyMonitor(1)
+  },
+  //按钮菜单点击事件
+  click(e){
+    var {method,params} = e.detail
+    this[method](params)
+  },
+  //查看监控结果
+  monitoringRecord(params){
+    var index = params.index
+    var id = this.data.tableData[index].id
+    wx.navigateTo({
+      url: '/pages/monitor/monitoringRecord?id='+id,
+    })
+  },
 
 
 

+ 1 - 1
pages/monitor/monitor.wxml

@@ -8,7 +8,7 @@
   </view>
   <view class="main">
     <my-scroll-view wx:if="{{tableData.length>0}}" triggered="{{triggered}}" load="{{load}}" hasMore="{{hasMore}}" bindonRefresh="onRefresh" bindloadMore="loadMore" customStyle="height: calc(100vh - 300rpx)">
-      <myProduct tableData="{{tableData}}"></myProduct>
+      <myProduct tableData="{{tableData}}" menu="{{menu}}" bindclick="click"></myProduct>
     </my-scroll-view>
     <van-empty wx:else description="暂无数据" />
   </view>

+ 170 - 0
pages/monitor/monitoringRecord.js

@@ -0,0 +1,170 @@
+// pages/monitor/monitoringRecord.js
+const api = require('../../api/index')
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    tableData:[],
+    queryParams:{
+      current:1,
+      size:10
+    },
+    total:0,
+    triggered:false,
+    load:false,
+    hasMore:true,
+    id:null
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    var id = options.id
+    this.setData({
+      id:id
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+    this.init()
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 页面功能
+   */
+  //初始化加载
+  init(){
+    var params = {
+      current:1,
+      size:10
+    }
+    this.setData(
+      {
+        queryParams:params,
+        total:0,
+        tableData:[],
+        hasMore:true
+      }
+    )
+    this.getMyMonitorRecord()
+  },
+
+  //下拉刷新
+  onRefresh() {
+    console.log('onRefresh')
+    this.setData({
+      triggered: true,
+    })
+    this.init()
+  },
+  //获取监控产品
+  getMyMonitorRecord(){
+    var params = {
+      ...this.data.queryParams,
+      id:this.data.id
+    }
+    wx.showLoading({
+      title: '加载中',
+    })
+    api.selectMonitoring(params).then(res=>{
+      if(res.code == 200){
+        var data = this.data.tableData
+        if(type){
+            var startIndex = (this.data.queryParams.current-1)*this.data.queryParams.size
+            var endIndex = data.length
+            var len = endIndex - startIndex
+            data.splice(startIndex,len,...res.data.data)
+        }else{
+            data = data.concat(res.data.data)
+        }
+        this.setData(
+          {
+            tableData:data,
+            total:res.data.total,
+            triggered: false,
+            load:false
+          }
+        )
+        if(this.data.total<=data.length){
+          this.setData({
+            hasMore:false
+          })
+        }
+        api.notify(
+          {
+            type:'success',
+            message:'查询成功',
+            top:wx.getStorageSync('height')
+          }
+        )
+      }
+    }).catch(error=>{
+      wx.hideLoading()
+      this.setData({
+        triggered: false,
+        load:false
+      })
+    })
+  },
+  //加载更多
+  loadMore(){
+    var current = this.data.queryParams.current
+    this.setData(
+      {
+        ['queryParams.current']:current+1,
+        load:true
+      }
+    )
+    this.getMyMonitorRecord()
+  },
+
+
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 7 - 0
pages/monitor/monitoringRecord.json

@@ -0,0 +1,7 @@
+{
+  "navigationStyle": "custom",
+  "usingComponents": {
+    "navBar": "/myComponents/navBar/navBar",
+    "van-steps": "/miniprogram_npm/@vant/weapp/steps/index"
+  }
+}

+ 22 - 0
pages/monitor/monitoringRecord.wxml

@@ -0,0 +1,22 @@
+<!--pages/monitor/monitoringRecord.wxml-->
+<navBar></navBar>
+<van-notify id="van-notify" />
+
+<view class="monitoringRecord">
+  <view class="headTitle head">
+    监控记录
+  </view>
+  <view class="main">
+    <my-scroll-view wx:if="{{tableData.length>0}}" triggered="{{triggered}}" load="{{load}}" hasMore="{{hasMore}}" bindonRefresh="onRefresh" bindloadMore="loadMore" customStyle="height: calc(100vh - 300rpx)">
+      <view class="content">
+        <van-steps
+          steps="{{ tableData }}"
+          active="{{ tableData.length }}"
+          direction="vertical"
+          active-color="#ee0a24"
+        />
+      </view>
+    </my-scroll-view>
+    <van-empty wx:else description="暂无数据" />
+  </view>
+</view>

+ 12 - 0
pages/monitor/monitoringRecord.wxss

@@ -0,0 +1,12 @@
+/* pages/monitor/monitoringRecord.wxss */
+.head{
+  margin: 0 25rpx;
+}
+
+.main{
+  margin-top: 15rpx;
+}
+
+.content{
+  padding: 0 25rpx;
+}

+ 6 - 0
pages/myFollow/myFollow.js

@@ -7,6 +7,12 @@ Page({
    * 页面的初始数据
    */
   data: {
+    menu:[
+      {
+        label:'收藏的专利',
+        method:'selectCollectPatent'
+      }
+    ],
     queryParams:{
       current:1,
       size:10

+ 1 - 1
pages/myFollow/myFollow.wxml

@@ -17,7 +17,7 @@
   </view>
   <view class="main myFollow">
     <my-scroll-view wx:if="{{tableData.length>0}}" triggered="{{triggered}}" load="{{load}}" hasMore="{{hasMore}}" bindonRefresh="onRefresh" bindloadMore="loadMore" customStyle="height: calc(100vh - 320rpx)">
-      <myProduct tableData="{{tableData}}" isFollow="{{true}}" bindcancelFollow="cancelFollow"></myProduct>
+      <myProduct tableData="{{tableData}}" isFollow="{{true}}" menu="{{menu}}" bindcancelFollow="cancelFollow"></myProduct>
     </my-scroll-view>
     <van-empty wx:else description="暂无数据" />
   </view>

+ 134 - 16
pages/searchResults/searchResults.js

@@ -50,7 +50,8 @@ Page({
     isAdd:false,
     triggered:false,
     load:false,
-    hasMore:true
+    hasMore:true,
+    clickType:null,//1是关注,2是监控
   },
 
   /**
@@ -318,10 +319,11 @@ Page({
   },
 
   //关注产品
-  open(){
+  open(clickType=1){
     this.setData(
       {
-        showDialog:true
+        showDialog:true,
+        clickType:clickType
       }
     )
   },
@@ -369,23 +371,17 @@ Page({
     var that = this
     if(this.data.searchType == 0){
       console.log(1)
-      wx.navigateTo({
-        url: `/pages/form/addProduct/addProduct`,
-        success: function(res) {
-          // 通过eventChannel向被打开页面传送数据
-          var data = {
-            ...that.data.product,
-            concernType:that.data.followType
-          }
-          res.eventChannel.emit('acceptDataFromOpenerPage', data)
-        }
-      })
+      this.toImproveInformation('关注')
       return false
     }
     var params = {
       productId:this.data.product.id,
       concernType:this.data.followType
     }
+    if(this.data.clickType == 2){
+      this.addMonitoring(params,this.data.followType)
+      return
+    }
     wx.showLoading({
       title: '加载中',
     })
@@ -402,11 +398,26 @@ Page({
           ['product.concernType'] : that.data.followType,
         })
         that.closeDialog()
-        // console.log(that.data.isAdd,this.data.patentNoList)
         this.collectPatent()
       }
     })
   },
+  //跳转填写产品信息
+  toImproveInformation(method){
+    var that = this
+    wx.navigateTo({
+      url: `/pages/form/addProduct/addProduct`,
+      success: function(res) {
+        // 通过eventChannel向被打开页面传送数据
+        var data = {
+          ...that.data.product,
+          concernType:that.data.followType,
+          method:method
+        }
+        res.eventChannel.emit('acceptDataFromOpenerPage', data)
+      }
+    })
+  },
 //收藏专利
 collectPatent(){
   if(this.data.isAdd ){
@@ -472,7 +483,6 @@ collectPatent(){
   },
  //监控
  control(e){
-  // var index = e.currentTarget.dataset.index
   wx.showModal({
     title: '提示',
     content: '敬请期待!',
@@ -481,7 +491,115 @@ collectPatent(){
       if (res.confirm) {}
     }
   })
+  if(this.data.searchType == 0 ){
+    this.toImproveInformation('监控')
+    return
+  }
+  if(this.data.product.concernType == 0 || this.data.product.concernType){
+    wx.showModal({
+      title: '提示',
+      content: '是否确定监控该产品?',
+      complete: (res) => {
+        if (res.cancel) {}
+        if (res.confirm) {
+          var params = {
+            productId:this.data.product.id
+          }
+          this.addMonitoring(params)
+        }
+      }
+    })
+    retrun 
+  }
+  this.open(2)
+},
+//监控产品接口
+addMonitoring(product,type){
+  wx.showLoading({
+    title: '加载中',
+  })
+  api.addMonitoring(product).then(res=>{
+    var obj = {
+      type: 'success', 
+      message: '监控成功',
+    }
+    if(this.properties.isFollow){
+      obj.top = wx.getStorageSync('height')
+    }
+    api.notify(obj)
+    this.setData(
+      {
+        showDialog:false,
+      }
+    )
+    if(type == 0 || type){
+      this.setData({
+        ['product.concernType'] : type,
+      })
+    }
+  })
 },
+
+ //取消监控产品接口
+ cancelMonitoring(params,type){
+  wx.showLoading({
+    title: '取消中',
+  })
+  api.cancelMonitoring(params).then(res=>{
+    if(res.code == 200){
+      var obj = {
+        type: 'success', 
+        message: '取消监控成功',
+      }
+      if(this.properties.isFollow){
+        obj.top = wx.getStorageSync('height')
+      }
+      api.notify(obj)
+      this.setData(
+        {
+          ["product.iscon"]:false
+        }
+      )
+      if(type == 1){
+        this.setData(
+          {
+            ["product.concernType"]:null
+          }
+        )
+      }
+    }
+  })
+},
+cancelControl(){
+  var product = this.data.product
+  var params = {
+    productIds:[product.id],
+    ifCancelConcern:false
+  }
+  wx.showActionSheet({
+    itemList: ['只取消监控', '取消监控和关注', '关闭'],
+    success (res) {
+      console.log(res.tapIndex)
+      switch(res.tapIndex){
+        case 0:
+          this.cancelMonitoring(params,0)
+          break;
+        case 1:
+          params.ifCancelConcern = true
+          this.cancelMonitoring(params,1)
+          break;
+        case 2:
+          break
+      }
+    },
+    fail (res) {
+      console.log(res.errMsg)
+    }
+  })
+
+},
+
+
 //点击button
 onClick(e){
   console.log(e)

+ 7 - 7
pages/searchResults/searchResults.wxml

@@ -55,13 +55,13 @@
         <wux-ellipsis class="head_left_title" wx:if="{{product.name}}" direction="end" content="产品名称:{{ product.name }}"/>
       <!-- <text wx:if="{{product.name}}">产品名称:{{product.name}}</text> -->
       </view>
-      <view wx:if="{{product.concernType == 0 || product.concernType}}" class="product_icon">
-        <view  class="iconfont {{concernType[product.concernType]}}" style="font-size: 50rpx;" catch:tap="cancelFollow"></view>
-        <view  class="iconfont myIconmonitor" data-index="{{index}}" catch:tap="control"></view>
-      </view>
-      <view wx:else class="product_icon">
-        <view class="iconfont myIconguanzhu" data-index="{{index}}" bind:tap="open"></view>
-        <view class="iconfont myIconmonitor" data-index="{{index}}" bind:tap="control"></view>
+
+      <view class="product_icon">
+        <view wx:if="{{product.concernType == 0 || product.concernType}}" class="iconfont {{concernType[product.concernType]}}" style="font-size: 50rpx;" catch:tap="cancelFollow"></view>
+        <view wx:else class="iconfont myIconguanzhu" bind:tap="open"></view>
+
+        <view wx:if="{{!product.iscon}}" class="iconfont myIconmonitor" catch:tap="control"></view>
+        <view wx:else class="iconfont myIcona-yijiankong2x" catch:tap="cancelControl"></view>
       </view>
     </view>
     <view>

TEMPAT SAMPAH
static/icon/14.png


TEMPAT SAMPAH
static/icon/a-yijiankong2x.png


TEMPAT SAMPAH
static/icon/anquanbangzhu.png


TEMPAT SAMPAH
static/icon/dajiaduzaimai-copy.png


TEMPAT SAMPAH
static/icon/dajiaduzaimai.png


TEMPAT SAMPAH
static/icon/daochu.png


TEMPAT SAMPAH
static/icon/fanhui.png


TEMPAT SAMPAH
static/icon/gongdan.png


TEMPAT SAMPAH
static/icon/group43.png


TEMPAT SAMPAH
static/icon/guanzhu.png


TEMPAT SAMPAH
static/icon/icon-test.png


TEMPAT SAMPAH
static/icon/monitor.png


TEMPAT SAMPAH
static/icon/rengongkefu.png


TEMPAT SAMPAH
static/icon/renyuan.png


TEMPAT SAMPAH
static/icon/sangedian-type-1.png


TEMPAT SAMPAH
static/icon/shangchuan.png


TEMPAT SAMPAH
static/icon/sousuo.png


TEMPAT SAMPAH
static/icon/weibiaoti-_huabanfuben.png


TEMPAT SAMPAH
static/icon/wode-copy.png


TEMPAT SAMPAH
static/icon/wode.png


TEMPAT SAMPAH
static/icon/zhaoxiangji.png


TEMPAT SAMPAH
static/icon/zhuye-copy.png


TEMPAT SAMPAH
static/icon/zhuye.png


TEMPAT SAMPAH
static/icon/zhuye1.png


File diff ditekan karena terlalu besar
+ 18 - 2
static/iconfont/iconfont.wxss


+ 1 - 1
utils/request.js

@@ -15,7 +15,7 @@ const config = {
   tabbar:["pages/index/index","pages/hotProduct/hotProduct","pages/mine/mine"]
 };  
 const apiUrl = {  
-  develop: 'https://www.xsip.cn', // 开发环境地址  
+  develop: 'http://192.168.2.113:8902', // 开发环境地址  
   trial: 'https://www.xsip.cn/test', // 测试环境地址  
   release: 'https://www.xsip.cn' // 生产环境地址  
 };