打包配置

This commit is contained in:
BianLzhaoMin 2025-01-21 10:55:37 +08:00
parent f51d2ecd01
commit ba8076d5a2
11 changed files with 43 additions and 14 deletions

2
env/.env.production vendored
View File

@ -3,4 +3,4 @@ VITE_ENV = 'production'
VITE_BUILD_MODE = 'prod'
# 线上环境接口地址
VITE_API_URL = '/proxyApi'
VITE_API_URL = '/iws/proxyApi'

6
env/.env.testing vendored Normal file
View File

@ -0,0 +1,6 @@
VITE_ENV = 'test'
VITE_BUILD_MODE = 'prod'
# 线上环境接口地址
VITE_API_URL = '/proxyApi'

View File

@ -9,6 +9,7 @@
"build:sit": "vite build --mode sit",
"build:uat": "vite build --mode uat",
"build:pro": "vite build --mode production",
"build:test": "vite build --mode testing",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"

View File

@ -36,7 +36,7 @@ const navMenuList = computed(() => {
{ name: '订单管理', routerName: 'orderManagement' },
{ name: '需求管理', routerName: 'sourcingNeed' },
{ name: '通知公告', routerName: 'enterpriseZone' },
{ name: '数据大屏', routerName: 'big-screen' },
// { name: '', routerName: 'big-screen' },
]
if (isType == 3)
@ -45,7 +45,7 @@ const navMenuList = computed(() => {
{ name: '装备共享大厅', routerName: 'equipList' },
{ name: '租赁需求大厅', routerName: 'parity' },
{ name: '通知公告', routerName: 'enterpriseZone' },
{ name: '数据大屏', routerName: 'big-screen' },
// { name: '', routerName: 'big-screen' },
]
})

View File

@ -14,6 +14,7 @@ import {
} from 'http/api/personalCenter'
const { getCompanyList } = userClass()
import imgSrc from '@/assets/img/logo.png'
import { el } from 'element-plus/es/locale'
const store: any = mainStore()
const searchTypeName = ref('装备')
const userStore = useStore()
@ -247,7 +248,13 @@ const onCarts = () => {
const onJumpUser = () => {
const isType: any = localStorage.getItem('rolesType')
if (isType == 3) {
window.open(`http://36.33.26.201:17788/iws/glweb/login?token=${store.token}`)
const host = window.location.origin
if (host.indexOf('sgwpdm.ah.sgcc.com.cn') > -1) {
window.open(`${host}/iws/glweb/login?token@${store.token}@`)
} else {
window.open(`${host}/glweb/?token@${store.token}@`)
}
} else {
router.push({ name: 'my-user' })
}

View File

@ -1,4 +1,4 @@
import { createRouter, RouteRecordRaw, createWebHistory } from 'vue-router'
import { createRouter, RouteRecordRaw, createWebHistory, createWebHashHistory } from 'vue-router'
import test from './module/test'
import myInfo from './module/myInfo'
// import login from '../hooks/login'
@ -775,7 +775,8 @@ const routes: Array<RouteRecordRaw> = [
const router = createRouter({
// 路由模式
history: createWebHistory('/iws/mall-view/'),
// history: createWebHistory('/iws/mall-view/'),
history: import.meta.env.VITE_ENV === 'production' ? createWebHashHistory() : createWebHistory('/iws/mall-view/'),
routes
})

View File

@ -152,12 +152,10 @@ const getSwiperListData = async () => {
const onClickSwiper = (item: any) => {
if (item.slideLink) {
// window.open(item.slideLink, '_blank')
const link = item.slideLink.startsWith('http')
? item.slideLink
: `https://${item.slideLink}`
window.open(link, '_blank')
// window.open('www.baidu.com')
} else {
router.push({ name: 'equipList' })
}

View File

@ -382,7 +382,9 @@ const amountDevice = computed(() => {
// amountNum++
// }
// })
return 1
return orderList.value.length
// return 1
})
//
const amountDeviceList = computed(() => {

View File

@ -689,7 +689,7 @@ const onEditorReady = (editor) => {
onMounted(() => {
getContractListData()
uploadUrlTemp.value = window.location.origin + '/iws/mall-view/contract-template.docx'
uploadUrlTemp.value = window.location.origin + '/mall-view/contract-template.docx'
// getEquipmentTypeApi().then((res: any) => {
// deviceTypeTree.value = res.data
})

View File

@ -1099,10 +1099,15 @@ const onDeleteDescription = (index: number) => {
const onMainFileChange = (fileList: any) => {
addAndEditForm.mainFileTempList = []
const origin = window.location.origin
const isProd = origin.indexOf('sgwpdm.ah.sgcc.com.cn') > -1
const fileListTemp = fileList.map((e: any) => {
return {
fileName: e.name,
fileUrl: e.url,
fileUrl: isProd
? 'http://sgwpdm.ah.sgcc.com.cn/iws/ahbns/' + e.url
: origin + '/ahbns/' + e.url,
}
})
addAndEditFormRef.value.clearValidate('mainFileList')
@ -1110,10 +1115,14 @@ const onMainFileChange = (fileList: any) => {
}
const onDetailsFileChange = (fileList: any) => {
addAndEditForm.detailsFileTempList = []
const origin = window.location.origin
const isProd = origin.indexOf('sgwpdm.ah.sgcc.com.cn') > -1
const fileListTemp = fileList.map((e: any) => {
return {
fileName: e.name,
fileUrl: e.url,
fileUrl: isProd
? 'http://sgwpdm.ah.sgcc.com.cn/iws/ahbns/' + e.url
: origin + '/ahbns/' + e.url,
}
})
addAndEditFormRef.value.clearValidate('detailsFileList')
@ -1144,6 +1153,8 @@ const onExaminationPdfChange = (fileList: any, index: number) => {
}
const onFileChangeEquip = (fileList: any, row: any, index: number, type: number) => {
const origin = window.location.origin
const isProd = origin.indexOf('sgwpdm.ah.sgcc.com.cn') > -1
if (type == 1) {
equipTableList.value[index].insurancePdf = []
} else {
@ -1152,7 +1163,9 @@ const onFileChangeEquip = (fileList: any, row: any, index: number, type: number)
const fileListTemp = fileList.map((e: any) => {
return {
fileName: e.name,
fileUrl: e.url,
fileUrl: isProd
? 'http://sgwpdm.ah.sgcc.com.cn/iws/ahbns/' + e.url
: origin + '/ahbns/' + e.url,
}
})
console.log('11111', fileListTemp[0].fileUrl)

View File

@ -11,6 +11,7 @@ import { createHtmlPlugin } from 'vite-plugin-html'
// @ts-ignore
import pjson from './package.json'
const VITE_ENV = process.env.VITE_EN
const now = new Date()
@ -31,7 +32,7 @@ export default ({ mode }: any) => {
}
return defineConfig({
base: '/iws/mall-view/',
base: VITE_ENV === 'production' ? './' : '/iws/mall-view/',
plugins: [
vue(),
vueJsx(),