Commit 3dd242bb by pangchong

feat: 修改登录

parent 52f7f6b2
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</view> </view>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<global-button class="login-btn" size="large" type="primary" @tap="handleLogin">登录</global-button> <global-button class="login-btn" size="large" type="primary" @tap="handleLogin" :loading="loading">登录</global-button>
</view> </view>
</global-page> </global-page>
</template> </template>
...@@ -55,9 +55,12 @@ watch( ...@@ -55,9 +55,12 @@ watch(
//登录 //登录
const userStore = useUserStore() const userStore = useUserStore()
const loginFormRef = ref() const loginFormRef = ref()
const loading = ref(false)
const handleLogin = async () => { const handleLogin = async () => {
await loginFormRef.value?.validate() await loginFormRef.value?.validate()
loading.value = true
const res = await loginApi(toRaw(loginForm), { loading: '登陆中...' }) const res = await loginApi(toRaw(loginForm), { loading: '登陆中...' })
loading.value = false
if (res.code == 200) { if (res.code == 200) {
userStore.setUserInfo(res.data) userStore.setUserInfo(res.data)
} else { } else {
......
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