helpcenter.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div style="background-color:white;height: 100%;">
  3. <div v-loading="datas.loading">
  4. <el-scrollbar>
  5. <div class="flex justify-flex-start">
  6. <div class="scrollbar-demo-item flex column center" v-for="(item,index) in datas.categoryList" :key="index"
  7. @click="onCategoryClick(index)">
  8. <div :class="{'font_bold':item.isSelect}">{{item.name}}</div>
  9. <div :class="{'line_active':item.isSelect}"></div>
  10. </div>
  11. </div>
  12. </el-scrollbar>
  13. <el-scrollbar>
  14. <div style="padding-left:20px;padding-right:20px;" v-if="datas.detailList.length>0">
  15. <div class="mt-20" v-for="(item,index) in datas.detailList" :key="index" v-loading="datas.listLoading" @click="onGoDetail(item.id)">
  16. <div class="flex justify-space-between ">
  17. <div style="font-size:15px;color:#25272B">{{item.helpTitle}}</div>
  18. <div>
  19. <el-image :src="navIocn" style="width:20px;"></el-image>
  20. </div>
  21. </div>
  22. <div style="width:100%;height:1px;background-color:#F3F1F1;" class="mt-15"></div>
  23. </div>
  24. </div>
  25. <div class="flex center mt-100" v-else>
  26. <el-empty image-size="100" description="暂无数据" />
  27. </div>
  28. </el-scrollbar>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup lang="ts">
  33. import Vue, { reactive } from 'vue'
  34. import { getHelpCategoryList, getInfoList } from '/@/api/frontend/helpcenter'
  35. import navIocn from '/@/assets/list_nav_go_icon.svg'
  36. import {useRouter} from 'vue-router'
  37. const router = useRouter()
  38. const datas = reactive({
  39. loading: false,
  40. listLoading:false,
  41. categoryList: [] as any,
  42. detailList: [],
  43. })
  44. getHelpCategoryList().then((res) => {
  45. if (res.data) {
  46. let count = 0
  47. res.data.map((item: any) => {
  48. let subItem = {
  49. name: '',
  50. id: '',
  51. isSelect: false,
  52. }
  53. if (count === 0) {
  54. subItem.isSelect = true
  55. } else {
  56. subItem.isSelect = false
  57. }
  58. subItem.id = item.id
  59. subItem.name = item.value
  60. datas.categoryList.push(subItem)
  61. count++
  62. })
  63. getList(res.data[0].id)
  64. }
  65. })
  66. const getList = (val: any) => {
  67. let params = {
  68. page: 1,
  69. limit: 200,
  70. typeId: val,
  71. }
  72. datas.listLoading=true
  73. getInfoList(params).then((res) => {
  74. datas.detailList = res.data.list
  75. datas.listLoading=false
  76. }).catch(()=>{
  77. datas.listLoading=false
  78. })
  79. }
  80. const onCategoryClick = (index: number) => {
  81. datas.categoryList.map((item:any) => {
  82. item.isSelect = false
  83. })
  84. datas.categoryList[index].isSelect = true
  85. getList(datas.categoryList[index].id)
  86. }
  87. const onGoDetail=(id:any)=>{
  88. let info={id:id}
  89. router.push({name: 'helpdetail', query: info})
  90. }
  91. </script>
  92. <style scoped>
  93. .scrollbar-flex-content {
  94. display: flex;
  95. }
  96. .scrollbar-demo-item {
  97. flex-shrink: 0;
  98. display: flex;
  99. align-items: flex-start;
  100. justify-content: flex-start;
  101. font-size: 16px;
  102. width: 80px;
  103. height: 30px;
  104. margin: 20px;
  105. text-align: center;
  106. border-radius: 4px;
  107. color: black;
  108. }
  109. .font_bold {
  110. font-weight: bold;
  111. }
  112. .line_active {
  113. width: 30px;
  114. height: 3px;
  115. background-color: #9c4dc5;
  116. border-radius: 3px;
  117. }
  118. .line_disable {
  119. width: 30px;
  120. height: 3px;
  121. background-color: #ffffff;
  122. border-radius: 3px;
  123. }
  124. </style>
  125. function getHelpCategoryList() {
  126. throw new Error('Function not implemented.')
  127. }