From 90675cb210f5a2afc4766e6fd091776a14397d48 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期三, 23 四月 2025 17:34:01 +0800
Subject: [PATCH] 最新版

---
 src/plugin/axios/index.ts |   66 +++++++++++++--------------------
 1 files changed, 26 insertions(+), 40 deletions(-)

diff --git a/src/plugin/axios/index.ts b/src/plugin/axios/index.ts
index e0c1d14..6bbd491 100644
--- a/src/plugin/axios/index.ts
+++ b/src/plugin/axios/index.ts
@@ -1,56 +1,42 @@
 import axios from 'axios'
-import myConfig from '@/assets/js/config.js'
+import myConfig from '@/assets/js/config.ts'
 // 鍒涘缓 axios 瀹炰緥
 const service = axios.create({
-  baseURL: myConfig.requestCtx,
-  timeout: myConfig.requestTimeOut // 璇锋眰瓒呮椂鏃堕棿
+	baseURL: myConfig.requestCtx,
+	timeout: myConfig.requestTimeOut, // 璇锋眰瓒呮椂鏃堕棿
 })
 
 // 璇锋眰鎷︽埅鍣�
 // app-6MPX5Fr97eK6BWHpy8g7vddd
 
 service.interceptors.request.use(
-  (config) => {
-    const token = "app-6MPX5Fr97eK6BWHpy8g7vddd"
-    if (token) config.headers['Authorization'] = `Bearer ${token}`
-    return config
-  },
-  (error) => {
-    // 鍙戦�佸け璐�
-    Promise.reject(error)
-  }
+	(config) => {
+		const token = 'app-TmoRR8VCs9nNEb9CxVpyIDcb'
+		if (token) config.headers['Authorization'] = `Bearer ${token}`
+		config.headers['Content-Type'] = 'application/json;charset=utf-8'
+		return config
+	},
+	(error) => {
+		// 鍙戦�佸け璐�
+		Promise.reject(error)
+	},
 )
 
 // 鍝嶅簲鎷︽埅鍣�
 service.interceptors.response.use(
-  (response) => {
-    // dataAxios 鏄� axios 杩斿洖鏁版嵁涓殑 data
-    const dataAxios = response.data
-    if (typeof dataAxios.data === 'boolean') {
-      return dataAxios.data
-    }
-    if (response.config.responseType == 'blob') {
-      return dataAxios
-    }
-    const { success } = dataAxios
-    if (dataAxios.currentDate) {
-      sessionStorage.currentDate = new Date(dataAxios.currentDate).getTime()
-    }
-    // 鏍规嵁 code 杩涜鍒ゆ柇
-    if (success) {
-      return dataAxios.data ? dataAxios.data : dataAxios
-    } else {
-      // 鎻愮ず閿欒
-    }
-  },
-  (error) => {
-    if (error.response && error.response.data && error.response.data.error) {
-      console.error(error.response.data.error.msg)
-    } else {
-      console.error('璇锋眰鍙戠敓閿欒')
-    }
-    return Promise.reject(error)
-  }
+	(response) => {
+		if (response.status == 200 && response.statusText == 'OK') {
+			return response.data
+		}
+	},
+	(error) => {
+		if (error.response && error.response.data && error.response.data.error) {
+			console.error(error.response.data.error.msg)
+		} else {
+			console.error('璇锋眰鍙戠敓閿欒')
+		}
+		return Promise.reject(error)
+	},
 )
 
 export default service

--
Gitblit v1.9.1