liyongli 1 год назад
Родитель
Сommit
6ae98ed0e6

+ 2 - 1
miniprogram/app.json

@@ -5,7 +5,8 @@
     "pages/mediaController/index",
     "pages/videoDetail/index",
     "pages/schedule/index",
-    "pages/live/live"
+    "pages/live/live",
+    "pages/livelist/index"
   ],
   "window": {
     "backgroundColor": "#F6F6F6",

+ 1 - 1
miniprogram/pages/home/index.js

@@ -19,7 +19,7 @@ Page({
     if (!item.type) return
     switch (item.type) {
       case 'live':
-        url = '/pages/live/live?title=' + item.text + "&mediaType=" + item.type;
+        url = '/pages/livelist/index?title=' + item.text + "&mediaType=" + item.type;
         break;
       case 'image':
       case 'video':

+ 0 - 26
miniprogram/pages/live/live.js

@@ -38,31 +38,6 @@ Page({
       isLive: false
     })
   },
-  showBack() {
-    const _this = this;
-    httpCloud({
-      name: "server",
-      type: "getLiveListData",
-      data: {},
-      call(res) {
-        const r = res || [];
-        for (let i = 0; i < r.length; i++) {
-          const v = r[i];
-          v.titleShow = v.live_type === 'back' ? '回看-' + v.title : '直播-' + v.title;
-        }
-        _this.setData({
-          list: r,
-        })
-      }
-    })
-  },
-  bindPickerChange(e) {
-    const d = this.data.list[e.detail.value] || {}
-    this.setData({
-      liveData: d,
-      isLive : d.backUrl ? true : false
-    })
-  },
   /**
    * 生命周期函数--监听页面加载
    */
@@ -71,7 +46,6 @@ Page({
       title: decodeURIComponent(options.title || "盛世中华 何以中国")
     })
     this.getDate();
-    this.showBack();
   },
 
   /**

+ 0 - 3
miniprogram/pages/live/live.wxml

@@ -3,8 +3,5 @@
   <image wx:if="{{!isLive}}" class="image" src="../../assets/image/nolive.jpg" mode="aspectFill" />
   <video class="video" enable-play-gesture="{{true}}" enable-progress-gesture="{{false}}" play-btn-position="center" show-progress="{{false}}" src="{{liveData.liveUrl || liveData.backUrl}}" binderror="liveerr" bindplay="liveing" autoplay />
 </view>
-<picker bindchange="bindPickerChange" range-key="title" range="{{list}}">
-<mp-cell title="查看回放" link link></mp-cell>
-</picker>
 <mp-cell title="{{liveData.title}}"></mp-cell>
 <rich-text wx:if="{{liveData.introduce}}" style="width:730rpx;margin: 10rpx auto;display:block" nodes="{{liveData.introduce}}"></rich-text>

+ 92 - 0
miniprogram/pages/livelist/index.js

@@ -0,0 +1,92 @@
+// pages/livelist/index.js
+import {
+  httpCloud
+} from "../../utils/httpFunc";
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    list: []
+  },
+  title: '',
+  showBack() {
+    const _this = this;
+    httpCloud({
+      name: "server",
+      type: "getLiveListData",
+      data: {},
+      call(res) {
+        const r = res || [];
+        console.log(r)
+        _this.setData({
+          list: r,
+        })
+      }
+    })
+  },
+
+  toDetail(e){
+    if(!e.currentTarget.dataset.id) return
+    wx.navigateTo({
+      url: '/pages/live/live?title=' + this.title + '&id=' + e.currentTarget.dataset.id
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.showBack();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
miniprogram/pages/livelist/index.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 7 - 0
miniprogram/pages/livelist/index.wxml

@@ -0,0 +1,7 @@
+<!--pages/livelist/index.wxml-->
+<view class="livelist" wx:for="{{list}}" wx:key="_id" data-id="{{item._id}}" bind:tap="toDetail">
+  <image class="image" wx:if="{{item.cover}}" src="{{item.cover}}" />
+  <view class="title">{{item.title}}</view>
+  <view wx:if="{{item.live_type === 'live'}}" style="background-color: #7ec67f;" class="tag">直播</view>
+  <view wx:if="{{item.live_type === 'back'}}" class="tag">回放</view>
+</view>

+ 24 - 0
miniprogram/pages/livelist/index.wxss

@@ -0,0 +1,24 @@
+/* pages/livelist/index.wxss */
+.livelist{
+  position: relative;
+}
+
+.image{
+  width: 750rpx;
+  height: 422rpx;
+}
+
+.title{
+  padding: 15rpx 10rpx;
+}
+
+.tag{
+  position: absolute;
+  border-radius: 15rpx;
+  color: #fff;
+  background-color: #aaaaaa;
+  padding: 5rpx 10rpx;
+  font-size: 14px;
+  top: 5rpx;
+  left: 5rpx;
+}

+ 7 - 0
project.private.config.json

@@ -12,6 +12,13 @@
           "query": "title=%E8%93%9D%E7%9B%B4%E6%92%AD&mediaType=live",
           "launchMode": "default",
           "scene": null
+        },
+        {
+          "name": "",
+          "pathName": "pages/livelist/index",
+          "query": "title=%E8%93%9D%E7%9B%B4%E6%92%AD&mediaType=live",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }