Explorar o código

fix: app 打包失败BUG

Burt %!s(int64=2) %!d(string=hai) anos
pai
achega
7ba6f95b53
Modificáronse 7 ficheiros con 203 adicións e 9 borrados
  1. 16 0
      .hbuilderx/launch.json
  2. 3 3
      manifest.config.ts
  3. 4 1
      src/manifest.json
  4. 155 0
      src/pages.json
  5. 1 0
      src/typings.d.ts
  6. 3 3
      src/utils/http.ts
  7. 21 2
      uni-pages.d.ts

+ 16 - 0
.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"
+    }
+  ]
+}

+ 3 - 3
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: [
           '<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>',
           '<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>',

+ 4 - 1
src/manifest.json

@@ -34,7 +34,10 @@
           "<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": {},

+ 155 - 0
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": []

+ 1 - 0
src/typings.d.ts

@@ -1,6 +1,7 @@
 export type UserInfo = {
   nickname: string
   avatar: string
+  token?: string
 }
 export type UserItem = {
   username: string

+ 3 - 3
src/utils/http.ts

@@ -2,7 +2,6 @@
 import { useUserStore } from '@/store'
 import { UserInfo } from '@/typings'
 
-const userStore = useUserStore()
 type Data<T> = {
   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 = <T>(options: UniApp.RequestOptions) => {
           resolve(res.data as Data<T>)
         } 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 {
           // 其他错误 -> 根据后端错误信息轻提示

+ 21 - 2
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