From dac3922c42ef7a26286bc7b41afd25f7711e9554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Fri, 16 Jul 2021 14:02:38 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E5=88=86=E5=8F=91=E6=88=90=E4=B8=BA=E5=88=86=E9=94=80=E8=BE=BE?= =?UTF-8?q?=E4=BA=BA=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 16 +++++++++++----- pages/route/index.vue | 7 +++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 51986d2..5fbef66 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -66,14 +66,19 @@ s_id: '' } }, - onLoad(options) { - this.pt = options.pt || 1; + onLoad() { this.windowHeight = getApp().globalData.windowHeight; this.getCategoryList(); this.getShareInfo(); - this.s_id = options.share_id - if(this.pt == 2) { - this.bindUsders() + // 获取页面参数 + let options = uni.getStorageSync('homePageOptions') || {}; + if(Object.keys(options).length > 0){ + this.pt = options.pt || 1; + this.s_id = options.share_id || ''; + uni.removeStorageSync('homePageOptions'); + if(this.pt == 2) { + this.bindUsders() + } } }, methods: { @@ -91,6 +96,7 @@ let timeDate = Math.round(new Date().getTime() / 1000).toString(); let md5TimeDate = SparkMD5.hash(timeDate) let nowTime = new Date().toLocaleString(); + console.log("进来啦~~~~~") _this.$http(_this.API.API_BINDSALES, { deed: md5TimeDate, sid: _this.s_id, diff --git a/pages/route/index.vue b/pages/route/index.vue index a154e0d..0d92634 100644 --- a/pages/route/index.vue +++ b/pages/route/index.vue @@ -38,9 +38,11 @@ // 拼接地址,并相应跳转 joinPagePath(par){ let path = par.page_url; + let options = {}; // 传给页面的参数,用于解决switch不能传参的问题 let flag = true; // 标志,用于判断拼接次数,?只能出现一次 for(let i in par){ if(i != 'route' && i != 'page_url' && i != 'is_tabbar'){ // 跳过route、page_url、is_tabbar + options[i] = par[i]; if(flag){ path += '?'+ i +'='+ par[i]; flag = false; @@ -49,9 +51,10 @@ } } } - console.log(par) + console.log(par); if(par.is_tabbar){ - this.$url(path, {type: 'switch'}); + uni.setStorageSync('homePageOptions', options); + this.$url(par.page_url, {type: 'switch'}); }else{ this.$url(path, {type: 'redirect'}); }