index.nvue 22 KB

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