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.
40 lines
975 B
40 lines
975 B
5 years ago
|
import {getFormatDatetime} from "../../../js/utils";
|
||
|
|
||
|
const app = getApp();
|
||
|
Component({
|
||
|
properties: {
|
||
|
exercise_id:Number
|
||
|
},
|
||
|
|
||
|
data: {
|
||
|
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
onLoad:function(){
|
||
|
this.refresh();
|
||
|
},
|
||
|
async refresh(){
|
||
|
let {exercise_id} = this.data;
|
||
|
let data = await app.api("exercises.exercise_setting")({exercise_id});
|
||
|
let date = new Date(data.exercise.end_time);
|
||
|
data.exercise.end_time_str = getFormatDatetime(date);
|
||
|
this.setData(data);
|
||
|
},
|
||
|
onTap(){
|
||
|
let {time} = this.data.exercise;
|
||
|
if(time&&time>0){
|
||
|
wx.showModal({
|
||
|
title: '提示',
|
||
|
content: `答题时间为${time}分钟\n开始答题后即开始计时`,
|
||
|
success:res=>{
|
||
|
if(res.confirm)
|
||
|
app.navigateTo({ url: `{exercise}?exercise_id=${this.data.exercise_id}` });
|
||
|
}
|
||
|
})
|
||
|
}else
|
||
|
app.navigateTo({url:`{exercise}?exercise_id=${this.data.exercise_id}`});
|
||
|
}
|
||
|
}
|
||
|
})
|