videoList.vue 10 KB

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