Commit 2d67bd18 by 杨明

北森

1 parent 2a38b5a9
...@@ -289,5 +289,21 @@ module.exports = { ...@@ -289,5 +289,21 @@ module.exports = {
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
},
//北森埋点进入
dynamicrecordAdd(data) {
return http.post({
method: 'dj.pad.api.beisen.dynamicrecord.add',
projectName: 'pad',
...data
})
},
//更新埋点离开信息
dynamicrecordLeave(data) {
return http.post({
method: 'dj.pad.api.beisen.dynamicrecord.leave',
projectName: 'pad',
...data
})
} }
} }
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
</view> </view>
<view :class="['left-tabs', { three: tabs.length == 3 }]"> <view :class="['left-tabs', { three: tabs.length == 3 }]">
<template v-for="(i, index) in tabs"> <template v-for="(i, index) in tabs">
<view :class="['tab-item', { tabActive: tabIndex == index }]" :key="index" @click="changeIndex(index)"> <view :class="['tab-item', { tabActive: tabIndex == index }]" :key="index" @click="changeIndex(index, i)">
<view class="icon-box"> <view class="icon-box">
<view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view> <view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view>
</view> </view>
{{ i.label }} {{ i.label }}
<view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view> <view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view>
<view class="tip-box" v-if="i.icon == 'study'">待办事项:3</view> <view class="tip-box" v-if="i.icon == 'study' && readCount" @click="readCount = 0">待办事项:{{ readCount }}</view>
</view> </view>
</template> </template>
</view> </view>
...@@ -71,6 +71,7 @@ export default { ...@@ -71,6 +71,7 @@ export default {
{ {
label: "学习中心", label: "学习中心",
icon: "study", icon: "study",
isTrack:true,
name: 'StudyCenter' name: 'StudyCenter'
}, },
], ],
...@@ -80,12 +81,21 @@ export default { ...@@ -80,12 +81,21 @@ export default {
total: 0 total: 0
}, },
messageTotal: 0, messageTotal: 0,
readCount:0,
trackId:0,
trackInterval:null,
collectTrack:false,
hasPerson: false hasPerson: false
} }
}, },
watch: { watch: {
userInfo(n) { userInfo(n) {
if (n.shopMerchantId) this.haveCustomerAccess(n) if (n.shopMerchantId) this.haveCustomerAccess(n)
},
trackId(n) {
if(!n) {
clearInterval(this.trackInterval)
}
} }
}, },
computed: { computed: {
...@@ -100,11 +110,47 @@ export default { ...@@ -100,11 +110,47 @@ export default {
this.getMessageInfo(); this.getMessageInfo();
}); });
this.getMessageInfo() this.getMessageInfo()
this.getUnreadCount()
}, },
inject: ['showPage'], inject: ['showPage'],
methods: { methods: {
changeIndex(index) { getUnreadCount() {
uni.$api.commonApi.getUnreadCount({}).then(res => {
this.readCount = res
})
},
addTrack() {
const { merchantId, merchantName } = uni.$storage.get("userInfo")
const params = {
goodsType: 1,
merchantId,
merchantName
}
uni.$api.commonApi.dynamicrecordAdd(params).then(res=>{
this.trackId = res
})
},
leaveTrack() {
if(!this.trackId) return
uni.$api.commonApi.dynamicrecordLeave({id:this.trackId}).then(res=>{
console.log(res)
})
},
startTrack() {
this.trackInterval = setInterval(()=>{
this.addTrack()
}, 5000)
},
changeIndex(index,item) {
if (this.tabIndex == index) return; if (this.tabIndex == index) return;
if(item.isTrack) {
this.readCount = 0
this.addTrack()
this.startTrack()
}else {
this.leaveTrack()
this.trackId = 0
}
this.$emit('update:tabIndex', index) this.$emit('update:tabIndex', index)
this.$emit("changeTab", index) this.$emit("changeTab", index)
this.getMessageInfo() this.getMessageInfo()
...@@ -170,7 +216,10 @@ export default { ...@@ -170,7 +216,10 @@ export default {
this.$emit('update:tabIndex', 99) this.$emit('update:tabIndex', 99)
} }
} }
} },
beforeCreate() {
clearInterval(this.trackInterval)
},
} }
</script> </script>
......
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
const wv = currentWebview.children()[1] const wv = currentWebview.children()[1]
console.log(wv, 1111) console.log(wv, 1111)
if (wv) { if (wv) {
wv.setStyle({ left: '8%', height: '100%', width: '92%' }) wv.setStyle({ left: '8%', height: '100%', top: '3%', height: '97%', width: '92%' })
} }
}, 100) }, 100)
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!