diff --git a/env/.env.development b/env/.env.development index fc1bdf6..514145c 100644 --- a/env/.env.development +++ b/env/.env.development @@ -8,9 +8,11 @@ VITE_SHOW_SOURCEMAP = true #VITE_WEBAPP = 'D://opt//AppUpdateTest' VITE_WEBAPP = '' #VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot' -#VITE_SERVER_BASEURL = 'http://10.96.108.144:8080/jeecg-boot' +VITE_SERVER_BASEURL = 'http://10.75.166.6:8080/jeecg-boot' +#VITE_SERVER_BASEURL = 'http://10.75.173.194:8080/jeecg-boot' +#VITE_SERVER_BASEURL = 'https://10.75.166.6/test' -VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' +#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' #VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot' diff --git a/env/.env.production b/env/.env.production index 308b458..d961230 100644 --- a/env/.env.production +++ b/env/.env.production @@ -8,7 +8,7 @@ VITE_SHOW_SOURCEMAP = false #VITE_WEBAPP = 'D://opt//AppUpdateTest' VITE_WEBAPP = '' - -VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot' +VITE_SERVER_BASEURL = 'https://10.75.166.6/test' +#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot' #VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/wwapi' #VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/yjapi' diff --git a/manifest.config.ts b/manifest.config.ts index c8adea4..17aa39a 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -6,169 +6,169 @@ import { loadEnv } from 'vite' // 获取环境变量的范例 const env = loadEnv(process.env.NODE_ENV!, path.resolve(process.cwd(), 'env')) const { - VITE_APP_TITLE, - VITE_UNI_APPID, - VITE_WX_APPID, - VITE_APP_PUBLIC_BASE, - VITE_FALLBACK_LOCALE, + VITE_APP_TITLE, + VITE_UNI_APPID, + VITE_WX_APPID, + VITE_APP_PUBLIC_BASE, + VITE_FALLBACK_LOCALE, } = env export default defineManifestConfig({ - name: VITE_APP_TITLE, - appid: VITE_UNI_APPID, - description: '', - versionName: '2.2.0', - versionCode: '20250909', - transformPx: false, - locale: VITE_FALLBACK_LOCALE, // 'zh-Hans' - /* 5+App特有相关 */ - 'app-plus': { - usingComponents: true, - nvueStyleCompiler: 'uni-app', - compilerVersion: 3, - android: { - webView: { - domStorageEnabled: true, - databaseEnabled: true, - allowFileAccess: true - } + name: VITE_APP_TITLE, + appid: VITE_UNI_APPID, + description: '', + versionName: '2.3.0', + versionCode: '202509011', + transformPx: false, + locale: VITE_FALLBACK_LOCALE, // 'zh-Hans' + /* 5+App特有相关 */ + 'app-plus': { + usingComponents: true, + nvueStyleCompiler: 'uni-app', + compilerVersion: 3, + android: { + webView: { + domStorageEnabled: true, + databaseEnabled: true, + allowFileAccess: true + } + }, + compatible: { + ignoreVersion: true, + }, + webview: { + debug: true, + crossDomain: true // 允许跨域通信 + }, + splashscreen: { + alwaysShowBeforeRender: true, + waiting: true, + autoclose: true, + delay: 0, + }, + /* 模块配置 */ + modules: { + Maps: {}, + Messaging: {}, + Camera: {}, + }, + /* 应用发布信息 */ + distribute: { + /* android打包配置 */ + android: { + minSdkVersion: 26, + targetSdkVersion: 30, + abiFilters: ['armeabi-v7a', 'arm64-v8a'], + permissions: [ + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + ], + // app外连接访问 by 闵 + schemes: "szcxapp" + }, + /* ios打包配置 */ + ios: {}, + /* SDK配置 */ + sdkConfigs: { + maps: { + amap: { + name: 'amap_15931993294Bqxlq8EgG', + appkey_ios: 'c913e46ffdf548ebc56ac1cf4d883e7e', + appkey_android: 'c913e46ffdf548ebc56ac1cf4d883e7e', + }, + }, + }, + /* 图标配置 */ + icons: { + android: { + hdpi: 'src/static/app/icons/72x72.png', + xhdpi: 'src/static/app/icons/96x96.png', + xxhdpi: 'src/static/app/icons/144x144.png', + xxxhdpi: 'src/static/app/icons/192x192.png', + }, + ios: { + appstore: 'src/static/app/icons/1024x1024.png', + ipad: { + app: 'src/static/app/icons/76x76.png', + 'app@2x': 'src/static/app/icons/152x152.png', + notification: 'src/static/app/icons/20x20.png', + 'notification@2x': 'src/static/app/icons/40x40.png', + 'proapp@2x': 'src/static/app/icons/167x167.png', + settings: 'src/static/app/icons/29x29.png', + 'settings@2x': 'src/static/app/icons/58x58.png', + spotlight: 'src/static/app/icons/40x40.png', + 'spotlight@2x': 'src/static/app/icons/80x80.png', + }, + iphone: { + 'app@2x': 'src/static/app/icons/120x120.png', + 'app@3x': 'src/static/app/icons/180x180.png', + 'notification@2x': 'src/static/app/icons/40x40.png', + 'notification@3x': 'src/static/app/icons/60x60.png', + 'settings@2x': 'src/static/app/icons/58x58.png', + 'settings@3x': 'src/static/app/icons/87x87.png', + 'spotlight@2x': 'src/static/app/icons/80x80.png', + 'spotlight@3x': 'src/static/app/icons/120x120.png', + }, + }, + }, + }, }, - compatible: { - ignoreVersion: true, - }, - webview: { - debug: true, - crossDomain: true // 允许跨域通信 + /* 快应用特有相关 */ + quickapp: {}, + /* 小程序特有相关 */ + 'mp-weixin': { + appid: VITE_WX_APPID, + setting: { + urlCheck: false, + minified: true + }, + usingComponents: true, + // __usePrivacyCheck__: true, }, - splashscreen: { - alwaysShowBeforeRender: true, - waiting: true, - autoclose: true, - delay: 0, - }, - /* 模块配置 */ - modules: { - Maps: {}, - Messaging: {}, - Camera: {}, - }, - /* 应用发布信息 */ - distribute: { - /* android打包配置 */ - android: { - minSdkVersion: 26, - targetSdkVersion: 30, - abiFilters: ['armeabi-v7a', 'arm64-v8a'], - permissions: [ - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - ], - // app外连接访问 by 闵 - schemes : "szcxapp" - }, - /* ios打包配置 */ - ios: {}, - /* SDK配置 */ - sdkConfigs: { - maps: { - amap: { - name: 'amap_15931993294Bqxlq8EgG', - appkey_ios: 'c913e46ffdf548ebc56ac1cf4d883e7e', - appkey_android: 'c913e46ffdf548ebc56ac1cf4d883e7e', - }, - }, - }, - /* 图标配置 */ - icons: { - android: { - hdpi: 'src/static/app/icons/72x72.png', - xhdpi: 'src/static/app/icons/96x96.png', - xxhdpi: 'src/static/app/icons/144x144.png', - xxxhdpi: 'src/static/app/icons/192x192.png', - }, - ios: { - appstore: 'src/static/app/icons/1024x1024.png', - ipad: { - app: 'src/static/app/icons/76x76.png', - 'app@2x': 'src/static/app/icons/152x152.png', - notification: 'src/static/app/icons/20x20.png', - 'notification@2x': 'src/static/app/icons/40x40.png', - 'proapp@2x': 'src/static/app/icons/167x167.png', - settings: 'src/static/app/icons/29x29.png', - 'settings@2x': 'src/static/app/icons/58x58.png', - spotlight: 'src/static/app/icons/40x40.png', - 'spotlight@2x': 'src/static/app/icons/80x80.png', - }, - iphone: { - 'app@2x': 'src/static/app/icons/120x120.png', - 'app@3x': 'src/static/app/icons/180x180.png', - 'notification@2x': 'src/static/app/icons/40x40.png', - 'notification@3x': 'src/static/app/icons/60x60.png', - 'settings@2x': 'src/static/app/icons/58x58.png', - 'settings@3x': 'src/static/app/icons/87x87.png', - 'spotlight@2x': 'src/static/app/icons/80x80.png', - 'spotlight@3x': 'src/static/app/icons/120x120.png', - }, - }, - }, - }, - }, - /* 快应用特有相关 */ - quickapp: {}, - /* 小程序特有相关 */ - 'mp-weixin': { - appid: VITE_WX_APPID, - setting: { - urlCheck: false, - minified: true - }, - usingComponents: true, - // __usePrivacyCheck__: true, - }, - 'mp-alipay': { - usingComponents: true, - styleIsolation: 'shared', - }, - 'mp-baidu': { - usingComponents: true, - }, - 'mp-toutiao': { - usingComponents: true, - }, - h5: { - router: { - base: VITE_APP_PUBLIC_BASE, - }, - sdkConfigs: { - maps: { - amap: { - key: '21f194a0d33197f874f7bbdd198419be', - securityJsCode: 'a46b425f31a4de445b2966d998fba851', - serviceHost: '', - }, - }, - }, - }, - 'app-harmony': { - distribute: { - bundleName: 'uniapp.demo.test', - }, - }, - uniStatistics: { - enable: false, - }, - vueVersion: '3', -}) + 'mp-alipay': { + usingComponents: true, + styleIsolation: 'shared', + }, + 'mp-baidu': { + usingComponents: true, + }, + 'mp-toutiao': { + usingComponents: true, + }, + h5: { + router: { + base: VITE_APP_PUBLIC_BASE, + }, + sdkConfigs: { + maps: { + amap: { + key: '21f194a0d33197f874f7bbdd198419be', + securityJsCode: 'a46b425f31a4de445b2966d998fba851', + serviceHost: '', + }, + }, + }, + }, + 'app-harmony': { + distribute: { + bundleName: 'uniapp.demo.test', + }, + }, + uniStatistics: { + enable: false, + }, + vueVersion: '3', +}) \ No newline at end of file diff --git a/src/api/devicecontrol/officedevice.ts b/src/api/devicecontrol/officedevice.ts index a2ed01b..14d6c50 100644 --- a/src/api/devicecontrol/officedevice.ts +++ b/src/api/devicecontrol/officedevice.ts @@ -10,6 +10,15 @@ export function gethomelist(config : object) { // 获取房间信息 }) } + +export function gethomelistforApp(config : object) { // 获取房间信息 + return http({ + url: '/RoomOperation/RoomOperation/gethomelistforApp', + method: 'GET', + data: config + }) +} + export function testcontiont(config : object) { // 获取房间信息 return http({ url: mqtturl + '/mqttSubclient/mqttSubclient/testgetcontint', diff --git a/src/api/humanResource/personnel/index.ts b/src/api/humanResource/personnel/index.ts index a2b7464..adbc7c6 100644 --- a/src/api/humanResource/personnel/index.ts +++ b/src/api/humanResource/personnel/index.ts @@ -5,6 +5,7 @@ export function listApi(config : object) { return http({ url: '/cxc_rlzy.zb/cxcRlzyZb/list', method: 'GET', + timeout: 5000, data: config }) } diff --git a/src/api/production/index.ts b/src/api/production/index.ts index d35c63c..2d07362 100644 --- a/src/api/production/index.ts +++ b/src/api/production/index.ts @@ -48,4 +48,20 @@ export function queryJldDataByZc(params : object) { // 获取站场计量点实 method: 'GET', data: params }) +} + +export function queryJldDataByJldID(params : object) { // 获取计量点五分钟实时采集的历史数据 + return http({ + url: 'http://10.75.166.6:9999/Gyk/jldls/cxcSssjLssjJldls/getLssjByJldId', + method: 'GET', + data: params + }) +} + +export function queryJldRbDataByJldID(params : object) { // 获取计量点日报数据 + return http({ + url: '/tbqr/cxcScdtRbTbqr/listJldZongHe', + method: 'GET', + data: params + }) } \ No newline at end of file diff --git a/src/components/Esign/SinopecEsignPageH5.vue b/src/components/Esign/SinopecEsignPageH5.vue index dce340d..355293d 100644 --- a/src/components/Esign/SinopecEsignPageH5.vue +++ b/src/components/Esign/SinopecEsignPageH5.vue @@ -80,6 +80,7 @@ iframeWin.value = iframe.value.contentWindow console.log(iframe.value) console.log(iframe.value.contentWindow) + console.log(props.fileName) try { iframeWin.value.postMessage({ filename: props.fileName, @@ -138,7 +139,7 @@ if(props.taskDefKey=='task1715564108096'){ //如果是综合办审核,不需要该区 return flag = true; //只要执行了签章成功操作就返回成功,否则加载个数验证 } - return flag = true; //只要执行了签章成功操作就返回成功,否则加载个数验证 + // return flag = true; //只要执行了签章成功操作就返回成功,否则加载个数验证 if (sign.value) { return flag = true; //只要执行了签章成功操作就返回成功,否则加载个数验证 } else { diff --git a/src/components/dataTimeShow.vue b/src/components/dataTimeShow.vue new file mode 100644 index 0000000..dfb4fad --- /dev/null +++ b/src/components/dataTimeShow.vue @@ -0,0 +1,61 @@ + + + + + \ No newline at end of file diff --git a/src/manifest.json b/src/manifest.json index 962c0ae..b9286e3 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,8 +2,8 @@ "name": "数智产销", "appid": "__UNI__9F097F0", "description": "", - "versionName": "2.2.0", - "versionCode": "20250909", + "versionName": "2.3.0", + "versionCode": "202509011", "transformPx": false, "app-plus": { "usingComponents": true, diff --git a/src/pages-bpm/officialReceptions/index.vue b/src/pages-bpm/officialReceptions/index.vue index c3d83b7..ac5f65d 100644 --- a/src/pages-bpm/officialReceptions/index.vue +++ b/src/pages-bpm/officialReceptions/index.vue @@ -75,6 +75,7 @@ if(info.value.jdsqwj){ info.value.jdsqwj = info.value.jdsqwj.replace("PdfFiles/PdfFile/",'') } + console.log(info.value.jdsqwj) }else{ toast.error(res.message) } diff --git a/src/pages-home/device-control/office/Personaldevices.vue b/src/pages-home/device-control/office/Personaldevices.vue index 48b2747..520c629 100644 --- a/src/pages-home/device-control/office/Personaldevices.vue +++ b/src/pages-home/device-control/office/Personaldevices.vue @@ -13,30 +13,11 @@ {{ room.ssbmname }} + + - @@ -48,6 +29,7 @@ } from 'vue' import { gethomelist, + gethomelistforApp, getMqttPushClient, selectfjkzbmforfjid, createdSwitch, @@ -90,7 +72,8 @@ //获取房间信息 const getofficehomelist = async () => { - await gethomelist().then((res) => { + //20250811,张祥瑞,修改查询接口 + await gethomelistforApp().then((res) => { if (res.success) { homelist.value = res.result.map((item, index) => ({ ...item, diff --git a/src/pages-humanResource/personnel/standingbook.vue b/src/pages-humanResource/personnel/standingbook.vue index 888f3e7..040b96b 100644 --- a/src/pages-humanResource/personnel/standingbook.vue +++ b/src/pages-humanResource/personnel/standingbook.vue @@ -1,6 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/pages/production/index.vue b/src/pages/production/index.vue index 0181ff7..1019e73 100644 --- a/src/pages/production/index.vue +++ b/src/pages/production/index.vue @@ -9,51 +9,35 @@ \ No newline at end of file diff --git a/src/pages/production/shishishuju/index.vue b/src/pages/production/shishishuju/index.vue deleted file mode 100644 index 467da78..0000000 --- a/src/pages/production/shishishuju/index.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - \ No newline at end of file diff --git a/src/pages/production/shishishuju/trqSssj.vue b/src/pages/production/shishishuju/trqSssj.vue deleted file mode 100644 index b97dc1f..0000000 --- a/src/pages/production/shishishuju/trqSssj.vue +++ /dev/null @@ -1,293 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/types/uni-pages.d.ts b/src/types/uni-pages.d.ts index 7cc9dd7..85d7163 100644 --- a/src/types/uni-pages.d.ts +++ b/src/types/uni-pages.d.ts @@ -19,15 +19,6 @@ interface NavigateToOptions { "/pages/sljd/index" | "/pages/user/people" | "/pages/workHome/index" | - "/pages/production/ribaoshuju/rbsjLsxq" | - "/pages/production/ribaoshuju/trqRbsj" | - "/pages/production/ribaoshuju/yyRbsj" | - "/pages/production/shishishuju/aqbjSssj" | - "/pages/production/shishishuju/gycsSssj" | - "/pages/production/shishishuju/index" | - "/pages/production/shishishuju/nyxhSssj" | - "/pages/production/shishishuju/trqSssj" | - "/pages/production/shishishuju/ysjSssj" | "/pages-home/device-control/office/ALLleader" | "/pages-home/device-control/office/index" | "/pages-home/device-control/office/officehomedevice" | @@ -44,8 +35,10 @@ interface NavigateToOptions { "/pages-sub/online/online" | "/pages-sub/online/onlineCard" | "/pages-sub/online/onlineTable" | + "/pages-operate/caiwu/index" | "/pages-operate/file/detail" | "/pages-operate/file/index" | + "/pages-operate/jingying/index" | "/pages-operate/sc/index" | "/pages-humanResource/absence/add" | "/pages-humanResource/absence/detail" | @@ -78,7 +71,18 @@ interface NavigateToOptions { "/pages-bpm/SuperiorSystem/index" | "/pages-bpm/unconventional/index" | "/pages-bpm/unconventional/stamp" | - "/pages-bpm/zbkh/index"; + "/pages-bpm/zbkh/index" | + "/pages-production/ribaoshuju/rbsjLsxq" | + "/pages-production/ribaoshuju/trqRbsj" | + "/pages-production/ribaoshuju/yyRbsj" | + "/pages-production/shishishuju/aqbjSssj" | + "/pages-production/shishishuju/gycsSssj" | + "/pages-production/shishishuju/index" | + "/pages-production/shishishuju/nyxhSssj" | + "/pages-production/shishishuju/trqSssj" | + "/pages-production/shishishuju/ysjSssj" | + "/pages-production/shishishuju/chart/lssjChart" | + "/pages-production/shishishuju/chart/sssjChart"; } interface RedirectToOptions extends NavigateToOptions {} diff --git a/src/uni_modules/cxc-szcx-multiLineChart/changelog.md b/src/uni_modules/cxc-szcx-multiLineChart/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/src/uni_modules/cxc-szcx-multiLineChart/components/cxc-szcx-multiLineChart/cxc-szcx-multiLineChart.vue b/src/uni_modules/cxc-szcx-multiLineChart/components/cxc-szcx-multiLineChart/cxc-szcx-multiLineChart.vue new file mode 100644 index 0000000..46d49ae --- /dev/null +++ b/src/uni_modules/cxc-szcx-multiLineChart/components/cxc-szcx-multiLineChart/cxc-szcx-multiLineChart.vue @@ -0,0 +1,314 @@ + + + + + \ No newline at end of file diff --git a/src/uni_modules/cxc-szcx-multiLineChart/package.json b/src/uni_modules/cxc-szcx-multiLineChart/package.json new file mode 100644 index 0000000..62b3818 --- /dev/null +++ b/src/uni_modules/cxc-szcx-multiLineChart/package.json @@ -0,0 +1,97 @@ +{ + "id": "cxc-szcx-multiLineChart", + "displayName": "cxc-szcx-multiLineChart", + "version": "1.0.0", + "description": "cxc-szcx-multiLineChart", + "keywords": [ + "cxc-szcx-multiLineChart" + ], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0", + "uni-app": "^3.1.0", + "uni-app-x": "^3.1.0" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "", + "darkmode": "-", + "i18n": "-", + "widescreen": "-" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "-", + "aliyun": "-", + "alipay": "-" + }, + "client": { + "uni-app": { + "vue": { + "vue2": "-", + "vue3": "-" + }, + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "vue": "-", + "nvue": "-", + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-", + "alipay": "-", + "toutiao": "-", + "baidu": "-", + "kuaishou": "-", + "jd": "-", + "harmony": "-", + "qq": "-", + "lark": "-" + }, + "quickapp": { + "huawei": "-", + "union": "-" + } + }, + "uni-app-x": { + "web": { + "safari": "-", + "chrome": "-" + }, + "app": { + "android": "-", + "ios": "-", + "harmony": "-" + }, + "mp": { + "weixin": "-" + } + } + } + } + } +} \ No newline at end of file diff --git a/src/uni_modules/cxc-szcx-multiLineChart/readme.md b/src/uni_modules/cxc-szcx-multiLineChart/readme.md new file mode 100644 index 0000000..c9dc1ab --- /dev/null +++ b/src/uni_modules/cxc-szcx-multiLineChart/readme.md @@ -0,0 +1,34 @@ +# cxc-szcx-multiLineChart +# 这个多字段趋势图组件具有以下特点和功能: +类型安全:使用 TypeScript 定义了清晰的接口,确保数据类型正确 +灵活配置:通过 props 参数可以配置需要展示的字段、时间字段、标题等 +多字段展示:支持同时展示多个数据字段的趋势线(如 yl, wd, yc 等) +参考线功能:每个字段都可以设置参考值,自动生成对应的参考线 +交互功能: +支持图例筛选,可单独显示 / 隐藏某个字段 +提供数据缩放功能,可查看局部数据 +悬停时显示详细数据信息 +窗口大小变化时自动调整图表 +使用示例: + + + \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 117c126..bb350b3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -23,164 +23,165 @@ import { viteMockServe } from 'vite-plugin-mock' // https://vitejs.dev/config/ export default ({ command, mode }) => { - // console.log(mode === process.env.NODE_ENV) // true + // console.log(mode === process.env.NODE_ENV) // true - // mode: 区分生产环境还是开发环境 - console.log('command, mode -> ', command, mode) - // pnpm dev:h5 时得到 => serve development - // pnpm build:h5 时得到 => build production - // pnpm dev:mp-weixin 时得到 => build development (注意区别,command为build) - // pnpm build:mp-weixin 时得到 => build production - // pnpm dev:app 时得到 => build development (注意区别,command为build) - // pnpm build:app 时得到 => build production - // dev 和 build 命令可以分别使用 .env.development 和 .env.production 的环境变量 + // mode: 区分生产环境还是开发环境 + console.log('command, mode -> ', command, mode) + // pnpm dev:h5 时得到 => serve development + // pnpm build:h5 时得到 => build production + // pnpm dev:mp-weixin 时得到 => build development (注意区别,command为build) + // pnpm build:mp-weixin 时得到 => build production + // pnpm dev:app 时得到 => build development (注意区别,command为build) + // pnpm build:app 时得到 => build production + // dev 和 build 命令可以分别使用 .env.development 和 .env.production 的环境变量 - const { UNI_PLATFORM } = process.env - console.log('UNI_PLATFORM -> ', UNI_PLATFORM) // 得到 mp-weixin, h5, app 等 + const { UNI_PLATFORM } = process.env + console.log('UNI_PLATFORM -> ', UNI_PLATFORM) // 得到 mp-weixin, h5, app 等 - const env = loadEnv(mode, path.resolve(process.cwd(), 'env')) - const { - VITE_APP_PORT, - VITE_SERVER_BASEURL, - VITE_DELETE_CONSOLE, - VITE_SHOW_SOURCEMAP, - VITE_APP_PROXY, - VITE_APP_PROXY_PREFIX, - VITE_USE_MOCK, - WEBAPP - } = env - console.log('环境变量 env -> ', env) + const env = loadEnv(mode, path.resolve(process.cwd(), 'env')) + const { + VITE_APP_PORT, + VITE_SERVER_BASEURL, + VITE_DELETE_CONSOLE, + VITE_SHOW_SOURCEMAP, + VITE_APP_PROXY, + VITE_APP_PROXY_PREFIX, + VITE_USE_MOCK, + WEBAPP + } = env + console.log('环境变量 env -> ', env) - return defineConfig({ - envDir: './env', // 自定义env目录 + return defineConfig({ + envDir: './env', // 自定义env目录 - plugins: [ - UniPages({ - exclude: ['**/components/**/**.*'], - routeBlockLang: 'json5', // 虽然设了默认值,但是vue文件还是要加上 lang="json5", 这样才能很好地格式化 - // homePage 通过 vue 文件的 route-block 的type="home"来设定 - // pages 目录为 src/pages,分包目录不能配置在pages目录下 - subPackages: [ - 'src/pages-home', - 'src/pages-message', - 'src/pages-user', - 'src/pages-work', - 'src/pages-sub', - 'src/pages-operate', - 'src/pages-humanResource', - 'src/pages-integrated', - 'src/pages-politics', - 'src/pages-process', - 'src/pages-bpm' - ], // 是个数组,可以配置多个,但是不能为pages里面的目录 - dts: 'src/types/uni-pages.d.ts', - }), - UniLayouts(), - UniPlatform(), - UniManifest(), - // UniXXX 需要在 Uni 之前引入 - Uni(), - { - // 临时解决 dcloudio 官方的 @dcloudio/uni-mp-compiler 出现的编译 BUG - // 参考 github issue: https://github.com/dcloudio/uni-app/issues/4952 - // 自定义插件禁用 vite:vue 插件的 devToolsEnabled,强制编译 vue 模板时 inline 为 true - name: 'fix-vite-plugin-vue', - configResolved(config) { - const plugin = config.plugins.find((p) => p.name === 'vite:vue') - if (plugin && plugin.api && plugin.api.options) { - plugin.api.options.devToolsEnabled = false - } - }, - }, - UnoCSS(), - AutoImport({ - imports: ['vue', 'uni-app'], - dts: 'src/types/auto-import.d.ts', - dirs: ['src/hooks'], // 自动导入 hooks - eslintrc: { enabled: true }, - vueTemplate: true, // default false - }), + plugins: [ + UniPages({ + exclude: ['**/components/**/**.*'], + routeBlockLang: 'json5', // 虽然设了默认值,但是vue文件还是要加上 lang="json5", 这样才能很好地格式化 + // homePage 通过 vue 文件的 route-block 的type="home"来设定 + // pages 目录为 src/pages,分包目录不能配置在pages目录下 + subPackages: [ + 'src/pages-home', + 'src/pages-message', + 'src/pages-user', + 'src/pages-work', + 'src/pages-sub', + 'src/pages-operate', + 'src/pages-humanResource', + 'src/pages-integrated', + 'src/pages-politics', + 'src/pages-process', + 'src/pages-bpm', + 'src/pages-production' + ], // 是个数组,可以配置多个,但是不能为pages里面的目录 + dts: 'src/types/uni-pages.d.ts', + }), + UniLayouts(), + UniPlatform(), + UniManifest(), + // UniXXX 需要在 Uni 之前引入 + Uni(), + { + // 临时解决 dcloudio 官方的 @dcloudio/uni-mp-compiler 出现的编译 BUG + // 参考 github issue: https://github.com/dcloudio/uni-app/issues/4952 + // 自定义插件禁用 vite:vue 插件的 devToolsEnabled,强制编译 vue 模板时 inline 为 true + name: 'fix-vite-plugin-vue', + configResolved(config) { + const plugin = config.plugins.find((p) => p.name === 'vite:vue') + if (plugin && plugin.api && plugin.api.options) { + plugin.api.options.devToolsEnabled = false + } + }, + }, + UnoCSS(), + AutoImport({ + imports: ['vue', 'uni-app'], + dts: 'src/types/auto-import.d.ts', + dirs: ['src/hooks'], // 自动导入 hooks + eslintrc: { enabled: true }, + vueTemplate: true, // default false + }), - ViteRestart({ - // 通过这个插件,在修改vite.config.js文件则不需要重新运行也生效配置 - restart: ['vite.config.js'], - }), - // h5环境增加 BUILD_TIME 和 BUILD_BRANCH - UNI_PLATFORM === 'h5' && { - name: 'html-transform', - transformIndexHtml(html) { - return html.replace('%BUILD_TIME%', dayjs().format('YYYY-MM-DD HH:mm:ss')) - }, - }, - // 打包分析插件,h5 + 生产环境才弹出 - UNI_PLATFORM === 'h5' && - mode === 'production' && - visualizer({ - filename: './node_modules/.cache/visualizer/stats.html', - open: true, - gzipSize: true, - brotliSize: true, - }), - // 只有在 app 平台时才启用 copyNativeRes 插件 - UNI_PLATFORM === 'app' && copyNativeRes(), - viteMockServe({ - // 指定 mock 文件目录 - mockPath: './mock', - // 开发服务器才启用mock数据 - enable: mode === 'development' && JSON.parse(VITE_USE_MOCK), - }), - ], - define: { - __UNI_PLATFORM__: JSON.stringify(UNI_PLATFORM), - __VITE_APP_PROXY__: JSON.stringify(VITE_APP_PROXY), - }, - css: { - postcss: { - plugins: [ - // autoprefixer({ - // // 指定目标浏览器 - // overrideBrowserslist: ['> 1%', 'last 2 versions'], - // }), - ], - }, - }, + ViteRestart({ + // 通过这个插件,在修改vite.config.js文件则不需要重新运行也生效配置 + restart: ['vite.config.js'], + }), + // h5环境增加 BUILD_TIME 和 BUILD_BRANCH + UNI_PLATFORM === 'h5' && { + name: 'html-transform', + transformIndexHtml(html) { + return html.replace('%BUILD_TIME%', dayjs().format('YYYY-MM-DD HH:mm:ss')) + }, + }, + // 打包分析插件,h5 + 生产环境才弹出 + UNI_PLATFORM === 'h5' && + mode === 'production' && + visualizer({ + filename: './node_modules/.cache/visualizer/stats.html', + open: true, + gzipSize: true, + brotliSize: true, + }), + // 只有在 app 平台时才启用 copyNativeRes 插件 + UNI_PLATFORM === 'app' && copyNativeRes(), + viteMockServe({ + // 指定 mock 文件目录 + mockPath: './mock', + // 开发服务器才启用mock数据 + enable: mode === 'development' && JSON.parse(VITE_USE_MOCK), + }), + ], + define: { + __UNI_PLATFORM__: JSON.stringify(UNI_PLATFORM), + __VITE_APP_PROXY__: JSON.stringify(VITE_APP_PROXY), + }, + css: { + postcss: { + plugins: [ + // autoprefixer({ + // // 指定目标浏览器 + // overrideBrowserslist: ['> 1%', 'last 2 versions'], + // }), + ], + }, + }, - resolve: { - alias: { - '@': path.join(process.cwd(), './src'), - '@img': path.join(process.cwd(), './src/static/images'), - }, - }, - server: { - host: '0.0.0.0', - headers: { //允许跨域by 闵 - 'Access-Control-Allow-Origin': '*' - }, - hmr: true, - port: Number.parseInt(VITE_APP_PORT, 10), - // 仅 H5 端生效,其他端不生效(其他端走build,不走devServer) - proxy: JSON.parse(VITE_APP_PROXY) - ? { - [VITE_APP_PROXY_PREFIX]: { - target: VITE_SERVER_BASEURL, - changeOrigin: true, - rewrite: (path) => path.replace(new RegExp(`^${VITE_APP_PROXY_PREFIX}`), ''), - }, - } - : undefined, - }, - build: { - // 方便非h5端调试 - sourcemap: VITE_SHOW_SOURCEMAP === 'true', // 默认是false - target: 'es6', - // 开发环境不用压缩 - minify: mode === 'development' ? false : 'terser', - terserOptions: { - compress: { - drop_console: VITE_DELETE_CONSOLE === 'true', - drop_debugger: true, - }, - }, - }, - }) -} + resolve: { + alias: { + '@': path.join(process.cwd(), './src'), + '@img': path.join(process.cwd(), './src/static/images'), + }, + }, + server: { + host: '0.0.0.0', + headers: { //允许跨域by 闵 + 'Access-Control-Allow-Origin': '*' + }, + hmr: true, + port: Number.parseInt(VITE_APP_PORT, 10), + // 仅 H5 端生效,其他端不生效(其他端走build,不走devServer) + proxy: JSON.parse(VITE_APP_PROXY) + ? { + [VITE_APP_PROXY_PREFIX]: { + target: VITE_SERVER_BASEURL, + changeOrigin: true, + rewrite: (path) => path.replace(new RegExp(`^${VITE_APP_PROXY_PREFIX}`), ''), + }, + } + : undefined, + }, + build: { + // 方便非h5端调试 + sourcemap: VITE_SHOW_SOURCEMAP === 'true', // 默认是false + target: 'es6', + // 开发环境不用压缩 + minify: mode === 'development' ? false : 'terser', + terserOptions: { + compress: { + drop_console: VITE_DELETE_CONSOLE === 'true', + drop_debugger: true, + }, + }, + }, + }) +} \ No newline at end of file