participateTopic.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class='productSort'>
  3. <view class="title">
  4. 参与话题
  5. <text class="iconfont icon-guanbi5" @click="close"></text>
  6. </view>
  7. <view class="con-box">
  8. <view class='aside'>
  9. <scroll-view scroll-y="true" style="height: 100%; overflow: hidden;">
  10. <view v-for="(item,index) in productList" :key="item.category_id">
  11. <view v-show="item.children && item.children.length > 0" class='item acea-row row-center-wrapper' :class='index==navActive?"on":""' @click='tap(index,"b"+index)'><text class="item_text">{{item.cate_name}}</text>
  12. </view>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. <view class='conter'>
  17. <scroll-view scroll-y="true" style="height: 100%; overflow: hidden;">
  18. <view v-for="(item,index) in childList" :key="item.topic_id">
  19. <view class='list' @click.stop="confirmTopic(item)">
  20. <view class='item acea-row'>
  21. <view class='picture' :class="{iconjing : !item.pic}">
  22. <image :src='item.pic'></image>
  23. </view>
  24. <view class="name line1">{{item.topic_name}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. // +----------------------------------------------------------------------
  35. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  36. // +----------------------------------------------------------------------
  37. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  38. // +----------------------------------------------------------------------
  39. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  40. // +----------------------------------------------------------------------
  41. // | Author: CRMEB Team <admin@crmeb.com>
  42. // +----------------------------------------------------------------------
  43. let app = getApp();
  44. import { getTopicList } from '@/api/community.js';
  45. export default {
  46. data() {
  47. return {
  48. navlist: [],
  49. productList: [],
  50. navActive: 0,
  51. childList: []
  52. }
  53. },
  54. watch:{},
  55. mounted() {
  56. if (!this.productList.length) {
  57. this.getAllCategory();
  58. }
  59. },
  60. methods: {
  61. // 点击关闭按钮
  62. close() {
  63. this.$emit('close');
  64. },
  65. tap: function(index, id) {
  66. this.navActive = index;
  67. this.childList = this.productList[index].children
  68. },
  69. getAllCategory: function() {
  70. let that = this;
  71. let value = ""
  72. getTopicList().then(res => {
  73. let arr = [
  74. {category_id: "",count_use: 0,count_view: 0,pic: null,topic_id: '',topic_name: "不添加任何话题"}
  75. ]
  76. that.productList = res.data;
  77. if(that.productList[0].children && that.productList[0].children.length > 0){
  78. that.productList[0].children=[...arr,...that.productList[0].children]
  79. }else{
  80. that.productList[0].children = arr
  81. }
  82. that.childList = that.productList[0].children;
  83. })
  84. },
  85. confirmTopic(item){
  86. this.$emit('getTopic',item);
  87. }
  88. }
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .productSort {
  93. display: flex;
  94. flex-direction: column;
  95. width: 100%;
  96. height: 70vh;
  97. background: #ffffff;
  98. border-radius: 16rpx 16rpx 0 0;
  99. .title{
  100. text-align: center;
  101. padding: 40rpx 0;
  102. position: relative;
  103. color: #333333;
  104. font-size: 34rpx;
  105. font-weight: bold;
  106. .iconfont{
  107. color: #8A8A8A;
  108. font-size: 28rpx;
  109. position: absolute;
  110. right: 30rpx;
  111. top: 42rpx;
  112. font-weight: normal;
  113. }
  114. }
  115. .con-box {
  116. flex: 1;
  117. display: flex;
  118. overflow: hidden;
  119. }
  120. }
  121. .productSort .aside {
  122. overflow-y: auto;
  123. overflow-x: hidden;
  124. border-right: 1px solid #EEEEEE;
  125. width: 202rpx;
  126. height: 100%;
  127. overflow: hidden;
  128. }
  129. .productSort .aside .item {
  130. line-height: 100rpx;
  131. width: 100%;
  132. font-size: 26rpx;
  133. color: #666666;
  134. }
  135. .productSort .aside .item_text {
  136. padding-left: 20rpx;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. display: -webkit-box;
  140. -webkit-line-clamp: 2;
  141. -webkit-box-orient: vertical;
  142. }
  143. .productSort .aside .item.on {
  144. width: 100%;
  145. text-align: center;
  146. font-weight: bold;
  147. color: #333333;
  148. }
  149. .productSort .conter {
  150. flex: 1;
  151. height: 100%;
  152. padding: 0 30rpx;
  153. background-color: #ffffff;
  154. margin-top: 20rpx;
  155. }
  156. .productSort .conter .list {
  157. flex-wrap: wrap;
  158. }
  159. .productSort .conter .list .item {
  160. margin-top: 26rpx;
  161. margin-bottom: 40rpx;
  162. align-items: center;
  163. }
  164. .productSort .conter .list .item .picture {
  165. width: 88rpx;
  166. height: 88rpx;
  167. border-radius: 100%;
  168. position: relative;
  169. &.iconjing{
  170. &::before{
  171. content: "#";
  172. display: block;
  173. width: 88rpx;
  174. height: 88rpx;
  175. line-height: 88rpx;
  176. border-radius: 100%;
  177. color: #ffffff;
  178. font-size: 40rpx;
  179. text-align: center;
  180. position: absolute;
  181. top: 0;
  182. left: 0;
  183. background: rgba(0,0,0,.3);
  184. }
  185. }
  186. }
  187. .productSort .conter .listw:first-child .picture{
  188. &::before{
  189. content: "\\";
  190. background: #D8D8D8;
  191. }
  192. }
  193. .productSort .conter .list .item .picture image {
  194. width: 100%;
  195. height: 100%;
  196. border-radius: 100%;
  197. }
  198. .productSort .conter .list .name {
  199. margin-left: 30rpx;
  200. font-size: 28rpx;
  201. color: #282828;
  202. font-weight: bold;
  203. max-width: 300rpx;
  204. }
  205. </style>