diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 27df73d..ca20d5b 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -3,11 +3,14 @@ "Component": true, "ComponentPublicInstance": true, "ComputedRef": true, + "DirectiveBinding": true, "EffectScope": true, "ExtractDefaultPropTypes": true, "ExtractPropTypes": true, "ExtractPublicPropTypes": true, "InjectionKey": true, + "MaybeRef": true, + "MaybeRefOrGetter": true, "PropType": true, "Ref": true, "VNode": true, @@ -65,6 +68,7 @@ "onUnload": true, "onUnmounted": true, "onUpdated": true, + "onWatcherCleanup": true, "provide": true, "reactive": true, "readonly": true, @@ -82,20 +86,15 @@ "useAttrs": true, "useCssModule": true, "useCssVars": true, + "useId": true, + "useModel": true, "useRequest": true, "useSlots": true, + "useTemplateRef": true, "useUpload": true, - "useUpload2": true, "watch": true, "watchEffect": true, "watchPostEffect": true, - "watchSyncEffect": true, - "DirectiveBinding": true, - "MaybeRef": true, - "MaybeRefOrGetter": true, - "onWatcherCleanup": true, - "useId": true, - "useModel": true, - "useTemplateRef": true + "watchSyncEffect": true } } diff --git a/env/.env b/env/.env index 03c7ecf..c367880 100644 --- a/env/.env +++ b/env/.env @@ -1,15 +1,15 @@ -VITE_APP_TITLE = 'unibest' -VITE_APP_PORT = 9000 +VITE_APP_TITLE='星星勤务' +VITE_APP_PORT=9000 -VITE_UNI_APPID = 'H57F2ACE4' -VITE_WX_APPID = 'wxa2abb91f64032a2b' +VITE_UNI_APPID='__UNI__58536F2' +VITE_WX_APPID='wxa2abb91f64032a2b' # h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base -VITE_APP_PUBLIC_BASE=/unibest/ +VITE_APP_PUBLIC_BASE=/ -VITE_SERVER_BASEURL = 'https://ukw0y1.laf.run' -VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload' +VITE_SERVER_BASEURL='https://ukw0y1.laf.run' +VITE_UPLOAD_BASEURL='https://ukw0y1.laf.run/upload' # h5是否需要配置代理 VITE_APP_PROXY=false -VITE_APP_PROXY_PREFIX = '/api' +VITE_APP_PROXY_PREFIX='/api' diff --git a/env/.env.development b/env/.env.development index 04fa273..286b50f 100644 --- a/env/.env.development +++ b/env/.env.development @@ -1,6 +1,6 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 -NODE_ENV = 'development' +NODE_ENV='development' # 是否去除console 和 debugger -VITE_DELETE_CONSOLE = false +VITE_DELETE_CONSOLE=false # 是否开启sourcemap -VITE_SHOW_SOURCEMAP = true +VITE_SHOW_SOURCEMAP=true diff --git a/env/.env.production b/env/.env.production index 8a1b50c..21bbcba 100644 --- a/env/.env.production +++ b/env/.env.production @@ -1,6 +1,6 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 -NODE_ENV = 'development' +NODE_ENV='development' # 是否去除console 和 debugger -VITE_DELETE_CONSOLE = true +VITE_DELETE_CONSOLE=true # 是否开启sourcemap -VITE_SHOW_SOURCEMAP = false +VITE_SHOW_SOURCEMAP=false diff --git a/env/.env.test b/env/.env.test index e22f765..ed9c565 100644 --- a/env/.env.test +++ b/env/.env.test @@ -1,4 +1,4 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 -NODE_ENV = 'development' +NODE_ENV='development' # 是否去除console 和 debugger -VITE_DELETE_CONSOLE = false +VITE_DELETE_CONSOLE=false diff --git a/package.json b/package.json index f7a3071..080be6d 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "pinia-plugin-persistedstate": "3.2.1", "qs": "6.5.3", "vue": "3.4.21", - "wot-design-uni": "^1.4.0", + "wot-design-uni": "1.4.0", "z-paging": "^2.8.4" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9699bff..a33933e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,8 +72,8 @@ importers: specifier: 3.4.21 version: 3.4.21(typescript@5.7.2) wot-design-uni: - specifier: ^1.4.0 - version: 1.4.0(vue@3.4.21(typescript@5.7.2)) + specifier: 1.5.1 + version: 1.5.1(vue@3.4.21(typescript@5.7.2)) z-paging: specifier: ^2.8.4 version: 2.8.4 @@ -5456,8 +5456,8 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} - wot-design-uni@1.4.0: - resolution: {integrity: sha512-h6sjrgfg7mP0nJwGTiHn/iTLPFyRswMpQV6MKhWN3skTnXe+FAyndvtXofpXp+uLkTXefGfw5BPI0uuCMD874w==} + wot-design-uni@1.5.1: + resolution: {integrity: sha512-jiDRuF8r7+xAldc4Dp+2T1VnqDnOoMWsXu6aRpDg2QG7ZH+/bJl7W8H8hHbKFgA9lu1By/HCDmpG7JC45nYtBw==} engines: {HBuilderX: ^3.8.7} peerDependencies: vue: '>=3.2.47' @@ -12236,7 +12236,7 @@ snapshots: word-wrap@1.2.5: {} - wot-design-uni@1.4.0(vue@3.4.21(typescript@5.7.2)): + wot-design-uni@1.5.1(vue@3.4.21(typescript@5.7.2)): dependencies: vue: 3.4.21(typescript@5.7.2) diff --git a/src/App.vue b/src/App.vue index e127703..49958a6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,29 +30,4 @@ height: 100%; vertical-align: middle; } - - // 单行省略,优先使用 unocss: text-ellipsis - .ellipsis { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - // 两行省略 - .ellipsis-2 { - display: -webkit-box; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - } - - // 三行省略 - .ellipsis-3 { - display: -webkit-box; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - } diff --git a/src/components/.gitkeep b/src/components/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/CustomTabBar/CustomTabBar.vue b/src/components/CustomTabBar/CustomTabBar.vue new file mode 100644 index 0000000..d9dd1fd --- /dev/null +++ b/src/components/CustomTabBar/CustomTabBar.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/components/Modal/Modal.vue b/src/components/Modal/Modal.vue new file mode 100644 index 0000000..ed171d8 --- /dev/null +++ b/src/components/Modal/Modal.vue @@ -0,0 +1,95 @@ + + + diff --git a/src/components/TopNavigation/TopNavigation.vue b/src/components/TopNavigation/TopNavigation.vue new file mode 100644 index 0000000..af1bfdd --- /dev/null +++ b/src/components/TopNavigation/TopNavigation.vue @@ -0,0 +1,75 @@ + + + diff --git a/src/constants/regular-expressions.js b/src/constants/regular-expressions.js new file mode 100644 index 0000000..1fcc6be --- /dev/null +++ b/src/constants/regular-expressions.js @@ -0,0 +1,3 @@ +export const phoneRegExp = /^1[3-9]\d{9}$/ + +export const passwordRegExp = /^(?![0-9]+$)(?![a-zA-Z]+$)(?![^0-9a-zA-Z]+$).{8,20}$/ diff --git a/src/hooks/.gitkeep b/src/hooks/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/manifest.json b/src/manifest.json index ac9b61f..2c18b3f 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { - "name": "unibest", - "appid": "H57F2ACE4", + "name": "星星勤务", + "appid": "__UNI__58536F2", "description": "", "versionName": "1.0.0", "versionCode": "100", @@ -105,7 +105,7 @@ "vueVersion": "3", "h5": { "router": { - "base": "/unibest/" + "base": "/" } } -} +} \ No newline at end of file diff --git a/src/pages.json b/src/pages.json index 0c1bb86..db2c4f6 100644 --- a/src/pages.json +++ b/src/pages.json @@ -51,7 +51,7 @@ }, "pages": [ { - "path": "pages/index/index", + "path": "pages/home/home", "type": "home", "style": { "navigationStyle": "custom", @@ -59,12 +59,53 @@ } }, { - "path": "pages/about/about", + "path": "pages/code/code", "type": "page", "style": { - "navigationBarTitleText": "关于" + "navigationStyle": "custom", + "disableScroll": true } + }, + { + "path": "pages/get-code/get-code", + "type": "page", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/home/CustomTab", + "type": "page" + }, + { + "path": "pages/login/login", + "type": "page", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/mine/mine", + "type": "page" + }, + { + "path": "pages/notification/notification", + "type": "page" + }, + { + "path": "pages/reset-password/reset-password", + "type": "page", + "style": { + "navigationStyle": "custom", + "disableScroll": true + } + }, + { + "path": "pages/workbench/workbench", + "type": "page" } ], "subPackages": [] -} +} \ No newline at end of file diff --git a/src/pages/about/about.vue b/src/pages/about/about.vue deleted file mode 100644 index 4276540..0000000 --- a/src/pages/about/about.vue +++ /dev/null @@ -1,36 +0,0 @@ - -{ - style: { - navigationBarTitleText: '关于' - } -} - - - - - - - diff --git a/src/pages/about/components/request.vue b/src/pages/about/components/request.vue deleted file mode 100644 index 3ccb18f..0000000 --- a/src/pages/about/components/request.vue +++ /dev/null @@ -1,56 +0,0 @@ - -{ - layout: 'demo', - style: { - navigationBarTitleText: '请求' - } -} - - - - - diff --git a/src/pages/about/components/upload.vue b/src/pages/about/components/upload.vue deleted file mode 100644 index 2b2ee83..0000000 --- a/src/pages/about/components/upload.vue +++ /dev/null @@ -1,30 +0,0 @@ - -{ - layout: 'default', - style: { - navigationBarTitleText: '上传-状态一体化' - } -} - - - - - - - diff --git a/src/pages/code/code.vue b/src/pages/code/code.vue new file mode 100644 index 0000000..731d583 --- /dev/null +++ b/src/pages/code/code.vue @@ -0,0 +1,100 @@ + +{ + style: { + navigationStyle: 'custom', + disableScroll: true + } +} + + + + + + diff --git a/src/pages/get-code/get-code.vue b/src/pages/get-code/get-code.vue new file mode 100644 index 0000000..2c23461 --- /dev/null +++ b/src/pages/get-code/get-code.vue @@ -0,0 +1,59 @@ + +{ + style: { + navigationStyle: 'custom', + disableScroll: true + } +} + + + + + + diff --git a/src/pages/home/CustomTab.vue b/src/pages/home/CustomTab.vue new file mode 100644 index 0000000..feedb58 --- /dev/null +++ b/src/pages/home/CustomTab.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/pages/home/home.vue b/src/pages/home/home.vue new file mode 100644 index 0000000..b39176d --- /dev/null +++ b/src/pages/home/home.vue @@ -0,0 +1,254 @@ + +{ + style: { + navigationStyle: 'custom', + navigationBarTitleText: '首页' + } +} + + + + + + diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue deleted file mode 100644 index 8fb2be9..0000000 --- a/src/pages/index/index.vue +++ /dev/null @@ -1,56 +0,0 @@ - - -{ - style: { - navigationStyle: 'custom', - navigationBarTitleText: '首页' - } -} - - - - - - diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue new file mode 100644 index 0000000..258d9ec --- /dev/null +++ b/src/pages/login/login.vue @@ -0,0 +1,242 @@ + +{ + style: { + navigationStyle: 'custom', + disableScroll: true + } +} + + + + diff --git a/src/pages/mine/mine.vue b/src/pages/mine/mine.vue new file mode 100644 index 0000000..126a836 --- /dev/null +++ b/src/pages/mine/mine.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/pages/notification/notification.vue b/src/pages/notification/notification.vue new file mode 100644 index 0000000..126a836 --- /dev/null +++ b/src/pages/notification/notification.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/pages/reset-password/reset-password.vue b/src/pages/reset-password/reset-password.vue new file mode 100644 index 0000000..d07f1ac --- /dev/null +++ b/src/pages/reset-password/reset-password.vue @@ -0,0 +1,74 @@ + +{ + style: { + navigationStyle: 'custom', + disableScroll: true + } +} + + + + + + diff --git a/src/pages/workbench/workbench.vue b/src/pages/workbench/workbench.vue new file mode 100644 index 0000000..126a836 --- /dev/null +++ b/src/pages/workbench/workbench.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/static/images/.gitkeep b/src/static/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/static/images/icon_back.png b/src/static/images/icon_back.png new file mode 100644 index 0000000..8f3fb45 Binary files /dev/null and b/src/static/images/icon_back.png differ diff --git a/src/static/images/icon_nav_close.png b/src/static/images/icon_nav_close.png new file mode 100644 index 0000000..dacd201 Binary files /dev/null and b/src/static/images/icon_nav_close.png differ diff --git a/src/static/images/icon_nav_more.png b/src/static/images/icon_nav_more.png new file mode 100644 index 0000000..b70c06e Binary files /dev/null and b/src/static/images/icon_nav_more.png differ diff --git a/src/static/images/icon_scan_code.png b/src/static/images/icon_scan_code.png new file mode 100644 index 0000000..f48d932 Binary files /dev/null and b/src/static/images/icon_scan_code.png differ diff --git a/src/static/images/icon_wechat.png b/src/static/images/icon_wechat.png new file mode 100644 index 0000000..144dd1c Binary files /dev/null and b/src/static/images/icon_wechat.png differ diff --git a/src/static/logo.png b/src/static/logo.png new file mode 100644 index 0000000..b5771e2 Binary files /dev/null and b/src/static/logo.png differ diff --git a/src/store/basic.ts b/src/store/basic.ts new file mode 100644 index 0000000..55273b9 --- /dev/null +++ b/src/store/basic.ts @@ -0,0 +1,22 @@ +import { defineStore } from 'pinia' +import GetSystemInfoResult = UniNamespace.GetSystemInfoResult + +export const useBasicStore = defineStore('basic', () => { + // 系统信息 + let systemInfo: GetSystemInfoResult = uni.getSystemInfoSync() + // 获取系统信息 + const getSystemInfo = (): Promise => { + return new Promise(resolve => { + if (systemInfo.uniPlatform) { + resolve(systemInfo) + } else { + systemInfo = uni.getSystemInfoSync() + resolve(systemInfo) + } + }) + } + + return { + getSystemInfo + } +}) diff --git a/src/store/index.ts b/src/store/index.ts index 964ce63..37cdae4 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -15,3 +15,4 @@ export default store // 模块统一导出 export * from './user' +export * from './basic' diff --git a/src/types/auto-import.d.ts b/src/types/auto-import.d.ts index 117a03d..5dedc7d 100644 --- a/src/types/auto-import.d.ts +++ b/src/types/auto-import.d.ts @@ -79,12 +79,10 @@ declare global { const useCssVars: typeof import('vue')['useCssVars'] const useId: typeof import('vue')['useId'] const useModel: typeof import('vue')['useModel'] - const useNavbarWeixin: (typeof import('../hooks/useNavbarWeixin'))['default'] const useRequest: typeof import('../hooks/useRequest')['default'] const useSlots: typeof import('vue')['useSlots'] const useTemplateRef: typeof import('vue')['useTemplateRef'] const useUpload: typeof import('../hooks/useUpload')['default'] - const useUpload2: typeof import('../hooks/useUpload2')['default'] const watch: typeof import('vue')['watch'] const watchEffect: typeof import('vue')['watchEffect'] const watchPostEffect: typeof import('vue')['watchPostEffect'] diff --git a/src/types/uni-pages.d.ts b/src/types/uni-pages.d.ts index b87aa55..2397e12 100644 --- a/src/types/uni-pages.d.ts +++ b/src/types/uni-pages.d.ts @@ -4,8 +4,15 @@ // Generated by vite-plugin-uni-pages interface NavigateToOptions { - url: "/pages/index/index" | - "/pages/about/about"; + url: "/pages/home/home" | + "/pages/code/code" | + "/pages/get-code/get-code" | + "/pages/home/CustomTab" | + "/pages/login/login" | + "/pages/mine/mine" | + "/pages/notification/notification" | + "/pages/reset-password/reset-password" | + "/pages/workbench/workbench"; } interface RedirectToOptions extends NavigateToOptions {} diff --git a/src/typings.ts b/src/typings.ts index d564304..8052235 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -1,8 +1,8 @@ // 全局要用的类型放到这里 type IResData = { - code: number - msg: string + errorCode: number + errorMsg: string data: T } @@ -18,12 +18,24 @@ type IUniUploadFileOptions = { type IUserInfo = { nickname?: string avatar?: string - /** 微信的 openid,非微信没有这个字段 */ openid?: string token?: string } -enum TestEnum { - A = 'a', - B = 'b' +type TabBarItem = { + icon: string + title: string + isDot?: boolean + value?: number +} + +type HomeTabItem = { + icon: string + title: string + id: number +} + +type HomeTab = { + title: string + list: HomeTabItem[] } diff --git a/src/uni_modules/.gitkeep b/src/uni_modules/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/utils/http.ts b/src/utils/http.ts index dd422eb..8cb75a9 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -13,20 +13,20 @@ export const http = (options: CustomRequestOptions) => { success(res) { // 状态码 2xx,参考 axios 的设计 if (res.statusCode >= 200 && res.statusCode < 300) { - // 2.1 提取核心数据 res.data - resolve(res.data as IResData) - } else if (res.statusCode === 401) { - // 401错误 -> 清理用户信息,跳转到登录页 - // userStore.clearUserInfo() - // uni.navigateTo({ url: '/pages/login/login' }) - reject(res) + if (res.data.errorCode === 403) { + // 401错误 -> 清理用户信息,跳转到登录页 + // userStore.clearUserInfo() + // uni.navigateTo({ url: '/pages/login/login' }) + reject(res) + } else { + resolve(res.data as IResData) + } } else { // 其他错误 -> 根据后端错误信息轻提示 - !options.hideErrorToast && - uni.showToast({ - icon: 'none', - title: (res.data as IResData).msg || '请求错误' - }) + uni.showToast({ + icon: 'none', + title: '网络错误,请重试' + }) reject(res) } }, @@ -34,7 +34,7 @@ export const http = (options: CustomRequestOptions) => { fail(err) { uni.showToast({ icon: 'none', - title: '网络错误,换个网络试试' + title: '网络错误,请重试' }) reject(err) } diff --git a/src/utils/platform.ts b/src/utils/platform.ts index 5c345ad..84e4e70 100644 --- a/src/utils/platform.ts +++ b/src/utils/platform.ts @@ -1,9 +1,3 @@ -/* - * @Author: 菲鸽 - * @Date: 2024-03-28 19:13:55 - * @Last Modified by: 菲鸽 - * @Last Modified time: 2024-03-28 19:24:55 - */ export const platform = __UNI_PLATFORM__ export const isH5 = __UNI_PLATFORM__ === 'h5' export const isApp = __UNI_PLATFORM__ === 'app'