vodComment.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template name="vodComment">
  2. <view>
  3. <view class="topbanner">
  4. <video
  5. :src="item.video"
  6. preload="auto"
  7. :show-play-btn="true"
  8. :show-center-play-btn="false"
  9. :controls="true"
  10. :loop="true"
  11. :id="id()"
  12. objectFit="fill"
  13. :enable-progress-gesture="false"
  14. @click="start"
  15. ref="video_url"
  16. play-btn-position="center"
  17. class="video"
  18. :x5-playsinline="true"
  19. :playsinline="true"
  20. :webkit-playsinline="true"
  21. :x5-video-can-play-with-audio="true"
  22. x5-video-orientation="portraint"
  23. >
  24. </video>
  25. <cover-image v-if="show_play_poster" class="poster" :src="item.pic">
  26. </cover-image>
  27. <cover-image
  28. class="ico-video-play" v-if="show_play"
  29. @tap="start"></cover-image>
  30. </view>
  31. <view class='msgs-tabs'>
  32. <view class='tit'>{{item.name}}</view>
  33. <view class='num'>全部评论(100)</view>
  34. </view>
  35. <view class="living">
  36. <scroll-view class="message" bindscrolltolower="loadmore" scroll-y>
  37. <view class="item" v-for="(v, k) in comments">
  38. <view class="user">
  39. <image :src="v.avatar"></image>
  40. </view>
  41. <view class="info clearfix">
  42. <view class="username text-ellipsis">
  43. <text>{{v.username}}</text>
  44. </view>
  45. <view class="txt">
  46. <text>{{v.content}}</text>
  47. </view>
  48. </view>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. name: "vodComment",
  57. props: {
  58. config : {
  59. type : Object,
  60. value : null
  61. },
  62. item : {
  63. type : Object,
  64. value : null
  65. },
  66. },
  67. data() {
  68. return {
  69. show_play_poster: true,
  70. show_play: true,
  71. videoCtx : false,
  72. comments: [
  73. {
  74. id : 1,
  75. avatar : 'https://yt3.ggpht.com/a/AATXAJxSSAfjWzxQAkDei2MeIPc6WqlO2FG-gOSpZQ=s48-c-k-c0xffffffff-no-rj-mo',
  76. username : 'rabin',
  77. content : 'dfdfdfdf',
  78. },
  79. {
  80. id : 2,
  81. avatar : 'https://pic.rmb.bdstatic.com/b9279adf974b78d27201a0b34970c2a9.jpeg',
  82. username : 'test',
  83. content : '哈哈哈哈或',
  84. }
  85. ],
  86. loading: false
  87. }
  88. },
  89. methods:{
  90. id : function() {
  91. var video_id = this.item.id;
  92. return 'video_comment_' + video_id;
  93. },
  94. start : function() {
  95. this.show_play_poster = false;
  96. this.config.stop[this.config.page] = this;
  97. var id = this.id();
  98. if (!this.videoCtx) {
  99. this.videoCtx = uni.createVideoContext(id, this);
  100. }
  101. if (this.show_play) {
  102. this.videoCtx.play();
  103. this.show_play = false;
  104. } else {
  105. this.videoCtx.pause();
  106. this.show_play = true;
  107. }
  108. },
  109. stop : function() {
  110. var id = this.id();
  111. if (!this.videoCtx) {
  112. this.videoCtx = uni.createVideoContext(id, this);
  113. }
  114. this.videoCtx.pause();
  115. this.show_play = true;
  116. },
  117. },
  118. }
  119. </script>
  120. <style>
  121. .topbanner{
  122. position: relative;
  123. }
  124. .topbanner image,.topbanner video,.topbanner live-player{
  125. width: 750rpx;
  126. height: 422rpx;
  127. display: block;
  128. }
  129. .topbanner .media-cover,.topbanner video,.topbanner live-player{
  130. height: 422rpx;
  131. }
  132. .living{
  133. margin-bottom:50rpx;
  134. }
  135. .poster{
  136. background-size: cover;
  137. position: absolute;
  138. left: 0;
  139. top: 0;
  140. width: 100%;
  141. height: 100%;
  142. }
  143. .living-tabs{
  144. display: flex;
  145. justify-content: center;
  146. margin-bottom: 36rpx;
  147. }
  148. .living-tabs>view{
  149. font-size: 30rpx;
  150. line-height: 52rpx;
  151. margin: 0 26rpx;
  152. }
  153. .living-tabs>view.cur{
  154. border-bottom: 6rpx solid #000;
  155. }
  156. .living .send{
  157. border-bottom: solid 2rpx #f0f0f0;
  158. padding:0 30rpx 40rpx;
  159. }
  160. .living .send input{
  161. float:left;
  162. box-sizing: border-box;
  163. width:540rpx;
  164. height:60rpx;
  165. border:solid 2rpx #999999;
  166. border-radius: 10rpx;
  167. padding:0 10rpx;
  168. line-height: 60rpx;
  169. font-size: 30rpx;
  170. }
  171. .living .send .button{
  172. float:right;
  173. box-sizing: border-box;
  174. padding:0;
  175. width:130rpx;
  176. min-width: 0;
  177. height:60rpx;
  178. line-height: 60rpx;
  179. }
  180. .living .message{
  181. height:320rpx;
  182. padding:15rpx 0 110rpx;
  183. border-bottom: solid 2rpx #f0f0f0;
  184. }
  185. .living .message .item{
  186. padding:20rpx 35rpx 0;
  187. }
  188. .living .message .user{
  189. float:left;
  190. }
  191. .living .message .user image{
  192. display: block;
  193. width:51rpx;
  194. height:51rpx;
  195. border-radius: 50%;
  196. }
  197. .living .message .info{
  198. position: relative;
  199. margin-left:70rpx;
  200. overflow: visible;
  201. }
  202. .living .message .username{
  203. font-size: 28rpx;
  204. margin-bottom: 13rpx;
  205. }
  206. .living .message .txt{
  207. position: relative;
  208. float:left;
  209. background: #eeeeee;
  210. max-width:400rpx;
  211. border-radius: 15rpx;
  212. padding: 9rpx 18rpx;
  213. font-size: 26rpx;
  214. line-height: 1.8;
  215. color: #666666;
  216. overflow: visible;
  217. }
  218. .living .message .txt:before{
  219. display: block;
  220. position: absolute;
  221. top:0;
  222. left:-14rpx;
  223. width:0;
  224. height:0;
  225. border: solid 14rpx transparent;
  226. border-top: solid 12rpx #eee;
  227. content:'';
  228. }
  229. .msgs-tabs{
  230. line-height: 88rpx;
  231. display: flex;
  232. height: 88rpx;
  233. justify-content: space-between;
  234. box-sizing: border-box;
  235. padding: 0 30rpx;
  236. border-bottom: 1rpx solid #ccc;
  237. }
  238. .msgs-tabs .tit{
  239. font-size: 30rpx;
  240. color: #000;
  241. display: flex;
  242. align-items: center;
  243. overflow: hidden;
  244. }
  245. .msgs-tabs .tit:before{
  246. content: '';
  247. display: inline-block;
  248. width: 6rpx;
  249. height: 30rpx;
  250. margin-right: 10rpx;
  251. background-color: #000;
  252. }
  253. .msgs-tabs .num{
  254. font-size: 22rpx;
  255. color: #999;
  256. overflow: hidden;
  257. }
  258. .living{
  259. margin-bottom: 0;
  260. }
  261. .living .message{
  262. padding:0;
  263. border-bottom: 0;
  264. }
  265. .console{
  266. z-index: 5;
  267. }
  268. .living .message{
  269. position: absolute;
  270. bottom: 120rpx;
  271. top: 544rpx;
  272. left: 0;
  273. width: 100%;
  274. height: auto;
  275. }
  276. .ico-video-play{
  277. background: url(@/static/icon/ico-video-play.png) no-repeat;
  278. background-size: cover;
  279. width: 100rpx;
  280. height: 100rpx;
  281. position: absolute;
  282. left: 50%;
  283. top: 50%;
  284. transform: translate3d(-50%,-50%,0);
  285. }
  286. .console{
  287. position: fixed;
  288. bottom:0;
  289. left:0;
  290. width:750rpx;
  291. height:98rpx;
  292. padding-top:20rpx;
  293. }
  294. .console .comment{
  295. position: absolute;
  296. top:10rpx;
  297. left:85rpx;
  298. background:url(http://www.huoxingkandiqiu.com/files/img/ico-comment.png) no-repeat;
  299. background-size: 98rpx 98rpx;
  300. width:98rpx;
  301. height:98rpx;
  302. }
  303. .console .thumbup{
  304. position: absolute;
  305. top:10rpx;
  306. right:85rpx;
  307. }
  308. .console .num{
  309. background: #fff;
  310. position: absolute;
  311. top:40rpx;
  312. right:0;
  313. width:100rpx;
  314. height: 40rpx;
  315. line-height: 40rpx;
  316. color: #000;
  317. font-size: 24rpx;
  318. text-align: center;
  319. }
  320. .console .unlike{
  321. background:url(http://www.huoxingkandiqiu.com/files/img/ico-unlike.png) no-repeat;
  322. background-size: 98rpx 98rpx;
  323. width:98rpx;
  324. height:98rpx;
  325. }
  326. .console .like{
  327. background:url(http://www.huoxingkandiqiu.com/files/img/ico-like.png) no-repeat;
  328. background-size: 98rpx 98rpx;
  329. width:98rpx;
  330. height:98rpx;
  331. }
  332. .mask .layer{
  333. padding:40rpx 30rpx;
  334. }
  335. .mask textarea{
  336. margin-bottom: 25rpx;
  337. box-sizing: border-box;
  338. padding:10rpx;
  339. border:solid 2rpx #999999;
  340. border-radius: 10rpx;
  341. width:500rpx;
  342. font-size: 24rpx;
  343. }
  344. .mask .button{
  345. width:300rpx;
  346. }
  347. .share{
  348. position: fixed;
  349. bottom:20rpx;
  350. left:225rpx;
  351. }
  352. .console .edit{
  353. background:url(http://www.huoxingkandiqiu.com/files/img/edit.png) no-repeat;
  354. background-size: 80rpx 80rpx;
  355. width:80rpx;
  356. height:80rpx;
  357. position: absolute;
  358. left: 135rpx;
  359. bottom: 30rpx;
  360. }
  361. .console .edit.left30{
  362. left: 30rpx;
  363. }
  364. </style>