This commit is contained in:
oneao committed 2025-10-08 19:41:13 +08:00
1 parent b03e2c1e69
commit 8770e4fddc
9 files changed
+217 -116

No files matched your search

@@ -8,7 +8,7 @@ onLaunch(() => {
console.log('App Launch')
})
onShow(() => {
userStore.requireLogin()
// userStore.requireLogin()
console.log('App Show')
})
@@ -34,9 +34,9 @@ export const navigateToInterceptor = {
export const routeInterceptor = {
install() {
uni.addInterceptor('navigateTo', navigateToInterceptor)
uni.addInterceptor('reLaunch', navigateToInterceptor)
uni.addInterceptor('redirectTo', navigateToInterceptor)
uni.addInterceptor('switchTab', navigateToInterceptor)
// uni.addInterceptor('navigateTo', navigateToInterceptor)
// uni.addInterceptor('reLaunch', navigateToInterceptor)
// uni.addInterceptor('redirectTo', navigateToInterceptor)
// uni.addInterceptor('switchTab', navigateToInterceptor)
},
}
@@ -34,35 +34,47 @@ function onSubmit() {
formRef.value
?.validate()
.then(() => {
_loading.value = true
loginOrgApi({
orgid: formModel.orgid,
userid: formModel.userid,
password: formModel.password,
}).then((res) => {
if (res.data) {
userStore.userInfo.orgid = formModel.orgid
userStore.userInfo.userid = formModel.userid
userStore.userInfo.token = res.data
userStore.userInfo.orgid = formModel.orgid
userStore.userInfo.userid = formModel.userid
userStore.userInfo.token = '123'
uni.showToast({
title: '登录成功',
icon: 'success',
})
uni.switchTab({
url: '/pages/home/index',
})
}
else {
uni.showToast({
title: '登录失败,请稍后再试',
icon: 'error',
})
}
}).finally(() => {
_loading.value = false
uni.showToast({
title: '登录成功',
icon: 'success',
})
uni.switchTab({
url: '/pages/home/index',
})
// _loading.value = true
// loginOrgApi({
// orgid: formModel.orgid,
// userid: formModel.userid,
// password: formModel.password,
// }).then((res) => {
// if (res.data) {
// userStore.userInfo.orgid = formModel.orgid
// userStore.userInfo.userid = formModel.userid
// userStore.userInfo.token = res.data
// uni.showToast({
// title: '登录成功',
// icon: 'success',
// })
// uni.switchTab({
// url: '/pages/home/index',
// })
// }
// else {
// uni.showToast({
// title: '登录失败,请稍后再试',
// icon: 'error',
// })
// }
// }).finally(() => {
// _loading.value = false
// })
})
.catch((error: FieldValidateError[]) => {
toast.fail(error[0].message)
@@ -2,8 +2,8 @@
"globalStyle": {
"navigationStyle": "default",
"navigationBarTitleText": "App",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#2c3e50",
"navigationBarTextStyle": "white",
"backgroundColor": "#FFFFFF"
},
"easycom": {
@@ -11,6 +11,10 @@ function handleLoginOut() {
onConfirm() {
toast.success('退出成功')
userStore.reset()
uni.navigateTo({
url: '/pages-sub/login/index',
})
},
})
}
@@ -4,7 +4,7 @@
page,
.sar-portal {
--sar-input-border-color: #ddd;
--sar-primary: #0064fa;
--sar-primary: #34495E;
--sar-rounded: 4rpx;
}