添加默认头像
This commit is contained in:
parent
ccb09bac2a
commit
dffb1fe2b6
@ -21,7 +21,7 @@
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-info-box">
|
||||
<view class="user-icon">
|
||||
<image src="https://img.smartadmin.1024lab.net/hexagon/logo.png" class="user-image" />
|
||||
<image :src="avatar || defaultAvatar" class="user-image" />
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<view class="user-name">{{ actualName }}</view>
|
||||
@ -54,6 +54,7 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { SmartLoading, SmartToast } from '@/lib/smart-support';
|
||||
import { smartSentry } from '@/lib/smart-sentry';
|
||||
import defaultAvatar from '@/static/common/default-avatar.png';
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@ -61,6 +62,10 @@
|
||||
return userStore.administratorFlag || userStore.backAdministratorFlag;
|
||||
});
|
||||
|
||||
const avatar = computed(() => {
|
||||
return useUserStore().avatar;
|
||||
});
|
||||
|
||||
const actualName = computed(() => {
|
||||
return userStore.actualName;
|
||||
});
|
||||
|
||||
@ -3,7 +3,12 @@
|
||||
<view class="list-item" @click="gotoDetail(item.villagerId)" v-for="item in list" :key="item.villagerId">
|
||||
<view class="item-left">
|
||||
<!-- mode="widthFix" -->
|
||||
<image @tap.stop="_previewImage([item.avatar], item.avatar)" class="image" :src="item.avatar" mode="aspectFill" />
|
||||
<image
|
||||
@tap.stop="_previewImage(item.avatar?.[0]?.fileUrl || defaultAvatar)"
|
||||
class="image"
|
||||
:src="item.avatar?.[0]?.fileUrl || defaultAvatar"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="item-center">
|
||||
<view class="title">
|
||||
@ -52,10 +57,10 @@
|
||||
},
|
||||
});
|
||||
|
||||
const _previewImage = (images, image) => {
|
||||
const _previewImage = (image) => {
|
||||
//预览图片
|
||||
uni.previewImage({
|
||||
urls: images,
|
||||
urls: [image],
|
||||
current: image,
|
||||
});
|
||||
};
|
||||
|
||||
BIN
src/static/common/default-avatar.png
Normal file
BIN
src/static/common/default-avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@ -166,6 +166,7 @@ export const useUserStore = defineStore({
|
||||
this.lastLoginTime = data.lastLoginTime;
|
||||
this.currentVillageId = data.villageId;
|
||||
this.villagerId = data.villagerId;
|
||||
this.avatar = data.avatar;
|
||||
|
||||
uni.setStorageSync(USER_TOKEN, data.token);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user