|
@@ -1,6 +1,6 @@
|
|
|
// 统计Ross 用户
|
|
|
import Vue from 'vue'
|
|
|
-import { includeList , roosConfig } from './router.config.js' // 配置信息
|
|
|
+import { includeList } from './router.config.js' // 配置信息
|
|
|
// 参数
|
|
|
const defaultParams = {
|
|
|
accessClient: 1, // 来源 0 网站 1 小程序
|
|
@@ -16,90 +16,108 @@ const defaultParams = {
|
|
|
const cmSrsMixins = {
|
|
|
data() {
|
|
|
return {
|
|
|
- handleProsId: 0,
|
|
|
- handleShopId: 0,
|
|
|
+ handleProsId: '',
|
|
|
+ handleShopId: '',
|
|
|
handleProsKey: '',
|
|
|
handleShopKey: '',
|
|
|
showRossHtml: false,
|
|
|
- isDisabled: true
|
|
|
+ isDisabled: true,
|
|
|
+ advertisement:{},// 弹窗广告信息
|
|
|
+ popUpParams: {
|
|
|
+ shopId: '',
|
|
|
+ productId: '',
|
|
|
+ infoId: '',
|
|
|
+ keyword: ''
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
checkedIsRossSet() {
|
|
|
- if (roosConfig.productIdList.includes(this.handleProsId * 1) ||
|
|
|
- roosConfig.shopIds.includes(this.handleShopId * 1) ||
|
|
|
- roosConfig.keyWords.includes(this.handleProsKey) ||
|
|
|
- roosConfig.shopKeyWords.includes(this.handleShopKey)
|
|
|
- ) {
|
|
|
+ if (this.handleProsId || this.handleShopId || this.handleProsKey || this.handleShopKey) {
|
|
|
+ this.popUpParams.shopId = this.handleShopId
|
|
|
+ this.popUpParams.productId = this.handleProsId
|
|
|
+ this.popUpParams.keyword = this.handleProsKey ? this.handleProsKey : '' || this.handleShopKey ? this.handleShopKey : ''
|
|
|
uni.setStorageSync('behaviorType', 2)
|
|
|
this.setingSysParams()
|
|
|
if (!this.hasLogin) {
|
|
|
this.userInformationIsClick()
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.setingSysParams()
|
|
|
}
|
|
|
},
|
|
|
// 接口参数设置
|
|
|
- async setingSysParams(){
|
|
|
- const sysParams = Object.assign({}, defaultParams)
|
|
|
- const userSync = uni.getStorageSync('userInfo')
|
|
|
+ async setingSysParams() {
|
|
|
+ const sysParams = Object.assign({}, defaultParams)
|
|
|
+ const userSync = uni.getStorageSync('userInfo')
|
|
|
const route = this.getPath()
|
|
|
- const pageData = this.isIncludeType(route.path)
|
|
|
- // 协销不记录
|
|
|
- if (userSync.userIdentity === 1) return
|
|
|
- // 参数设置
|
|
|
- sysParams.userId = userSync.userId ? userSync.userId : 0
|
|
|
- sysParams.pagePath = route.fullPath
|
|
|
- sysParams.pageType = pageData ? pageData.pageType : ''
|
|
|
- sysParams.behaviorType = uni.getStorageSync('behaviorType') ? uni.getStorageSync('behaviorType') : 1
|
|
|
- // 根据path获取不同的参数
|
|
|
+ const pageData = this.isIncludeType(route.path)
|
|
|
+ // 协销不记录
|
|
|
+ if (userSync.userIdentity === 1) return
|
|
|
+ // 参数设置
|
|
|
+ sysParams.userId = userSync.userId ? userSync.userId : 0
|
|
|
+ sysParams.pagePath = route.fullPath
|
|
|
+ sysParams.pageType = pageData ? pageData.pageType : ''
|
|
|
+ sysParams.behaviorType = uni.getStorageSync('behaviorType') ? uni.getStorageSync('behaviorType') : 1
|
|
|
+ // 根据path获取不同的参数
|
|
|
if (route.path === '/pages/supplier/user/my-shop') {
|
|
|
- sysParams.shopId = route.query.shopId ? route.query.shopId : 0
|
|
|
- }
|
|
|
+ sysParams.shopId = route.query.shopId ? route.query.shopId : 0
|
|
|
+ }
|
|
|
if (route.path === '/pages/goods/product') {
|
|
|
- sysParams.productId = route.query.id ? route.query.id : 0
|
|
|
- sysParams.pageLabel = uni.getStorageSync('productLabel')
|
|
|
+ sysParams.productId = route.query.id ? route.query.id : 0
|
|
|
+ sysParams.pageLabel = uni.getStorageSync('productLabel')
|
|
|
} else {
|
|
|
- sysParams.pageLabel = uni.getStorageSync('pageLabel') ? uni.getStorageSync('pageLabel') : pageData.pageLabel
|
|
|
+ sysParams.pageLabel = uni.getStorageSync('pageLabel') ? uni.getStorageSync('pageLabel') :
|
|
|
+ pageData.pageLabel
|
|
|
}
|
|
|
- console.log('记录路径:', sysParams.pagePath, '标签:', sysParams.pageLabel)
|
|
|
- // 统计接口调用
|
|
|
- this.userRecordStatistics(sysParams)
|
|
|
- console.log('---用户行为轨迹记录成功---')
|
|
|
+ console.log('记录路径:', sysParams.pagePath, '标签:', sysParams.pageLabel)
|
|
|
+ // 统计接口调用
|
|
|
+ this.userRecordStatistics(sysParams)
|
|
|
+ console.log('---用户行为轨迹记录成功---')
|
|
|
},
|
|
|
- userRecordStatistics(params){
|
|
|
+ userRecordStatistics(params) {
|
|
|
// 上送
|
|
|
this.UserService.userRecordStatistics(params)
|
|
|
- .then(response => {
|
|
|
- console.log('---用户行为轨迹记录成功---')
|
|
|
+ .then(response => {
|
|
|
+ console.log('---用户行为轨迹记录成功---')
|
|
|
uni.removeStorageSync('pageLabel')
|
|
|
uni.removeStorageSync('behaviorType')
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.log('---用户行为轨迹记录失败---')
|
|
|
- })
|
|
|
- },
|
|
|
- userInformationIsClick() {
|
|
|
- // 查看用户是否有过弹框游客当天是否有过弹框
|
|
|
- this.UserService.userInformationIsClick()
|
|
|
- .then(response => {
|
|
|
- if (response.data) {
|
|
|
- setTimeout(() => {
|
|
|
- this.showRossHtml = true
|
|
|
- }, 5000)
|
|
|
- }
|
|
|
})
|
|
|
.catch(error => {
|
|
|
- console.log('查询失败~')
|
|
|
+ console.log('---用户行为轨迹记录失败---')
|
|
|
})
|
|
|
},
|
|
|
- isIncludeType(url){
|
|
|
+ async userInformationIsClick() {
|
|
|
+ // 查看用户是否有过弹框游客当天是否有过弹框
|
|
|
+ try {
|
|
|
+ const res = await this.UserService.userInformationIsClick(this.popUpParams)
|
|
|
+ if (res.data) {
|
|
|
+ this.getUserPopUpInfo()
|
|
|
+ setTimeout(() => {
|
|
|
+ this.showRossHtml = true
|
|
|
+ }, 5000)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('查询失败~')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getUserPopUpInfo() {
|
|
|
+ // 获取供应商广告弹窗信息
|
|
|
+ try {
|
|
|
+ const res = await this.UserService.getUserPopUpInfo(this.popUpParams)
|
|
|
+ const data = res.data
|
|
|
+ this.advertisement = data
|
|
|
+ this.consultParams.shopId = data.shopId
|
|
|
+ } catch (error) {
|
|
|
+ console.log('获取失败~')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isIncludeType(url) {
|
|
|
// 校验返回页面类型
|
|
|
- if (!url) return false
|
|
|
- return includeList.find(item => url === item.url)
|
|
|
+ if (!url) return false
|
|
|
+ return includeList.find(item => url === item.url)
|
|
|
},
|
|
|
- getPath(){
|
|
|
+ getPath() {
|
|
|
// 获取路径
|
|
|
const pages = getCurrentPages()
|
|
|
const len = pages.length
|
|
@@ -110,4 +128,4 @@ const cmSrsMixins = {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export default cmSrsMixins
|
|
|
+export default cmSrsMixins
|