From 14681dfe7052cb76eefcc0c17d0a0d708e1ac9dd Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期二, 13 五月 2025 16:31:14 +0800 Subject: [PATCH] 完成移动端基本功能 --- eims-ui-mobile/src/pages/home/index.vue | 185 +++++++++++++++++++++++++++++++++------------- 1 files changed, 132 insertions(+), 53 deletions(-) diff --git a/eims-ui-mobile/src/pages/home/index.vue b/eims-ui-mobile/src/pages/home/index.vue index cb1e18e..b04275b 100644 --- a/eims-ui-mobile/src/pages/home/index.vue +++ b/eims-ui-mobile/src/pages/home/index.vue @@ -17,13 +17,13 @@ <view class="bg-white h-[80rpx] px-2 flex items-center justify-between"> <view class="flex items-center" @click="handleUserInfo"> <wd-icon name="user" size="40rpx" class="icon-color-base"></wd-icon> - <text class="ml-1 text-color-base">寮犱笁</text> + <text class="ml-1 text-color-base">{{ realName }}</text> </view> <view class="flex items-center"> - <wd-icon name="notification" size="40rpx" class="icon-color-base mr-3"></wd-icon> - <wd-icon name="tips" size="40rpx" class="icon-color-base mr-3"></wd-icon> - <wd-icon name="app" size="40rpx" class="icon-color-base"></wd-icon> + <wd-icon name="notification" size="40rpx" class="icon-color-base mr-3" @click="handleInfo"></wd-icon> + <wd-icon name="tips" size="40rpx" class="icon-color-base mr-3" @click="handleInfo"></wd-icon> + <wd-icon name="app" size="40rpx" class="icon-color-base" @click="handleInfo"></wd-icon> </view> </view> @@ -65,74 +65,85 @@ </view> </wd-card> </view> - <view class="bg-white mt-2"> <wd-card type="rectangle"> <template #title> <view class="flex items-center menu-title-box"> <view class="menu-indicator"></view> - <view class="ml-1 text-xs">鏁版嵁鎬昏</view> - </view> - </template> - <wd-grid :column="4"> - <wd-grid-item use-slot class="flex justify-center items-center"> - <image class="slot-img text-center" src="/static/menu/menu2.png" /> - <text>12</text> - </wd-grid-item> - <wd-grid-item use-slot class="flex justify-center items-center"> - <image class="slot-img text-center" src="/static/menu/menu2.png" /> - <text>12</text> - </wd-grid-item> - <wd-grid-item use-slot class="flex justify-center items-center"> - <image class="slot-img text-center" src="/static/menu/menu2.png" /> - <text>12</text> - </wd-grid-item> - <wd-grid-item use-slot is-dot class="flex justify-center items-center"> - <image class="slot-img text-center" src="/static/menu/menu2.png" /> - <text>12</text> - </wd-grid-item> - <wd-grid-item use-slot class="flex justify-center items-center"> - <image class="slot-img text-center" src="/static/menu/menu2.png" /> - <text>12</text> - </wd-grid-item> - <wd-grid-item use-slot class="flex justify-center items-center"> - <image class="slot-img text-center" src="/static/menu/menu2.png" /> - <text>12</text> - </wd-grid-item> - </wd-grid> - </wd-card> - </view> - - <view class="bg-white mt-2"> - <wd-card type="rectangle"> - <template #title> - <view class="flex items-center menu-title-box"> - <view class="menu-indicator"></view> - <view class="ml-1 text-xs">鏁版嵁鎬昏</view> + <view class="ml-1 text-xs">蹇嵎鎿嶄綔</view> </view> </template> <wd-grid :column="4"> <wd-grid-item use-slot class="flex justify-center items-center" - v-for="(item, index) in menuList" + v-for="(item, index) in commonMenu" :key="item.id" + @click.stop="goItemPage(item.path)" > - <image class="slot-img text-center" :src="item.url" /> + <image class="slot-img text-center" :src="item.icon" /> <text>{{ item.name }}</text> </wd-grid-item> </wd-grid> </wd-card> </view> + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">璁惧绠$悊</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in inspectMenu" + :key="item.id" + @click.stop="goItemPage(item.path)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> + </view> + <view class="bg-white mt-2"> + <wd-card type="rectangle"> + <template #title> + <view class="flex items-center menu-title-box"> + <view class="menu-indicator"></view> + <view class="ml-1 text-xs">鍙拌处鐩稿叧</view> + </view> + </template> + <wd-grid :column="4"> + <wd-grid-item + use-slot + class="flex justify-center items-center" + v-for="(item, index) in equMenu" + @click.stop="goItemPage(item.path)" + > + <image class="slot-img text-center" :src="item.icon" /> + <text>{{ item.name }}</text> + </wd-grid-item> + </wd-grid> + </wd-card> + </view> + + </view> </template> <script lang="ts" setup> import { getAllMenusApi } from '@/service/menu' - +import { useUserStore } from '@/store' +import { tabbarStore } from '@/components/fg-tabbar/tabbar' defineOptions({ name: 'Home', }) + +const userStore = useUserStore() // 鑾峰彇灞忓箷杈圭晫鍒板畨鍏ㄥ尯鍩熻窛绂� const { safeAreaInsets } = uni.getSystemInfoSync() @@ -141,29 +152,94 @@ const menuList = await getAllMenusApi() console.error(menuList) } +function handleInfo() { + uni.showToast({ + title: '鍔熻兘寮�鍙戜腑', + icon: 'none', + }) +} + +const goItemPage = (path: string) => { + const url = `/${path}` + uni.navigateTo({ + url, + }) +} onLoad(() => { // getAllMenus() }) -const menuList = reactive([ + +const commonMenu = reactive([ { id: 1, - name: '娴嬭瘯', - url: '/static/menu/menu1.png', + name: '鏁呴殰鎶ヤ慨', + icon: '/static/ico/ico20.png', + path: 'pages/repair/repair-add', + } +]) + +const equMenu = reactive([ + { + id: 1, + name: '璁惧鍒楄〃', + icon: '/static/ico/ico15.png', + path: 'pages/equ/equ-list', }, { id: 2, - name: '娴嬭瘯', - url: '/static/menu/menu1.png', + name: '宸ュ叿鍒楄〃', + icon: '/static/ico/ico16.png', + path: 'pages/fixture/fixture-list', + }, +]) + +const inspectMenu = reactive([ + /* { + id: 0, + name: '璁惧鐐规', + icon: '/static/menu/menu0.png', + path: 'pages/inspect/insp-add', + }, */ + { + id: 1, + name: '鐐规姹囨��', + icon: '/static/ico/ico17.png', + path: 'pages/inspect/insp-st', + }, + { + id: 2, + name: '淇濆吇姹囨��', + icon: '/static/ico/ico11.png', + path: 'pages/maint/maint-st', + }, + { + id: 3, + name: '鎶ヤ慨鍒楄〃', + icon: '/static/ico/ico18.png', + path: 'pages/repair/req-list', + }, + { + id: 4, + name: '缁翠慨鍒楄〃', + icon: '/static/ico/ico19.png', + path: 'pages/repair/res-list', }, ]) function handleUserInfo() { - getAllMenus() + goToMy() } +function goToMy() { + tabbarStore.setCurIdx(4) + uni.switchTab({ + url: '/pages/my/index', + }) +} +const realName = computed(() => userStore?.userInfo?.realName) </script> <style lang="scss" scoped> @@ -201,6 +277,9 @@ .slot-img { width: 72rpx; height: 72rpx; - border-radius: 8rpx; + margin-left: 4rpx; +} +:deep(.wd-grid-item__content) { + align-items: center; } </style> -- Gitblit v1.9.3