中间部分
Showing
7 changed files
with
144 additions
and
141 deletions
src/api/server.js.js
0 → 100644
| 1 | import request from '@/utils/request' | ||
| 2 | |||
| 3 | /** | ||
| 4 | * 营业收入 | ||
| 5 | * @returns {*} | ||
| 6 | */ | ||
| 7 | export function getYS001() { | ||
| 8 | return request({ | ||
| 9 | method: 'post', | ||
| 10 | data: { | ||
| 11 | 'INTERFACEID': 'YS001', | ||
| 12 | 'USERCONTEXT': 'a6c49439-f01c-0292-1757-30563fb41c77' | ||
| 13 | } | ||
| 14 | }) | ||
| 15 | } | ||
| 16 | |||
| 17 | /** | ||
| 18 | * 应收余额 | ||
| 19 | * @returns {*} | ||
| 20 | */ | ||
| 21 | export function getYS002() { | ||
| 22 | return request({ | ||
| 23 | method: 'post', | ||
| 24 | data: { | ||
| 25 | 'INTERFACEID': 'YS002', | ||
| 26 | 'USERCONTEXT': 'a6c49439-f01c-0292-1757-30563fb41c77' | ||
| 27 | } | ||
| 28 | }) | ||
| 29 | } | ||
| 30 | |||
| 31 | /** | ||
| 32 | * 现金余额 | ||
| 33 | * @returns {*} | ||
| 34 | */ | ||
| 35 | export function getYS003() { | ||
| 36 | return request({ | ||
| 37 | method: 'post', | ||
| 38 | data: { | ||
| 39 | 'INTERFACEID': 'YS003', | ||
| 40 | 'USERCONTEXT': 'a6c49439-f01c-0292-1757-30563fb41c77' | ||
| 41 | } | ||
| 42 | }) | ||
| 43 | } | ||
| 44 | |||
| 45 | /** | ||
| 46 | * DSO天数 | ||
| 47 | * @returns {*} | ||
| 48 | */ | ||
| 49 | export function getYS004() { | ||
| 50 | return request({ | ||
| 51 | method: 'post', | ||
| 52 | data: { | ||
| 53 | 'INTERFACEID': 'YS004', | ||
| 54 | 'USERCONTEXT': 'a6c49439-f01c-0292-1757-30563fb41c77' | ||
| 55 | } | ||
| 56 | }) | ||
| 57 | } | ||
| 58 | |||
| 59 | /** | ||
| 60 | * (五)董事会得分、领导重点关注 | ||
| 61 | * @returns {*} | ||
| 62 | */ | ||
| 63 | export function getYS005() { | ||
| 64 | return request({ | ||
| 65 | method: 'post', | ||
| 66 | data: { | ||
| 67 | 'INTERFACEID': 'YS005', | ||
| 68 | 'USERCONTEXT': 'a6c49439-f01c-0292-1757-30563fb41c77' | ||
| 69 | } | ||
| 70 | }) | ||
| 71 | } |
| 1 | import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus' | 1 | import {ElMessage, ElMessageBox, ElNotification, ElLoading} from 'element-plus' |
| 2 | import {useStorage} from "@vueuse/core/index"; | 2 | import {useStorage} from "@vueuse/core/index"; |
| 3 | 3 | ||
| 4 | const language= useStorage('language',0) | 4 | const language = useStorage('language', 0) |
| 5 | let loadingInstance | 5 | let loadingInstance |
| 6 | 6 | ||
| 7 | export default { | 7 | export default { |
| ... | @@ -23,19 +23,19 @@ export default { | ... | @@ -23,19 +23,19 @@ export default { |
| 23 | }, | 23 | }, |
| 24 | // 弹出提示 | 24 | // 弹出提示 |
| 25 | alert(content) { | 25 | alert(content) { |
| 26 | return ElMessageBox.alert(content, language.value==0 ? language.value==0 ? '系统提示' :'Tips' :'Tips') | 26 | return ElMessageBox.alert(content, language.value == 0 ? language.value == 0 ? '系统提示' : 'Tips' : 'Tips') |
| 27 | }, | 27 | }, |
| 28 | // 错误提示 | 28 | // 错误提示 |
| 29 | alertError(content) { | 29 | alertError(content) { |
| 30 | return ElMessageBox.alert(content, language.value==0 ? language.value==0 ? '系统提示' :'Tips' :'Tips', { type: 'error' }) | 30 | return ElMessageBox.alert(content, language.value == 0 ? language.value == 0 ? '系统提示' : 'Tips' : 'Tips', {type: 'error'}) |
| 31 | }, | 31 | }, |
| 32 | // 成功提示 | 32 | // 成功提示 |
| 33 | alertSuccess(content) { | 33 | alertSuccess(content) { |
| 34 | return ElMessageBox.alert(content, language.value==0 ? '系统提示' :'Tips', { type: 'success' }) | 34 | return ElMessageBox.alert(content, language.value == 0 ? '系统提示' : 'Tips', {type: 'success'}) |
| 35 | }, | 35 | }, |
| 36 | // 警告提示 | 36 | // 警告提示 |
| 37 | alertWarning(content) { | 37 | alertWarning(content) { |
| 38 | return ElMessageBox.alert(content, language.value==0 ? '系统提示' :'Tips', { type: 'warning' }) | 38 | return ElMessageBox.alert(content, language.value == 0 ? '系统提示' : 'Tips', {type: 'warning'}) |
| 39 | }, | 39 | }, |
| 40 | // 通知提示 | 40 | // 通知提示 |
| 41 | notify(content) { | 41 | notify(content) { |
| ... | @@ -55,17 +55,17 @@ export default { | ... | @@ -55,17 +55,17 @@ export default { |
| 55 | }, | 55 | }, |
| 56 | // 确认窗体 | 56 | // 确认窗体 |
| 57 | confirm(content) { | 57 | confirm(content) { |
| 58 | return ElMessageBox.confirm(content, language.value==0 ? '系统提示' :'Tips', { | 58 | return ElMessageBox.confirm(content, language.value == 0 ? '系统提示' : 'Tips', { |
| 59 | confirmButtonText: language.value==0 ? '确定' :'OK', | 59 | confirmButtonText: language.value == 0 ? '确定' : 'OK', |
| 60 | cancelButtonText: language.value==0 ? '取消' :'Cancel', | 60 | cancelButtonText: language.value == 0 ? '取消' : 'Cancel', |
| 61 | type: 'warning' | 61 | type: 'warning' |
| 62 | }) | 62 | }) |
| 63 | }, | 63 | }, |
| 64 | // 提交内容 | 64 | // 提交内容 |
| 65 | prompt(content) { | 65 | prompt(content) { |
| 66 | return ElMessageBox.prompt(content, language.value==0 ? '系统提示' :'Tips', { | 66 | return ElMessageBox.prompt(content, language.value == 0 ? '系统提示' : 'Tips', { |
| 67 | confirmButtonText: language.value==0 ? '确定' :'OK', | 67 | confirmButtonText: language.value == 0 ? '确定' : 'OK', |
| 68 | cancelButtonText: language.value==0 ? '取消' :'Cancel', | 68 | cancelButtonText: language.value == 0 ? '取消' : 'Cancel', |
| 69 | type: 'warning' | 69 | type: 'warning' |
| 70 | }) | 70 | }) |
| 71 | }, | 71 | }, |
| ... | @@ -79,6 +79,6 @@ export default { | ... | @@ -79,6 +79,6 @@ export default { |
| 79 | }, | 79 | }, |
| 80 | // 关闭遮罩层 | 80 | // 关闭遮罩层 |
| 81 | closeLoading() { | 81 | closeLoading() { |
| 82 | loadingInstance.close() | 82 | loadingInstance?.close() |
| 83 | } | 83 | } |
| 84 | } | 84 | } | ... | ... |
| ... | @@ -110,26 +110,28 @@ NProgress.configure({showSpinner: false}) | ... | @@ -110,26 +110,28 @@ NProgress.configure({showSpinner: false}) |
| 110 | 110 | ||
| 111 | router.beforeEach((to, from, next) => { | 111 | router.beforeEach((to, from, next) => { |
| 112 | NProgress.start() | 112 | NProgress.start() |
| 113 | if (getToken()) { | ||
| 114 | // 判断当前用户是否已拉取完user_info信息 | ||
| 115 | if (!useUserStore().user) { | ||
| 116 | isRelogin.show = true | ||
| 117 | useUserStore().getInfo().then(() => { | ||
| 118 | isRelogin.show = false | ||
| 119 | next() // hack方法 确保addRoutes已完成 | ||
| 120 | }).catch(err => { | ||
| 121 | useUserStore().logOut().then(() => { | ||
| 122 | ElMessage.error(err) | ||
| 123 | next({path: '/'}) | ||
| 124 | }) | ||
| 125 | }) | ||
| 126 | } else { | ||
| 127 | next() | 113 | next() |
| 128 | } | 114 | // if (getToken()) { |
| 129 | } else { | 115 | // // 判断当前用户是否已拉取完user_info信息 |
| 130 | // 没有token | 116 | // if (!useUserStore().user) { |
| 131 | next() | 117 | // |
| 132 | } | 118 | // isRelogin.show = true |
| 119 | // useUserStore().getInfo().then(() => { | ||
| 120 | // isRelogin.show = false | ||
| 121 | // next() // hack方法 确保addRoutes已完成 | ||
| 122 | // }).catch(err => { | ||
| 123 | // useUserStore().logOut().then(() => { | ||
| 124 | // ElMessage.error(err) | ||
| 125 | // next({path: '/'}) | ||
| 126 | // }) | ||
| 127 | // }) | ||
| 128 | // } else { | ||
| 129 | // next() | ||
| 130 | // } | ||
| 131 | // } else { | ||
| 132 | // // 没有token | ||
| 133 | // next() | ||
| 134 | // } | ||
| 133 | }) | 135 | }) |
| 134 | 136 | ||
| 135 | router.afterEach((to) => { | 137 | router.afterEach((to) => { | ... | ... |
| ... | @@ -5,25 +5,20 @@ import { | ... | @@ -5,25 +5,20 @@ import { |
| 5 | ElMessage, | 5 | ElMessage, |
| 6 | ElLoading | 6 | ElLoading |
| 7 | } from 'element-plus' | 7 | } from 'element-plus' |
| 8 | import { getToken } from '@/utils/auth' | 8 | import {getToken} from '@/utils/auth' |
| 9 | import errorCode from '@/utils/errorCode' | 9 | import errorCode from '@/utils/errorCode' |
| 10 | import { tansParams, blobValidate } from '@/utils/ruoyi' | 10 | import {tansParams, blobValidate} from '@/utils/ruoyi' |
| 11 | import cache from '@/plugins/cache' | 11 | import cache from '@/plugins/cache' |
| 12 | import modal from '@/plugins/modal' | 12 | import modal from '@/plugins/modal' |
| 13 | import { saveAs } from 'file-saver' | 13 | import {saveAs} from 'file-saver' |
| 14 | import useUserStore from '@/store/modules/user' | 14 | import {sendNotification} from '@/assets/lib/extend' |
| 15 | import { sendNotification } from '@/assets/lib/extend' | 15 | |
| 16 | import _ from 'lodash' | ||
| 17 | // const language = cache.local.get('language') || 0 | ||
| 18 | import {useStorage} from "@vueuse/core/index"; | ||
| 19 | const language= useStorage('language',0) | ||
| 20 | let downloadLoadingInstance | 16 | let downloadLoadingInstance |
| 21 | // 是否显示重新登录 | 17 | // 是否显示重新登录 |
| 22 | export const isRelogin = { show: false } | 18 | export const isRelogin = {show: false} |
| 23 | 19 | ||
| 24 | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' | 20 | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' |
| 25 | // 对应国际化资源文件后缀 | 21 | |
| 26 | axios.defaults.headers['Content-Language'] = (language.value==0? 'zh_CN':'en_US' ) | ||
| 27 | // 创建axios实例 | 22 | // 创建axios实例 |
| 28 | const service = axios.create({ | 23 | const service = axios.create({ |
| 29 | // axios中请求配置有baseURL选项,表示请求URL公共部分 | 24 | // axios中请求配置有baseURL选项,表示请求URL公共部分 |
| ... | @@ -32,15 +27,12 @@ const service = axios.create({ | ... | @@ -32,15 +27,12 @@ const service = axios.create({ |
| 32 | timeout: 0 | 27 | timeout: 0 |
| 33 | }) | 28 | }) |
| 34 | 29 | ||
| 35 | const otherWeb = ['ztx-match/', 'ztx-webSite/', 'ztx-train/'] | ||
| 36 | const excludeUrl = ['system/remindCount/getCounts'] | ||
| 37 | const noModal = ['person/info/extractInfo'] | ||
| 38 | 30 | ||
| 39 | // request拦截器 | 31 | // request拦截器 |
| 40 | service.interceptors.request.use( | 32 | service.interceptors.request.use( |
| 41 | (config) => { | 33 | (config) => { |
| 42 | if (config.method.toLowerCase() !== 'get' && !_.some(noModal, (m) => config.url.indexOf(m) > -1)) { | 34 | if (!config.url) { |
| 43 | modal.loading() | 35 | config.url = '/portal/r/jd?cmd=com.dr.coslexpro.cwys.unifiedInterface' |
| 44 | } | 36 | } |
| 45 | 37 | ||
| 46 | // 是否需要设置 token | 38 | // 是否需要设置 token |
| ... | @@ -50,9 +42,6 @@ service.interceptors.request.use( | ... | @@ -50,9 +42,6 @@ service.interceptors.request.use( |
| 50 | if (getToken() && !isToken) { | 42 | if (getToken() && !isToken) { |
| 51 | config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 | 43 | config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 |
| 52 | } | 44 | } |
| 53 | if (_.some(otherWeb, (w) => config.url.indexOf(w) > -1)) { | ||
| 54 | config.headers['Ztx-Per-Id'] = useUserStore().perId || -1 | ||
| 55 | } | ||
| 56 | 45 | ||
| 57 | // get请求映射params参数 | 46 | // get请求映射params参数 |
| 58 | if (config.method === 'get') { | 47 | if (config.method === 'get') { |
| ... | @@ -93,20 +82,21 @@ service.interceptors.request.use( | ... | @@ -93,20 +82,21 @@ service.interceptors.request.use( |
| 93 | const s_data = sessionObj.data // 请求数据 | 82 | const s_data = sessionObj.data // 请求数据 |
| 94 | const s_time = sessionObj.time // 请求时间 | 83 | const s_time = sessionObj.time // 请求时间 |
| 95 | const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交 | 84 | const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交 |
| 96 | if ( | 85 | // if ( |
| 97 | s_data === requestObj.data && | 86 | // s_data === requestObj.data && |
| 98 | requestObj.time - s_time < interval && | 87 | // requestObj.time - s_time < interval && |
| 99 | s_url === requestObj.url | 88 | // s_url === requestObj.url |
| 100 | ) { | 89 | // ) { |
| 101 | const message = '数据正在处理,请勿重复提交' | 90 | // const message = '数据正在处理,请勿重复提交' |
| 102 | console.warn(`[${s_url}]: ` + message) | 91 | // console.warn(`[${s_url}]: ` + message) |
| 103 | modal.closeLoading() | 92 | // modal.closeLoading() |
| 104 | return Promise.reject(new Error(message)) | 93 | // return Promise.reject(new Error(message)) |
| 105 | } else { | 94 | // } else { |
| 95 | // cache.session.setJSON('sessionObj', requestObj) | ||
| 96 | // } | ||
| 106 | cache.session.setJSON('sessionObj', requestObj) | 97 | cache.session.setJSON('sessionObj', requestObj) |
| 107 | } | 98 | } |
| 108 | } | 99 | } |
| 109 | } | ||
| 110 | return config | 100 | return config |
| 111 | }, | 101 | }, |
| 112 | (error) => { | 102 | (error) => { |
| ... | @@ -119,11 +109,8 @@ service.interceptors.request.use( | ... | @@ -119,11 +109,8 @@ service.interceptors.request.use( |
| 119 | // 响应拦截器 | 109 | // 响应拦截器 |
| 120 | service.interceptors.response.use( | 110 | service.interceptors.response.use( |
| 121 | (res) => { | 111 | (res) => { |
| 122 | if (res.config.method.toLowerCase() !== 'get' && !_.some(noModal, (m) => res.config.url.indexOf(m) > -1)) { | ||
| 123 | modal.closeLoading() | ||
| 124 | } | ||
| 125 | // 未设置状态码则默认成功状态 | 112 | // 未设置状态码则默认成功状态 |
| 126 | const code = res.data.code || 200 | 113 | const code = res.code || 200 |
| 127 | // 获取错误信息 | 114 | // 获取错误信息 |
| 128 | const msg = errorCode[code] || res.data.msg | 115 | const msg = errorCode[code] || res.data.msg |
| 129 | // const msg = errorCode[code] || res.data.msg || errorCode['default'] | 116 | // const msg = errorCode[code] || res.data.msg || errorCode['default'] |
| ... | @@ -137,9 +124,6 @@ service.interceptors.response.use( | ... | @@ -137,9 +124,6 @@ service.interceptors.response.use( |
| 137 | return res | 124 | return res |
| 138 | } | 125 | } |
| 139 | 126 | ||
| 140 | if (_.some(excludeUrl, (m) => res.config.url.indexOf(m) > -1)) { | ||
| 141 | return Promise.resolve(res.data) | ||
| 142 | } | ||
| 143 | if (code === 401) { | 127 | if (code === 401) { |
| 144 | if (!isRelogin.show) { | 128 | if (!isRelogin.show) { |
| 145 | isRelogin.show = true | 129 | isRelogin.show = true |
| ... | @@ -167,16 +151,16 @@ service.interceptors.response.use( | ... | @@ -167,16 +151,16 @@ service.interceptors.response.use( |
| 167 | } | 151 | } |
| 168 | return Promise.reject('会话已过期,请重新登录。') | 152 | return Promise.reject('会话已过期,请重新登录。') |
| 169 | } else if (code === 500) { | 153 | } else if (code === 500) { |
| 170 | if(msg){ | 154 | if (msg) { |
| 171 | ElMessage({ message: msg, type: 'error' }) | 155 | ElMessage({message: msg, type: 'error'}) |
| 172 | sendNotification('错误提示', { body: msg }) | 156 | sendNotification('错误提示', {body: msg}) |
| 173 | } | 157 | } |
| 174 | return Promise.reject(new Error(msg)) | 158 | return Promise.reject(new Error(msg)) |
| 175 | } else if (code === 601) { | 159 | } else if (code === 601) { |
| 176 | ElMessage({ message: msg, type: 'warning' }) | 160 | ElMessage({message: msg, type: 'warning'}) |
| 177 | return Promise.reject(new Error(msg)) | 161 | return Promise.reject(new Error(msg)) |
| 178 | } else if (code !== 200) { | 162 | } else if (code !== 200) { |
| 179 | ElNotification.error({ title: msg }) | 163 | ElNotification.error({title: msg}) |
| 180 | return Promise.reject('error') | 164 | return Promise.reject('error') |
| 181 | } else { | 165 | } else { |
| 182 | return Promise.resolve(res.data) | 166 | return Promise.resolve(res.data) |
| ... | @@ -184,7 +168,7 @@ service.interceptors.response.use( | ... | @@ -184,7 +168,7 @@ service.interceptors.response.use( |
| 184 | }, | 168 | }, |
| 185 | (error) => { | 169 | (error) => { |
| 186 | console.log('err' + error) | 170 | console.log('err' + error) |
| 187 | let { message } = error | 171 | let {message} = error |
| 188 | if (message === 'Network Error') { | 172 | if (message === 'Network Error') { |
| 189 | message = '后端接口连接异常' | 173 | message = '后端接口连接异常' |
| 190 | } else if (message.includes('timeout')) { | 174 | } else if (message.includes('timeout')) { |
| ... | @@ -192,8 +176,8 @@ service.interceptors.response.use( | ... | @@ -192,8 +176,8 @@ service.interceptors.response.use( |
| 192 | } else if (message.includes('Request failed with status code')) { | 176 | } else if (message.includes('Request failed with status code')) { |
| 193 | message = '系统接口' + message.substr(message.length - 3) + '异常' | 177 | message = '系统接口' + message.substr(message.length - 3) + '异常' |
| 194 | } | 178 | } |
| 195 | ElMessage({ message: message, type: 'error', duration: 5 * 1000 }) | 179 | ElMessage({message: message, type: 'error', duration: 5 * 1000}) |
| 196 | sendNotification('错误提示', { body: message }) | 180 | sendNotification('错误提示', {body: message}) |
| 197 | modal.closeLoading() | 181 | modal.closeLoading() |
| 198 | return Promise.reject(error) | 182 | return Promise.reject(error) |
| 199 | } | 183 | } |
| ... | @@ -212,11 +196,11 @@ export function download(url, params, filename, config) { | ... | @@ -212,11 +196,11 @@ export function download(url, params, filename, config) { |
| 212 | return tansParams(params) | 196 | return tansParams(params) |
| 213 | } | 197 | } |
| 214 | ], | 198 | ], |
| 215 | headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | 199 | headers: {'Content-Type': 'application/x-www-form-urlencoded'}, |
| 216 | responseType: 'blob', | 200 | responseType: 'blob', |
| 217 | ...config | 201 | ...config |
| 218 | }) | 202 | }) |
| 219 | .then(async(res) => { | 203 | .then(async (res) => { |
| 220 | const data = res.data | 204 | const data = res.data |
| 221 | const isBlob = blobValidate(data) | 205 | const isBlob = blobValidate(data) |
| 222 | if (isBlob) { | 206 | if (isBlob) { | ... | ... |
This diff is collapsed.
Click to expand it.
| 1 | import { defineConfig, loadEnv } from 'vite' | 1 | import {defineConfig, loadEnv} from 'vite' |
| 2 | import path, { resolve } from 'path' | 2 | import path, {resolve} from 'path' |
| 3 | import createVitePlugins from './vite/plugins' | 3 | import createVitePlugins from './vite/plugins' |
| 4 | import inject from '@rollup/plugin-inject' | 4 | import inject from '@rollup/plugin-inject' |
| 5 | import commonjs from '@rollup/plugin-commonjs' | 5 | import commonjs from '@rollup/plugin-commonjs' |
| 6 | // import legacy from '@vitejs/plugin-legacy' | ||
| 7 | 6 | ||
| 8 | // https://vitejs.dev/config/ | 7 | export default defineConfig(({mode, command}) => { |
| 9 | export default defineConfig(({ mode, command }) => { | ||
| 10 | const env = loadEnv(mode, process.cwd()) | 8 | const env = loadEnv(mode, process.cwd()) |
| 11 | return { | 9 | return { |
| 12 | // 部署生产环境和开发环境下的URL。 | 10 | // 部署生产环境和开发环境下的URL。 |
| ... | @@ -20,32 +18,8 @@ export default defineConfig(({ mode, command }) => { | ... | @@ -20,32 +18,8 @@ export default defineConfig(({ mode, command }) => { |
| 20 | 'window.katex': 'katex', | 18 | 'window.katex': 'katex', |
| 21 | 'window.Quill': ['@vueup/vue-quill', 'Quill'] | 19 | 'window.Quill': ['@vueup/vue-quill', 'Quill'] |
| 22 | }) | 20 | }) |
| 23 | // legacy({ | ||
| 24 | // targets: ['defaults', 'not IE 11'], // 需要兼容的目标列表,可以设置多个 | ||
| 25 | // additionalLegacyPolyfills: ['regenerator-runtime/runtime'], | ||
| 26 | // renderLegacyChunks: true, | ||
| 27 | // polyfills: [ | ||
| 28 | // 'es.symbol', | ||
| 29 | // 'es.array.filter', | ||
| 30 | // 'es.promise', | ||
| 31 | // 'es.promise.finally', | ||
| 32 | // 'es/map', | ||
| 33 | // 'es/set', | ||
| 34 | // 'es.array.for-each', | ||
| 35 | // 'es.object.define-properties', | ||
| 36 | // 'es.object.define-property', | ||
| 37 | // 'es.object.get-own-property-descriptor', | ||
| 38 | // 'es.object.get-own-property-descriptors', | ||
| 39 | // 'es.object.keys', | ||
| 40 | // 'es.object.to-string', | ||
| 41 | // 'web.dom-collections.for-each', | ||
| 42 | // 'esnext.global-this', | ||
| 43 | // 'esnext.string.match-all' | ||
| 44 | // ] | ||
| 45 | // }) | ||
| 46 | ], | 21 | ], |
| 47 | resolve: { | 22 | resolve: { |
| 48 | // https://cn.vitejs.dev/config/#resolve-alias | ||
| 49 | alias: { | 23 | alias: { |
| 50 | // 设置路径 | 24 | // 设置路径 |
| 51 | '~': path.resolve(__dirname, './'), | 25 | '~': path.resolve(__dirname, './'), |
| ... | @@ -62,41 +36,14 @@ export default defineConfig(({ mode, command }) => { | ... | @@ -62,41 +36,14 @@ export default defineConfig(({ mode, command }) => { |
| 62 | host: true, | 36 | host: true, |
| 63 | open: true, | 37 | open: true, |
| 64 | proxy: { | 38 | proxy: { |
| 65 | // https://cn.vitejs.dev/config/#server-proxy | 39 | '/dev-api/portal': { |
| 66 | '/dev-api/ztx-train': { | 40 | // target: 'http://116.63.185.147:8088', |
| 67 | // target: 'http://123.60.96.243:1896/stage-api', | 41 | target: 'https://ff9451fo0879.vicp.fun', |
| 68 | target: 'https://jijin.wtwuxicenter.com/stage-api', | ||
| 69 | changeOrigin: true, | 42 | changeOrigin: true, |
| 70 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-train/, '') | 43 | rewrite: (p) => p.replace(/^\/dev-api\/portal/, '') |
| 71 | }, | ||
| 72 | '/dev-api/ztx-match': { | ||
| 73 | // target: 'http://192.168.1.118:8083', | ||
| 74 | target: 'https://jijin.wtwuxicenter.com/stage-api', | ||
| 75 | changeOrigin: true, | ||
| 76 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-match/, '') | ||
| 77 | }, | ||
| 78 | '/dev-api/ztx-webSite': { | ||
| 79 | target: 'https://wdsfwuxicenter.com/stage-api/', | ||
| 80 | changeOrigin: true, | ||
| 81 | rewrite: (p) => p.replace(/^\/dev-api\/ztx-webSite/, '') | ||
| 82 | }, | ||
| 83 | '/dev-api': { | ||
| 84 | // target: 'http://192.168.1.207:5511/', | ||
| 85 | target: 'https://jijin.wtwuxicenter.com/stage-api', | ||
| 86 | changeOrigin: true, | ||
| 87 | rewrite: (p) => p.replace(/^\/dev-api/, '') | ||
| 88 | }, | ||
| 89 | '/ticket': { | ||
| 90 | // target: 'http://192.168.1.131:8098/', | ||
| 91 | // target: 'http://192.168.1.131:8081/', | ||
| 92 | target: 'https://jijin.wtwuxicenter.com/h5/', | ||
| 93 | // target: 'https://ticketh5.wdsfwuxicenter.com/h5/', | ||
| 94 | changeOrigin: true, | ||
| 95 | rewrite: (p) => p.replace(/^\/ticket/, '') | ||
| 96 | } | 44 | } |
| 97 | } | 45 | } |
| 98 | }, | 46 | }, |
| 99 | // fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file | ||
| 100 | css: { | 47 | css: { |
| 101 | postcss: { | 48 | postcss: { |
| 102 | plugins: [ | 49 | plugins: [ |
| ... | @@ -114,7 +61,6 @@ export default defineConfig(({ mode, command }) => { | ... | @@ -114,7 +61,6 @@ export default defineConfig(({ mode, command }) => { |
| 114 | } | 61 | } |
| 115 | }, | 62 | }, |
| 116 | build: { | 63 | build: { |
| 117 | // target: 'es2015', | ||
| 118 | rollupOptions: { | 64 | rollupOptions: { |
| 119 | input: { | 65 | input: { |
| 120 | main: resolve(__dirname, 'index.html') | 66 | main: resolve(__dirname, 'index.html') | ... | ... |
-
Please register or sign in to post a comment