Эх сурвалжийг харах

优化头像不显示问题

LinWuTai 1 жил өмнө
parent
commit
4426aebbef

+ 2 - 1
pages/login/login.vue

@@ -99,7 +99,8 @@
 								cache.session.setJSON('email',res.data.user.email)
 								cache.session.setJSON('nickName',res.data.user.nickName)
 								cache.session.setJSON('userName',res.data.user.userName)
-								cache.session.setJSON('userId',res.data.user.userId)
+								cache.session.setJSON('userId',res.data.user.userId) // avatar
+								cache.session.setJSON('avatar', res.data.user.avatar)
 								uni.switchTab({
 									url:'/pages/home/home'
 								})

+ 3 - 1
pages/menus/menu/menu.vue

@@ -3,7 +3,7 @@
 		<image style="width: 100%;" mode="aspectFill" :src="imgSrc('/profile/logo/menuBackgroundImage.png')"></image>
 		<view class="big-circle"></view>
 		<view class="avatar-area z10" >
-			<u-avatar :src="src" size="80" shape="circle"></u-avatar>
+			<u-avatar :src="avatar.length > 0 ? imgSrc(avatar) : src" size="80" shape="circle"></u-avatar>
 		</view>
 		<view class="menu-area z10">
 			<view class="basic-msg">
@@ -88,6 +88,7 @@
 		data() {
 			return {
 				src: 'https://tupian.qqw21.com/article/UploadPic/2021-1/20211722215735941.jpg',
+				avatar: '',
 				name: "",
 				amount:null,
 				role:"",
@@ -241,6 +242,7 @@
 			this.init()
 			this.name = cache.session.getJSON('nickName')
 			this.role = cache.session.getJSON('role')
+			this.avatar = cache.session.getJSON('avatar')
 		}
 	}
 </script>