From 334cf9c6946d3783144448e645b4fddeeedcccba Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 23 十月 2023 10:02:50 +0800
Subject: [PATCH] #
---
pages/authority/authority.vue | 57 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/pages/authority/authority.vue b/pages/authority/authority.vue
index 844fe0e..acab027 100644
--- a/pages/authority/authority.vue
+++ b/pages/authority/authority.vue
@@ -1,29 +1,35 @@
<template>
<view>
- <view class="container" v-for="item in tree">
+ <view class="container" v-for="(item,i) in tree" :key="i">
<view :class="item.key">
- <view class="title" v-show="item.key == 'dept_id'">
+ <view class="title" v-show="item.key == 'dept_id'" @click="switchbtn(item)">
<view>{{item.title}}</view>
- <view>+</view>
+ <view >
+ <uni-icons type="top" v-show="item.switch"></uni-icons>
+ <uni-icons type="bottom" v-show="!item.switch"></uni-icons>
+ </view>
</view>
- <view class="name" v-show="item.key == 'user_id'">
+ <view class="name" v-show="item.key == 'user_id'" @click="back()">
<view>{{item.title}}</view>
- <view>></view>
</view>
- <view class="sub1" v-for="sub in item.children" style="margin-left: 1em;" v-show="true">
- <view :class="sub.key" class="title sub-title" v-show="sub.key == 'dept_id'">
+ <view class="sub1" v-for="sub in item.children" style="margin-left: 1em;" v-show="item.switch">
+ <view :class="sub.key" class="title sub-title" v-show="sub.key == 'dept_id'" @click="switchbtn(sub)">
<view>{{sub.title}}</view>
- <view>+</view>
+ <view>
+ <!-- <uni-icons type="bottom"></uni-icons> -->
+ <uni-icons type="top" v-show="sub.switch"></uni-icons>
+ <uni-icons type="bottom" v-show="!sub.switch"></uni-icons>
+ </view>
</view>
- <view :class="sub.key" class="name" v-show="sub.key == 'user_id'">
+
+ <view :class="sub.key" class="name" v-show="sub.key == 'user_id'" @click="back()">
<view>{{sub.title}}</view>
- <view>></view>
</view>
- <view class="sub2" v-for="it in sub.children" style="margin-left: 1em;">
+
+ <view class="sub2" v-for="it in sub.children" style="margin-left: 1em;" v-show="sub.switch">
<view :class="it.key" class="title sub-title" v-show="it.key == 'dept_id'">{{it.title}}</view>
- <view :class="it.key" class="name" v-show="it.key == 'user_id'">
+ <view :class="it.key" class="name" v-show="it.key == 'user_id'" @click="back()">
<view>{{it.title}}</view>
- <view>></view>
</view>
</view>
</view>
@@ -51,14 +57,28 @@
console.log(res.data[0]);
if (res.data[0].children) {
for (let k of res.data[0].children) {
+
+ if (k.children && k.children.length > 0) {
+ for (let i of k.children) {
+ i['switch'] = true
+ console.log(i);
+ }
+ }
+ // console.log(k);
+ k['switch'] = true
this.tree.push(k)
}
} else {
-
+ this.tree.push(res.data[0])
}
} else if (res.code === 403) {
this.backLogin(res)
}
+ console.log(this.tree);
+ },
+ switchbtn(item) {
+ console.log(item);
+ item.switch = item.switch ? false : true
},
open(e) {
// console.log('open', e)
@@ -76,6 +96,12 @@
url: '../login/login'
});
}, 1000);
+ },
+ back() {
+ uni.$emit('isRefresh', 1)
+ uni.navigateBack({
+
+ })
}
}
}
@@ -101,13 +127,14 @@
align-items: center;
}
.sub-title {
+ margin: 16rpx;
box-shadow: -3px 0px 0px #55aa7f;
}
.name {
padding: 16rpx;
- border-bottom: 1px solid #e7e7e7;
display: flex;
justify-content: space-between;
align-items: center;
}
+
</style>
\ No newline at end of file
--
Gitblit v1.9.1