This commit is contained in:
2025-06-26 20:25:32 +08:00
parent e18168ea73
commit cfff1b4062
5 changed files with 45 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ export default {
onShow: function () { onShow: function () {
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN
const UserStore = useUserStore(); const UserStore = useUserStore();
if (!UserStore.isLogin && window.location.href.indexOf('/pages/register/index') < 0) { if (!UserStore.isLogin && window.location.href.indexOf('/pages/register/index') < 0 && window.location.href.indexOf('/pages/fastInput/index') < 0) {
toPage('/pages/login/index'); toPage('/pages/login/index');
} }
// #endif // #endif

View File

@@ -411,6 +411,13 @@ const system = {
data: data data: data
}); });
}, },
passLogin: async (id) => {
return request({
method: MethodsENUM.POST,
url: "/login/passLogin",
data: {id}
});
},
} }
export default system; export default system;

View File

@@ -22,6 +22,13 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/fastInput/index",
"style": {
"navigationBarTitleText": "快速进入",
"navigationStyle": "custom"
}
},
{ {
"path": "pages/myTask/index", "path": "pages/myTask/index",
"style": { "style": {

View File

@@ -0,0 +1,20 @@
<script setup>
import {onLoad} from "@dcloudio/uni-app";
import AESCrypto from "../../utils/AESCrypto.js";
import {useUserStore} from "../../pinia/UserStore/index.js";
const UserStore = useUserStore();
onLoad((options) => {
const {context, iv} = options;
const res = AESCrypto.decrypt(context, iv);
UserStore.passLogin(res);
});
</script>
<template>
</template>
<style scoped lang="scss">
</style>

View File

@@ -1,5 +1,5 @@
import {defineStore} from "pinia"; import {defineStore} from "pinia";
import {ref, reactive} from "vue"; import {reactive, ref} from "vue";
import {clearObject, toPage} from "../../utils/uils.js"; import {clearObject, toPage} from "../../utils/uils.js";
import Api from "../../api/index.js"; import Api from "../../api/index.js";
@@ -20,6 +20,14 @@ export const useUserStore = defineStore('UserStore', () => {
Object.assign(userInfo, data); Object.assign(userInfo, data);
} }
const passLogin = async (id) => {
const {data} = await Api.system.passLogin(id);
Object.assign(userInfo, data);
isLogin.value = true;
token.value = data.token;
await toPage('/pages/user/index');
}
const setToken = (value) => { const setToken = (value) => {
isLogin.value = true; isLogin.value = true;
token.value = value; token.value = value;
@@ -32,6 +40,7 @@ export const useUserStore = defineStore('UserStore', () => {
logout, logout,
setToken, setToken,
getUserInfo, getUserInfo,
passLogin,
} }
}, { }, {
persist: { persist: {