index.nvue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. <template>
  2. <view class="">
  3. <view class="content">
  4. <u-navbar :leftText="topTitle" @leftClick="leftClick" titleStyle="color:#fff;" bgColor="#000"
  5. leftIconColor="#fff" :autoBack="false">
  6. </u-navbar>
  7. <swiper :style="'width: '+ windowWidth +'px; height:100vh; background-color: #000;'" class="swiper"
  8. :circular='false' @change="swiperChange" :current="swiperCurrent" :vertical="true" duration="200">
  9. <block v-for="content in swiperList" :key="content">
  10. <swiper-item>
  11. <view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'">
  12. <!-- @controlstoggle="controlstoggle" -->
  13. <video v-if="isShowVideo(content)" autoplay :key="content" id="myVideo" :controls="controls"
  14. :loop="!isplay" preload="auto" :enable-progress-gesture="true"
  15. :show-center-play-btn="false" :show-loading="false" :show-fullscreen-btn="false"
  16. :poster="videoInfo.cover_image" @ended="ended" @click="tapVides()"
  17. :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'"
  18. :src="currentVideoInfo.video_url" class="tsvideo">
  19. </video>
  20. <image v-else :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'"
  21. :src="videoInfo.cover_image"></image>
  22. <view v-if="isqp" class="userInfo">
  23. <!-- 2.点赞 -->
  24. <view style="opacity: 0.9; margin-top: 17px;">
  25. <image v-if="currentVideoInfo.is_zan" src="@/static/aixinRed.png" @click="myLike(2)"
  26. style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
  27. <image v-else src="@/static/aixin.png" @click="myLike(1)"
  28. style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
  29. <text
  30. style="color: #FFFFFF; margin-top: 5px; font-size: 14px; text-align: center; margin-top: 40px; font-weight: bold;">{{currentVideoInfo.total_zan}}</text>
  31. </view>
  32. <!-- 3.分享 -->
  33. <!-- <view style="opacity: 0.9; margin-top: 17px;">
  34. <image src="@/static/share-fill.png"
  35. style="width: 40px; height: 40px; position: absolute; right: 5px;"></image>
  36. <text
  37. style="color: #FFFFFF; margin-top: 5px; font-size: 14px; text-align: center; font-weight: bold; margin-top: 40px;">分享</text>
  38. <button open-type="share"
  39. style="position: absolute; background: none; width: 100%; height: 100%;"
  40. @click.stop="share"></button>
  41. </view> -->
  42. <!-- 4.追剧 -->
  43. <view class="comment" style="opacity: 0.9; margin-top: 17px;">
  44. <view v-if="videoInfo.is_binge_watch" @click="unBingewatch">
  45. <image src="@/static/scRed.png"
  46. style="width: 40px; height: 40px; position: absolute; right: 6px;">
  47. </image>
  48. <text
  49. style="color: #ff0000; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">已追</text>
  50. </view>
  51. <view v-else @click="bingewatch">
  52. <image src="@/static/sc.png"
  53. style="width: 40px; height: 40px; position: absolute; right: 6px;">
  54. </image>
  55. <text
  56. style="color: #FFFFFF; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">追剧</text>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 最底下的文字部分 -->
  61. <view v-if="isqp" class="contentcd" @click.stop="sellxj()">
  62. <text class="userName">《{{videoInfo.name}}》</text>
  63. <text class="userName">更新到第{{videoInfo.updated_episode_num}}集</text>
  64. <text class="userName">|</text>
  65. <text class="userName">选集</text>
  66. </view>
  67. </view>
  68. </swiper-item>
  69. </block>
  70. </swiper>
  71. <uni-popup type="bottom" ref="select" style="z-index: 100;" :mask-click="true">
  72. <view v-if="fenji==1" class="pop-my"
  73. style=" border-top-left-radius: 10px; border-top-right-radius: 10px;">
  74. <view class="ju-top">
  75. <view style="display: flex; flex-direction: column; ">
  76. <view style="display: flex; flex-direction: column;">
  77. <view style="display: flex; flex-direction: column;">
  78. <view class="utabs-top">
  79. <u-tabs v-if="fenji==1" :activeStyle="activeStyle" lineColor="none"
  80. :inactiveStyle="inactiveStyle" class="utabs-top" :list="list1"
  81. :current="current"></u-tabs>
  82. </view>
  83. <view class="ju-top-title">
  84. {{videoInfo.name}}
  85. </view>
  86. <view class="ju-top-update"> 已更新至{{videoInfo.updated_episode_num}}集 </view>
  87. </view>
  88. <u-tabs v-if="fenji==1" :activeStyle="activeStyle" lineColor="none"
  89. :inactiveStyle="inactiveStyle" :current="tabcurrent" :list="labelList"
  90. @click="labelListClick"></u-tabs>
  91. </view>
  92. <view class="down" @click="down">
  93. <text class="down-text">收起</text>
  94. <image class="down-img" src="@/static/img/index/down.png">
  95. </image>
  96. </view>
  97. </view>
  98. </view>
  99. <scroll-view class="scroll-my" :scroll-y="true" :scroll-top="scrollTop">
  100. <view class="ju-wrapper">
  101. <block v-for="content in labelList[tabcurrent].content" :key="content">
  102. <view class="ju-content" :class="activeIndex ==content?'active':'' "
  103. @click="playVideo(content)">
  104. <!-- <view :class="isShowUpdate(content)?'lock-wrapper-no':'lock-wrapper'" -->
  105. <view class="lock-wrapper" v-if="isShowUpdate(content)">
  106. <text class="update-title">待更新</text>
  107. </view>
  108. <text class="title">第{{content}}集 </text>
  109. <view class="lock-wrapper" v-if="isShowVip(content)">
  110. <image class="lock-img" src="@/static/shilu-login/2.png"></image>
  111. </view>
  112. </view>
  113. </block>
  114. </view>
  115. <view style="width: 1px; height: 1px; margin-top: 30px;"></view>
  116. </scroll-view>
  117. </view>
  118. <view v-if="fenji==2"
  119. :style="'width: '+ windowWidth +'px;height:70vh; background-color: #fff; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  120. <view class="charge-wrapper">
  121. <view class="top">
  122. <text class="charge-title">充值购买后可继续观看{{popUpTitle}} </text>
  123. <text class="charge-info">为保护创作者权益,当前内容需要付费观看。</text>
  124. <view class="charge-coin">
  125. <text class="ji">本集:</text>
  126. <text class="bi">{{videoInfo.charge_coin}}k币</text>
  127. </view>
  128. </view>
  129. <view class="ft14"
  130. style="display: flex;flex-direction: row;justify-content: flex-start;padding: 0 20px;">
  131. 账户余额<text class="ft14" style="color: #FF9800;">{{user_info.total_coin}}</text>K币</view>
  132. <scroll-view class="scroll-charge" :scroll-y="true" :scroll-top="scrollTop">
  133. <view class="pay-box">
  134. <block v-for="(item,key) in payOptions" :key="key">
  135. <view v-if="item.type =='COIN'" @click="selectPayItem(item)"
  136. :class="item.id == pay_select_id ?'pay-select' :'' " class="box pay-box-items">
  137. <view style="height: 20px;align-self: flex-end;"><text class="ft12 top-lab"
  138. v-if="item.tip_text">{{item.tip_text}}</text></view>
  139. <text class="ft18 pay-box-items-txt"
  140. style="color: #FF9800;">{{item.price}}元</text>
  141. <view class="ft14 pay-box-items-txt" style="flex-direction: row;">
  142. {{item.price_text}} <text class="ft14"
  143. style="color: #FF9800;">+{{item.given}}K币</text>
  144. </view>
  145. <view class="ft14 pay-box-items-txt"
  146. style="flex-direction: row;justify-content: space-between;"
  147. :class=" item.id == pay_select_id ?'select-text' :'given-txt'">
  148. {{item.given_amount}} <text v-if="item.id == pay_select_id"
  149. class="ft14">&#10003;️</text>
  150. </view>
  151. </view>
  152. <view v-else @click="selectPayItem(item)"
  153. :class="item.id == pay_select_id ?'pay-select' :'' " class="box pay-box-items">
  154. <view style="height: 20px;align-self: flex-end;"><text class="ft12 top-lab"
  155. v-if="item.tip_text">{{item.tip_text}}</text></view>
  156. <view class="vip-center">
  157. <view class="">
  158. <text class="ft18 pay-box-items-txt"
  159. style="color: #FF9800;">{{item.price}}元</text>
  160. <view class="ft14 pay-box-items-txt">{{item.price_text}}</text></view>
  161. </view>
  162. <image class="vip-level-icon" src="/static/icon/vip.png"></image>
  163. </view>
  164. <view class="ft14 pay-box-items-txt"
  165. style="flex-direction: row;justify-content: space-between;"
  166. :class=" item.id == pay_select_id ?'select-text' :'given-txt'">
  167. {{item.given_amount}} <text v-if="item.id == pay_select_id"
  168. class="ft14">&#10003;️</text>
  169. </view>
  170. </view>
  171. </block>
  172. </view>
  173. <view class="ft14" style="margin: 10px 0; padding: 0 20px;">付费须知</view>
  174. <view class="ft14" style="padding: 0 20px;">
  175. <text class="ft12">1、虚拟商品,一经购买不得退换</text>
  176. <text class="ft12">2、充值后K币可能有延迟,1小时未到账请在“我的”页面联系客服</text>
  177. <text class="ft12">3、未满18岁的未成年需要在监护人陪同下购买并观看短剧剧</text>
  178. <text class="ft12">4、购买成功后,“K币”仅在本小程序中使用</text>
  179. <text class="ft12">5、购买成功后可在”我的”页面订单中心进行查看</text>
  180. </view>
  181. </scroll-view>
  182. </view>
  183. </view>
  184. </uni-popup>
  185. </view>
  186. <u-overlay :show="centerShow" :duration="400" closeOnClickOverlay :z-index="999" @click="closeOverlay">
  187. <view class="warp">
  188. <view class="rect" @tap.stop>
  189. <text class="rect-text">剧集暂未更新</text>
  190. <view class="rect-button" @tap.stop @click="closeOverlay"><text class="rect-button-text">确定</text>
  191. </view>
  192. </view>
  193. </view>
  194. </u-overlay>
  195. </view>
  196. </template>
  197. <script>
  198. import {
  199. getVideoInfo,
  200. videoEpisodePlay,
  201. videoEpisodeZan,
  202. } from '@/common/apis/video.js';
  203. import {
  204. delShelf,
  205. storeshelf
  206. } from '@/common/apis/zju.js'
  207. import {
  208. getUserInfo
  209. } from "@/common/apis/my.js";
  210. import {
  211. userRanse
  212. } from "@/common/apis/common.js"
  213. import {
  214. getOptions,
  215. getPayInfo
  216. } from "@/common/apis/recharge.js"
  217. import configs from "@/common/config.js"
  218. export default {
  219. data() {
  220. return {
  221. centerShow: false, //暂未更新弹窗
  222. limitPage: 15,
  223. top_height: 0,
  224. episode: 1,
  225. ranse_id: 0,
  226. swiperCurrent: 0,
  227. videoContext: '',
  228. currentVideoInfo: {},
  229. activeStyle: {
  230. color: '#f95d27',
  231. fontWeight: 'bold',
  232. transform: 'scale(1.05)'
  233. },
  234. inactiveStyle: {
  235. color: '#606266',
  236. transform: 'scale(1)'
  237. },
  238. activeIndex: 1,
  239. tabcurrent: 0,
  240. videoInfo: {},
  241. labelList: [],
  242. list1: [{
  243. name: '当前剧集',
  244. }],
  245. sharedata: {
  246. type: 2,
  247. strShareUrl: "",
  248. strShareTitle: "分享标题",
  249. strShareSummary: "分享总结",
  250. strShareImageUrl: ""
  251. },
  252. isShow: true,
  253. fenji: 2,
  254. pay_select_id: 0,
  255. controls: true,
  256. windowWidth: 0,
  257. windowHeight: 0,
  258. current: 0,
  259. isplay: true, //是否自动播放下一个视频
  260. duration: 500,
  261. isqp: true,
  262. urls: configs.webUrl,
  263. scrollTop: 0,
  264. video_id: 0,
  265. safeArea: 0,
  266. ttuop: 0,
  267. heightxw: 100,
  268. user_info: {},
  269. payVideoInfo: {},
  270. payOptions: []
  271. };
  272. },
  273. computed: {
  274. swiperList() {
  275. return Number(parseInt(this.videoInfo.updated_episode_num, 10)) + 1
  276. },
  277. isShowVideo(item) {
  278. return (item) => {
  279. return this.swiperCurrent == item && this.isShow
  280. }
  281. },
  282. isShowVip(item) {
  283. return (item) => {
  284. return item >= this.videoInfo.charge_sequence && item <= this.videoInfo.updated_episode_num
  285. }
  286. },
  287. isShowUpdate(item) {
  288. return (item) => {
  289. return item > this.videoInfo.updated_episode_num
  290. }
  291. },
  292. popUpTitle() {
  293. return `《${this.videoInfo.name}》 第${this.episode}集`
  294. },
  295. topTitle() {
  296. return `第${this.episode}集`
  297. }
  298. },
  299. onReady: function(res) {
  300. this.videoContext = uni.createVideoContext('myVideo')
  301. },
  302. mounted() {
  303. this.initSwiperData(this.swiperCurrent + 1)
  304. getVideoInfo({
  305. video_id: this.video_id
  306. }).then(res => {
  307. // console.log(res, 'getVideoInfogetVideoInfogetVideoInfo')
  308. this.videoInfo = res.data
  309. this.initTabs();
  310. })
  311. },
  312. async onLoad(e) {
  313. // console.log('11111111111111111111',e)
  314. let that = this;
  315. uni.getSystemInfo({
  316. success(res) {
  317. that.top_height = res.statusBarHeight; //data中 声明 top_height:0
  318. }
  319. });
  320. if (e.video_id) {
  321. this.video_id = Number(e.video_id)
  322. }
  323. if (e.sequence && Number(e.sequence) > 0) {
  324. this.swiperCurrent = Number(e.sequence) - 1;
  325. }
  326. // 染色参数接收
  327. if (e.ranse_id && Number(e.ranse_id) > 0) {
  328. try {
  329. this.ranse_id = Number(e.ranse_id);
  330. let res = await userRanse(this.ranse_id);
  331. } catch (e) {
  332. console.log("player-errr:", e)
  333. }
  334. }
  335. uni.getSystemInfo({
  336. success: res => {
  337. this.safeArea = res.safeAreaInsets.bottom;
  338. if (this.safeArea > 0) {
  339. this.heightxw = 97
  340. }
  341. }
  342. })
  343. // #ifdef MP-TOUTIAO
  344. this.ttuop = 64
  345. // #endif
  346. this.windowWidth = uni.getSystemInfoSync().windowWidth
  347. this.windowHeight = uni.getSystemInfoSync().windowHeight - this.safeArea - this.ttuop
  348. console.log(this.windowHeight)
  349. },
  350. onShow() {
  351. },
  352. onShareAppMessage: function(res) {
  353. // #ifdef MP-WEIXIN
  354. var href = '/pages/video/index?video_id=' + this.video_id + "&"
  355. console.log(res)
  356. let that = this;
  357. const obj = {
  358. title: "发送给好友",
  359. imageUrl: '',
  360. path: href,
  361. success: function(res) {
  362. console.log(res, "转发成功")
  363. },
  364. fail: function(res) {
  365. wx.showToast({
  366. title: '发送失败',
  367. icon: 'none'
  368. })
  369. }
  370. }
  371. return obj
  372. // #endif
  373. },
  374. watch: {
  375. activeIndex: {
  376. handler(newVal, oldVal) {
  377. this.initTabs()
  378. let index = this.labelList.findIndex(el => el.content.includes(newVal))
  379. console.log(index, 'newValnewVal', this.labelList, newVal)
  380. this.tabcurrent = index
  381. },
  382. }
  383. },
  384. onBackPress() {},
  385. methods: {
  386. closeOverlay() {
  387. this.centerShow = false
  388. // console.log('open');
  389. },
  390. bingewatch() {
  391. storeshelf(this.video_id).then(res => {
  392. this.videoInfo.is_binge_watch = !Boolean(this.videoInfo.is_binge_watch)
  393. uni.showToast({
  394. title: '追剧成功',
  395. duration: 1000,
  396. icon: 'none'
  397. });
  398. })
  399. },
  400. unBingewatch() {
  401. delShelf(this.video_id).then(res => {
  402. this.videoInfo.is_binge_watch = !Boolean(this.videoInfo.is_binge_watch)
  403. })
  404. },
  405. leftClick(e) {
  406. if (!this.videoInfo?.is_binge_watch) {
  407. uni.showModal({
  408. title: '加入追剧',
  409. content: '喜欢就加入追剧吧',
  410. confirmText: '加入追剧',
  411. confirmColor: '#FFA500',
  412. cancelText: '不用了',
  413. success: (res) => {
  414. if (res.confirm) {
  415. this.bingewatch()
  416. uni.navigateBack()
  417. // 用户点击了确定按钮
  418. // 执行加入追剧的逻辑
  419. } else if (res.cancel) {
  420. // 用户点击了取消按钮
  421. // 执行取消逻辑
  422. uni.navigateBack()
  423. }
  424. }
  425. });
  426. } else {
  427. uni.navigateBack()
  428. }
  429. },
  430. myLike(like) {
  431. videoEpisodeZan({
  432. episode_id: this.currentVideoInfo.id,
  433. zan: like
  434. }).then(res => {
  435. this.$nextTick(() => {
  436. this.currentVideoInfo.is_zan = !Boolean(this.currentVideoInfo.is_zan)
  437. if (this.currentVideoInfo.is_zan) {
  438. this.currentVideoInfo.total_zan++
  439. } else {
  440. this.currentVideoInfo.total_zan--
  441. }
  442. })
  443. })
  444. },
  445. initTabs() {
  446. function innit(i, num) {
  447. let arr = [];
  448. for (i; i <= num; i++) {
  449. arr.push(i)
  450. }
  451. return arr
  452. }
  453. const pageSize = this.limitPage;
  454. const total = this.videoInfo.total_episode_num;
  455. const pageCount = Math.ceil(total / pageSize);
  456. for (let i = 0; i < pageCount; i++) {
  457. const start = i * pageSize + 1;
  458. const end = i === pageCount - 1 ? total : (i + 1) * pageSize;
  459. let label;
  460. if (i === pageCount - 1) {
  461. if (start === total) {
  462. label = `${total}`
  463. } else {
  464. label = `${start}-${total}`
  465. }
  466. } else {
  467. label = `${start}-${end}`
  468. }
  469. let index;
  470. if (label.split('-')[1]) {
  471. index = label.split('-')[1]
  472. } else {
  473. index = total
  474. }
  475. this.labelList.push({
  476. name: label,
  477. page: pageCount,
  478. content: innit(start, index)
  479. })
  480. }
  481. // let index = this.labelList.findIndex(el => el.content.includes(this.activeIndex))
  482. // this.tabcurrent = index
  483. },
  484. async getPayInfo(originIndex) {
  485. this.user_info = await getUserInfo();
  486. this.payOptions = await getOptions();
  487. this.payOptions.forEach((item, index) => {
  488. if (item.is_default == 1) {
  489. this.pay_select_id = item.id;
  490. }
  491. })
  492. this.payVideoInfo = {
  493. video_id: this.video_id,
  494. video_series_sequence: originIndex
  495. };
  496. },
  497. async selectPayItem(item) {
  498. this.pay_select_id = item.id;
  499. let params = {
  500. video_id: this.payVideoInfo.video_id,
  501. video_series_sequence: this.payVideoInfo.video_series_sequence,
  502. pay_proudct_id: item.id,
  503. is_first_pay: item.is_first_pay,
  504. }
  505. let res = await getPayInfo(params);
  506. if (res) {
  507. // #ifdef MP-WEIXIN
  508. this.wxMinPay(res);
  509. // #endif
  510. }
  511. },
  512. wxMinPay(param) {
  513. wx.requestPayment({
  514. timeStamp: param.timeStamp,
  515. nonceStr: param.nonceStr,
  516. package: param.package,
  517. signType: param.signType,
  518. paySign: param.paySign,
  519. success(res) {
  520. this.pay_success = true;
  521. uni.showToast({
  522. title: '支付成功',
  523. icon: "none"
  524. });
  525. // console.log('success:' + JSON.stringify(res));
  526. },
  527. fail(e) {
  528. if (e.errMsg == "requestPayment:fail cancel") {
  529. uni.showToast({
  530. title: '取消支付',
  531. icon: "none"
  532. });
  533. } else {
  534. uni.showToast({
  535. title: '支付失败',
  536. icon: "none"
  537. });
  538. }
  539. }
  540. })
  541. },
  542. playVideo(item) {
  543. if (this.isShowVip(item)) {
  544. // this.fenji = 2
  545. this.swiperCurrent = item - 1;
  546. this.getPayInfo(item);
  547. // this.activeIndex = ''
  548. } else if (this.isShowUpdate(item)) {
  549. // this.activeIndex = ''
  550. this.centerShow = true
  551. // this.swiperCurrent = this.videoInfo.updated_episode_num + 1;
  552. // uni.showToast({
  553. // title: '剧集暂未更新',
  554. // duration: 500,
  555. // icon: 'none'
  556. // });
  557. } else {
  558. this.activeIndex = item;
  559. this.swiperCurrent = item - 1;
  560. this.episode = this.swiperCurrent
  561. // this.initSwiperData(item)
  562. this.down();
  563. }
  564. },
  565. labelListClick(item) {
  566. this.tabcurrent = item.index
  567. },
  568. share() {
  569. var href = '/pages/video/index?video_id=' + this.video_id
  570. // #ifdef H5
  571. uni.setClipboardData({
  572. data: this.urls + '/h5/#' + href,
  573. complete() {
  574. uni.showToast({
  575. title: "分享连接已复制到剪贴板"
  576. })
  577. }
  578. })
  579. // #endif
  580. // #ifndef H5
  581. uni.share({
  582. provider: "weixin",
  583. scene: "WXSenceTimeline",
  584. type: 0,
  585. href: href,
  586. title: '分享标题',
  587. summary: '分享总结',
  588. imageUrl: '',
  589. success: function(res) {
  590. console.log("success:" + JSON.stringify(res));
  591. },
  592. fail: function(err) {
  593. console.log("fail:" + JSON.stringify(err));
  594. }
  595. })
  596. // #endif
  597. },
  598. down() {
  599. this.$refs.select.close();
  600. },
  601. sellxj() {
  602. this.fenji = 1
  603. this.$refs.select.open('bottom');
  604. this.$nextTick(() => {
  605. let num1 = (this.windowHeight / 1.6) * 0.85;
  606. let num2 = num1 / 4.78;
  607. this.scrollTop = num2 * Number(this.k);
  608. })
  609. },
  610. tapVideoHover(index, pays) {
  611. this.videoContext.play()
  612. // this.$refs.select.open('bottom');
  613. },
  614. tapVides() {
  615. this.isqp = !this.isqp
  616. },
  617. ended() {
  618. //console.log('isplay----',this.isplay)
  619. // 1.播放当前视频结束时触发,自动切换下一个视频
  620. if (this.isplay) {
  621. if (this.displayIndex < 2) {
  622. this.current = this.displayIndex + 1
  623. } else {
  624. this.current = 0
  625. }
  626. this.isqp = true
  627. // console.log('显示swiper Index:', this.displayIndex)
  628. }
  629. },
  630. initSwiperData(originIndex) {
  631. this.episode = originIndex;
  632. this.isqp = true
  633. console.log(this.videoInfo.updated_episode_num, 'this.swiperCurrent', this.swiperCurrent)
  634. if (this.swiperList != this.swiperCurrent + 1) {
  635. videoEpisodePlay({
  636. video_id: this.video_id,
  637. sequence: originIndex,
  638. }).then(res => {
  639. if (res.code == 0) {
  640. this.currentVideoInfo = res.data
  641. this.activeIndex = this.episode;
  642. this.isShow = true
  643. this.down();
  644. } else if (res.code == 500101) {
  645. // console.log(this.currentVideoInfo, 'res.code == 500101res.code == 500101')
  646. this.currentVideoInfo.video_url = ""
  647. this.isShow = false
  648. this.isqp = false
  649. this.fenji = 2
  650. this.getPayInfo(originIndex);
  651. this.$refs.select.open('bottom');
  652. // this.currentVideoInfo = {}
  653. } else {
  654. this.isqp = false
  655. this.currentVideoInfo.video_url = ""
  656. this.isShow = false
  657. }
  658. // console.log(res, 'getVideoEpisodePlaygetVideoEpisodePlay')
  659. })
  660. } else {
  661. this.isqp = false
  662. this.centerShow = true
  663. this.currentVideoInfo.video_url = ""
  664. this.isShow = false
  665. }
  666. },
  667. /**
  668. * swiper滑动时候
  669. */
  670. swiperChange(event) {
  671. const {
  672. current
  673. } = event.detail;
  674. this.swiperCurrent = current
  675. // console.log(this.swiperCurrent, 'this.swiperCurrentthis.swiperCurrent')
  676. this.initSwiperData(current + 1)
  677. },
  678. controlstoggle(e) {
  679. // console.log(e.detail.show);
  680. },
  681. },
  682. };
  683. </script>
  684. <style lang="scss" scoped>
  685. @import "./style/index.scss"
  686. </style>