feat: 右上角图标随个人中心弹窗展示而变化

This commit is contained in:
2025-12-24 11:48:31 +08:00
parent a5cf919ded
commit 53b9a83b80
6 changed files with 65 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive, onMounted, inject } from 'vue'
import { ref, reactive, onMounted, inject ,watch} from 'vue'
import router from '@/router'
import { showConfirmDialog } from 'vant'
import { useUserInfoStore, useOverallStore } from '@/stores'
@@ -13,7 +13,7 @@ const props = defineProps<{
const userInfoStore = useUserInfoStore()
const overallStore = useOverallStore()
const emit = defineEmits(['view-type', 'selected-customer'])
const emit = defineEmits(['view-type', 'selected-customer','change-visible'])
const show = ref(false)
const isEdit = ref(false)
const form = reactive({
@@ -28,6 +28,12 @@ const open = () => {
const close = () => {
show.value = false
}
watch(show,(newVal)=>{
emit('change-visible', newVal)
MyEvent.emit('change-profile-visible',newVal)
})
const onEditItem = (item) => {
if (!form[item]) return
form[item].edit = true
@@ -49,7 +55,6 @@ const confirm = () => {
username: form.name.value,
email: form.email.value,
}
console.log(params)
setTimeout(() => {
overallStore.setLoading(false)
isEdit.value = false

View File

@@ -5,7 +5,11 @@
>
<div class="setting flex flex-between">
<SvgIcon name="left" size="70" @click.stop="handleBack" />
<SvgIcon name="profile_white" size="55" @click="handleOpenProfile" />
<SvgIcon
:name="profileVisible ? 'profileFilledWhite' : 'profile_white'"
size="55"
@click="handleOpenProfile"
/>
</div>
<template v-if="pageMode === 'entry'">
<div class="content flex-1 flex flex-center flex-column">
@@ -58,7 +62,12 @@
</div>
</template>
<Profile ref="profileRef" @selected-customer="handleSelectCustomer" is-customer />
<Profile
ref="profileRef"
@change-visible="handleChangeVisible"
@selected-customer="handleSelectCustomer"
is-customer
/>
</div>
</template>
<script setup lang="ts">
@@ -147,6 +156,11 @@ const handleSelectCustomer = (value) => {
}
}
const profileVisible = ref(false)
const handleChangeVisible = (visible: boolean) => {
profileVisible.value = visible
}
const handleBack = (e?: Event) => {
if (e) {
e.stopPropagation()