Commit e742c6fd authored by 郝聪敏's avatar 郝聪敏

feature: 获取distinctId

parent 9c8ab939
......@@ -34,8 +34,8 @@
*/
const LEFT_BTN_CLICK_EVENT = "leftClick";
const RIGHT_BTN_CLICK_EVENT = "click";
import settings from "@/api/settings";
import { onKeyboardStateChange } from "@/service/utils";
import { onKeyboardStateChange, getSobot } from "@/service/utils";
export default {
name: "GoodAction",
props: {
......@@ -72,7 +72,7 @@ export default {
methods: {
leftClick() {
this.$emit(LEFT_BTN_CLICK_EVENT, {});
window.location.href = settings.sobot;
window.location.href = getSobot();
},
rightClick() {
// TODO
......
import { isAndroid, isIOS } from "./validation";
import sa from "sa-sdk-javascript";
import uuidv1 from "uuid/v1";
import { isAndroid, isIOS } from "./validation";
import localStorage from "@/service/localStorage";
import settings from "@/api/settings";
/**
* 替换邮箱字符
......@@ -324,15 +324,17 @@ export function isValidDate(date) {
// 神策注册公共属性
export function registerSa() {
// 获取uuid表示设备唯一标识
let uuid_unloggin = localStorage.get("uuid_unloggin");
if (!uuid_unloggin) {
uuid_unloggin = uuidv1();
localStorage.set("uuid_unloggin", uuid_unloggin);
}
const saObj = { platformType: "H5", uuid_unloggin };
const saObj = { platformType: "H5" };
// 获取distinctId
sa.quick("isReady", function() {
const distinctId = sa.quick("getAnonymousID");
localStorage.set("distinctId", distinctId);
});
// 添加公共属性
sa.registerPage(saObj);
// 登陆埋点
loginSa();
}
......@@ -342,3 +344,8 @@ export function loginSa(uuid = localStorage.get("uuid")) {
localStorage.set("uuid", uuid);
sa.login(uuid);
}
export function getSobot() {
const distinctId = localStorage.get("distinctId");
return distinctId ? `${settings.sobot}&partnerid=${distinctId}` : settings.sobot;
}
......@@ -11,7 +11,7 @@
</div>
</template>
<script>
import settings from "@/api/settings";
import { getSobot } from "@/service/utils";
export default {
name: "CustomerService",
......@@ -23,7 +23,7 @@ export default {
if (type === "home") {
this.$router.push("/home");
} else {
window.location.href = settings.sobot;
window.location.href = getSobot();
}
}
}
......
......@@ -77,10 +77,10 @@ import { some } from "lodash-es";
import GOODS_LIST from "@/api/goodsList.mock";
import { getPolicyList } from "@/api/policy";
import { getLink } from "@/api/product";
import settings from "@/api/settings";
import policyStatusMixin from "../mixin/policyStatus.mixin";
import detailPayMixin from "@/views/Goods/Detail/modules/detailPay.mixin";
import electronicInsurance from "../mixin/electronicInsurance.mixin";
import { getSobot } from "@/service/utils";
// SELF(1, "本人"),
// PARENT(2, "父母"),
......@@ -152,7 +152,7 @@ export default {
};
this.goPay();
} else if (text === "联系客服") {
window.location.href = settings.sobot;
window.location.href = getSobot();
}
},
goDetail(orderNo) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment