Commit 8fe15180 authored by youjie's avatar youjie

no message

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