index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view class="msilde">
  3. <view class="left">
  4. <u-collapse accordion @open="current = -1">
  5. <u-collapse-item :title="d.deptName" name="Docs guide" v-for="(d, index) in list" :key="d.deptName">
  6. <view :class="{ active: index == current }" v-for="(i, index) in d.children" :key="i.deptName" class="item" @click="selected(i, index)">{{ i.deptName }}</view>
  7. </u-collapse-item>
  8. </u-collapse>
  9. </view>
  10. <view class="right">
  11. <view class="contents">
  12. <u-divider :text="item.deptName + '介绍'" v-if="item.deptName"></u-divider>
  13. <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>
  14. <u-parse :content="item.brief"></u-parse>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. item: {},
  24. current: -1,
  25. list: []
  26. };
  27. },
  28. onLoad(e) {
  29. this.getData();
  30. },
  31. methods: {
  32. getData() {
  33. this.http.request({
  34. url: '/app/department/list',
  35. success: (res) => {
  36. this.list = res.data.data;
  37. }
  38. });
  39. },
  40. selected(item, index) {
  41. this.current = index;
  42. this.http.request({
  43. url: '/app/department/detail/' + item.deptId,
  44. success: (res) => {
  45. this.item = res.data.data;
  46. this.item.brief = res.data.data.brief.replace(new RegExp('/profile/upload/', 'g'), this.http.ip + '/profile/upload/');
  47. }
  48. });
  49. }
  50. }
  51. };
  52. </script>
  53. <style lang="scss"></style>