From 7ba6f95b53f45f07b2850e2803c8a800f1d4661f Mon Sep 17 00:00:00 2001
From: Burt <1020103647@qq.com>
Date: Fri, 19 Jan 2024 17:28:04 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20app=20=E6=89=93=E5=8C=85=E5=A4=B1?=
=?UTF-8?q?=E8=B4=A5BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.hbuilderx/launch.json | 16 +++++
manifest.config.ts | 6 +-
src/manifest.json | 5 +-
src/pages.json | 155 +++++++++++++++++++++++++++++++++++++++++
src/typings.d.ts | 1 +
src/utils/http.ts | 6 +-
uni-pages.d.ts | 23 +++++-
7 files changed, 203 insertions(+), 9 deletions(-)
create mode 100644 .hbuilderx/launch.json
diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
new file mode 100644
index 0000000..5f90ebe
--- /dev/null
+++ b/.hbuilderx/launch.json
@@ -0,0 +1,16 @@
+{
+ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+ // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+ "version": "0.0",
+ "configurations": [
+ {
+ "app-plus": {
+ "launchtype": "local"
+ },
+ "default": {
+ "launchtype": "local"
+ },
+ "type": "uniCloud"
+ }
+ ]
+}
diff --git a/manifest.config.ts b/manifest.config.ts
index df54acd..3ace335 100644
--- a/manifest.config.ts
+++ b/manifest.config.ts
@@ -32,9 +32,9 @@ export default defineManifestConfig({
distribute: {
/* android打包配置 */
android: {
- // minSdkVersion: 30,
- // targetSdkVersion: 30,
- // abiFilters: ['armeabi-v7a', 'arm64-v8a'],
+ minSdkVersion: 30,
+ targetSdkVersion: 30,
+ abiFilters: ['armeabi-v7a', 'arm64-v8a'],
permissions: [
'',
'',
diff --git a/src/manifest.json b/src/manifest.json
index 75a22d2..63853bc 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -34,7 +34,10 @@
"",
"",
""
- ]
+ ],
+ "minSdkVersion": 30,
+ "targetSdkVersion": 30,
+ "abiFilters": ["armeabi-v7a", "arm64-v8a"]
},
"ios": {},
"sdkConfigs": {},
diff --git a/src/pages.json b/src/pages.json
index 43b3ecc..66a7baf 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -29,6 +29,12 @@
"pagePath": "pages/index/index",
"text": "首页"
},
+ {
+ "iconPath": "static/tabbar/example.png",
+ "selectedIconPath": "static/tabbar/exampleHL.png",
+ "pagePath": "pages/demo/index",
+ "text": "示例"
+ },
{
"iconPath": "static/tabbar/personal.png",
"selectedIconPath": "static/tabbar/personalHL.png",
@@ -45,6 +51,10 @@
"navigationBarTitleText": "首页"
}
},
+ {
+ "path": "pages/demo/index",
+ "type": "page"
+ },
{
"path": "pages/login/index",
"type": "page",
@@ -58,6 +68,151 @@
"style": {
"navigationBarTitleText": "我的"
}
+ },
+ {
+ "path": "pages/demo/demo/clock",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "动态时钟"
+ }
+ },
+ {
+ "path": "pages/demo/demo/component-auto-import",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "easycom 自动导入"
+ }
+ },
+ {
+ "path": "pages/demo/demo/lottery",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "九宫格抽奖"
+ }
+ },
+ {
+ "path": "pages/demo/demo/lottery2",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "大转盘抽奖"
+ }
+ },
+ {
+ "path": "pages/demo/demo/mp-weixin-share",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "微信分享"
+ }
+ },
+ {
+ "path": "pages/demo/demo/navbar",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "自定义导航栏",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/demo/demo/pages-auto-import",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "pages 自动导入"
+ }
+ },
+ {
+ "path": "pages/demo/demo/pinia",
+ "type": "page",
+ "layout": "display",
+ "style": {
+ "navigationBarTitleText": "pinia+持久化"
+ }
+ },
+ {
+ "path": "pages/demo/demo/request",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "request请求+请求拦截"
+ }
+ },
+ {
+ "path": "pages/demo/demo/throughout",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏",
+ "enablePullDownRefresh": false,
+ "backgroundColor": "#23c09c",
+ "app-plus": {
+ "titleNView": {
+ "type": "transparent"
+ }
+ },
+ "mp-weixin": {
+ "navigationStyle": "custom"
+ }
+ }
+ },
+ {
+ "path": "pages/demo/demo/uni-ui-icons",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "UniUI Icons 使用"
+ }
+ },
+ {
+ "path": "pages/demo/demo/uni-ui",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "UniUI 使用"
+ }
+ },
+ {
+ "path": "pages/demo/demo/unocss-icons",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "UnoCss Icons 使用"
+ }
+ },
+ {
+ "path": "pages/demo/demo/unocss",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "UnoCss 使用"
+ }
+ },
+ {
+ "path": "pages/demo/demo/img-min/index",
+ "type": "page"
+ },
+ {
+ "path": "pages/demo/demo/lottery/big-wheel",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "大转盘抽奖"
+ }
+ },
+ {
+ "path": "pages/demo/demo/lottery/nine-grid",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "九宫格抽奖"
+ }
+ },
+ {
+ "path": "pages/demo/demo/throughout/index",
+ "type": "page",
+ "style": {
+ "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏",
+ "enablePullDownRefresh": true,
+ "backgroundColor": "#23c09c",
+ "app-plus": {
+ "titleNView": {
+ "type": "transparent"
+ }
+ },
+ "mp-weixin": {
+ "navigationStyle": "custom"
+ }
+ }
}
],
"subPackages": []
diff --git a/src/typings.d.ts b/src/typings.d.ts
index 5b00d1f..28c9bf8 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -1,6 +1,7 @@
export type UserInfo = {
nickname: string
avatar: string
+ token?: string
}
export type UserItem = {
username: string
diff --git a/src/utils/http.ts b/src/utils/http.ts
index 3f766f7..2501a26 100644
--- a/src/utils/http.ts
+++ b/src/utils/http.ts
@@ -2,7 +2,6 @@
import { useUserStore } from '@/store'
import { UserInfo } from '@/typings'
-const userStore = useUserStore()
type Data = {
code: number
msg: string
@@ -29,6 +28,7 @@ const httpInterceptor = {
...options.header,
}
// 4. 添加 token 请求头标识
+ const userStore = useUserStore()
const { token } = userStore.userInfo as unknown as UserInfo
if (token) {
options.header.Authorization = `Bearer ${token}`
@@ -54,8 +54,8 @@ export const http = (options: UniApp.RequestOptions) => {
resolve(res.data as Data)
} else if (res.statusCode === 401) {
// 401错误 -> 清理用户信息,跳转到登录页
- userStore.clearUserInfo()
- uni.navigateTo({ url: '/pages/login/login' })
+ // userStore.clearUserInfo()
+ // uni.navigateTo({ url: '/pages/login/login' })
reject(res)
} else {
// 其他错误 -> 根据后端错误信息轻提示
diff --git a/uni-pages.d.ts b/uni-pages.d.ts
index 728a18e..f261783 100644
--- a/uni-pages.d.ts
+++ b/uni-pages.d.ts
@@ -5,13 +5,32 @@
interface NavigateToOptions {
url: "pages/index/index" |
+ "pages/demo/index" |
"pages/login/index" |
- "pages/my/index";
+ "pages/my/index" |
+ "pages/demo/demo/clock" |
+ "pages/demo/demo/component-auto-import" |
+ "pages/demo/demo/lottery" |
+ "pages/demo/demo/lottery2" |
+ "pages/demo/demo/mp-weixin-share" |
+ "pages/demo/demo/navbar" |
+ "pages/demo/demo/pages-auto-import" |
+ "pages/demo/demo/pinia" |
+ "pages/demo/demo/request" |
+ "pages/demo/demo/throughout" |
+ "pages/demo/demo/uni-ui-icons" |
+ "pages/demo/demo/uni-ui" |
+ "pages/demo/demo/unocss-icons" |
+ "pages/demo/demo/unocss" |
+ "pages/demo/demo/img-min/index" |
+ "pages/demo/demo/lottery/big-wheel" |
+ "pages/demo/demo/lottery/nine-grid" |
+ "pages/demo/demo/throughout/index";
}
interface RedirectToOptions extends NavigateToOptions {}
interface SwitchTabOptions {
- url: 'pages/index/index' | 'pages/my/index'
+ url: 'pages/index/index' | 'pages/demo/index' | 'pages/my/index'
}
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions