登录逻辑修改

parent 56979060
......@@ -16,10 +16,13 @@ declare module 'vue' {
VanForm: typeof import('vant/es')['Form']
VanIcon: typeof import('vant/es')['Icon']
VanList: typeof import('vant/es')['List']
VanNoticeBar: typeof import('vant/es')['NoticeBar']
VanPopup: typeof import('vant/es')['Popup']
VanPullRefresh: typeof import('vant/es')['PullRefresh']
VanSearch: typeof import('vant/es')['Search']
VanSticky: typeof import('vant/es')['Sticky']
VanSwipe: typeof import('vant/es')['Swipe']
VanSwipeItem: typeof import('vant/es')['SwipeItem']
VanTab: typeof import('vant/es')['Tab']
VanTabs: typeof import('vant/es')['Tabs']
VanTextEllipsis: typeof import('vant/es')['TextEllipsis']
......
......@@ -6,13 +6,13 @@ import { loginBySgy } from '@/api/account'
const userStore = useUserStore()
onLaunch(async () => {
// #ifdef H5-SGY
if (import.meta.env.VITE_APP_ENV === 'production') {
userStore.logout()
fastLoginBySgy()
return
} else {
if (userStore.logout) await signIn2();
}
// if (import.meta.env.VITE_APP_ENV === 'production') {
// userStore.logout()
// fastLoginBySgy()
// return
// } else {
// if (userStore.logout) await signIn2();
// }
// #endif
});
......
......@@ -75,6 +75,7 @@
import { showToast, showLoadingToast, closeToast } from 'vant'
import { loginByPassword, loginBySgy } from '@/api/account'
import useUserStore from '@/store/user'
import testJson from '@/utils/test.json';
const router = useRouter()
const userStore = useUserStore()
......@@ -85,6 +86,19 @@ const formData = ref({
account: '',
password: ''
})
onLoad(async() => {
if (import.meta.env.VITE_APP_ENV === 'development') {
if (userStore.logout) await signIn2();
return
}
if(xma.xh.isMediaConvergenceXinhuaApp()) {
userStore.logout()
fastLoginBySgy()
}
})
const login = async () => {
if (!formData.value.account) {
showToast('请输入用户名')
......@@ -133,10 +147,26 @@ const fastLoginBySgy = () => {
icon: 'success'
})
// router.pushTab({ name: 'home' })
router.back()
// router.back()
router.push({ name: 'home' })
}
});
}
// 登录
const signIn2 = async () => {
showLoadingToast({
title: '加载中...',
mask: true,
});
sgyLoginParams.value.encryptDataMap = testJson
const res = await loginBySgy(sgyLoginParams.value)
console.log(res)
userStore.login(res)
closeToast()
// router.pushTab({ name: 'home' })
router.push({ name: 'mine' })
};
</script>
<style scoped>
......
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