ソースを参照

commit 用户行为记录

zhengjinyi 2 年 前
コミット
e15a24686e

+ 0 - 1
pages/goods/good-hot.vue

@@ -311,7 +311,6 @@ export default{
 			this.listQuery.userId = userInfo.userId ? userInfo.userId : 0
 			this.vipFlag = userInfo.vipFlag ? userInfo.vipFlag : 0
 			this.userIdentity = userInfo.userIdentity ? userInfo.userIdentity : 0
-			uni.setStorageSync('pageLabel','新品')
 			this.GetHomeRecommend()
 			this.GetHomeNewBrandNames()
 			this.GetHomeNewFloorList()

+ 0 - 1
pages/second/form/form.vue

@@ -581,7 +581,6 @@
 		},
 		onShow() {
 			this.getBrandList()
-			uni.setStorageSync('pageLabel','发布二手')
 			this.$api.getComStorage('userInfo').then((resolve) =>{
 				this.userIdentity = resolve.userIdentity
 				console.log(this.userIdentity)

+ 1 - 1
pages/second/product/product-list.vue

@@ -298,7 +298,7 @@
 			}
 		},	
 		onShow() {
-		   uni.setStorageSync('pageLabel', `二手市场`)
+			
 		}
 	}
 </script>

+ 0 - 1
pages/supplier/user/my-shop.vue

@@ -475,7 +475,6 @@ export default {
 			wxLogin.wxLoginAuthorize()
 		}
 		this.listQuery.id = this.supplierId = this.handleShopId = option.shopId
-		uni.setStorageSync('pageLabel','供应商主页')
 		this.initGetStotage()
 	},
 	filters: {

+ 0 - 1
pages/tabBar/home/index.vue

@@ -297,7 +297,6 @@ export default {
 	},
 	onHide() {
 		this.autoplay = false
-		uni.setStorageSync('pageLabel','首页')
 	}
 }
 </script>

+ 2 - 2
services/config.env.js

@@ -4,8 +4,8 @@ if(process.env.NODE_ENV === 'development'){
     // URL_CONFIG = 'http://192.168.2.67:18002'	 //智捷联调地址
     // URL_CONFIG = 'http://192.168.2.68:18002'	 //涛涛联调地址
     // URL_CONFIG = 'http://192.168.2.17:18002' //志国联调地址
-    // URL_CONFIG = 'https://core-b.caimei365.com'
-    URL_CONFIG = 'https://core.caimei365.com'  
+    URL_CONFIG = 'https://core-b.caimei365.com'
+    // URL_CONFIG = 'https://core.caimei365.com'  
 }else{
     // 生产环境
     // URL_CONFIG = 'https://core-b.caimei365.com'

+ 1 - 1
services/user.service.js

@@ -861,7 +861,7 @@ export default class UserService {
 	 */
     userRecordStatistics(data = {}) {
 	    return this.AjaxService.get({
-	        url: '/user/record/StatisticsApp',
+	        url: '/user/record/Statistics',
 	        data,
 	        isLoading: false,
 	    }) 

+ 24 - 22
utils/residence.js

@@ -16,6 +16,7 @@ const isIncludeType = (url) => {
 
 // 参数
 const defaultParams = {
+    accessClient: 1, // 来源 0 网站 1 小程序
     pagePath: '', //页面路径
     accessDuration: 0, //浏览时长初始值为 0
     pageType: '', //页面类型
@@ -26,7 +27,8 @@ const defaultParams = {
 }
 
 // 页面进入
-const enter = (current) => {
+const enter = async (current) => {
+    await userBehavior(current)
     current.meta.enterTime = Date.now()
 }
 
@@ -37,24 +39,26 @@ const leave = (prev) => {
 
 // 页面切换
 const routting = async (current, prev) => {
-    await userBehavior(current, prev)
+    // await userBehavior(current, prev)
 	
 }
 
 /* 用户停留时间 */
-async function userBehavior(current, prev) {
+async function userBehavior(current) {
     try {
-        if (process.env.NODE_ENV !== 'production') { return }
-        if (!prev) return
-        if (!isInclude(prev.path)) return
+        // if (process.env.NODE_ENV !== 'production') { return }
+        if (!current) return
+        if (!isInclude(current.path)) return
         console.log('\n')
         console.log('------------------------')
         console.log('当前页面:', current.path)
-        console.log('离开页面:', prev.path)
+        // console.log('离开页面:', prev.path)
         // 接口参数设置
-        setingSysParams(prev)
+        setTimeout(()=>{
+            setingSysParams(current)
+        },1000)
         // 清除设置缓存
-        clearsSysParams(prev)
+        clearsSysParams(current)
         console.log('\n')
         console.log('------------------------')
         console.log('\n')
@@ -63,36 +67,34 @@ async function userBehavior(current, prev) {
         console.log('---用户行为轨迹记录异常---')
     }
 }
-
 // 接口参数设置
-const setingSysParams = async (prev) => {
+const setingSysParams = async (current) => {
     const sysParams = Object.assign({}, defaultParams)
     const userSync = uni.getStorageSync('userInfo')
-    const pageData = isIncludeType(prev.path)
+    const pageData = isIncludeType(current.path)
+    // 协销不记录
+    if (userSync.userIdentity === 1) return
     // 参数设置
     sysParams.userId = userSync.userId ? userSync.userId : 0
-    sysParams.accessDuration = prev.meta.leaveTime - prev.meta.enterTime
-    sysParams.pagePath = prev.fullPath
+    sysParams.pagePath = current.fullPath
     sysParams.pageType = pageData ? pageData.pageType : ''
     sysParams.behaviorType = uni.getStorageSync('behaviorType') ? uni.getStorageSync('behaviorType') : 1
     // 根据path获取不同的参数
-    if (prev.path === '/pages/goods/product' || prev.path === '/pages/second/product/product-details') {
-	    sysParams.productId = prev.query.id ? prev.query.id : 0
+    if (current.path === '/pages/goods/product' || current.path === '/pages/second/product/product-details') {
+	    sysParams.productId = current.query.id ? current.query.id : 0
 	    sysParams.pageLabel = uni.getStorageSync('productLabel')
     } else {
-	    sysParams.pageLabel = uni.getStorageSync('pageLabel')
+	    sysParams.pageLabel = uni.getStorageSync('pageLabel') ? uni.getStorageSync('pageLabel') : pageData.pageLabel
     }
-    console.log('记录路径:', prev.path, '停留时间:', sysParams.accessDuration, 'ms', '标签:', sysParams.pageLabel)
-    // 协销不记录
-    if (userSync.userIdentity === 1) return
+    console.log('记录路径:', sysParams.path, '标签:', sysParams.pageLabel)
     // 统计接口调用
     await UserApi.userRecordStatistics(sysParams)
     console.log('---用户行为轨迹记录成功---')
 }
 
 // 清除设置缓存
-const clearsSysParams = async (prev) => {
-    if (prev.path === '/pages/goods/product' || prev.path === '/pages/second/product/product-details') {
+const clearsSysParams = async (current) => {
+    if (current.path === '/pages/goods/product' || current.path === '/pages/second/product/product-details') {
 	    uni.removeStorageSync('productLabel')
     } else {
 	    uni.removeStorageSync('pageLabel')

+ 51 - 15
utils/router.config.js

@@ -1,19 +1,55 @@
 // 配置需要统计的路径
 export const includeList = [
-    { url:'/pages/tabBar/home/index', pageType:1},
-    { url:'/pages/goods/product', pageType:6},
-    { url:'/pages/goods/good-hot', pageType:2},
-    { url:'/pages/second/form/form', pageType:4},
-    { url:'/pages/second/product/product-list', pageType:3},
-    { url:'/pages/second/product/product-details', pageType:7},
-    { url:'/pages/search/search', pageType:8},
-    { url:'/pages/search/search-supplier', pageType:9 },
-    { url:'/pages/goods/goods-classify', pageType:10 },
-    { url:'/pages/goods/good-floor', pageType:13 },
-    { url:'/pages/goods/goods-instrument', pageType:13 },
-    { url:'/pages/goods/good-floor-temp', pageType:13 },
-    { url:'/pages/h5/activity/activity', pageType:13 },
-    { url:'/pages/h5/activity/activity-topic', pageType:13 },
-    { url:'/pages/supplier/user/my-shop', pageType:14 }
+    {title:'商城首页', url:'/pages/tabBar/home/index',pageLabel:'商城首页', pageType:1},
+    {title:'商品详情', url:'/pages/goods/product',pageLabel:'商品详情', pageType:6},
+    {title:'热门商品', url:'/pages/goods/good-hot',pageLabel:'热门商品', pageType:2},
+    {title:'发布二手', url:'/pages/second/form/form',pageLabel:'发布二手', pageType:4},
+    {title:'二手市场', url:'/pages/second/product/product-list',pageLabel:'二手市场', pageType:3},
+    {title:'二手详情', url:'/pages/second/product/product-details',pageLabel:'二手详情', pageType:7},
+    // {title:'搜索商品', url:'/pages/search/search',pageLabel:'搜索商品', pageType:8},
+    // {title:'搜索供应商', url:'/pages/search/search-supplier',pageLabel:'搜索供应商', pageType:9 },
+    {title:'分类商品列表', url:'/pages/goods/goods-classify',pageLabel:'分类商品列表', pageType:10 },
+    {title:'二级楼层', url:'/pages/goods/good-floor',pageLabel:'二级楼层', pageType:13 },
+    {title:'项目详情', url:'/pages/goods/goods-instrument',pageLabel:'项目详情', pageType:13 },
+    {title:'网页列表', url:'/pages/goods/good-floor-temp',pageLabel:'网页列表', pageType:13 },
+    {title:'活动专题', url:'/pages/h5/activity/activity',pageLabel:'活动专题', pageType:13 },
+    {title:'美博会', url:'/pages/h5/activity/activity-topic',pageLabel:'美博会', pageType:13 },
+    {title:'供应商首页', url:'/pages/supplier/user/my-shop',pageLabel:'供应商首页', pageType:14 },
+    {title:'公告列表', url:'/pages/service/news-list',pageLabel:'公告列表', pageType:15 },
+    {title:'公告详情', url:'/pages/service/news-detailes',pageLabel:'公告详情', pageType:16 },
+    {title:'二手介绍', url:'/pages/second/form/introduce',pageLabel:'二手介绍', pageType:17 },
+    {title:'登录', url:'/pages/login/login',pageLabel:'登录', pageType:21 },
+    {title:'机构注册', url:'/pages/login/register',pageLabel:'机构注册', pageType:22 },
+    {title:'供应商注册', url:'/pages/login/register-supplier',pageLabel:'供应商注册', pageType:23 },
+    {title:'机构个人中心', url:'/pages/tabBar/user/user',pageLabel:'机构个人中心', pageType:25 },
+    {title:'机构编辑资料', url:'/pages/login/information',pageLabel:'机构编辑资料', pageType:26 },
+    {title:'机构站内消息', url:'/pages/tabBar/notice/index',pageLabel:'机构站内消息', pageType:27 },
+    {title:'机构超级会员', url:'/pages/user/member/member',pageLabel:'机构超级会员', pageType:28 },
+    {title:'机构账户余额', url:'/pages/user/account/account',pageLabel:'机构账户余额', pageType:29 },
+    {title:'机构采美豆', url:'/pages/user/account/account-bean',pageLabel:'机构采美豆', pageType:30 },
+    {title:'机构优惠券', url:'/pages/user/coupon/coupon',pageLabel:'机构优惠券', pageType:31 },
+    {title:'机构收藏商品', url:'/pages/user/collection/collection',pageLabel:'机构收藏商品', pageType:32 },
+    {title:'机构订单列表', url:'/pages/user/order/order-list',pageLabel:'机构订单列表', pageType:33 },
+    {title:'机构订单详情', url:'/pages/user/order/order-details',pageLabel:'机构订单详情', pageType:34 },
+    {title:'线下支付', url:'/pages/user/order/order-payunder',pageLabel:'线下支付', pageType:36 },
+    {title:'线上支付', url:'/pages/user/order/order-pay-list',pageLabel:'线上支付', pageType:37 },
+    {title:'线上收银台', url:'/pages/user/order/order-payment',pageLabel:'线上收银台', pageType:38 },
+    {title:'机构收货地址管理', url:'/pages/user/address/address',pageLabel:'机构收货地址管理', pageType:39 },
+    {title:'机构运营人员管理', url:'/pages/user/operator/list',pageLabel:'机构运营人员管理', pageType:40 },
+    {title:'机构购物车', url:'/pages/tabBar/cart/index',pageLabel:'机构购物车', pageType:41 },
+    {title:'机构购物车', url:'/pages/goods/cart',pageLabel:'机构购物车', pageType:41 },
+    {title:'机构重置密码', url:'/pages/login/password',pageLabel:'机构重置密码', pageType:42 },
+    {title:'机构更换手机号', url:'/pages/user/setting/phone',pageLabel:'机构更换手机号', pageType:43 },
+    {title:'供应商个人中心', url:'/pages/supplier/index/index',pageLabel:'供应商个人中心', pageType:44 },
+    {title:'供应商编辑资料', url:'/pages/supplier/user/information',pageLabel:'供应商编辑资料', pageType:45 },
+    {title:'供应商站内消息', url:'/pages/supplier/index/index',pageLabel:'供应商站内消息', pageType:46 },
+    {title:'供应商我的商品', url:'/pages/supplier/user/my-product',pageLabel:'供应商我的商品', pageType:47 },
+    {title:'供应商订单列表', url:'/pages/supplier/order/order-list',pageLabel:'供应商订单列表', pageType:48 },
+    {title:'供应商订单详情', url:'/pages/supplier/order/order-details',pageLabel:'供应商订单详情', pageType:49 },
+    {title:'供应商发货', url:'/pages/supplier/deliver/deliver-goods',pageLabel:'供应商发货', pageType:50 },
+    {title:'添加物流', url:'/pages/supplier/deliver/add-logistics',pageLabel:'添加物流', pageType:51 },
+    {title:'发货记录', url:'/pages/supplier/deliver/deliver-record',pageLabel:'发货记录', pageType:52 },
+    {title:'重置密码', url:'/pages/supplier/user/setting/password',pageLabel:'重置密码', pageType:66 },
+    {title:'更换手机号', url:'/pages/supplier/user/setting/phone',pageLabel:'更换手机号', pageType:67 },
 ]