/* * 全局注入器 */ let page = { data() { return { } }, methods: { }, onLoad(options) { if (!this.$u.test.isEmpty(options.activityId)) { this.$u.api.activity.detail({ id: options.activityId }).then(res => { let userId = uni.getStorageSync("userId") if (!this.$u.test.isEmpty(userId)) { let link = window.location.href if (link.indexOf("?") != -1) { link = link + "&agenterId=" + userId } else { link = link + "?agenterId=" + userId } let obj = { link, title: res.shareTitle, desc: res.shareDesc, imgUrl: res.shareImg } console.log("**********************obj", obj); this.$shareConfig(obj, this) } if (!this.$u.test.isEmpty(options.agenterId)) { uni.setStorageSync("agenterId", options.agenterId) let url = window.location.href let len = url.indexOf("agenterId=") - 1 let tmp = url.substring(0, len) window.location.href = tmp } }) } else { let userId = uni.getStorageSync("userId") if (!this.$u.test.isEmpty(userId)) { let link = window.location.href if (link.indexOf("?") != -1) { link = link + "&agenterId=" + userId } else { link = link + "?agenterId=" + userId } let obj = { link, title: '', desc: link, } this.$shareConfig(obj, this) } if (!this.$u.test.isEmpty(options.agenterId)) { uni.setStorageSync("agenterId", options.agenterId) let url = window.location.href let len = url.indexOf("agenterId=") - 1 let tmp = url.substring(0, len) window.location.href = tmp } } } } export default page