Browse Source

fix 头像更新修复

master
whyzxhnd 8 hours ago
parent
commit
bcc47124c2
  1. 11
      web/src/views/Profile/Index.vue
  2. 3
      web/src/views/Profile/components/BasicInfo.vue
  3. 9
      web/src/views/Profile/components/ProfileUser.vue
  4. 3
      web/src/views/Profile/components/UserAvatar.vue
  5. 4
      web/src/views/lock/grouplock/components/MobileGroupLock.vue

11
web/src/views/Profile/Index.vue

@ -7,13 +7,13 @@
<span>{{ t('profile.user.title') }}</span>
</div>
</template>
<ProfileUser ref="profileUserRef" />
<ProfileUser ref="profileUserRef" @update:avatar="handleUpdateAvatar" />
</el-card>
<el-card class="user ml-3 w-2/3" shadow="hover">
<div>
<el-tabs v-model="activeName" class="profile-tabs" style="height: 400px" tab-position="top">
<el-tab-pane :label="t('profile.info.basicInfo')" name="basicInfo">
<BasicInfo @success="handleBasicInfoSuccess" />
<BasicInfo @success="handleBasicInfoSuccess" ref="basicInfoRef" />
</el-tab-pane>
<el-tab-pane :label="t('profile.info.resetPwd')" name="resetPwd">
<ResetPwd />
@ -30,11 +30,16 @@ const { t } = useI18n()
defineOptions({ name: 'Profile' })
const activeName = ref('basicInfo')
const profileUserRef = ref()
const basicInfoRef = ref()
//
const handleBasicInfoSuccess = async () => {
await profileUserRef.value?.refresh()
}
const handleUpdateAvatar = () => {
basicInfoRef.value.init()
}
</script>
<style scoped>
.user {
@ -52,7 +57,7 @@ const handleBasicInfoSuccess = async () => {
padding: 15px !important;
}
.profile-tabs > .el-tabs__content {
.profile-tabs>.el-tabs__content {
padding: 32px;
font-weight: 600;
color: #6b778c;

3
web/src/views/Profile/components/BasicInfo.vue

@ -101,4 +101,7 @@ const init = async () => {
onMounted(async () => {
await init()
})
defineExpose({
init
})
</script>

9
web/src/views/Profile/components/ProfileUser.vue

@ -1,7 +1,7 @@
<template>
<div>
<div class="text-center">
<UserAvatar :img="userInfo?.avatar" />
<UserAvatar :img="userInfo?.avatar" @update:img="handleUpdateAvatar" />
</div>
<ul class="list-group list-group-striped">
<li class="list-group-item">
@ -52,6 +52,8 @@ import UserAvatar from './UserAvatar.vue'
import { getUserProfile, ProfileVO } from '@/api/system/user/profile'
const emit = defineEmits(['update:avatar'])
defineOptions({ name: 'ProfileUser' })
const { t } = useI18n()
@ -61,6 +63,11 @@ const getUserInfo = async () => {
userInfo.value = users
}
const handleUpdateAvatar = (avatar: string) => {
userInfo.value.avatar = avatar
emit('update:avatar', avatar)
}
//
defineExpose({
refresh: getUserInfo

3
web/src/views/Profile/components/UserAvatar.vue

@ -20,6 +20,8 @@ import { UploadRequestOptions } from 'element-plus/es/components/upload/src/uplo
defineOptions({ name: 'UserAvatar' })
const emit = defineEmits(['update:img'])
defineProps({
img: propTypes.string.def('')
})
@ -40,6 +42,7 @@ const handelUpload = async ({ data }) => {
// userStore
cropperRef.value.close()
await userStore.setUserAvatarAction(avatar)
emit('update:img', avatar)
}
</script>

4
web/src/views/lock/grouplock/components/MobileGroupLock.vue

@ -1,8 +1,8 @@
<template>
<div class="mobile-container">
<div>位置权限{{ locationPermission ? '是' : '否' }}</div>
<!-- <div>位置权限{{ locationPermission ? '是' : '否' }}</div>
<div>蓝牙权限{{ bluetoothPermission ? '是' : '否' }}</div>
<div>相机权限{{ cameraPermission ? '是' : '否' }}</div>
<div>相机权限{{ cameraPermission ? '是' : '否' }}</div> -->
<div class="mobile-header">
<el-input
v-model="searchText"

Loading…
Cancel
Save