| | |
| | | total: 999, |
| | | loading: false |
| | | }, |
| | | updateCourse: false, |
| | | currentCourse: null, |
| | | submitLoading: false, |
| | | // 加载参数 |
| | | bottomLoading: false, |
| | | isMoreData: false, |
| | |
| | | item |
| | | } = e.currentTarget.dataset |
| | | const refCode = item.linkProduct.refCode ? item.linkProduct.refCode : '' |
| | | if (item.applyState == 'WaitAudit' || item.applyState == 'Reject') { |
| | | if (item.applyState == 'WaitAudit') { |
| | | wx.showToast({ |
| | | title: item.applyState == 'WaitAudit' ? '审核中' : '未通过', |
| | | title: '审核中', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | }) |
| | | return false |
| | | } |
| | | if (item.applyState == 'Reject') return false |
| | | wx.navigateTo({ |
| | | url: '/packageCourse/pages/course/detail/index?courseId=' + courseId + "&bookRefCode=" + refCode, |
| | | }) |
| | |
| | | ...item, |
| | | name: item.name, |
| | | id: item.id, |
| | | icon: item.icon && item.icon != 'default' ? getPublicImage(item.icon, 80) : '', |
| | | icon: item.icon && item.icon != 'default' ? getPublicImage(item.icon, 200) : '', |
| | | introduction: item.description, |
| | | reason: item.applyReturnMsg ? JSON.parse(item.applyReturnMsg).reason : '-' |
| | | reason: item.applyReturnMsg ? JSON.parse(item.applyReturnMsg).reason ? JSON.parse(item.applyReturnMsg).reason : '-' : '-' |
| | | } |
| | | }) |
| | | //触底加载新数据并保留老数据 |
| | |
| | | const list = res.datas.map((item) => { |
| | | return { |
| | | ...item, |
| | | icon: item.product.icon ? getPublicImage(item.product.icon, 80) : '' |
| | | icon: item.product.icon ? getPublicImage(item.product.icon, 200) : '' |
| | | } |
| | | }) |
| | | this.setData({ |
| | |
| | | |
| | | // 单选选择课本 |
| | | onChange(e) { |
| | | const { |
| | | index |
| | | } = e.currentTarget.dataset |
| | | this.setData({ |
| | | radioVal: e.detail.value |
| | | radioVal: index |
| | | }); |
| | | }, |
| | | |
| | |
| | | }) |
| | | }, |
| | | |
| | | // 重新申请 |
| | | replayCourse(e) { |
| | | const { |
| | | item |
| | | } = e.currentTarget.dataset |
| | | if (!item.linkProduct.icon) { |
| | | item.linkProduct.icon = '' |
| | | } |
| | | const data = { |
| | | product: item.linkProduct |
| | | } |
| | | this.setData({ |
| | | currentCourse: item, |
| | | courseName: item.name, |
| | | courseDesc: item.description, |
| | | selectedBook: data, |
| | | updateCourse: true, |
| | | visible: true |
| | | }) |
| | | this.getTextBook() |
| | | }, |
| | | |
| | | // 新建课程 |
| | | submitCourse() { |
| | | if (!this.data.courseName) { |
| | | wx.showToast({ |
| | | title: '请填写课程名称', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | if (this.data.updateCourse) { |
| | | this.setData({ |
| | | submitLoading: true |
| | | }) |
| | | return false |
| | | app.MG.edu |
| | | .updateCourse({ |
| | | courseId: this.data.currentCourse.id, |
| | | name: this.data.currentCourse.name, |
| | | description: this.data.currentCourse.desc |
| | | }) |
| | | .then((res) => { |
| | | app.MG.edu |
| | | .updateCourseApply({ |
| | | courseId: this.data.currentCourse.id, |
| | | applyData: JSON.stringify({ |
| | | textBookId: this.data.selectedBook.product.id, |
| | | textBookName: this.data.selectedBook.product.name |
| | | }) |
| | | }) |
| | | .then((ares) => { |
| | | if (ares) { |
| | | this.setData({ |
| | | visible: false, |
| | | selectedBook: null, |
| | | courseDesc: '', |
| | | courseName: '', |
| | | submitLoading: false |
| | | }) |
| | | this.getData() |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | if (!this.data.courseName) { |
| | | wx.showToast({ |
| | | title: '请填写课程名称', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | }) |
| | | return false |
| | | } |
| | | if (!this.data.selectedBook) { |
| | | wx.showToast({ |
| | | title: '请选择关联教材', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | }) |
| | | return false |
| | | } |
| | | this.setData({ |
| | | submitLoading: true |
| | | }) |
| | | app.MG.edu |
| | | .applyNewCourse({ |
| | | name: this.data.courseName, |
| | | description: this.data.courseDesc, |
| | | content: '', |
| | | icon: this.data.selectedBook.product.icon, |
| | | type: 'course', |
| | | config: '', |
| | | applyData: JSON.stringify({ |
| | | textBookId: this.data.selectedBook.product.id, |
| | | textBookName: this.data.selectedBook.product.name |
| | | }), |
| | | linkProductId: this.data.selectedBook.product.id, |
| | | maxClassCount: 999, |
| | | payPrice: 0 |
| | | }) |
| | | .then((res) => { |
| | | if (res) { |
| | | this.setData({ |
| | | visible: false, |
| | | selectedBook: null, |
| | | courseDesc: '', |
| | | courseName: '', |
| | | submitLoading: false |
| | | }) |
| | | this.getData() |
| | | } |
| | | }) |
| | | } |
| | | if (!this.data.selectedBook) { |
| | | wx.showToast({ |
| | | title: '请选择关联教材', |
| | | duration: 1000, |
| | | icon: 'none', |
| | | }) |
| | | return false |
| | | } |
| | | app.MG.edu |
| | | .applyNewCourse({ |
| | | name: this.data.courseName, |
| | | description: this.data.courseDesc, |
| | | content: '', |
| | | icon: this.data.selectedBook.product.icon, |
| | | type: 'course', |
| | | config: '', |
| | | applyData: JSON.stringify({ |
| | | textBookId: this.data.selectedBook.product.id, |
| | | textBookName: this.data.selectedBook.product.name |
| | | }), |
| | | linkProductId: this.data.selectedBook.product.id, |
| | | maxClassCount: 999, |
| | | payPrice: 0 |
| | | }) |
| | | .then((res) => { |
| | | if (res) { |
| | | this.setData({ |
| | | visible: false |
| | | }) |
| | | this.getData() |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 返回顶部 |