list.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="video-comment-list-page">
  3. <van-sticky v-if="!id">
  4. <view @click="goSearch">
  5. <van-search :value="key_word" shape="round" placeholder="评论内容" disabled />
  6. </view>
  7. <view class="tabs-box">
  8. <text :class="source===3?'active':''" @click="handleTypeChange(3)">线上路演</text>
  9. <text :class="source===2?'active':''" @click="handleTypeChange(2)">视频社区</text>
  10. </view>
  11. </van-sticky>
  12. <view class="list-wrap">
  13. <view class="question-item" v-for="(item,index) in list" :key="item.CommunityQuestionCommentId">
  14. <view class="cont">
  15. <veiw class="item-title">{{item.Content}}</veiw>
  16. <view class="row">视频分类:{{source===3?'线上路演':'视频社区'}}</view>
  17. <view class="row">视频标题:{{item.QuestionContent}}</view>
  18. <view class="row">所属{{source===3?'品种':'标签'}}:{{item.TagName}}</view>
  19. <view class="row">评论人:{{item.UserName}}</view>
  20. <view class="row">客户信息:{{item.CompanyName}} <text v-if="item.CompanyProductStatus">({{item.CompanyProductStatus}})</text> </view>
  21. <view class="row">评论时间:{{item.CreateTime | formatTime}}</view>
  22. </view>
  23. <view class="action-bot flex">
  24. <text class="red-color" v-if="showDelBtn" @click="delHandle(item,index)">删除</text>
  25. </view>
  26. </view>
  27. </view>
  28. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
  29. </view>
  30. </template>
  31. <script>
  32. import {apiCommentList,apiDelComment} from '@/api/question/index'
  33. export default {
  34. computed: {
  35. showDelBtn(){
  36. const userInfo = this.$store.state.userInfo;
  37. return ['ficc_admin','admin'].includes(userInfo.RoleTypeCode)
  38. }
  39. },
  40. data() {
  41. return {
  42. id:0,
  43. key_word:'',
  44. page:1,
  45. pageSize:20,
  46. list:[],
  47. finished:false,
  48. source:3
  49. }
  50. },
  51. onLoad(options){
  52. this.id=options.id||0
  53. this.source=Number(options.source)||3
  54. this.getList()
  55. // 搜索返回
  56. uni.$on('videoCommentUpdate',({key_word})=>{
  57. this.key_word = key_word;
  58. this.page = 1;
  59. this.list=[]
  60. this.finished=false
  61. this.getList()
  62. })
  63. },
  64. onUnload() {
  65. uni.$off('videoCommentUpdate')
  66. },
  67. onPullDownRefresh() {
  68. this.page=1
  69. this.finished=false
  70. this.list=[]
  71. this.key_word = ''
  72. this.getList()
  73. setTimeout(()=>{
  74. uni.stopPullDownRefresh()
  75. },1500)
  76. },
  77. onReachBottom() {
  78. if(this.finished) return
  79. this.page++
  80. this.getList()
  81. },
  82. methods: {
  83. async getList(){
  84. const res=await apiCommentList({
  85. Keyword:this.key_word,
  86. CurrentIndex:this.page,
  87. PageSize:this.pageSize,
  88. Source:this.source,
  89. HotStatus:-1,
  90. CommunityQuestionCommentId:Number(this.id)
  91. })
  92. if(res.code===200){
  93. this.finished=res.data.Paging.IsEnd
  94. this.list=[...this.list,...res.data.List]
  95. }
  96. },
  97. /* 删除 */
  98. delHandle(item,index) {
  99. wx.showModal({
  100. title: "",
  101. content: `评论删除后不可恢复,确认删除吗`,
  102. confirmColor: "#EE3636",
  103. cancelColor: '#333',
  104. success: async (res) => {
  105. if(res.cancel) return
  106. const { CommunityQuestionCommentId } = item;
  107. const { code } = await apiDelComment({ CommunityQuestionCommentId: CommunityQuestionCommentId });
  108. if( code !== 200 ) return
  109. wx.showToast({title: '删除成功'})
  110. this.list.splice(index,1)
  111. }
  112. })
  113. },
  114. /* 搜索 */
  115. goSearch() {
  116. uni.navigateTo({
  117. url: `/pages-approve/search/index?type=videoComment`,
  118. })
  119. },
  120. handleTypeChange(e){
  121. this.source=e
  122. // this.key_word = '';
  123. this.page = 1;
  124. this.list=[]
  125. this.finished=false
  126. this.getList()
  127. }
  128. },
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .red-color {
  133. color: #D63535;
  134. }
  135. .list-wrap{
  136. padding: 40rpx 20rpx;
  137. }
  138. .flex {
  139. display: flex;
  140. align-items: center;
  141. }
  142. .question-item {
  143. background: #fff;
  144. padding: 20rpx 0 0;
  145. border-radius: 8rpx;
  146. font-size: 28rpx;
  147. margin-bottom: 20rpx;
  148. color: #666;
  149. .cont {
  150. padding: 0 20rpx;
  151. }
  152. .item-title {
  153. color: #333;
  154. font-size: 32rpx;
  155. }
  156. .row {
  157. margin: 15rpx 0;
  158. }
  159. .item-bottom {
  160. justify-content: space-between;
  161. .select-wrapper {
  162. width: 250rpx;
  163. border: 1px solid #F1F2F6;
  164. padding: 0 40rpx 0 20rpx;
  165. position: relative;
  166. .ipt {
  167. height: 80rpx;
  168. line-height: 80rpx;
  169. }
  170. }
  171. }
  172. .action-bot {
  173. border-top: 1px solid #EAEAEA;
  174. margin-top: 30rpx;
  175. text {
  176. padding: 24rpx 0;
  177. flex: 1;
  178. text-align: center;
  179. border-right: 1px solid #EAEAEA;
  180. &:last-child { border: none; }
  181. }
  182. }
  183. }
  184. .tabs-box{
  185. background-color: #fff;
  186. padding: 10px 12px 0 12px;
  187. text{
  188. display: inline-block;
  189. margin-right: 60rpx;
  190. padding-bottom: 13rpx;
  191. &.active{
  192. border-bottom: 2px solid #3385FF;
  193. }
  194. }
  195. }
  196. </style>