Commit b1bbcab6 authored by youjie's avatar youjie

微信登录

parent f60782be
...@@ -67,20 +67,14 @@ service.interceptors.response.use( ...@@ -67,20 +67,14 @@ service.interceptors.response.use(
// 处理 401 错误(临时令牌过期) // 处理 401 错误(临时令牌过期)
if (error.response?.status === 401) { if (error.response?.status === 401) {
const tempToken = sessionStorage.getItem('tempToken'); const tempToken = sessionStorage.getItem('tempToken');
console.log('临时令牌过期:', tempToken);
if (tempToken) { if (tempToken) {
// 清除临时令牌和 OTA 用户信息 // 清除临时令牌和 OTA 用户信息
sessionStorage.removeItem('tempToken'); sessionStorage.removeItem('tempToken');
sessionStorage.removeItem('otaUserInfo'); sessionStorage.removeItem('otaUserInfo');
useUserStore().signOutAsync(); useUserStore().signOutAsync();
location.href= '/login';
// 返回更友好的错误信息
// const customError = new Error('授权已过期,请重新从 OTA 平台进入');
// (customError as any).response = error.response;
// (customError as any).config = error.config;
// (customError as any).isAuthExpired = true;
// return Promise.reject(customError);
} }
location.href= '/login';
} }
// 如果有响应数据,尝试提取错误信息 // 如果有响应数据,尝试提取错误信息
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/> />
</a-avatar> </a-avatar>
<template #content> <template #content>
<a-doption @click="goPage('/personalCenter/myOrder')"> <a-doption @click="goPage('/myOrder')">
<template #icon> <template #icon>
<icon-user /> <icon-user />
</template> </template>
......
...@@ -15,7 +15,7 @@ const router = createRouter({ ...@@ -15,7 +15,7 @@ const router = createRouter({
component: () => import ('../views/home/index.vue') component: () => import ('../views/home/index.vue')
}, },
{ {
path: '', path: '/personalCenter',
meta: { title: "page.profile" }, meta: { title: "page.profile" },
component: () => import ('../views/personalCenter/index.vue'), component: () => import ('../views/personalCenter/index.vue'),
children: [{ children: [{
......
...@@ -198,7 +198,6 @@ export const useUserStore = defineStore('user', { ...@@ -198,7 +198,6 @@ export const useUserStore = defineStore('user', {
async registerDistributorAsync(data: DistributorSelfRegisterDto): Promise<UserLoginResult> { async registerDistributorAsync(data: DistributorSelfRegisterDto): Promise<UserLoginResult> {
try { try {
const response = await UserService.distributorSelfRegisterAsync(data) const response = await UserService.distributorSelfRegisterAsync(data)
console.log('Register response:', response)
this.token = response.token || '' this.token = response.token || ''
this.userInfo = response.userInfo || {} this.userInfo = response.userInfo || {}
this.memberData = response.memberData this.memberData = response.memberData
......
...@@ -157,7 +157,7 @@ const loginMsg = reactive({ ...@@ -157,7 +157,7 @@ const loginMsg = reactive({
reType: 0,//登录方式 0账号密码 1谷歌授权 3LINE授权 7FaceBook授权 reType: 0,//登录方式 0账号密码 1谷歌授权 3LINE授权 7FaceBook授权
openId: "", openId: "",
email: "2310721242@qq.com",// email: "2310721242@qq.com",//
password: 'yj950815',//123456 password: 'yj123456',//123456
distributorId: systemConfigStore.distributorId as any, distributorId: systemConfigStore.distributorId as any,
parentId: null, parentId: null,
redirectUri: '', redirectUri: '',
......
...@@ -439,6 +439,16 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{ ...@@ -439,6 +439,16 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{
} }
}) })
// 初始化
const init = async () => {
// 如果已经登录且是正常用户,直接跳转到首页
if (userStore.getUserToken && userStore.getUser) {
router.replace('/')
}
}
init()
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.light-login-bg { .light-login-bg {
...@@ -457,7 +467,7 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{ ...@@ -457,7 +467,7 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{
height: 46px; height: 46px;
border-radius: 12px !important; border-radius: 12px !important;
background-color: #EEEFEB; background-color: #EEEFEB;
border: 2px solid #FFFFFF; border: 2px solid rgba(225,225,225,0);
} }
:deep(.arco-input-focus){ :deep(.arco-input-focus){
border-radius: 12px; border-radius: 12px;
...@@ -527,9 +537,9 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{ ...@@ -527,9 +537,9 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{
opacity: 0 !important; opacity: 0 !important;
} }
:deep(.arco-btn-text.arco-btn-disabled){ :deep(.arco-btn-text.arco-btn-disabled){
background-color: #EEEEEB; background-color: rgba(225,225,225,0);
} }
:deep(.arco-btn-text.arco-btn-loading){ :deep(.arco-btn-text.arco-btn-loading){
background-color: #dddddd; background-color: rgba(225,225,225,0);
} }
</style> </style>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
size="large" size="large"
:placeholder="t('login.setPasswordRequired')" :placeholder="t('login.setPasswordRequired')"
:maxLength="8" :maxLength="8"
:defaultVisibility="false" :defaultVisibility="true"
:invisible-button="false" :invisible-button="false"
> >
<!-- <template #prefix> <!-- <template #prefix>
...@@ -113,7 +113,8 @@ ...@@ -113,7 +113,8 @@
@click.stop="handleAreaCodeChange(option.value)"> @click.stop="handleAreaCodeChange(option.value)">
<div class="flex items-center space-x-3 px-2 py-1"> <div class="flex items-center space-x-3 px-2 py-1">
<!-- <span class="text-lg">{{ option.flag }}</span> --> <!-- <span class="text-lg">{{ option.flag }}</span> -->
<span class="font-medium">{{ option.label }}({{ option.value }})</span> <span class="font-medium">{{ option.label }}</span>
<span class="text-[#A3A4A0] font-light">({{ option.value }})</span>
</div> </div>
</a-doption> </a-doption>
</template> </template>
...@@ -377,7 +378,7 @@ const getSimples = async () => { ...@@ -377,7 +378,7 @@ const getSimples = async () => {
if(result&&result.length>0){ if(result&&result.length>0){
AreaCodeList.value = result.map((item: any) => ({ AreaCodeList.value = result.map((item: any) => ({
label: item.name, label: item.name,
value: item.phoneCode value: `+${item.phoneCode}`
})) }))
} }
} }
...@@ -672,6 +673,16 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{ ...@@ -672,6 +673,16 @@ watch(()=>currentStep.value,(newVal,oldVal)=>{
} }
}) })
// 初始化
const init = async () => {
// 如果已经登录且是正常用户,直接跳转到首页
if (userStore.getUserToken && userStore.getUser) {
router.replace('/')
}
}
init()
getSimples() getSimples()
</script> </script>
...@@ -694,7 +705,7 @@ getSimples() ...@@ -694,7 +705,7 @@ getSimples()
height: 46px; height: 46px;
border-radius: 12px !important; border-radius: 12px !important;
background-color: #EEEFEB; background-color: #EEEFEB;
border: 2px solid #FFFFFF; border: 2px solid rgba(225,225,225,0);
} }
:deep(.arco-input-focus){ :deep(.arco-input-focus){
border-radius: 12px; border-radius: 12px;
...@@ -766,9 +777,9 @@ getSimples() ...@@ -766,9 +777,9 @@ getSimples()
opacity: 0 !important; opacity: 0 !important;
} }
:deep(.arco-btn-text.arco-btn-disabled){ :deep(.arco-btn-text.arco-btn-disabled){
background-color: #EEEEEB; background-color: rgba(225,225,225,0);
} }
:deep(.arco-btn-text.arco-btn-loading){ :deep(.arco-btn-text.arco-btn-loading){
background-color: #dddddd; background-color: rgba(225,225,225,0);
} }
</style> </style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</div> </div>
<div class="mt-[13px] text-lg font-medium text-center truncate">{{ userInfo.name }}</div> <div class="mt-[13px] text-lg font-medium text-center truncate">{{ userInfo.name }}</div>
<div class="flex justify-center items-center mt-[10px] cursor-pointer"> <div class="flex justify-center items-center mt-[10px] cursor-pointer">
<span v-if="userInfo.externalLoginList?.length==0" class="LeftViewTisp w-[6px] h-[6px] rounded-full"></span> <span v-if="!userInfo.IsComplete" class="LeftViewTisp w-[6px] h-[6px] rounded-full"></span>
<span class="LeftViewData ml-[5px] text-sm font-medium text-[#666]"> <span class="LeftViewData ml-[5px] text-sm font-medium text-[#666]">
{{ t('personal.completeProfile') }} {{ t('personal.completeProfile') }}
>> >>
......
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