<template>
|
</template>
|
<script>
|
import {
|
parseQueryString
|
} from "@/utils/index.js";
|
import {
|
getUserBelong,
|
updateUserBelong,
|
sceneToParams,
|
spread,
|
protocolExist
|
} from "./api/user.js";
|
import {
|
addParentChance
|
} from "./api/lottery.js";
|
import {
|
checkLogin
|
} from "./libs/login";
|
import {
|
HTTP_REQUEST_URL
|
} from './config/app';
|
import Auth from './libs/wechat.js';
|
import Routine from './libs/routine.js';
|
import Apps from './libs/apps.js';
|
import {
|
mapActions
|
} from 'vuex';
|
import BigNumber from 'bignumber.js';
|
|
import {
|
getBeanRate
|
} from '@/api/store.js';
|
import parseQuery from "./utils/index.js";
|
import {
|
silenceBindingSpread
|
} from "@/utils";
|
export default {
|
globalData: {
|
spid: 0,
|
code: 0,
|
isLogin: false,
|
userInfo: {},
|
MyMenus: [],
|
windowHeight: 0,
|
id: 0,
|
source: 'Mall',
|
showProtocol: false,
|
showLoginFl: false,
|
authKey: '',
|
thirdToken: '',
|
task: null,
|
buttonName: null,
|
entranceNameVar: null
|
},
|
data: {
|
isFirstLogin: true,
|
unionId: '',
|
option: {},
|
showOption: {},
|
_isReloginAfterLogout: false
|
},
|
onLoad: function () { },
|
onLaunch: function (option) {
|
let that = this;
|
that.watchRouter();
|
this.$store.commit('UPDATE_isSystemHide', {
|
isSystemHide: false
|
});
|
uni.$on('onAddTrack', (data) => {
|
console.log('onAddTrack', data);
|
that.addTrack(data.name, data.data);
|
})
|
uni.$on('clearTask', (data) => {
|
console.error('clear Task')
|
that.globalData.task = null;
|
})
|
|
|
uni.$on('showTips', (data) => {
|
let pages = getCurrentPages();
|
let curPage = pages[pages.length - 1];
|
if (curPage.$vm.$parent) {
|
console.log(curPage.$vm.$parent.$refs.showTips);
|
curPage.$vm.$parent.$refs.showTips.show(data);
|
} else {
|
curPage.$vm.$refs.showTips.show(data);
|
}
|
|
});
|
//解决token过期问题
|
that.$store.commit("LOGOUT");
|
that.checkForUpdate();
|
that.option = option;
|
console.log('onLaunch option', option);
|
|
let source = (that.option.query && that.option.query.source) ? that.option.query.source : (that.option
|
.query && that.option.query.thirdToken ? 'MINIP' : 'MALL');
|
that.globalData.source = source;
|
if (that.option.query && that.option.query.buttonName) {
|
that.globalData.buttonName = that.option.query.buttonName;
|
}
|
if (that.option.query && that.option.query.entranceNameVar) {
|
that.globalData.entranceNameVar = that.option.query.entranceNameVar;
|
}
|
if (HTTP_REQUEST_URL == '') {
|
console.error(
|
"请配置根目录下的config.js文件中的 'HTTP_REQUEST_URL'\n\n请修改开发者工具中【详情】->【AppID】改为自己的Appid\n\n请前往后台【小程序】->【小程序配置】填写自己的 appId and AppSecret"
|
);
|
return false;
|
}
|
|
// 获取导航高度;
|
uni.getSystemInfo({
|
success: function (res) {
|
that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
|
}
|
});
|
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
that.globalData.navH = menuButtonInfo.top * 2 + menuButtonInfo.height / 2;
|
|
uni.$on('paramReady', function (obj) {
|
if (that.globalData.spid) {
|
//只有会员日专区和会员日商品需要增加抽奖机会
|
let pages = getCurrentPages(),
|
currPage = pages[pages.length - 1];
|
let path = currPage.$page.fullPath;
|
console.log('------------------paramReady' + that.globalData.spid, path)
|
if (path.indexOf('pages/zone/index') >= 0 || path.indexOf('pages/goods_details/index') >= 0) {
|
let zoneId = that.option.query.zoneId ? that.option.query.zoneId : (that.option.query.id ? that.option.query.id : false)
|
if (obj && obj.zoneId) {
|
zoneId = obj.zoneId;
|
}
|
if (zoneId && zoneId == 130) {
|
addParentChance({
|
parentUid: that.globalData.spid
|
}).then(() => {
|
console.log('增加抽奖机会' + zoneId)
|
});
|
}
|
}
|
|
|
if (that.$store.getters.isLogin) {
|
silenceBindingSpread(); //未绑定手机号前是否需要spread参数
|
}
|
}
|
});
|
//监听绑定手机号注册成功事件
|
uni.$on('registerSuccess', (data) => {
|
console.log('app监听到 registerSuccess事件')
|
if (that.option.query.thirdToken) { //客经的同意隐私协议才更新belong
|
that.parseQuery('isRegisterBack');
|
} else {
|
that.getLastBelong('isRegisterBack');
|
}
|
});
|
//退出登录/解绑手机号后,重新走匿名登录恢复游客会话(token、unionId、归属信息)
|
uni.$on('reloginAfterLogout', () => {
|
that.reloginAfterLogout();
|
});
|
//监听获取到用户信息事件
|
uni.$on('updateUserInfo', () => {
|
console.log('监听到 userinfo事件')
|
let userInfo = that.$store.getters.userInfo;
|
that.setGdpAttr();
|
});
|
//首次请求unionid后回调
|
uni.$once('UPDATE_LOGINSTATUS', (data) => {
|
//解绑/退出登录后主动发起的匿名重登,由 reloginAfterLogout 自行处理,避免重复 parseQuery
|
if (that._isReloginAfterLogout) {
|
that._isReloginAfterLogout = false;
|
return;
|
}
|
console.log('app监听到 UPDATE_LOGINSTATUS ' + that.isFirstLogin);
|
//首次请求login获取到unionId
|
if (that.$store.getters.isLogin) {
|
if (that.option.query.thirdToken) {
|
Routine.authThirdUpdate({
|
'thirdToken': that.option.query.thirdToken
|
}).then(res => {
|
Routine.getLastUserInfo().then(() => {
|
that.setGdpUserId();
|
that.parseQuery();
|
});
|
});
|
} else {
|
Routine.getLastUserInfo().then(() => {
|
that.setGdpUserId();
|
that.parseQuery()
|
});
|
}
|
// Routine.getLastUserInfo().then(()=>{
|
// that.setGdpUserId();
|
// if (that.option.query.thirdToken) { //客经的注册过才更新belong
|
// that.parseQuery()
|
// } else {
|
// that.parseQuery()
|
// }
|
// })
|
} else {
|
that.setGdpUserId();
|
if (that.option.query.thirdToken) { //客经的注册过才更新belong
|
|
} else {
|
that.parseQuery()
|
}
|
}
|
|
|
protocolExist(that.$store.getters.unionId).then((res) => {
|
if (!res.data) {
|
that.$nextTick(() => {
|
that.globalData.showProtocol = true;
|
if (uni.showProtocol) {
|
uni.showProtocol();
|
}
|
})
|
} else {
|
uni.$emit('protocolAgreed');
|
}
|
});
|
});
|
|
//获取悦养豆兑换比率,请求一次
|
if (!this.$store.getters.careBeanRate) {
|
getBeanRate().then((res) => {
|
this.$store.commit('UPDATE_CAREBEANRATE', {
|
careBeanRate: res.data
|
});
|
uni.$emit('updateCareBeanRate', {});
|
})
|
}
|
|
|
//判断进入场景
|
if (option.query.hasOwnProperty('scene')) {
|
switch (option.scene) {
|
case 1047: //扫描小程序码
|
case 1048: //长按图片识别小程序码
|
case 1049: //手机相册选取小程序码
|
case 1001: //直接进入小程序
|
let value = this.$util.getUrlParams(decodeURIComponent(option.query.scene));
|
let values = value.split(',');
|
if (values.length === 2) {
|
let v1 = values[0].split(":");
|
if (v1[0] === 'pid') {
|
console.log('set spid 22222222')
|
that.globalData.spid = v1[1];
|
} else {
|
that.globalData.id = v1[1];
|
}
|
let v2 = values[1].split(":");
|
if (v2[0] === 'pid') {
|
that.globalData.spid = v2[1];
|
} else {
|
that.globalData.id = v2[1];
|
}
|
} else {
|
console.log('set spid 3333333')
|
that.globalData.spid = values[0].split(":")[1];
|
}
|
break;
|
}
|
}
|
if (that.option.query.spread) {
|
|
console.log('set spid 44444')
|
that.globalData.spid = that.option.query.spread;
|
}
|
|
//请求login获取unionid
|
console.log('------------------isLogin', that.$store.getters.isLogin);
|
if (!that.$store.getters.isLogin) {
|
that.appLogin();
|
} else { //登录过期
|
uni.$on('needLogin', () => {
|
that.appLogin()
|
})
|
}
|
},
|
onError: function (e) {
|
console.log('------------ app error ', e);
|
},
|
onShow: function (option) {
|
let that = this;
|
console.log('onShow option', option);
|
if (that.$store.getters.isSystemHide) {
|
console.log('系统事件触发了app onshow事件,不更新归属等信息');
|
} else {
|
if (option.referrerInfo && option.referrerInfo.extraData && option.referrerInfo.extraData.task) {
|
this.globalData.task = option.referrerInfo.extraData.task;
|
console.log('app onShow task', this.globalData.task);
|
}
|
if (option.scene || option.source || (option.referrerInfo && option.referrerInfo.extraData && option
|
.referrerInfo.extraData.source)) {
|
console.log('第三方来源进入');
|
let isChange = false;
|
|
function checkEq(i) {
|
console.log(i, option.query[i], that.option.query[i], option.query[i] !== that.option.query[
|
i]);
|
if (i == 'thirdToken') {
|
let source1 = (that.option.referrerInfo && that.option.referrerInfo.extraData && that
|
.option
|
.referrerInfo.extraData.source) ? that.option.referrerInfo.extraData.source :
|
'MINIP';
|
let agentInfo1 = (that.option.referrerInfo && that.option.referrerInfo.extraData && that
|
.option
|
.referrerInfo.extraData.agentInfo) ? that.option.referrerInfo.extraData.agentInfo :
|
{};
|
let source2 = (option.referrerInfo && option.referrerInfo.extraData && option
|
.referrerInfo.extraData.source) ? option.referrerInfo.extraData.source : 'MINIP';
|
that.globalData.source = source2;
|
let agentInfo2 = (option.referrerInfo && option.referrerInfo.extraData && option
|
.referrerInfo.extraData.agentInfo) ? option.referrerInfo.extraData.agentInfo : {};
|
if (source1 !== source2 || agentInfo1.agentNo !== agentInfo2.agentNo) {
|
isChange = true;
|
}
|
if (option.referrerInfo && option.referrerInfo.extraData && option.referrerInfo.extraData
|
.buttonName) {
|
that.globalData.buttonName = option.referrerInfo.extraData.buttonName;
|
}
|
if (option.referrerInfo && option.referrerInfo.extraData && option.referrerInfo.extraData
|
.entranceNameVar) {
|
that.globalData.entranceNameVar = option.referrerInfo.extraData.entranceNameVar;
|
}
|
} else if ((i == 'scene' || i == 'agentNo' || i == 'source' || i == 'buttonName' || i ==
|
'entranceNameVar') && (option.query[i] !== that.option.query[i])) {
|
isChange = true;
|
}
|
}
|
|
for (var i in option.query) {
|
if (i == 'source' || i == 'buttonName' || i == 'entranceNameVar') {
|
that.globalData[i] = option.query[i];
|
}
|
checkEq(i);
|
}
|
for (var i in that.option.query) {
|
checkEq(i);
|
}
|
console.log('代码更新 2026-01-29');
|
console.log('isChange', isChange);
|
//会对专区和商品需要重新加载
|
if (option.path == "pages/zone/index" || option.path == "pages/goods_details/index") {
|
isChange = true
|
}
|
if (!that.$store.getters.unionId) {
|
console.log('测试-数据重新初始化');
|
} else if (!isChange) {
|
console.log('测试-没有发生变化不需要更新')
|
}
|
if (isChange && that.$store.getters.unionId) {
|
console.log('参数发生变化 上次的参数', JSON.stringify(that.option));
|
this.$store.commit('CLEAR_BELONG', {});
|
that.option = option;
|
if (that.$store.getters.isLogin) {
|
if (option.query.thirdToken) {
|
Routine.authThirdUpdate({
|
'thirdToken': option.query.thirdToken
|
}).then(res => {
|
Routine.getLastUserInfo().then(() => {
|
that.parseQuery();
|
});
|
});
|
} else {
|
Routine.getLastUserInfo().then(() => {
|
that.parseQuery()
|
});
|
}
|
} else {
|
if (!option.query.thirdToken) {
|
that.parseQuery()
|
}
|
}
|
}
|
} else {
|
console.log('小程序直接进入')
|
}
|
}
|
|
setTimeout(() => {
|
console.log('app onshow 删除系统隐藏标识')
|
that.$store.commit('UPDATE_isSystemHide', {
|
isSystemHide: false
|
});
|
}, 500)
|
},
|
onHide: function () {
|
//console.log('App Hide')
|
},
|
methods: {
|
watchRouter() {
|
let that = this;
|
// 监听 uni-app 所有路由跳转
|
const routes = ['navigateTo', 'redirectTo', 'switchTab', 'navigateBack']
|
|
routes.forEach(item => {
|
const origin = uni[item]
|
uni[item] = function (options) {
|
that.$store.commit('UPDATE_isSystemHide', {
|
isSystemHide: false
|
});
|
console.log('跳转类型:', item)
|
console.log('跳转到:', options?.url || '返回')
|
// 执行原来的跳转
|
return origin.call(this, options)
|
}
|
})
|
},
|
checkForUpdate() {
|
let that = this;
|
console.log('--------------------checkForUpdate');
|
const updateManager = wx.getUpdateManager()
|
updateManager.onCheckForUpdate(function (res) {
|
// 请求完新版本信息的回调
|
console.log('-----------------hasUpdate', res.hasUpdate)
|
})
|
|
updateManager.onUpdateReady(function () {
|
uni.showModal({
|
title: '更新提示',
|
content: '新版本已经准备好,是否重启应用?',
|
success(res) {
|
if (res.confirm) {
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
updateManager.applyUpdate()
|
} else if (res.cancel) {
|
return that.$util.Tips({
|
title: '已取消!'
|
});
|
}
|
}
|
})
|
})
|
|
updateManager.onUpdateFailed(function () {
|
// 新版本下载失败
|
})
|
},
|
appLogin() {
|
let that = this;
|
|
// that.globalData.showLoginFl = true;
|
// if (uni.showLoginFl) {
|
// uni.showLoginFl({
|
// authKey: that.globalData.authKey,
|
// thirdToken: that.globalData.thirdToken
|
// });
|
// }
|
|
let spread = that.globalData.spid ? that.globalData.spid : 0;
|
uni.showLoading()
|
Routine.getCode()
|
.then(code => {
|
Routine.authUserInfo(code, {
|
'spread_spid': spread
|
}).then(res => {
|
uni.hideLoading()
|
that.globalData.authKey = res.data.key;
|
if (res.data.type == 'register' && that.option.query.thirdToken) {
|
that.globalData.thirdToken = that.option.query.thirdToken;
|
that.globalData.showLoginFl = true;
|
if (uni.showLoginFl) {
|
uni.showLoginFl({
|
authKey: that.globalData.authKey,
|
thirdToken: that.globalData.thirdToken
|
});
|
}
|
}
|
}).catch(e => {
|
console.log(e);
|
})
|
})
|
.catch(res => {
|
console.log(res);
|
uni.hideLoading();
|
});
|
},
|
/**
|
* 退出登录/解绑手机号后的匿名重登
|
* reLaunch 不会重跑 onLaunch,需手动重新获取游客 token、unionId,
|
* 再刷新归属信息并触发 BELONG_READY,各 tab 页依赖该状态/事件加载数据
|
*/
|
reloginAfterLogout() {
|
let that = this;
|
that._isReloginAfterLogout = true;
|
let spread = that.globalData.spid ? that.globalData.spid : 0;
|
uni.showLoading();
|
Routine.getCode().then(code => {
|
return Routine.authUserInfo(code, {
|
'spread_spid': spread
|
}).then(res=>{
|
that.globalData.authKey = res.data.key;
|
});
|
}).then(() => {
|
uni.hideLoading();
|
//authUserInfo 内部已 commit UPDATE_LOGINSTATUS,此时防重入分支已执行完毕
|
that._isReloginAfterLogout = false;
|
that.setGdpUserId();
|
updateUserBelong({
|
'unionId': that.$store.getters.unionId
|
}).then(() => {
|
that.getLastBelong();
|
}).catch(() => {
|
that.getLastBelong();
|
});
|
}).catch(e => {
|
uni.hideLoading();
|
that._isReloginAfterLogout = false;
|
console.log('reloginAfterLogout fail', e);
|
});
|
},
|
checkBelongParam(params) {
|
if (!params['agentNo']) {
|
return false;
|
}
|
let isValid = true;
|
for (var i in params) {
|
if (!params[i] || params[i] == '-' || params[i] == 'null' || params[i] == 'undefined') {
|
isValid = false;
|
}
|
}
|
console.log(params);
|
if (!isValid) {
|
console.log('参数不合法,不更新归属')
|
}
|
return isValid;
|
},
|
sceneToParams() {
|
let that = this;
|
return new Promise((resolve, reject) => {
|
sceneToParams(that.option.query.scene).then((res) => {
|
console.log('sceneToParams 返回值:', res);
|
if (res.data.source) {
|
that.globalData.source = res.data.source;
|
}
|
if (res.data.buttonName) {
|
that.globalData.buttonName = res.data.buttonName;
|
}
|
if (res.data.entranceNameVar) {
|
that.globalData.entranceNameVar = res.data.entranceNameVar;
|
}
|
if (res.data.task) {
|
that.globalData.task = JSON.parse(res.data.task);
|
console.log('app sceneToParams task', that.globalData.task);
|
}
|
that.globalData.spid = res.data.pid;
|
that.globalData.id = res.data.id;
|
uni.$emit('finishSceneParam', res)
|
resolve(res);
|
}).catch((e) => {
|
console.log(e);
|
uni.$emit('paramReady', false)
|
uni.$emit('finishSceneParam', e)
|
reject();
|
})
|
});
|
},
|
parseQuery(isRegisterBack) {
|
console.log('开始解析参数')
|
let that = this;
|
let params = {};
|
if (that.option.query && that.option.query.spread) {
|
console.log('set spid 1111111')
|
that.globalData.spid = that.option.query.spread;
|
}
|
//小程序码
|
if (that.option.query && that.option.query.scene) {
|
that.sceneToParams().then((res) => {
|
uni.$emit('paramReady', {
|
zoneId: res.data.zoneId ? res.data.zoneId : (res.data.id ? res.data.id : false)
|
})
|
let params = {
|
"agentNo": res.data.agentNo,
|
"branchCode": res.data.branchCode,
|
"channel": res.data.channel,
|
"companyCode": res.data.companyCode,
|
"subCode": res.data.subCode,
|
"unionId": that.$store.getters.unionId
|
};
|
if (!params['subCode'] || params['subCode'] == 'null' || params['subCode'] == '-' ||
|
params['subCode'] == 'undefined') {
|
delete params['subCode'];
|
}
|
if (!that.checkBelongParam(params)) {
|
params = {
|
"unionId": that.$store.getters.unionId
|
}
|
}
|
updateUserBelong(params).then((res) => {
|
that.getLastBelong(isRegisterBack);
|
})
|
}).catch(() => {
|
updateUserBelong({
|
"unionId": that.$store.getters.unionId
|
}).then((res) => {
|
that.getLastBelong(isRegisterBack);
|
})
|
});
|
} else {
|
uni.$emit('paramReady', false)
|
if (that.option.query && that.option.query.agentNo) { //小程序分享跳转-INSMART跳转
|
let params = {
|
"agentNo": that.option.query.agentNo,
|
"branchCode": that.option.query.branchCode,
|
"channel": that.option.query.channel,
|
"companyCode": that.option.query.companyCode,
|
"subCode": that.option.query.subCode,
|
"unionId": that.$store.getters.unionId
|
};
|
if (!params['subCode'] || params['subCode'] == 'null' || params['subCode'] == '-' || params[
|
'subCode'] == 'undefined') {
|
delete params['subCode'];
|
}
|
if (!that.checkBelongParam(params)) {
|
params = {
|
"unionId": that.$store.getters.unionId
|
}
|
}
|
updateUserBelong(params).then((res) => {
|
that.getLastBelong();
|
}).catch(() => {
|
that.getLastBelong(isRegisterBack);
|
})
|
}
|
//else if (that.option.query && that.option.query.thirdToken) { //客经小程序跳转
|
else if (that.option.referrerInfo && that.option.referrerInfo.extraData) { //客经小程序跳转
|
let source = (that.option.referrerInfo && that.option.referrerInfo.extraData && that.option
|
.referrerInfo.extraData.source) ? that.option.referrerInfo.extraData.source : 'MINIP';
|
that.globalData.source = source;
|
if (that.option.referrerInfo && that.option.referrerInfo.extraData && that.option.referrerInfo
|
.extraData.buttonName) {
|
that.globalData.buttonName = that.option.referrerInfo.extraData.buttonName;
|
}
|
if (that.option.referrerInfo && that.option.referrerInfo.extraData && that.option.referrerInfo
|
.extraData.entranceNameVar) {
|
that.globalData.entranceNameVar = that.option.referrerInfo.extraData.entranceNameVar;
|
}
|
|
let agentInfo = (that.option.referrerInfo && that.option.referrerInfo.extraData && that.option
|
.referrerInfo.extraData.agentInfo) ? that.option.referrerInfo.extraData.agentInfo : {};
|
let params = {
|
"agentNo": agentInfo.custAgentNo,
|
"branchCode": agentInfo.custAgentBranch,
|
"channel": agentInfo.custAgentChnl,
|
"companyCode": agentInfo.custAgentCoy,
|
"subCode": agentInfo.custAgentOrgNo,
|
"unionId": that.$store.getters.unionId
|
}
|
if (!params['subCode'] || params['subCode'] == 'null' || params['subCode'] == '-' || params[
|
'subCode'] == 'undefined') {
|
delete params['subCode'];
|
}
|
if (!that.checkBelongParam(params)) {
|
params = {
|
"unionId": that.$store.getters.unionId
|
}
|
}
|
updateUserBelong(params).then((res) => {
|
that.getLastBelong(isRegisterBack);
|
}).catch(() => {
|
that.getLastBelong(isRegisterBack);
|
})
|
} else {
|
updateUserBelong({
|
"unionId": that.$store.getters.unionId
|
}).then((res) => {
|
that.getLastBelong(isRegisterBack);
|
});
|
}
|
}
|
},
|
getLastBelong(isRegisterBack) {
|
let that = this;
|
getUserBelong(that.$store.getters.unionId).then((res) => {
|
this.$store.commit('UPDATE_BELONG', res.data);
|
console.log('获取到belong', that.$store.getters.belong)
|
//如果有联合工号
|
//经代 分公司 + 所在机构 + 代理人工号;客户所属代理人渠道/代理人渠道= “AB”
|
//其他 分公司 + 代理人工号
|
if (res.data && res.data.unionCode && res.data.unionCode !== '-') {
|
if (res.data.customerId && res.data.customerId !== 'null' && res.data.customerId !== '-') {
|
that.$gdp('setUserId', res.data.customerId + '@' + res.data.unionCode, 'customer_id');
|
} else {
|
that.$gdp('setUserId', that.$store.getters.unionId + '@' + res.data.unionCode,
|
'union_id');
|
}
|
}
|
that.setGdpAttr();
|
console.log('调用 enter 埋点')
|
if (isRegisterBack) {
|
that.addTrack('yy_mobileAuthSuccess', {});
|
if (that.option.query && that.option.query.thirdToken) {
|
that.addTrack('yy_enterMinip', {});
|
} else { }
|
} else {
|
if (that.option.query && that.option.query.thirdToken) {
|
if (that.$store.getters.isLogin) {
|
that.addTrack('yy_enterMinip', {});
|
}
|
} else {
|
that.addTrack('yy_enterMinip', {});
|
}
|
}
|
uni.$emit('BELONG_READY', {
|
isRegister: isRegisterBack ? true : false
|
});
|
})
|
},
|
setGdpUserId() {
|
let that = this;
|
let unionId = that.$store.getters.unionId;
|
that.$gdp('identify', unionId);
|
that.setGdpAttr();
|
},
|
setGdpAttr() {
|
let that = this;
|
let belong = that.$store.getters.belong;
|
let param = {
|
source: 'M'
|
}
|
if (that.$store.getters.unionId) {
|
param['union_id'] = that.$store.getters.unionId;
|
}
|
if (that.$store.getters.userInfo) {
|
param['is_internal'] = that.$store.getters.userInfo.staff ? true : false;
|
if (that.$store.getters.userInfo.extVipLevel) {
|
param['member_level'] = that.$store.getters.userInfo.extVipLevel;
|
}
|
}
|
if (belong) {
|
if (belong.mobile) {
|
param['mobile_phone'] = belong.mobile;
|
}
|
if (belong.customerId) {
|
param['customer_id'] = belong.customerId;
|
}
|
if (belong.unionCode) {
|
param['operator'] = belong.unionCode;
|
}
|
if (belong.channel) {
|
param['channel'] = belong.channel;
|
param['multi_channel'] = belong.multi ? 1 : 0;
|
}
|
if (belong.subCode) {
|
param['operator_agent'] = belong.subCode;
|
}
|
}
|
|
that.$gdp('setUserAttributes', param);
|
console.log('设置gdp用户属性', param);
|
},
|
}
|
}
|
</script>
|
|
<style>
|
@import "@/plugin/animate/animate.min.css";
|
@import '@/styles/base.css';
|
@import '@/static/iconfont/iconfont.css';
|
@import '@/styles/guildford.css';
|
@import '@/styles/style.scss';
|
|
/* 条件编译,仅在H5平台生效 */
|
/* #ifdef H5 */
|
body::-webkit-scrollbar,
|
html::-webkit-scrollbar {
|
display: none;
|
}
|
|
/* #endif */
|
view {
|
box-sizing: border-box;
|
}
|
|
.bg-color-red {
|
background-color: #E93323 !important;
|
}
|
|
.syspadding {
|
padding-top: var(--status-bar-height);
|
}
|
|
.flex {
|
display: flex;
|
}
|
|
.uni-scroll-view::-webkit-scrollbar {
|
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
|
display: none
|
}
|
|
::-webkit-scrollbar {
|
width: 0;
|
height: 0;
|
color: transparent;
|
}
|
</style>
|