You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

const app = getApp();
Component({
properties: {
data:Object,
course_identity:Number,
course_id:Number
},
data: {
},
methods: {
onButtonTap(e){
console.log(this.data);
let {course_identity,course_id,data:{mode, code, id:attendance_id}} = this.data;
if(course_identity==5&&mode=="QUICK"){
wx.reportAnalytics('tap_quick_attendance_button', {});
this.quickAttendance();
}else{
app.navigateTo({url:`{attendance_detail}?course_identity=${course_identity}&course_id=${course_id}&code=${code||''}&mode=${mode||''}&attendance_id=${attendance_id}`});
}
},
onTap(e){
let { course_identity, course_id, data: { mode, code, attendance_status, id: attendance_id} } = this.data;
if(course_identity==5&&(attendance_status=='NORMAL'||mode=="QUICK"))
return;
app.navigateTo({ url: `{attendance_detail}?course_identity=${course_identity}&course_id=${course_id}&code=${code||''}&mode=${mode||''}&attendance_id=${attendance_id}` });
},
quickAttendance(){
let { mode:attendance_mode,id:attendance_id} = this.data.data;
app.api("weapps.course_member_attendances")({attendance_mode,attendance_id})
.then(res=>{
res.message = "签到成功";
app.showMsg(res);
this.triggerRefresh();
}).catch(e=>{
app.showError(e);
});
},
triggerRefresh(){
this.triggerEvent("refresh", {}, { bubbles: true });
}
}
})