diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index a521947..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -# Run the commit-msg hook -npx --no-install commitlint --edit diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 0599206..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -# Run the pre-commit hook -npx --no-install -- lint-staged diff --git a/package.json b/package.json index 7b45d8a..313fe1a 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "bin-wrapper": "npm:bin-wrapper-china" }, "dependencies": { + "@chenfengyuan/vue-qrcode": "^2.0.0", "@dcloudio/uni-app": "3.0.0-4020920240930001", "@dcloudio/uni-app-harmony": "3.0.0-4020920240930001", "@dcloudio/uni-app-plus": "3.0.0-4020920240930001", diff --git a/pages.config.ts b/pages.config.ts index c334c9a..987dbd4 100644 --- a/pages.config.ts +++ b/pages.config.ts @@ -3,7 +3,7 @@ import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages' export default defineUniPages({ globalStyle: { navigationStyle: 'default', - navigationBarTitleText: 'unibest', + navigationBarTitleText: '', navigationBarBackgroundColor: '#f8f8f8', navigationBarTextStyle: 'black', backgroundColor: '#FFFFFF', @@ -18,25 +18,37 @@ export default defineUniPages({ }, tabBar: { color: '#999999', - selectedColor: '#018d71', - backgroundColor: '#F8F8F8', - borderStyle: 'black', - height: '50px', + selectedColor: '#0E57A2', + backgroundColor: '#ffffff', + borderStyle: '#E7E7E7', + height: '56px', fontSize: '10px', - iconWidth: '24px', + iconWidth: '20px', spacing: '3px', list: [ { iconPath: 'static/tabbar/home.png', selectedIconPath: 'static/tabbar/homeHL.png', pagePath: 'pages/index/index', - text: '%tabbar.home%', + text: '首页', }, { - iconPath: 'static/tabbar/example.png', - selectedIconPath: 'static/tabbar/exampleHL.png', - pagePath: 'pages/about/about', - text: '%tabbar.about%', + iconPath: 'static/tabbar/invest.png', + selectedIconPath: 'static/tabbar/investHL.png', + pagePath: 'pages/invest/index', + text: '投资', + }, + { + iconPath: 'static/tabbar/house.png', + selectedIconPath: 'static/tabbar/houseHL.png', + pagePath: 'pages/invite/index', + text: '房屋', + }, + { + iconPath: 'static/tabbar/personal.png', + selectedIconPath: 'static/tabbar/personalHL.png', + pagePath: 'pages/my/index', + text: '我的', }, ], }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f903f0..17f379b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: .: dependencies: + '@chenfengyuan/vue-qrcode': + specifier: ^2.0.0 + version: 2.0.0(qrcode@1.5.4)(vue@3.4.21(typescript@5.7.2)) '@dcloudio/uni-app': specifier: 3.0.0-4020920240930001 version: 3.0.0-4020920240930001(@dcloudio/types@3.4.14)(postcss@8.4.49)(rollup@4.28.0)(vue@3.4.21(typescript@5.7.2)) @@ -858,6 +861,12 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + '@chenfengyuan/vue-qrcode@2.0.0': + resolution: {integrity: sha512-33Cfr0zjbc3Dd8d5b1IgzXRAgXH0c2Gv19VI4snS25V/x9Z41eg769tC+Us1x+vqgQQhgD5YUjLnkpkrQfeMSw==} + peerDependencies: + qrcode: ^1.5.0 + vue: ^3.0.0 + '@commitlint/cli@18.6.1': resolution: {integrity: sha512-5IDE0a+lWGdkOvKH892HHAZgbAjcj1mT5QrfA/SVbLJV/BbBMGyKN0W5mhgjekPJJwEQdVNvhl9PwUacY58Usw==} engines: {node: '>=v18'} @@ -2436,6 +2445,9 @@ packages: resolution: {integrity: sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==} engines: {node: '>=18'} + cliui@6.0.0: + resolution: {integrity: sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==} + cliui@7.0.4: resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} @@ -2740,6 +2752,9 @@ packages: resolution: {integrity: sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + dijkstrajs@1.0.3: + resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==} + dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -4442,6 +4457,10 @@ packages: resolution: {integrity: sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==} engines: {node: '>=4.0.0'} + pngjs@5.0.0: + resolution: {integrity: sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==} + engines: {node: '>=10.13.0'} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -4589,6 +4608,11 @@ packages: resolution: {integrity: sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==} hasBin: true + qrcode@1.5.4: + resolution: {integrity: sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==} + engines: {node: '>=10.13.0'} + hasBin: true + qs@6.13.0: resolution: {integrity: sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==} engines: {node: '>=0.6'} @@ -4687,6 +4711,9 @@ packages: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} + require-main-filename@2.0.0: + resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} + requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} @@ -4809,6 +4836,9 @@ packages: resolution: {integrity: sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==} engines: {node: '>= 0.8.0'} + set-blocking@2.0.0: + resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + set-function-length@1.2.2: resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} engines: {node: '>= 0.4'} @@ -5465,6 +5495,9 @@ packages: resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} engines: {node: '>= 0.4'} + which-module@2.0.1: + resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==} + which-typed-array@1.1.16: resolution: {integrity: sha512-g+N+GAWiRj66DngFwHvISJd+ITsyphZvD1vChfVg6cEdnzy53GzB3oy0fUNlvhz7H7+MiqhYr26qxQShCpKTTQ==} engines: {node: '>= 0.4'} @@ -5488,6 +5521,10 @@ packages: peerDependencies: vue: '>=3.2.47' + wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -5565,6 +5602,9 @@ packages: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} + y18n@4.0.3: + resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} + y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} @@ -5589,6 +5629,10 @@ packages: engines: {node: '>= 14'} hasBin: true + yargs-parser@18.1.3: + resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} + engines: {node: '>=6'} + yargs-parser@20.2.9: resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} @@ -5597,6 +5641,10 @@ packages: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} + yargs@15.4.1: + resolution: {integrity: sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==} + engines: {node: '>=8'} + yargs@16.2.0: resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} engines: {node: '>=10'} @@ -6388,6 +6436,11 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} + '@chenfengyuan/vue-qrcode@2.0.0(qrcode@1.5.4)(vue@3.4.21(typescript@5.7.2))': + dependencies: + qrcode: 1.5.4 + vue: 3.4.21(typescript@5.7.2) + '@commitlint/cli@18.6.1(@types/node@20.17.9)(typescript@5.7.2)': dependencies: '@commitlint/format': 18.6.1 @@ -8859,6 +8912,12 @@ snapshots: slice-ansi: 5.0.0 string-width: 7.2.0 + cliui@6.0.0: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 6.2.0 + cliui@7.0.4: dependencies: string-width: 4.2.3 @@ -9113,6 +9172,8 @@ snapshots: diff-sequences@27.5.1: {} + dijkstrajs@1.0.3: {} + dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -11126,6 +11187,8 @@ snapshots: pngjs@3.4.0: {} + pngjs@5.0.0: {} + possible-typed-array-names@1.0.0: {} postcss-html@1.7.0: @@ -11260,6 +11323,12 @@ snapshots: qrcode-terminal@0.12.0: {} + qrcode@1.5.4: + dependencies: + dijkstrajs: 1.0.3 + pngjs: 5.0.0 + yargs: 15.4.1 + qs@6.13.0: dependencies: side-channel: 1.0.6 @@ -11370,6 +11439,8 @@ snapshots: require-from-string@2.0.2: {} + require-main-filename@2.0.0: {} + requires-port@1.0.0: {} resolve-cwd@3.0.0: @@ -11514,6 +11585,8 @@ snapshots: transitivePeerDependencies: - supports-color + set-blocking@2.0.0: {} + set-function-length@1.2.2: dependencies: define-data-property: 1.1.4 @@ -12262,6 +12335,8 @@ snapshots: is-weakmap: 2.0.2 is-weakset: 2.0.3 + which-module@2.0.1: {} + which-typed-array@1.1.16: dependencies: available-typed-arrays: 1.0.7 @@ -12284,6 +12359,12 @@ snapshots: dependencies: vue: 3.4.21(typescript@5.7.2) + wrap-ansi@6.2.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 @@ -12342,6 +12423,8 @@ snapshots: xtend@4.0.2: {} + y18n@4.0.3: {} + y18n@5.0.8: {} yallist@3.1.1: {} @@ -12354,10 +12437,29 @@ snapshots: yaml@2.6.1: {} + yargs-parser@18.1.3: + dependencies: + camelcase: 5.3.1 + decamelize: 1.2.0 + yargs-parser@20.2.9: {} yargs-parser@21.1.1: {} + yargs@15.4.1: + dependencies: + cliui: 6.0.0 + decamelize: 1.2.0 + find-up: 4.1.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + require-main-filename: 2.0.0 + set-blocking: 2.0.0 + string-width: 4.2.3 + which-module: 2.0.1 + y18n: 4.0.3 + yargs-parser: 18.1.3 + yargs@16.2.0: dependencies: cliui: 7.0.4 diff --git a/src/App.vue b/src/App.vue index 969d42a..f2de0bb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,21 +1,37 @@ diff --git a/src/interceptors/index.ts b/src/interceptors/index.ts index 292d9f8..e0d34e6 100644 --- a/src/interceptors/index.ts +++ b/src/interceptors/index.ts @@ -1,3 +1,3 @@ -export { routeInterceptor } from './route' +export { routeInterceptor, routerBeforeEachConfig } from './route' export { requestInterceptor } from './request' export { prototypeInterceptor } from './prototype' diff --git a/src/interceptors/route.ts b/src/interceptors/route.ts index fb8ad33..b50c59d 100644 --- a/src/interceptors/route.ts +++ b/src/interceptors/route.ts @@ -5,14 +5,19 @@ * 我这里应为大部分都可以随便进入,所以使用黑名单 */ import { useUserStore } from '@/store' -import { getNeedLoginPages, needLoginPages as _needLoginPages } from '@/utils' +import { + getNotNeedLoginPages as _getNotNeedLoginPages, + notNeedLoginPages as _notNeedLoginPages, + getIsTabbar, +} from '@/utils' +import type { Router } from 'vue-router' +import { tabBar } from '@/pages.json' -// TODO Check -const loginRoute = '/pages/login/index' +export const loginRoute = '/pages/login/index' -const isLogined = () => { +export const isLogged = () => { const userStore = useUserStore() - return userStore.isLogined + return userStore.isLogged } const isDev = import.meta.env.DEV @@ -21,26 +26,14 @@ const isDev = import.meta.env.DEV const navigateToInterceptor = { // 注意,这里的url是 '/' 开头的,如 '/pages/index/index',跟 'pages.json' 里面的 path 不同 invoke({ url }: { url: string }) { - // console.log(url) // /pages/route-interceptor/index?name=feige&age=30 - const path = url.split('?')[0] - let needLoginPages: string[] = [] - // 为了防止开发时出现BUG,这里每次都获取一下。生产环境可以移到函数外,性能更好 - if (isDev) { - needLoginPages = getNeedLoginPages() - } else { - needLoginPages = _needLoginPages + const isTabbar = getIsTabbar(url) + console.log(url) + // const redirectRoute = `${loginRoute}?redirect=${encodeURIComponent(url)}` + if (isTabbar) { + uni.switchTab({ url }) + return false } - const isNeedLogin = needLoginPages.includes(path) - if (!isNeedLogin) { - return true - } - const hasLogin = isLogined() - if (hasLogin) { - return true - } - const redirectRoute = `${loginRoute}?redirect=${encodeURIComponent(url)}` - uni.navigateTo({ url: redirectRoute }) - return false + return true }, } @@ -51,3 +44,50 @@ export const routeInterceptor = { uni.addInterceptor('redirectTo', navigateToInterceptor) }, } + +export const getNotNeedLoginPages = () => { + let notNeedLoginPages: string[] = [] + if (isDev) { + notNeedLoginPages = _getNotNeedLoginPages() + } else { + notNeedLoginPages = _notNeedLoginPages + } + return notNeedLoginPages +} + +export const checkLoginUrl = (url: string) => { + const path = url.split('?')[0] + const isNotNeedLogin = getNotNeedLoginPages().includes(path.replace(/^pages/, '/pages')) + console.log(path) + return isNotNeedLogin +} + +export const checkWithRedirectLogin = (url: string) => { + const isNotNeedLogin = checkLoginUrl(url) + if (!isNotNeedLogin) { + return !isLogged() + } + return false +} + +export const checkNotFound = (url: string) => { + const isNotNeedLogin = checkLoginUrl(url) + if (!isNotNeedLogin) { + return !isLogged() + } + return false +} + +export const routerBeforeEachConfig = (router: Router) => { + router.beforeEach((to, from, next) => { + if (checkWithRedirectLogin(to.path)) { + return next({ + path: loginRoute, + // query: { + // redirect: to.fullPath, + // }, + }) + } + return next() + }) +} diff --git a/src/main.ts b/src/main.ts index c6119a8..aeb6a7a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,12 @@ import { createSSRApp } from 'vue' import App from './App.vue' import store from './store' import i18n from './locale/index' -import { routeInterceptor, requestInterceptor, prototypeInterceptor } from './interceptors' +import { + routeInterceptor, + routerBeforeEachConfig, + requestInterceptor, + prototypeInterceptor, +} from './interceptors' import 'virtual:uno.css' import '@/style/index.scss' @@ -13,6 +18,10 @@ export function createApp() { app.use(routeInterceptor) app.use(requestInterceptor) app.use(prototypeInterceptor) + + setTimeout(() => { + routerBeforeEachConfig((app as any).router) + }, 0) return { app, } diff --git a/src/pages-sub/asset/index.vue b/src/pages-sub/asset/index.vue new file mode 100644 index 0000000..60aa3fb --- /dev/null +++ b/src/pages-sub/asset/index.vue @@ -0,0 +1,61 @@ + +{ + style: { + navigationBarTitleText: '我的资产', + navigationBarBackgroundColor: '#fff', + }, +} + + + + + diff --git a/src/pages-sub/convert/index.vue b/src/pages-sub/convert/index.vue new file mode 100644 index 0000000..2ff3889 --- /dev/null +++ b/src/pages-sub/convert/index.vue @@ -0,0 +1,78 @@ + +{ + style: { + navigationStyle: 'custom', + navigationBarTitleText: '转换', + }, +} + + + + + + diff --git a/src/pages-sub/introduction/index.vue b/src/pages-sub/introduction/index.vue new file mode 100644 index 0000000..6679c10 --- /dev/null +++ b/src/pages-sub/introduction/index.vue @@ -0,0 +1,23 @@ + +{ + style: { + navigationBarTitleText: '公司简介', + navigationBarBackgroundColor: '#fff', + }, +} + + + diff --git a/src/pages-sub/invest-detail/index.vue b/src/pages-sub/invest-detail/index.vue new file mode 100644 index 0000000..c49b6e4 --- /dev/null +++ b/src/pages-sub/invest-detail/index.vue @@ -0,0 +1,29 @@ + +{ + style: { + navigationBarTitleText: '投资记录', + navigationBarBackgroundColor: '#fff', + }, +} + + diff --git a/src/pages-sub/invest-immediately/index.vue b/src/pages-sub/invest-immediately/index.vue new file mode 100644 index 0000000..7df416b --- /dev/null +++ b/src/pages-sub/invest-immediately/index.vue @@ -0,0 +1,60 @@ + +{ + style: { + navigationStyle: 'custom', + navigationBarTitleText: '立即投资', + }, +} + + + + + + diff --git a/src/pages-sub/invest-result/index.vue b/src/pages-sub/invest-result/index.vue new file mode 100644 index 0000000..a194df8 --- /dev/null +++ b/src/pages-sub/invest-result/index.vue @@ -0,0 +1,26 @@ + +{ + style: { + navigationBarTitleText: '投资成功', + navigationBarBackgroundColor: '#fff', + }, +} + + + + diff --git a/src/pages-sub/invite/index.vue b/src/pages-sub/invite/index.vue new file mode 100644 index 0000000..6a79c58 --- /dev/null +++ b/src/pages-sub/invite/index.vue @@ -0,0 +1,74 @@ + +{ + style: { + navigationBarTitleText: '邀请好友', + navigationBarBackgroundColor: '#fff', + navigationStyle: 'custom', + }, +} + + + + + + + diff --git a/src/pages-sub/lottery/index.vue b/src/pages-sub/lottery/index.vue new file mode 100644 index 0000000..3ee3eda --- /dev/null +++ b/src/pages-sub/lottery/index.vue @@ -0,0 +1,19 @@ + + + +{ + style: { + navigationBarTitleText: '幸运大转盘', + navigationBarBackgroundColor: '#fff', + navigationStyle: 'custom', + }, +} + + + diff --git a/src/pages-sub/official-community/index.vue b/src/pages-sub/official-community/index.vue new file mode 100644 index 0000000..9013602 --- /dev/null +++ b/src/pages-sub/official-community/index.vue @@ -0,0 +1,46 @@ + + + +{ + style: { + navigationBarTitleText: '官方社群', + navigationBarBackgroundColor: '#fff', + navigationStyle: 'custom', + }, +} + + + + + diff --git a/src/pages-sub/realname/index.vue b/src/pages-sub/realname/index.vue new file mode 100644 index 0000000..c0eb15a --- /dev/null +++ b/src/pages-sub/realname/index.vue @@ -0,0 +1,92 @@ + +{ + style: { + navigationBarTitleText: '实名认证', + navigationBarBackgroundColor: '#fff', + }, +} + + + + + + diff --git a/src/pages-sub/team/index.vue b/src/pages-sub/team/index.vue new file mode 100644 index 0000000..fba3c14 --- /dev/null +++ b/src/pages-sub/team/index.vue @@ -0,0 +1,116 @@ + +{ + style: { + navigationBarTitleText: '我的邀请', + navigationBarBackgroundColor: '#fff', + navigationStyle: 'custom', + }, +} + + + + + + + diff --git a/src/pages-sub/withdrawal-detail/index.vue b/src/pages-sub/withdrawal-detail/index.vue new file mode 100644 index 0000000..0df700f --- /dev/null +++ b/src/pages-sub/withdrawal-detail/index.vue @@ -0,0 +1,29 @@ + +{ + style: { + navigationBarTitleText: '提现记录', + navigationBarBackgroundColor: '#fff', + }, +} + + diff --git a/src/pages-sub/withdrawal-type/edit.vue b/src/pages-sub/withdrawal-type/edit.vue new file mode 100644 index 0000000..4ec06a0 --- /dev/null +++ b/src/pages-sub/withdrawal-type/edit.vue @@ -0,0 +1,105 @@ + +{ + style: { + navigationBarTitleText: '编辑收款方式', + navigationBarBackgroundColor: '#fff', + }, +} + + + + + + diff --git a/src/pages-sub/withdrawal-type/index.vue b/src/pages-sub/withdrawal-type/index.vue new file mode 100644 index 0000000..a3c0c36 --- /dev/null +++ b/src/pages-sub/withdrawal-type/index.vue @@ -0,0 +1,59 @@ + +{ + style: { + navigationBarTitleText: '收款方式', + navigationBarBackgroundColor: '#fff', + }, +} + + + + + diff --git a/src/pages-sub/withdrawal/index.vue b/src/pages-sub/withdrawal/index.vue new file mode 100644 index 0000000..feb9f28 --- /dev/null +++ b/src/pages-sub/withdrawal/index.vue @@ -0,0 +1,91 @@ + +{ + style: { + navigationStyle: 'custom', + navigationBarTitleText: '提现', + }, +} + + + + + + diff --git a/src/pages.json b/src/pages.json index 1a0f611..1fabe67 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1,7 +1,7 @@ { "globalStyle": { "navigationStyle": "default", - "navigationBarTitleText": "unibest", + "navigationBarTitleText": "", "navigationBarBackgroundColor": "#f8f8f8", "navigationBarTextStyle": "black", "backgroundColor": "#FFFFFF" @@ -15,25 +15,37 @@ }, "tabBar": { "color": "#999999", - "selectedColor": "#018d71", - "backgroundColor": "#F8F8F8", - "borderStyle": "black", - "height": "50px", + "selectedColor": "#0E57A2", + "backgroundColor": "#ffffff", + "borderStyle": "#E7E7E7", + "height": "56px", "fontSize": "10px", - "iconWidth": "24px", + "iconWidth": "20px", "spacing": "3px", "list": [ { "iconPath": "static/tabbar/home.png", "selectedIconPath": "static/tabbar/homeHL.png", "pagePath": "pages/index/index", - "text": "%tabbar.home%" + "text": "首页" }, { - "iconPath": "static/tabbar/example.png", - "selectedIconPath": "static/tabbar/exampleHL.png", - "pagePath": "pages/about/about", - "text": "%tabbar.about%" + "iconPath": "static/tabbar/invest.png", + "selectedIconPath": "static/tabbar/investHL.png", + "pagePath": "pages/invest/index", + "text": "投资" + }, + { + "iconPath": "static/tabbar/house.png", + "selectedIconPath": "static/tabbar/houseHL.png", + "pagePath": "pages/invite/index", + "text": "房屋" + }, + { + "iconPath": "static/tabbar/personal.png", + "selectedIconPath": "static/tabbar/personalHL.png", + "pagePath": "pages/my/index", + "text": "我的" } ] }, @@ -47,30 +59,192 @@ } }, { - "path": "pages/about/about", + "path": "pages/edit-password/index", "type": "page", "style": { - "navigationBarTitleText": "关于" + "navigationBarTitleText": "忘记密码", + "navigationStyle": "custom" + }, + "notNeedLogin": false + }, + { + "path": "pages/invest/index", + "type": "page", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "投资理财" } }, { - "path": "pages/about/i18n", + "path": "pages/invite/index", "type": "page", "style": { - "navigationBarTitleText": "%app.name%" + "navigationBarTitleText": "邀请好友", + "navigationBarBackgroundColor": "#fff", + "navigationStyle": "custom" } + }, + { + "path": "pages/login/index", + "type": "page", + "style": { + "navigationBarTitleText": "登录", + "navigationStyle": "custom" + }, + "notNeedLogin": false + }, + { + "path": "pages/my/index", + "type": "page", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "个人中心" + } + }, + { + "path": "pages/register/index", + "type": "page", + "style": { + "navigationBarTitleText": "注册", + "navigationStyle": "custom" + }, + "notNeedLogin": false } ], "subPackages": [ { "root": "pages-sub", "pages": [ + { + "path": "asset/index", + "type": "page", + "style": { + "navigationBarTitleText": "我的资产", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "convert/index", + "type": "page", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "转换" + } + }, { "path": "demo/index", "type": "page", "style": { "navigationBarTitleText": "分包页面 标题" } + }, + { + "path": "introduction/index", + "type": "page", + "style": { + "navigationBarTitleText": "公司简介", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "invest-detail/index", + "type": "page", + "style": { + "navigationBarTitleText": "投资记录", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "invest-immediately/index", + "type": "page", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "立即投资" + } + }, + { + "path": "invest-result/index", + "type": "page", + "style": { + "navigationBarTitleText": "投资成功", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "invite/index", + "type": "page", + "style": { + "navigationBarTitleText": "邀请好友", + "navigationBarBackgroundColor": "#fff", + "navigationStyle": "custom" + } + }, + { + "path": "lottery/index", + "type": "page", + "style": { + "navigationBarTitleText": "幸运大转盘", + "navigationBarBackgroundColor": "#fff", + "navigationStyle": "custom" + } + }, + { + "path": "official-community/index", + "type": "page", + "style": { + "navigationBarTitleText": "官方社群", + "navigationBarBackgroundColor": "#fff", + "navigationStyle": "custom" + } + }, + { + "path": "realname/index", + "type": "page", + "style": { + "navigationBarTitleText": "实名认证", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "team/index", + "type": "page", + "style": { + "navigationBarTitleText": "我的邀请", + "navigationBarBackgroundColor": "#fff", + "navigationStyle": "custom" + } + }, + { + "path": "withdrawal/index", + "type": "page", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "提现" + } + }, + { + "path": "withdrawal-detail/index", + "type": "page", + "style": { + "navigationBarTitleText": "提现记录", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "withdrawal-type/edit", + "type": "page", + "style": { + "navigationBarTitleText": "编辑收款方式", + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path": "withdrawal-type/index", + "type": "page", + "style": { + "navigationBarTitleText": "收款方式", + "navigationBarBackgroundColor": "#fff" + } } ] } diff --git a/src/pages/about/about.vue b/src/pages/about/about.vue deleted file mode 100644 index 792944f..0000000 --- a/src/pages/about/about.vue +++ /dev/null @@ -1,45 +0,0 @@ - -{ - style: { - navigationBarTitleText: '关于', - }, -} - - - - - - - diff --git a/src/pages/about/i18n.vue b/src/pages/about/i18n.vue deleted file mode 100644 index 69f3044..0000000 --- a/src/pages/about/i18n.vue +++ /dev/null @@ -1,97 +0,0 @@ - -{ - "style": { - "navigationBarTitleText": "%app.name%" - } -} - - - - - - - diff --git a/src/pages/edit-password/index.vue b/src/pages/edit-password/index.vue new file mode 100644 index 0000000..fc155b0 --- /dev/null +++ b/src/pages/edit-password/index.vue @@ -0,0 +1,124 @@ + +{ + style: { + navigationBarTitleText: '忘记密码', + navigationStyle: 'custom', + }, + notNeedLogin: false, +} + + + + + + diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index a0459f4..433729a 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -8,50 +8,86 @@ } diff --git a/src/pages/invest/index.vue b/src/pages/invest/index.vue new file mode 100644 index 0000000..fe605c6 --- /dev/null +++ b/src/pages/invest/index.vue @@ -0,0 +1,134 @@ + + +{ + style: { + navigationStyle: 'custom', + navigationBarTitleText: '投资理财', + }, +} + + + + + + diff --git a/src/pages/invite/index.vue b/src/pages/invite/index.vue new file mode 100644 index 0000000..6a79c58 --- /dev/null +++ b/src/pages/invite/index.vue @@ -0,0 +1,74 @@ + +{ + style: { + navigationBarTitleText: '邀请好友', + navigationBarBackgroundColor: '#fff', + navigationStyle: 'custom', + }, +} + + + + + + + diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue new file mode 100644 index 0000000..7797e89 --- /dev/null +++ b/src/pages/login/index.vue @@ -0,0 +1,118 @@ + +{ + style: { + navigationBarTitleText: '登录', + navigationStyle: 'custom', + }, + notNeedLogin: false, +} + + + + + + diff --git a/src/pages/about/components/request.vue b/src/pages/my/components/request.vue similarity index 100% rename from src/pages/about/components/request.vue rename to src/pages/my/components/request.vue diff --git a/src/pages/about/components/upload.vue b/src/pages/my/components/upload.vue similarity index 100% rename from src/pages/about/components/upload.vue rename to src/pages/my/components/upload.vue diff --git a/src/pages/my/index.vue b/src/pages/my/index.vue new file mode 100644 index 0000000..227987f --- /dev/null +++ b/src/pages/my/index.vue @@ -0,0 +1,166 @@ + +{ + style: { + navigationStyle: 'custom', + navigationBarTitleText: '个人中心', + }, +} + + + + + + + diff --git a/src/pages/register/index.vue b/src/pages/register/index.vue new file mode 100644 index 0000000..0530172 --- /dev/null +++ b/src/pages/register/index.vue @@ -0,0 +1,133 @@ + +{ + style: { + navigationBarTitleText: '注册', + navigationStyle: 'custom', + }, + notNeedLogin: false, +} + + + + + + diff --git a/src/static/images/bg.png b/src/static/images/bg.png new file mode 100644 index 0000000..1ba2dd6 Binary files /dev/null and b/src/static/images/bg.png differ diff --git a/src/static/images/default-avatar.png b/src/static/images/default-avatar.png new file mode 100644 index 0000000..383aaa0 Binary files /dev/null and b/src/static/images/default-avatar.png differ diff --git a/src/static/images/home/main-bg.png b/src/static/images/home/main-bg.png new file mode 100644 index 0000000..e806714 Binary files /dev/null and b/src/static/images/home/main-bg.png differ diff --git a/src/static/images/home/nav-1.png b/src/static/images/home/nav-1.png new file mode 100644 index 0000000..688c875 Binary files /dev/null and b/src/static/images/home/nav-1.png differ diff --git a/src/static/images/home/nav-2.png b/src/static/images/home/nav-2.png new file mode 100644 index 0000000..25cb559 Binary files /dev/null and b/src/static/images/home/nav-2.png differ diff --git a/src/static/images/home/nav-3.png b/src/static/images/home/nav-3.png new file mode 100644 index 0000000..52fa868 Binary files /dev/null and b/src/static/images/home/nav-3.png differ diff --git a/src/static/images/home/nav-4.png b/src/static/images/home/nav-4.png new file mode 100644 index 0000000..b300b8e Binary files /dev/null and b/src/static/images/home/nav-4.png differ diff --git a/src/static/images/home/news-1.png b/src/static/images/home/news-1.png new file mode 100644 index 0000000..e391f95 Binary files /dev/null and b/src/static/images/home/news-1.png differ diff --git a/src/static/images/home/news-2.png b/src/static/images/home/news-2.png new file mode 100644 index 0000000..e05f4a2 Binary files /dev/null and b/src/static/images/home/news-2.png differ diff --git a/src/static/images/house/1.png b/src/static/images/house/1.png new file mode 100644 index 0000000..7df03e7 Binary files /dev/null and b/src/static/images/house/1.png differ diff --git a/src/static/images/invest/alipay-icon.png b/src/static/images/invest/alipay-icon.png new file mode 100644 index 0000000..637291b Binary files /dev/null and b/src/static/images/invest/alipay-icon.png differ diff --git a/src/static/images/invest/bg.png b/src/static/images/invest/bg.png new file mode 100644 index 0000000..0235c51 Binary files /dev/null and b/src/static/images/invest/bg.png differ diff --git a/src/static/images/invest/item-bg.png b/src/static/images/invest/item-bg.png new file mode 100644 index 0000000..9db5b01 Binary files /dev/null and b/src/static/images/invest/item-bg.png differ diff --git a/src/static/images/invest/main-bg.png b/src/static/images/invest/main-bg.png new file mode 100644 index 0000000..81945b2 Binary files /dev/null and b/src/static/images/invest/main-bg.png differ diff --git a/src/static/images/invest/unionpay-icon.png b/src/static/images/invest/unionpay-icon.png new file mode 100644 index 0000000..00d6891 Binary files /dev/null and b/src/static/images/invest/unionpay-icon.png differ diff --git a/src/static/images/invest/wechat-icon.png b/src/static/images/invest/wechat-icon.png new file mode 100644 index 0000000..6b926ec Binary files /dev/null and b/src/static/images/invest/wechat-icon.png differ diff --git a/src/static/images/login-bg.png b/src/static/images/login-bg.png new file mode 100644 index 0000000..54c6d4d Binary files /dev/null and b/src/static/images/login-bg.png differ diff --git a/src/static/images/login/invite.png b/src/static/images/login/invite.png new file mode 100644 index 0000000..00fc5dc Binary files /dev/null and b/src/static/images/login/invite.png differ diff --git a/src/static/images/login/message.png b/src/static/images/login/message.png new file mode 100644 index 0000000..1ffae6f Binary files /dev/null and b/src/static/images/login/message.png differ diff --git a/src/static/images/login/password.png b/src/static/images/login/password.png new file mode 100644 index 0000000..9503e6f Binary files /dev/null and b/src/static/images/login/password.png differ diff --git a/src/static/images/login/phone.png b/src/static/images/login/phone.png new file mode 100644 index 0000000..e8db725 Binary files /dev/null and b/src/static/images/login/phone.png differ diff --git a/src/static/images/my/card.png b/src/static/images/my/card.png new file mode 100644 index 0000000..55ae25b Binary files /dev/null and b/src/static/images/my/card.png differ diff --git a/src/static/images/my/house.png b/src/static/images/my/house.png new file mode 100644 index 0000000..805a283 Binary files /dev/null and b/src/static/images/my/house.png differ diff --git a/src/static/images/my/realname.png b/src/static/images/my/realname.png new file mode 100644 index 0000000..805a283 Binary files /dev/null and b/src/static/images/my/realname.png differ diff --git a/src/static/images/my/recommend.png b/src/static/images/my/recommend.png new file mode 100644 index 0000000..f9f29e1 Binary files /dev/null and b/src/static/images/my/recommend.png differ diff --git a/src/static/images/my/team.png b/src/static/images/my/team.png new file mode 100644 index 0000000..750b756 Binary files /dev/null and b/src/static/images/my/team.png differ diff --git a/src/static/images/my/top-up.png b/src/static/images/my/top-up.png new file mode 100644 index 0000000..8a4b85d Binary files /dev/null and b/src/static/images/my/top-up.png differ diff --git a/src/static/images/my/translate.png b/src/static/images/my/translate.png new file mode 100644 index 0000000..774346b Binary files /dev/null and b/src/static/images/my/translate.png differ diff --git a/src/static/images/my/withdrawal.png b/src/static/images/my/withdrawal.png new file mode 100644 index 0000000..ee3a3c0 Binary files /dev/null and b/src/static/images/my/withdrawal.png differ diff --git a/src/static/images/page-sub/introduction.png b/src/static/images/page-sub/introduction.png new file mode 100644 index 0000000..42ba365 Binary files /dev/null and b/src/static/images/page-sub/introduction.png differ diff --git a/src/static/images/page-sub/invest-success.png b/src/static/images/page-sub/invest-success.png new file mode 100644 index 0000000..b3b9bff Binary files /dev/null and b/src/static/images/page-sub/invest-success.png differ diff --git a/src/static/images/page-sub/invite-bg.png b/src/static/images/page-sub/invite-bg.png new file mode 100644 index 0000000..09ec310 Binary files /dev/null and b/src/static/images/page-sub/invite-bg.png differ diff --git a/src/static/images/page-sub/invite-icon.png b/src/static/images/page-sub/invite-icon.png new file mode 100644 index 0000000..76a289b Binary files /dev/null and b/src/static/images/page-sub/invite-icon.png differ diff --git a/src/static/images/page-sub/money-icon.png b/src/static/images/page-sub/money-icon.png new file mode 100644 index 0000000..d632df3 Binary files /dev/null and b/src/static/images/page-sub/money-icon.png differ diff --git a/src/static/images/page-sub/realname/realname-checking.png b/src/static/images/page-sub/realname/realname-checking.png new file mode 100644 index 0000000..d547a3a Binary files /dev/null and b/src/static/images/page-sub/realname/realname-checking.png differ diff --git a/src/static/images/page-sub/realname/realname-fail.png b/src/static/images/page-sub/realname/realname-fail.png new file mode 100644 index 0000000..85f81a8 Binary files /dev/null and b/src/static/images/page-sub/realname/realname-fail.png differ diff --git a/src/static/images/page-sub/realname/realname-name.png b/src/static/images/page-sub/realname/realname-name.png new file mode 100644 index 0000000..224d162 Binary files /dev/null and b/src/static/images/page-sub/realname/realname-name.png differ diff --git a/src/static/images/page-sub/realname/realname-number.png b/src/static/images/page-sub/realname/realname-number.png new file mode 100644 index 0000000..dcef82f Binary files /dev/null and b/src/static/images/page-sub/realname/realname-number.png differ diff --git a/src/static/images/page-sub/realname/realname-success.png b/src/static/images/page-sub/realname/realname-success.png new file mode 100644 index 0000000..899ca1f Binary files /dev/null and b/src/static/images/page-sub/realname/realname-success.png differ diff --git a/src/static/images/page-sub/realname/realname-type.png b/src/static/images/page-sub/realname/realname-type.png new file mode 100644 index 0000000..86661dc Binary files /dev/null and b/src/static/images/page-sub/realname/realname-type.png differ diff --git a/src/static/images/page-sub/recharge.png b/src/static/images/page-sub/recharge.png new file mode 100644 index 0000000..cf1d561 Binary files /dev/null and b/src/static/images/page-sub/recharge.png differ diff --git a/src/static/images/page-sub/team/level-1.png b/src/static/images/page-sub/team/level-1.png new file mode 100644 index 0000000..bcc991a Binary files /dev/null and b/src/static/images/page-sub/team/level-1.png differ diff --git a/src/static/images/page-sub/team/level-2.png b/src/static/images/page-sub/team/level-2.png new file mode 100644 index 0000000..be200e7 Binary files /dev/null and b/src/static/images/page-sub/team/level-2.png differ diff --git a/src/static/images/page-sub/team/level-3.png b/src/static/images/page-sub/team/level-3.png new file mode 100644 index 0000000..d83d205 Binary files /dev/null and b/src/static/images/page-sub/team/level-3.png differ diff --git a/src/static/images/page-sub/team/main-bg.png b/src/static/images/page-sub/team/main-bg.png new file mode 100644 index 0000000..0604a0f Binary files /dev/null and b/src/static/images/page-sub/team/main-bg.png differ diff --git a/src/static/images/page-sub/team/team-main-hero.png b/src/static/images/page-sub/team/team-main-hero.png new file mode 100644 index 0000000..a82cf5a Binary files /dev/null and b/src/static/images/page-sub/team/team-main-hero.png differ diff --git a/src/static/images/page-sub/team/team-title.png b/src/static/images/page-sub/team/team-title.png new file mode 100644 index 0000000..fac1ec9 Binary files /dev/null and b/src/static/images/page-sub/team/team-title.png differ diff --git a/src/static/tabbar/example.png b/src/static/tabbar/example.png deleted file mode 100644 index fd1e942..0000000 Binary files a/src/static/tabbar/example.png and /dev/null differ diff --git a/src/static/tabbar/exampleHL.png b/src/static/tabbar/exampleHL.png deleted file mode 100644 index 7501011..0000000 Binary files a/src/static/tabbar/exampleHL.png and /dev/null differ diff --git a/src/static/tabbar/home.png b/src/static/tabbar/home.png index 8f82e21..d3e4980 100644 Binary files a/src/static/tabbar/home.png and b/src/static/tabbar/home.png differ diff --git a/src/static/tabbar/homeHL.png b/src/static/tabbar/homeHL.png index 26d3761..0256212 100644 Binary files a/src/static/tabbar/homeHL.png and b/src/static/tabbar/homeHL.png differ diff --git a/src/static/tabbar/house.png b/src/static/tabbar/house.png new file mode 100644 index 0000000..36a8885 Binary files /dev/null and b/src/static/tabbar/house.png differ diff --git a/src/static/tabbar/houseHL.png b/src/static/tabbar/houseHL.png new file mode 100644 index 0000000..7d0640f Binary files /dev/null and b/src/static/tabbar/houseHL.png differ diff --git a/src/static/tabbar/invest.png b/src/static/tabbar/invest.png new file mode 100644 index 0000000..b7f2243 Binary files /dev/null and b/src/static/tabbar/invest.png differ diff --git a/src/static/tabbar/investHL.png b/src/static/tabbar/investHL.png new file mode 100644 index 0000000..300e329 Binary files /dev/null and b/src/static/tabbar/investHL.png differ diff --git a/src/static/tabbar/personal.png b/src/static/tabbar/personal.png index 0a569a2..7f8f64a 100644 Binary files a/src/static/tabbar/personal.png and b/src/static/tabbar/personal.png differ diff --git a/src/static/tabbar/personalHL.png b/src/static/tabbar/personalHL.png index 8c3e66e..7c54a93 100644 Binary files a/src/static/tabbar/personalHL.png and b/src/static/tabbar/personalHL.png differ diff --git a/src/store/user.ts b/src/store/user.ts index 82bd873..5927fb1 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -15,18 +15,14 @@ export const useUserStore = defineStore( const clearUserInfo = () => { userInfo.value = { ...initState } } - // 一般没有reset需求,不需要的可以删除 - const reset = () => { - userInfo.value = { ...initState } - } - const isLogined = computed(() => !!userInfo.value.token) + + const isLogged = computed(() => !!userInfo.value.token) return { userInfo, setUserInfo, clearUserInfo, - isLogined, - reset, + isLogged, } }, { diff --git a/src/types/uni-pages.d.ts b/src/types/uni-pages.d.ts index ee63ee4..061c59b 100644 --- a/src/types/uni-pages.d.ts +++ b/src/types/uni-pages.d.ts @@ -5,14 +5,33 @@ interface NavigateToOptions { url: "/pages/index/index" | - "/pages/about/about" | - "/pages/about/i18n" | - "/pages-sub/demo/index"; + "/pages/edit-password/index" | + "/pages/invest/index" | + "/pages/invite/index" | + "/pages/login/index" | + "/pages/my/index" | + "/pages/register/index" | + "/pages-sub/asset/index" | + "/pages-sub/convert/index" | + "/pages-sub/demo/index" | + "/pages-sub/introduction/index" | + "/pages-sub/invest-detail/index" | + "/pages-sub/invest-immediately/index" | + "/pages-sub/invest-result/index" | + "/pages-sub/invite/index" | + "/pages-sub/lottery/index" | + "/pages-sub/official-community/index" | + "/pages-sub/realname/index" | + "/pages-sub/team/index" | + "/pages-sub/withdrawal/index" | + "/pages-sub/withdrawal-detail/index" | + "/pages-sub/withdrawal-type/edit" | + "/pages-sub/withdrawal-type/index"; } interface RedirectToOptions extends NavigateToOptions {} interface SwitchTabOptions { - url: "/pages/index/index" | "/pages/about/about" + url: "/pages/index/index" | "/pages/invest/index" | "/pages/invite/index" | "/pages/my/index" } type ReLaunchOptions = NavigateToOptions | SwitchTabOptions; diff --git a/src/utils/index.ts b/src/utils/index.ts index 57f0042..90f9593 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -9,8 +9,15 @@ export const getLastPage = () => { return pages[pages.length - 1] } +export const getPath = (url: string) => { + if (typeof url === 'string') { + return url.split('?')[0].replace(/^pages/, '/pages') + } + throw new Error('please input string type') +} + /** 判断当前页面是否是tabbar页 */ -export const getIsTabbar = () => { +export const getIsTabbar = (url?: string) => { if (!tabBar) { return false } @@ -18,29 +25,14 @@ export const getIsTabbar = () => { // 通常有tabBar的话,list不能有空,且至少有2个元素,这里其实不用处理 return false } - const lastPage = getLastPage() - const currPath = lastPage.route - return !!tabBar.list.find((e) => e.pagePath === currPath) -} - -/** - * 获取当前页面路由的 path 路径和 redirectPath 路径 - * path 如 ‘/pages/login/index’ - * redirectPath 如 ‘/pages/demo/base/route-interceptor’ - */ -export const currRoute = () => { - const lastPage = getLastPage() - const currRoute = (lastPage as any).$page - // console.log('lastPage.$page:', currRoute) - // console.log('lastPage.$page.fullpath:', currRoute.fullPath) - // console.log('lastPage.$page.options:', currRoute.options) - // console.log('lastPage.options:', (lastPage as any).options) - // 经过多端测试,只有 fullPath 靠谱,其他都不靠谱 - const { fullPath } = currRoute as { fullPath: string } - // console.log(fullPath) - // eg: /pages/login/index?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor (小程序) - // eg: /pages/login/index?redirect=%2Fpages%2Froute-interceptor%2Findex%3Fname%3Dfeige%26age%3D30(h5) - return getUrlObj(fullPath) + if (url) { + console.log(tabBar.list, getPath(url)) + return !!tabBar.list.some((e) => getPath(e.pagePath) === getPath(url)) + } else { + const lastPage = getLastPage() + const currPath = lastPage.route + return !!tabBar.list.some((e) => e.pagePath === currPath) + } } const ensureDecodeURIComponent = (url: string) => { @@ -74,14 +66,17 @@ export const getUrlObj = (url: string) => { } /** * 得到所有的需要登录的pages,包括主包和分包的 - * 这里设计得通用一点,可以传递key作为判断依据,默认是 needLogin, 与 route-block 配对使用 + * 这里设计得通用一点,可以传递key作为判断依据,默认是 notNeedLogin, 与 route-block 配对使用 * 如果没有传 key,则表示所有的pages,如果传递了 key, 则表示通过 key 过滤 */ -export const getAllPages = (key = 'needLogin') => { +export const getAllPages = (key = 'notNeedLogin') => { // 这里处理主包 const mainPages = [ ...pages - .filter((page) => !key || page[key]) + .filter((page) => { + if (!key) return false + return page[key] === false + }) .map((page) => ({ ...page, path: `/${page.path}`, @@ -111,39 +106,21 @@ export const getAllPages = (key = 'needLogin') => { * 得到所有的需要登录的pages,包括主包和分包的 * 只得到 path 数组 */ -export const getNeedLoginPages = (): string[] => getAllPages('needLogin').map((page) => page.path) +export const getNotNeedLoginPages = (): string[] => + getAllPages('notNeedLogin').map((page) => page.path) /** * 得到所有的需要登录的pages,包括主包和分包的 * 只得到 path 数组 */ -export const needLoginPages: string[] = getAllPages('needLogin').map((page) => page.path) +export const notNeedLoginPages: string[] = getAllPages('notNeedLogin').map((page) => page.path) /** * 根据微信小程序当前环境,判断应该获取的BaseUrl */ export const getEnvBaseUrl = () => { // 请求基准地址 - 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 - } - } + const baseUrl = import.meta.env.VITE_SERVER_BASEURL return baseUrl } diff --git a/uno.config.ts b/uno.config.ts index d126b9b..ca89fc3 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -78,6 +78,15 @@ export default defineConfig({ ], ['pt-safe', { 'padding-top': 'env(safe-area-inset-top)' }], ['pb-safe', { 'padding-bottom': 'env(safe-area-inset-bottom)' }], + ['btn-gradient', { background: 'linear-gradient(90deg,#95C3FF,#4D72F6)' }], + [ + 'text-gradient', + { + 'background-image': 'linear-gradient(90deg,#95C3FF,#4D72F6 30%)', + 'background-clip': 'text', + color: 'transparent', + }, + ], ], })