diff --git a/pages.config.ts b/pages.config.ts
index 5a4bc68..25797ab 100644
--- a/pages.config.ts
+++ b/pages.config.ts
@@ -15,4 +15,34 @@ export default defineUniPages({
'^uv-(.*)': '@climblee/uv-ui/components/uv-$1/uv-$1.vue',
},
},
+ tabBar: {
+ color: '#999999',
+ selectedColor: '#018d71',
+ backgroundColor: '#F8F8F8',
+ borderStyle: 'black',
+ height: '50px',
+ fontSize: '10px',
+ iconWidth: '24px',
+ spacing: '3px',
+ list: [
+ {
+ iconPath: 'static/tabbar/home.png',
+ selectedIconPath: 'static/tabbar/homeHL.png',
+ 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',
+ pagePath: 'pages/my/index',
+ text: '我的',
+ },
+ ],
+ },
})
diff --git a/src/components/fly-header/fly-header.vue b/src/components/fly-header/fly-header.vue
new file mode 100644
index 0000000..9e34a4b
--- /dev/null
+++ b/src/components/fly-header/fly-header.vue
@@ -0,0 +1,3 @@
+
+ header
+
diff --git a/src/components/fly-login/README.md b/src/components/fly-login/README.md
new file mode 100644
index 0000000..c931549
--- /dev/null
+++ b/src/components/fly-login/README.md
@@ -0,0 +1,7 @@
+# fly-login
+
+点击“点击显示微信头像”按钮后,出现的半屏登录弹窗,可以在任意页面引入。
+
+仿“掘金小册”小程序。
+
+
diff --git a/src/components/fly-login/defaultAvatar.png b/src/components/fly-login/defaultAvatar.png
new file mode 100644
index 0000000..e69596a
Binary files /dev/null and b/src/components/fly-login/defaultAvatar.png differ
diff --git a/src/components/fly-login/fly-login.vue b/src/components/fly-login/fly-login.vue
new file mode 100644
index 0000000..8a6dc1f
--- /dev/null
+++ b/src/components/fly-login/fly-login.vue
@@ -0,0 +1,120 @@
+
+
+
+
+ 获取您的昵称、头像
+
+
+
+
+
+ 头像
+
+
+
+
+ 昵称
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/fly-login/screenshot.png b/src/components/fly-login/screenshot.png
new file mode 100644
index 0000000..7ca7a26
Binary files /dev/null and b/src/components/fly-login/screenshot.png differ
diff --git a/src/components/fly-navbar/README.md b/src/components/fly-navbar/README.md
new file mode 100644
index 0000000..cd5cf97
--- /dev/null
+++ b/src/components/fly-navbar/README.md
@@ -0,0 +1,3 @@
+# fly-navbar
+
+建议本导航栏组件在设置 `"navigationStyle": "custom"` 的页面使用,目前支持微信小程序的页面滚动动画。
diff --git a/src/components/fly-navbar/fly-navbar.vue b/src/components/fly-navbar/fly-navbar.vue
new file mode 100644
index 0000000..5636cb4
--- /dev/null
+++ b/src/components/fly-navbar/fly-navbar.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ title || '' }}
+
+
+
+
+
+
diff --git a/src/hooks/useNavbarWeixin.ts b/src/hooks/useNavbarWeixin.ts
new file mode 100644
index 0000000..e8f7aff
--- /dev/null
+++ b/src/hooks/useNavbarWeixin.ts
@@ -0,0 +1,62 @@
+import { onReady } from '@dcloudio/uni-app'
+import { getIsTabbar } from '@/utils/index'
+
+export default () => {
+ // 获取页面栈
+ const pages = getCurrentPages()
+ const isTabbar = getIsTabbar()
+
+ // 页面滚动到底部时的操作,通常用于加载更多数据
+ const onScrollToLower = () => {}
+ // 获取屏幕边界到安全区域距离
+ const { safeAreaInsets } = uni.getSystemInfoSync()
+
+ // #ifdef MP-WEIXIN
+ // 基于小程序的 Page 类型扩展 uni-app 的 Page
+ type PageInstance = Page.PageInstance & WechatMiniprogram.Page.InstanceMethods
+ // 获取当前页面实例,数组最后一项
+ const pageInstance = getCurrentPages().at(-1) as PageInstance
+
+ // 页面渲染完毕,绑定动画效果
+ onReady(() => {
+ // 动画效果,导航栏背景色
+ pageInstance.animate(
+ '.fly-navbar',
+ [{ backgroundColor: 'transparent' }, { backgroundColor: '#f8f8f8' }],
+ 1000,
+ {
+ scrollSource: '#scroller',
+ timeRange: 1000,
+ startScrollOffset: 0,
+ endScrollOffset: 50,
+ },
+ )
+ // 动画效果,导航栏标题
+ pageInstance.animate(
+ '.fly-navbar .title',
+ [{ color: 'transparent' }, { color: '#000' }],
+ 1000,
+ {
+ scrollSource: '#scroller',
+ timeRange: 1000,
+ startScrollOffset: 0,
+ endScrollOffset: 50,
+ },
+ )
+ // 动画效果,导航栏返回按钮
+ pageInstance.animate('.fly-navbar .left-icon', [{ color: '#fff' }, { color: '#000' }], 1000, {
+ scrollSource: '#scroller',
+ timeRange: 1000,
+ startScrollOffset: 0,
+ endScrollOffset: 50,
+ })
+ })
+ // #endif
+
+ return {
+ pages,
+ isTabbar,
+ onScrollToLower,
+ safeAreaInsets,
+ }
+}
diff --git a/src/hooks/useWeixinShare.ts b/src/hooks/useWeixinShare.ts
new file mode 100644
index 0000000..47880c2
--- /dev/null
+++ b/src/hooks/useWeixinShare.ts
@@ -0,0 +1,25 @@
+import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
+
+export default () => {
+ return {
+ /** 激活“分享给好友” */
+ onShareAppMessage: onShareAppMessage(
+ (options: Page.ShareAppMessageOption): Page.CustomShareContent => {
+ console.log('options:', options)
+ return {
+ title: '自定义分享标题',
+ path: '/pages/index/index?id=xxx',
+ imageUrl:
+ 'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png',
+ }
+ },
+ ),
+ /** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */
+ onShareTimeline: onShareTimeline((): Page.ShareTimelineContent => {
+ return {
+ title: '自定义分享标题',
+ query: 'a=1&b=2',
+ }
+ }),
+ }
+}
diff --git a/src/pages/demo/base/mp-weixin-share.vue b/src/pages/demo/base/mp-weixin-share.vue
new file mode 100644
index 0000000..9e499e4
--- /dev/null
+++ b/src/pages/demo/base/mp-weixin-share.vue
@@ -0,0 +1,42 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '微信分享' },
+}
+
+
+
+ 微信分享页
+ 请在微信小程序中体验,或者开发者工具
+ 1) 默认是不激活”发送给朋友“和”分享到朋友圈“的,如下图
+
+ 2) 增加了onShareAppMessage和onShareTimeline后,就可以微信分享了,如下图
+
+
+
+
diff --git a/src/pages/demo/base/navbar.vue b/src/pages/demo/base/navbar.vue
new file mode 100644
index 0000000..7985584
--- /dev/null
+++ b/src/pages/demo/base/navbar.vue
@@ -0,0 +1,19 @@
+
+{
+ style: { navigationBarTitleText: '自定义导航栏', navigationStyle: 'custom' },
+}
+
+
+
+
+
+ 自定义导航栏,设置"navigationStyle":"custom"
+ 通常页面顶部有一个图片或背景色
+
+
+
+
+
diff --git a/src/pages/demo/base/pinia.vue b/src/pages/demo/base/pinia.vue
new file mode 100644
index 0000000..4ae0c52
--- /dev/null
+++ b/src/pages/demo/base/pinia.vue
@@ -0,0 +1,40 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: 'pinia+持久化' },
+}
+
+
+
+
+ Count: {{ countStore.count }}
+
+
+
+
+
+ {{ userStore.userInfo }}
+ 请观察小程序的store,可以看到是可以正常设置的
+
+
+
+
+
+
+
diff --git a/src/pages/demo/base/request.vue b/src/pages/demo/base/request.vue
new file mode 100644
index 0000000..2af78a9
--- /dev/null
+++ b/src/pages/demo/base/request.vue
@@ -0,0 +1,67 @@
+
+{
+ layout: 'demo',
+ style: {
+ navigationBarTitleText: '请求',
+ },
+}
+
+
+
+
+
+
+ 请求数据如下
+ {{ JSON.stringify(data) }}
+ 完整数据
+ {{ JSON.stringify(originalData) }}
+
+ 请求数据如下
+ {{ JSON.stringify(data2) }}
+
+
+
+ 使用的是 laf 云后台
+ 我的推荐码,可以获得佣金
+
+
+ {{ recommendUrl }}
+
+
+
+
+ {{ recommendUrl }}
+
+
+
+
+
diff --git a/src/pages/demo/base/throughout.vue b/src/pages/demo/base/throughout.vue
new file mode 100644
index 0000000..10d8c7e
--- /dev/null
+++ b/src/pages/demo/base/throughout.vue
@@ -0,0 +1,145 @@
+
+{
+ style: {
+ navigationBarTitleText: '通屏+下拉刷新+自定义导航栏',
+ enablePullDownRefresh: false,
+ backgroundColor: '#23c09c', // 这个背景色要与页面的.top-section的背景图差不多,这样下拉刷新看起来才比较协调
+ 'app-plus': {
+ titleNView: {
+ type: 'transparent',
+ },
+ },
+ 'mp-weixin': {
+ navigationStyle: 'custom',
+ },
+ },
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ '我是标题' }}
+
+
+
+
+
+ 顶部区域
+ 可以是标题,也可以是个人中心头像等
+ 建议本区域高度不低于200rpx
+
+
+ 注意,上面的导航栏渐变效果仅微信端支持,且上面的导航栏无法抽为组件引入使用,否则滚动效果没有了。如果不只是微信小程序使用,可以
+ onPageScroll 实现全端效果一样,另外如果是app端,还可以配置 titleNView。参考
+ https://uniapp.dcloud.net.cn/tutorial/page.html#onpagescroll 。
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/base/uni-ui-icons.vue b/src/pages/demo/base/uni-ui-icons.vue
new file mode 100644
index 0000000..f513674
--- /dev/null
+++ b/src/pages/demo/base/uni-ui-icons.vue
@@ -0,0 +1,16 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: 'UniUI Icons 使用' },
+}
+
+
+
+
+
+
+ 注意在微信小程序中,不支持改颜色,即设置了颜色也会变成默认的#333, BUG
+
+
diff --git a/src/pages/demo/base/uni-ui.vue b/src/pages/demo/base/uni-ui.vue
new file mode 100644
index 0000000..6fd423d
--- /dev/null
+++ b/src/pages/demo/base/uni-ui.vue
@@ -0,0 +1,14 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: 'UniUI 使用' },
+}
+
+
+
+
+ 这是一个基础卡片示例,内容较少,此示例展示了一个没有任何属性不带阴影的卡片。
+
+ 微信里面下面的 uni-badge 显示不出来,BUG
+
+
diff --git a/src/pages/demo/base/unocss-icons.vue b/src/pages/demo/base/unocss-icons.vue
new file mode 100644
index 0000000..18c583a
--- /dev/null
+++ b/src/pages/demo/base/unocss-icons.vue
@@ -0,0 +1,20 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: 'UnoCss Icons 使用' },
+}
+
+
+
+
+
+ 这里只装了carbon的图表库,网址:
+ https://icones.js.org/collection/carbon (非H5环境,请使用浏览器打开)
+
+
+
+
+
+
diff --git a/src/pages/demo/base/unocss.vue b/src/pages/demo/base/unocss.vue
new file mode 100644
index 0000000..3fd903c
--- /dev/null
+++ b/src/pages/demo/base/unocss.vue
@@ -0,0 +1,15 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: 'UnoCss 使用' },
+}
+
+
+
+
+ 文字颜色 text-light-50
+ 文字颜色 text-red-500
+ 背景色 bg-light-50
+ 背景色 bg-red-500
+
+
diff --git a/src/pages/demo/base/vconsole.vue b/src/pages/demo/base/vconsole.vue
new file mode 100644
index 0000000..072f3e4
--- /dev/null
+++ b/src/pages/demo/base/vconsole.vue
@@ -0,0 +1,22 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '开启 vConsole' },
+}
+
+
+
+
+ 在非正式版小程序里面已经集成了VConsole
+ 开启方式如下面
+
+ 然后页面上会出现一个 `vConsole` 的调试按钮,如下图
+
+
+
diff --git a/src/pages/demo/index.vue b/src/pages/demo/index.vue
new file mode 100644
index 0000000..7a940ee
--- /dev/null
+++ b/src/pages/demo/index.vue
@@ -0,0 +1,81 @@
+
+
+
+ {{ item.title }}
+
+
+ {{ itemDetail.title }}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/clock.vue b/src/pages/demo/page/clock.vue
new file mode 100644
index 0000000..d507298
--- /dev/null
+++ b/src/pages/demo/page/clock.vue
@@ -0,0 +1,130 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '动态时钟' },
+}
+
+
+
+ 动态时钟
+
+
+
+ {{ n }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/clock2.vue b/src/pages/demo/page/clock2.vue
new file mode 100644
index 0000000..6fc30d8
--- /dev/null
+++ b/src/pages/demo/page/clock2.vue
@@ -0,0 +1,152 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '动态时钟-抗锯齿' },
+}
+
+
+
+ 动态时钟
+
+
+
+ {{ n }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/floating-bubble.vue b/src/pages/demo/page/floating-bubble.vue
new file mode 100644
index 0000000..3523408
--- /dev/null
+++ b/src/pages/demo/page/floating-bubble.vue
@@ -0,0 +1,88 @@
+
+{
+ layout: 'default',
+ style: { navigationBarTitleText: '页面悬浮球' },
+}
+
+
+
+
+
+
+
+
+
+ 页面其他元素
+ 可以正常触发点击事件吗?答案是可以的
+
+ {{ x }}
+ {{ y }}
+ 点击设置
+
+
+
+
+
+
diff --git a/src/pages/demo/page/i18n.vue b/src/pages/demo/page/i18n.vue
new file mode 100644
index 0000000..033cd8d
--- /dev/null
+++ b/src/pages/demo/page/i18n.vue
@@ -0,0 +1,83 @@
+
+{
+ layout: 'demo',
+ style: {
+ navigationBarTitleText: '%app.name%',
+ },
+}
+
+
+
+
+ 多语言测试
+ {{ $t('app.name') }}
+
+ 切换语言
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/img-min/index.vue b/src/pages/demo/page/img-min/index.vue
new file mode 100644
index 0000000..b4f4ee7
--- /dev/null
+++ b/src/pages/demo/page/img-min/index.vue
@@ -0,0 +1,29 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '图片压缩' },
+}
+
+
+
+
+
+ 原始图片是一个很大的,2.5M,build之后生成的图片只有1.1M,体积下降 56%
+
+
+ 对比图如下2图,如果看不清请看代码原图
+
+
+
+
diff --git a/src/pages/demo/page/lottery.vue b/src/pages/demo/page/lottery.vue
new file mode 100644
index 0000000..048044d
--- /dev/null
+++ b/src/pages/demo/page/lottery.vue
@@ -0,0 +1,127 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '九宫格抽奖' },
+}
+
+
+
+ 九宫格抽奖
+
+
+
+ 点击抽奖
+ {{ n }}
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/lottery/big-wheel.vue b/src/pages/demo/page/lottery/big-wheel.vue
new file mode 100644
index 0000000..397f2af
--- /dev/null
+++ b/src/pages/demo/page/lottery/big-wheel.vue
@@ -0,0 +1,216 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '大转盘抽奖' },
+}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+ 目标是实现如下的效果,但是我感觉只用css还是太难了
+
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/lottery/nine-grid.vue b/src/pages/demo/page/lottery/nine-grid.vue
new file mode 100644
index 0000000..6374aa2
--- /dev/null
+++ b/src/pages/demo/page/lottery/nine-grid.vue
@@ -0,0 +1,196 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '九宫格抽奖' },
+}
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/lottery2.vue b/src/pages/demo/page/lottery2.vue
new file mode 100644
index 0000000..876a1bd
--- /dev/null
+++ b/src/pages/demo/page/lottery2.vue
@@ -0,0 +1,181 @@
+
+{
+ layout: 'demo',
+ style: { navigationBarTitleText: '大转盘抽奖' },
+}
+
+
+
+ 大转盘抽奖
+
+
+ 下面是调试过程图片
+ 欢迎感兴趣的玩家继续优化
+ 计算lottery-item-inner节点的padding-left值
+
+ 调整lottery-item-gift节点
+
+
+
+
+
+
+
diff --git a/src/pages/demo/page/sign.vue b/src/pages/demo/page/sign.vue
new file mode 100644
index 0000000..91cc02e
--- /dev/null
+++ b/src/pages/demo/page/sign.vue
@@ -0,0 +1,266 @@
+
+{
+ layout: 'default',
+ style: { navigationBarTitleText: '签字板' },
+}
+
+
+
+
+
+
+
+
+ {{ isFullScreen ? '退出全屏' : '全屏' }}
+
+ 清空
+
+ 撤回
+
+
+
+ 保存
+
+
+
+
+
+
+
+
diff --git a/src/pages/my/components/wx-login.vue b/src/pages/my/components/wx-login.vue
new file mode 100644
index 0000000..30e5ff9
--- /dev/null
+++ b/src/pages/my/components/wx-login.vue
@@ -0,0 +1,39 @@
+
+{
+ style: { navigationBarTitleText: '登录' },
+}
+
+
+
+
+
+
+ {{ userStore.userInfo?.nickname }}
+
+
+
+ 点击显示微信头像
+
+
+
+
+
+
+
+
diff --git a/src/pages/my/index.vue b/src/pages/my/index.vue
new file mode 100644
index 0000000..0d53bd8
--- /dev/null
+++ b/src/pages/my/index.vue
@@ -0,0 +1,35 @@
+
+{
+ style: { navigationBarTitleText: '我的' },
+}
+
+
+ wx的openid:
+ {{ openId }}
+
+
+
+
diff --git a/src/static/tabbar/example.png b/src/static/tabbar/example.png
new file mode 100644
index 0000000..fd1e942
Binary files /dev/null and b/src/static/tabbar/example.png differ
diff --git a/src/static/tabbar/exampleHL.png b/src/static/tabbar/exampleHL.png
new file mode 100644
index 0000000..7501011
Binary files /dev/null and b/src/static/tabbar/exampleHL.png differ
diff --git a/src/static/tabbar/home.png b/src/static/tabbar/home.png
new file mode 100644
index 0000000..8f82e21
Binary files /dev/null and b/src/static/tabbar/home.png differ
diff --git a/src/static/tabbar/homeHL.png b/src/static/tabbar/homeHL.png
new file mode 100644
index 0000000..26d3761
Binary files /dev/null and b/src/static/tabbar/homeHL.png differ
diff --git a/src/static/tabbar/personal.png b/src/static/tabbar/personal.png
new file mode 100644
index 0000000..0a569a2
Binary files /dev/null and b/src/static/tabbar/personal.png differ
diff --git a/src/static/tabbar/personalHL.png b/src/static/tabbar/personalHL.png
new file mode 100644
index 0000000..8c3e66e
Binary files /dev/null and b/src/static/tabbar/personalHL.png differ
diff --git a/src/store/count.ts b/src/store/count.ts
new file mode 100644
index 0000000..946ccd7
--- /dev/null
+++ b/src/store/count.ts
@@ -0,0 +1,28 @@
+// src/store/useCountStore.ts
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+
+export const useCountStore = defineStore(
+ 'count',
+ () => {
+ const count = ref(0)
+ const increment = () => {
+ count.value++
+ }
+ const decrement = () => {
+ count.value--
+ }
+ const reset = () => {
+ count.value = 0
+ }
+ return {
+ count,
+ decrement,
+ increment,
+ reset,
+ }
+ },
+ {
+ persist: true,
+ },
+)
diff --git a/src/store/index.ts b/src/store/index.ts
index e5f6675..74cb584 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -16,3 +16,4 @@ export default store
// 模块统一导出
export * from './user'
+export * from './count'
diff --git a/src/store/user.ts b/src/store/user.ts
index 7e08146..9118687 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -1,24 +1,30 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
-import { UserInfo } from '../typings'
+import { IUserInfo } from '../typings'
+
+const initState = { nickname: '', avatar: '' }
export const useUserStore = defineStore(
'user',
() => {
- const userInfo = ref({ nickname: '', avatar: '' })
+ const userInfo = ref({ ...initState })
- const setUserInfo = (val: UserInfo) => {
+ const setUserInfo = (val: IUserInfo) => {
userInfo.value = val
}
const clearUserInfo = () => {
userInfo.value = undefined
}
+ const reset = () => {
+ userInfo.value = { ...initState }
+ }
return {
userInfo,
setUserInfo,
clearUserInfo,
+ reset,
}
},
{
diff --git a/src/typings.d.ts b/src/typings.d.ts
index 9878916..3e860bb 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -6,15 +6,10 @@ export type IResData = {
result: T
}
-export type UserInfo = {
+export type IUserInfo = {
nickname?: string
avatar?: string
/** 微信的 openid,非微信没有这个字段 */
openid?: string
token?: string
}
-
-export type UserItem = {
- username: string
- age: number
-}
diff --git a/src/utils/http.ts b/src/utils/http.ts
index 79ace68..1a3d1a5 100644
--- a/src/utils/http.ts
+++ b/src/utils/http.ts
@@ -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 }
@@ -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}`
}
diff --git a/src/utils/index.ts b/src/utils/index.ts
index b46d00d..90d3637 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -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
*/