diff --git a/env/.env b/env/.env index ffa26f4..fa5fd9f 100644 --- a/env/.env +++ b/env/.env @@ -1,7 +1,9 @@ VITE_APP_TITLE = '数智产销' VITE_APP_PORT = 9000 -VITE_UNI_APPID = '__UNI__9F097F0' +#VITE_UNI_APPID = '__UNI__9F097F0' +#测试APPID +VITE_UNI_APPID = '__UNI__1B02D50' VITE_WX_APPID = 'wx8e287639924edb51' #发布版本号 @@ -28,4 +30,4 @@ VITE_APP_PROXY= false VITE_APP_PROXY_PREFIX = '/api' # 是否启用mock (1.仅支持h5 2.启用必须要开启代理,否则生效。) -VITE_USE_MOCK = true +VITE_USE_MOCK = true \ No newline at end of file diff --git a/env/.env.development b/env/.env.development index 375d2cf..cfea491 100644 --- a/env/.env.development +++ b/env/.env.development @@ -4,6 +4,11 @@ NODE_ENV = 'development' VITE_DELETE_CONSOLE = false # 是否开启sourcemap VITE_SHOW_SOURCEMAP = true -VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot' +# 是否启用读取配置文件 min +#VITE_WEBAPP = 'D://opt//AppUpdateTest' +VITE_WEBAPP = '' +#VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot' #VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' -#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot' \ No newline at end of file +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' \ No newline at end of file diff --git a/env/.env.production b/env/.env.production index 99f7ca7..6bf67f0 100644 --- a/env/.env.production +++ b/env/.env.production @@ -4,4 +4,10 @@ NODE_ENV = 'development' VITE_DELETE_CONSOLE = true # 是否开启sourcemap VITE_SHOW_SOURCEMAP = false +# 是否启用读取配置文件 min +#VITE_WEBAPP = 'D://opt//AppUpdateTest' +VITE_WEBAPP = '' 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' +#VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot' \ No newline at end of file diff --git a/manifest.config.ts b/manifest.config.ts index ffade86..1ee837f 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -17,7 +17,7 @@ export default defineManifestConfig({ name: VITE_APP_TITLE, appid: VITE_UNI_APPID, description: '', - versionName: '2.0.2', + versionName: '2.0.0', versionCode: '20250616', transformPx: false, locale: VITE_FALLBACK_LOCALE, // 'zh-Hans' diff --git a/src/api/system/index.ts b/src/api/system/index.ts index 3ec4a04..f1c117c 100644 --- a/src/api/system/index.ts +++ b/src/api/system/index.ts @@ -26,10 +26,13 @@ export function loginApi(config : LoginParams) { * @param * @returns */ -export function upDateAppApi() { +export function upDateAppApi(path : string) { return http({ url: '/sys/common/upDateApp', - method: 'GET' + method: 'GET', + data: { + path + } }) } diff --git a/src/env.d.ts b/src/env.d.ts index 561b633..41fc2ef 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -14,7 +14,9 @@ interface ImportMetaEnv { /** 服务端口号 */ readonly VITE_SERVER_PORT: string /** 后台接口地址 */ - readonly VITE_SERVER_BASEURL: string + readonly VITE_WEBAPP: string + /** 读取更新配置文件路径 by min */ + readonly WEBAPP: string /** H5是否需要代理 */ readonly VITE_APP_PROXY: 'true' | 'false' /** H5是否需要代理,需要的话有个前缀 */ diff --git a/src/manifest.json b/src/manifest.json index 1589bed..4ae261f 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,8 +1,8 @@ { "name": "数智产销", - "appid": "__UNI__9F097F0", + "appid": "__UNI__1B02D50", "description": "", - "versionName": "2.0.2", + "versionName": "2.0.0", "versionCode": "20250616", "transformPx": false, "app-plus": { diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 72d8ac9..d1cbda1 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -105,9 +105,9 @@ let pw = Base64.encode(encodeURIComponent(password.value)) loading.value = true /*生产环境 begin */ - // loginApi({ username: un, password: pw }) + loginApi({ username: un, password: pw }) /*开发环境 begin */ - loginApi({ username: userName.value, password: password.value, captcha: 'app' }) + // loginApi({ username: userName.value, password: password.value, captcha: 'app' }) .then((res : any) => { if (res.success) { const { result } = res diff --git a/src/utils/index.ts b/src/utils/index.ts index 34ea067..cb9a81f 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -4,6 +4,8 @@ import { isMpWeixin } from './platform' import { useAppStore } from '@/store' import { upDateAppApi } from '@/api/system' + + const getLastPage = () => { // getCurrentPages() 至少有1个元素,所以不再额外判断 // const lastPage = getCurrentPages().at(-1) @@ -228,7 +230,14 @@ export const useUpdateApp = defineStore('updateApp', () => { */ function checkAppUpdate(to = false) { try { - upDateAppApi().then(async (res : any) => { + let path = '' + let webApp = import.meta.env.VITE_WEBAPP + console.log(webApp) + if(webApp){//如果是测试环境 ,upDateAppApi 传递参数 by min + path = webApp + } + console.log(path) + upDateAppApi(path).then(async (res : any) => { let { result } = res diff --git a/vite.config.ts b/vite.config.ts index 19f1f48..117c126 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -47,6 +47,7 @@ export default ({ command, mode }) => { VITE_APP_PROXY, VITE_APP_PROXY_PREFIX, VITE_USE_MOCK, + WEBAPP } = env console.log('环境变量 env -> ', env)