添加默认头像
This commit is contained in:
parent
c5e06be4e6
commit
4f51f23da7
@ -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>
|
||||
@ -51,11 +51,16 @@
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { useUserStore } from '@/store/modules/system/user';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import defaultAvatar from '@/static/common/default-avatar.png';
|
||||
|
||||
const isHideVillage = computed(() => {
|
||||
return useUserStore().administratorFlag || useUserStore().backAdministratorFlag;
|
||||
});
|
||||
|
||||
const avatar = computed(() => {
|
||||
return useUserStore().avatar;
|
||||
});
|
||||
|
||||
const actualName = computed(() => {
|
||||
return useUserStore().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">
|
||||
@ -40,6 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import defaultAvatar from '@/static/common/default-avatar.png';
|
||||
import Navigation from '@/components/navigation.vue';
|
||||
const props = defineProps({
|
||||
marginTop: {
|
||||
@ -52,10 +58,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 |
@ -162,6 +162,7 @@ export const useUserStore = defineStore({
|
||||
this.lastLoginIpRegion = data.lastLoginIpRegion;
|
||||
this.lastLoginUserAgent = data.lastLoginUserAgent;
|
||||
this.lastLoginTime = data.lastLoginTime;
|
||||
this.avatar = data.avatar;
|
||||
|
||||
uni.setStorageSync(USER_TOKEN, data.token);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user