Commit d6d11a65 authored by guxukai's avatar guxukai

chore: query-wrapper完善

parent cbb7678a
...@@ -72,6 +72,7 @@ const layoutStore = useLayout() ...@@ -72,6 +72,7 @@ const layoutStore = useLayout()
const $router = useRouter() const $router = useRouter()
const captchaUrl = ref(`${process.env.API_PREFIX}/api/kaptcha/kaptcha`) const captchaUrl = ref(`${process.env.API_PREFIX}/api/kaptcha/kaptcha`)
const authLoginForm = reactive(new AuthLoginPostReq({})) const authLoginForm = reactive(new AuthLoginPostReq({}))
authStore.$reset()
const rules: any = { const rules: any = {
username: { required: helpers.withMessage('用户名不能为空', required) }, username: { required: helpers.withMessage('用户名不能为空', required) },
password: { required: helpers.withMessage('密码不能为空', required) }, password: { required: helpers.withMessage('密码不能为空', required) },
......
...@@ -18,31 +18,29 @@ const { ...@@ -18,31 +18,29 @@ const {
loading: userLoading, loading: userLoading,
error: userError, error: userError,
run: userRun, run: userRun,
} = useRequest( } = useRequest(() =>
() => UserToken.get({
UserToken.get({ token: authStore.loginInfo.token,
token: authStore.loginInfo.token, }).then(res => {
}).then(res => { if (res.code === GATEWAY_CODE.success) {
if (res.code === GATEWAY_CODE.success) { userStore.$patch({ userInfo: res.data })
userStore.$patch({ userInfo: res.data }) //超管跳转
//超管跳转 if (authStore.loginInfo.id === 10000000) {
if (authStore.loginInfo.id === 10000000) { authStore.$patch({
authStore.$patch({ consoleInfo: {
consoleInfo: { consoleName: '超管',
consoleName: '超管', consoleObjectId: '1',
consoleObjectId: '1', consoleTypeId: '1',
consoleTypeId: '1', },
}, })
}) window.location.replace(`${origin}/super/proxy`)
window.location.replace(`${origin}/super/proxy`) return
return
}
//其余跳转
authStore.$reset()
window.location.replace(`${origin}/account/proxy`)
} }
return res //其余跳转
}), authStore.$reset()
{ manual: true }, window.location.replace(`${origin}/account/proxy`)
}
return res
}),
) )
</script> </script>
...@@ -222,8 +222,6 @@ const { ...@@ -222,8 +222,6 @@ const {
const handleLogout = () => { const handleLogout = () => {
logoutRun().then(res => { logoutRun().then(res => {
if (res?.code === GATEWAY_CODE.success) { if (res?.code === GATEWAY_CODE.success) {
const authStore = useAuth()
authStore.$reset()
window.location.replace(window.location.origin + '/entry/login') window.location.replace(window.location.origin + '/entry/login')
} else { } else {
MessageUtils.warning(res?.message) MessageUtils.warning(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