Merge branch 'base' into tabbar
This commit is contained in:
commit
46ae55c73c
@ -41,6 +41,8 @@
|
||||
|
||||
- node>=18
|
||||
- pnpm>=7.30
|
||||
- Vue Official<=2.1.6
|
||||
- TypeScript<=5.5.4
|
||||
|
||||
## 📂 快速开始
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
"pinia-plugin-persistedstate": "3.2.1",
|
||||
"qs": "6.5.3",
|
||||
"vue": "3.4.21",
|
||||
"wot-design-uni": "^1.3.9",
|
||||
"wot-design-uni": "^1.3.10",
|
||||
"z-paging": "^2.7.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -112,6 +112,7 @@
|
||||
"@types/wechat-miniprogram": "^3.4.7",
|
||||
"@typescript-eslint/eslint-plugin": "^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-manifest": "^0.2.6",
|
||||
"@uni-helper/vite-plugin-uni-pages": "0.2.20",
|
||||
@ -144,7 +145,7 @@
|
||||
"stylelint-config-recommended-vue": "^1.5.0",
|
||||
"stylelint-prettier": "^5.0.0",
|
||||
"terser": "^5.31.1",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript": "^5.5.4",
|
||||
"unocss": "^0.58.9",
|
||||
"unocss-applet": "^0.7.8",
|
||||
"unplugin-auto-import": "^0.17.6",
|
||||
|
749
pnpm-lock.yaml
generated
749
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,7 @@
|
||||
// TODO: 别忘加更改环境变量的 VITE_UPLOAD_BASEURL 地址。
|
||||
const VITE_UPLOAD_BASEURL = import.meta.env.VITE_UPLOAD_BASEURL
|
||||
import { getEvnBaseUploadUrl } from '@/utils'
|
||||
|
||||
const VITE_UPLOAD_BASEURL = `${getEvnBaseUploadUrl()}`
|
||||
|
||||
/**
|
||||
* useUpload 是一个定制化的请求钩子,用于处理上传图片。
|
||||
|
@ -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<string, any>
|
||||
@ -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 = {
|
||||
|
@ -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,61 @@ 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://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",
|
||||
"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": {
|
||||
"target": 3,
|
||||
"nativeTags": ["block", "template", "component", "slot"]
|
||||
"plugins": ["@uni-helper/uni-types/volar-plugin"]
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"include": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user