diff --git a/pages/index/index.vue b/pages/index/index.vue
index 41dcbf9..78f58ad 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -8,30 +8,30 @@
-
+
雨管巡查
-
+
雨管养护
-
-
-
+
@@ -42,7 +42,7 @@
-
+
通用巡查
@@ -62,20 +62,54 @@
data() {
return {
title: '',
- userInfo: {}
+ userInfo: {
+ allow_menu_list: -1
+ },
+ isshowty: false,
+ isshowxc: false,
+ isshowyh: false,
+ isshowrc: false
}
},
onLoad() {
this.loadInfo();
- },
- mounted() {
- var a = document.getElementsByClassName('uni-page-head-btn')[0]
- a.style.display = 'none';
- },
- onNavigationBarButtonTap(val) {
- window.android.finish();
+ },
+ mounted() {
+ var a = document.getElementsByClassName('uni-page-head-btn')[0]
+ a.style.display = 'none';
+ },
+ watch: {
+ userInfo: {
+ // 每个属性值发生变化就会调用这个函数
+ handler(newVal, oldVal) {
+ this.isshowty = this.hasMenu(4);
+ this.isshowxc = this.hasMenu(1);
+ this.isshowyh = this.hasMenu(2);
+ this.isshowrc = this.hasMenu(3);
+ },
+ // 立即处理 进入页面就触发
+ immediate: true,
+ // 深度监听 属性的变化
+ deep: true
+ }
+ },
+ onNavigationBarButtonTap(val) {
+ window.android.finish();
},
methods: {
+ hasMenu(menu_id) {
+ if (this.userInfo.allow_menu_list == -1) return false;
+ if (this.userInfo.allow_menu_list.length == 0) {
+ return true;
+ } else {
+ let list = this.userInfo.allow_menu_list.filter((item) => {
+ return item == menu_id;
+ });
+
+ return list > 0;
+
+ }
+ },
loadInfo() {
let that = this;
this.util.request({
@@ -90,25 +124,25 @@
});
},
toview(type) {
- // let url = "/packageA/pages/generalPatrol/generalPatrol";
+ // let url = "/packageA/pages/generalPatrol/generalPatrol";
let url = "/road/road/road?type=general"
if (type == 2) {
url = "/pages/mine/mine"
- }
- if (type == 3) {
- // url = "/road/road/road?type=daily"
- url = "/packageB/pages/dailyInspection/dailyInspection"
- }
- if (type == 4) {
- url = "/road/road/road?type=rainmaintain"
- // url = "/rainmaintain/rainmaintain/rainmaintain"
- }
- if (type == 5) {
- url = "/road/road/road?type=raininspection"
- // url = "/raininspection/raininspection/raininspection"
- }
- // if (type == 6) {
- // url = "/order/order/order/order"
+ }
+ if (type == 3) {
+ // url = "/road/road/road?type=daily"
+ url = "/packageB/pages/dailyInspection/dailyInspection"
+ }
+ if (type == 4) {
+ url = "/road/road/road?type=rainmaintain"
+ // url = "/rainmaintain/rainmaintain/rainmaintain"
+ }
+ if (type == 5) {
+ url = "/road/road/road?type=raininspection"
+ // url = "/raininspection/raininspection/raininspection"
+ }
+ // if (type == 6) {
+ // url = "/order/order/order/order"
// }
uni.navigateTo({
url: url
diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue
index de03647..6c93b3c 100644
--- a/pages/mine/mine.vue
+++ b/pages/mine/mine.vue
@@ -8,40 +8,40 @@
-
+
我的巡查
-
+
我的养护
-
-
-
-
-
-
-
- 我的工单
-
-
+
+
+ 我的工单
+
+
+
+
+
+
+
我的日常监督巡查
-
+
@@ -56,13 +56,47 @@
data() {
return {
title: '',
- userInfo: {}
+ userInfo: {
+ allow_menu_list: -1
+ },
+ isshowty: false,
+ isshowxc: false,
+ isshowyh: false,
+ isshowrc: false
}
},
onLoad() {
this.loadInfo();
},
+ watch: {
+ userInfo: {
+ // 每个属性值发生变化就会调用这个函数
+ handler(newVal, oldVal) {
+ this.isshowty = this.hasMenu(4);
+ this.isshowxc = this.hasMenu(1);
+ this.isshowyh = this.hasMenu(2);
+ this.isshowrc = this.hasMenu(3);
+ },
+ // 立即处理 进入页面就触发
+ immediate: true,
+ // 深度监听 属性的变化
+ deep: true
+ }
+ },
methods: {
+ hasMenu(menu_id) {
+ if (this.userInfo.allow_menu_list == -1) return false;
+ if (this.userInfo.allow_menu_list.length == 0) {
+ return true;
+ } else {
+ let list = this.userInfo.allow_menu_list.filter((item) => {
+ return item == menu_id;
+ });
+
+ return list > 0;
+
+ }
+ },
loadInfo() {
let that = this;
this.util.request({
@@ -80,15 +114,15 @@
let url = "/packageA/pages/generalList/generalList";
if (type == 2) {
url = "/packageB/pages/dailyList/dailyList"
- }
- if (type == 3) {
- url = "/rainmaintain/rainmaintainlist/rainmaintainList"
- }
- if (type == 4) {
- url = "/raininspection/raininspectionlist/raininspectionList"
- }
- if (type == 5) {
- url = "/order/order/orderList/orderList"
+ }
+ if (type == 3) {
+ url = "/rainmaintain/rainmaintainlist/rainmaintainList"
+ }
+ if (type == 4) {
+ url = "/raininspection/raininspectionlist/raininspectionList"
+ }
+ if (type == 5) {
+ url = "/order/order/orderList/orderList"
}
uni.navigateTo({
url: url