feat: 大量升级,v2.0.0

This commit is contained in:
菲鸽
2024-04-17 15:32:15 +08:00
parent 09fbee72aa
commit 28caa1dea3
37 changed files with 233 additions and 297 deletions

View File

@@ -22,10 +22,11 @@ export const http = <T>(options: CustomRequestOptions) => {
reject(res)
} else {
// 其他错误 -> 根据后端错误信息轻提示
uni.showToast({
icon: 'none',
title: (res.data as IResData<T>).msg || '请求错误',
})
!options.hideErrorToast &&
uni.showToast({
icon: 'none',
title: (res.data as IResData<T>).msg || '请求错误',
})
reject(res)
}
},

View File

@@ -8,7 +8,7 @@ export const getIsTabbar = () => {
return false
}
const pages = getCurrentPages()
const lastPage = getArrElementByIdx(pages, -1)
const lastPage = pages.at(-1)
const currPath = lastPage.route
return !!pagesJson.tabBar.list.find((e) => e.pagePath === currPath)
}
@@ -22,7 +22,7 @@ export const currRoute = () => {
const pages = getCurrentPages()
console.log('pages:', pages)
const lastPage = getArrElementByIdx(pages, -1)
const lastPage = pages.at(-1)
const currRoute = (lastPage as any).$page
// console.log('lastPage.$page:', currRoute)
// console.log('lastPage.$page.fullpath:', currRoute.fullPath)
@@ -105,9 +105,3 @@ export const getNeedLoginPages = (): string[] => getAllPages('needLogin').map((p
* 只得到 path 数组
*/
export const needLoginPages: string[] = getAllPages('needLogin').map((page) => page.path)
export const getArrElementByIdx = (arr: any[], index: number) => {
if (index < 0) return arr[arr.length + index]
if (index >= arr.length) return undefined
return arr[index]
}