xiaoxin 2 vuotta sitten
vanhempi
commit
cb12b4ed45
2 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 4 2
      pages/main/main.vue
  2. 2 2
      utils/api.js

+ 4 - 2
pages/main/main.vue

@@ -94,8 +94,10 @@ const getUseAppList = async () => {
 		}
 	})
 	// console.log(res)
-	const result = JSON.parse(decryptDes(res.data))
-	useAppList.value = result
+	if (res.code == 200) {
+		const result = JSON.parse(decryptDes(res.data))
+		useAppList.value = result
+	}
 }
 
 // 跳转登录页

+ 2 - 2
utils/api.js

@@ -11,8 +11,8 @@ export const myRequest = (options) => {
 			url: BASE_URL + options.url,
 			method: options.method || "GET",
 			header: options.header || {
-				'token': uni.getStorageSync('token'),
-				'user_head': uni.getStorageSync('userhead')
+				'token': uni.getStorageSync('token') || '',
+				'user_head': uni.getStorageSync('userhead') || ''
 			},
 			data: options.data || {},
 			timeout: 25000,