| | |
| | | <template> |
| | | <view> |
| | | <u-collapse @change="change" @close="close" @open="open"> |
| | | <u-collapse-item :title="item.title" name="Docs guide" v-for="item in tree"> |
| | | <text class="u-collapse-content">1</text> |
| | | </u-collapse-item> |
| | | </u-collapse> |
| | | <view class="container" v-for="item in tree"> |
| | | <view :class="item.key"> |
| | | <view class="title" v-show="item.key == 'dept_id'"> |
| | | <view>{{item.title}}</view> |
| | | <view>+</view> |
| | | </view> |
| | | <view class="name" v-show="item.key == 'user_id'"> |
| | | <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>{{sub.title}}</view> |
| | | <view>+</view> |
| | | </view> |
| | | <view :class="sub.key" class="name" v-show="sub.key == 'user_id'"> |
| | | <view>{{sub.title}}</view> |
| | | <view>></view> |
| | | </view> |
| | | <view class="sub2" v-for="it in sub.children" style="margin-left: 1em;"> |
| | | <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>{{it.title}}</view> |
| | | <view>></view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | let res = await user.getUserTree() |
| | | if (res.code === 200) { |
| | | this.tree = [] |
| | | console.log(res.data); |
| | | for (let k of res.data) { |
| | | this.tree.push(k) |
| | | console.log(res.data[0]); |
| | | if (res.data[0].children) { |
| | | for (let k of res.data[0].children) { |
| | | this.tree.push(k) |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | } else if (res.code === 403) { |
| | | this.backLogin(res) |
| | |
| | | }, |
| | | change(e) { |
| | | // console.log('change', e) |
| | | }, |
| | | backLogin(res) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '../login/login' |
| | | }); |
| | | }, 1000); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .container { |
| | | margin: 16rpx; |
| | | min-height: 35rpx; |
| | | background-color: #FFF; |
| | | padding: 16rpx; |
| | | } |
| | | .box1 { |
| | | background-color: aqua; |
| | | } |
| | | .title { |
| | | box-shadow: -3px 0px 0px #55aaff; |
| | | padding-left: 5px; |
| | | font-size: 15px; |
| | | font-weight: 700; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | .sub-title { |
| | | box-shadow: -3px 0px 0px #55aa7f; |
| | | } |
| | | .name { |
| | | padding: 16rpx; |
| | | border-bottom: 1px solid #e7e7e7; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | </style> |