From c60e5fb5fdc0f61ff9c5fe689fc48832018d1c0d Mon Sep 17 00:00:00 2001 From: Gaoxs <704041637@qq.com> Date: Wed, 23 Sep 2020 18:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=86=E9=94=80=E5=92=8C?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E6=97=A0=E6=B3=95=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=85=B3=E7=B3=BB=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 12 +----- pages/Loading/index.vue | 51 +++++++++++-------------- pages/activity/DargainDetails/index.vue | 19 ++++++--- pages/shop/GoodsCon/index.vue | 24 ++++++++---- store/index.js | 9 +---- utils/index.js | 34 ++++------------- utils/store/cookie.js | 11 +++++- 7 files changed, 71 insertions(+), 89 deletions(-) diff --git a/main.js b/main.js index 23eb888..66258c1 100644 --- a/main.js +++ b/main.js @@ -38,14 +38,6 @@ Vue.prototype.$validator = function (rule) { return new schema(rule); }; -// const CACHE_KEY = "clear_0.0.1"; - -// if (!cookie.has(CACHE_KEY)) { -// cookie.clearAll(); -// cookie.set(CACHE_KEY, 1); -// } - - Vue.config.productionTip = false App.mpType = 'app' Vue.prototype.$store = store @@ -128,7 +120,7 @@ import { isWeixin } from '@/utils' const CACHE_KEY = "clear_0.0.1"; if (!cookie.has(CACHE_KEY)) { - cookie.clearAll(); + cookie.clearAll() cookie.set(CACHE_KEY, 1); } @@ -146,7 +138,7 @@ if (urlSpread !== undefined) { // #endif - + async function init() { // #ifdef H5 diff --git a/pages/Loading/index.vue b/pages/Loading/index.vue index 4c9d143..578a2eb 100644 --- a/pages/Loading/index.vue +++ b/pages/Loading/index.vue @@ -48,36 +48,20 @@ } else if (spread === 0 || typeof spread !== "number") { cookie.set("spread", urlSpread || 0); } - if (this.$store.getters.token) { - this.toLaunch(); - return; - } } - - // cookie.get("spread"); - // if (this.$deviceType == "weixin") { - // let path = parseQuery().path - // console.log(this) - // if (path) { - // this.$yrouter.push({ - // path - // }); - // } else { - // this.$yrouter.switchTab({ - // path: "/pages/home/index" - // }); - // } - - // return + // if (this.$deviceType == "app" || this.$deviceType == "weixinh5") { + // this.$yrouter.switchTab({ + // path: "/pages/home/index" + // }); + // return; // } - // this.toLaunch(); - if (this.$deviceType == "app" || this.$deviceType == "weixinh5") { - // this.toLaunch(); - this.$yrouter.switchTab({ - path: "/pages/home/index" - }); + if (this.$store.getters.token) { + // 如果token存在,直接进行进页面 + console.log('登录状态存在,直接进页面') + this.toLaunch(); return; } + console.log('进行登录操作') login().finally(() => { this.$yrouter.switchTab({ path: "/pages/home/index" @@ -89,9 +73,18 @@ toLaunch() { console.log("loading home"); this.changeAuthorization(false); - this.$yrouter.switchTab({ - path: "/pages/home/index" - }); + let redirect = cookie.get('redirect') + if (redirect) { + redirect = redirect.split('/pages')[1] + this.$yrouter.replace({ + path: '/pages' + redirect, + }); + cookie.remove('redirect'); + } else { + this.$yrouter.replace({ + path: '/pages/home/index', + }); + } } } }; diff --git a/pages/activity/DargainDetails/index.vue b/pages/activity/DargainDetails/index.vue index d931b90..1e40300 100644 --- a/pages/activity/DargainDetails/index.vue +++ b/pages/activity/DargainDetails/index.vue @@ -1,10 +1,11 @@