修改前端去除后端模块名
This commit is contained in:
5
.env.removeMode
Normal file
5
.env.removeMode
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
NODE_ENV = removeMode
|
||||||
|
VITE_NAME="removeMode"
|
||||||
|
# 电网一张图 地图图层
|
||||||
|
VITE_NARIMAP=null
|
||||||
|
VITE_NRGISCOMMON=null
|
||||||
@@ -18,6 +18,14 @@ pnpm i
|
|||||||
#运行项目
|
#运行项目
|
||||||
npm run dev
|
npm run dev
|
||||||
|
|
||||||
|
#冀北现场启动命令 区分是否加载现场电网一张图内网api
|
||||||
|
npm run dev:jibei
|
||||||
|
|
||||||
|
#去除后台所有模块名 如除/xxxx-boot
|
||||||
|
npm run dev:removeMode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#因海南和冀北技术监督不同 通过修改文件的方式来区分
|
#因海南和冀北技术监督不同 通过修改文件的方式来区分
|
||||||
#海南打包 需要吧pqs目录下supervise_hn 文件夹改成supervise 原文件改成supervise_jb
|
#海南打包 需要吧pqs目录下supervise_hn 文件夹改成supervise 原文件改成supervise_jb
|
||||||
#冀北打包 需要吧pqs目录下supervise_jb 文件夹改成supervise 原文件改成supervise_hn
|
#冀北打包 需要吧pqs目录下supervise_jb 文件夹改成supervise 原文件改成supervise_hn
|
||||||
|
|||||||
@@ -6,8 +6,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --mode dev",
|
"dev": "vite --mode dev",
|
||||||
"dev:jibei": "vite --mode jibei",
|
"dev:jibei": "vite --mode jibei",
|
||||||
|
"dev:removeMode": "vite --mode removeMode",
|
||||||
"build": "vite build --mode dev",
|
"build": "vite build --mode dev",
|
||||||
"build:jibei": "vite build --mode jibei",
|
"build:jibei": "vite build --mode jibei",
|
||||||
|
"build:removeMode": "vite build --mode removeMode",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -12,14 +12,30 @@ const loadingInstance: LoadingInstance = {
|
|||||||
target: null,
|
target: null,
|
||||||
count: 0
|
count: 0
|
||||||
}
|
}
|
||||||
|
const VITE_FLAG = import.meta.env.VITE_NAME == 'removeMode'
|
||||||
|
// console.log('🚀 ~ import.meta.env.VITE_NAME:', import.meta.env.VITE_NAME)
|
||||||
/**
|
/**
|
||||||
* 根据运行环境获取基础请求URL
|
* 根据运行环境获取基础请求URL
|
||||||
*/
|
*/
|
||||||
export const getUrl = (): string => {
|
export const getUrl = (): string => {
|
||||||
return '/api'
|
return '/api'
|
||||||
}
|
}
|
||||||
|
function removeBeforeSecondSlash(str: string) {
|
||||||
|
// 找到第一个斜杠的位置
|
||||||
|
const firstSlashIndex = str.indexOf('/')
|
||||||
|
if (firstSlashIndex === -1) {
|
||||||
|
// 如果没有斜杠,返回原字符串
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
// 从第一个斜杠之后开始找第二个斜杠
|
||||||
|
const secondSlashIndex = str.indexOf('/', firstSlashIndex + 1)
|
||||||
|
if (secondSlashIndex === -1) {
|
||||||
|
// 如果只有一个斜杠,返回原字符串
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
// 返回第二个斜杠及之后的内容
|
||||||
|
return str.substring(secondSlashIndex)
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 创建`Axios`
|
* 创建`Axios`
|
||||||
* 默认开启`reductDataFormat(简洁响应)`,返回类型为`ApiPromise`
|
* 默认开启`reductDataFormat(简洁响应)`,返回类型为`ApiPromise`
|
||||||
@@ -54,11 +70,12 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
|||||||
|
|
||||||
// 请求拦截
|
// 请求拦截
|
||||||
Axios.interceptors.request.use(
|
Axios.interceptors.request.use(
|
||||||
config => {
|
async (config: any) => {
|
||||||
// if(config.url?.substring(0, 13)=='/advance-boot'){
|
//嵌入去除所有请求头
|
||||||
// config.url=config.url?.slice(13)
|
if (VITE_FLAG) {
|
||||||
// config.baseURL='/hzj'
|
config.url = await removeBeforeSecondSlash(config.url)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// 取消重复请求
|
// 取消重复请求
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -18,13 +18,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="终端厂家:">
|
<el-form-item label="终端厂家:">
|
||||||
<el-select
|
<el-select v-model="tableStore.table.params.manufacturer" clearable placeholder="请选择终端厂家">
|
||||||
v-model="tableStore.table.params.manufacturer"
|
|
||||||
|
|
||||||
clearable
|
|
||||||
|
|
||||||
placeholder="请选择终端厂家"
|
|
||||||
>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in terminaloption"
|
v-for="item in terminaloption"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
|||||||
Reference in New Issue
Block a user