wuhb 2 месяцев назад
Родитель
Сommit
7b36600e8e
2 измененных файлов с 6 добавлено и 11 удалено
  1. 0 4
      api/user/info.uts
  2. 6 7
      utils/request.uts

+ 0 - 4
api/user/info.uts

@@ -44,10 +44,6 @@ export const updatePassword = async (password: string, newPassword: string): Pro
 	return request({
 	return request({
         url: '/system/user/profile/updatePwd',
         url: '/system/user/profile/updatePwd',
         method: 'PUT',
         method: 'PUT',
-		header: {
-		  isToken: false,
-		  repeatSubmit: false
-		},
         data: dataForm,
         data: dataForm,
     })
     })
 }
 }

+ 6 - 7
utils/request.uts

@@ -14,8 +14,8 @@ export type RequestConfig = {
 
 
 // 基础 URL
 // 基础 URL
 // const BASE_URL = "http://192.168.110.105:8080";
 // const BASE_URL = "http://192.168.110.105:8080";
-const BASE_URL = "http://222.243.138.146:5095" //测试服务器;
-	// const BASE_URL = "http://222.243.138.146:5097" //正式服务器;
+// const BASE_URL = "http://222.243.138.146:5095" //测试服务器;
+	const BASE_URL = "http://222.243.138.146:5097" //正式服务器;
 // const BASE_URL = "http://10.170.129.135:8089";
 // const BASE_URL = "http://10.170.129.135:8089";
 // const BASE_URL = "http://222.243.138.146:5096/prod-api"
 // const BASE_URL = "http://222.243.138.146:5096/prod-api"
 // const BASE_URL = "http://10.170.129.135/prod-api";
 // const BASE_URL = "http://10.170.129.135/prod-api";
@@ -52,6 +52,9 @@ export const request = (config: RequestConfig): Promise<any> => {
             for (const key in customHeader) {
             for (const key in customHeader) {
                 header[key] = customHeader[key];
                 header[key] = customHeader[key];
             }
             }
+			if(config.header['isToken'] == false){
+				header["Authorization"] = ""
+			}
         }
         }
 
 
         // 发起请求
         // 发起请求
@@ -82,11 +85,7 @@ export const request = (config: RequestConfig): Promise<any> => {
                     }else if (code != null && (code == 403)) {
                     }else if (code != null && (code == 403)) {
                         // 有些接口使用 code 字段
                         // 有些接口使用 code 字段
 						const errorMsg = msg != null ? msg : "请求失败";
 						const errorMsg = msg != null ? msg : "请求失败";
-						uni.showToast({
-						    title: config.url + errorMsg ,
-						    icon: 'success'
-						})
-                        resolve(result as any);
+						reject(new Error(errorMsg));
                     } else {
                     } else {
                         const errorMsg = msg != null ? msg : "请求失败";
                         const errorMsg = msg != null ? msg : "请求失败";
                         reject(new Error(errorMsg));
                         reject(new Error(errorMsg));