zhaoxiaohai пре 3 година
родитељ
комит
6b14fd7fc2
3 измењених фајлова са 28 додато и 11 уклоњено
  1. 12 1
      pages/college/detail.js
  2. 8 9
      pages/college/detail.wxml
  3. 8 1
      pages/college/index.js

+ 12 - 1
pages/college/detail.js

@@ -6,14 +6,26 @@ Page({
      * 页面的初始数据
      */
     data: {
+        active: 0,
         detailData: {},
         currentVideo: {},
     },
+    tabChange({
+        detail
+    }) {
+        this.setData({
+            active: detail.index
+        })
+    },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        console.log(options)
+        if (options.viewData) this.setData({
+            viewData: options.viewData
+        });
         _Http.basic({
             "classname": "saletool.courseware.courseware",
             "method": "selectDetail",
@@ -32,7 +44,6 @@ Page({
                 currentVideo: list.find(v => v.fileType == 'video')
             })
         });
-
     },
 
     callBack({

+ 8 - 9
pages/college/detail.wxml

@@ -16,12 +16,11 @@
     <view class="multi-line">{{detailData.notes}}</view>
 </navigator>
 <view style="height: 20rpx;" />
-<van-tabs swipeable sticky title-active-color='var(--assist)' color='var(--assist)'>
-    <van-tab title="课件">
-        <!-- <My_accessory list="{{videoList}}" butType='播放' bindcallBack='callBack' /> -->
-        <My_accessory list="{{flieList}}" butType='商学院' bindcallBack='callBack' />
-    </van-tab>
-    <van-tab title="数据">
-        <DispalyData></DispalyData>
-    </van-tab>
-</van-tabs>
+
+<van-tabs wx:if="{{viewData!='false'}}" sticky title-active-color='var(--assist)' color='var(--assist)' active="{{ active }}" bind:change="tabChange">
+    <van-tab title="课件" />
+    <van-tab title="数据" />
+</van-tabs>
+
+<My_accessory wx:if="{{active==0}}" list="{{flieList}}" butType='商学院' bindcallBack='callBack' />
+<DispalyData wx:else />

+ 8 - 1
pages/college/index.js

@@ -7,6 +7,7 @@ Page({
      * 页面的初始数据
      */
     data: {
+        optionList: [],
         scrollHeight: 0, //滚动区域高度
         searchContent: "", //搜索内容
         mainActiveIndex: 0, //分类选择器打开分类的下标
@@ -29,6 +30,12 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        if (options.auth) {
+            let auth = JSON.parse(options.auth)[0].meta.auth;
+            this.setData({
+                optionList: auth.map(v => v.optionname)
+            })
+        }
         this.selectMenu(0);
         this.selectList();
     },
@@ -55,7 +62,7 @@ Page({
             item
         } = e.currentTarget.dataset;
         wx.navigateTo({
-            url: './detail?id=' + item.sat_coursewareid,
+            url: `./detail?id=${item.sat_coursewareid}&viewData=${this.data.optionList.includes("查看数据")}`,
         })
     },
     /* 获取列表 */