Merge branch 'base' into i18n
This commit is contained in:
commit
deda75ffdd
@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
- node>=18
|
- node>=18
|
||||||
- pnpm>=7.30
|
- pnpm>=7.30
|
||||||
|
- Vue Official<=2.1.6
|
||||||
|
- TypeScript<=5.5.4
|
||||||
|
|
||||||
## 📂 快速开始
|
## 📂 快速开始
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
"qs": "6.5.3",
|
"qs": "6.5.3",
|
||||||
"vue": "3.4.21",
|
"vue": "3.4.21",
|
||||||
"vue-i18n": "^9.1.9",
|
"vue-i18n": "^9.1.9",
|
||||||
"wot-design-uni": "^1.3.9",
|
"wot-design-uni": "^1.3.10",
|
||||||
"z-paging": "^2.7.10"
|
"z-paging": "^2.7.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -113,6 +113,7 @@
|
|||||||
"@types/wechat-miniprogram": "^3.4.7",
|
"@types/wechat-miniprogram": "^3.4.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
"@typescript-eslint/parser": "^6.21.0",
|
"@typescript-eslint/parser": "^6.21.0",
|
||||||
|
"@uni-helper/uni-types": "1.0.0-alpha.3",
|
||||||
"@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
|
"@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
|
||||||
"@uni-helper/vite-plugin-uni-manifest": "^0.2.6",
|
"@uni-helper/vite-plugin-uni-manifest": "^0.2.6",
|
||||||
"@uni-helper/vite-plugin-uni-pages": "0.2.20",
|
"@uni-helper/vite-plugin-uni-pages": "0.2.20",
|
||||||
@ -145,7 +146,7 @@
|
|||||||
"stylelint-config-recommended-vue": "^1.5.0",
|
"stylelint-config-recommended-vue": "^1.5.0",
|
||||||
"stylelint-prettier": "^5.0.0",
|
"stylelint-prettier": "^5.0.0",
|
||||||
"terser": "^5.31.1",
|
"terser": "^5.31.1",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^5.5.4",
|
||||||
"unocss": "^0.58.9",
|
"unocss": "^0.58.9",
|
||||||
"unocss-applet": "^0.7.8",
|
"unocss-applet": "^0.7.8",
|
||||||
"unplugin-auto-import": "^0.17.6",
|
"unplugin-auto-import": "^0.17.6",
|
||||||
|
423
pnpm-lock.yaml
generated
423
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,7 @@
|
|||||||
// TODO: 别忘加更改环境变量的 VITE_UPLOAD_BASEURL 地址。
|
// TODO: 别忘加更改环境变量的 VITE_UPLOAD_BASEURL 地址。
|
||||||
const VITE_UPLOAD_BASEURL = import.meta.env.VITE_UPLOAD_BASEURL
|
import { getEvnBaseUploadUrl } from '@/utils'
|
||||||
|
|
||||||
|
const VITE_UPLOAD_BASEURL = `${getEvnBaseUploadUrl()}`
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* useUpload 是一个定制化的请求钩子,用于处理上传图片。
|
* useUpload 是一个定制化的请求钩子,用于处理上传图片。
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { platform } from '@/utils/platform'
|
import { platform } from '@/utils/platform'
|
||||||
|
import { getEvnBaseUrl } from '@/utils'
|
||||||
|
|
||||||
export type CustomRequestOptions = UniApp.RequestOptions & {
|
export type CustomRequestOptions = UniApp.RequestOptions & {
|
||||||
query?: Record<string, any>
|
query?: Record<string, any>
|
||||||
@ -10,7 +11,7 @@ export type CustomRequestOptions = UniApp.RequestOptions & {
|
|||||||
} & IUniUploadFileOptions // 添加uni.uploadFile参数类型
|
} & IUniUploadFileOptions // 添加uni.uploadFile参数类型
|
||||||
|
|
||||||
// 请求基准地址
|
// 请求基准地址
|
||||||
const baseUrl = import.meta.env.VITE_SERVER_BASEURL
|
const baseUrl = getEvnBaseUrl()
|
||||||
|
|
||||||
// 拦截器配置
|
// 拦截器配置
|
||||||
const httpInterceptor = {
|
const httpInterceptor = {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||||
|
import { isMp } from './platform'
|
||||||
|
|
||||||
const getLastPage = () => {
|
const getLastPage = () => {
|
||||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||||
// const lastPage = getCurrentPages().at(-1)
|
// const lastPage = getCurrentPages().at(-1)
|
||||||
@ -116,3 +118,61 @@ export const getNeedLoginPages = (): string[] => getAllPages('needLogin').map((p
|
|||||||
* 只得到 path 数组
|
* 只得到 path 数组
|
||||||
*/
|
*/
|
||||||
export const needLoginPages: string[] = getAllPages('needLogin').map((page) => page.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://ukw0y1.laf.run'
|
||||||
|
break
|
||||||
|
case 'trial':
|
||||||
|
baseUrl = 'https://ukw0y1.laf.run'
|
||||||
|
break
|
||||||
|
case 'release':
|
||||||
|
baseUrl = 'https://ukw0y1.laf.run'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据微信小程序当前环境,判断应该获取的UPLOAD_BASEURL
|
||||||
|
*/
|
||||||
|
export const getEvnBaseUploadUrl = () => {
|
||||||
|
// 请求基准地址
|
||||||
|
let baseUploadUrl = import.meta.env.VITE_UPLOAD_BASEURL
|
||||||
|
|
||||||
|
// 小程序端环境区分
|
||||||
|
if (isMp) {
|
||||||
|
const {
|
||||||
|
miniProgram: { envVersion },
|
||||||
|
} = uni.getAccountInfoSync()
|
||||||
|
|
||||||
|
switch (envVersion) {
|
||||||
|
case 'develop':
|
||||||
|
baseUploadUrl = 'https://ukw0y1.laf.run/upload'
|
||||||
|
break
|
||||||
|
case 'trial':
|
||||||
|
baseUploadUrl = 'https://ukw0y1.laf.run/upload'
|
||||||
|
break
|
||||||
|
case 'release':
|
||||||
|
baseUploadUrl = 'https://ukw0y1.laf.run/upload'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseUploadUrl
|
||||||
|
}
|
||||||
|
@ -15,11 +15,16 @@
|
|||||||
},
|
},
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"lib": ["esnext", "dom"],
|
"lib": ["esnext", "dom"],
|
||||||
"types": ["@dcloudio/types", "@types/wechat-miniprogram", "wot-design-uni/global.d.ts"]
|
"types": [
|
||||||
|
"@dcloudio/types",
|
||||||
|
"@uni-helper/uni-types",
|
||||||
|
"@types/wechat-miniprogram",
|
||||||
|
"wot-design-uni/global.d.ts"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"vueCompilerOptions": {
|
"vueCompilerOptions": {
|
||||||
"target": 3,
|
"target": 3,
|
||||||
"nativeTags": ["block", "template", "component", "slot"]
|
"plugins": ["@uni-helper/uni-types/volar-plugin"]
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules"],
|
"exclude": ["node_modules"],
|
||||||
"include": [
|
"include": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user