Forráskód Böngészése

fix: 接口code==-1时,消息为空时,返回默认消息

liujt 1 napja
szülő
commit
76748dc793
2 módosított fájl, 3 hozzáadás és 3 törlés
  1. 1 1
      main.js
  2. 2 2
      utils/request.js

+ 1 - 1
main.js

@@ -8,7 +8,7 @@ Vue.prototype.$isAuthorities = (authorities)=>{
 	try {
 		let authoritiesLiat=uni.getStorageSync('authorities') //按钮
 		let authoritiesCode=JSON.parse(authoritiesLiat).map(item=>item.permissionCode)
-		console.log(authoritiesCode,'authoritiesCode')
+		// console.log(authoritiesCode,'authoritiesCode')
 		return authoritiesCode.includes(authorities)
 	} catch (error) {
 		//TODO handle the exception

+ 2 - 2
utils/request.js

@@ -37,7 +37,7 @@ const http = ({
 			timeout: 600000,
 			...other,
 			complete: (res) => {
-				// console.log(res,'res')
+				// console.log(res.data,'res~~~')
 				if (showLoading) {
 					uni.hideLoading();
 				}
@@ -64,7 +64,7 @@ const http = ({
 					}, 1500);
 				} else if (res.data.code == -1) {
 					wx.showToast({
-						title: res.data.message,
+						title: res.data.message || "数据获取失败",
 						icon: "none",
 					});
 					reject(res.data)