From dd9ca4df1e2a72707de5ae4e57e081d89db01a36 Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期二, 31 十二月 2024 15:09:06 +0800 Subject: [PATCH] 批量操作 --- packageCourse/pages/course/detail/index.wxml | 253 +++++------------------------------ packageCourse/pages/course/index.wxss | 3 packageCourse/pages/course/index.wxml | 8 packageCourse/components/studentManage/index.json | 3 packageCourse/components/studentManage/index.js | 107 ++++++++++++++- packageCourse/pages/course/detail/index.wxss | 7 packageCourse/components/studentManage/index.wxml | 12 + packageCourse/components/studentManage/index.wxss | 18 ++ 8 files changed, 176 insertions(+), 235 deletions(-) diff --git a/packageCourse/components/studentManage/index.js b/packageCourse/components/studentManage/index.js index 519a3c3..51fc396 100644 --- a/packageCourse/components/studentManage/index.js +++ b/packageCourse/components/studentManage/index.js @@ -34,6 +34,8 @@ name: '鍔╂暀', value: 'Teacher' }], + isAll: false, + isEnbled: false, // 鍔犺浇鍙傛暟 bottomLoading: false, isMoreData: false, @@ -50,6 +52,88 @@ * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { + // 閫夋嫨瀛︾敓 + 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); + if (list.length === this.data.userList.length - 1) { + allBool = true + } + if (list.length > 1) { + bool = true + } + this.setData({ + userList: data, + isEnbled: bool, + isAll: allBool + }) + }, + + // 鍏ㄩ�� + selectAll(e) { + const data = this.data.userList; + data.forEach(item => { + 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) + 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) { + 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) + const data = { + groupId: this.properties.classId, + appUserIds: dataUser.map((item) => item.appUser.id) + } + app.MG.identity.removeAppUserFromGroup(data).then((res) => { + if (res) { + this.getStudentList() + } + }) + } + } + }) + }, + // 鑾峰彇瀛︾敓鍒楄〃 getStudentList(isReachBottom) { const data = { @@ -70,12 +154,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 +182,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 +192,7 @@ } this.setData({ userList: list, - total: res.totalSize, + total: totalSize, skeletonLoding: false, bottomLoading: false }) diff --git a/packageCourse/components/studentManage/index.json b/packageCourse/components/studentManage/index.json index 4c3b9c4..f219418 100644 --- a/packageCourse/components/studentManage/index.json +++ b/packageCourse/components/studentManage/index.json @@ -13,6 +13,7 @@ "t-popup": "tdesign-miniprogram/popup/popup", "t-icon": "tdesign-miniprogram/icon/icon", "t-radio": "tdesign-miniprogram/radio/radio", - "t-radio-group": "tdesign-miniprogram/radio-group/radio-group" + "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox" } } \ No newline at end of file diff --git a/packageCourse/components/studentManage/index.wxml b/packageCourse/components/studentManage/index.wxml index 8d9f419..a655a41 100644 --- a/packageCourse/components/studentManage/index.wxml +++ b/packageCourse/components/studentManage/index.wxml @@ -11,7 +11,8 @@ </view> </view> <view class="userList" wx:for="{{userList}}" wx:key="index"> - <view class="userInfo"> + <view class="userInfo" bindtap="selectUser" data-index="{{index}}"> + <t-checkbox wx:if="{{item.linkType != 'Creator'}}" block="{{false}}" checked="{{item.isCheck}}" /> <t-avatar class="avatar-example" size="small" image="{{item.appUser.icon}}" /> <text class="user">{{item.appUser.name}}</text> </view> @@ -32,6 +33,15 @@ <view class="content" wx:if="{{userList.length == 0}}"> <empty /> </view> + <view class="navBottom" wx:if="{{userList.length > 1}}"> + <view class="navBottom-check"> + <t-checkbox block="{{false}}" label="鍏ㄩ��" checked="{{isAll}}" bind:change="selectAll" /> + </view> + <view class="navBtn"> + <t-button disabled="{{!isEnbled}}" style="margin-right:10px" size="extra-small" bindtap="updateStateNormalDatas">鎵归噺閫氳繃</t-button> + <t-button disabled="{{!isEnbled}}" size="extra-small" theme="danger" bindtap="removeStudentDatas">鎵归噺绉婚櫎</t-button> + </view> + </view> </view> <t-popup visible="{{showConfirm}}" usingCustomNavbar bind:visible-change="onVisibleChange" placement="center"> <view class="block--select"> diff --git a/packageCourse/components/studentManage/index.wxss b/packageCourse/components/studentManage/index.wxss index 4d35761..2afdb87 100644 --- a/packageCourse/components/studentManage/index.wxss +++ b/packageCourse/components/studentManage/index.wxss @@ -7,8 +7,8 @@ .contentBox { width: 100%; - height: calc(100vh - env(safe-area-inset-bottom)); - background-color: #eee; + height: 100%; + background-color: #fff; font-size: 28rpx; } @@ -55,7 +55,7 @@ .contentList { width: 100%; - height: calc(100% - 55px); + height: calc(100% - 55px - 45px); background-color: #fff; } @@ -120,6 +120,18 @@ right: 0; } +.navBottom { + width: 100%; + height: 45px; + background-color: #fff; + display: flex; + justify-content: space-between; + align-items: center; + border-top: 1rpx solid #eee; + padding: 5px 10px; + box-sizing: border-box; +} + /* gujia */ .group { diff --git a/packageCourse/pages/course/detail/index.wxml b/packageCourse/pages/course/detail/index.wxml index 341b1b2..5127d35 100644 --- a/packageCourse/pages/course/detail/index.wxml +++ b/packageCourse/pages/course/detail/index.wxml @@ -6,30 +6,9 @@ <view wx:if="{{!courseLoading}}"> <view class="ID-State"> <text class="ID">ID: {{detail.id}}</text> - <t-tag - class="margin-16" - size="large" - wx:if="{{detail.applyState == 'WaitAudit'}}" - variant="light" - theme="warning" - >瀹℃牳涓�</t-tag - > - <t-tag - class="margin-16" - size="large" - wx:if="{{detail.applyState == 'Reject'}}" - variant="light" - theme="danger" - >鏈�氳繃</t-tag - > - <t-tag - class="margin-16" - size="large" - wx:if="{{detail.applyState == 'Normal'}}" - variant="light" - theme="success" - >浣跨敤涓�</t-tag - > + <t-tag class="margin-16" size="large" wx:if="{{detail.applyState == 'WaitAudit'}}" variant="light" theme="warning">瀹℃牳涓�</t-tag> + <t-tag class="margin-16" size="large" wx:if="{{detail.applyState == 'Reject'}}" variant="light" theme="danger">鏈�氳繃</t-tag> + <t-tag class="margin-16" size="large" wx:if="{{detail.applyState == 'Normal'}}" variant="light" theme="success">浣跨敤涓�</t-tag> </view> <view class="statics"> <view class="classCout"> @@ -50,18 +29,8 @@ <text>浣滆�咃細{{bookData.author}}</text> <text>ISBN锛歿{bookData.isbn}}</text> </view> - <image - wx:if="{{bookData.icon}}" - class="bookIcon" - src="{{bookData.icon}}" - mode="" - /> - <image - wx:else - class="bookIcon" - src="/static/images/default-book-img.png" - mode="" - /> + <image wx:if="{{bookData.icon}}" class="bookIcon" src="{{bookData.icon}}" mode="" /> + <image wx:else class="bookIcon" src="/static/images/default-book-img.png" mode="" /> </view> </view> </view> @@ -78,123 +47,40 @@ <!-- 鐝骇绠$悊 --> <view class="classBox" wx:else> <view class="header"> - <t-search - style="flex: 1" - value="{{searchKey}}" - bind:clear="changeHandle" - bind:submit="changeHandle" - placeholder="鎼滅储鐝骇鍚嶇О" - clearable - /> - <t-button bindtap="newClass" size="small" style="margin-left: 15rpx" - >寮�鐝�</t-button - > + <t-search style="flex: 1" value="{{searchKey}}" bind:clear="changeHandle" bind:submit="changeHandle" placeholder="鎼滅储鐝骇鍚嶇О" clearable /> + <t-button bindtap="newClass" size="small" style="margin-left: 15rpx">寮�鐝�</t-button> </view> - <view - class="contentList" - wx:if="{{classList.length > 0 && !classLoading}}" - > - <scroll-view - class="scroll" - class="content" - bind:scroll="onPageScroll" - model:scroll-top="{{setScrollValue}}" - scroll-y - refresher-enabled="{{true}}" - lower-threshold="{{80}}" - refresher-threshold="{{80}}" - refresher-default-style="none" - refresher-triggered="{{triggered}}" - bindrefresherpulling="{{refresh.onPulling}}" - bindrefresherrefresh="onPullDownRefresh" - bindscrolltolower="onReachBottom" - > + <view class="contentList" wx:if="{{classList.length > 0 && !classLoading}}"> + <scroll-view class="scroll" class="content" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" scroll-y refresher-enabled="{{true}}" lower-threshold="{{80}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> <view slot="refresher" class="refresh-container"> <view class="loading"> - <t-loading - theme="circular" - size="40rpx" - text="姝e湪鍒锋柊..." - class="wrapper" - /> + <t-loading theme="circular" size="40rpx" text="姝e湪鍒锋柊..." class="wrapper" /> </view> </view> - <view - class="listClass" - wx:for="{{classList}}" - wx:key="index" - data-class-id="{{item.id}}" - data-item="{{item}}" - bindtap="todetail" - > + <view class="listClass" wx:for="{{classList}}" wx:key="index" data-class-id="{{item.id}}" data-item="{{item}}" bindtap="todetail"> <view class="titleBox"> <text class="className">{{item.name}}</text> - <text class="classId" style="color: #999; font-size: 12px"> - ID: {{item.id}}</text - > + <text class="classId" style="color: #999; font-size: 12px">ID: {{item.id}}</text> </view> <view class="infoBox"> - <text - class="classTag" - wx:if="{{item.applyState == 'WaitAudit'}}" - style="color: #ef9f29" - >鐘舵��: 瀹℃牳涓�</text - > - <text - class="classTag" - wx:if="{{item.applyState == 'Normal'}}" - style="color: #1dbd11" - >鐘舵��: 杩涜涓�</text - > - <text - class="classTag" - wx:if="{{item.applyState == 'Reject'}}" - style="color: red" - >鐘舵��: 鏈�氳繃</text - > - <t-icon - bindtap="delClass" - data-del-id="{{item.id}}" - class="delete" - wx:if="{{item.applyState == 'Reject'}}" - name="delete" - color="red" - size="18px" - /> + <text class="classTag" wx:if="{{item.applyState == 'WaitAudit'}}" style="color: #ef9f29">鐘舵��: 瀹℃牳涓�</text> + <text class="classTag" wx:if="{{item.applyState == 'Normal'}}" style="color: #1dbd11">鐘舵��: 杩涜涓�</text> + <text class="classTag" wx:if="{{item.applyState == 'Reject'}}" style="color: red">鐘舵��: 鏈�氳繃</text> + <t-icon bindtap="delClass" data-del-id="{{item.id}}" class="delete" wx:if="{{item.applyState == 'Reject'}}" name="delete" color="red" size="18px" /> <view wx:if="{{item.applyState == 'Reject'}}" class="reason"> <text> 鎷掔粷鍘熷洜锛�</text> - <t-tag - style="margin-left: 0" - bind:tap="showDialog" - data-item="{{item}}" - class="margin-16 replay" - theme="danger" - >鐐瑰嚮鏌ョ湅</t-tag - > + <t-tag style="margin-left: 0" bind:tap="showDialog" data-item="{{item}}" class="margin-16 replay" theme="danger">鐐瑰嚮鏌ョ湅</t-tag> </view> <!-- <text class="classTag" wx:if="{{item.applyState == 'Reject'}}" style="color: red">鎷掔粷鍘熷洜锛歿{ item.reason != '' ? item.reason : '-' }}</text> --> - <text class="classTag" - >鐝骇浜烘暟: {{ item.memberCount }} / {{ item.maxUserCount - }}</text - > - <text class="classTag" - >鏈夋晥鏈燂細{{ item.beginDate }} - {{ item.endDate }}</text - > + <text class="classTag">鐝骇浜烘暟: {{ item.memberCount }} / {{ item.maxUserCount + }}</text> + <text class="classTag">鏈夋晥鏈燂細{{ item.beginDate }} - {{ item.endDate }}</text> </view> </view> <view class="bottom-loading" wx:if="{{bottomLoading}}"> - <t-loading - theme="circular" - size="40rpx" - text="鍔犺浇涓�..." - class="wrapper" - /> + <t-loading theme="circular" size="40rpx" text="鍔犺浇涓�..." class="wrapper" /> </view> - <view - class="bottom-loading" - style="color: #ccc; font-size: 28rpx" - wx:if="{{isMoreData}}" - > + <view class="bottom-loading" style="color: #ccc; font-size: 28rpx" wx:if="{{isMoreData}}"> <text>娌℃湁鏇村浜�</text> </view> </scroll-view> @@ -216,112 +102,53 @@ <view class="classInfo"> <view class="c-name"> <text>鐝骇鍚嶇О</text> - <t-input - value="{{className}}" - bindchange="onCourseNameInput" - borderless - clearable - placeholder="璇疯緭鍏ョ彮绾у悕绉�" - /> + <t-input value="{{className}}" bindchange="onCourseNameInput" borderless clearable placeholder="璇疯緭鍏ョ彮绾у悕绉�" /> </view> <view class="c-desc"> <text>鐝骇浜烘暟</text> - <t-input - value="{{count}}" - type="number" - bindchange="onCourseDescInput" - borderless - placeholder="璇疯緭鍏ョ彮绾т汉鏁�" - /> + <t-input value="{{count}}" type="number" bindchange="onCourseDescInput" borderless placeholder="璇疯緭鍏ョ彮绾т汉鏁�" /> </view> <view class="c-date"> <text>鐝骇鏈夋晥鏈�</text> <view class="dateBox"> <view> - <t-input - style="display:{{isShow}}" - value="{{startTime}}" - readonly - borderless - bindtap="openDateStart" - placeholder="璇烽�夋嫨寮�濮嬫椂闂�" - /> - <t-calendar - visible="{{visibleStart}}" - bind:confirm="handleConfirmStart" - /> + <t-input style="display:{{isShow}}" value="{{startTime}}" readonly borderless bindtap="openDateStart" placeholder="璇烽�夋嫨寮�濮嬫椂闂�" /> + <t-calendar visible="{{visibleStart}}" bind:confirm="handleConfirmStart" /> </view> <view>~</view> <view> - <t-input - value="{{endTime}}" - style="display:{{isShow}}" - readonly - borderless - bindtap="openDateEnd" - placeholder="璇烽�夋嫨缁撴潫鏃堕棿" - /> - <t-calendar - visible="{{visibleEnd}}" - bind:confirm="handleConfirmEnd" - /> + <t-input value="{{endTime}}" style="display:{{isShow}}" readonly borderless bindtap="openDateEnd" placeholder="璇烽�夋嫨缁撴潫鏃堕棿" /> + <t-calendar visible="{{visibleEnd}}" bind:confirm="handleConfirmEnd" /> </view> </view> </view> </view> <view class="classSubmit"> - <t-button - style="padding: 0 25px; margin: 0 15px" - size="small" - bindtap="cancle" - variant="outline" - >鍙栨秷</t-button - > - <t-button - style="padding: 0 25px; margin: 0" - size="small" - bindtap="submitClass" - >纭</t-button - > + <t-button style="padding: 0 25px; margin: 0 15px" size="small" bindtap="cancle" variant="outline">鍙栨秷</t-button> + <t-button style="padding: 0 25px; margin: 0" size="small" bindtap="submitClass">纭</t-button> </view> </view> </t-popup> - <t-dialog - visible="{{showContentOnly}}" - bind:confirm="closeDialog" - close-on-overlay-click - > - <view slot="content" class="reasonContent"> {{reason}} </view> + <t-dialog visible="{{showContentOnly}}" bind:confirm="closeDialog" close-on-overlay-click> + <scroll-view slot="content" type="list" scroll-y class="long-content"> + <view class="reasonContent"> + {{reason}} + </view> + </scroll-view> <view slot="confirm-btn" style="width: 100%"> - <t-button - style="color: #ff6d00; border-top: 1px solid #eee" - variant="text" - bindtap="closeDialog" - size="large" - block - t-class="external-class" - >鐭ラ亾浜�</t-button - > + <t-button style="color: #ff6d00; border-top: 1px solid #eee" variant="text" bindtap="closeDialog" size="large" block t-class="external-class">鐭ラ亾浜�</t-button> </view> </t-dialog> </view> </view> <view class="tabbar-bottom"> - <view - class="{{tabVal == 'base'?'tab-pubItem activeTab':'tab-pubItem'}}" - data-str="base" - bindtap="tabActive" - > + <view class="{{tabVal == 'base'?'tab-pubItem activeTab':'tab-pubItem'}}" data-str="base" bindtap="tabActive"> <t-icon class="tabIcon" name="home" size="24px" /> <text class="text">鍩烘湰淇℃伅</text> </view> - <view - class="{{tabVal == 'class'?'tab-pubItem activeTab':'tab-pubItem'}}" - data-str="class" - bindtap="tabActive" - > + <view class="{{tabVal == 'class'?'tab-pubItem activeTab':'tab-pubItem'}}" data-str="class" bindtap="tabActive"> <t-icon class="tabIcon" name="file-setting" size="24px" /> <text class="text">鐝骇绠$悊</text> </view> </view> -</view> +</view> \ No newline at end of file diff --git a/packageCourse/pages/course/detail/index.wxss b/packageCourse/pages/course/detail/index.wxss index 1c6380a..684e83f 100644 --- a/packageCourse/pages/course/detail/index.wxss +++ b/packageCourse/pages/course/detail/index.wxss @@ -57,7 +57,7 @@ .contentList { width: 100%; height: calc(100% - 55px); - padding: 5px 20rpx; + padding: 5px 10rpx; box-sizing: border-box; } @@ -136,6 +136,7 @@ color: #666; font-size: 26rpx; line-height: 44rpx; + max-height: 300rpx; } .external-class { @@ -227,10 +228,6 @@ color: #ff6d00; } -.contentList { - width: 100%; - height: calc(100% - 55px); -} .header { width: 100%; diff --git a/packageCourse/pages/course/index.wxml b/packageCourse/pages/course/index.wxml index 0261e09..b7d38db 100644 --- a/packageCourse/pages/course/index.wxml +++ b/packageCourse/pages/course/index.wxml @@ -32,9 +32,11 @@ <text> 鎷掔粷鍘熷洜锛�</text> <t-tag style="margin-left: 0;" bind:tap="showDialog" class="margin-16 replay" theme="danger">鐐瑰嚮鏌ョ湅</t-tag> <t-dialog visible="{{showContentOnly}}" bind:confirm="closeDialog" close-on-overlay-click> - <view slot="content" class="reasonContent"> - {{item.reason}} - </view> + <scroll-view slot="content" type="list" scroll-y class="long-content"> + <view class="reasonContent"> + {{item.reason}} + </view> + </scroll-view> <view slot="confirm-btn" style="width: 100%;"> <t-button style="color: #ff6d00;border-top: 1px solid #eee;" variant="text" bindtap="closeDialog" size="large" block t-class="external-class">鐭ラ亾浜�</t-button> </view> diff --git a/packageCourse/pages/course/index.wxss b/packageCourse/pages/course/index.wxss index 326ee90..97b3b35 100644 --- a/packageCourse/pages/course/index.wxss +++ b/packageCourse/pages/course/index.wxss @@ -85,6 +85,7 @@ color: #666; font-size: 26rpx; line-height: 44rpx; + max-height: 300rpx; } .external-class { @@ -363,4 +364,4 @@ display: flex; justify-content: flex-end; align-items: center; -} +} \ No newline at end of file -- Gitblit v1.9.1