|
@@ -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(){
|