feat:增加tabbar
This commit is contained in:
1 parent
cc39f190d0
commit
108521704f
47 files changed
+201
-79
No files matched your search
@@ -2,7 +2,7 @@
|
||||
import { ref, reactive, computed, nextTick, onMounted } from "vue"
|
||||
import { onHide, onShow } from "@dcloudio/uni-app"
|
||||
|
||||
import { router } from "@@/index"
|
||||
import { router, constant } from "@@/index"
|
||||
import { noticeApi, appApi } from "@@/api/index"
|
||||
import { getAppInfo } from "@@/utils/app"
|
||||
import { SERVICE_IMAGE } from "@@/constant/index"
|
||||
@@ -25,12 +25,14 @@ const state = reactive<any>({
|
||||
appMenuList: [],
|
||||
})
|
||||
const groupSize = 3
|
||||
const shouldScroll = computed(() => state.noticeList.length > groupSize)
|
||||
const noticeListSafe = computed(() => (Array.isArray(state.noticeList) ? state.noticeList : []).filter(Boolean))
|
||||
const appMenuListSafe = computed(() => (Array.isArray(state.appMenuList) ? state.appMenuList : []).filter(Boolean))
|
||||
const shouldScroll = computed(() => noticeListSafe.value.length > groupSize)
|
||||
|
||||
const groupedNoticeList = computed(() => {
|
||||
const base = state.noticeList
|
||||
const base = noticeListSafe.value
|
||||
if (!base || base.length === 0) return []
|
||||
if (base.length <= groupSize) return base
|
||||
if (base.length <= groupSize) return [base]
|
||||
const groups: any[] = []
|
||||
for (let i = 0; i < base.length; i += groupSize) {
|
||||
const group = base.slice(i, i + groupSize)
|
||||
@@ -61,6 +63,7 @@ onHide(() => {
|
||||
})
|
||||
|
||||
const doMenu = async (v: any) => {
|
||||
if (!v) return
|
||||
if (v.page.includes("thirdApp")) {
|
||||
router.jump("/pages/third-app/happyMall")
|
||||
return
|
||||
@@ -79,7 +82,7 @@ const getNoticeList = async () => {
|
||||
if (code != 0) {
|
||||
throw new Error()
|
||||
}
|
||||
state.noticeList = data?.records || []
|
||||
state.noticeList = (data?.records || []).filter(Boolean)
|
||||
} catch (error) {
|
||||
console.log("获取通知公告列表意外的错误error:", error);
|
||||
}
|
||||
@@ -97,7 +100,7 @@ const getAppMenuList = async () => {
|
||||
if (code != 0) {
|
||||
throw new Error()
|
||||
}
|
||||
state.appMenuList = data || []
|
||||
state.appMenuList = (data || []).filter(Boolean)
|
||||
} catch (error) {
|
||||
console.log("获取应用菜单列表意外的错误error:", error);
|
||||
}
|
||||
@@ -105,7 +108,7 @@ const getAppMenuList = async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<crud-layout title="智慧后勤系统" :bg="filePath(SERVICE_IMAGE.blueBg)" ref="crudLayoutRef">
|
||||
<crud-layout title="智慧后勤系统" mainIsScroll :bg="filePath(SERVICE_IMAGE.blueBg)" ref="crudLayoutRef">
|
||||
<view class="h-20rpx" />
|
||||
<swiper class="w-full h-280rpx rounded-16rpx overflow-hidden" circular :indicator-dots="true"
|
||||
indicator-active-color="#0779FD" indicator-color="#ffffff" :autoplay="true">
|
||||
@@ -125,7 +128,7 @@ const getAppMenuList = async () => {
|
||||
查看更多
|
||||
</view>
|
||||
<view class="w-full h-50rpx" />
|
||||
<view class="h-300rpx overflow-hidden" v-if="state?.noticeList?.length > 0">
|
||||
<view class="h-300rpx overflow-hidden" v-if="noticeListSafe.length > 0">
|
||||
<swiper class="w-full h-full" :vertical="true" :circular="shouldScroll" :autoplay="shouldScroll"
|
||||
:interval="2500" :duration="500" :indicator-dots="false" :disable-touch="true">
|
||||
<swiper-item v-for="(group, i) in groupedNoticeList" :key="i">
|
||||
@@ -151,13 +154,13 @@ const getAppMenuList = async () => {
|
||||
常用功能
|
||||
</view>
|
||||
<view class="w-full h-50rpx" />
|
||||
<view v-if="state?.appMenuList?.length > 0">
|
||||
<view v-if="appMenuListSafe.length > 0">
|
||||
<view class="grid grid-cols-3 h-full items-center gap-y-30rpx p-y-30rpx">
|
||||
<view class="flex flex-col items-center justify-center" v-for="(v, i) in state.appMenuList" :key="i"
|
||||
<view class="flex flex-col items-center justify-center" v-for="(v, i) in appMenuListSafe" :key="i"
|
||||
@tap="doMenu(v)">
|
||||
<view class="flex-col-center">
|
||||
<image class="size-100rpx" :src="filePath(v.icon)" mode="aspectFill" />
|
||||
<view class="m-t-10rpx sub-text-26">{{ v.title }}</view>
|
||||
<image class="size-100rpx" :src="filePath(v?.icon)" mode="aspectFill" />
|
||||
<view class="m-t-10rpx sub-text-26">{{ v?.title || "" }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -166,6 +169,7 @@ const getAppMenuList = async () => {
|
||||
<empty text="暂无App" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-30rpx" />
|
||||
</crud-layout>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in new issue
Block a user