提交 f82bf773 作者: 姚志忠

修改

父级 cdb00d7a
import {
import {
EventEmitter,
get,
post,
......@@ -370,7 +370,7 @@ export const salt = "chinagoods2024";
sensors.init({
server_url:
"https://event-tracking.chinagoods.com/sa.gif?project=market_navigation_t&remark=online",
show_log: false, //鏄惁寮€鍚棩蹇?
show_log: false,
name: "sensors",
allow_amend_share_path: true,
global_properties: {
......@@ -422,6 +422,7 @@ App({
this.refreshItinerary();
this.checkUpdate();
this.initBuildingByLocation();
this.updateSensorsMarketCode(this.currentBuilding);
const callback = (res) => console.log("userTriggerTranslation", res);
wx.onUserTriggerTranslation(callback);
......@@ -451,6 +452,7 @@ App({
if (this.currentBuilding.name !== nearest.name) {
this.currentBuilding = nearest;
console.log('initBuildingByLocation 切换到:', nearest.name);
this.updateSensorsMarketCode(nearest);
this.events.emit('building', nearest);
}
} else {
......@@ -656,6 +658,18 @@ App({
title: this.globalData.isEn ? "Chinagoods Nav" : "小商AI导航",
});
},
/**
* 更新神策埋点全局参数 inner_market_code(市场编号)
* 若当前建筑有 marketCode 则注册,否则传空字符串(场外留空)
*/
updateSensorsMarketCode(building) {
try {
const code = building && building.marketCode ? building.marketCode : "";
sensors.registerApp({ inner_market_code: code });
} catch (e) {
console.error("updateSensorsMarketCode error", e);
}
},
setBuilding(currentBuilding) {
const now = Date.now();
if (this.lastSetBuildingTime && now - this.lastSetBuildingTime < 1000) {
......@@ -666,6 +680,7 @@ App({
this.currentBuilding = currentBuilding;
console.log(this.currentBuilding, "setBuilding");
this.lastSetBuildingTime = now;
this.updateSensorsMarketCode(currentBuilding);
this.events.emit("building", currentBuilding);
return true;
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论