From c3d81e837e6350b431583c5cdcc1e0e09b4376c0 Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期三, 18 十二月 2024 16:45:47 +0800 Subject: [PATCH] 111 --- packageCourse/pages/course/index.js | 146 ++++++++++++++++++++++++++++++++++-------------- packageCourse/pages/course/index.wxss | 8 ++ packageCourse/pages/course/index.wxml | 5 + assets/js/middleGround/api/edu.js | 11 +++ 4 files changed, 124 insertions(+), 46 deletions(-) diff --git a/assets/js/middleGround/api/edu.js b/assets/js/middleGround/api/edu.js index 635a1b3..b9e9cb1 100644 --- a/assets/js/middleGround/api/edu.js +++ b/assets/js/middleGround/api/edu.js @@ -29,12 +29,21 @@ }) }, + //鏇存柊璇剧▼淇℃伅 + updateCourse(data) { + return request({ + url: '/edu/api/ApiUpdateCourse', + method: 'post', + data + }) + }, + //鏇存柊璇剧▼鐢宠淇℃伅 updateCourseApply(data) { return request({ url: '/edu/api/ApiUpdateCourseApply', method: 'post', - data, + data }) }, diff --git a/packageCourse/pages/course/index.js b/packageCourse/pages/course/index.js index 5a33ce7..65b3410 100644 --- a/packageCourse/pages/course/index.js +++ b/packageCourse/pages/course/index.js @@ -31,6 +31,8 @@ total: 999, loading: false }, + updateCourse: false, + currentCourse: null, submitLoading: false, // 鍔犺浇鍙傛暟 bottomLoading: false, @@ -117,7 +119,7 @@ id: item.id, 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 : '-' : '-' } }) //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� @@ -242,55 +244,111 @@ }) }, - // 鏂板缓璇剧▼ - submitCourse() { - if (!this.data.courseName) { - wx.showToast({ - title: '璇峰~鍐欒绋嬪悕绉�', - duration: 1000, - icon: 'none', - }) - return false + // 閲嶆柊鐢宠 + replayCourse(e) { + const { + item + } = e.currentTarget.dataset + if (!item.linkProduct.icon) { + item.linkProduct.icon = '' } - if (!this.data.selectedBook) { - wx.showToast({ - title: '璇烽�夋嫨鍏宠仈鏁欐潗', - duration: 1000, - icon: 'none', - }) - return false + const data = { + product: item.linkProduct } this.setData({ - submitLoading: true + currentCourse: item, + courseName: item.name, + courseDesc: item.description, + selectedBook: data, + updateCourse: true, + visible: 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 + this.getTextBook() + }, + + // 鏂板缓璇剧▼ + submitCourse() { + if (this.data.updateCourse) { + this.setData({ + submitLoading: true }) - .then((res) => { - if (res) { - this.setData({ - visible: false, - selectedBook: null, - courseDesc: '', - courseName: '', - submitLoading: false - }) - this.getData() - } + 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() + } + }) + } }, // 杩斿洖椤堕儴 diff --git a/packageCourse/pages/course/index.wxml b/packageCourse/pages/course/index.wxml index 4bbb4e0..9bf6c59 100644 --- a/packageCourse/pages/course/index.wxml +++ b/packageCourse/pages/course/index.wxml @@ -22,7 +22,10 @@ <view class="courseId"> <text>ID: {{item.id}}</text> <t-tag class="margin-16" wx:if="{{item.applyState == 'WaitAudit'}}" variant="light" theme="warning">瀹℃牳涓�</t-tag> - <t-tag class="margin-16" wx:if="{{item.applyState == 'Reject'}}" variant="light" theme="danger">鏈�氳繃</t-tag> + <view wx:if="{{item.applyState == 'Reject'}}"> + <t-tag class="margin-16" variant="light" theme="danger">鏈�氳繃</t-tag> + <t-tag bindtap="replayCourse" data-item="{{item}}" class="margin-16 replay" theme="danger">閲嶆柊鐢宠</t-tag> + </view> <t-tag class="margin-16" wx:if="{{item.applyState == 'Normal'}}" variant="light" theme="success">浣跨敤涓�</t-tag> </view> <view wx:if="{{item.applyState == 'Reject'}}" class="reason">鎷掔粷鍘熷洜: {{item.reason}}</view> diff --git a/packageCourse/pages/course/index.wxss b/packageCourse/pages/course/index.wxss index bd31e00..b4c7659 100644 --- a/packageCourse/pages/course/index.wxss +++ b/packageCourse/pages/course/index.wxss @@ -75,6 +75,14 @@ border-bottom: 1rpx solid #eee; } +.replay { + margin-left: 20rpx; + background-color: red !important; + border: 0 !important; + position: relative; + z-index: 999999; +} + .courseIcon { width: 200rpx; height: 280rpx; -- Gitblit v1.9.1