Przeglądaj źródła

对接动态菜单接口+信息管理加loading

ming 2 lat temu
rodzic
commit
22c3590332

+ 19 - 0
src/api/index/index.js

@@ -1,5 +1,24 @@
 import request from "@/utils/request";
 import request from "@/utils/request";
 
 
+// 动态菜单请求
+export function getAppRouters(param) {
+  return request({
+    url: "/system/sysMobileMenu/getAppRouters",
+    method: "GET",
+    data: param,
+  });
+}
+
+// 动态菜单请求
+export function getRouters(param) {
+  return request({
+    url: "/system/sysMobileMenu/getRouters",
+    method: "GET",
+    data: param,
+  });
+}
+
+
 // 扫码请求
 // 扫码请求
 export function scan_push(param) {
 export function scan_push(param) {
   return request({
   return request({

+ 38 - 11
src/pages/business/mhxf/informationSelect/index.vue

@@ -35,11 +35,13 @@
 
 
 <script setup>
 <script setup>
 import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
 import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
-import { ref, onMounted, inject, shallowRef, reactive, watchEffect } from "vue";
+import { ref, onMounted, inject, shallowRef, reactive, watchEffect,getCurrentInstance } from "vue";
 import useXunJianStore from "@/store/modules/xunJian";
 import useXunJianStore from "@/store/modules/xunJian";
 
 
 import { dataList } from "@/api/business/mhxf/informationSelect";
 import { dataList } from "@/api/business/mhxf/informationSelect";
 
 
+const { proxy } = getCurrentInstance();
+
 const settingsStore = useXunJianStore(); //全局变量值Store
 const settingsStore = useXunJianStore(); //全局变量值Store
 
 
 const dataInput = ref("");
 const dataInput = ref("");
@@ -276,24 +278,49 @@ function goSearch() {
 }
 }
 
 
 //分类信息查询 start
 //分类信息查询 start
-function classifySearch(URL, params) {
+async function classifySearch(URL, params) {
+  proxy.$modal.loading("加载中");
   classifyData.value = [];
   classifyData.value = [];
-
   dataList(URL, params).then((res) => {
   dataList(URL, params).then((res) => {
+	  proxy.$modal.closeLoading();
     if (res.status == "SUCCESS") {
     if (res.status == "SUCCESS") {
+		
       if (current.value == 2) {
       if (current.value == 2) {
+		  if(res.data.length){
+		  	 dataRes.value = 1;
+		  }else{
+		  	dataRes.value = 0;
+		  }
         var records = res.data[0][0];
         var records = res.data[0][0];
+		
       } else if (current.value == 3) {
       } else if (current.value == 3) {
-        var records = res.data.data[0];
+		  if(res.data.length){
+		  	 dataRes.value = 1;
+		  }else{
+		  	dataRes.value = 0;
+		  }
+
+        var records = res.data[0];
       } else {
       } else {
+		  //  console.log('111111111')
+		  // console.log(res.data.records.length)
+		  //  console.log('111222')
+		  if(res.data.records.length){
+		  	 dataRes.value = 1;
+		  }else{
+		  	dataRes.value = 0;
+		  }
         var records = res.data.records[0];
         var records = res.data.records[0];
       }
       }
-      if (!records) {
-        dataRes.value = 0;
-      } else {
-        dataRes.value = 1;
-      }
-
+	  
+	  
+	  
+   //    if (!records) {
+   //      dataRes.value = 0;
+   //    } else {
+   //      dataRes.value = 1;
+   //    }
+	  
       switch (current.value) {
       switch (current.value) {
         case 0: //警情查询
         case 0: //警情查询
           var classifyTitle = [
           var classifyTitle = [
@@ -581,7 +608,7 @@ function classifySearch(URL, params) {
         obj.value = classifyValue[i];
         obj.value = classifyValue[i];
         classifyData.value.push(obj);
         classifyData.value.push(obj);
 
 
-        console.log(classifyData.value);
+        // console.log(classifyData.value);
       }
       }
     } else {
     } else {
     }
     }

+ 50 - 14
src/pages/index.vue

@@ -120,11 +120,11 @@
         <view style="color: #000000; font-size: 14px; padding: 10px 10px 5px 10px">最近使用</view>
         <view style="color: #000000; font-size: 14px; padding: 10px 10px 5px 10px">最近使用</view>
         <view class="cu-list grid col-5 no-border">
         <view class="cu-list grid col-5 no-border">
           <view class="cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in arrayList.recentlyUsed" :key="index">
           <view class="cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in arrayList.recentlyUsed" :key="index">
-            <image :src="item.imgUrl" style="width: 40px; height: 40px"></image>
-            <view class="cu-tag badge" v-if="item.badge != 0">
+            <image :src="item.icon" style="width: 40px; height: 40px"></image>
+            <!-- <view class="cu-tag badge" v-if="item.badge != 0">
               <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
               <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
-            </view>
-            <text style="font-size: 13px">{{ item.name }}</text>
+            </view> -->
+            <text style="font-size: 13px">{{ item.menuName }}</text>
           </view>
           </view>
         </view>
         </view>
       </view>
       </view>
@@ -135,11 +135,11 @@
         <view style="color: #000000; font-size: 14px; padding: 10px 10px 5px 10px">常用功能</view>
         <view style="color: #000000; font-size: 14px; padding: 10px 10px 5px 10px">常用功能</view>
         <view class="cu-list grid col-5 no-border">
         <view class="cu-list grid col-5 no-border">
           <view class="cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in arrayList.cuIconList" :key="index">
           <view class="cu-item justify-center align-center" @tap="navItemClick(item)" v-for="(item, index) in arrayList.cuIconList" :key="index">
-            <image :src="item.imgUrl" style="width: 40px; height: 40px"></image>
-            <view class="cu-tag badge" v-if="item.badge != 0">
+            <image :src="item.icon" style="width: 40px; height: 40px"></image>
+           <!-- <view class="cu-tag badge" v-if="item.badge != 0">
               <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
               <block v-if="item.badge != 0">{{ item.badge > 99 ? "99+" : item.badge }}</block>
-            </view>
-            <text style="font-size: 13px">{{ item.name }}</text>
+            </view> -->
+            <text style="font-size: 13px">{{ item.menuName }}</text>
           </view>
           </view>
         </view>
         </view>
       </view>
       </view>
@@ -158,7 +158,7 @@ import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni
 import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance } from "vue";
 import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance } from "vue";
 import useXunJianStore from "@/store/modules/xunJian.js";
 import useXunJianStore from "@/store/modules/xunJian.js";
 
 
-import { scan_push, getHomePageData, getFunctionalModuleStatistics } from "@/api/index";
+import { scan_push, getHomePageData, getFunctionalModuleStatistics,getAppRouters,getRouters } from "@/api/index";
 
 
 const settingsStore = useXunJianStore(); //全局变量值Store
 const settingsStore = useXunJianStore(); //全局变量值Store
 const BASE_URL = inject("$BASE_URL");
 const BASE_URL = inject("$BASE_URL");
@@ -178,11 +178,15 @@ const arrayList = reactive({
   codeResult: "",
   codeResult: "",
 
 
   swiperList: ["../static/images/index/banner1.png", "../static/images/index/banner2.jpg", "../static/images/index/banner3.jpg"],
   swiperList: ["../static/images/index/banner1.png", "../static/images/index/banner2.jpg", "../static/images/index/banner3.jpg"],
-  cuIconList: json.cuIconList,
+  // cuIconList: json.cuIconList,
   recentlyUsed: [],
   recentlyUsed: [],
 });
 });
 
 
 onLoad((option) => {
 onLoad((option) => {
+	
+	
+	
+	
   //获取首页标题
   //获取首页标题
   if (uni.getStorageSync("homeTitle")) {
   if (uni.getStorageSync("homeTitle")) {
     uni.setNavigationBarTitle({
     uni.setNavigationBarTitle({
@@ -211,6 +215,13 @@ onLoad((option) => {
   // nextTick(() => {
   // nextTick(() => {
   //   hackReset.value = true;
   //   hackReset.value = true;
   // });
   // });
+  
+  
+  
+  
+  
+  getAppRoutersData()
+  getRoutersData()
 });
 });
 
 
 async function init() {
 async function init() {
@@ -285,18 +296,18 @@ function getLocation() {
 
 
 // 九宫格页面跳转
 // 九宫格页面跳转
 function navItemClick(item) {
 function navItemClick(item) {
-  if (item.redirectUrl) {
+  if (item.path) {
     item.sort = 0;
     item.sort = 0;
 
 
     arrayList.recentlyUsed.push(item);
     arrayList.recentlyUsed.push(item);
 
 
     if (arrayList.recentlyUsed.length > 0) {
     if (arrayList.recentlyUsed.length > 0) {
       arrayList.recentlyUsed = arrayList.recentlyUsed.filter((currentValue, currentIndex, selfArr) => {
       arrayList.recentlyUsed = arrayList.recentlyUsed.filter((currentValue, currentIndex, selfArr) => {
-        return selfArr.findIndex((x) => x.redirectUrl === currentValue.redirectUrl) === currentIndex;
+        return selfArr.findIndex((x) => x.path === currentValue.path) === currentIndex;
       });
       });
 
 
       arrayList.recentlyUsed.filter((el) => {
       arrayList.recentlyUsed.filter((el) => {
-        if (el.redirectUrl === item.redirectUrl) {
+        if (el.path === item.path) {
           el.sort++;
           el.sort++;
         }
         }
       });
       });
@@ -307,7 +318,7 @@ function navItemClick(item) {
     uni.setStorageSync("recentlyUsed", arrayList.recentlyUsed);
     uni.setStorageSync("recentlyUsed", arrayList.recentlyUsed);
 
 
     uni.navigateTo({
     uni.navigateTo({
-      url: item.redirectUrl,
+      url: item.path,
     });
     });
   } else {
   } else {
     uni.showModal({
     uni.showModal({
@@ -358,7 +369,30 @@ function InputFocus(e) {
 
 
 function InputBlur(e) {
 function InputBlur(e) {
   arrayList.InputBottom = 0;
   arrayList.InputBottom = 0;
+  
 }
 }
+
+function getAppRoutersData() {
+  getAppRouters({
+   domain :'localhost:81'
+  }).then((res) => {
+	  console.log(res.data)
+	  arrayList.cuIconList=res.data
+	  console.log(window.location.host)
+   
+  });
+} 
+function getRoutersData() {
+  getRouters({
+  }).then((res) => {
+	  console.log(res.data)
+	  console.log(1)
+   
+  });
+} 
+
+
+
 //echarts图表请求
 //echarts图表请求
 async function getHomeData(param = {}) {
 async function getHomeData(param = {}) {
   getHomePageData(param).then((res) => {
   getHomePageData(param).then((res) => {
@@ -405,6 +439,8 @@ async function getHomeData(param = {}) {
   });
   });
 }
 }
 
 
+
+
 // 未处理告警请求
 // 未处理告警请求
 async function getHandleData(param = {}) {
 async function getHandleData(param = {}) {
   getFunctionalModuleStatistics(param).then((res) => {
   getFunctionalModuleStatistics(param).then((res) => {