Browse Source
Merge branch 'wangyi/feature-20251026183100-deepmate王毅' into milestone-20251031-简版功能开发
lihuilin/feature-20251024095243-我的
Merge branch 'wangyi/feature-20251026183100-deepmate王毅' into milestone-20251031-简版功能开发
lihuilin/feature-20251024095243-我的
9 changed files with 206 additions and 15 deletions
-
30api/start/login.js
-
2components/deepExploration_header.vue
-
25components/login-prompt.vue
-
10pages/deepMate/deepMate.vue
-
1pages/start/Registration/Registration.vue
-
95pages/start/recoverPassword/recoverPassword.vue
-
1stores/index.js
-
44stores/modules/login.js
-
13utils/http.js
@ -0,0 +1,44 @@ |
|||||
|
import { defineStore } from 'pinia' |
||||
|
import { ref } from 'vue' |
||||
|
|
||||
|
// 定义 Store
|
||||
|
export const useLoginStore = defineStore( |
||||
|
'login', |
||||
|
() => { |
||||
|
// 会员信息
|
||||
|
const loginInfo = ref("true") |
||||
|
|
||||
|
// 保存会员信息,登录时使用
|
||||
|
const setLoginInfo = (val) => { |
||||
|
loginInfo.value = val |
||||
|
} |
||||
|
|
||||
|
// 清理会员信息,退出时使用
|
||||
|
const clearLoginInfo = () => { |
||||
|
loginInfo.value = undefined |
||||
|
} |
||||
|
|
||||
|
// 记得 return
|
||||
|
return { |
||||
|
loginInfo, |
||||
|
setLoginInfo, |
||||
|
clearLoginInfo, |
||||
|
} |
||||
|
}, |
||||
|
// TODO: 持久化
|
||||
|
{ |
||||
|
// 网页端持久化
|
||||
|
// persist: true,
|
||||
|
// 小程序端持久化
|
||||
|
persist: { |
||||
|
storage: { |
||||
|
getItem(key) { |
||||
|
return uni.getStorageSync(key) |
||||
|
}, |
||||
|
setItem(key, value) { |
||||
|
uni.setStorageSync(key, value) |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
) |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue