Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
修复自定义课程的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mohuishou committed May 1, 2018
1 parent 8b41d84 commit 28b02db
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/pages/addSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
this.ShowToast("节次范围错误")
return
}
course.day += 1
course.day = course.day - 0 + 1
// 节次
let session = ""
for (let i = course.session[0] - 0 + 1; i < course.session[1] - 0 + 1; i++) {
Expand All @@ -168,14 +168,13 @@
course.all_week = course.all_week.join(",")
course.course_id = -Math.random()
course.lesson_id = -Math.random()
// 添加课程
// 添加课程
let items = db.Get("myScheduleItems") || [];
items.push(course)
db.Set("myScheduleItems", items);
wepy.navigateTo({
url: "/pages/schedule"
});
wepy.navigateBack({
delta: 2, //返回的页面数,如果 delta 大于现有页面数,则返回到首页
})
},
campusChange(e) {
this.campusIdx = e.detail.value
Expand Down
8 changes: 8 additions & 0 deletions src/pages/course/lists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
page: 1,
page_size: 15,
height: 500,
isEmpty: false,
params: {
call_name: "",
task: "",
Expand Down Expand Up @@ -408,6 +409,10 @@
return courses
}
async getCourses() {
if (this.page > 1 && this.isEmpty) {
this.ShowToast("已经到底了!")
return
}
const resp = await this.GetWithBind("/course/all", Object.assign({
page: this.page,
page_size: this.page_size,
Expand All @@ -418,6 +423,9 @@
} else {
this.courses = this.newCourse(resp.data)
}
if (resp.data.length === 0) {
this.isEmpty = true
}
this.$apply()
}
onLoad() {
Expand Down
10 changes: 9 additions & 1 deletion src/pages/course/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
page_size: 15,
name: "",
height: 500,
from: ""
from: "",
isEmpty: false,
}
newCourse(courses) {
for (let i = 0; i < courses.length; i++) {
Expand All @@ -122,6 +123,10 @@
return courses
}
async searchCourse() {
if (this.page > 1 && this.isEmpty) {
this.ShowToast("已经到底了!")
return
}
const resp = await this.PostWithBind("/course/search", {
page: this.page,
page_size: this.page_size,
Expand All @@ -131,6 +136,9 @@
this.courses = this.courses.concat(this.newCourse(resp.data))
} else {
this.courses = this.newCourse(resp.data)
}
if (resp.data.length === 0) {
this.isEmpty = true
}
this.$apply()
}
Expand Down

0 comments on commit 28b02db

Please sign in to comment.