Forráskód Böngészése

showList,playShow => update

yukangzhe 3 éve
szülő
commit
16b85816d2

+ 5 - 1
pages/Components/showList/showList.js

@@ -37,7 +37,11 @@ Component({
     },
     doPlay: function (e) {
       let playUrl = e.currentTarget.dataset.url
-      console.log('playUrl: ' + playUrl)
+      const index = e.currentTarget.dataset.index
+      const str = JSON.stringify(this.data.list[index])
+      wx.navigateTo({
+        url: '/pages/playShow/playShow?str='+str,
+      })
     }
   },
 })

+ 5 - 4
pages/Components/showList/showList.wxml

@@ -1,15 +1,16 @@
 <view class="show-view">
   <view class="show-list">
     <view class="show-box" wx:for="{{list}}" wx:key="index">
-      <view class="show-img"  bindtap="doPlay" data-url="{{item.playUrl}}">
-        <video poster="{{item.imgUrl}}" src="{{item.src}}" controls="true"></video>
+      <view class="show-img"  bindtap="doPlay" data-index="{{index}}" data-url="{{item.playUrl}}">
+        <image mode="aspectFill" src="{{item.imgUrl}}"></image>
+        <!-- <video poster="{{item.imgUrl}}" src="{{item.playUrl}}" controls="true"></video> -->
       </view>
       <view class="show-title-view">
         <view class="show-title">{{item.title}}</view>
         <view class="zan-view"  bindtap="doThumbsUp" data-id="{{item.videoId}}">
           <view class="zan-img">
-            <image src="/images/zan.png" wx:if="{{item.goodCount <= 0}}" ></image>
-            <image src="/images/cur-zan.png" ex:else></image>
+            <image src="/images/zan.png" wx:if="{{item.goodCount <= 0}}"></image>
+            <image src="/images/cur-zan.png" wx:else></image>
           </view>
           <view class="zan-num">{{item.goodCount}}</view>
         </view>

+ 5 - 1
pages/playShow/playShow.js

@@ -5,13 +5,17 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    item: null
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    const item = JSON.stringify(options.str)
+    this.setData({
+      item
+    })
 
   },
 

+ 6 - 5
pages/playShow/playShow.wxml

@@ -1,16 +1,17 @@
 <view class="container">
   <view class="video-view">
-    <video id="playShow" controls="true"></video>
+    <video id="playShow" poster="{{item.imgUrl}}" src="{{item.playUrl}}" controls="true"></video>
   </view>
 
-  <view class="title">测试视视频</view>
-  <view class="desc">测试视频简介测试视频简介测试视频简介测试视频简介测试视频简介测试视频简介</view>
+  <view class="title">{{item.title}}</view>
+  <view class="desc">{{item.content}}</view>
 
   <view class="edit-view">
     <view class="zan-view" bindtap="zanBtn">
-      <image src="/images/zan.png"></image>
+      <image src="/images/zan.png" wx:if="{{item.goodCount <= 0}}"></image>
+      <image src="/images/cur-zan.png" wx:else></image>
       <view>点赞</view>
-      <text>(1000000)</text>
+      <text>({{item.goodCount}})</text>
     </view>
     <button open-type='share' class="share-view">
       <image src="/images/share.png"></image>