Browse Source

商学院

zhaoxiaohai 3 năm trước cách đây
mục cha
commit
9caf519a5f

+ 23 - 6
pages/college/detail.js

@@ -1,30 +1,47 @@
 const _Http = getApp().globalData.http;
-
+const MFT = require("../../utils/matchingFeilType");
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-        detailData: {}
+        detailData: {},
+        currentVideo: {},
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-        const item = JSON.parse(options.item)
         _Http.basic({
             "classname": "saletool.courseware.courseware",
             "method": "selectDetail",
             "content": {
-                "sat_coursewareid": item.sat_coursewareid
+                "sat_coursewareid": options.id
             }
         }, false).then(res => {
-            console.log("详情", res)
+            let list = MFT.fileList(res.data[0].attinfos),
+                videoList = [],
+                flieList = [];
+            for (let i = 0; i < list.length; i++) {
+                list[i].fileType == 'video' ? videoList.push(list[i]) : flieList.push(list[i]);
+            };
+            this.setData({
+                detailData: res.data[0],
+                videoList,
+                flieList,
+                currentVideo: videoList[0] ? videoList[0] : {}
+            })
         });
+
+    },
+
+    callBack({
+        detail
+    }) {
         this.setData({
-            detailData: item
+            currentVideo: detail
         })
     },
 

+ 1 - 4
pages/college/detail.scss

@@ -1,8 +1,6 @@
-
 .header {
     width: 750rpx;
     height: 392rpx;
-    border: 1px solid red;
 }
 
 /* 基础盒子 */
@@ -67,5 +65,4 @@
         margin-top: 20rpx;
     }
 
-}
-
+}

+ 3 - 4
pages/college/detail.wxml

@@ -1,6 +1,4 @@
-<view class="header">
-    占位
-</view>
+<video class="header" autoplay src="{{currentVideo.url}}" poster='{{detailData.cover}}' />
 <!-- 简介 -->
 <navigator url="#" class="brief bsae-box">
     <view class="first-line">
@@ -20,7 +18,8 @@
 <view style="height: 20rpx;" />
 <van-tabs swipeable sticky title-active-color='var(--assist)' color='var(--assist)'>
     <van-tab title="课件">
-        <My_accessory></My_accessory>
+        <My_accessory list="{{videoList}}" butType='播放' bindcallBack='callBack' />
+        <My_accessory list="{{flieList}}" />
     </van-tab>
     <van-tab title="数据">
         <DispalyData></DispalyData>

+ 8 - 8
pages/college/index.js

@@ -13,13 +13,13 @@ Page({
         showText: null, //左上显示文本
         items: [], //分类列表
         list: [], //列表
+        sort: [],
         content: {
             pageNumber: 1,
             pageSize: 20,
             pageTotal: 1,
             where: {
-                condition: "",
-                sorttype: 2
+                condition: ""
             }
         }
     },
@@ -54,10 +54,9 @@ Page({
             item
         } = e.currentTarget.dataset;
         wx.navigateTo({
-            url: './detail?item=' + JSON.stringify(item),
+            url: './detail?id=' + item.sat_coursewareid,
         })
     },
-
     /* 获取列表 */
     selectList(init = false) {
         if (init.detail != undefined) init = init.detail;
@@ -66,13 +65,13 @@ Page({
         })
         if (this.data.content.pageNumber > this.data.content.pageTotal) return;
         let content = this.data.content;
-        (this.data.activeId == "") ? "" : content.where.sat_courseware_classid = this.data.activeId;
+        (this.data.activeId == "") ? delete(content.where.sat_courseware_classid): content.where.sat_courseware_classid = this.data.activeId;
+        if (this.data.sort[0]) content.sort = this.data.sort;
         _Http.basic({
             "classname": "saletool.courseware.courseware",
             "method": "selectList",
             content
         }).then(res => {
-            console.log("列表", res)
             this.selectComponent('#ListBox').RefreshToComplete();
             if (res.msg != '成功') return wx.showToast({
                 title: res.data,
@@ -82,7 +81,8 @@ Page({
                 list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
                 ['content.pageNumber']: res.pageNumber + 1,
                 ['content.pageTotal']: res.pageTotal,
-                total: res.total
+                total: res.total,
+                sort: res.sort
             })
         })
     },
@@ -109,7 +109,7 @@ Page({
         detail
     }) {
         this.setData({
-            'content.where.sorttype': detail == '最新' ? 2 : 1
+            sort: detail
         })
         this.selectList(true);
     },

+ 1 - 1
pages/college/index.wxml

@@ -5,7 +5,7 @@
         <van-tree-select items="{{ items }}" main-active-class='main-active' content-active-class='content-active' main-active-index="{{ mainActiveIndex }}" active-id="{{activeId}}" bind:click-nav="onClickNav" bind:click-item="onClickItem" />
     </van-dropdown-item>
     <view class="switch">
-        <My_switch bind:change="switchChange" />
+        <My_switch sort='{{sort}}' bind:change="switchChange" />
     </view>
 </van-dropdown-menu>
 <!-- 列表 -->