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

feature: 获取distinctId

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