Parcourir la source

Merge branch 'master' of http://git.cc-lotus.info/ball-court/ball-applet

guhongwei il y a 2 ans
Parent
commit
72844167ac

+ 27 - 1
pages/stuAdmin/course/list.js

@@ -7,6 +7,7 @@ Page({
         page: 0,
         skip: 0,
         limit: 5,
+        user: {},
         //状态
         statusList: [],
         // 选中
@@ -37,6 +38,30 @@ Page({
         const { item } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/stuAdmin/course/info?id=${item._id}` })
     },
+    // 签到
+    toSign: async function (e) {
+        const that = this;
+        const { item } = e.currentTarget.dataset;
+        const user = that.data.user;
+        wx.showModal({
+            title: '提示',
+            content: '您是否确定签到?',
+            async success(res) {
+                if (res.confirm) {
+                    let params = { school_id: item.school_id, lesson_id: item._id, student_id: user.info.id, is_pay: '1' }
+                    let lessonStudent = await app.$get(`/lessonStudent`, params);
+                    if (lessonStudent.errcode == '0' && lessonStudent.total > 0) {
+                        const arr = await app.$post(`/lessonStudent/${lessonStudent.data[0]._id}`, { is_sign: '1' });
+                        if (arr.errcode == '0') {
+                            wx.showToast({ title: `签到成功`, icon: 'success', duration: 2000 });
+                            that.setData({ skip: 0, page: 0, list: [] })
+                            that.watchLogin();
+                        }
+                    }
+                } else if (res.cancel) { }
+            }
+        });
+    },
     // 分页
     toPage: function () {
         const that = this;
@@ -85,9 +110,10 @@ Page({
         wx.getStorage({
             key: 'user',
             success: async res => {
+                that.setData({ user: res.data })
                 let info = { skip: that.data.skip, limit: that.data.limit, type: that.data.tabs.active, student_id: res.data.info._id, is_pay: '1' };
                 let arr = await app.$get(`/studentView/lessonList`, { ...info });
-                if (arr.errcode == '0') { 
+                if (arr.errcode == '0') {
                     for (const val of arr.data) { let status = statusList.find(i => i.value == val.status); if (status) val.zhStatus = status.label; }
                     that.setData({ list: [...that.data.list, ...arr.data] })
                     that.setData({ total: arr.total })

+ 2 - 0
pages/stuAdmin/course/list.wxml

@@ -26,6 +26,7 @@
                             <view class="btn">
                                 <button size="mini" type="primary" bindtap="toView" data-item="{{item}}">详细信息</button>
                                 <button size="mini" type="primary" bindtap="toDrop" data-item="{{item}}">退课</button>
+                                <button wx:if="{{item.type=='3'&&item.is_sign=='0'}}" size="mini" type="primary" bindtap="toSign" data-item="{{item}}">签到</button>
                             </view>
                         </view>
                     </view>
@@ -48,6 +49,7 @@
                             <view class="btn">
                                 <button size="mini" type="primary" bindtap="toView" data-item="{{item}}">详细信息</button>
                                 <button size="mini" type="primary" bindtap="toDrop" data-item="{{item}}">退课</button>
+                                <button wx:if="{{item.type=='3'&&item.is_sign=='0'}}" size="mini" type="primary" bindtap="toSign" data-item="{{item}}">签到</button>
                             </view>
                         </view>
                     </view>

+ 1 - 1
pages/stuAdmin/school/info.wxml

@@ -39,7 +39,7 @@
                 <text class="text1">{{form.brief||'暂无'}}</text>
             </view>
             <view class="one_1">
-                <image bindtap="toView" data-item="{{form.yyzz[0]}}" class="image" src="{{form.yyzz&&form.yyzz.length>0?form.yyzz[0].url:''}}"></image>
+                <image mode="aspectFit" bindtap="toView" data-item="{{form.yyzz[0]}}" class="image" src="{{form.yyzz&&form.yyzz.length>0?form.yyzz[0].url:''}}"></image>
             </view>
         </view>
     </view>