Merge branch 'base' into tabbar
This commit is contained in:
commit
ffa5c68e66
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
src/uni_modules/
|
9
.gitignore
vendored
9
.gitignore
vendored
@ -22,12 +22,9 @@ dist
|
||||
.hbuilderx
|
||||
|
||||
.stylelintcache
|
||||
# rollup-plugin-visualizer 生成的分析文件
|
||||
stats.html
|
||||
|
||||
# unplugin-auto-import 生成的类型文件
|
||||
auto-import.d.ts
|
||||
# unplugin-vue-components 生成的类型文件
|
||||
components.d.ts
|
||||
# vite-plugin-uni-pages 生成的类型文件
|
||||
uni-pages.d.ts
|
||||
|
||||
@ -36,7 +33,6 @@ src/pages.json
|
||||
src/manifest.json
|
||||
|
||||
# lock 文件还是不要了,我主要的版本写死就好了
|
||||
# github actions 需要这些文件,所以main分支需要留着
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
|
||||
@ -46,3 +42,6 @@ package-lock.json
|
||||
# git rm -r --cached file1 file2 ## 针对某些文件
|
||||
# git rm -r --cached dir1 dir2 ## 针对某些文件夹
|
||||
# git rm -r --cached . ## 针对所有文件
|
||||
|
||||
# 更新 uni-app 官方版本
|
||||
# npx @dcloudio/uvm@latest
|
||||
|
1
.stylelintignore
Normal file
1
.stylelintignore
Normal file
@ -0,0 +1 @@
|
||||
src/uni_modules/
|
@ -3,7 +3,8 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: [
|
||||
'stylelint-config-standard',
|
||||
// stylelint-config-standard 替换成了更宽松的 stylelint-config-recommended
|
||||
'stylelint-config-recommended',
|
||||
// stylelint-config-standard-scss 替换成了更宽松的 stylelint-config-recommended-scss
|
||||
'stylelint-config-recommended-scss',
|
||||
'stylelint-config-recommended-vue/scss',
|
||||
|
42
package.json
42
package.json
@ -79,35 +79,35 @@
|
||||
"bin-wrapper": "npm:bin-wrapper-china"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-app": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-components": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-h5": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-app": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-components": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-h5": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4010420240430001",
|
||||
"dayjs": "1.11.10",
|
||||
"pinia": "2.0.36",
|
||||
"pinia-plugin-persistedstate": "3.2.1",
|
||||
"qs": "6.5.3",
|
||||
"vue": "3.3.11",
|
||||
"vue": "3.4.26",
|
||||
"wot-design-uni": "^1.2.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^18.4.3",
|
||||
"@commitlint/config-conventional": "^18.4.3",
|
||||
"@dcloudio/types": "^3.4.8",
|
||||
"@dcloudio/uni-automator": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-4000820240401001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4000820240401001",
|
||||
"@dcloudio/uni-automator": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4010420240430001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-4010420240430001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4010420240430001",
|
||||
"@iconify-json/carbon": "^1.1.27",
|
||||
"@types/node": "^20.11.5",
|
||||
"@types/wechat-miniprogram": "^3.4.7",
|
||||
@ -139,16 +139,16 @@
|
||||
"stylelint": "^16.0.2",
|
||||
"stylelint-config-html": "^1.1.0",
|
||||
"stylelint-config-recess-order": "^4.4.0",
|
||||
"stylelint-config-recommended": "^14.0.0",
|
||||
"stylelint-config-recommended-scss": "^14.0.0",
|
||||
"stylelint-config-recommended-vue": "^1.5.0",
|
||||
"stylelint-config-standard": "^35.0.0",
|
||||
"stylelint-prettier": "^5.0.0",
|
||||
"terser": "^5.26.0",
|
||||
"typescript": "^4.9.5",
|
||||
"unocss": "^0.58.0",
|
||||
"unocss-applet": "^0.7.8",
|
||||
"unplugin-auto-import": "^0.17.2",
|
||||
"vite": "4.3.5",
|
||||
"vite": "5.2.8",
|
||||
"vite-plugin-restart": "^0.4.0",
|
||||
"vue-tsc": "^1.8.25"
|
||||
}
|
||||
|
@ -1,79 +0,0 @@
|
||||
{
|
||||
"name": "unibest-base",
|
||||
"appid": "H57F2ACE4",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
"modules": {},
|
||||
"distribute": {
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
],
|
||||
"minSdkVersion": 30,
|
||||
"targetSdkVersion": 30,
|
||||
"abiFilters": [
|
||||
"armeabi-v7a",
|
||||
"arm64-v8a"
|
||||
]
|
||||
},
|
||||
"ios": {},
|
||||
"sdkConfigs": {},
|
||||
"icons": {
|
||||
"android": {},
|
||||
"ios": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"quickapp": {},
|
||||
"mp-weixin": {
|
||||
"appid": "wxa2abb91f64032a2b",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"h5": {
|
||||
"router": {
|
||||
"base": "/"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
{
|
||||
"globalStyle": {
|
||||
"navigationStyle": "default",
|
||||
"navigationBarTitleText": "unibest",
|
||||
"navigationBarBackgroundColor": "#f8f8f8",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#FFFFFF"
|
||||
},
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue"
|
||||
}
|
||||
},
|
||||
"tabBar": {
|
||||
"custom": true,
|
||||
"color": "#999999",
|
||||
"selectedColor": "#018d71",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"borderStyle": "black",
|
||||
"height": "50px",
|
||||
"fontSize": "10px",
|
||||
"iconWidth": "24px",
|
||||
"spacing": "3px",
|
||||
"list": [
|
||||
{
|
||||
"iconPath": "static/tabbar/home.png",
|
||||
"selectedIconPath": "static/tabbar/homeHL.png",
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"iconPath": "static/tabbar/example.png",
|
||||
"selectedIconPath": "static/tabbar/exampleHL.png",
|
||||
"pagePath": "pages/index/about",
|
||||
"text": "关于"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"type": "home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/about",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/request",
|
||||
"type": "page",
|
||||
"layout": "demo",
|
||||
"style": {
|
||||
"navigationBarTitleText": "请求"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/request2",
|
||||
"type": "page",
|
||||
"layout": "demo",
|
||||
"style": {
|
||||
"navigationBarTitleText": "请求-状态一体化"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/upload",
|
||||
"type": "page",
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationBarTitleText": "上传"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/upload2",
|
||||
"type": "page",
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationBarTitleText": "上传-状态一体化"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": []
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { http, httpGet } from '@/utils/http'
|
||||
import { http } from '@/utils/http'
|
||||
export interface IFooItem {
|
||||
id: string
|
||||
name: string
|
||||
@ -15,7 +15,7 @@ export const getFooAPI = (name: string) => {
|
||||
|
||||
/** GET 请求 - 再次简化,看大家是否喜欢这种简化 */
|
||||
export const getFooAPI2 = (name: string) => {
|
||||
return httpGet<IFooItem>('/foo', { name })
|
||||
return http.get<IFooItem>('/foo', { name })
|
||||
}
|
||||
|
||||
/** POST 请求 */
|
||||
@ -27,3 +27,7 @@ export const postFooAPI = (name: string) => {
|
||||
data: { name },
|
||||
})
|
||||
}
|
||||
/** POST 请求 - 再次简化,看大家是否喜欢这种简化 */
|
||||
export const postFooAPI2 = (name: string) => {
|
||||
return http.post<IFooItem>('/foo', { name }, { name })
|
||||
}
|
||||
|
0
src/uni_modules/.gitkeep
Normal file
0
src/uni_modules/.gitkeep
Normal file
@ -41,6 +41,7 @@ export const http = <T>(options: CustomRequestOptions) => {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* GET 请求
|
||||
* @param url 后台地址
|
||||
@ -74,3 +75,6 @@ export const httpPost = <T>(
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
http.get = httpGet
|
||||
http.post = httpPost
|
||||
|
@ -1,16 +1,18 @@
|
||||
import pagesJson from '@/pages.json'
|
||||
|
||||
console.log(pagesJson)
|
||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||
|
||||
/** 判断当前页面是否是tabbar页 */
|
||||
export const getIsTabbar = () => {
|
||||
if (!Object.keys(pagesJson).includes('tabBar')) {
|
||||
if (!tabBar) {
|
||||
return false
|
||||
}
|
||||
const pages = getCurrentPages()
|
||||
const lastPage = pages.at(-1)
|
||||
if (!tabBar.list.length) {
|
||||
// 通常有tabBar的话,list不能有空,且至少有2个元素,这里其实不用处理
|
||||
return false
|
||||
}
|
||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||
const lastPage = getCurrentPages().at(-1)
|
||||
const currPath = lastPage.route
|
||||
return !!pagesJson.tabBar.list.find((e) => e.pagePath === currPath)
|
||||
return !!tabBar.list.find((e) => e.pagePath === currPath)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -19,10 +21,8 @@ export const getIsTabbar = () => {
|
||||
* redirectPath 如 ‘/pages/demo/base/route-interceptor’
|
||||
*/
|
||||
export const currRoute = () => {
|
||||
const pages = getCurrentPages()
|
||||
console.log('pages:', pages)
|
||||
|
||||
const lastPage = pages.at(-1)
|
||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||
const lastPage = getCurrentPages().at(-1)
|
||||
const currRoute = (lastPage as any).$page
|
||||
// console.log('lastPage.$page:', currRoute)
|
||||
// console.log('lastPage.$page.fullpath:', currRoute.fullPath)
|
||||
@ -66,8 +66,8 @@ export const getUrlObj = (url: string) => {
|
||||
*/
|
||||
export const getAllPages = (key = 'needLogin') => {
|
||||
// 这里处理主包
|
||||
const pages = [
|
||||
...pagesJson.pages
|
||||
const mainPages = [
|
||||
...pages
|
||||
.filter((page) => !key || page[key])
|
||||
.map((page) => ({
|
||||
...page,
|
||||
@ -76,7 +76,7 @@ export const getAllPages = (key = 'needLogin') => {
|
||||
]
|
||||
// 这里处理分包
|
||||
const subPages: any[] = []
|
||||
pagesJson.subPackages.forEach((subPageObj) => {
|
||||
subPackages.forEach((subPageObj) => {
|
||||
// console.log(subPageObj)
|
||||
const { root } = subPageObj
|
||||
|
||||
@ -89,7 +89,7 @@ export const getAllPages = (key = 'needLogin') => {
|
||||
})
|
||||
})
|
||||
})
|
||||
const result = [...pages, ...subPages]
|
||||
const result = [...mainPages, ...subPages]
|
||||
console.log(`getAllPages by ${key} result: `, result)
|
||||
return result
|
||||
}
|
||||
|
@ -110,13 +110,13 @@ export default ({ command, mode }) => {
|
||||
hmr: true,
|
||||
port: Number.parseInt(VITE_APP_PORT, 10),
|
||||
// 仅 H5 端生效,其他端不生效(其他端走build,不走devServer)
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: VITE_SERVER_BASEURL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
},
|
||||
},
|
||||
// proxy: {
|
||||
// '/api': {
|
||||
// target: VITE_SERVER_BASEURL,
|
||||
// changeOrigin: true,
|
||||
// rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// },
|
||||
// },
|
||||
},
|
||||
build: {
|
||||
// 方便非h5端调试
|
||||
|
Loading…
x
Reference in New Issue
Block a user