yangg 1 год назад
Родитель
Сommit
04411d01e6
3 измененных файлов с 37 добавлено и 29 удалено
  1. 3 0
      src/api/api.ts
  2. 4 3
      src/components/layout/Header.vue
  3. 30 26
      src/views/apps/applist.vue

+ 3 - 0
src/api/api.ts

@@ -86,6 +86,9 @@ export class infoApi {     // 字典,仓库,客户
     static async getMenu(parent_id=0) {//客户列表
         return request(`admin/systems/menus/children/${parent_id}`, '', 'get')
     }
+    static async getPdaMenu() {//客户列表
+        return request(`/admin/systems/menus/getPdaMenu`, '', 'get')
+    }
    
 }
 export class dictionaryAPI {

+ 4 - 3
src/components/layout/Header.vue

@@ -171,6 +171,7 @@
                         <Popper :placement="store.rtlClass === 'rtl' ? 'bottom-end' : 'bottom-start'" offsetDistance="8"
                             class="!block">
                             <button type="button" class="relative group block">
+                                <!-- <img class="rounded-md w-10 h-10 object-cover" :src="face" alt="" /> -->
                                 <img class="w-9 h-9 rounded-full object-cover saturate-50 group-hover:saturate-100"
                                     :src="face" alt="" />
                             </button>
@@ -282,9 +283,9 @@ const currentFlag = computed(() => {
 });
 const init = (uid) => {
     infoApi.getUser(uid).then((res: any) => {
-        face = res.data.face
-        nickName = res.data.nickname
-        email = res.data.email
+        face.value = res.data.face
+        nickName.value = res.data.nickname
+        email.value = res.data.email
     })
 }
 const notifications = ref([

+ 30 - 26
src/views/apps/applist.vue

@@ -1,6 +1,6 @@
 <template>
 
-   <!--  <ul class="flex space-x-2 rtl:space-x-reverse">
+    <!--  <ul class="flex space-x-2 rtl:space-x-reverse">
         <li>
             <a href="javascript:;" class="text-primary hover:underline">首页</a>
         </li>
@@ -10,8 +10,11 @@
     </ul> -->
     <div class="grid grid-cols-2 gap-8">
         <div v-for="(item, index) in cols" :key="index" @click="goPageList(item)">
-            
-            <svg class="w-40 h-40 text-gray-500 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
+           <!--  {{ menuList }} -->
+            <div v-for="(it) in menuList" :key="it.id">
+                <img v-if="it.title==item.title" :src="it.icon" alt="">
+            </div>
+            <!-- <svg class="w-40 h-40 text-gray-500 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
                 fill="currentColor" viewBox="0 0 24 24">
                 <path fill-rule="evenodd"
                     d="M11.32 6.176H5c-1.105 0-2 .949-2 2.118v10.588C3 20.052 3.895 21 5 21h11c1.105 0 2-.948 2-2.118v-7.75l-3.914 4.144A2.46 2.46 0 0 1 12.81 16l-2.681.568c-1.75.37-3.292-1.263-2.942-3.115l.536-2.839c.097-.512.335-.983.684-1.352l2.914-3.086Z"
@@ -19,11 +22,14 @@
                 <path fill-rule="evenodd"
                     d="M19.846 4.318a2.148 2.148 0 0 0-.437-.692 2.014 2.014 0 0 0-.654-.463 1.92 1.92 0 0 0-1.544 0 2.014 2.014 0 0 0-.654.463l-.546.578 2.852 3.02.546-.579a2.14 2.14 0 0 0 .437-.692 2.244 2.244 0 0 0 0-1.635ZM17.45 8.721 14.597 5.7 9.82 10.76a.54.54 0 0 0-.137.27l-.536 2.84c-.07.37.239.696.588.622l2.682-.567a.492.492 0 0 0 .255-.145l4.778-5.06Z"
                     clip-rule="evenodd" />
-            </svg>
+            </svg> -->
+            <div class="h-4 mx-10 my-2">
+                <span class="text-center text-base font-bold whitespace-nowrap">{{
+                    item.title }}</span>
+            </div>
 
-            <div class="h-4 mx-10 my-2"><span class="text-center text-base font-bold whitespace-nowrap">{{ item.title }}</span></div>
         </div>
-     <!--    <div>
+        <!--    <div>
             <svg class="w-40 h-40 text-gray-500 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
                 fill="currentColor" viewBox="0 0 24 24">
                 <path fill-rule="evenodd"
@@ -71,21 +77,21 @@ import { ref, computed, onMounted, inject } from 'vue'; // Added onMounted here
 import { useAppStore } from '@/stores/index';
 import { useMeta } from '@/composables/use-meta';
 import router from '@/router';
-import {infoApi } from '@/api/api'
+import { infoApi } from '@/api/api'
 import { AxiosInstance } from 'axios';
 const $axios = inject('axios') as AxiosInstance;
 const cols: any = ref([
-    { path: 'InventoryList', title: '库存列表',  },
-    { path: 'locationList', title: '库位管理'},
-    { path: 'InventoryLoss', title: '库存报损'},
-    { path: 'warehouseList', title: '仓库列表'},
-    { path: 'locationArea', title: '库位区域'},
-    /* { path: 'order_vo.pay_type', title: '冻结列表'}, 
+    { path: 'InventoryList', title: '库存列表', },
+    { path: 'locationList', title: '库位管理' },
+    { path: 'InventoryLoss', title: '库存报损' },
+    { path: 'warehouseList', title: '仓库列表' },
+     /*{ path: 'locationArea', title: '库位区域' },
+    { path: 'order_vo.pay_type', title: '冻结列表'}, 
     { path: 'orderList', title: '订单列表' },
     { path: 'actions', title: '售后列表'},
     { path: 'actions', title: '商品列表'} */
 ]);
-const menuList:any={}
+let menuList = ref('')
 
 const godashbord = () => {
     router.push(({ path: '/' }))
@@ -115,22 +121,20 @@ const fetchData = async () => {
         console.error('API Error:', error);
     }
 };
-const init=()=>{
-    infoApi.getMenu().then((res:any)=>{
-        res.map(el => {
-          el.children.map(e => {
-            if (e.show_home == 1) {
-              menuList.push(e)
-            }
-          })
-        })
-    })
+const init = async () => {
+    try {
+        const res:any = await infoApi.getPdaMenu();
+        menuList.value = res.data;
+        console.log(menuList.value);
+    } catch (error) {
+        console.error('Error fetching menu data:', error);
+    }
 }
 
 // 在组件加载时调用 fetchData
 onMounted(() => {
-   /*  init() */
-   /*  fetchData(); */
+    init()
+    /*  fetchData(); */
 });
 </script>
 <style>