瀏覽代碼

✨ feat:

zbb 6 天之前
父節點
當前提交
ef9865cc30
共有 3 個文件被更改,包括 22 次插入6 次删除
  1. 1 1
      components/companyIntroduce/index.vue
  2. 1 1
      components/empty-state/index.vue
  3. 20 4
      store/modules/user.js

+ 1 - 1
components/companyIntroduce/index.vue

@@ -39,7 +39,7 @@
 			display: flex;
 			align-items: center;
 			gap: 16rpx;
-			margin: 38rpx 0 30rpx;
+			margin: 12rpx 0 12rpx;
 			.img{
 				width: 124rpx;
 				height: 40rpx;

+ 1 - 1
components/empty-state/index.vue

@@ -58,7 +58,7 @@ const props = defineProps({
 	// 自定义图片(优先级高于icon)
 	image: {
 		type: String,
-		default: ''
+		default: '/static/image/public/no-data.png'
 	},
 	// 是否显示按钮
 	showBtn: {

+ 20 - 4
store/modules/user.js

@@ -37,7 +37,7 @@ export const useUserStore = defineStore('user', {
 		qrInfo: {
 
 		},
-		cardImage:"",
+		cardImage: "",
 	}),
 	actions: {
 		// 获取用户卡片信息
@@ -48,7 +48,16 @@ export const useUserStore = defineStore('user', {
 				} : {}
 				let res = await getCardInfo(parmas)
 				console.log(res, "resresresresresres");
-				this.cardInfo = res.data
+				if (res.code == 200) {
+					this.cardInfo = res.data
+					this.cardInfo.avatar = res.data.avatar.replace("http","https")
+					
+				} else if (res.code == 401) {
+					// token 失效,清除登录态并跳转登录页
+					uni.removeStorageSync('token')
+					this.$reset()
+					uni.reLaunch({ url: '/pages/login/login' })
+				}
 				resolve(res.data)
 			})
 		},
@@ -58,8 +67,15 @@ export const useUserStore = defineStore('user', {
 					userId
 				} : {}
 				let res = await getCompanyInfo(parmas)
-				this.companyInfo = res.data
-				this.companyInfo.introduce = formatRichText(res.data.introduce)
+				if (res.code == 200) {
+					this.companyInfo = res.data
+					this.companyInfo.introduce = formatRichText(res.data.introduce)
+				} else if (res.code == 401) {
+					// token 失效,清除登录态并跳转登录页
+					uni.removeStorageSync('token')
+					this.$reset()
+					uni.reLaunch({ url: '/pages/login/login' })
+				}
 				resolve(this.companyInfo)
 			})
 		},