From 598a3c1b0e2d5cd9a61824fab34b83d76debf217 Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Thu, 1 Aug 2024 02:59:34 +0800 Subject: [PATCH] uu --- common/loginHandle.js | 13 ++++++++++++- common/untool.js | 3 +++ components/buns-api/login/index.vue | 10 ++++++++-- components/buns-api/login/mp-login.vue | 4 ++-- pages/login/login.vue | 6 ------ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/common/loginHandle.js b/common/loginHandle.js index 6c2cd6c..55d3af1 100644 --- a/common/loginHandle.js +++ b/common/loginHandle.js @@ -2,5 +2,16 @@ import { goto } from "./untool" export const goLogin = ()=> { - // goto("login/login", 2) + // #ifdef MP + setTimeout(()=> { + console.log("===uni===", uni) + + debugger + }, 500) + debugger + // #endif + + // #ifndef MP + goto("login/login", 2) + // #endif } \ No newline at end of file diff --git a/common/untool.js b/common/untool.js index 8b97971..c6aafe9 100644 --- a/common/untool.js +++ b/common/untool.js @@ -259,6 +259,9 @@ const setNavigationBarTitle = (title)=> { } const reloadCurrentPage = (_thisPage)=> { + let routes = getCurrentPages(); // 获取当前打开过的页面路由数组 + let curPage = routes[routes.length - 1] // 获取当前页面路由,也就是最后一个打开的页面路由 + _thisPage = curPage || _thisPage let { fullPath } = _thisPage.$page uni.redirectTo({ url: fullPath diff --git a/components/buns-api/login/index.vue b/components/buns-api/login/index.vue index ab3f87f..ff59d22 100644 --- a/components/buns-api/login/index.vue +++ b/components/buns-api/login/index.vue @@ -1,6 +1,6 @@ @@ -29,17 +29,23 @@ }, created() { + // setSessionXToken() // 登录前先清除xtoke }, + mounted(){ + }, methods: { async handleLoginedBack() { await promiseTimeout(300) await this.$store.dispatch(USERKEY.GETUSERINFO) - showToast("登录成功") + // showToast("登录成功") this.reloadCurrentPage(this) // 刷新当前页面 }, handleShowLogin() { this.lgDialog.show = true + }, + triggerLogin(){ + this.$refs.lcRef.initData() } } } diff --git a/components/buns-api/login/mp-login.vue b/components/buns-api/login/mp-login.vue index fa0c188..ccade6a 100644 --- a/components/buns-api/login/mp-login.vue +++ b/components/buns-api/login/mp-login.vue @@ -63,7 +63,6 @@ phoneNumber: { required: true, requiredMsg: '手机号不能为空' }, }, token: '', - isLogined: !!getSessionXToken() } }, computed: { @@ -85,7 +84,8 @@ } }, async initData(){ - if(!this.isLogined) { + let isLogined = !!getSessionXToken() + if(!isLogined) { await this.autoLogin() if(this.token) { // 如果用户信息已绑定,直接触发登录成功 diff --git a/pages/login/login.vue b/pages/login/login.vue index f40a445..31965fc 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -10,13 +10,7 @@ import { encrypt } from "@/common/libs/jsencrypt_utils" import { promiseTimeout, showToast } from "@/common/untool" - // #ifdef MP - import LoginComponent from "@/components/buns-api/login/mp-login" - // #endif - - // #ifndef MP import LoginComponent from "@/components/buns-api/login/com-login" - // #endif export default { components: { LoginComponent },