소스 검색

头像id为空时不在去获取头像

zhanghui 2 년 전
부모
커밋
1e256c60e1
2개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 1
      pages/index/index.vue
  2. 4 1
      pages/my/my.vue

+ 4 - 1
pages/index/index.vue

@@ -468,7 +468,10 @@
 			getUserInfo() {
 				this.$api.user.getUserInfo().then(res => {
 					this.userInfo = res.data.data
-					this.getImgUrlByOssId(this.userInfo.avatar)
+					uni.setStorageSync('userInfo', this.userInfo )
+					if (this.userInfo.avatar){
+						this.getImgUrlByOssId(this.userInfo.avatar)
+					}
 					if (this.userInfo.signIn){
 						this.currServiceInfo()
 					}

+ 4 - 1
pages/my/my.vue

@@ -131,7 +131,10 @@
 			getUserInfo(){
 				this.$api.user.getUserInfo().then(res=>{
 					this.userInfo = res.data.data
-					this.getImgUrlByOssId(this.userInfo.avatar)
+					uni.setStorageSync('userInfo', this.userInfo )
+					if (this.userInfo.avatar){
+						this.getImgUrlByOssId(this.userInfo.avatar)
+					}
 				})
 			},