From 1cc5fd76248222cb6fa62a9db93c9716b635f480 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 22 Jan 2026 17:38:46 +0800
Subject: [PATCH] feat:工单
---
uniapps/work-app/src/utils/requestGd/index.js | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/uniapps/work-app/src/utils/requestGd/index.js b/uniapps/work-app/src/utils/requestGd/index.js
index 09fab9b..3875688 100644
--- a/uniapps/work-app/src/utils/requestGd/index.js
+++ b/uniapps/work-app/src/utils/requestGd/index.js
@@ -5,11 +5,11 @@
import website from '@/config/website'
import { Base64} from 'js-base64'
-const http = new Request()
+const httpGd = new Request()
export function request (config) {
return new Promise((resolve, reject) => {
- http
+ httpGd
.request(config)
.then(res => {
resolve(res)
@@ -22,12 +22,13 @@
// 请求拦截器
-function requestInterceptors(http) {
+function requestInterceptors(httpGd) {
- http.interceptors.request.use((config) => {
+ httpGd.interceptors.request.use((config) => {
const {detail} = useUserStore().$state?.userInfo || {}
// 假设有token值需要在头部需要携带
- let accessToken = useUserStore()?.$state?.userInfo?.gd_access_token;
+ // let accessToken = useUserStore()?.$state?.userInfo?.gd_access_token;
+ let accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJ1c2VyX25hbWUiOiJ5ankiLCJyZWFsX25hbWUiOiJ5ankiLCJhdmF0YXIiOiIiLCJhdXRob3JpdGllcyI6WyJrZmpzIl0sImNsaWVudF9pZCI6InNhYmVyIiwicm9sZV9uYW1lIjoia2ZqcyIsImxpY2Vuc2UiOiJwb3dlcmVkIGJ5IGJsYWRleCIsInBvc3RfaWQiOiIiLCJ1c2VyX2lkIjoiMjAwODc5MzU1MDA1OTkyNTUwNSIsInJvbGVfaWQiOiIyMDA4NzMzNDY5MTg3MzY2OTE0Iiwic2NvcGUiOlsiYWxsIl0sIm5pY2tfbmFtZSI6InlqeSIsIm9hdXRoX2lkIjoiIiwiZGV0YWlsIjp7ImFyZWFDb2RlIjpudWxsLCJhcmVhTmFtZSI6Iuaxn-ilv-ecgSIsImFjdGl2ZUxvYW5zQXJlYUNvZGUiOltdfSwiZXhwIjoxNzY5MDc1MzY1LCJkZXB0X2lkIjoiMTEyMzU5ODgxMzczODY3NTIwMSIsImp0aSI6ImUwMGFhNzIzLTU5YjgtNDNmNy1hZmU2LTNiMjZlNTM5NTUxMiIsImFjY291bnQiOiJ5ankifQ.CJTDqgL2wu2KgrUNncBz34VYPoxUfKXxgScBUUE-BhM'
if (accessToken) {
config.header['Blade-Auth'] = 'bearer ' + accessToken;
}
@@ -37,15 +38,16 @@
// 安全请求header
config.header['Blade-Requested-With'] = 'BladeHttpRequest';
// 客户端认证参数
- config.header['Authorization'] = 'Basic ' + Base64.encode(website.clientId + ':' + website.clientSecret);
+ // config.header['Authorization'] = 'Basic ' + Base64.encode(website.clientId + ':' + website.clientSecret);
+ config.header['Authorization'] = 'Basic ' + 'c2FiZXI6c2FiZXJfc2VjcmV0';
return config
}, config => { // 可使用async await 做异步操作
return Promise.reject(config)
})
}
-function responseInterceptors(http) {
- http.interceptors.response.use((response) => {
+function responseInterceptors(httpGd) {
+ httpGd.interceptors.response.use((response) => {
let res = response
const status = res.data.error_code || res.data.code || res.statusCode
const message = res?.data?.msg || res?.data?.error_description || res?.data?.message || '系统错误'
@@ -72,7 +74,8 @@
// 引入拦截器配置
export function setupRequest () {
- http.setConfig(defaultConfig => {
+ httpGd.setConfig(defaultConfig => {
+
/* defaultConfig 为默认全局配置 */
defaultConfig.baseURL = getEnvObj().VITE_API_BASE_URL_GD
// #ifdef H5
@@ -82,8 +85,8 @@
// #endif
return defaultConfig
})
- requestInterceptors(http)
- responseInterceptors(http)
+ requestInterceptors(httpGd)
+ responseInterceptors(httpGd)
}
--
Gitblit v1.9.3