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
1014 B

const app = getApp();
Component({
properties: {
course_id: Number,
id_: Number,
refresh: {
type: Number,
observer: function (r) {
if (r) {
5 years ago
this.refresh();
this.setData({ refresh: false });
}
}
}
},
data: {
list: [{ text: "全部", order: "" }, { text: "未发布", order: 0 }, { text: "提交中", order: 1 }, { text: "补交中", order: 2 }, { text: "已截止", order: 5 }]
},
attached() {
this.refresh();
},
methods: {
onSwitchNav({ detail: { current, value } }) {
5 years ago
if (!this.options)
this.options = {};
this.options.order = value.order;
this.refresh();
},
refresh() {
let { course_id } = this.data;
5 years ago
;
app.api("courses.homework_commons")({ ...this.options, course_id, type: 4 })
.then(res => {
5 years ago
;
this.setData({ homeworks: res.homeworks });
}).catch(e => {
app.showError(e);
})
}
}
})