|
@@ -1,16 +1,15 @@
|
|
|
<template>
|
|
|
<view class="msilde">
|
|
|
<view class="left">
|
|
|
- <u-collapse accordion @open="current = -1">
|
|
|
- <u-collapse-item :title="d.deptName" name="Docs guide" v-for="(d, index) in list" :key="d.deptName">
|
|
|
- <view :class="{ active: index == current }" v-for="(i, index) in d.children" :key="i.deptName" class="item" @click="selected(i, index)">{{ i.deptName }}</view>
|
|
|
+ <u-collapse accordion :value="list[0].deptId">
|
|
|
+ <u-collapse-item :title="d.deptName" :name="d.deptId" v-for="(d, index) in list" :key="d.deptName">
|
|
|
+ <view :class="{ active: index == i.current }" v-for="(i, index) in d.children" :key="i.deptName" class="item" @click="selected(i, index)">{{ i.deptName }}</view>
|
|
|
</u-collapse-item>
|
|
|
</u-collapse>
|
|
|
</view>
|
|
|
<view class="right">
|
|
|
<view class="contents">
|
|
|
<u-divider :text="item.deptName + '介绍'" v-if="item.deptName"></u-divider>
|
|
|
- <image src="https://omo-oss-image.thefastimg.com/portal-saas/new2022102818501904409/cms/image/29a676ec-abc2-48fe-8657-ce8f05f8ceb2.jpg" mode="widthFix" style="width: 100%;height: 150px;" v-else></image>
|
|
|
<u-parse :content="item.brief"></u-parse>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -22,8 +21,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
item: {},
|
|
|
- current: -1,
|
|
|
- list: []
|
|
|
+ list: [{ deptId: 0 }]
|
|
|
};
|
|
|
},
|
|
|
onLoad(e) {
|
|
@@ -35,11 +33,15 @@ export default {
|
|
|
url: '/app/department/list',
|
|
|
success: (res) => {
|
|
|
this.list = res.data.data;
|
|
|
+ if (this.list.length > 0 && this.list[0].children.length > 0) {
|
|
|
+ this.selected(this.list[0].children[0], 0);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
selected(item, index) {
|
|
|
- this.current = index;
|
|
|
+ this.list.flatMap((i) => i.children).forEach((j) => (j.current = -1));
|
|
|
+ item.current = index;
|
|
|
this.http.request({
|
|
|
url: '/app/department/detail/' + item.deptId,
|
|
|
success: (res) => {
|