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.
|
|
|
const app = getApp();
|
|
|
|
Component({
|
|
|
|
properties: {
|
|
|
|
course_id: {
|
|
|
|
type: Number
|
|
|
|
},
|
|
|
|
id_: {
|
|
|
|
type: Number
|
|
|
|
},
|
|
|
|
course_identity:Number,
|
|
|
|
refresh: {
|
|
|
|
type: Boolean,
|
|
|
|
observer: function (v) {
|
|
|
|
if (v) {
|
|
|
|
this.refresh({refresh:1});
|
|
|
|
this.setData({ refresh: false });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
|
|
|
|
},
|
|
|
|
pageLifetimes:{
|
|
|
|
show(){
|
|
|
|
if(this.secondShow)
|
|
|
|
this.refresh();
|
|
|
|
this.secondShow = 1;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
attached(){
|
|
|
|
this.refresh();
|
|
|
|
//this.test();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
log(e){
|
|
|
|
console.log(e);
|
|
|
|
},
|
|
|
|
async refresh({refresh=1}={}){
|
|
|
|
let {course_id, course_identity} = this.data;
|
|
|
|
if(course_identity==5)
|
|
|
|
var data = await app.api("weapps.courses.attendances.student_attendances")({course_id});
|
|
|
|
else{
|
|
|
|
var data = await app.api("weapps.courses.attendances")({course_id});
|
|
|
|
data.avg_absence_percent = (data.avg_absence_rate * 100).toFixed(1);
|
|
|
|
data.avg_normal_percent = (data.avg_normal_rate * 100).toFixed(1);
|
|
|
|
data.avg_leave_percent = (data.avg_leave_rate * 100).toFixed(1);
|
|
|
|
}this.setData(data);
|
|
|
|
},
|
|
|
|
|
|
|
|
test(){
|
|
|
|
let { course_id } = this.data;
|
|
|
|
app.api("weapps.courses.attendances")({ course_id });
|
|
|
|
app.api("courses.attendances")({course_id});
|
|
|
|
app.api("courses.attendances")({ course_id,history:true});
|
|
|
|
app.api("weapps.courses.attendances.student_attendances")({ course_id });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|