feat: 把hello项目文件搬过来

This commit is contained in:
菲鸽
2024-02-04 16:00:27 +08:00
parent 16694caccd
commit b90a409737
45 changed files with 2398 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable no-param-reassign */
import qs from 'qs'
import { useUserStore } from '@/store'
import { IResData, UserInfo } from '@/typings'
import { IResData, IUserInfo } from '@/typings'
type CustomRequestOptions = UniApp.RequestOptions & { query?: Record<string, any> }
@@ -36,7 +36,7 @@ const httpInterceptor = {
}
// 4. 添加 token 请求头标识
const userStore = useUserStore()
const { token } = userStore.userInfo as unknown as UserInfo
const { token } = userStore.userInfo as unknown as IUserInfo
if (token) {
options.header.Authorization = `Bearer ${token}`
}

View File

@@ -1,5 +1,18 @@
import pagesJson from '@/pages.json'
import { translate as t } from '@/locale/index'
console.log(pagesJson)
/** 判断当前页面是否是tabbar页 */
export const getIsTabbar = () => {
if (!Object.keys(pagesJson).includes('tabBar')) {
return false
}
const pages = getCurrentPages()
const currPath = pages.at(-1).route
return !!pagesJson.tabBar.list.find((e) => e.pagePath === currPath)
}
/**
* test i18n in not .vue file
*/