|
@@ -472,7 +472,13 @@
|
|
|
this.httpUrl = 'http://test.wefanbot.com:18993'
|
|
this.httpUrl = 'http://test.wefanbot.com:18993'
|
|
|
}
|
|
}
|
|
|
localStorage.removeItem('openId')
|
|
localStorage.removeItem('openId')
|
|
|
- this.ifH5Type()
|
|
|
|
|
|
|
+ if (this.isWeChatBrowser()) {
|
|
|
|
|
+ // 微信浏览器
|
|
|
|
|
+ this.ifH5Type()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 不是微信浏览器
|
|
|
|
|
+ this.lightenShare()
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
this.clearIntervalTask() // 在组件销毁前清除定时任务
|
|
this.clearIntervalTask() // 在组件销毁前清除定时任务
|
|
@@ -622,11 +628,11 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
lightenShare () {
|
|
lightenShare () {
|
|
|
- let externalUserid = this.getQueryParam('externalUserid')
|
|
|
|
|
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
|
|
|
|
|
|
|
+ let externalUserid = this.getQueryParam('externalUserid') || ''
|
|
|
|
|
+ let openId = this.getQueryParam('openId') || localStorage.getItem('openId') || ''
|
|
|
const headers = new Headers();
|
|
const headers = new Headers();
|
|
|
headers.append('police', 110);
|
|
headers.append('police', 110);
|
|
|
- fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-share/p/lottery?externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
|
|
|
|
|
|
|
+ fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-share/p/lottery?clientId=${localStorage.getItem('bkClientId') || ''}&externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
headers: headers
|
|
headers: headers
|
|
|
})
|
|
})
|
|
@@ -636,6 +642,9 @@
|
|
|
let { data, code, msg } = result
|
|
let { data, code, msg } = result
|
|
|
if (code === 1) {
|
|
if (code === 1) {
|
|
|
this.toshopData = data
|
|
this.toshopData = data
|
|
|
|
|
+ if (!this.isWeChatBrowser()) {
|
|
|
|
|
+ localStorage.setItem('bkClientId', data.client.id)
|
|
|
|
|
+ }
|
|
|
this.getCityLevel()
|
|
this.getCityLevel()
|
|
|
if (data.client.state === 1) {
|
|
if (data.client.state === 1) {
|
|
|
// 未提交表单
|
|
// 未提交表单
|
|
@@ -678,7 +687,7 @@
|
|
|
}, 10000); // 每10秒调用一次
|
|
}, 10000); // 每10秒调用一次
|
|
|
},
|
|
},
|
|
|
sendDataToServer(browseId, elapsedTime) {
|
|
sendDataToServer(browseId, elapsedTime) {
|
|
|
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
|
|
|
|
|
|
|
+ let openId = this.getQueryParam('openId') || localStorage.getItem('openId') || ''
|
|
|
fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-client-browse-history/p/updateBrowseDuration?openId=${openId}`, {
|
|
fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-client-browse-history/p/updateBrowseDuration?openId=${openId}`, {
|
|
|
method: 'post',
|
|
method: 'post',
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
@@ -733,9 +742,9 @@
|
|
|
value: item.type === 10 ? [item.value.join('')] : [item.value],
|
|
value: item.type === 10 ? [item.value.join('')] : [item.value],
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
|
|
|
|
|
|
|
+ let openId = this.getQueryParam('openId') || localStorage.getItem('openId') || ''
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
- fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-share/p/formData?openId=${openId}`, {
|
|
|
|
|
|
|
+ fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-share/p/formData?clientId=${localStorage.getItem('bkClientId') || ''}&openId=${openId}`, {
|
|
|
method: 'post',
|
|
method: 'post',
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
bid: this.bId,
|
|
bid: this.bId,
|
|
@@ -774,7 +783,7 @@
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
- }).fiqually(() => {
|
|
|
|
|
|
|
+ }).finally(() => {
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -842,6 +851,11 @@
|
|
|
// 返回指定参数的值,如果不存在则返回null
|
|
// 返回指定参数的值,如果不存在则返回null
|
|
|
return urlParams.get(paramName);
|
|
return urlParams.get(paramName);
|
|
|
},
|
|
},
|
|
|
|
|
+ // 判断当前是否为微信浏览器
|
|
|
|
|
+ isWeChatBrowser() {
|
|
|
|
|
+ const ua = navigator.userAgent.toLowerCase();
|
|
|
|
|
+ return ua.includes('micromessenger');
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|