Pārlūkot izejas kodu

feat(qilang/my): 动态加载用户头像图片

- 将静态图片地址替换为动态绑定的 image 数据属性- 在 data 中初始化默认图片地址
- 根据接口返回数据动态设置用户头像- 优化条件判断逻辑,使用严格相等运算符
- 添加对空值和空字符串的检查以确保图片地址有效
mws 1 mēnesi atpakaļ
vecāks
revīzija
53380aae6a
1 mainītis faili ar 7 papildinājumiem un 3 dzēšanām
  1. 7 3
      pages/qilang/my/my.vue

+ 7 - 3
pages/qilang/my/my.vue

@@ -17,7 +17,7 @@
 				<u-row customStyle="margin-bottom: 10px">
 					<u-col span="4">
 						<image class="tubiao"
-							src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/qilang/common/logo.png"
+							:src="image"
 							mode="aspectFit" />
 					</u-col>
 					<u-col span="8">
@@ -62,7 +62,8 @@
 		data() {
 			return {
 				userPhone: '',
-				point: 0
+				point: 0,
+        image:'https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/qilang/common/logo.png'
 			}
 		},
 		onLoad() {
@@ -78,9 +79,12 @@
 				let that = this;
 				getMiniCustomerUserInfo().then(res => {
 
-					if (res.code == 0) {
+					if (res.code === 0) {
 						that.userPhone = res.data.phone;
 						that.point = res.data.point;
+            if (res.data.image !== '' && res.data.image != null){
+              that.image = res.data.image;
+            }
 						console.log(that.point);
 					}
 				})