Silent 6 年之前
父節點
當前提交
8dce79b570

+ 1 - 0
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -217,6 +217,7 @@ class ApiController extends Controller
         $checkCard = CheckCard::where([
             ['begin_date_time', '>', $now]
         ])->whereNull('end_date_time')->orderBy('begin_date_time', 'desc')->first();
+
         return response()->json(['status' => 'success', 'result' => $result, 'checkCard' => $checkCard]);
     }
 

+ 2 - 1
wechat/app.json

xqd
@@ -13,7 +13,8 @@
     "pages/login/index",
     "pages/bind-phone/index",
     "pages/rate/rate",
-    "pages/form/index"
+    "pages/form/index",
+    "pages/video/index"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 19 - 1
wechat/pages/apply-leave/apply-leave.js

xqd xqd
@@ -38,6 +38,24 @@ Page({
   },
   formSubmit: function (e) {
     let value = e.detail.value
+    value.days = parseInt(value.days)
+    if(value.type == 0) {
+      if (value.days <= 0 || value.days > 7) {
+        wx.showModal({
+          title: '请假失败',
+          content: '短假可请天数为1到7天',
+        })
+        return false;
+      }
+    } else {
+      if (!(value.days >= 7 && value.days <= 60)) {
+        wx.showModal({
+          title: '请假失败',
+          content: '长假可请天数为7到60天',
+        })
+        return false;
+      }
+    }
     wx.request({
       url: api.applyLeaveUrl,
       method: 'GET',
@@ -49,7 +67,7 @@ Page({
         'remark': value.remark
       },
       success: res => {
-        if(res.data.status == 'success') {
+        if (res.data.status == 'success') {
           wx.showModal({
             title: '请假成功',
             content: '请假成功',

+ 2 - 2
wechat/pages/apply-leave/apply-leave.wxml

xqd xqd
@@ -13,7 +13,7 @@
       </zan-cell>
       <zan-cell title="天数">
         <view class="section">
-          <input placeholder="请输入请假天数" name='days'/>
+          <input placeholder="请输入请假天数" name='days' type='number'/>
         </view>
       </zan-cell>
       <zan-cell title="说明">
@@ -27,6 +27,6 @@
     <!-- <zan-button-group>
        <zan-button type="primary" btnclick="onSubmit">提交</zan-button>
     </zan-button-group> -->
-    <button formType="submit" type='primary' class='submit-btn'>提交</button>
+    <button formType="submit" type='primary' class='submit-btn' id='submit-btn'>提交</button>
   </view>
 </form>

+ 3 - 2
wechat/pages/apply-leave/apply-leave.wxss

xqd
@@ -1,3 +1,4 @@
-.submit-btn {
-  margin: 3px 3px
+#submit-btn {
+  margin: 40rpx 10rpx;
+  background-color: black;
 }

+ 18 - 5
wechat/pages/article/article.js

xqd xqd xqd
@@ -21,6 +21,9 @@ Page({
       title: '文章'
     }],
     selectedTab: 'video',
+    selectedVideoIndex: null,
+    selectedVideoUrl: '',
+    showVideo: false
   },
   onLoad: function(a) {
     // app.pageOnLoad(this);
@@ -29,6 +32,12 @@ Page({
   swiperTab: function(e) {
     var that = this;
     // console.log(e);
+    if (e.detail.currentItemId != 'video') {
+      this.setData({
+        show_video: null,
+        show: !0
+      });
+    }
     that.setData({
       selectedTab: e.detail.currentItemId
     });
@@ -175,11 +184,15 @@ Page({
     // }
   },
   play: function(a) {
-    var t = a.currentTarget.dataset.index;
-    wx.createVideoContext("video_" + this.data.show_video).pause(), this.setData({
-      show_video: t,
-      show: !0
-    });
+    var url = a.currentTarget.dataset.url;
+    var title = a.currentTarget.dataset.title;
+    wx.navigateTo({
+      url: '/pages/video/index?url=' + url + '&title=' + title,
+    })
+    // wx.createVideoContext("video_" + this.data.show_video).pause(), this.setData({
+    //   show_video: t,
+    //   show: !0
+    // });
   },
   onReachBottom: function() {
     this.loadMoreGoodsList();

+ 2 - 3
wechat/pages/article/article.wxml

xqd
@@ -11,9 +11,8 @@
           <view class="info-content" wx:for="{{ video_list }}">
             <view class="info-bg" wx:if="{{ item.type == 3 }}">
               <view class="info-video">
-                <image bindtap="play" class="bg {{show_video==index?hide:''}}" data-index="{{index}}" src="{{item.pic_url}}"></image>
-                <image bindtap="play" class="play {{show_video==index?hide:''}}" data-index="{{index}}" src="/images/video-play.png"></image>
-                <video autoplay="true" class="{{show_video==index?'':hide}}" controls="controls" id="video_{{index}}" src="{{item.url}}" wx:if="{{show_video==index}}"></video>
+                <image bindtap="play" class="bg" src="{{item.pic_url}}" data-url="{{ item.url }}" data-title="{{ item.title }}"></image>
+                <image bindtap="play" class="play" src="/images/video-play.png" data-url="{{ item.url }}" data-title="{{ item.title }}"></image>
               </view>
               <view class="info-label">{{item.title||'未命名'}}</view>
               <!-- <view class="content {{item.show!=-1?'':'more'}}">{{item.content||'暂无信息'}}</view>   -->

+ 23 - 7
wechat/pages/index/index.js

xqd xqd xqd xqd
@@ -62,12 +62,24 @@ Page({
             student_id: pt_student.id
           },
           success: res => {
-            console.log(res)
+            let validLocation = false;
             if (res.data.status == 'success' && res.data.result == 'ok') {
-              let validLocation = api.isTest ? true : false;
-              this.setData({
-                is_btn_disabled: !validLocation
-              })
+              validLocation = true;
+            } else {
+              validLocation = api.isTest ? true : false;
+            }
+            this.setData({
+              is_btn_disabled: !validLocation
+            })
+            if(validLocation) {
+              var start_time = wx.getStorageSync('check_card_start_time')
+              if(start_time) {
+                this.setData({
+                  startTime: start_time,
+                  isLearning: true
+                })
+                this.startClock()
+              }
             }
           },
         });
@@ -145,9 +157,10 @@ Page({
           success: res => {
             let validLocation = false;
             if (res.data.status == 'success' && res.data.result == 'ok') {
+              validLocation = true;
+            } else {
               validLocation = api.isTest ? true : false;
             }
-            validLocation = api.isTest ? true : false;
             this.setData({
               is_btn_disabled: !validLocation
             })
@@ -202,9 +215,11 @@ Page({
         success: res => {
           if (res.data.status == 'success') {
             wx.setStorageSync('check_card_id', res.data.check_card_id)
+            var start_time = new Date().getTime()
+            wx.setStorageSync('check_card_start_time', start_time)
             that.setData({
               isLearning: !isLearning,
-              startTime: new Date().getTime()
+              startTime: start_time
             })
             that.startClock()
           } else {
@@ -248,6 +263,7 @@ Page({
       isLearning: false,
       showPopup: true
     })
+    wx.setStorageSync('check_card_start_time', '')
     const ctx = wx.createCanvasContext('shareCanvas')
     let width = this.data.shareCanvasWidth
     let height = this.data.shareCanvasHeight

+ 73 - 0
wechat/pages/video/index.js

xqd
@@ -0,0 +1,73 @@
+// pages/video/index.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    video_url: '',
+    title: '视频'
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.setNavigationBarTitle({
+      title: options.title//页面标题为路由参数
+    })
+    this.setData({
+      video_url: options.url,
+      title: options.title
+    });
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
+})

+ 8 - 0
wechat/pages/video/index.json

xqd
@@ -0,0 +1,8 @@
+{
+  "navigationBarBackgroundColor": "#000",
+  "navigationBarTextStyle": "white",
+  "usingComponents": {
+    "zan-card": "../../bower_components/zanui-weapp/dist/card/index"
+  },
+  "navigationBarTitleText": "视频"
+}

+ 6 - 0
wechat/pages/video/index.wxml

xqd
@@ -0,0 +1,6 @@
+<!--pages/video/index.wxml-->
+<view class='sg-container'>
+  <view class='sg-video-container'>
+    <video autoplay="true" controls="controls" id="video_id" src="{{ video_url }}"></video>
+  </view>
+</view>

+ 4 - 0
wechat/pages/video/index.wxss

xqd
@@ -0,0 +1,4 @@
+/* pages/video/index.wxss */
+.sg-video-container video {
+  width: 100%;
+}