更新请求封装文件

This commit is contained in:
2024-12-10 15:09:34 +08:00
parent 4fec1aeb5d
commit 55f47da140

View File

@@ -6,10 +6,16 @@ import merge from 'lodash/merge'
import {clearLoginInfo} from '@/utils' import {clearLoginInfo} from '@/utils'
export const entryName = '短剧13.2系统'; export const entryName = '短剧13.2系统';
// const baseUrl = "http://192.168.1.15:8100/sqx_fast/"
// const baseUrl = "https://video.hnsiyao.cn/sqx_fast/"
const baseUrl = "https://dj-api.hnsiyao.cn/sqx_fast/"
// const $urlMap={ // const $urlMap={
// local:'http://192.168.1.15:8100/sqx_fast/', // local:'http://192.168.1.15:8100/sqx_fast/',
// product:'https://video.hnsiyao.cn/sqx_fast/', // product:'https://dj-api.hnsiyao.cn/sqx_fast/',
// test:'https://video.hnsiyao.cn/sqx_fast/', // test:'https://dj-api.hnsiyao.cn/sqx_fast/',
// } // }
// const $env='product' // const $env='product'
const http = axios.create({ const http = axios.create({
@@ -27,8 +33,8 @@ http.interceptors.request.use(config => {
config.headers['token'] = Vue.cookie.get('token') // 请求头带上token config.headers['token'] = Vue.cookie.get('token') // 请求头带上token
// config.baseURL = $urlMap[$env] // config.baseURL = $urlMap[$env]
const arr = config.url.split('sqx_fast/') const arr = config.url.split('sqx_fast/')
config.url = "https://video.hnsiyao.cn/sqx_fast/" + (arr.length >= 2 ? arr[1] : arr[0]) config.url = baseUrl + (arr.length >= 2 ? arr[1] : arr[0])
// config.url = "https://video.hnsiyao.cn/sqx_fast/" // config.url = "https://dj-api.hnsiyao.cn/sqx_fast/"
return config return config
}, error => { }, error => {
return Promise.reject(error) return Promise.reject(error)
@@ -57,7 +63,7 @@ http.adornUrl = (actionName) => {
// return 'http://192.168.0.132:8100/sqx_fast/' + actionName // return 'http://192.168.0.132:8100/sqx_fast/' + actionName
// return 'https://duanjuadmin.xianmxkj.com/sqx_fast/' + actionName // return 'https://duanjuadmin.xianmxkj.com/sqx_fast/' + actionName
actionName = actionName.replace(/^\//, ""); actionName = actionName.replace(/^\//, "");
return 'https://video.hnsiyao.cn/sqx_fast/' + actionName return baseUrl + actionName
} }
http.adornUrlUp = (actionName) => { http.adornUrlUp = (actionName) => {
@@ -66,7 +72,7 @@ http.adornUrlUp = (actionName) => {
// return 'http://192.168.0.132:8183/sqx_fast/' + actionName // return 'http://192.168.0.132:8183/sqx_fast/' + actionName
// return 'https://duanjuadmin.xianmxkj.com/sqx_fast/' + actionName // return 'https://duanjuadmin.xianmxkj.com/sqx_fast/' + actionName
actionName = actionName.replace(/^\//, ""); actionName = actionName.replace(/^\//, "");
return 'https://video.hnsiyao.cn/sqx_fast/' + actionName return baseUrl + actionName
} }
http.adornUrlWX = (actionName) => { http.adornUrlWX = (actionName) => {
@@ -75,7 +81,7 @@ http.adornUrlWX = (actionName) => {
actionName = actionName.replace(/^\//, ""); actionName = actionName.replace(/^\//, "");
return '/weixin/' + actionName return '/weixin/' + actionName
// return 'https://api.weixin.qq.com/' + actionName // return 'https://api.weixin.qq.com/' + actionName
// return 'https://video.hnsiyao.cn/sqx_fast/' + actionName // return 'https://dj-api.hnsiyao.cn/sqx_fast/' + actionName
} }
/** /**