Parcourir la source

fix 视频列表放到首页

tiedan il y a 4 ans
Parent
commit
fa909d3641

+ 3 - 1
pages/exhibitionList/exhibitionList.js

@@ -2,7 +2,9 @@ const app = require('../../utils/util.js');
 Page({
 Page({
   data: {
   data: {
     active: 0,
     active: 0,
-    xcpArr: []
+    xcpArr: [],
+    vType:["理论阵地","我的学院","特色课程","特色管理"]
+
   },
   },
   goSeevideo(e) {
   goSeevideo(e) {
     let id = e.currentTarget.dataset.item.id
     let id = e.currentTarget.dataset.item.id

+ 3 - 47
pages/exhibitionList/exhibitionList.wxml

@@ -1,6 +1,7 @@
 <view>
 <view>
 	<van-tabs active="{{ active }}" bind:change="onChange">
 	<van-tabs active="{{ active }}" bind:change="onChange">
-		<van-tab title="理论阵地" title-style="font-size:25rpx">
+
+		<van-tab  wx:for="{{vType}}" wx:for-item="titem" title="{{titem}}" wx:key="titem" title-style="font-size:25rpx">
 			<view class="xczs">
 			<view class="xczs">
 				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
 				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
 					<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
 					<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
@@ -14,51 +15,6 @@
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
-		</van-tab>
-		<van-tab title="我的学院" title-style="font-size:25rpx">
-			<view class="xczs">
-				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
-					<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
-					<view class="grayblock">
-						<view class="show_text">{{item.courseName}}</view>
-						<view class="viedoxx">
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
-								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-		</van-tab>
-		<van-tab title="特色课程" title-style="font-size:25rpx">
-			<view class="xczs">
-				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
-					<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
-					<view class="grayblock">
-						<view class="show_text">{{item.courseName}}</view>
-						<view class="viedoxx">
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
-								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-		</van-tab>
-		<van-tab title="特色管理" title-style="font-size:25rpx">
-			<view class="xczs">
-				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
-					<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
-					<view class="grayblock">
-						<view class="show_text">{{item.courseName}}</view>
-						<view class="viedoxx">
-							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
-								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-		</van-tab>
+		</van-tab>		
 	</van-tabs>
 	</van-tabs>
 </view>
 </view>

+ 30 - 3
pages/index/index.js

@@ -32,7 +32,10 @@ Page({
       '/pages/demandCourses/demandCourses',
       '/pages/demandCourses/demandCourses',
       '/pages/myInteractions/myInteractions',
       '/pages/myInteractions/myInteractions',
       '/pages/testAnswer/testAnswer'
       '/pages/testAnswer/testAnswer'
-    ]
+    ],
+    active: 0,
+    xcpArr: [],
+    vType:["理论阵地","我的学院","特色课程","特色管理"]
   },
   },
   // 轮播点击去上课跳转到我的班级
   // 轮播点击去上课跳转到我的班级
   gomyClass(e) {
   gomyClass(e) {
@@ -227,6 +230,29 @@ Page({
       }
       }
     })
     })
   },
   },
+  goSeevideo(e) {
+    let id = e.currentTarget.dataset.item.id
+    wx.navigateTo({
+      url: '/pages/dbVideo/dbVideo?id=' + id,
+    })
+  },
+  onChange(event) {
+    let tag = event.detail.name + 1;
+    this.getVedioList(tag)
+    
+  },
+  getVedioList(tag){
+    var that=this;
+    wx.request({
+      method: "POST",
+      url: app.globalData.publicUrl + '/wx/course/listByCourseTag?tag=' + tag,
+      success: (e) => {
+        that.setData({
+          xcpArr: e.data.list,
+        })
+      }
+    })
+  },
   async onShow() {
   async onShow() {
     const sessionKey = await tools.checkSessionAndLogin();
     const sessionKey = await tools.checkSessionAndLogin();
     this.getBanner(sessionKey);
     this.getBanner(sessionKey);
@@ -234,9 +260,10 @@ Page({
     this.getwqLength(sessionKey);
     this.getwqLength(sessionKey);
     this.getRedPoint1(sessionKey);
     this.getRedPoint1(sessionKey);
     this.getRedPoint4(sessionKey);
     this.getRedPoint4(sessionKey);
-    this.getfour1();
+   // this.getfour1();
   },
   },
   async onLoad() {
   async onLoad() {
-    this.getfour();
+    //this.getfour();
+    this.getVedioList(this.data.active+1);
   },
   },
 })
 })

+ 26 - 2
pages/index/index.wxml

@@ -1,4 +1,5 @@
 <view class="container">
 <view class="container">
+    <!-- <van-notice-bar left-icon="volume-o" mode="link" text="技术是开发它的人的共同灵魂。" tapclick="toNotice" /> -->
 	<view class="banner">
 	<view class="banner">
 		<swiper class='u-wrp-bnr' indicator-dots="true" interval='5000' duration='1000'>
 		<swiper class='u-wrp-bnr' indicator-dots="true" interval='5000' duration='1000'>
 			<block wx:for="{{bnrUrl}}" wx:for-index="index" wx:key="idx">
 			<block wx:for="{{bnrUrl}}" wx:for-index="index" wx:key="idx">
@@ -35,7 +36,7 @@
 		</van-grid-item>
 		</van-grid-item>
 	</van-grid>
 	</van-grid>
 	<view style="height:15rpx;width:750rpx;background-color:#F2F2F2"></view>
 	<view style="height:15rpx;width:750rpx;background-color:#F2F2F2"></view>
-	<view class="xczs">
+	<!-- <view class="xczs">
 		<view class="zb1" wx:for="{{xczsArr}}" wx:for-index="idx" wx:for-item="item" bindtap="turnDetails" id="{{idx}}" wx:key="idx">
 		<view class="zb1" wx:for="{{xczsArr}}" wx:for-index="idx" wx:for-item="item" bindtap="turnDetails" id="{{idx}}" wx:key="idx">
 			<image src='{{item.img}}' mode="aspectFill" class="show1"></image>
 			<image src='{{item.img}}' mode="aspectFill" class="show1"></image>
 			<view class="grayblock">
 			<view class="grayblock">
@@ -47,5 +48,28 @@
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
-	</view>
+	</view> -->
+
+
+
+	<van-tabs active="{{ active }}" bind:change="onChange">
+
+		<van-tab  wx:for="{{vType}}" wx:for-item="titem" title="{{titem}}" wx:key="titem" title-style="font-size:25rpx">
+			<view class="xczs">
+				<view class="zb1" wx:for="{{xcpArr}}" wx:for-index="idx" wx:for-item="item" wx:key="idx" bindtap="goSeevideo" data-item="{{item}}">
+					<image src='{{item.courseImg}}' mode='aspectFill' class="show1"></image>
+					<view class="grayblock">
+						<view class="show_text">{{item.courseName}}</view>
+						<view class="viedoxx">
+							<view style="color:#848585;font-size:22rpx;float:right;margin-right:20rpx">
+								<image src='/images/qb.png' mode='aspectFill' class="qb"></image>{{item.playTimes}}人看过
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</van-tab>		
+	</van-tabs>
+
+
 </view>
 </view>

+ 48 - 39
pages/myClass/myClass.js

@@ -940,48 +940,57 @@ Page({
       success: (res) => {
       success: (res) => {
         console.log(res);
         console.log(res);
         console.log(res.data, "领取结业证提交")
         console.log(res.data, "领取结业证提交")
+
         wx.hideLoading();
         wx.hideLoading();
-        that.setData({
-          myCanvasId: that.data.myCanvasId + 1
-        })
-        let str = that.data.studentName + " 同志于" + app.dateFilter(that.data.classInfo.beginDate) + "-" + app.dateFilter(that.data.classInfo.endDate) + "参加" + that.data.classInfo.clasName + ",完成规定培训内容。准予结业,特发此证。"
-        //汉字占两格,英文数字占一格
-        let re = /^[\u4e00-\u9fa5]$/;
-        let stra = str.split("");
-        let tva = 30;  //阈值
-        let strTar = [];
-        let num = 0;
-        let st = "";
-        for (let i = 0; i < str.length; i++) {
-          let s = stra.shift()
-          st = st + s;
-          num += re.test(s) ? 2 : 1;
-          tva = strTar.length < 1 ? that.data.tva - 4 : that.data.tva;
-          if (num >= tva || i == str.length - 1) {
-            strTar.push(st);
-            num = 0;
-            st = "";
+        if(res.data.code==500){
+          wx.showModal({
+            showCancel: false,
+            content: "领取失败,请稍后再试"
+          })
+        }else{
+          that.setData({
+            myCanvasId: that.data.myCanvasId + 1
+          })
+          let str = that.data.studentName + " 同志于" + app.dateFilter(that.data.classInfo.beginDate) + "-" + app.dateFilter(that.data.classInfo.endDate) + "参加" + that.data.classInfo.clasName + ",完成规定培训内容。准予结业,特发此证。"
+          //汉字占两格,英文数字占一格
+          let re = /^[\u4e00-\u9fa5]$/;
+          let stra = str.split("");
+          let tva = 30;  //阈值
+          let strTar = [];
+          let num = 0;
+          let st = "";
+          for (let i = 0; i < str.length; i++) {
+            let s = stra.shift()
+            st = st + s;
+            num += re.test(s) ? 2 : 1;
+            tva = strTar.length < 1 ? that.data.tva - 4 : that.data.tva;
+            if (num >= tva || i == str.length - 1) {
+              strTar.push(st);
+              num = 0;
+              st = "";
+            }
           }
           }
+          const ctx = wx.createCanvasContext(that.data.myCanvasId);
+          ctx.drawImage(that.data.byzsbj, 0, 0, 300, 415); //里面的参数无非就是图片放置的位置即图片的横纵坐标,图片的宽高
+          ctx.setFillStyle("#000");
+          ctx.setFontSize(14); //字大小
+          ctx.font = 'normal bold 14px sans-serif'
+          ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
+          let leftPositionAarr = [59, 30]
+          let graduationNum =res.data.data.graduationNum!=""? "编号:" + res.data.data.graduationNum:"";
+          ctx.fillText(graduationNum, 130, 150);
+          let topPt=190-(strTar.length-4)*5;
+          let lineHeight=30-(strTar.length>4?strTar.length>6?10:(strTar.length-4)*5:0)
+          for (let i = 0; i < strTar.length; i++) {
+  
+            ctx.fillText(strTar[i], i == 0 ? leftPositionAarr[0] : leftPositionAarr[1], topPt + i * lineHeight);
+          }
+          ctx.draw();
+          that.setData({
+            showzs: true
+          });
         }
         }
-        const ctx = wx.createCanvasContext(that.data.myCanvasId);
-        ctx.drawImage(that.data.byzsbj, 0, 0, 300, 415); //里面的参数无非就是图片放置的位置即图片的横纵坐标,图片的宽高
-        ctx.setFillStyle("#000");
-        ctx.setFontSize(14); //字大小
-        ctx.font = 'normal bold 14px sans-serif'
-        ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
-        let leftPositionAarr = [59, 30]
-        let graduationNum =res.data.data.graduationNum!=""? "编号:" + res.data.data.graduationNum:"";
-        ctx.fillText(graduationNum, 130, 150);
-        let topPt=190-(strTar.length-4)*5;
-        let lineHeight=30-(strTar.length>4?strTar.length>6?10:(strTar.length-4)*5:0)
-        for (let i = 0; i < strTar.length; i++) {
-
-          ctx.fillText(strTar[i], i == 0 ? leftPositionAarr[0] : leftPositionAarr[1], topPt + i * lineHeight);
-        }
-        ctx.draw();
-        that.setData({
-          showzs: true
-        });
+        
       },
       },
       fail: () => {
       fail: () => {
         wx.hideLoading();
         wx.hideLoading();

+ 48 - 40
pages/myMission/myMission.js

@@ -778,49 +778,57 @@ Page({
         console.log(res);
         console.log(res);
         console.log(res.data, "领取结业证提交")
         console.log(res.data, "领取结业证提交")
         wx.hideLoading();
         wx.hideLoading();
-        that.setData({
-          myCanvasId: that.data.myCanvasId + 1
-        })
-        let str = that.data.studentName + " 同志于" + app.dateFilter(that.data.classInfo.beginDate) + "-" + app.dateFilter(that.data.classInfo.endDate) + "参加" + that.data.classInfo.clasName + ",完成规定培训内容。准予结业,特发此证。"
-        //汉字占两格,英文数字占一格
-        let re = /^[\u4e00-\u9fa5]$/;
-        let stra = str.split("");
-        let tva = 30;  //阈值
-        let strTar = [];
-        let num = 0;
-        let st = "";
-        for (let i = 0; i < str.length; i++) {
-          let s = stra.shift()
-          st = st + s;
-          num += re.test(s) ? 2 : 1;
-          tva = strTar.length < 1 ? that.data.tva - 4 : that.data.tva;
-          if (num >= tva || i == str.length - 1) {
-            strTar.push(st);
-            num = 0;
-            st = "";
+        if(res.data.code==500){
+          wx.showModal({
+            showCancel: false,
+            content: "领取失败,请稍后再试"
+          })
+        }else{
+          that.setData({
+            myCanvasId: that.data.myCanvasId + 1
+          })
+          let str = that.data.studentName + " 同志于" + app.dateFilter(that.data.classInfo.beginDate) + "-" + app.dateFilter(that.data.classInfo.endDate) + "参加" + that.data.classInfo.clasName + ",完成规定培训内容。准予结业,特发此证。"
+          //汉字占两格,英文数字占一格
+          let re = /^[\u4e00-\u9fa5]$/;
+          let stra = str.split("");
+          let tva = 30;  //阈值
+          let strTar = [];
+          let num = 0;
+          let st = "";
+          for (let i = 0; i < str.length; i++) {
+            let s = stra.shift()
+            st = st + s;
+            num += re.test(s) ? 2 : 1;
+            tva = strTar.length < 1 ? that.data.tva - 4 : that.data.tva;
+            if (num >= tva || i == str.length - 1) {
+              strTar.push(st);
+              num = 0;
+              st = "";
+            }
           }
           }
+          const ctx = wx.createCanvasContext(that.data.myCanvasId);
+          ctx.drawImage(that.data.byzsbj, 0, 0, 300, 415); //里面的参数无非就是图片放置的位置即图片的横纵坐标,图片的宽高
+          ctx.setFillStyle("#000");
+          ctx.setFontSize(14); //字大小
+          ctx.font = 'normal bold 14px sans-serif'
+          ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
+          let leftPositionAarr = [59, 30]
+          let graduationNum =res.data.data.graduationNum!=""? "编号:" + res.data.data.graduationNum:"";
+          ctx.fillText(graduationNum, 130, 150);
+          
+          let topPt=190-(strTar.length-4)*5;
+          let lineHeight=30-(strTar.length>4?strTar.length>6?10:(strTar.length-4)*5:0)
+          for (let i = 0; i < strTar.length; i++) {
+  
+            ctx.fillText(strTar[i], i == 0 ? leftPositionAarr[0] : leftPositionAarr[1], topPt + i * lineHeight);
+          }
+          ctx.draw();
+  
+          that.setData({
+            showzs: true
+          });
         }
         }
-        const ctx = wx.createCanvasContext(that.data.myCanvasId);
-        ctx.drawImage(that.data.byzsbj, 0, 0, 300, 415); //里面的参数无非就是图片放置的位置即图片的横纵坐标,图片的宽高
-        ctx.setFillStyle("#000");
-        ctx.setFontSize(14); //字大小
-        ctx.font = 'normal bold 14px sans-serif'
-        ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
-        let leftPositionAarr = [59, 30]
-        let graduationNum =res.data.data.graduationNum!=""? "编号:" + res.data.data.graduationNum:"";
-        ctx.fillText(graduationNum, 130, 150);
         
         
-        let topPt=190-(strTar.length-4)*5;
-        let lineHeight=30-(strTar.length>4?strTar.length>6?10:(strTar.length-4)*5:0)
-        for (let i = 0; i < strTar.length; i++) {
-
-          ctx.fillText(strTar[i], i == 0 ? leftPositionAarr[0] : leftPositionAarr[1], topPt + i * lineHeight);
-        }
-        ctx.draw();
-
-        that.setData({
-          showzs: true
-        });
       },
       },
       fail: () => {
       fail: () => {
         wx.hideLoading();
         wx.hideLoading();

+ 1 - 1
utils/util.js

@@ -4,7 +4,7 @@
   // publicUrl:'http://10.16.10.139'//ly
   // publicUrl:'http://10.16.10.139'//ly
   // publicUrl:'http://10.16.4.19:80'//hyb
   // publicUrl:'http://10.16.4.19:80'//hyb
   // publicUrl:'http://10.16.4.26:80'//zxq
   // publicUrl:'http://10.16.4.26:80'//zxq
-  // publicUrl:'http://10.20.1.207:80'//dailin
+  //publicUrl:'http://10.20.1.207:80'//dailin
 };
 };
 const formatTime = date => {
 const formatTime = date => {
   const year = date.getFullYear()
   const year = date.getFullYear()