detail(原版模板) .nvue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <template>
  2. <view class="content">
  3. <swiper :style="'width: '+ windowWidth +'px; height:100vh; background-color: #000;'" class="swiper" circular
  4. @change="swiperChange"
  5. :current="current"
  6. :vertical="true"
  7. duration="300"
  8. >
  9. <swiper-item v-for="(list, index) in displaySwiperList" :key="index" :style="'width: '+ windowWidth +'px; height:100vh; background-color: #000;'">
  10. <view :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'">
  11. <video
  12. v-if="Math.abs(displayIndex-index)==0 && list.src"
  13. :id="list._id"
  14. :controls="controls"
  15. :loop="!isplay"
  16. :enable-progress-gesture="false"
  17. :show-center-play-btn="false"
  18. :show-loading="false"
  19. :show-fullscreen-btn="false"
  20. @ended="ended"
  21. @controlstoggle="controlstoggle"
  22. @click="tapVides()"
  23. @timeupdate="timeupdate"
  24. :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'"
  25. :src="list.src"
  26. :poster="list.img"
  27. class="tsvideo"
  28. >
  29. </video>
  30. <view v-if="isqp" class="userInfo">
  31. <!-- 1.头像 -->
  32. <!-- <image @click="tozuozhe" class="userAvatar" :src="list.href" mode="aspectFill"></image> -->
  33. <!-- 2.点赞 -->
  34. <view @click.stop="cLike(list.like,list.pid,list.mid);" style="opacity: 0.9; margin-top: 17px;">
  35. <image v-if="list.like*1==1" src="@/static/aixin.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
  36. <image v-if="list.like*1==2" src="@/static/aixinRed.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
  37. <text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; text-align: center; margin-top: 40px; font-weight: bold;" :class="{'likeNumActive':list.like}">{{list.like_n}}</text>
  38. </view>
  39. <!-- 3.分享 -->
  40. <view style="opacity: 0.9; margin-top: 17px;">
  41. <image src="@/static/share-fill.png" style="width: 40px; height: 40px; position: absolute; right: 5px;"></image>
  42. <text style="color: #FFFFFF; margin-top: 5px; font-size: 14px; text-align: center; font-weight: bold; margin-top: 40px;">分享</text>
  43. <button open-type="share" style="position: absolute; background: none; width: 100%; height: 100%;" @click.stop="share"></button>
  44. </view>
  45. <!-- 4.评论 -->
  46. <view class="comment" @click.stop="toComment(list.iszj,list.pid,list.mid)" style="opacity: 0.9; margin-top: 17px;">
  47. <image v-if="list.iszj*1==1" src="@/static/sc.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
  48. <image v-if="list.iszj*1==2" src="@/static/scRed.png" style="width: 40px; height: 40px; position: absolute; right: 6px;"></image>
  49. <text v-if="list.iszj*1==1" style="color: #FFFFFF; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">追剧</text>
  50. <text v-if="list.iszj*1==2" style="color: #ff0000; margin-top: 5px; font-size: 14px; font-weight: bold; text-align: center; margin-top: 40px;">已追</text>
  51. </view>
  52. </view>
  53. <!-- 最底下的文字部分 -->
  54. <view v-if="isqp" class="contentcd">
  55. <text class="userName" :style="'width: '+ (windowWidth - 90) +'px;'">{{list.title}}</text><!-- i={{i}} -->
  56. <text class="wordss" :style="'width: '+ (windowWidth - 90) +'px;'">{{list.msg}}</text><!-- k={{k}} -->
  57. <text class="words" @click.stop="sellxj()" :style="'width: '+ (windowWidth - 90) +'px;'">{{list.namets}}</text><!-- k={{k}} -->
  58. </view>
  59. <!-- play-btn-position="center" -->
  60. <view v-if="Math.abs(displayIndex-index)!=0 || !list.src" class="videoHover tsimg" @click.stop="tapVideoHover(index,list.pays)" :style="'width: '+ windowWidth +'px; height:'+heightxw+'vh;'">
  61. <image :src="list.img" :style="'width: 100vw; height:'+heightxw+'vh; background-color: #000; position: absolute;'" mode="aspectFit"></image>
  62. <image class="playState" src="@/static/play.png"></image>
  63. </view>
  64. </view>
  65. </swiper-item>
  66. </swiper>
  67. <uni-popup type="bottom" ref="select">
  68. <view v-if="fenji==1" :style="'width: '+ windowWidth +'px; height: '+ (windowHeight/1.6) +'px; background-color: #202020; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  69. <view :style="'width: '+ windowWidth +'px; height: 35px;'">
  70. <view style="display: flex; flex-direction: row;">
  71. <view style="display: flex; flex-direction: column;">
  72. <view style="display: flex; flex-direction: row;">
  73. <image src="@/static/img/index/layers.png" style="width: 20px; height: 20px; margin-top: 10px; margin-left: 20px;"></image>
  74. <view :style="'font-size: 16px; font-weight: bold; color: #FFFFFF; margin-top: 9px; height: 22px; margin-left: 20px; width: '+ (windowWidth*0.6) +'px; overflow: hidden;'">
  75. 当前播放第{{ Number(originIndex+1) }}个视频
  76. </view>
  77. </view>
  78. <!-- <view :style="'font-size: 12px; color: #FFFFFF; margin-top: 2px; height: 18px; margin-left: 20px; opacity: 0.6; width: '+ (windowWidth*0.6) +'px; overflow: hidden;'">这是第{{ Number(k+1) }}个视频</view> -->
  79. </view>
  80. <image @click="down" src="@/static/img/index/down.png" style="width: 30px; height: 30px; margin-top: 5px; position: absolute; right: 20px;"></image>
  81. </view>
  82. </view>
  83. <scroll-view :style="'width: '+ (windowWidth) +'px; height: '+ ((windowHeight/1.6)*0.85) +'px;'" :scroll-y="true" :scroll-top="scrollTop">
  84. <block v-for="(list,index) in originList">
  85. <view @click="selectThisVideo(index,list.pays)" :style="'width: '+ (windowWidth) +'px; display: flex; flex-direction: row;'">
  86. <image :src="list.img"
  87. mode="aspectFill" style="width: 70px; height: 80px; margin-top: 15px; margin-left: 15px; border-radius: 5px;"></image>
  88. <view style="display: flex; flex-direction: column; margin-top: 15px; margin-left: 10px;">
  89. <view style="display: flex; flex-direction: row;">
  90. <view style="font-size: 18px; color: #FFFFFF; font-weight: bold;">{{list.name}}</view>
  91. <image v-if="list.pays*1==1" src="@/static/shilu-login/2.png" style="width: 50rpx; height: 50rpx; margin-left: 20rpx;"></image>
  92. </view>
  93. <view :style="'font-size: 16px; color: #FFFFFF; margin-top: 5px; width: '+ (windowWidth*0.7) +'px; overflow: hidden;'">{{list.title}}</view>
  94. <view :style="'font-size: 16px; color: #FFFFFF; margin-top: 5px; width: '+ (windowWidth*0.7) +'px; overflow: hidden; opacity: 0.6;'">{{list.msg}}</view>
  95. </view>
  96. </view>
  97. </block>
  98. <!-- <view @click="getMoreSelectVideo" :style="'width: 100px; height: 40px; border: 1px #FFFFFF solid; border-radius: 40px; margin-top: 30px; margin-left: '+ (windowWidth*0.38) +'px; opacity: 0.6;'">
  99. <view v-if="!datareload" style="font-size: 14px; font-weight: bold; color: #FFFFFF; text-align: center; padding-top: 10px;">获取更多</view>
  100. <view v-if="datareload" style="font-size: 14px; font-weight: bold; color: #FFFFFF; text-align: center; padding-top: 10px;">没有数据了</view>
  101. </view> -->
  102. <view style="width: 1px; height: 1px; margin-top: 30px;"></view>
  103. </scroll-view>
  104. </view>
  105. <view v-if="fenji==2" :style="'width: '+ windowWidth +'px; background-color: #202020; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  106. <view :style="'width: '+ windowWidth +'px; height: 35px;'">
  107. <view style="display: flex; flex-direction: row;">
  108. <view style="display: flex; flex-direction: column;">
  109. <view style="display: flex; flex-direction: row;">
  110. <image src="@/static/shilu-login/2.png" style="width: 20px; height: 20px; margin-top: 10px; margin-left: 20px;"></image>
  111. <view :style="'font-size: 16px; font-weight: bold; color: #FFFFFF; margin-top: 9px; margin-left: 20px; height: 22px; width: '+ (windowWidth*0.6) +'px; overflow: hidden;'">
  112. 当前视频 没有权限播放
  113. </view>
  114. </view>
  115. <!-- <view :style="'font-size: 12px; color: #FFFFFF; margin-top: 2px; height: 18px; margin-left: 20px; opacity: 0.6; width: '+ (windowWidth*0.6) +'px; overflow: hidden;'">这是第{{ Number(k+1) }}个视频</view> -->
  116. </view>
  117. <image @click="downbuy" src="@/static/img/index/down.png" style="width: 30px; height: 30px; margin-top: 5px; position: absolute; right: 20px;"></image>
  118. </view>
  119. </view>
  120. <view class="flex space alcenter wrap" style="padding:30rpx 30rpx 10rpx 30rpx;flex-direction: row; display:flex;">
  121. <view class="ft14" style="color: #fff;">我的{{hbmc}}:{{userinfo.money*1}}</view>
  122. <view class="ft14" style="color: #fff;" v-if="userinfo.group_id == 1">普通用户</view>
  123. <view class="ft14" style="color: #fff;" v-if="userinfo.group_id == 2">VIP用户</view>
  124. </view>
  125. <view style="padding:10rpx 30rpx; border: #FFFFFF solid; 1upx; margin:10upx 30upx; border-radius: 16upx;">
  126. <view v-if="userinfo.group_id == 1" class="flex space alcenter wrap" style="flex-direction: row; display:flex;">
  127. <view class="ft14" IF style="color: #fff;">单集视频:{{originList[baymid].priced*1}}{{hbmc}}</view>
  128. <view class="ft14" style="color: #fff;">整部视频:{{originList[baymid].priceq*1}}{{hbmc}}</view>
  129. </view>
  130. <view v-if="userinfo.group_id == 2" class="flex space alcenter wrap" style="flex-direction: row; display:flex;">
  131. <view class="ft14" style="color: #fff;">VIP单集视频:{{originList[baymid].vippriced*1}}{{hbmc}}</view>
  132. <view class="ft14" style="color: #fff;">VIP整部视频:{{originList[baymid].vippriceq*1}}{{hbmc}}</view>
  133. </view>
  134. <view class="flex space alcenter wrap mt10" style="flex-direction: row; display:flex;">
  135. <view @click="buyAct(1)" class="gdfgjh" style="width: 49%; float: left;">购买单集视频</view>
  136. <view @click="buyAct(0)" class="gdfgjh" style="width: 49%; float: left;">购买整部视频</view>
  137. </view>
  138. </view>
  139. <view style="padding:10rpx 30rpx; border: #FFFFFF solid; 1upx; margin:10upx 30upx; border-radius: 16upx;">
  140. <view class="ft14 ftw500" style="color: #fff; ">当前充值优惠活动:</view>
  141. <view class="flex space alcenter wrap mt5" style="flex-direction: row; display:flex;">
  142. <block v-for="(tm,index) in moneyList">
  143. <view @click="congzs(tm.money)" class="pd5_15 mt10" style="background: #fff; border-radius: 10upx; width: 49%;">
  144. <view class="ft14 ftw500" style="color: #666;">充值¥{{tm.money*1}}</view>
  145. <view class="ft12" style="color: #666;">{{hbmc}}{{tm.num*1}} +送{{tm.coupon*1}}</view>
  146. </view>
  147. </block>
  148. </view>
  149. </view>
  150. <view style="padding:10rpx 30rpx; border: #FFFFFF solid; 1upx; margin:10upx 30upx; border-radius: 16upx;">
  151. <view class="ft14 ftw500" style="color: #fff; ">VIP用户权益:</view>
  152. <view class="flex space alcenter wrap mt5" style="flex-direction: row; display:flex;">
  153. <view v-if="originList[baymid].vippriced*1>0" class="ft12" style="color: #fff;">VIP单集视频:{{originList[baymid].vippriced*1}} {{hbmc}}</view>
  154. <view v-if="originList[baymid].vippriced*1==0 && originList[baymid].vippriceq*1>0" class="ft12" style="color: #fff;">VIP当前单节视频免费</view>
  155. <view v-if="originList[baymid].vippriceq*1>0" class="ft12" style="color: #fff;">VIP整部视频:{{originList[baymid].vippriceq*1}} {{hbmc}}</view>
  156. <view v-if="originList[baymid].vippriceq*1==0" class="ft12" style="color: #fff;">VIP当前整部免费</view>
  157. </view>
  158. <view class="ft12 mt5" style="color: #ff0000;">开通VIP享受更多优惠福利</view>
  159. <view @click="govip()" class="gdfgjh mt10">开通VIP</view>
  160. </view>
  161. </view>
  162. </uni-popup>
  163. </view>
  164. </template>
  165. <script>
  166. import configs from "@/common/config.js"
  167. let audo = uni.createInnerAudioContext()
  168. export default {
  169. data() {
  170. return {
  171. sharedata: {
  172. type: 2,
  173. strShareUrl: "",
  174. strShareTitle: "分享标题",
  175. strShareSummary: "分享总结",
  176. strShareImageUrl: ""
  177. },
  178. fenji: 1,
  179. controls:true,
  180. originList: [], // 源数据
  181. displaySwiperList: [], // swiper需要的数据
  182. displayIndex: 0, // 用于显示swiper的真正的下标数值只有:0,1,2。
  183. originIndex: 0, // 记录源数据的下标
  184. windowWidth:0,
  185. windowHeight:0,
  186. current:0,
  187. oid:0,
  188. isplay:true,//是否自动播放下一个视频
  189. playCount:2,//剩余多少视频加载视频列表
  190. nodate:true, //true 有数据
  191. duration: 500,
  192. issp:'',
  193. isqp:true,
  194. page: 1,
  195. urls:configs.webUrl,
  196. baymid:0,
  197. scrollTop:0,
  198. vid: 0,
  199. mid: 0,
  200. isbuylx: 0, //大于0单节购买 0全集
  201. safeArea:0,
  202. ttuop:0,
  203. uid:0,
  204. heightxw:100,
  205. hbmc:'',
  206. userinfo:[],
  207. moneyList:[]
  208. };
  209. },
  210. onLoad(e) {
  211. this.hbmc=uni.getStorageSync("config").site.hbmc
  212. console.log('eeeeeee-----',e)
  213. if(e.fxpid){
  214. if(e.fxpid>0){
  215. uni.setStorage({
  216. key: 'fxpid',
  217. data: e.fxpid
  218. })
  219. }
  220. }
  221. if(uni.getStorageSync("userinfo")){
  222. this.cztc();
  223. this.uid=uni.getStorageSync("userinfo").id
  224. }
  225. uni.getSystemInfo({
  226. success: res => {
  227. this.safeArea = res.safeAreaInsets.bottom;
  228. if(this.safeArea>0){
  229. this.heightxw=97
  230. }
  231. }
  232. })
  233. uni.setStorage({
  234. key: 'isbuy',
  235. data: 1
  236. })
  237. if(e.vid){
  238. this.vid=e.vid
  239. }
  240. if(e.mid){
  241. this.mid=e.mid
  242. }
  243. // #ifdef MP-TOUTIAO
  244. this.ttuop=64
  245. // #endif
  246. this.windowWidth = uni.getSystemInfoSync().windowWidth
  247. this.windowHeight = uni.getSystemInfoSync().windowHeight-this.safeArea-this.ttuop
  248. console.log(this.windowHeight)
  249. //this.Recommend();
  250. },
  251. onShow() {
  252. this.gxdd()
  253. if(uni.getStorageSync("userinfo")){
  254. this.ongrzlTap()
  255. }else{
  256. this.denglu()
  257. }
  258. },
  259. onShareAppMessage: function(res) {
  260. // #ifdef MP-WEIXIN
  261. var href='/pages/client/tuan/detail?vid='+this.vid+'&fxpid='+this.uid+'&mid=0'
  262. console.log(res)
  263. let that = this;
  264. const obj = {
  265. title: "发送给好友",
  266. imageUrl: '',
  267. path: href,
  268. success: function(res) {
  269. console.log(res, "转发成功")
  270. },
  271. fail: function(res) {
  272. wx.showToast({
  273. title: '发送失败',
  274. icon:'none'
  275. })
  276. }
  277. }
  278. return obj
  279. // #endif
  280. },
  281. methods: {
  282. cztc(){
  283. let data = {};
  284. data.token = uni.getStorageSync("userinfo").token;
  285. data.uid = uni.getStorageSync("userinfo").id;
  286. uni.request({
  287. url: this.configs.webUrl+'/api/user/cztc',
  288. data: data,
  289. success: res =>{
  290. console.log(res.data)
  291. this.moneyList=res.data
  292. },
  293. fail: (data, code) => {
  294. //console.log('fail' + JSON.stringify(data));
  295. }
  296. });
  297. },
  298. share(){
  299. var href='/pages/client/tuan/detail?vid='+this.vid+'&fxpid='+this.uid+'&mid=0'
  300. // #ifdef H5
  301. uni.setClipboardData({
  302. data: this.urls+'/h5/#'+href,
  303. complete() {
  304. uni.showToast({
  305. title: "分享连接已复制到剪贴板"
  306. })
  307. }
  308. })
  309. // #endif
  310. // #ifndef H5
  311. uni.share({
  312. provider: "weixin",
  313. scene: "WXSenceTimeline",
  314. type: 0,
  315. href: href,
  316. title: '分享标题',
  317. summary: '分享总结',
  318. imageUrl: '',
  319. success: function(res) {
  320. console.log("success:" + JSON.stringify(res));
  321. },
  322. fail: function(err) {
  323. console.log("fail:" + JSON.stringify(err));
  324. }
  325. })
  326. // #endif
  327. },
  328. gxdd(){
  329. var isbuy = uni.getStorageSync("isbuy")
  330. console.log('更新列表')
  331. this.page=1
  332. this.Recommend();
  333. },
  334. buyAct(mid){
  335. if(mid==1){
  336. mid = this.originList[this.baymid].mid
  337. }
  338. var info=this.originList[this.baymid]
  339. if(uni.getStorageSync("userinfo")){
  340. this.isbuylx=mid
  341. uni.setStorage({//缓存配置信息
  342. key: 'buydata',
  343. data: info
  344. })
  345. uni.setStorage({
  346. key: 'isbuy',
  347. data: 1
  348. })
  349. this.downbuy()
  350. uni.navigateTo({
  351. url:'/pages/client/tuan/buy?id='+this.vid+'&mid='+mid
  352. })
  353. }else{
  354. this.denglu()
  355. return false
  356. }
  357. },
  358. congzs(price){
  359. var mid = this.originList[this.baymid].mid
  360. uni.navigateTo({
  361. url:'/pages/client/vipcard/recharge?id='+this.vid+'&mid='+mid+'&price='+price
  362. })
  363. },
  364. govip(){
  365. var mid = this.originList[this.baymid].mid
  366. if(uni.getStorageSync("userinfo")){
  367. this.downbuy()
  368. uni.navigateTo({
  369. url:'/pages/client/vipcard/index?vid='+this.vid+'&mid='+mid
  370. })
  371. }else{
  372. this.denglu()
  373. return false
  374. }
  375. },
  376. timeupdate(event){
  377. // console.log(11111)
  378. // console.log(this.displayIndex)
  379. if(event.detail.currentTime>0 && this.originList[this.originIndex].pays==1){
  380. uni.createVideoContext(this.originList[this.originIndex]._id,this).seek(0);
  381. uni.createVideoContext(this.originList[this.originIndex]._id,this).pause();
  382. this.fenji=2
  383. this.baymid=this.originIndex
  384. this.$refs.select.open('bottom');
  385. }
  386. },
  387. selectThisVideo(index,pays){
  388. this.down();
  389. if(pays==1){
  390. this.baymid=index
  391. this.fenji=2
  392. this.$refs.select.open('bottom');
  393. }else{
  394. this.duration = 20;
  395. this.originIndex=index
  396. this.initSwiperData(index);
  397. setTimeout(()=>{
  398. this.duration = 500;
  399. },500)
  400. }
  401. },
  402. down(){
  403. this.$refs.select.close();
  404. },
  405. downbuy(){
  406. this.$refs.select.close();
  407. },
  408. sellxj() {
  409. this.fenji=1
  410. this.$refs.select.open('bottom');
  411. this.$nextTick(()=>{
  412. let num1 = (this.windowHeight/1.6)*0.85;
  413. let num2 = num1/4.78;
  414. this.scrollTop = num2 * Number(this.k);
  415. })
  416. },
  417. tapVideoHover(index,pays){
  418. this.baymid=index
  419. this.fenji=2
  420. this.$refs.select.open('bottom');
  421. },
  422. tapVides(){
  423. this.isqp=!this.isqp
  424. },
  425. ongrzlTap(){
  426. let data = {};
  427. data.token = uni.getStorageSync("userinfo").token;
  428. data.uid = uni.getStorageSync("userinfo").id;
  429. uni.request({
  430. url: this.urls+'/api/user/index',
  431. data: data,
  432. success: res =>{
  433. if(res.data.code==1){
  434. let ionfo=res.data.data
  435. this.userinfo=ionfo
  436. }else{
  437. uni.showToast({ title: res.data.msg,icon:"none" });
  438. }
  439. },
  440. fail: (data, code) => {
  441. //console.log('fail' + JSON.stringify(data));
  442. }
  443. });
  444. },
  445. Recommend(){
  446. this.originList=[]
  447. var uid=0;
  448. if(uni.getStorageSync("userinfo")){
  449. uid=uni.getStorageSync("userinfo").id
  450. }
  451. uni.request({
  452. //url: this.urls+'/api/video/videoinfo?page='+this.page+'&uid='+uid,
  453. url: this.urls+'/api/video/videoinfo?page='+this.page+'&uid='+uid+'&vid='+this.vid+'&mid='+this.mid+'&token='+uni.getStorageSync("userinfo").token,
  454. success: (res) => {
  455. if(res.data.isempty==1){
  456. // #ifdef MP-WEIXIN
  457. if(res.data.videodata){
  458. uni.setNavigationBarTitle({
  459. title: res.data.videodata.name
  460. });
  461. }
  462. // #endif
  463. var msg = res.data.data
  464. var midlog = res.data.midlog
  465. //2.这里把视频添加到视频列表
  466. if(this.page==1){
  467. this.originList=res.data.data
  468. for (let i = 0; i < msg.length; i++) {
  469. if(this.mid>0){//等于0 上一个页面视频id未0 相当于没有上传
  470. if(msg[i].mid==this.mid){//判断判断上一个页面视频id
  471. this.originIndex=i
  472. }
  473. }else{
  474. if(msg[i].mid==midlog){//判断当前历史记录最新视频id
  475. this.originIndex=i
  476. }
  477. }
  478. }
  479. this.initSwiperData(this.originIndex);
  480. }else{
  481. for (let i = 0; i < msg.length; i++) {
  482. this.originList.push(msg[i])
  483. }
  484. }
  485. this.page=this.page+1
  486. }else{
  487. this.nodate=false
  488. }
  489. }
  490. })
  491. },
  492. ended(){
  493. //console.log('isplay----',this.isplay)
  494. // 1.播放当前视频结束时触发,自动切换下一个视频
  495. if(this.isplay){
  496. if(this.displayIndex<2){
  497. this.current=this.displayIndex+1
  498. }else{
  499. this.current=0
  500. }
  501. this.isqp=true
  502. console.log('显示swiper Index:',this.displayIndex)
  503. }
  504. },
  505. /**
  506. * 初始一个显示的swiper数据
  507. * @originIndex 从源数据的哪个开始显示默认0,如从其他页面跳转进来,要显示第n个,这个参数就是他的下标
  508. */
  509. initSwiperData(originIndex = this.originIndex) {
  510. this.isqp=false
  511. //console.log('--------当前数据 Index:',originIndex)
  512. const originListLength = this.originList.length; // 源数据长度
  513. const displayList = [];
  514. displayList[this.displayIndex] = this.originList[originIndex];
  515. displayList[this.displayIndex - 1 == -1 ? 2 : this.displayIndex - 1] =
  516. this.originList[
  517. originIndex - 1 == -1 ? originListLength - 1 : originIndex - 1
  518. ];
  519. displayList[this.displayIndex + 1 == 3 ? 0 : this.displayIndex + 1] =
  520. this.originList[
  521. originIndex + 1 == originListLength ? 0 : originIndex + 1
  522. ];
  523. this.displaySwiperList = displayList;
  524. audo.pause()
  525. if(this.oid>=this.originList.length){
  526. this.oid=0
  527. }
  528. if(this.oid<0){
  529. this.oid=this.originList.length-1
  530. }
  531. //console.log('++++++++++++上一条播放数据 Index:',this.oid)
  532. uni.createVideoContext(this.originList[this.oid]._id,this).stop();
  533. if(this.originList[originIndex].pays==1){
  534. this.isqp=true
  535. this.baymid=this.originIndex
  536. this.fenji=2
  537. this.$refs.select.open('bottom');
  538. }else{
  539. setTimeout(()=>{
  540. this.isqp=true
  541. console.log('qqqqqq:',this.originList[originIndex]._id)
  542. //audo.play()
  543. uni.createVideoContext(this.originList[originIndex]._id,this).play();
  544. this.bfjl(this.originList[originIndex].mid)
  545. },500)
  546. }
  547. var pCount=this.originList.length-this.playCount
  548. if(originIndex==pCount && this.nodate){
  549. this.Recommend()
  550. }
  551. },
  552. /**
  553. * swiper滑动时候
  554. */
  555. swiperChange(event) {
  556. const { current } = event.detail;
  557. const originListLength = this.originList.length; // 源数据长度
  558. // =============向后==========
  559. if (this.displayIndex - current == 2 || this.displayIndex - current == -1) {
  560. this.originIndex =
  561. this.originIndex + 1 == originListLength ? 0 : this.originIndex + 1;
  562. this.displayIndex = this.displayIndex + 1 == 3 ? 0 : this.displayIndex + 1;
  563. //console.log('+++',this.originIndex)
  564. this.oid=this.originIndex-1
  565. this.initSwiperData(this.originIndex);
  566. }
  567. // ======如果两者的差为-2或者1则是向前滑动============
  568. else if (this.displayIndex - current == -2 || this.displayIndex - current == 1) {
  569. this.originIndex = this.originIndex - 1 == -1 ? originListLength - 1 : this.originIndex - 1;
  570. this.displayIndex = this.displayIndex - 1 == -1 ? 2 : this.displayIndex - 1;
  571. //console.log('---',this.originIndex)
  572. this.oid=this.originIndex+1
  573. this.initSwiperData(this.originIndex);
  574. }
  575. },
  576. detail(vid,mid){
  577. var fxpid=1
  578. if(uni.getStorageSync("userinfo")){
  579. fxpid=uni.getStorageSync("userinfo").id
  580. }
  581. uni.navigateTo({
  582. url:'/pages/client/tuan/detail?vid='+vid+'&mid='+mid+'&fxpid='+fxpid
  583. })
  584. },
  585. toComment(sss,vid,mid){
  586. if(uni.getStorageSync("userinfo")){
  587. }else{
  588. this.denglu()
  589. return false
  590. }
  591. const video = this.displaySwiperList[this.displayIndex];
  592. //console.log(sss)
  593. if(sss==1){
  594. this.displaySwiperList[this.displayIndex].iszj=2
  595. }else{
  596. this.displaySwiperList[this.displayIndex].iszj=1
  597. }
  598. let this_=this
  599. let data = {'vid':vid,'mid':mid};
  600. data.token = uni.getStorageSync("userinfo").token
  601. data.uid = uni.getStorageSync("userinfo").id
  602. uni.request({
  603. url: this_.urls+'/api/user/videorecord',
  604. data: data,
  605. success: data => {
  606. // uni.showToast({
  607. // icon:'none',
  608. // title:data.data.msg
  609. // })
  610. },
  611. fail: (data, code) => {
  612. }
  613. });
  614. },
  615. bfjl(mid){//更新播放记录
  616. let this_=this
  617. if(uni.getStorageSync("userinfo")){
  618. let data = {'vid':this_.vid,'mid':mid};
  619. data.uid = uni.getStorageSync("userinfo").id
  620. uni.request({
  621. url: this_.urls+'/api/video/bfjl',
  622. data: data,
  623. success: data => {
  624. },
  625. fail: (data, code) => {
  626. }
  627. });
  628. }
  629. },
  630. controlstoggle(e){
  631. console.log(e.detail.show);
  632. this.issp=e.detail.show
  633. },
  634. cLike(sss,vid,mid){
  635. if(uni.getStorageSync("userinfo")){
  636. }else{
  637. this.denglu()
  638. return false
  639. }
  640. const video = this.displaySwiperList[this.displayIndex];
  641. if(sss==1){
  642. this.displaySwiperList[this.displayIndex].like=2
  643. video.like_n += 1;
  644. }else{
  645. this.displaySwiperList[this.displayIndex].like=1
  646. video.like_n -= 1
  647. }
  648. console.log(vid)
  649. let this_=this
  650. let data = {'vid':vid,'mid':mid};
  651. data.token = uni.getStorageSync("userinfo").token
  652. data.uid = uni.getStorageSync("userinfo").id
  653. uni.request({
  654. url: this_.urls+'/api/user/tapLove',
  655. data: data,
  656. success: data => {
  657. // uni.showToast({
  658. // icon:'none',
  659. // title:data.data.msg
  660. // })
  661. // if(data.data.msg=='取消成功'){
  662. // video.like_n -= 1
  663. // }else{
  664. // video.like_n += 1;
  665. // }
  666. },
  667. fail: (data, code) => {
  668. }
  669. });
  670. },
  671. denglu(){
  672. uni.showModal({
  673. title: '温馨提示',
  674. content: '请先登录',
  675. showCancel: true,
  676. confirmText: "登录",
  677. success: function (res) {
  678. if (res.confirm) {
  679. uni.navigateTo({
  680. url:"/pages/login/login"
  681. })
  682. } else if (res.cancel) {
  683. //uni.navigateBack();
  684. }
  685. }
  686. });
  687. }
  688. },
  689. created() {
  690. },
  691. };
  692. </script>
  693. <style>
  694. page{
  695. background: #000000;
  696. }
  697. .title {
  698. width: 100%;
  699. display: flex;
  700. justify-content: center;
  701. align-items: center;
  702. height: 60rpx;
  703. }
  704. .swiper {
  705. }
  706. .wrap_content {
  707. border-radius: 20rpx;
  708. display: flex;
  709. justify-content: center;
  710. align-items: center;
  711. background: gray;
  712. color: aqua;
  713. height: 100%;
  714. font-size: 80px;
  715. margin: 0rpx 40rpx;
  716. }
  717. .container {background-color: #000000;}
  718. .item {
  719. /* width : 750rpx; */
  720. background-color: #000000;
  721. position: relative;
  722. }
  723. .videoHover{
  724. position: absolute;
  725. top: 0px;
  726. left: 0;
  727. flex: 1;
  728. background-color: rgba(0,0,0,0.1);
  729. justify-content: center;
  730. align-items: center;
  731. /* border-style: dashed;
  732. border-color: #DD524D;
  733. border-width: 1px; */
  734. }
  735. .playState{
  736. width: 160rpx;
  737. height: 160rpx;
  738. opacity: 0.2;
  739. }
  740. .userInfo{
  741. position: absolute;
  742. z-index: 99;
  743. bottom:30%;
  744. right: 10px;
  745. width: 100rpx;
  746. text-align: center;
  747. flex-direction: column;
  748. }
  749. .userAvatar{
  750. border-radius: 500%;
  751. margin-bottom: 15px;
  752. border-style: solid;
  753. border-width: 2px;
  754. border-color: #ffffff;
  755. }
  756. .userAvatar{
  757. width : 100rpx;
  758. height: 100rpx;
  759. }
  760. .likeIco,.shareIco,.commentIco{
  761. width : 60rpx;
  762. height: 60rpx;
  763. margin-top: 15px;
  764. }
  765. .likeNum,.commentNum,.shareTex{
  766. color: #ffffff;
  767. font-size: 30rpx;
  768. text-align: center;
  769. margin: 5px;
  770. }
  771. .likeNumActive{
  772. color: red;
  773. }
  774. .contentcd{
  775. width: 720rpx;
  776. z-index: 99;
  777. position: absolute;
  778. bottom: 70rpx;
  779. /* justify-content: center; */
  780. padding: 15rpx;
  781. flex-direction: column;
  782. justify-content: flex-start;
  783. color: #ffffff;
  784. }
  785. .userName {
  786. font-size: 30rpx;
  787. color: #ffffff;
  788. margin-top: 80upx;
  789. margin-left: -12rpx;
  790. }
  791. .words {
  792. margin-top: 16rpx;
  793. font-size: 30rpx;
  794. color: #ffffff;
  795. margin-bottom: 20rpx;
  796. }
  797. .wordss {
  798. margin-top: 10rpx;
  799. font-size: 26rpx;
  800. color: #ffffff;
  801. }
  802. .root{
  803. background-color: #000000;
  804. }
  805. .gdfgjh{
  806. font-size: 30rpx;
  807. font-weight: 600;
  808. line-height: 90rpx;
  809. background: #fff;
  810. border-radius: 18rpx;
  811. padding: 0 20rpx;
  812. text-align: center;
  813. margin-bottom: 20rpx;
  814. }
  815. .tsvideo{
  816. /* animation:showDivAni 1s 1; */
  817. }
  818. @keyframes showDivAni{
  819. 0%{opacity:0;}
  820. 100%{opacity: 1;}
  821. }
  822. .tsimg{
  823. /* animation:fadenum12 10s 1; */
  824. }
  825. @keyframes fadenum12{
  826. 0%{opacity: 1;}
  827. 10%{opacity: 0.8;}
  828. 100%{opacity: 0;}
  829. }
  830. </style>