From c9a4731768084a84c37ae4ad280e2ab4d11d6535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=99=93=E7=90=AA?= Date: Fri, 26 Aug 2022 17:24:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LearunApp-2.2.0/App.vue | 2 +- .../LearunApp-2.2.0/pages/weixinLogin.vue | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue index 55e9bb57a..e8e26ff44 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/App.vue @@ -10,7 +10,7 @@ // H5 刷新时获取当前页面路径 const pagePath = "/" + param.path; // 如果 H5 刷新后访问的不是首页/登录页/注册页,直接跳转回首页 - if (!["/pages/login", "/pages/home", "/pages/signup"].includes(pagePath)) { + if (!["/pages/login", "/pages/weixinLogin","/pages/home", "/pages/signup"].includes(pagePath)) { this.$nextTick(() => { this.TAB_TO("/pages/home"); return; diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/weixinLogin.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/weixinLogin.vue index 924100876..de5b9bae9 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/weixinLogin.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/weixinLogin.vue @@ -31,7 +31,7 @@ - 确 认 + 确 认 常规登陆 @@ -86,8 +86,10 @@ export default { } }, - async onLoad({code}) { - this.code = code + async onLoad() { + if(this.getHashSearchParam("code")){ + this.code = this.getHashSearchParam("code") + } await this.init() }, @@ -108,6 +110,17 @@ export default { // this.ready = true this.loginInit() }, + getHashSearchParam(key) { + let search = location.search + let array = [] + if(search){ + search = search.substring(1) + array = search.split("&") + let res = array.find((item)=>item.split("=")[0] == key) + return res.split("=")[1] + } + return '' + }, // 点击新用户注册 signUp() { @@ -117,8 +130,9 @@ export default { loginInit(){ if (this.code) { this.LOADING("加载中...") - this.HTTP_POST("weixinapi/getweixinaccess_token?code="+this.code).then(success=>{ + this.HTTP_POST("weixinapi/getweixinaccess_token?code="+this.code,null).then(success=>{ this.HIDE_LOADING() + return if(!success){ location.href = "http://" + window.location.host; return @@ -129,6 +143,7 @@ export default { token: success.baseinfo.token, date: moment().format('yyyy-MM-dd hh:mm:ss') }; + this.ready = true this.SET_STORAGE("token",success.baseinfo.token) // this.SET_STORAGE("logininfo",logininfo) // this.SET_STORAGE("userinfo",success)