From bd7b08a5e9a071a8155bd8fea95592af6b7dfe93 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 21 二月 2025 10:56:23 +0800 Subject: [PATCH] 视频销售方式 --- packageCourse/components/studentManage/index.js | 277 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 252 insertions(+), 25 deletions(-) diff --git a/packageCourse/components/studentManage/index.js b/packageCourse/components/studentManage/index.js index 519a3c3..967308b 100644 --- a/packageCourse/components/studentManage/index.js +++ b/packageCourse/components/studentManage/index.js @@ -34,6 +34,9 @@ name: '鍔╂暀', value: 'Teacher' }], + isAll: false, + isEnbled: false, + currentState: 'Normal', // 鍔犺浇鍙傛暟 bottomLoading: false, isMoreData: false, @@ -50,11 +53,207 @@ * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { + changeHandle(e) { + const { + value + } = e.detail; + let cmsList = this.data.userList + this.setData({ + userList: [] + }) + if (value) { + const data = cmsList.filter(item => item.appUser.name.indexOf(value) > -1); + this.setData({ + userList: data + }) + } + if (value == '') { + this.setData({ + userList: [], + }) + this.getStudentList() + } + }, + // 褰撳墠鐘舵�� + onTabsChange(e) { + this.setData({ + currentState: e.detail.value, + userList: [], + isAll: false, + isEnbled: false, + searchKey: '' + }) + this.getStudentList() + }, + + // 閫夋嫨瀛︾敓 + selectUser(e) { + const { + index + } = e.currentTarget.dataset + let bool = false; + let allBool = false; + const data = [...this.data.userList]; + data[index].isCheck = !data[index].isCheck; + const list = data.filter(item => item.isCheck == true); + if (list.length === data.length) { + allBool = true + } + if (list.length > 0) { + bool = true + } + this.setData({ + userList: data, + isEnbled: bool, + isAll: allBool + }) + }, + + // 鍏ㄩ�� + selectAll(e) { + const data = this.data.userList; + data.forEach(item => { + if (item.linkType != 'Creator') { + item.isCheck = e.detail.checked + } + }) + this.setData({ + userList: data, + isAll: e.detail.checked, + isEnbled: e.detail.checked, + }) + }, + + // 鎵归噺閫氳繃 + updateStateNormalDatas() { + const dataUser = this.data.userList.filter((item) => item.isCheck == true && item.linkType != 'Creator') + const data = { + groupId: this.properties.classId, + requests: dataUser.map((item) => { + return { + linkId: item.linkId, + linkType: item.linkType, + state: 'Normal', + groupState: 'Normal' + } + }) + } + app.MG.identity.updateAppUserGroupLink(data).then((res) => { + if (res) { + wx.showToast({ + title: '宸查�氳繃', + duration: 1000, + icon: 'none', + }) + this.setData({ + userList: [] + }) + this.getStudentList() + } + }) + }, + + // 鎵归噺绉婚櫎瀛︾敓 + removeStudentDatas() { + wx.showModal({ + title: '鎻愮ず', + content: '鏄惁鎵归噺绉婚櫎閫変腑鎴愬憳?', + complete: (res) => { + if (res.cancel) { + return + } + if (res.confirm) { + const dataUser = this.data.userList.filter((item) => item.isCheck == true && item.linkType != 'Creator') + const data = { + groupId: this.properties.classId, + appUserIds: dataUser.map((item) => item.appUser.id) + } + app.MG.identity.removeAppUserFromGroup(data).then((res) => { + if (res) { + wx.showToast({ + title: '宸茬Щ闄�', + duration: 1000, + icon: 'none', + }) + this.setData({ + userList: [] + }) + this.getStudentList() + } + }) + } + } + }) + }, + + // 鎵归噺鎷掔粷 + updateStateRejectDatas() { + const dataUser = this.data.userList.filter((item) => item.isCheck == true && item.linkType != 'Creator') + const data = { + groupId: this.properties.classId, + requests: dataUser.map((item) => { + return { + linkId: item.linkId, + linkType: item.linkType, + state: 'Reject', + groupState: 'Normal' + } + }) + } + app.MG.identity.updateAppUserGroupLink(data).then((res) => { + if (res) { + wx.showToast({ + title: '宸叉嫆缁�', + duration: 1000, + icon: 'none', + }) + this.setData({ + userList: [] + }) + this.getStudentList() + } + }) + }, + + // 鏇存柊鐘舵�� 鎷掔粷 + updateStateReject(e) { + const { + item + } = e.currentTarget.dataset + const data = { + groupId: this.properties.classId, + requests: [{ + linkId: item.linkId, + linkType: item.linkType, + state: 'Reject', + groupState: 'Normal' + }] + } + app.MG.identity.updateAppUserGroupLink(data).then((res) => { + if (res) { + wx.showToast({ + title: '宸叉嫆缁�', + duration: 1000, + icon: 'none', + }) + this.setData({ + userList: [] + }) + this.getStudentList() + } + }) + }, + // 鑾峰彇瀛︾敓鍒楄〃 getStudentList(isReachBottom) { const data = { start: (this.data.page - 1) * this.data.limit, size: this.data.limit, + filterList: [{ + value: this.data.currentState, + field: "State", + subFilters: [] + }], searchList: this.data.searchKey ? [{ keywords: this.data.searchKey, field: 'Name', @@ -70,12 +269,18 @@ if (datas.length > 0) { let list = datas.map((item, index) => { if (item.linkType == 'Creator') { - const userInfo = item.appUser?.infoList?.find((citem) => citem.type == 'teacherInfo') - item.appUser.name = userInfo.name - item.appUser.icon = userInfo.icon - if (userInfo?.data) { - const iconData = JSON.parse(userInfo.data) - item.appUser.icon = getPublicImage(iconData?.relevantCertificates[0]?.md5, 100) ?? '' + const wechatData = item.appUser?.infoList?.find((citem) => citem.type == 'WeChat') + const defaultData = item.appUser?.infoList?.find((citem) => citem.type == 'teacherInfo') + let userInfo = defaultData; + if (wechatData?.name) { + userInfo = wechatData; + item.appUser.name = userInfo.name + item.appUser.icon = userInfo.icon + } else { + if (userInfo?.data) { + const iconData = JSON.parse(userInfo.data) + item.appUser.icon = getPublicImage(iconData?.relevantCertificates[0]?.md5, 100) ?? '' + } } } if (item.linkType == 'RefCode' || item.linkType == 'Teacher') { @@ -92,7 +297,8 @@ return { ...item, index: index + 1, - createDate: moment(item.createDate).format('YYYY-MM-DD') + createDate: moment(item.createDate).format('YYYY-MM-DD'), + isCheck: false } }) //瑙﹀簳鍔犺浇鏂版暟鎹苟淇濈暀鑰佹暟鎹� @@ -101,7 +307,9 @@ } this.setData({ userList: list, - total: res.totalSize, + total: totalSize, + isAll: false, + isEnbled: false, skeletonLoding: false, bottomLoading: false }) @@ -177,22 +385,37 @@ // 绉婚櫎瀛︾敓 removeStudent(e) { - const { - item - } = e.currentTarget.dataset - const data = { - groupId: this.properties.classId, - appUserIds: [item.appUser.id] - } - app.MG.identity.removeAppUserFromGroup(data).then((res) => { - if (res) { - wx.showToast({ - title: '宸茬Щ闄�', - duration: 1000, - icon: 'none', - }) - this.getStudentList() - this.newNotice(item, 'remove') + wx.showModal({ + title: '鎻愮ず', + content: '鏄惁绉婚櫎褰撳墠鎴愬憳?', + complete: (res) => { + if (res.cancel) { + return + } + if (res.confirm) { + const { + item + } = e.currentTarget.dataset + const data = { + groupId: this.properties.classId, + appUserIds: [item.appUser.id] + } + app.MG.identity.removeAppUserFromGroup(data).then((res) => { + if (res) { + wx.showToast({ + title: '宸茬Щ闄�', + duration: 1000, + icon: 'none', + }) + this.setData({ + userList: [], + isAll: false, + isEnbled: false + }) + this.getStudentList() + } + }) + } } }) }, @@ -222,9 +445,13 @@ duration: 1000, icon: 'success', }) + this.setData({ + userList: [], + isAll: false, + isEnbled: false + }) this.cancle() this.getStudentList() - this.newNotice(this.data.currentIdentity, 'success') } }) }, -- Gitblit v1.9.1