index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="play">
  3. <video-player :videoUrl="watchVo.url"></video-player>
  4. <view class="anthologys_detail">
  5. <view class="anthology" @click="show = true">
  6. <view class="ant">
  7. <image :src="play_img" class="play"></image>
  8. <text class="ant-text">{{watchVo.programName}}(1/{{watchVo.programNum}})</text>
  9. </view>
  10. <view class="ant">
  11. <text>选集</text>
  12. <pv-icon name="icon-shangla" color='#fff'
  13. :customStyle="{ fontSize: '32rpx',marginLeft:'8rpx'}"></pv-icon>
  14. </view>
  15. </view>
  16. <!-- <view class="hot">
  17. <pv-icon name="icon-huomiao" color='#fff' :customStyle="{ fontSize: '32rpx'}"></pv-icon>
  18. <text>12.8W</text>
  19. </view> -->
  20. </view>
  21. <u-popup :show="show" @close="close" @open="open" safeAreaInsetBottom :round="15">
  22. <view class="opera">
  23. <view class="opera-top">
  24. <view class="title">
  25. <image class="cover" :src="watchVo.thumbnail"></image>
  26. <view class="name">
  27. <text>{{watchVo.programName}}</text>
  28. <text>共{{watchVo.programNum}}集·已完结</text>
  29. </view>
  30. </view>
  31. <view @click="close"><pv-icon name="icon-xiala"
  32. :customStyle="{ fontSize: '40rpx',fontWeight: 'bold'}"></pv-icon></view>
  33. </view>
  34. <view class="serice">
  35. <!-- <u-tabs :list="tabs" lineWidth="0" lineColor="#f56c6c" :activeStyle="{
  36. color: '#62C5C6',
  37. transform: 'scale(1)'
  38. }" :inactiveStyle="{
  39. color: '#000',
  40. transform: 'scale(1)'
  41. }" itemStyle="padding-left: 0px; padding-right: 20px; height: 34px;">
  42. </u-tabs> -->
  43. <view class="numbers">
  44. <view class="num">
  45. <view class="num_item" :class="{num_item_select: item.sort == sort}" v-for="(item,index) in list" :key="index" @click="toPlay(item)">
  46. <text class="num_text">{{item.sort}}</text>
  47. <view v-if="item.sort === sort" class="num_play">
  48. <view></view>
  49. <view></view>
  50. <view></view>
  51. </view>
  52. <view v-if="!item.isPay" class="lock">
  53. <pv-icon name="icon-v-locked" color="#A37449"
  54. :customStyle="{ fontSize: '20rpx',fontWeight: 'bold'}"></pv-icon>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </u-popup>
  62. <u-popup :show="isPayShow" @open="openPlay" @close="closePlay" safeAreaInsetBottom :round="15">
  63. <view class="pay_video">
  64. <view class="tit flex aic">
  65. <pv-icon name="icon-v-locked" color="#fff" :customStyle="{ fontSize: '30rpx',fontWeight: 'bold'}"></pv-icon>
  66. <text class="tips">当前视频没有播放权限</text>
  67. </view>
  68. <view class="pays flex jcsa aic">
  69. <view class="pay_item single" :class="{ pay_item_select: !type }" @click="changeType(type)">
  70. <text>单集购买</text>
  71. </view>
  72. <view class="pay_item all" :class="{ pay_item_select: type }" @click="changeType(type)">
  73. <text>整集购买</text>
  74. </view>
  75. </view>
  76. <u-button class="btn" type="primary" shape="circle" @click="confirm">确认</u-button>
  77. </view>
  78. </u-popup>
  79. </view>
  80. </template>
  81. <script>
  82. import defaultConfig from '@/config/default.js'
  83. import { getServerShipVideoUrl,getServerShipVideoList } from '@/apis/index'
  84. import { buyShipVideo } from '@/apis/video'
  85. export default {
  86. data() {
  87. return {
  88. // id:'',
  89. type: 0,
  90. watchVo:{},
  91. sort:0,
  92. show: false,
  93. isPayShow: false,
  94. videoUrl: '/static/video/luo-sun.mp4', //路径
  95. play_img: defaultConfig.ossImgUrl + '/playVideo/video/ic_search.png',
  96. coverImg: 'https://obs-fanxing.obs.cn-east-3.myhuaweicloud.com/retail/main/img_bgtop.png',
  97. tabs: [{
  98. name: '1-50',
  99. }, {
  100. name: '51-94'
  101. }],
  102. list: [],
  103. shipVideoId:'',
  104. }
  105. },
  106. onLoad(params){
  107. let id = params.id
  108. console.log(params,id,'id');
  109. // this.getVideoUrl(id)
  110. this.getVideoList(id)
  111. },
  112. methods: {
  113. // 获取视频url
  114. async toPlay(item){
  115. if(item.sort === this.watchVo.sort) return
  116. if(!item.isPay){
  117. this.shipVideoId = item.id
  118. this.isPayShow = true
  119. return
  120. }
  121. const res = await getServerShipVideoUrl(item.id)
  122. console.log(res);
  123. },
  124. // 查看视频列表
  125. async getVideoList(id){
  126. const res = await getServerShipVideoList(id)
  127. this.watchVo = res.serverVideoWatchVo
  128. this.sort = res.serverVideoWatchVo.sort
  129. this.list = res.videoVos
  130. },
  131. async confirm(){
  132. let params = {
  133. shipVideoId: this.shipVideoId,
  134. type: this.type
  135. }
  136. const res = await buyShipVideo(params)
  137. console.log(res);
  138. },
  139. changeType(type){
  140. type?this.type = 0:this.type = 1
  141. },
  142. open() {
  143. },
  144. close() {
  145. this.show = false
  146. },
  147. closePlay() {
  148. this.isPayShow = false
  149. this.show = true
  150. },
  151. openPlay(){
  152. this.show = false
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. .play {
  159. width: 100%;
  160. height: 100%;
  161. .anthologys_detail {
  162. box-sizing: border-box;
  163. width: 100%;
  164. padding: 0 24rpx 0 34rpx;
  165. display: flex;
  166. align-items: center;
  167. justify-content: space-between;
  168. color: #fff;
  169. position: absolute;
  170. bottom: calc(70rpx + constant(safe-area-inset-bottom));
  171. bottom: calc(70rpx);
  172. z-index: 99;
  173. .anthology {
  174. flex-grow: 1;
  175. display: flex;
  176. align-items: center;
  177. justify-content: space-between;
  178. // height: 72rpx;
  179. background: #1A1A1A;
  180. border-radius: 72rpx;
  181. padding: 16rpx 20rpx;
  182. font-size: 32rpx;
  183. // width: 572rpx;
  184. .ant {
  185. display: flex;
  186. align-items: center;
  187. .ant-text {
  188. margin-left: 16rpx;
  189. }
  190. }
  191. .play {
  192. width: 40rpx;
  193. height: 40rpx;
  194. }
  195. }
  196. .hot {
  197. width: 150rpx;
  198. text-align: right;
  199. text {
  200. margin-left: 8rpx;
  201. }
  202. }
  203. }
  204. .opera {
  205. padding: 20rpx 30rpx;
  206. .opera-top {
  207. display: flex;
  208. justify-content: space-between;
  209. align-items: center;
  210. margin-bottom: 10rpx;
  211. .title {
  212. display: flex;
  213. .cover {
  214. width: 80rpx;
  215. height: 108rpx;
  216. border-radius: 10rpx;
  217. margin-right: 20rpx;
  218. }
  219. .name {
  220. display: flex;
  221. flex-direction: column;
  222. justify-content: space-around;
  223. text:nth-child(1) {
  224. color: #000;
  225. font-size: 40rpx;
  226. font-weight: bold;
  227. }
  228. text:nth-child(2) {
  229. color: #999;
  230. font-size: 30rpx;
  231. }
  232. }
  233. }
  234. }
  235. .serice {
  236. overflow: hidden;
  237. .numbers {
  238. height: 500rpx;
  239. overflow: scroll;
  240. .num {
  241. display: flex;
  242. flex-wrap: wrap;
  243. .num_item_select{
  244. background: #E9F9F9 !important;
  245. }
  246. .num_item {
  247. position: relative;
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. width: calc(20% - 20rpx);
  252. height: 110rpx;
  253. margin: 10rpx;
  254. background: #FAFAFA;
  255. color: #000;
  256. box-sizing: border-box;
  257. .num_text {
  258. color: #62C5C6;
  259. }
  260. .num_play {
  261. position: absolute;
  262. left: 10rpx;
  263. bottom: 10rpx;
  264. display: flex;
  265. align-items: flex-end;
  266. view {
  267. width: 6rpx;
  268. background: #62C5C6;
  269. margin-right: 6rpx;
  270. border-radius: 6rpx;
  271. }
  272. view:nth-child(1) {
  273. height: 21rpx;
  274. }
  275. view:nth-child(2) {
  276. height: 16rpx;
  277. }
  278. view:nth-child(3) {
  279. height: 18rpx;
  280. }
  281. }
  282. .lock {
  283. position: absolute;
  284. top: 0;
  285. right: 0;
  286. width: 40rpx;
  287. height: 40rpx;
  288. background: #F9E2B7;
  289. border-radius: 0rpx 12rpx 0rpx 12rpx;
  290. // text-align: center;
  291. // line-height: 40rpx;
  292. display: flex;
  293. justify-content: center;
  294. align-items: center;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. .pay_video{
  302. background: linear-gradient( 180deg, #216CFF 10%, #C7F0FF 50%);
  303. padding: 30rpx 20rpx;
  304. // margin-bottom: calc(20rpx + constant(safe-area-inset-bottom)) !important;
  305. margin-bottom: calc(env(safe-area-inset-bottom)) !important;
  306. // height: 300rpx;
  307. .tit{
  308. color: #fff;
  309. .tips{
  310. margin-left: 5rpx;
  311. }
  312. }
  313. .pays{
  314. margin: 30rpx 0;
  315. .pay_item{
  316. background: #fff;
  317. width: 40%;
  318. height: 100rpx;
  319. border-radius: 12rpx;
  320. text-align: center;
  321. line-height: 100rpx;
  322. }
  323. .pay_item_select{
  324. background: #216CFF;
  325. color: #fff;
  326. }
  327. }
  328. .btn{
  329. // margin-bottom: 30rpx;
  330. }
  331. }
  332. }
  333. </style>