Commit 8fe15180 authored by youjie's avatar youjie

no message

parent c5d4c613
......@@ -36,7 +36,7 @@
:src="userStore.memberData.photo || systemConfigStore.config?.logo || 'https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp'"
/>
</a-avatar>
<span class="ml-[9px] text-sm">{{ t('personal.profile') }}</span>
<span class="ml-[9px] text-sm text-nowrap">{{ t('personal.profile') }}</span>
</div>
<template #content>
<a-doption @click="goPage('/myOrder')">
......
......@@ -61,7 +61,7 @@ const router = createRouter({
component: () => import ('../views/personalCenter/resetPassword.vue')
},
{
path: '/editEmail',
path: '/editEmail/:forward?',
meta: { title: "page.editEmail" },
component: () => import ('../views/personalCenter/editEmail.vue')
},
......
......@@ -657,7 +657,7 @@ class UserService {
ProviderType
}
const response = await OtaRequest.get(
'/member-auth/member-center',
'/member-auth/external-unbind-bind',
data,
{
headers: tenantId ? {
......
......@@ -56,6 +56,24 @@ export const useUserStore = defineStore('user', {
},
actions: {
// 更新单个字段
updateProfileField(path: string, value: any) {
const keys = path.split('.')
let current: any = this.personalInfor
for (let i = 0; i < keys.length - 1; i++) {
const key = keys[i]
if (!current[key]) current[key] = {}
current = current[key]
}
current[keys[keys.length - 1]] = value
},
// 更新多个字段
updateProfile(fields: Partial<typeof this.personalInfor>) {
this.personalInfor = { ...this.personalInfor, ...fields }
},
/**
* 设置email
* @param email email
......
......@@ -457,7 +457,6 @@ const init = async () => {
router.replace('/')
}
}
console.log('params',router.currentRoute.value.params.email)
if(!params||!params.email){
init()
}else{
......
......@@ -3,14 +3,14 @@
<a-spin :loading="loading">
<a-scrollbar class="max-h-[815px] overflow-auto"
ref="scrollContainer">
<div v-if="userInfor&&userInfor.email!=''" class="accountCenter rounded-[14px] border-[1px] mb-[28px] flex items-center py-[30px] pl-[43px] pr-[35px]">
<div v-if="userInfor?.email" class="accountCenter rounded-[14px] border-[1px] mb-[28px] flex items-center py-[30px] pl-[43px] pr-[35px]">
<div class="w-[102px] mr-[43px]">
<div class="customPrimary-bg-7 rounded-full w-[50px] h-[50px] flex justify-center items-center">
<img class="w-[29px] h-[36px]" src="../../assets/images/personal/mm.png" alt="" />
</div>
</div>
<div class="text-sm w-[200px]">
<span v-if="userInfor&&userInfor.email==''" class="customColor-text-7">{{ t('personal.notYetBin') }}</span>
<span v-if="userInfor?.email==''" class="customColor-text-7">{{ t('personal.notYetBin') }}</span>
<span v-else class="SourceHanSansCN">
<span>{{ t('personal.securityLevel') }}</span>
<span class="customPrimary-9">{{ t('personal.low') }}</span>
......@@ -41,7 +41,7 @@
</div>
</div>
<div class="text-sm w-[200px] font-medium">
<span :class="[userInfor&&userInfor.phone?'':'customColor-text-7']">{{ userInfor&&userInfor.phone?userInfor.phone:t('personal.notYetBin') }}</span>
<span :class="[userInfor?.phone?'':'customColor-text-7']">{{ userInfor?.phone?userInfor.phone:t('personal.notYetBin') }}</span>
</div>
<div class="w-[415px] leading-[20px] SourceHanSansCN">
<div class="customColor-text-7">{{ t('personal.bindPhoneTip') }}</div>
......@@ -51,7 +51,7 @@
type="primary"
size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
<span class="customPrimary-6 font-medium ">{{userInfor&&userInfor.phone?t('personal.changeBindData'):t('personal.goBind')}}</span>
<span class="customPrimary-6 font-medium ">{{userInfor?.phone?t('personal.changeBindData'):t('personal.goBind')}}</span>
</a-button>
</div>
</div> -->
......@@ -62,7 +62,7 @@
</div>
</div>
<div class="text-sm w-[200px] font-medium">
<span :class="[userInfor&&userInfor.email!=''?'':'customColor-text-7']">{{ userInfor&&userInfor.email!=''?userInfor.email:t('personal.notYetBin') }}</span>
<span :class="[userInfor?.email?'':'customColor-text-7']">{{ userInfor?.email?userInfor.email:t('personal.notYetBin') }}</span>
</div>
<div class="w-[415px] leading-[20px] SourceHanSansCN">
<div class="customColor-text-7">{{ t('personal.bindEmailTip') }}</div>
......@@ -72,7 +72,7 @@
type="primary"
size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
<span class="customPrimary-6 font-medium">{{userInfor&&userInfor.email!=''?t('personal.changeBindData'):t('personal.goBind')}}</span>
<span class="customPrimary-6 font-medium">{{userInfor?.email?t('personal.changeBindData'):t('personal.goBind')}}</span>
</a-button>
</div>
</div>
......@@ -113,7 +113,7 @@
type="primary"
size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
<span class="customPrimary-6 font-medium">{{WeChatInfor?t('personal.unBind'):t('personal.unBind')}}</span>
<span class="customPrimary-6 font-medium">{{GoogleInfor?t('personal.unBind'):t('personal.goBind')}}</span>
<div v-if="!GoogleInfor"
ref="googleButtonContainer"
class="g-signin2 rounded-full !rounded-[13px] overflow-hidden
......@@ -168,7 +168,8 @@ const systemConfig = reactive({
distributorId: systemConfigStore.distributorId as any,
})
const loginType = ref(userStore.loginType)
const userInfor = ref(null as any)
const userInfor = ref<any>(userStore.personalInfor)
const orderList = ref<any>([])
const currentStatus = ref(0)
......@@ -190,9 +191,8 @@ const LnlineInfor = ref(null as any)
// 打开微信绑定账号弹窗信息
const openInfo = ref({} as any)
watch(() => userStore.personalInfor, (newVal, oldVal) => {
userInfor.value = newVal
userInfor.value?.externalLoginList.forEach((x:any) => {
const inData = () =>{
userInfor?.value?.externalLoginList.forEach((x:any) => {
if(x.provider=='WeChat'){
WeChatInfor.value = x
}
......@@ -203,7 +203,7 @@ watch(() => userStore.personalInfor, (newVal, oldVal) => {
LnlineInfor.value = x
}
});
})
}
const goPage = (path: string) => {
router.push(path)
......@@ -235,7 +235,8 @@ const unBindWeChatAccount = async (type: number) => {
const getPersonalInfor = async () => {
const response = await UserService.memberCenterAsync(systemConfig.tenantId)
userStore.setPersonalInfor(response)
// userStore.setPersonalInfor(response)
userStore.updateProfile(response)
}
// 获取微信绑定AppID 域名 重定向页面
......@@ -364,6 +365,13 @@ onMounted(async () => {
console.error('SDK 初始化失败:', error);
}
});
watch(() => userStore.personalInfor, (newVal, oldVal) => {
userInfor.value = newVal
inData()
})
inData()
</script>
<style scoped lang="scss">
.accountCenter{
......
......@@ -139,7 +139,8 @@ const goPage = (path:string) => {
const getPersonalInfor = async () => {
const response = await UserService.memberCenterAsync(tenantId.value)
userStore.setPersonalInfor(response)
// userStore.setPersonalInfor(response)
userStore.updateProfile(response)
}
getPersonalInfor()
</script>
......
......@@ -18,7 +18,7 @@
</div>
</div>
<div class="text-[32px] font-bold w-[319px] text-center ">
{{ userInfor&&userInfor.email!=''?t('personal.editEmail'):t('personal.binEmail') }}
{{ userInfor?.email?t('personal.editEmail'):t('personal.binEmail') }}
</div>
</div>
</a-form-item>
......@@ -53,7 +53,7 @@
</template>
</a-input>
</a-form-item>
<template v-if="userInfor&&userInfor.email==''">
<template v-if="userInfor?.email==''">
<a-form-item field="password" :label="t('login.setPassword')" class="">
<a-input-password class="formData-input"
v-model="formData.password"
......@@ -89,7 +89,7 @@
class="!w-[319px] SourceHanSansCN flex-1 font-bold text-gray-200 !h-[46px] !rounded-[13px] !text-base"
@click="handleSubmit()"
>
{{ userInfor&&userInfor.email!=''?t('personal.confirmChange'):t('personal.save') }}
{{ userInfor?.email?t('personal.confirmChange'):t('personal.save') }}
</a-button>
</a-form-item>
</a-form>
......@@ -126,6 +126,7 @@ const props = defineProps({
const { t } = useI18n();
const router = useRouter()
const { params } = router.currentRoute.value
const userStore = useUserStore()
const systemConfigStore = useSystemConfigStore()
const userInfor = ref<any>(userStore.personalInfor)
......@@ -218,7 +219,16 @@ const canSendCode = computed(() => {
// 邮箱验证延时器
let emailCheckTimer: number | null = null
watch(() => userStore.personalInfor, (newVal, oldVal) => {
if(newVal!=oldVal){
userInfor.value = newVal
}
})
const goPage = (path: string) => {
if(params&&params.forward){
return router.push(`/${params.forward}`)
}
router.push(path)
}
......@@ -433,7 +443,11 @@ const handleSubmit = async () => {
const response = await userStore.setEmailAsync(registerData)
if (response.status== 'SUCCESS') {
if(params&&params.forward){
goPage(`/${params.forward}`)
}else{
goPage('/accountCenter')
}
}
} catch (error: any) {
console.error('提交失败:', error)
......
......@@ -8,7 +8,7 @@
</div>
<div>
<div class="myOrder-bin">
{{t('personal.bindingEmail')}}
{{ t('personal.bindingEmail')}}
</div>
<div class="mt-[10px] flex items-center">
<span class="text-base font-normal">{{ userInfor?.email || t('personal.unbound') }}</span>
......@@ -150,6 +150,7 @@
<script setup lang="ts">
import { ref, inject, computed, watch, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user'
import { useSystemConfigStore } from '@/stores/index'
// 引入订单状态枚举
......@@ -159,12 +160,12 @@ import Modal from '@/components/common/modal.vue'
import editEmail from './components/myOrder/editEmail.vue'
const { t } = useI18n()
const router = useRouter()
const userStore = useUserStore()
const systemConfigStore = useSystemConfigStore()
const userData = ref({} as any)
userData.value = inject('userData')
const userInfor = ref(null as any)
const userInfor = ref<any>(userStore.personalInfor)
const showType = ref(null as number | null)
const modalConfig = ref({
......@@ -238,15 +239,20 @@ watch(() => userStore.personalInfor, (newVal, oldVal) => {
}
})
const goPage = (path: string) => {
router.push(path)
}
const handleSaveSuccess = () => {
ModalRef.value.handleCancel()
}
// 编辑邮箱 绑定邮箱
const editEmailClick = async () => {
showType.value = 1
modalConfig.value.title = userInfor.value.email?t('personal.editEmail'):t('personal.binEmail')
if(ModalRef.value) await ModalRef.value.openModal(userInfor.value)
goPage(`/editEmail/myOrder`)
// showType.value = 1
// modalConfig.value.title = userInfor.value.email?t('personal.editEmail'):t('personal.binEmail')
// if(ModalRef.value) await ModalRef.value.openModal(userInfor.value)
}
const changeStatus = (key: number) => {
......
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