fix: app 打包失败BUG
This commit is contained in:
parent
2e3c18f9a6
commit
7ba6f95b53
16
.hbuilderx/launch.json
Normal file
16
.hbuilderx/launch.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -32,9 +32,9 @@ export default defineManifestConfig({
|
|||||||
distribute: {
|
distribute: {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
android: {
|
android: {
|
||||||
// minSdkVersion: 30,
|
minSdkVersion: 30,
|
||||||
// targetSdkVersion: 30,
|
targetSdkVersion: 30,
|
||||||
// abiFilters: ['armeabi-v7a', 'arm64-v8a'],
|
abiFilters: ['armeabi-v7a', 'arm64-v8a'],
|
||||||
permissions: [
|
permissions: [
|
||||||
'<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>',
|
'<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>',
|
||||||
'<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>',
|
'<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>',
|
||||||
|
@ -34,7 +34,10 @@
|
|||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
]
|
],
|
||||||
|
"minSdkVersion": 30,
|
||||||
|
"targetSdkVersion": 30,
|
||||||
|
"abiFilters": ["armeabi-v7a", "arm64-v8a"]
|
||||||
},
|
},
|
||||||
"ios": {},
|
"ios": {},
|
||||||
"sdkConfigs": {},
|
"sdkConfigs": {},
|
||||||
|
155
src/pages.json
155
src/pages.json
@ -29,6 +29,12 @@
|
|||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"iconPath": "static/tabbar/example.png",
|
||||||
|
"selectedIconPath": "static/tabbar/exampleHL.png",
|
||||||
|
"pagePath": "pages/demo/index",
|
||||||
|
"text": "示例"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/tabbar/personal.png",
|
"iconPath": "static/tabbar/personal.png",
|
||||||
"selectedIconPath": "static/tabbar/personalHL.png",
|
"selectedIconPath": "static/tabbar/personalHL.png",
|
||||||
@ -45,6 +51,10 @@
|
|||||||
"navigationBarTitleText": "首页"
|
"navigationBarTitleText": "首页"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/demo/index",
|
||||||
|
"type": "page"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/login/index",
|
"path": "pages/login/index",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
@ -58,6 +68,151 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的"
|
"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": []
|
"subPackages": []
|
||||||
|
1
src/typings.d.ts
vendored
1
src/typings.d.ts
vendored
@ -1,6 +1,7 @@
|
|||||||
export type UserInfo = {
|
export type UserInfo = {
|
||||||
nickname: string
|
nickname: string
|
||||||
avatar: string
|
avatar: string
|
||||||
|
token?: string
|
||||||
}
|
}
|
||||||
export type UserItem = {
|
export type UserItem = {
|
||||||
username: string
|
username: string
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { UserInfo } from '@/typings'
|
import { UserInfo } from '@/typings'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
type Data<T> = {
|
type Data<T> = {
|
||||||
code: number
|
code: number
|
||||||
msg: string
|
msg: string
|
||||||
@ -29,6 +28,7 @@ const httpInterceptor = {
|
|||||||
...options.header,
|
...options.header,
|
||||||
}
|
}
|
||||||
// 4. 添加 token 请求头标识
|
// 4. 添加 token 请求头标识
|
||||||
|
const userStore = useUserStore()
|
||||||
const { token } = userStore.userInfo as unknown as UserInfo
|
const { token } = userStore.userInfo as unknown as UserInfo
|
||||||
if (token) {
|
if (token) {
|
||||||
options.header.Authorization = `Bearer ${token}`
|
options.header.Authorization = `Bearer ${token}`
|
||||||
@ -54,8 +54,8 @@ export const http = <T>(options: UniApp.RequestOptions) => {
|
|||||||
resolve(res.data as Data<T>)
|
resolve(res.data as Data<T>)
|
||||||
} else if (res.statusCode === 401) {
|
} else if (res.statusCode === 401) {
|
||||||
// 401错误 -> 清理用户信息,跳转到登录页
|
// 401错误 -> 清理用户信息,跳转到登录页
|
||||||
userStore.clearUserInfo()
|
// userStore.clearUserInfo()
|
||||||
uni.navigateTo({ url: '/pages/login/login' })
|
// uni.navigateTo({ url: '/pages/login/login' })
|
||||||
reject(res)
|
reject(res)
|
||||||
} else {
|
} else {
|
||||||
// 其他错误 -> 根据后端错误信息轻提示
|
// 其他错误 -> 根据后端错误信息轻提示
|
||||||
|
23
uni-pages.d.ts
vendored
23
uni-pages.d.ts
vendored
@ -5,13 +5,32 @@
|
|||||||
|
|
||||||
interface NavigateToOptions {
|
interface NavigateToOptions {
|
||||||
url: "pages/index/index" |
|
url: "pages/index/index" |
|
||||||
|
"pages/demo/index" |
|
||||||
"pages/login/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 RedirectToOptions extends NavigateToOptions {}
|
||||||
|
|
||||||
interface SwitchTabOptions {
|
interface SwitchTabOptions {
|
||||||
url: 'pages/index/index' | 'pages/my/index'
|
url: 'pages/index/index' | 'pages/demo/index' | 'pages/my/index'
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions
|
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user