videoList.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view class="video-list-page">
  3. <van-sticky style="background: #fff">
  4. <view class="flex search-wrap">
  5. <view @click="goSearchPage" style="flex:1;margin-right:30rpx" >
  6. <searchBox
  7. placeholder="关键字搜索"
  8. :hasRightBtn="false"
  9. :disabled="true"
  10. ></searchBox>
  11. </view>
  12. <view class="flex" @click="showFilter=true">
  13. <image style="width:50rpx;height:50rpx" src="@/static/filter-icon.png" mode="aspectFill"/>
  14. <text style="color:#E3B377;font-size:32rpx">筛选</text>
  15. </view>
  16. </view>
  17. </van-sticky>
  18. <view class="empty-box" v-if="list.length==0&&finished">
  19. <image
  20. :src="globalImgUrls.activityNoAuth"
  21. mode="widthFix"
  22. />
  23. <view>暂无数据</view>
  24. </view>
  25. <view class="list-wrap">
  26. <view class="item" v-for="item in list" :key="item.community_video_id">
  27. <view class="title-box">
  28. <text class="tag">{{item.chart_permission_name}}</text>
  29. <text class="title">{{item.title}}</text>
  30. </view>
  31. <button
  32. class="share-btn"
  33. open-type="share"
  34. :data-item="item">
  35. <image class="share-img" src="@/static/share-icon.png" mode="aspectFill"/>
  36. </button>
  37. <video
  38. object-fit="cover"
  39. show-mute-btn
  40. :poster="item.cover_img_url"
  41. :src="item.video_url"
  42. enable-play-gesture
  43. ></video>
  44. <view class="time">发布时间:{{item.publish_time}}</view>
  45. </view>
  46. </view>
  47. <!-- 筛选 -->
  48. <van-popup
  49. :show="showFilter"
  50. position="bottom"
  51. :safe-area-inset-bottom="true"
  52. round
  53. @close="showFilter=false"
  54. >
  55. <view class="filter-wrap">
  56. <view class="flex top">
  57. <text style="color:#000">全部筛选</text>
  58. <text style="color:#E3B377" @click="showFilter=false">取消</text>
  59. </view>
  60. <view class="list-box">
  61. <van-collapse accordion @change="change" :value="active" :border="false">
  62. <van-collapse-item
  63. :title="item.ClassifyName"
  64. :name='item.ClassifyName'
  65. :border="false"
  66. v-for="item in options"
  67. :key="item.ClassifyName"
  68. >
  69. <van-row gutter="5">
  70. <van-col
  71. :span="_item.PermissionName.length>7?16:8"
  72. v-for="_item in item.Items"
  73. :key="_item.PermissionId"
  74. >
  75. <text
  76. :class="['list-item',_item.PermissionId==selectPerId&&'list-item-active']"
  77. @click="handleSelectPerItem(_item)"
  78. >{{_item.PermissionName}}</text>
  79. </van-col>
  80. </van-row>
  81. </van-collapse-item>
  82. </van-collapse>
  83. </view>
  84. </view>
  85. </van-popup>
  86. </view>
  87. </template>
  88. <script>
  89. import {apiVideoList} from '@/api/video'
  90. import {apiOptionList} from '@/api/question'
  91. export default {
  92. data() {
  93. return {
  94. showFilter:false,
  95. active:'',
  96. options:[],
  97. selectPerId:0,
  98. videoId:0,
  99. page:1,
  100. pageSize:10,
  101. finished:false,
  102. list:[]
  103. }
  104. },
  105. onLoad(options){
  106. this.videoId=options.videoId||0
  107. this.getList()
  108. this.getPermissionList()
  109. },
  110. onShareAppMessage({from,target}) {
  111. console.log(from,target);
  112. let path='/pages/video/videoList?videoId=0'
  113. let title='FICC视频社区'
  114. let imageUrl=''
  115. if(from=='button'){
  116. title=`${target.dataset.item.chart_permission_name}:${target.dataset.item.title}`
  117. path=`/pages/video/videoList?videoId=${target.dataset.item.community_video_id}`
  118. imageUrl=target.dataset.item.cover_img_url
  119. }
  120. return {
  121. title:title,
  122. path:path,
  123. imageUrl:imageUrl
  124. }
  125. },
  126. onPullDownRefresh(){
  127. this.videoId=0
  128. this.selectPerId=0
  129. this.page=1
  130. this.list=[]
  131. this.finished=false
  132. this.getList()
  133. setTimeout(() => {
  134. uni.stopPullDownRefresh()
  135. }, 1500)
  136. },
  137. methods: {
  138. goSearchPage(){
  139. uni.navigateTo({
  140. url: '/pages/video/videoSearch',
  141. });
  142. },
  143. change(e){
  144. this.active=e.detail
  145. },
  146. //点击分类某项
  147. handleSelectPerItem(item){
  148. if(this.selectPerId==item.PermissionId){
  149. this.selectPerId=0
  150. }else{
  151. this.selectPerId=item.PermissionId
  152. }
  153. this.videoId=0//重置掉分享进入的状态
  154. this.page=1
  155. this.list=[]
  156. this.finished=false
  157. this.getList()
  158. this.showFilter=false
  159. },
  160. async getList(){
  161. const res=await apiVideoList({
  162. page_index:Number(this.page),
  163. page_size:Number(this.pageSize),
  164. video_id:Number(this.videoId),
  165. chart_permission_id:Number(this.selectPerId)
  166. })
  167. if(res.code===200){
  168. let arr=res.data||[]
  169. this.list=[...this.list,...arr]
  170. if(arr.length===0){
  171. this.finished=true
  172. }
  173. }
  174. },
  175. //获取筛选项
  176. async getPermissionList(){
  177. const res=await apiOptionList()
  178. if(res.code===200){
  179. this.options=res.data
  180. }
  181. }
  182. },
  183. }
  184. </script>
  185. <style lang='scss'>
  186. .search-wrap .van-search{
  187. padding: 0 !important;
  188. }
  189. .video-list-page{
  190. .filter-wrap{
  191. .van-cell__title, .van-cell__value{
  192. flex: none !important;
  193. }
  194. .van-cell:after{
  195. border: none !important;
  196. }
  197. .van-cell__title{
  198. font-size: 14px;
  199. }
  200. .van-hairline--top:after{
  201. border-top-width: 0 !important;
  202. }
  203. }
  204. }
  205. </style>
  206. <style lang="scss" scoped>
  207. .video-list-page{
  208. .search-wrap {
  209. background-color: #fff;
  210. padding: 30rpx 34rpx;
  211. align-items: center;
  212. .menu-icon{
  213. width: 52rpx;
  214. height: 40rpx;
  215. display: block;
  216. flex-shrink: 0;
  217. margin-left: 30rpx;
  218. }
  219. }
  220. .list-wrap{
  221. .item{
  222. border-top: 10rpx solid #f9f9f9;
  223. padding: 30rpx 34rpx;
  224. position: relative;
  225. .title-box{
  226. padding-right: 40rpx;
  227. }
  228. .share-btn{
  229. position: absolute;
  230. top: 34rpx;
  231. right: 34rpx;
  232. background-color: transparent;
  233. width: 36rpx;
  234. height: 36rpx;
  235. line-height: 1;
  236. padding: 0;
  237. &::after{
  238. border: none;
  239. }
  240. }
  241. .share-img{
  242. width: 32.5rpx;
  243. height: 32rpx;
  244. }
  245. .tag{
  246. color: #E4B478;
  247. background-color: #333;
  248. padding: 5rpx 20rpx;
  249. border-radius: 20rpx;
  250. font-size: 24rpx;
  251. margin-right: 26rpx;
  252. }
  253. .title{
  254. font-size: 32rpx;
  255. color: #000;
  256. }
  257. video{
  258. width: 100%;
  259. height: 400rpx;
  260. margin: 30rpx 0 20rpx 0;
  261. border-radius: 20rpx;
  262. }
  263. .time{
  264. font-size: 28rpx;
  265. color: #999;
  266. }
  267. }
  268. }
  269. .empty-box{
  270. text-align: center;
  271. font-size: 32rpx;
  272. color: #999;
  273. padding-top: 150rpx;
  274. image{
  275. width: 80vw;
  276. margin-bottom: 57rpx;
  277. }
  278. }
  279. }
  280. .filter-wrap{
  281. background-color: #fff;
  282. padding-top: 53rpx;
  283. padding-bottom: 100rpx;
  284. .top{
  285. font-size: 32rpx;
  286. justify-content: space-between;
  287. margin-bottom: 40rpx;
  288. padding: 0 34rpx;
  289. }
  290. .list-box{
  291. min-height: 30vh;
  292. max-height: 60vh;
  293. .list-item{
  294. display: block;
  295. margin: 10rpx;
  296. height: 76rpx;
  297. line-height: 76rpx;
  298. color: #000;
  299. background: #F6F6F6;
  300. border-radius: 4px 4px 4px 4px;
  301. text-align: center;
  302. }
  303. .list-item-active{
  304. background-color: #FAEEDE;
  305. }
  306. }
  307. }
  308. </style>