|
@@ -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 })
|