From 9b4adf6c63f9c0ba7a833cf6b4137cb0f902794d Mon Sep 17 00:00:00 2001 From: iHeyTang Date: Tue, 2 Sep 2025 17:17:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E9=85=8D=E7=BD=AE=E5=92=8C=E5=B9=B3=E5=8F=B0=E6=94=AF?= =?UTF-8?q?=E6=8C=81=EF=BC=8C=E6=94=AF=E6=8C=81=E5=A4=9A=E7=AB=AF=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E8=AF=95=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 ++- .env.production | 6 ++++-- .env.test | 6 ++++-- config/index.ts | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/.env.development b/.env.development index 0dc3e7b..622e77d 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,4 @@ # 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config # TARO_APP_ID="开发环境下的小程序 AppID" -TARO_APP_ID=ttbfd9c96420ec8f8201 \ No newline at end of file +TARO_APP_ID_WEAPP=wxb51f0b0c3aad7cdf +TARO_APP_ID_TT=ttbfd9c96420ec8f8201 diff --git a/.env.production b/.env.production index 0202ec0..622e77d 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,4 @@ -# TARO_APP_ID="生产环境下的小程序 AppID" -TARO_APP_ID=ttbfd9c96420ec8f8201 \ No newline at end of file +# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config +# TARO_APP_ID="开发环境下的小程序 AppID" +TARO_APP_ID_WEAPP=wxb51f0b0c3aad7cdf +TARO_APP_ID_TT=ttbfd9c96420ec8f8201 diff --git a/.env.test b/.env.test index 8ee227d..622e77d 100644 --- a/.env.test +++ b/.env.test @@ -1,2 +1,4 @@ -# TARO_APP_ID="测试环境下的小程序 AppID" -TARO_APP_ID=ttbfd9c96420ec8f8201 \ No newline at end of file +# 配置文档参考 https://taro-docs.jd.com/docs/next/env-mode-config +# TARO_APP_ID="开发环境下的小程序 AppID" +TARO_APP_ID_WEAPP=wxb51f0b0c3aad7cdf +TARO_APP_ID_TT=ttbfd9c96420ec8f8201 diff --git a/config/index.ts b/config/index.ts index 1d13a38..42a8072 100644 --- a/config/index.ts +++ b/config/index.ts @@ -5,6 +5,16 @@ import prodConfig from './prod' // https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数 export default defineConfig<'vite'>(async (merge) => { + // 不同平台的 appId 配置 + const appIds = { + weapp: process.env.TARO_APP_ID_WEAPP || 'your-weapp-appid', + tt: process.env.TARO_APP_ID_TT || 'your-tt-appid', + alipay: process.env.TARO_APP_ID_ALIPAY || 'your-alipay-appid', + swan: process.env.TARO_APP_ID_SWAN || 'your-swan-appid', + qq: process.env.TARO_APP_ID_QQ || 'your-qq-appid', + jd: process.env.TARO_APP_ID_JD || 'your-jd-appid' + } + const baseConfig: UserConfigExport<'vite'> = { projectName: 'bw-mini-app', date: '2025-9-1', @@ -16,7 +26,7 @@ export default defineConfig<'vite'>(async (merge) => { 828: 1.81 / 2 }, sourceRoot: 'src', - outputRoot: 'dist', + outputRoot: process.env.TARO_ENV ? `dist/${process.env.TARO_ENV}` : 'dist', plugins: [ "@tarojs/plugin-generator" ], @@ -47,6 +57,31 @@ export default defineConfig<'vite'>(async (merge) => { } }, }, + // 小程序平台特定配置 + weapp: { + outputRoot: 'dist/weapp', + appId: appIds.weapp + }, + tt: { + outputRoot: 'dist/tt', + appId: appIds.tt + }, + alipay: { + outputRoot: 'dist/alipay', + appId: appIds.alipay + }, + swan: { + outputRoot: 'dist/swan', + appId: appIds.swan + }, + qq: { + outputRoot: 'dist/qq', + appId: appIds.qq + }, + jd: { + outputRoot: 'dist/jd', + appId: appIds.jd + }, h5: { publicPath: '/', staticDirectory: 'static', From 2704645b0eaea55dabf55bedfc17bf6e88a88e1c Mon Sep 17 00:00:00 2001 From: iHeyTang Date: Tue, 2 Sep 2025 17:21:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E9=9C=80=E8=A6=81=E4=B8=AA=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.config.json | 16 +++++++++++++++- project.tt.json | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 project.tt.json diff --git a/project.config.json b/project.config.json index 1e7518d..4818118 100644 --- a/project.config.json +++ b/project.config.json @@ -1 +1,15 @@ -{"miniprogramRoot":"./dist","projectname":"bw-mini-app","description":"图生图 风格转换 ","appid":"ttbfd9c96420ec8f8201","setting":{"urlCheck":true,"es6":true,"enhance":false,"compileHotReLoad":false,"postcss":false,"minified":false},"compileType":"miniprogram"} \ No newline at end of file +{ + "miniprogramRoot": "./dist/weapp", + "projectname": "bw-mini-app", + "description": "图生图 风格转换 ", + "appid": "wxb51f0b0c3aad7cdf", + "setting": { + "urlCheck": true, + "es6": true, + "enhance": false, + "compileHotReLoad": false, + "postcss": false, + "minified": false + }, + "compileType": "miniprogram" +} diff --git a/project.tt.json b/project.tt.json new file mode 100644 index 0000000..517768b --- /dev/null +++ b/project.tt.json @@ -0,0 +1,5 @@ +{ + "miniprogramRoot": "./dist/tt", + "projectname": "bw-mini-app", + "appid": "ttbfd9c96420ec8f8201" +}