From 154597a114a4065b3bea09b8977f2f0e0fe8a1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <1020103647@qq.com> Date: Sat, 1 Jun 2024 21:49:42 +0800 Subject: [PATCH 1/7] Revert "Merge branch 'base'" This reverts commit 7318f25c05977bd38ec046031d9d60865507d345, reversing changes made to 17d5e3e7e23ec89b453faf70f5a11fcaf33df13e. --- .github/ISSUE_TEMPLATE/bug_report.md | 32 ++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 6 +++ .github/workflows/deploy-h5.yml | 52 +++++++++++++++++++++++ package.json | 2 +- pnpm-lock.yaml | 2 +- 5 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/deploy-h5.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..bed7e7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report(报告问题) +about: Create a report to help us improve +--- + + + +# Bug report(问题描述) + +please write your issue description here + +## Steps to reproduce(问题复现步骤) + + + +## Screenshot or Gif(截图或动态图) + +## minimal reproduction(最小可还原代码) + +## System Info + +`npx envinfo --system --npmPackages vue --binaries --browsers` + +执行上面命令,将结果贴下面 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..c6b45b7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,6 @@ +--- +name: Feature Request(新功能建议) +about: Suggest an idea for this project +--- + +# Feature request(新功能建议) diff --git a/.github/workflows/deploy-h5.yml b/.github/workflows/deploy-h5.yml new file mode 100644 index 0000000..b199657 --- /dev/null +++ b/.github/workflows/deploy-h5.yml @@ -0,0 +1,52 @@ +name: Deploy Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + # 设置服务器时区为东八区 + - name: Set time zone + run: sudo timedatectl set-timezone 'Asia/Shanghai' + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + with: + version: 8 + - uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'pnpm' + - name: Install dependencies + run: pnpm i --no-frozen-lockfile + - name: Build + run: pnpm build:h5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./dist/build/h5 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/package.json b/package.json index 2f3f1db..edc01a3 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "pinia-plugin-persistedstate": "3.2.1", "qs": "6.5.3", "vue": "3.4.26", - "wot-design-uni": "^1.2.20", + "wot-design-uni": "^1.2.13", "z-paging": "^2.7.10" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d094b2..ef6bc73 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,7 +66,7 @@ dependencies: specifier: 3.4.26 version: 3.4.26(typescript@4.9.5) wot-design-uni: - specifier: ^1.2.20 + specifier: ^1.2.13 version: 1.2.20(vue@3.4.26) z-paging: specifier: ^2.7.10 From 69461204dd7940859cb3475ddedbfdc04b654b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <1020103647@qq.com> Date: Sat, 1 Jun 2024 21:48:17 +0800 Subject: [PATCH 2/7] build: "wot-design-uni": "^1.2.20" --- package.json | 2 +- pnpm-lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index edc01a3..2f3f1db 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "pinia-plugin-persistedstate": "3.2.1", "qs": "6.5.3", "vue": "3.4.26", - "wot-design-uni": "^1.2.13", + "wot-design-uni": "^1.2.20", "z-paging": "^2.7.10" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef6bc73..3d094b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,7 +66,7 @@ dependencies: specifier: 3.4.26 version: 3.4.26(typescript@4.9.5) wot-design-uni: - specifier: ^1.2.13 + specifier: ^1.2.20 version: 1.2.20(vue@3.4.26) z-paging: specifier: ^2.7.10 From 5f4bc6e206efdab66e565dd6d757a67220a99fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <65991901+codercup@users.noreply.github.com> Date: Sat, 1 Jun 2024 22:12:00 +0800 Subject: [PATCH 3/7] Merge pull request #95 from JinliangYan/fix-function-overloads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(eslint): 函数重载飘红 --- .eslintrc.cjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 2371f0b..aff8be4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -69,6 +69,9 @@ module.exports = { 'no-unused-vars': 'off', 'no-param-reassign': 'off', '@typescript-eslint/no-unused-vars': 'off', + // 避免 `eslint` 对于 `typescript` 函数重载的误报 + 'no-redeclare': 'off', + '@typescript-eslint/no-redeclare': 'error', }, // eslint-import-resolver-typescript 插件,@see https://www.npmjs.com/package/eslint-import-resolver-typescript settings: { From dfe099173199b92ff608493aaf28e5f530fea93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <1020103647@qq.com> Date: Thu, 6 Jun 2024 10:45:39 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=89=BE?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 51b6801..1aa3f68 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ +> 作者目前失业状态(5月底公司裁员),求工作,城市不限(一二线城市为主),薪资OPEN,大厂优先,尽量不加班,有推荐的请联系我,万分感激。 +> +> 微信与手机同号:`156 9200 4664`,备注:`工作` or `工作推荐`。 + `unibest` —— 最好的 `uniapp` 开发框架,由 `uniapp` + `Vue3` + `Ts` + `Vite5` + `UnoCss` + `wot-ui` + `z-paging` 构成,使用了最新的前端技术栈,无需依靠 `HBuilderX`,通过命令行方式运行 `web`、`小程序` 和 `App`(编辑器推荐 `VSCode`,可选 `webstorm`)。 `unibest` 内置了 `约定式路由`、`layout布局`、`请求封装`、`请求拦截`、`登录拦截`、`UnoCSS`、`i18n多语言` 等基础功能,提供了 `代码提示`、`自动格式化`、`统一配置`、`代码片段` 等辅助功能,让你编写 `uniapp` 拥有 `best` 体验 ( `unibest 的由来`)。 From 7d3a955389c3a99237bb5985837227503d6722f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <1020103647@qq.com> Date: Sun, 16 Jun 2024 22:05:31 +0800 Subject: [PATCH 5/7] perf: BUILD_DATE --> BUILD_TIME --- index.html | 2 +- vite.config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index da6d915..53ebc78 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + diff --git a/vite.config.ts b/vite.config.ts index e6a07de..1059b13 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -91,7 +91,7 @@ export default ({ command, mode }) => { UNI_PLATFORM === 'h5' && { name: 'html-transform', transformIndexHtml(html) { - return html.replace('%BUILD_DATE%', dayjs().format('YYYY-MM-DD HH:mm:ss')) + return html.replace('%BUILD_TIME%', dayjs().format('YYYY-MM-DD HH:mm:ss')) }, }, // 打包分析插件,h5 + 生产环境才弹出 From 35ee452a3ecddc6c82572055378c83d7a7690b31 Mon Sep 17 00:00:00 2001 From: Burt Date: Thu, 5 Sep 2024 21:11:47 +0800 Subject: [PATCH 6/7] build: fix pnpm version 2 --- .github/workflows/deploy-h5.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-h5.yml b/.github/workflows/deploy-h5.yml index b199657..2767edb 100644 --- a/.github/workflows/deploy-h5.yml +++ b/.github/workflows/deploy-h5.yml @@ -23,7 +23,7 @@ jobs: - name: Set time zone run: sudo timedatectl set-timezone 'Asia/Shanghai' - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 8 - uses: actions/setup-node@v4 From 560d4d05fee2de21aa4e35cf161309a7b943476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=89=AC?= <1076535690@qq.com> Date: Fri, 6 Sep 2024 09:39:23 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=E8=AF=B7=E6=B1=82=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E5=99=A8=E5=9F=BA=E5=87=86URL=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=8A=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整请求拦截器中的baseUrl定义,以适配不同的运行环境,特别是小程序环境。 --- src/interceptors/request.ts | 3 ++- src/utils/index.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/interceptors/request.ts b/src/interceptors/request.ts index 4cd0204..79c0a49 100644 --- a/src/interceptors/request.ts +++ b/src/interceptors/request.ts @@ -2,6 +2,7 @@ import qs from 'qs' import { useUserStore } from '@/store' import { platform } from '@/utils/platform' +import { getEvnBaseUrl } from '@/utils' export type CustomRequestOptions = UniApp.RequestOptions & { query?: Record @@ -10,7 +11,7 @@ export type CustomRequestOptions = UniApp.RequestOptions & { } & IUniUploadFileOptions // 添加uni.uploadFile参数类型 // 请求基准地址 -const baseUrl = import.meta.env.VITE_SERVER_BASEURL +const baseUrl = getEvnBaseUrl() // 拦截器配置 const httpInterceptor = { diff --git a/src/utils/index.ts b/src/utils/index.ts index 5c5ee2e..c01f0a7 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,6 @@ import { pages, subPackages, tabBar } from '@/pages.json' +import { isMp } from './platform' + const getLastPage = () => { // getCurrentPages() 至少有1个元素,所以不再额外判断 // const lastPage = getCurrentPages().at(-1) @@ -116,3 +118,32 @@ export const getNeedLoginPages = (): string[] => getAllPages('needLogin').map((p * 只得到 path 数组 */ export const needLoginPages: string[] = getAllPages('needLogin').map((page) => page.path) + +/** + * 根据微信小程序当前环境,判断应该获取的BaseUrl + */ +export const getEvnBaseUrl = () => { + // 请求基准地址 + let baseUrl = import.meta.env.VITE_SERVER_BASEURL + + // 小程序端环境区分 + if (isMp) { + const { + miniProgram: { envVersion }, + } = uni.getAccountInfoSync() + + switch (envVersion) { + case 'develop': + baseUrl = 'https://dev.test.net' + break + case 'trial': + baseUrl = 'https://trial.test.net' + break + case 'release': + baseUrl = 'https://prod.test.net' + break + } + } + + return baseUrl +}