Commit c1e29238 by pangchong

feat: 调整

parent 28d02d1c
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
"transformPx" : false, "transformPx" : false,
/* 5+App特有相关 */ /* 5+App特有相关 */
"app-plus" : { "app-plus" : {
"compatible" : {
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
},
"usingComponents" : true, "usingComponents" : true,
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3, "compilerVersion" : 3,
......
...@@ -77,13 +77,14 @@ const useUserStore = defineStore('mocpUser', { ...@@ -77,13 +77,14 @@ const useUserStore = defineStore('mocpUser', {
}, },
//退出登录 //退出登录
handleLogOut() { handleLogOut() {
this.token = '' this.resetUserInfo()
this.userInfo = undefined
//返回登录页面 //返回登录页面
uni.$mocpJump.redirectTo('/login/index') uni.$mocpJump.redirectTo('/login/index')
}, },
//重置席位权限 //重置用户信息
resetSeat() { resetUserInfo() {
this.token = ''
this.userInfo = undefined
this.seatId = '' this.seatId = ''
this.seatPermission = ['all'] this.seatPermission = ['all']
this.configData = [] this.configData = []
......
...@@ -58,7 +58,7 @@ watch( ...@@ -58,7 +58,7 @@ watch(
) )
const userStore = useUserStore() const userStore = useUserStore()
onLoad(() => { onLoad(() => {
userStore.resetSeat() userStore.resetUserInfo()
loginForm.verifyCode = '' loginForm.verifyCode = ''
getGifCaptcha() getGifCaptcha()
loginAmms() loginAmms()
...@@ -75,6 +75,7 @@ const handleLogin = async () => { ...@@ -75,6 +75,7 @@ const handleLogin = async () => {
}) })
loading.value = true loading.value = true
await login() await login()
if (userStore.token) {
//加入席位权限 //加入席位权限
await getUserSeatList() await getUserSeatList()
if (userStore.seatId) { if (userStore.seatId) {
...@@ -84,6 +85,7 @@ const handleLogin = async () => { ...@@ -84,6 +85,7 @@ const handleLogin = async () => {
} }
//跳转工作台 //跳转工作台
uni.$mocpJump.redirectTo('/tab/index') uni.$mocpJump.redirectTo('/tab/index')
}
} catch (error) { } catch (error) {
uni.$mocpMessage.error('登录失败') uni.$mocpMessage.error('登录失败')
} finally { } finally {
...@@ -96,6 +98,7 @@ const login = async () => { ...@@ -96,6 +98,7 @@ const login = async () => {
const res = await loginApi(toRaw(loginForm)) const res = await loginApi(toRaw(loginForm))
if (res.code == 200) { if (res.code == 200) {
userStore.setUserInfo(res.data) userStore.setUserInfo(res.data)
return true
} else { } else {
uni.$mocpMessage.error(res.message) uni.$mocpMessage.error(res.message)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment