diff --git a/.vscode/settings.json b/.vscode/settings.json index 4fbb64b..020efc6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -71,6 +71,7 @@ "cSpell.words": [ "alova", "Aplipay", + "chooseavatar", "climblee", "commitlint", "dcloudio", diff --git a/src/http/alova.ts b/src/http/alova.ts index 005b54b..06b7f2f 100644 --- a/src/http/alova.ts +++ b/src/http/alova.ts @@ -30,7 +30,7 @@ const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthenticati } catch (error) { // 切换到登录页 - await uni.reLaunch({ url: '/pages/common/login/index' }) + await uni.reLaunch({ url: '/pages/login/login' }) throw error } }, diff --git a/src/pages.json b/src/pages.json index c2254af..89267e8 100644 --- a/src/pages.json +++ b/src/pages.json @@ -36,6 +36,12 @@ "selectedIconPath": "static/tabbar/exampleHL.png", "pagePath": "pages/about/about", "text": "关于" + }, + { + "iconPath": "static/tabbar/personal.png", + "selectedIconPath": "static/tabbar/personalHL.png", + "pagePath": "pages/me/me", + "text": "个人" } ] }, @@ -88,6 +94,13 @@ "style": { "navigationBarTitleText": "注册" } + }, + { + "path": "pages/me/me", + "type": "page", + "style": { + "navigationBarTitleText": "我的" + } } ], "subPackages": [ diff --git a/src/pages/me/me.vue b/src/pages/me/me.vue new file mode 100644 index 0000000..67fce5c --- /dev/null +++ b/src/pages/me/me.vue @@ -0,0 +1,219 @@ + +{ + style: { + navigationBarTitleText: '我的', + }, +} + + + + + + + diff --git a/src/tabbar/config.ts b/src/tabbar/config.ts index 8a28010..9fde129 100644 --- a/src/tabbar/config.ts +++ b/src/tabbar/config.ts @@ -38,6 +38,12 @@ export const nativeTabbarList: NativeTabBarItem[] = [ pagePath: 'pages/about/about', text: '关于', }, + { + iconPath: 'static/tabbar/personal.png', + selectedIconPath: 'static/tabbar/personalHL.png', + pagePath: 'pages/me/me', + text: '个人', + }, ] export interface CustomTabBarItem { @@ -71,17 +77,18 @@ export const customTabbarList: CustomTabBarItem[] = [ icon: 'i-carbon-code', // badge: 10, }, - - // { - // pagePath: 'pages/mine/index', - // text: '我的', - // // 注意 iconfont 图标需要额外加上 'iconfont',如下 - // iconType: 'iconfont', - // icon: 'iconfont icon-my', - // }, + { + pagePath: 'pages/me/me', + text: '我的', + iconType: 'uniUi', + icon: 'contact', + }, // { // pagePath: 'pages/index/index', // text: '首页', + // 注意 iconfont 图标需要额外加上 'iconfont',如下 + // iconType: 'iconfont', + // icon: 'iconfont icon-my', // // 使用 ‘image’时,需要配置 icon + iconActive 2张图片(不推荐) // // 既然已经用了自定义tabbar了,就不建议用图片了,所以不推荐 // iconType: 'image', diff --git a/src/utils/index.ts b/src/utils/index.ts index e0d28c5..9ef3987 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -12,7 +12,7 @@ export function getLastPage() { /** * 获取当前页面路由的 path 路径和 redirectPath 路径 - * path 如 '/pages/login/index' + * path 如 '/pages/login/login' * redirectPath 如 '/pages/demo/base/route-interceptor' */ export function currRoute() { @@ -25,8 +25,8 @@ export function currRoute() { // 经过多端测试,只有 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) + // eg: /pages/login/login?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor (小程序) + // eg: /pages/login/login?redirect=%2Fpages%2Froute-interceptor%2Findex%3Fname%3Dfeige%26age%3D30(h5) return getUrlObj(fullPath) } @@ -38,8 +38,8 @@ export function ensureDecodeURIComponent(url: string) { } /** * 解析 url 得到 path 和 query - * 比如输入url: /pages/login/index?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor - * 输出: {path: /pages/login/index, query: {redirect: /pages/demo/base/route-interceptor}} + * 比如输入url: /pages/login/login?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor + * 输出: {path: /pages/login/login, query: {redirect: /pages/demo/base/route-interceptor}} */ export function getUrlObj(url: string) { const [path, queryStr] = url.split('?') diff --git a/tsconfig.json b/tsconfig.json index c95ea2f..0a76bae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,6 +29,7 @@ "plugins": ["@uni-helper/uni-types/volar-plugin"] }, "include": [ + "package.json", "src/**/*.ts", "src/**/*.js", "src/**/*.d.ts",