diff --git a/pages/index/index.vue b/pages/index/index.vue index 6c29770..6bfbe3f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -223,32 +223,31 @@ import useUserStore from "@/store/user"; const userStore = useUserStore(); + const STORE_INFO = reactive({}) - const STORE_INFO = ref({ - name: '', - id: 5, - detailed_address: '', - image: '' - }); - - const test = () => { - uni.navigateTo({ - url: '/pageQuota/quotation/index' - }) + const getStoreInfo = () => { + if (uni.getStorageSync('STORE_INFO')) { + let data = JSON.parse(uni.getStorageSync('STORE_INFO')) + for (let key in data) { + STORE_INFO[key] = data[key] + } + } } + getStoreInfo() // 分享给好友 onShareAppMessage(() => { - let shareStr = '?id=' + STORE_INFO.value.id; + + let shareStr = '?id=' + STORE_INFO.id; if (userStore.userInfo.user_ship == 1) { shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo .real_name || userStore.userInfo.nickname) } let shareInfo = { - title: STORE_INFO.value.name, + title: STORE_INFO.store_name, path: '/pages/index/index' + shareStr, - imageUrl: STORE_INFO.value.image, + imageUrl: STORE_INFO.image || '', success() { uni.$u.toast('分享成功'); }, @@ -550,6 +549,7 @@ left: 0 }); + // 分享信息 const shareInfo = ref({ uid: '', @@ -573,7 +573,6 @@ shareInfo.value.uid = opt.spread_uid; shareInfo.value.real_name = opt.real_name; shareInfo.value.store_id = opt.id; - console.log(shareInfo.value); uni.setStorageSync('SHARE_INFO', shareInfo.value); } else { // 分享信息 diff --git a/pages/my/my.vue b/pages/my/my.vue index 2afeb8c..75a0f7a 100644 --- a/pages/my/my.vue +++ b/pages/my/my.vue @@ -177,8 +177,8 @@ const logout = () => { userStore.setToken(''); userStore.setUserInfo({}); + uni.removeStorageSync('SHARE_INFO'); uni.setStorageSync("STORE_INFO", '') - uni.reLaunch({ url: '/pages/login/login' })