Commit 7c7b71a3 by 前端

Merge branch 'v2.10.5' of http://192.168.3.233:8090/saas/mini-program/ai-card into v2.10.5

2 parents 07da405d 0ece257b
...@@ -7,6 +7,8 @@ import { ...@@ -7,6 +7,8 @@ import {
wechatApi wechatApi
} from './api/api' } from './api/api'
import {trackData} from './utils/data' import {trackData} from './utils/data'
// //全局分享
// import './utils/share'
import eventbus from './utils/evenbus' import eventbus from './utils/evenbus'
// 实例化对象存储 // 实例化对象存储
......
...@@ -168,7 +168,7 @@ Page({ ...@@ -168,7 +168,7 @@ Page({
name = userInfoObj.merchantName name = userInfoObj.merchantName
} }
this.shareTitle = `${name}给你分享一个活动${senceData[actNum]?.productList[activeNavIdx].proName},戳我参与~`; this.shareTitle = `${name}给你分享一个活动${senceData[actNum]?.productList[activeNavIdx].proName},戳我参与~`;
this.getImgInfo(actNum) // this.getImgInfo(actNum)
this.setData({ this.setData({
actNum, actNum,
...@@ -573,12 +573,14 @@ Page({ ...@@ -573,12 +573,14 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
// let {senceData,actNum,activeNavIdx} = this.data let {senceData,actNum,activeNavIdx,isShare} = this.data
// let product = senceData[actNum]?.productList[activeNavIdx].proName let product = senceData[actNum]?.productList[activeNavIdx].proName
// console.log('product: ', product); console.log('product: ', product);
// return { return {
// title: `给你分享一个活动${product},戳我参与~`, // title: `给你分享一个活动${product},戳我参与~`,
// } title: `给你分享一个活动,戳我参与~`,
path:`/pages/checkProduct/checkProduct?actNum=${actNum}&activeNavIdx=${activeNavIdx}&isShare=${isShare}`
}
}, },
/** /**
* 浏览埋点 * 浏览埋点
......
...@@ -6,6 +6,7 @@ const videoBaseUrl = ...@@ -6,6 +6,7 @@ const videoBaseUrl =
"https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/"; "https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/";
let IMG_URL = wx.$imgUrl let IMG_URL = wx.$imgUrl
import { trackData } from "../../../../utils/data";
Component({ Component({
// behaviors: [imgUrlMixin], // behaviors: [imgUrlMixin],
/** /**
...@@ -56,6 +57,13 @@ Component({ ...@@ -56,6 +57,13 @@ Component({
getMoreBtn: false, getMoreBtn: false,
showVideo: true, //显示视频列表 showVideo: true, //显示视频列表
imgTopArr: [], imgTopArr: [],
trackList: [
['EQUITYCARD'],
['SOLARFILM'],
['PAINTPROTECT', 'CHANGEFILM'],
['CARBEAUTY', 'SEATVENTILATE', 'ARNAVIGATION', 'LIGHT', 'NAVIGATIONARROUND'],
['LOSSPGASE']
]
}, },
lifetimes: { lifetimes: {
ready: function () { ready: function () {
...@@ -135,6 +143,7 @@ Component({ ...@@ -135,6 +143,7 @@ Component({
// "合作案例", // "合作案例",
]; ];
let num = this.data.actNum; let num = this.data.actNum;
console.log(num)
switch (num) { switch (num) {
case 0: case 0:
navList = ["数字无忧权益卡"]; navList = ["数字无忧权益卡"];
...@@ -291,9 +300,13 @@ Component({ ...@@ -291,9 +300,13 @@ Component({
}); });
}, },
changeNav(event) { changeNav(event) {
const index = event.target.dataset.index
this.setData({ this.setData({
activeNavIdx: event.target.dataset.index, activeNavIdx: index,
}); });
const trackName = this.data.trackList[this.data.actNum][index]
console.log(trackName)
wx.$Track.sendTrack(trackData[trackName]);
}, },
// scrolltoupper(event) { // scrolltoupper(event) {
// console.log(event.detail.scrollHeight,event.detail.scrollTop) // console.log(event.detail.scrollHeight,event.detail.scrollTop)
......
const navStyle = "background-color: transparent;"; const navStyle = "background-color: transparent;";
import util from "../../utils/util"; import util from "../../utils/util";
import { trackData } from "../../utils/data";
// import { IMG_URL } from '~/utils/constantData.js' // import { IMG_URL } from '~/utils/constantData.js'
// wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/' // wx.$imgUrl = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
import { senceData } from "./constant/data"; import { senceData } from "./constant/data";
...@@ -98,6 +99,13 @@ Page({ ...@@ -98,6 +99,13 @@ Page({
cluePageSize: 10, cluePageSize: 10,
clueCurrentPage: 1, clueCurrentPage: 1,
hasPhoneNumber: false, hasPhoneNumber: false,
trackList: [
['EQUITYCARD'],
['SOLARFILM'],
['PAINTPROTECT', 'CHANGEFILM'],
['CARBEAUTY', 'SEATVENTILATE', 'ARNAVIGATION', 'LIGHT', 'NAVIGATIONARROUND'],
['LOSSPGASE']
]
}, },
//引导图 //引导图
...@@ -139,6 +147,8 @@ Page({ ...@@ -139,6 +147,8 @@ Page({
// if(scenestatus == 1){ // if(scenestatus == 1){
// } // }
const trackName = this.data.trackList[num][0]
wx.$Track.sendTrack(trackData[trackName]);
this.setData({ this.setData({
actNum: num, actNum: num,
}); });
...@@ -450,6 +460,14 @@ Page({ ...@@ -450,6 +460,14 @@ Page({
}, },
onRoute(options) { onRoute(options) {
console.log(options, "options"); console.log(options, "options");
if (options.actNum) {
const trackName = this.data.trackList[options.actNum][options.activeNavIdx]
console.log(trackName)
wx.$Track.sendTrack(trackData[trackName]);
} else {
// 无参数默认埋点
wx.$Track.sendTrack(trackData.CARBEAUTY);
}
this.setData({ this.setData({
actNum: options.actNum, actNum: options.actNum,
wrapactiveNavIdx: options.activeNavIdx, wrapactiveNavIdx: options.activeNavIdx,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-08-30 11:26:21 * @Date: 2022-08-30 11:26:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-10-28 10:30:34 * @LastEditTime: 2022-10-28 10:51:40
*/ */
// pages/tab/index/index.js // pages/tab/index/index.js
import { menuMixin } from "../../../mixins/index"; import { menuMixin } from "../../../mixins/index";
...@@ -106,6 +106,7 @@ Page({ ...@@ -106,6 +106,7 @@ Page({
extraData: storeParams, extraData: storeParams,
envVersion: 'develop', envVersion: 'develop',
success(res) { success(res) {
console.log(res, storeParams)
// 打开成功 // 打开成功
} }
}) })
...@@ -215,7 +216,7 @@ Page({ ...@@ -215,7 +216,7 @@ Page({
*/ */
onShow() { onShow() {
this.setData({ this.setData({
hasPhoneNumber: util.getUserInfo().phone hasPhoneNumber: util.getUserInfo() && util.getUserInfo().phone
}) })
const options = wx.getEnterOptionsSync() const options = wx.getEnterOptionsSync()
wx.$trackData = options.query wx.$trackData = options.query
......
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
}, },
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"compileHotReLoad": true "compileHotReLoad": false
}, },
"libVersion": "2.26.1", "libVersion": "2.26.1",
"projectname": "ai-card" "projectname": "ai-card"
......
/** 分享
* @param {*} shareTitle 分享标题
* @param {*} sharePath 分享页面路径 不传默认当前页
* @param {*} shareImage 分享图片 不传默认当前页面截图
* @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} shareFun 分享页面
* @param {*} shareTrackData 分享埋点数据
* @param {*} onViewTrack 开启浏览埋点
* @returns
*/
// import {
// reportData
// } from '~/api/index.js'
// import USERAPI from '~/api/usersApi/index'
class Share {
constructor() {
console.log('---------------- 分享初始化 ----------------')
this.initPageProxy()
}
/**全局注册事件 */
initPageProxy() {
let thisPage = Page
let _this = this
Page = function (el) {
try {
el || (el = {}), _this.pageLeaveProxy(el), thisPage.apply(this, arguments)
} catch (el) {
thisPage.apply(this, arguments)
}
}
}
/**设置全局分享 */
pageLeaveProxy(page) {
const onLoad = page.onLoad,
that = this
if (page.onShareAppMessage) {
const that = this
page.onShareAppMessage = function () {
let {
shareTitle,
sharePath,
shareImage,
shareQuery,
noPageAuth,
shareFun,
shareTrackData
} = this,
path = `/${this.route}`
if (sharePath) path = `/${sharePath}`
path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}`
console.log('===============', path)
if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
return {
path,
title: shareTitle,
imageUrl: shareImage
}
}
}
if (page.onShareTimeline) {
page.onShareTimeline = function () {
let {
shareTitle,
shareImage,
shareQuery,
shareFun,
shareTrackData
} = this
if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
shareQuery = that.setCommonShareQuery(shareQuery)
console.log(shareQuery)
return {
query: shareQuery,
title: shareTitle,
imageUrl: shareImage
}
}
}
page.onLoad = async function () {
onLoad && onLoad.apply(this, arguments)
if (this.onViewTrack) {
const WXUSERINFO = await USERAPI.getWXUserInfo(),
{
USERINFO
} = that.getCommonData(),
shareInfo = this.options
// if (shareInfo.shareOpenId) reportData({
// openId: WXUSERINFO.openId || '',
// unionId: WXUSERINFO.unionId || '',
// nickName: WXUSERINFO.nickName || '',
// avatar: WXUSERINFO.avatarUrl || '',
// phone: WXUSERINFO.phone || USERINFO.phone || '',
// ...shareInfo
// }, 1)
}
}
}
getCommonData() {
const WXUSERINFO = wx.$storage.get('wx_user_info'),
USERINFO = wx.$storage.get('userInfo')
return {
WXUSERINFO,
USERINFO
}
}
setCommonShareQuery(query) {
const {
WXUSERINFO,
USERINFO
} = this.getCommonData(),
thisPage = wx.$router.getPageInstance().options
query = `${query? `?${query}&`:'?'}merchantId=${thisPage.merchantId || USERINFO.merchantId || ''}&shareOpenId=${thisPage.shareOpenId || WXUSERINFO.openId || ''}&sharePhone=${thisPage.sharePhone || USERINFO.phone || ''}`
return query
}
// reportShareData(shareTrackData) {
// const {
// WXUSERINFO,
// USERINFO
// } = this.getCommonData(),
// thisPage = wx.$router.getPageInstance().options
// // reportData({
// // openId: WXUSERINFO.openId || '',
// // unionId: WXUSERINFO.unionId || '',
// // nickName: WXUSERINFO.nickName || '',
// // avatar: WXUSERINFO.avatarUrl || '',
// // phone: USERINFO.phone || '',
// // merchantId: thisPage.merchantId || USERINFO.merchantId || '',
// // shareOpenId: thisPage.shareOpenId || WXUSERINFO.openId || '',
// // sharePhone: thisPage.sharePhone || USERINFO.phone || '',
// // ...shareTrackData
// // })
// }
}
new Share()
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!