index.nvue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207
  1. <template>
  2. <view class="container">
  3. <!--
  4. 注意:这是 App 所用页面,请勿引入微信小程序或浏览器运行,最好运行在真机
  5. 1. new_index.nvue、index.nvue这两个是App页面
  6. 2. index.nvue - 页面预加载使用 - 在线预加载方案
  7. 3. 另外:data.js 是上一版本留下的假数据,这一版改成了 URL 请求了(如不需要可以删除,也可作为后端请求参考)
  8. 4. 请各位大神多多留手,我已经把请求内存开到最大了
  9. 5. 视频 id 切记是字符串类型
  10. 6. 这里仅 App 端引入了 App 端专用评论,小程序 、H5 引入的时候 可以作为参考
  11. App、小程序、H5评论请参考插件:https://ext.dcloud.net.cn/plugin?id=7875
  12. -->
  13. <!-- 头部导航 -->
  14. <view class="header">
  15. <view class="items" @click.stop="navTap(2)">
  16. <text class="tName" :class="currentNav==2?'on':''">推荐</text>
  17. <view class="tLine" v-if="currentNav==2"></view>
  18. </view>
  19. <view class="items" @click.stop="navTap(1)">
  20. <text class="tName" :class="currentNav==1?'on':''">最新</text>
  21. <view class="tLine" v-if="currentNav==1"></view>
  22. </view>
  23. </view>
  24. <view class="footer">
  25. <text class="items" @click="goIndex">首页</text>
  26. <text class="items on">视频</text>
  27. <view class="items" @click="goCarts">
  28. <view class="itemCon">
  29. <text class="cart">购物车</text>
  30. <uni-badge v-if="cartNum>0" class="uni-badge-left-margin" type='error' :text="cartNum"></uni-badge>
  31. </view>
  32. </view>
  33. <text class="items" @click="goUser">我的</text>
  34. </view>
  35. <view class="noVideo acea-row row-center-wrapper" v-if="!dataList.length">
  36. <view>
  37. <image :src="imgHost+'/statics/images/no-video.png'" class="pictrue"></image>
  38. <text class="tips">暂无短视频内容哦~</text>
  39. </view>
  40. </view>
  41. <!-- <view @click="tolistVideo" style="position: fixed; margin-top: 100upx; right: 40upx;">
  42. <text style="padding: 10upx; padding-left: 40upx; padding-right: 40upx; border-radius: 20upx; background-color: #F8F8F8; font-size: 14px;">H5/小程序</text>
  43. </view>
  44. <view @click="autoPlay" style="position: fixed; margin-top: 100upx; left: 40upx;">
  45. <text style="padding: 10upx; padding-left: 40upx; padding-right: 40upx; border-radius: 20upx; background-color: #F8F8F8; color: #007AFF; font-weight: bold; font-size: 14px;">{{autoplayText}}</text>
  46. </view>
  47. <view @click="previewVideo" style="position: fixed; margin-top: 200upx; right: 40upx;">
  48. <text style="padding: 10upx; padding-left: 40upx; padding-right: 40upx; border-radius: 20upx; background-color: #F8F8F8; font-size: 14px;">App端-预览视频界面</text>
  49. </view>
  50. <view @click="wxh5Video" style="position: fixed; margin-top: 300upx; right: 40upx;">
  51. <text style="padding: 10upx; padding-left: 40upx; padding-right: 40upx; border-radius: 20upx; background-color: #F8F8F8; font-size: 14px;">微信/H5端-预览视频界面</text>
  52. </view> -->
  53. <image v-if="isShowAixin" src="../static/img/index/aixining.png" :style="'position: fixed; margin-left: '+ aixinLeft +'px; margin-top: '+ aixinTop +'px; width: 70px; height: 65px; transform: rotate('+ Rotate +'deg);'"></image>
  54. <view :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'">
  55. <!--
  56. 1.这里的 swiper 不是用来控制视频滑动的,而是用来控制左右滑动的,如果不需要的可以改成 view
  57. 2.为了 视频无限加载,已经把 21 行的 appear 去掉了,加上了 loadmore 方法(第10行)
  58. 3.由于方法比较多,可以采取下面的方式查看代码:
  59. (1)Mac:按住 option 键,然后点击方法名,即可跳转到方法
  60. (2)windows:按住 Alt 键,然后鼠标左击,即可跳转到方法
  61. -->
  62. <list @loadmore="getData" @scroll="scrolls" :loadmoreoffset="wHeight*1" :show-scrollbar="false" ref="listBox" :pagingEnabled="true" :scrollable="true">
  63. <!-- 刷新模块 -->
  64. <refresh class="refresh" @refresh="onrefresh" @pullingdown="onpullingdown" :display="refreshing ? 'show' : 'hide'">
  65. <loading style="background-color: #FFFFFF;">
  66. <image src="../static/img/index/logins.gif" :style="'width: 80upx; height: 40upx; margin-top: 80upx; margin-bottom: 30upx; margin-left: '+ (windowWidth - 200) +'px;'"></image>
  67. </loading>
  68. </refresh>
  69. <!-- 循环数据 -->
  70. <cell v-for="(item,i) in dataList" :key="i">
  71. <!-- 用div把视频模组套起来 -->
  72. <div :style="'width: '+ windowWidth +'px; height: '+ boxStyle.height +'px;'" @disappear="stop()">
  73. <view v-if="Math.abs(k-i)<=1">
  74. <view class="root">
  75. <!--
  76. 具体视频参数可以参考官方文档
  77. 说明:
  78. 1.v-if很关键,这里主要是为了减少 dom 元素【这样才不会加载视频多了闪退】,
  79. 这里 Math.abs(k-i)<=5 也就是往上预加载 5 个视频,往下预加载 5
  80. 个视频这样做的目的是为了让视频能够提前加载但是不播放,在真正滑到位
  81. 置的时候播放视频。
  82. 【2.0.1就是 1 Math.abs(k-i)<=1:请勿修改,记住,要不然会提前播放很多视频】
  83. 2.要注意 @play="playIngs" 里面的 playIngs 方法,这个方法只是在视频播放的时候
  84. 起效果,我们控制视频播放不是用这个的。这个的主要作用是给视频封面的。我们先用
  85. 下面的视频封面盖住视频,等到视频播放的时候,我们不要急着直接播放,而是延迟一下下,
  86. 300-600ms左右。因为视频播放需要一点点时间,这点时间里会黑屏,这个时候我们就用
  87. 下面的封面盖住,这样用户就不会有从黑屏到有画面的感觉了,但是如果遇到视频太大,缓冲
  88. 时间太长,还是会出现短暂的黑屏,大部分是不会有黑屏的(这样盖住的话)。
  89. 【更新记录:2.0版】已经解决了视频黑屏问题,和加载速度慢的情况,如果还是出现了黑屏,
  90. 意味着此时手滑动的速度,已经超过了视频加载的速度,对于这个问题,建议修改 preloadNumber
  91. 变量,当它的值大一点的时候就会提前加载视频,这样用户在滑到视频的时候就不会有停顿感了
  92. 【注意】:老用户在 video 中增加和修改
  93. (1):muted="!item.playIng",
  94. (2)@timeupdate="timeupdate($event,i)"
  95. (3)把 199 行注释了,
  96. (4):id="item.id",
  97. (5)修改:uni.createVideoContext(this.dataList[this.k].id + '' + this.k,this) 为
  98. uni.createVideoContext(this.dataList[this.k].id,this)
  99. (6)在 timeupdate 方法里加入,if(index == this.k){把里面的加一个总的判断}
  100. 3.其他的下面有详解
  101. -->
  102. <video
  103. :ref="'item'+i"
  104. :id="item.id"
  105. :loop="true"
  106. :src="item.video_url"
  107. :muted="item.isplay"
  108. @play="playIngs(i)"
  109. :enable-progress-gesture="false"
  110. :page-gesture="false"
  111. :controls="false"
  112. :http-cache="true"
  113. :show-loading="false"
  114. :show-fullscreen-btn="false"
  115. :show-center-play-btn="false"
  116. :style="boxStyle"
  117. :object-fit="object_fit"
  118. @timeupdate="timeupdate($event,i)"
  119. ></video>
  120. <!-- 这里是封面 -->
  121. <!-- <image
  122. v-if="!item.playIng"
  123. :src="item.image"
  124. :mode="mode"
  125. :style="'width: '+ windowWidth +'px; height: '+ (wHeight - deleteHeight) +'px; position: absolute;'"
  126. ></image> -->
  127. <!--
  128. mode: 图片裁剪、缩放的模式
  129. mode 有 14 种模式,其中 5 种是缩放模式,9 种是裁剪模式。
  130. https://uniapp.dcloud.io/component/image
  131. -->
  132. </view>
  133. <!-- 直接用 view 就行了,一样是可以覆盖原生组件的 -->
  134. <!-- 这个是暂停时出现的图标 -->
  135. <view class="videoHover" @click="tapVideoHover(item.state,$event)" @touchstart="touchstartHover" :style="boxStyle">
  136. <image v-if="item.state=='pause'" class="playState" src="../static/img/index/play.png"></image>
  137. </view>
  138. <view class="userInfo">
  139. <!-- 1.头像 -->
  140. <image v-if="item.isShowProgressBarTime == false" @click="tozuozhe(item)" class="userAvatar" :src="item.type_image" mode="aspectFill"></image>
  141. <!-- 2.点赞 -->
  142. <view v-if="item.isShowProgressBarTime == false" @click="cLike(item);" style="opacity: 0.9; margin-top: 5px;">
  143. <image v-if="item.is_like" src="../static/img/index/xin.png" style="width: 29px; height: 29px; position: absolute; right: 6px;"></image>
  144. <image v-if="!item.is_like" src="../static/img/index/xin-2.png" style="width: 29px; height: 29px; position: absolute; right: 6px;"></image>
  145. <text style="color: #FFFFFF; margin-top: 5px; font-size: 12px; text-align: center; margin-top: 32px; font-weight: 400;">{{item.like_num}}</text>
  146. </view>
  147. <!-- 3.评论 -->
  148. <view v-if="item.isShowProgressBarTime == false" class="comment" @click="toComment(item)" style="opacity: 0.9; margin-top: 18px;">
  149. <image src="../static/img/index/evaluate.png" style="width: 54rpx; height: 50rpx; position: absolute; right: 7px;"></image>
  150. <text style="color: #FFFFFF; font-size: 12px; font-weight: 400; text-align: center; margin-top: 29px;">{{item.comment_num}}</text>
  151. </view>
  152. <!-- 收藏 -->
  153. <view @click="cCollect(item);" style="opacity: 0.9; margin-top: 18px;">
  154. <image v-if="item.is_collect" src="../static/img/index/collection02.png" style="width: 29px; height: 29px; position: absolute; right: 6px;"></image>
  155. <image v-if="!item.is_collect" src="../static/img/index/collection01.png" style="width: 29px; height: 29px; position: absolute; right: 6px;"></image>
  156. <text style="color: #FFFFFF; margin-top: 5px; font-size: 12px; text-align: center; margin-top: 36px; font-weight: 400;">{{item.collect_num}}</text>
  157. </view>
  158. <!-- 4.分享 -->
  159. <view class="shares" v-if="item.isShowProgressBarTime == false" @click="appShare('WXSceneSession',item.id)">
  160. <image class="img" src="../static/img/index/we-chat.png"></image>
  161. <text class="text">分享</text>
  162. </view>
  163. </view>
  164. <!-- 最底下的文字部分 -->
  165. <view class="content" v-if="dataList.length !== 0 && dataList[k].isShowProgressBarTime == false">
  166. <view class="cart" @click="goCart(item)" v-if="item.product_num>0">
  167. <image class="cartPic" src="../static/img/index/shopping-car.png"></image>
  168. <text class="cartName">购物</text>
  169. <text class="line"></text>
  170. <text class="cartName">视频款请点击这里购买</text>
  171. </view>
  172. <view class="timeCon" :style="'width: '+ (windowWidth - 90) +'px;'">
  173. <text class="userName" v-if="item.type_name.length<=12">{{item.type_name}}</text>
  174. <text class="userName" v-else>{{item.type_name.slice(0,12)}}...</text>
  175. <text class="time">.{{item.date}}</text>
  176. </view>
  177. <view class="words" :style="'width: '+ (windowWidth - 120) +'px;'">
  178. <view v-if="item.isMore || item.desc.length<=29">
  179. <text class="info">{{item.desc}}</text>
  180. <view class="close">
  181. <text v-if="item.isMore" class="more" @click="moreTap(item)">收起</text>
  182. <image v-if="item.isMore" class="imgClose" src="../static/img/index/drop-down.png"></image>
  183. </view>
  184. </view>
  185. <view class="wordsCon" v-else>
  186. <text class="info">{{item.desc.slice(0,29)}}...</text>
  187. <text class="more" @click="moreTap(item)">更多</text>
  188. <image class="img" src="../static/img/index/drop-down.png"></image>
  189. </view>
  190. </view>
  191. </view>
  192. <!-- 1.视频预览时的图片,currenttimes:就是获取当前滑块的时间点,如果不需要,可以注释掉 -->
  193. <!-- 2.如果使用下面的视频预览的话要注意的是视频链接最好是阿里云上的,因为
  194. https://xxxxxxxxx.mp4?x-oss-process=video/snapshot,t_1000,f_jpg
  195. 这个是阿里云的东西,至于其他的视频截帧我还没有试过。
  196. -->
  197. <!-- 3.阿里云视频截帧地址:https://help.aliyun.com/document_detail/64555.html -->
  198. <image
  199. v-if="item.isShowimage == true"
  200. :src="item.src+'?x-oss-process=video/snapshot,t_'+ currenttimes +'000,f_jpg'"
  201. mode="aspectFill"
  202. :style="'width: 120upx; height: 160upx; border-radius: 10upx; position: absolute; bottom: '+ (ProgressBarBottom + 160) +'upx; left: '+ (currentPositions - 15) +'px;'"
  203. ></image>
  204. </view>
  205. </div>
  206. </cell>
  207. </list>
  208. <!-- 1.注意:进度条这类拖拽的东西不能放进block\cell这些循环体中的,要不然touchmove方法会捕捉有误 -->
  209. <!-- <view v-if="dataList.length !== 0 && dataList[k].isShowProgressBarTime == true" :style="'position: absolute; bottom: '+ (ProgressBarBottom + this.windowWidth*0.2)/2 +'px; left: '+ (windowWidth*2 - this.windowWidth*1.35)/2 +'px;'">
  210. <text style="font-size: 22px; font-weight: bold; color: #F1F1F1;">{{changeTime}} / {{videoTimes}}</text>
  211. </view> -->
  212. <!-- 这里就是进度条了:纯手工进度条,调整位置的话就把他们的 bottom 改成一下就行了 -->
  213. <!-- <view v-if="isDragging == false" @touchmove="touchmove" @touchend="touchend" @touchstart="touchstart" style="position: absolute; bottom: 0; left: 0;"> -->
  214. <!-- 1.这一步必须加,为了适配低端机型 -->
  215. <!-- <text :style="'width: '+ windowWidth +'px; opacity: 0;'">.</text> -->
  216. <!-- 2.这是未加载的时的右边的灰色部分 -->
  217. <!-- <view :style="'width: '+ windowWidth +'px; height: 4upx; background-color: #C8C7CC; position: absolute; bottom: '+ ProgressBarBottom +'upx; opacity: '+ ProgressBarOpacity +';'"></view> -->
  218. <!-- 3.这里我采用的分离式办法:就是让滑动样式和不滑动的样式分开,这样相互不干扰,可以避免进度条闪动的问题 -->
  219. <!-- 4.注意:isShowProgressBarTime 加入了返回数据中 -->
  220. <!-- <view v-if="dataList.length !== 0 && dataList[k].isShowProgressBarTime == false" :style="'width: '+ (currentPosition) +'px; height: 4upx; background-color: #FFFFFF; position: absolute; bottom: '+ ProgressBarBottom +'upx; left: 0; opacity: '+ (ProgressBarOpacity - 0.1) +';'"></view>
  221. <view v-if="dataList.length !== 0 && dataList[k].isShowProgressBarTime == true" :style="'width: '+ (currentPositions) +'px; height: 8upx; background-color: #FFFFFF; position: absolute; bottom: '+ ProgressBarBottom +'upx; left: 0; opacity: '+ (ProgressBarOpacity + 0.05) +';'"></view>
  222. <view v-if="dataList.length !== 0 && dataList[k].isShowProgressBarTime == false" :style="'width: 4px; height: 4px; background-color: #FFFFFF; border-radius: 10px; position: absolute; bottom: '+ (ProgressBarBottom - 2) +'upx; left: '+ (currentPosition) +'px; opacity: '+ ProgressBarOpacity +';'"></view>
  223. <view v-if="dataList.length !== 0 && dataList[k].isShowProgressBarTime == true" :style="'width: '+ dotWidth +'px; height: '+ dotWidth +'px; background-color: #FFFFFF; border-radius: 10px; position: absolute; bottom: '+ (ProgressBarBottom - 5) +'upx; left: '+ (currentPositions - 5) +'px; opacity: '+ ProgressBarOpacity +';'"></view> -->
  224. <!-- </view> -->
  225. </view>
  226. <!--
  227. 请前往 douyin-scrollview.nvue 文件查看
  228. 已经全部注释
  229. 这里就是引入评论插件
  230. -->
  231. <uni-popup type="bottom" ref="pinglun" @touchmove.stop.prevent="moveHandle">
  232. <view :style="'width: '+ windowWidth +'px; height: '+ (boxStyle.height/heightNum) +'px; background-color: #fff; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  233. <!--
  234. 注意:
  235. deleteIOSHeight
  236. deleteAndroidHeight
  237. 这两个参数用于控制评论等的高度
  238. -->
  239. <douyin-scrollview
  240. :Width="windowWidth"
  241. :Height="(boxStyle.height/1.18)"
  242. :deleteIOSHeight="36"
  243. :deleteAndroidHeight="15"
  244. @closeScrollview="closeScrollview"
  245. @pinlunFun="pinlunFun"
  246. ></douyin-scrollview>
  247. </view>
  248. </uni-popup>
  249. <uni-popup type="bottom" ref="pinglunGoods" @touchmove.stop.prevent="moveHandle">
  250. <view :style="'width: '+ windowWidth +'px;background-color: #F5F5F5; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  251. <goodsList
  252. :Width="windowWidth"
  253. :Height="(boxStyle.height/1.18)"
  254. ></goodsList>
  255. </view>
  256. </uni-popup>
  257. </view>
  258. </template>
  259. <script>
  260. // import userList from './data.js'//这个是假数据
  261. const app = getApp();
  262. import {
  263. toLogin
  264. } from '@/libs/login.js';
  265. import {
  266. mapGetters
  267. } from 'vuex';
  268. /*
  269. 引入评论组件
  270. */
  271. import douyinScrollview from '../components/douyin-scrollview/douyin-scrollview.nvue'
  272. import goodsList from '../components/goodsList/index.vue'
  273. import {
  274. videoList,
  275. markeVideo
  276. } from '@/api/short-video.js';
  277. import {
  278. HTTP_REQUEST_URL
  279. } from '@/config/app.js';
  280. import {
  281. getCartCounts,
  282. } from '@/api/order.js';
  283. export default {
  284. computed: mapGetters(['isLogin','uid','cartNum']),
  285. data() {
  286. return {
  287. isGoods:false,
  288. //下面打🌟号的是必须要的基础字段
  289. //下面打💗号的是拥有滑动条的必须字段
  290. dataList:[],//用于数据循环的列表🌟💗
  291. wHeight:0,//获取的屏幕高度🌟💗
  292. boxStyle:{//视频,图片封面样式🌟💗
  293. 'height': 0,
  294. 'width': 0,
  295. },
  296. k:0,//默认为0🌟💗
  297. playIngIds:[],//正在播放的视频id列队,列队用于处理滑动过快导致的跳频问题🌟💗
  298. ready:false,//可忽略
  299. isDragging: false,//false代表停止滑动🌟💗
  300. refreshing: true,//用于下拉刷新🌟💗
  301. windowWidth: 0,//获取屏幕宽度🌟💗
  302. windowHeight: 0,
  303. dex: [0,0],//用于判断是上滑还是下滑,第一个存旧值,第二个存新值【目前在1.0.7已经废弃】
  304. currents: 0,//用于左右滑动,0代表视频界面,1代表右滑界面🌟💗
  305. platform: '',//用于获取操作系统:ios、android🌟💗
  306. playIng: false,//用于视频初始化时是否播放,默认不播放🌟💗
  307. videoTime: '',//视频总时长,这个主要用来截取时间数值💗
  308. videoTimes: '',//视频时长,用这个来获取时间值,例如:00:30这个时间值💗
  309. changeTime: '',//显示滑动进度条时变化的时间💗
  310. isShowimage: false,//是否显示封面【1.0.4已废弃,但是意思需要记住】
  311. currenttimes: 0,//当前时间💗
  312. isShowProgressBarTime: false,//是否拖动进度条,如果拖动(true)则显示进度条时间,否则不显示(false)【1.0.4已废弃,但是意思需要记住】
  313. ProgressBarOpacity: 0.7,//进度条不拖动时的默认值,就是透明的💗
  314. dotWidth: 0,//播放的小圆点,默认没有💗
  315. deleteHeight: 0,//测试高度🌟💗
  316. percent: 0,//百分小数💗
  317. currentPosition: 0,//滑块当前位置💗//2.0已弃用,现已用于后端参数
  318. currentPositions: 0,//滑块当前位置的副本💗//2.0已弃用,现已用于后端参数
  319. newTime: 0,//跟手滑动后的最新时间💗
  320. timeNumber: 0,//🌟💗
  321. ProgressBarBottom: 20,//进度条离底部的距离💗
  322. object_fit: 'contain',//视频样式默认包含🌟💗
  323. mode: 'aspectFit',//图片封面样式🌟💗
  324. timeout: "",//🌟用来阻止 setTimeout()方法
  325. voice: "",//🌟用来阻止 setTimeout()方法
  326. oldVideo: "",
  327. isAutoplay: false,//是否开启自动播放(默认不开启)
  328. autoplayText: "开启自动播放",
  329. timers: "",
  330. // 引入评论 - 参数
  331. heightNum: 1.18,
  332. // 双击点赞参数
  333. touchNum: 0,
  334. aixinLeft: 0,
  335. aixinTop: 0,
  336. isShowAixin: false,
  337. Rotate: 0,
  338. currentNav:1,
  339. limit: 6,
  340. page: 1
  341. }
  342. },
  343. components:{
  344. douyinScrollview,
  345. goodsList
  346. },
  347. watch:{
  348. async k(k,old_k){//监听 k 值的变化,可以控制视频的播放与暂停
  349. // console.log('的点点滴滴多',this.dataList[k].id);
  350. this.dataList[old_k].state = 'stop'//如果是被滑走的视频,就停止播放
  351. this.dataList[old_k].playIng = false//如果视频暂停,就加载封面
  352. this.dataList[old_k].isplay = true
  353. // uni.createVideoContext(this.dataList[old_k].id,this).seek(0)
  354. uni.createVideoContext(this.dataList[old_k].id,this).play()
  355. clearTimeout(this.oldVideo)
  356. this.oldVideo = await setTimeout(()=>{
  357. uni.createVideoContext(this.dataList[old_k].id,this).seek(0)
  358. uni.createVideoContext(this.dataList[old_k].id,this).pause()
  359. console.log('预留第' + (old_k + 1) + '个视频:' + this.dataList[old_k].id)
  360. },500)
  361. uni.createVideoContext(this.dataList[k].id,this).play();
  362. clearTimeout(this.voice)
  363. this.voice = await setTimeout(()=>{
  364. this.dataList[k].isplay = false
  365. },300)
  366. await setTimeout(()=>{
  367. this.dataList[k].playIng = true
  368. },850)
  369. //【2.0版本更新内容】- start
  370. var p = k
  371. ++p
  372. await setTimeout(async ()=>{
  373. uni.createVideoContext(this.dataList[p].id,this).play()
  374. clearTimeout(this.timeout)
  375. this.timeout = await setTimeout(()=>{
  376. uni.createVideoContext(this.dataList[p].id,this).seek(0)
  377. uni.createVideoContext(this.dataList[p].id,this).pause()
  378. console.log('预加载第' + (p + 1) + '个视频:' + this.dataList[p].id)
  379. },1500)
  380. },20)
  381. //【2.0版本更新内容】- end
  382. //【此处处理进度条卡住的问题】
  383. if(uni.getSystemInfoSync().platform !== 'ios'){
  384. await setTimeout(()=>{
  385. uni.createVideoContext(this.dataList[k].id,this).pause()
  386. uni.createVideoContext(this.dataList[k].id,this).play()
  387. },100)
  388. }
  389. }
  390. },
  391. onShow(){
  392. console.log('回到前台');
  393. if(this.dataList.length !== 0){
  394. this.dataList[this.k].state = 'play';
  395. uni.createVideoContext(this.dataList[this.k].id,this).play()
  396. }
  397. },
  398. onHide(){
  399. this.dataList[this.k].state = 'pause';//界面隐藏也要停止播放视频
  400. uni.createVideoContext(this.dataList[this.k].id,this).pause();//暂停以后继续播放
  401. console.log('到后台');
  402. },
  403. onLoad(options){
  404. this.videoID = options.id || 0;
  405. if (options.spid) app.globalData.spid = options.spid;
  406. console.log('到后台');
  407. this.platform = uni.getSystemInfoSync().platform
  408. var model = uni.getSystemInfoSync().model
  409. if(this.platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !== 'iPhone7' || model !== 'iPhone8')){
  410. this.deleteHeight = 32//有 tabbar的 修改这里可以改变视频高度
  411. /*
  412. 引入评论参数
  413. */
  414. this.heightNum = 1.27
  415. } else {
  416. this.deleteHeight = 0
  417. /*
  418. 引入评论参数
  419. */
  420. this.heightNum = 1.18
  421. }
  422. this.windowWidth = uni.getSystemInfoSync().screenWidth//获取屏幕宽度
  423. this.boxStyle.width = this.windowWidth + 'px'//给宽度加px
  424. this.wHeight = uni.getSystemInfoSync().screenHeight;//获取屏幕高度
  425. this.boxStyle.height = this.wHeight - this.deleteHeight;//改变视频高度
  426. this.get()//这一步,加载视频数据
  427. if (this.isLogin) {
  428. this.getCartNum()
  429. }
  430. },
  431. onReady() {
  432. },
  433. methods: {
  434. getCartNum: function() {
  435. getCartCounts().then(res => {
  436. this.$store.commit('indexData/setCartNum', res.data.count + '')
  437. });
  438. },
  439. goIndex(){
  440. uni.switchTab({
  441. url: '/pages/index/index'
  442. })
  443. },
  444. goCarts(){
  445. uni.switchTab({
  446. url: '/pages/order_addcart/order_addcart'
  447. })
  448. },
  449. goUser(){
  450. uni.switchTab({
  451. url: '/pages/user/index'
  452. })
  453. },
  454. pinlunFun(e){
  455. let videoID = uni.getStorageSync("videoID");
  456. this.dataList.forEach(item=>{
  457. if(item.id == videoID){
  458. item.comment_num = e;
  459. }
  460. })
  461. },
  462. cShare(id){
  463. markeVideo('share',id).then(res=>{}).catch(err=>{
  464. return uni.showToast({
  465. title: err,
  466. icon: 'none',
  467. duration: 2000
  468. });
  469. })
  470. },
  471. // 分享
  472. // #ifdef APP-PLUS
  473. appShare(scene,id) {
  474. let that = this
  475. uni.showLoading({
  476. title: '加载中',
  477. mask: true
  478. });
  479. let uid = this.uid?this.uid:0;
  480. let data = this.dataList[this.k];
  481. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  482. let curRoute = routes[routes.length - 1].$page.fullPath // 获取当前页面路由,也就是最后一个打开的页面路由
  483. uni.share({
  484. provider: "weixin",
  485. scene: scene,
  486. type: 0,
  487. href: `${HTTP_REQUEST_URL}/pages/short_video/nvueSwiper/index?spid=${that.uid}&id=${id}`,
  488. title: data.type_name || '',
  489. summary: data.desc || '',
  490. imageUrl: data.image || '',
  491. success: function(res) {
  492. uni.hideLoading();
  493. that.cShare(id);
  494. },
  495. fail: function(err) {
  496. uni.showToast({
  497. title: '分享失败',
  498. icon: 'none',
  499. duration: 2000
  500. })
  501. }
  502. });
  503. },
  504. // #endif
  505. onMyEvent: function() {
  506. this.$set(this, 'isGoods', false);
  507. },
  508. goCart(item){
  509. if (this.isLogin === false) {
  510. return toLogin();
  511. }
  512. // uni.showToast({
  513. // title: '加载中...',
  514. // icon: 'none',
  515. // position: 'bottom',
  516. // duration: 300
  517. // })
  518. uni.setStorageSync("videoID",parseInt(item.id));
  519. this.$refs.pinglunGoods.open('bottom');
  520. },
  521. navTap(n){
  522. this.currentNav = n;
  523. this.oldVideo = "";
  524. this.k = 0;
  525. this.page = 1;
  526. this.dataList = [];
  527. this.get();
  528. },
  529. moreTap(item){
  530. item.isMore = !item.isMore;
  531. },
  532. autoPlay(){
  533. this.isAutoplay = !this.isAutoplay;
  534. if(!this.isAutoplay){
  535. this.autoplayText = "开启自动播放"
  536. uni.showToast({
  537. title: "关闭自动播放",
  538. icon: 'none',
  539. duration: 3000
  540. })
  541. } else {
  542. this.autoplayText = "关闭自动播放"
  543. uni.showToast({
  544. title: "开启自动播放",
  545. icon: 'none',
  546. duration: 3000
  547. })
  548. }
  549. },
  550. getData(){
  551. // 这里就是数据加载完以后再向后端发送数据的地方,
  552. videoList({
  553. page: this.page,
  554. limit: this.limit,
  555. order_type: this.currentNav,
  556. id: (this.page > 1 || this.currentNav == 2) ? 0 : this.videoID
  557. }).then(res=>{
  558. this.page = this.page + 1;
  559. var msg = res.data
  560. for (let i = 0; i < msg.length; i++) {
  561. this.dataList.push(msg[i])
  562. }
  563. }).catch(err=>{
  564. return uni.showToast({ title: err, icon: 'none', duration: 2000 });
  565. })
  566. },
  567. touchstart(event){
  568. this.dataList[this.k].isShowimage = true //刚触摸的时候就要显示预览视频图片了
  569. this.dataList[this.k].isShowProgressBarTime = true //显示时间线
  570. this.ProgressBarOpacity = 1 //让滑块显示起来更明显一点
  571. this.dotWidth = 10 //让点显示起来更明显一点
  572. },
  573. touchend(){//当手松开后,跳到最新时间
  574. uni.createVideoContext(this.dataList[this.k].id,this).seek(this.newTime)
  575. if(this.dataList[this.k].state == 'pause'){
  576. this.dataList[this.k].state = 'play'
  577. uni.createVideoContext(this.dataList[this.k].id,this).play()
  578. }
  579. this.dataList[this.k].isShowProgressBarTime = false //触摸结束后,隐藏时间线
  580. this.dataList[this.k].isShowimage = false //触摸结束后,隐藏时间预览
  581. this.ProgressBarOpacity = 0.5 //隐藏起来进度条,不那么明显了
  582. this.dotWidth = 0 //隐藏起来进度条,不那么明显了
  583. },
  584. touchmove(event){//当手移动滑块时,计算位置、百分小数、新的时间
  585. var msg = []
  586. if(this.videoTime !== ''){
  587. msg = this.videoTime.split(':')
  588. }
  589. var timeNumber = Number(msg[0])*60 + Number(msg[1])
  590. this.currentPositions = event.changedTouches[0].screenX
  591. this.percent = this.currentPositions / this.windowWidth
  592. this.newTime = this.percent*timeNumber
  593. this.currenttimes = parseInt(this.newTime)
  594. let theTime = this.newTime
  595. let middle = 0;// 分
  596. if(theTime > 60) {
  597. middle = parseInt(theTime/60);
  598. theTime = parseInt(theTime%60);
  599. }
  600. this.changeTime = `${Math.round(middle)>9?Math.round(middle):'0'+Math.round(middle)}:${Math.round(theTime)>9?Math.round(theTime):'0'+Math.round(theTime)}`
  601. },
  602. timeupdate(event,index){//计算滑块当前位置,计算当前百分小数
  603. // console.log(index)
  604. if(index == this.k){
  605. // console.log(event)
  606. var currenttime = event.detail.currentTime
  607. this.timeNumber = Math.round(event.detail.duration)
  608. this.getTime()
  609. this.percent = currenttime/this.timeNumber
  610. this.currentPosition = this.windowWidth*this.percent
  611. let theTime = currenttime
  612. let middle = 0;// 分
  613. if(theTime > 60) {
  614. middle = parseInt(theTime/60);
  615. theTime = parseInt(theTime%60);
  616. }
  617. this.changeTime = `${Math.round(middle)>9?Math.round(middle):'0'+Math.round(middle)}:${Math.round(theTime)>9?Math.round(theTime):'0'+Math.round(theTime)}`
  618. //自动切换视频
  619. if(this.isAutoplay){//true,代表自动播放
  620. if(Math.round(currenttime) == this.timeNumber - 1){
  621. const dom = uni.requireNativePlugin('dom')
  622. let doms = 'item'+(this.k+1)
  623. setTimeout(()=>{
  624. let el = this.$refs[doms][0]
  625. dom.scrollToElement(el,{
  626. offset: 0,
  627. animated: true
  628. })
  629. },500)
  630. }
  631. }
  632. }
  633. },
  634. getTime(){//得到时间函数
  635. this.videoTime = this.formatSeconds(this.timeNumber);
  636. // console.log(that.videoTime)
  637. var msg = []
  638. if(this.videoTime !== ''){
  639. msg = this.videoTime.split(':')
  640. }
  641. this.videoTimes = `${msg[0]>9?msg[0]:'0'+msg[0]}:${msg[1]>9?msg[1]:'0'+msg[1]}`;
  642. },
  643. formatSeconds(value) {//获取时间函数
  644. let theTime = parseInt(value);// 秒
  645. let middle= 0;// 分
  646. if(theTime > 60) {
  647. middle= parseInt(theTime/60);
  648. theTime = parseInt(theTime%60);
  649. }
  650. return `${middle>9?middle:middle}:${theTime>9?theTime:theTime}`;
  651. },
  652. playIngs(index) {
  653. //
  654. },
  655. moreVideo(index){
  656. },
  657. toVideo(index){
  658. },
  659. erweima(){
  660. },
  661. tozuozhe(item){
  662. this.currents = 1//点击头像以后就会切换
  663. if(item.type==0){
  664. uni.reLaunch({
  665. url: `/pages/index/index`
  666. });
  667. }else{
  668. uni.reLaunch({
  669. url: `/pages/store_cate/store_cate?id=`+item.relation_id
  670. });
  671. }
  672. },
  673. stop(){
  674. // console.log('stop')
  675. },
  676. scrolls (event) {
  677. this.isDragging = event.isDragging
  678. if (!event.isDragging) {//isDragging:判断用户是不是在滑动,滑动:true,停止滑动:false。我们要用户停止滑动时才给 k 赋值,这样就可以避免很多麻烦
  679. var i = Math.round(Math.abs(event.contentOffset.y) / (this.wHeight - this.deleteHeight + 1))//先用绝对值取出滑动的距离,然后除以屏幕高度,取一个整,就知道你现在滑动到哪一个视频了
  680. if(i !== this.k){//这里加判断是因为这个方法会执行很多次,会造成重复请求,所以这里写一个限制
  681. if(uni.getSystemInfoSync().platform == 'ios'){
  682. this.k = i//判断了用户没有滑动,确认了用户的确是在看这个视频,然后就赋值啦
  683. this.dataList[this.k].state = 'play'
  684. console.log('正在播放 --> 第' + (this.k + 1) + '个视频~')
  685. } else {
  686. clearTimeout(this.timers);
  687. this.timers = setTimeout(()=>{
  688. this.k = i//判断了用户没有滑动,确认了用户的确是在看这个视频,然后就赋值啦
  689. this.dataList[this.k].state = 'play'
  690. console.log('正在播放 --> 第' + (this.k + 1) + '个视频~')
  691. },80)
  692. }
  693. }
  694. }
  695. },
  696. get(){
  697. // 这个方法主要就是用来第一次进入视频播放时用来处理的
  698. videoList({
  699. page: this.page,
  700. limit: this.limit,
  701. order_type: this.currentNav,
  702. id: (this.page > 1 || this.currentNav == 2) ? 0 : this.videoID
  703. }).then(async (res)=>{
  704. this.page = this.page + 1;
  705. var msg = res.data;
  706. this.dataList = msg;
  707. this.dataList[0].state = "play";
  708. await setTimeout(()=>{
  709. //这里的延迟是为了避免执行时间太快而直接跳过执行的bug
  710. uni.createVideoContext(this.dataList[0].id,this).seek(0)
  711. uni.createVideoContext(this.dataList[0].id,this).play()
  712. },200)
  713. this.dataList[0].isplay = false
  714. await setTimeout(()=>{
  715. this.dataList[0].playIng = true
  716. },500)
  717. var p = 0
  718. await setTimeout(async ()=>{
  719. ++p
  720. uni.createVideoContext(this.dataList[p].id,this).play()
  721. await setTimeout(()=>{
  722. uni.createVideoContext(this.dataList[p].id,this).seek(0)
  723. uni.createVideoContext(this.dataList[p].id,this).pause()
  724. console.log('预加载第' + (p + 1) + '个视频s:' + this.dataList[p].id)
  725. },800)
  726. },50)
  727. }).catch(err=>{
  728. return uni.showToast({
  729. title: err,
  730. icon: 'none',
  731. duration: 2000
  732. });
  733. })
  734. },
  735. onpullingdown(){
  736. // console.log('正在下拉刷新,此时手还在触摸没有松开')
  737. this.refreshing = true
  738. },
  739. onrefresh(){
  740. // console.log('下拉刷新完毕,此时手松开了')
  741. setTimeout(()=>{
  742. this.refreshing = false
  743. },1000)
  744. },
  745. // 双击点赞效果
  746. touchstartHover(event){
  747. if(this.touchNum >= 1){
  748. // console.log('双击 -- X坐标:'+ event.touches[0].screenX);
  749. // console.log('双击 -- Y坐标:'+ event.touches[0].screenY);
  750. this.aixinLeft = event.touches[0].screenX - 50;
  751. this.aixinTop = event.touches[0].screenY - 50;
  752. this.isShowAixin = true;
  753. let max = 40; let min = -40;
  754. this.Rotate = Math.floor(Math.random() * (max - min + 1)) + min;
  755. setTimeout(()=>{
  756. this.isShowAixin = false;
  757. },700)
  758. this.onTabItemTaps();
  759. }
  760. },
  761. //点击播放&&暂停
  762. tapVideoHover(state,event){
  763. this.dataList[this.k].isShowimage = false
  764. this.dataList[this.k].isShowProgressBarTime = false
  765. this.ProgressBarOpacity = 0.5
  766. this.dotWidth = 0
  767. console.log('state--',state);
  768. // 1.启用双击点赞 --- start
  769. this.touchNum++;
  770. setTimeout(()=>{
  771. if(this.touchNum == 1){
  772. if(state=='play'||state=='continue'){
  773. this.dataList[this.k].state = 'pause';
  774. }else{
  775. this.dataList[this.k].state = 'continue';
  776. }
  777. if(this.dataList[this.k].state == 'continue'){
  778. uni.createVideoContext(this.dataList[this.k].id,this).play();//暂停以后继续播放
  779. }
  780. if(this.dataList[this.k].state == 'pause'){
  781. uni.createVideoContext(this.dataList[this.k].id,this).pause();//暂停以后继续播放
  782. }
  783. }
  784. if(this.touchNum >= 2){
  785. // this.doubleLike();
  786. }
  787. this.touchNum = 0;
  788. },200)
  789. // --------------- ending
  790. // 2. 不启用双击点赞 start
  791. // if(state=='play'||state=='continue'){
  792. // this.dataList[this.k].state = 'pause';
  793. // }else{
  794. // this.dataList[this.k].state = 'continue';
  795. // }
  796. // if(this.dataList[this.k].state == 'continue'){
  797. // uni.createVideoContext(this.dataList[this.k].id,this).play();//暂停以后继续播放
  798. // }
  799. // if(this.dataList[this.k].state == 'pause'){
  800. // uni.createVideoContext(this.dataList[this.k].id,this).pause();//暂停以后继续播放
  801. // }
  802. // --------------- ending
  803. },
  804. doubleLike(){
  805. if(this.dataList[this.k].is_like == false){
  806. this.dataList[this.k].like_num += 1;
  807. this.dataList[this.k].is_like = true;
  808. }
  809. /*
  810. 点赞
  811. */
  812. },
  813. toComment(item){
  814. // 注意点击评论之后会执行这里
  815. /*
  816. (1)先加载缓冲
  817. (2)获取当前视频 ID 信息
  818. (3)🌟🌟🌟🌟重要🌟🌟🌟🌟
  819. - 一定要记得看 index.vue 里面
  820. uni.setStorageSync("user",this.peopleList[i]);
  821. 这个东西,用于存储当前用户信息。在 插件里面会使用到这个东西,
  822. 记得写一下。
  823. (4)打开评论
  824. */
  825. uni.showToast({
  826. title: '加载中...',
  827. icon: 'none',
  828. position: 'bottom',
  829. duration: 300
  830. })
  831. uni.setStorageSync("videoID",parseInt(item.id));
  832. uni.setStorageSync("pinlunNum",item.comment_num);
  833. this.$refs.pinglun.open('bottom')
  834. },
  835. wxh5Video(){
  836. uni.navigateTo({
  837. url: '../wxh5previewVideo/wxh5previewVideo'
  838. })
  839. },
  840. previewVideo(){
  841. uni.navigateTo({
  842. url: '../previewVideo/previewVideo'
  843. })
  844. },
  845. toTwoVideo(){
  846. uni.navigateTo({
  847. url: '../new_index/new_index'
  848. })
  849. },
  850. tolistVideo(){
  851. uni.navigateTo({
  852. url: '../nvueSwiper/nvueSwiper'
  853. })
  854. },
  855. cLike(item){
  856. markeVideo('like',item.id).then(res=>{
  857. this.dataList[this.k].is_like = !this.dataList[this.k].is_like
  858. const video = this.dataList[this.k];
  859. item.is_like?video.like_num += 1:video.like_num -= 1;
  860. }).catch(err=>{
  861. return uni.showToast({
  862. title: err,
  863. icon: 'none',
  864. duration: 2000
  865. });
  866. })
  867. /*
  868. 点赞
  869. */
  870. },
  871. /*
  872. 收藏
  873. */
  874. cCollect(item){
  875. markeVideo('collect',item.id).then(res=>{
  876. this.dataList[this.k].is_collect = !this.dataList[this.k].is_collect
  877. const video = this.dataList[this.k];
  878. item.is_collect?video.collect_num += 1:video.collect_num -= 1;
  879. }).catch(err=>{
  880. return uni.showToast({
  881. title: err,
  882. icon: 'none',
  883. duration: 2000
  884. });
  885. })
  886. },
  887. moveHandle(){},
  888. closeScrollview(){
  889. // 点击评论里面的叉叉,就会关闭评论
  890. this.$refs.pinglun.close();
  891. },
  892. onTabItemTaps() {
  893. // #ifdef APP-PLUS
  894. if (uni.getSystemInfoSync().platform == "ios") {
  895. let UIImpactFeedbackGenerator = plus.ios.importClass('UIImpactFeedbackGenerator');
  896. let impact = new UIImpactFeedbackGenerator();
  897. impact.prepare();
  898. impact.init(1);
  899. impact.impactOccurred();
  900. }
  901. if (uni.getSystemInfoSync().platform == "android") {
  902. uni.vibrateShort({
  903. success: () => {
  904. console.log('点击震动');
  905. }
  906. });
  907. }
  908. // #endif
  909. }
  910. }
  911. }
  912. </script>
  913. <style lang="scss">
  914. .shares{
  915. opacity: 0.9;
  916. margin-top: 17px;
  917. .img{
  918. width: 31px;
  919. height: 24px;
  920. position: absolute;
  921. right: 5px;
  922. }
  923. .text{
  924. color: #FFFFFF;
  925. margin-top: 5px;
  926. font-size: 12px;
  927. text-align: center;
  928. font-weight: bold;
  929. margin-top: 30px;
  930. }
  931. }
  932. .noVideo{
  933. position: fixed;
  934. top: 400rpx;
  935. z-index: 9;
  936. width:750rpx;
  937. flex-direction: row;
  938. justify-content: center;
  939. .pictrue{
  940. width: 414rpx;
  941. height: 256rpx;
  942. }
  943. .tips{
  944. text-align: center;
  945. margin-top: 14rpx;
  946. font-size: 26rpx;
  947. color: #999;
  948. }
  949. }
  950. .footer{
  951. align-items: center;
  952. justify-content: space-around;
  953. flex-direction: row;
  954. background-color: #161616;
  955. height: 118rpx;
  956. position: fixed;
  957. bottom: 0;
  958. z-index: 9;
  959. width: 750rpx;
  960. line-height: 100rpx;
  961. .items{
  962. color: #999999;
  963. font-size: 30rpx;
  964. width: 50%;
  965. text-align: center;
  966. .itemCon{
  967. position: relative;
  968. }
  969. .cart{
  970. color: #999999;
  971. font-size: 30rpx;
  972. display: flex;
  973. height: 100rpx;
  974. line-height: 100rpx;
  975. }
  976. &.on{
  977. color: #fff;
  978. }
  979. .uni-badge-left-margin{
  980. position: absolute;
  981. right: 0px;
  982. top: 5px;
  983. }
  984. .uni-badge{
  985. border: 1px solid #e93323;
  986. background-color: #e93323;
  987. }
  988. .cartNum{
  989. position:absolute;
  990. height: 28rpx;
  991. background: #E93323;
  992. border-radius: 15rpx;
  993. color: #fff;
  994. line-height: 27rpx;
  995. padding: 0 8rpx;
  996. right: 0px;
  997. top: 20rpx;
  998. font-size: 22rpx;
  999. }
  1000. }
  1001. }
  1002. .header{
  1003. position: fixed;
  1004. z-index: 9;
  1005. width: 750rpx;
  1006. height: 86rpx;
  1007. flex-direction:row;
  1008. justify-content: center;
  1009. top: 80rpx;
  1010. .items{
  1011. margin: 0 30rpx;
  1012. .tName{
  1013. color: rgba(255,255,255,0.7);
  1014. font-size: 32rpx;
  1015. &.on{
  1016. color: rgba(255,255,255,0.95);
  1017. font-weight: 600;
  1018. }
  1019. }
  1020. .tLine{
  1021. width: 30rpx;
  1022. height: 4rpx;
  1023. background: #FFFFFF;
  1024. border-radius: 2rpx;
  1025. margin-left: 15rpx;
  1026. margin-top: 10rpx;
  1027. }
  1028. }
  1029. }
  1030. .container {background-color: #000000;}
  1031. .item {
  1032. /* width : 750rpx; */
  1033. background-color: #000000;
  1034. position: relative;
  1035. }
  1036. .videoHover{
  1037. position: absolute;
  1038. top: 0;
  1039. left: 0;
  1040. flex: 1;
  1041. background-color: rgba(0,0,0,0.1);
  1042. justify-content: center;
  1043. align-items: center;
  1044. /* border-style: dashed;
  1045. border-color: #DD524D;
  1046. border-width: 1px; */
  1047. }
  1048. .playState{
  1049. width: 160rpx;
  1050. height: 160rpx;
  1051. opacity: 0.2;
  1052. }
  1053. .userInfo{
  1054. position: absolute;
  1055. bottom:90px;
  1056. right: 10px;
  1057. flex-direction: column;
  1058. }
  1059. .userAvatar{
  1060. border-radius: 500%;
  1061. margin-bottom: 15px;
  1062. border-style: solid;
  1063. border-width: 2px;
  1064. border-color: #ffffff;
  1065. }
  1066. .userAvatar{
  1067. width : 80rpx;
  1068. height: 80rpx;
  1069. }
  1070. .likeIco,.shareIco,.commentIco{
  1071. width : 60rpx;
  1072. height: 60rpx;
  1073. margin-top: 15px;
  1074. }
  1075. .likeNum,.commentNum,.shareTex{
  1076. color: #ffffff;
  1077. font-size: 30rpx;
  1078. text-align: center;
  1079. margin: 5px;
  1080. }
  1081. .content{
  1082. width: 720rpx;
  1083. z-index: 99;
  1084. position: absolute;
  1085. bottom: 80px;
  1086. /* justify-content: center; */
  1087. padding: 15rpx;
  1088. flex-direction: column;
  1089. justify-content: flex-start;
  1090. color: #ffffff;
  1091. left:5px;
  1092. .time{
  1093. font-size: 24rpx;
  1094. color: rgba(255,255,255,0.5);
  1095. margin-left: 12rpx;
  1096. }
  1097. .cart{
  1098. background: rgba(153,153,153,0.3);
  1099. width: 376rpx;
  1100. height: 48rpx;
  1101. border-radius: 4rpx;
  1102. margin-bottom: 22rpx;
  1103. flex-direction:row;
  1104. justify-content: center;
  1105. align-items: center;
  1106. .cartPic{
  1107. width: 36rpx;
  1108. height: 36rpx;
  1109. margin-right: 14rpx;
  1110. }
  1111. .cartName{
  1112. font-size: 24rpx;
  1113. color: #fff;
  1114. }
  1115. .line{
  1116. width: 2rpx;
  1117. height: 22rpx;
  1118. background-color: rgba(255,255,255,0.3);
  1119. margin: 0 12rpx;
  1120. }
  1121. }
  1122. }
  1123. .timeCon{
  1124. flex-direction:row;
  1125. align-items: center;
  1126. .userName {
  1127. font-size: 30rpx;
  1128. color: #ffffff;
  1129. }
  1130. }
  1131. .words {
  1132. margin-top: 20rpx;
  1133. .close{
  1134. display: flex;
  1135. flex-direction: row;
  1136. align-items: center;
  1137. justify-content: flex-end;
  1138. margin-right: 20rpx;
  1139. .imgClose{
  1140. width: 18rpx;
  1141. height: 10rpx;
  1142. margin-left: 10rpx;
  1143. }
  1144. }
  1145. .wordsCon{
  1146. position: relative;
  1147. .more{
  1148. position: absolute;
  1149. bottom: 0;
  1150. right: 40rpx;
  1151. font-size: 26rpx;
  1152. }
  1153. .img{
  1154. width: 18rpx;
  1155. height: 10rpx;
  1156. margin-left: 4rpx;
  1157. position: absolute;
  1158. bottom: 7rpx;
  1159. right: 20rpx;
  1160. }
  1161. }
  1162. .info{
  1163. color: #fff;
  1164. font-size: 28rpx;
  1165. }
  1166. .more{
  1167. font-size: 26rpx;
  1168. color: #AAAAAA;
  1169. font-weight: 400;
  1170. }
  1171. }
  1172. .root{
  1173. background-color: #000000;
  1174. }
  1175. </style>