diff --git a/pages/Mystudent/addstu.vue b/pages/Mystudent/addstu.vue
index 215860d..89d0a64 100644
--- a/pages/Mystudent/addstu.vue
+++ b/pages/Mystudent/addstu.vue
@@ -1,27 +1,33 @@
-
+
-
+
-
+
-
+
-
- 李斯丹妮
+
+
- ID:3324
+ ID:{{item.id}}
@@ -30,9 +36,14 @@
-
+
+
+
+ 确定添加({{selectedIds.length}})
+
+
@@ -41,10 +52,13 @@
data() {
return {
bgc: {
- backgroundColor: "#transparent",
+ backgroundColor: "#F6F9FC",
},
checkindex: 1,
- stulist:[]
+ stulist:[],
+ searchKeyword:'',
+ orgstulist:[],
+ selectedIds: [],
}
},
onLoad(option) {
@@ -53,14 +67,81 @@
this.getallstu()
},
methods: {
+ addstu() {
+ let data = {
+ memberId: this.selectedIds[0],
+ // memberId: '1522',
+ roomId: this.classid
+ };
+
+ this.$u.post(`https://api.admin-v2.langsi.online/admin-api/classroom/members/add`, data).then(res => {
+ if (res.code === 0) {
+ this.$refs.uToast.show({
+ title: '添加成功',
+ type: 'success',
+ position:'top'
+ })
+ this.selectedIds=[]
+ this.fuwei()
+ }else{
+ this.$refs.uToast.show({
+ title: '添加失败',
+ type: 'error',
+ position:'top'
+
+ })
+ this.selectedIds=[]
+ this.fuwei()
+ }
+ });
+ },
+ toggleSelection(item) {
+ const selectedIndex = this.selectedIds.indexOf(item.id);
+
+ if (selectedIndex === -1) {
+ // If not selected, add to the array and apply the 'act1' class
+ this.selectedIds.push(item.id);
+ item.isSelected = true; // Add a property to the item to track selection
+ } else {
+ // If already selected, remove from the array and remove the 'act1' class
+ this.selectedIds.splice(selectedIndex, 1);
+ item.isSelected = false;
+ }
+ console.log(this.selectedIds,'selectedIdsselectedIdsselectedIds');
+ },
+ search() {
+ // 根据关键字过滤 this.classlist
+ if (this.searchKeyword !== '') {
+ const filteredList = JSON.parse(JSON.stringify(this.orgstulist)).filter(item => {
+ // 匹配 nickName 或者 id
+ return item.nickName.includes(this.searchKeyword) || item.id.toString().includes(this.searchKeyword);
+ });
+ // 更新 this.classlist 为过滤后的列表
+ this.stulist = filteredList;
+ } else {
+ this.fuwei();
+ }
+ },
+ fuwei() {
+
+ this.stulist = JSON.parse(JSON.stringify(this.orgstulist));
+ },
+ highlightSearch(name) {
+ // 使用正则表达式替换匹配到的 searchKeyword 为带有颜色的文字
+ if (this.searchKeyword) {
+ const regex = new RegExp(this.searchKeyword, 'gi');
+ return name.replace(regex, match => `${match}`);
+ }
+ return name;
+ },
getallstu(){
this.$u.get(`https://api.admin-v2.langsi.online/admin-api/v2/ybs-user/page`).then(res => {
if (res.code == 0) {
- this.stulist=res.data.list
- // this.classlist = res.data.list
- // this.isloding = false
+ this.stulist=res.data.list
+ this.orgstulist = JSON.parse(JSON.stringify(res.data.list));
+
}
})
@@ -203,5 +284,29 @@
border: 2rpx solid #2D7CE6;
}
}
+ .botbtn{
+ padding: 32rpx 32rpx 0 32rpx;
+ margin-left: -32rpx;
+ position: fixed;
+ bottom: 0;
+ width: 750rpx;
+ height: 200rpx;
+ background: #FFFFFF;
+ box-shadow: 0rpx -10rpx 16rpx 0rpx rgba(202,202,202,0.25);
+ border-radius: 40rpx 40rpx 0rpx 0rpx;
+ .btn{
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 28rpx;
+ font-family:'PingFang','PingFang';
+ font-weight: 800;
+ color: #FFFFFF;
+ width: 686rpx;
+ height: 80rpx;
+ background: linear-gradient(180deg, #74AFFF 0%, #2D7CE6 100%);
+ border-radius: 104rpx 104rpx 104rpx 104rpx;
+ }
+ }
}
\ No newline at end of file
diff --git a/pages/Mystudent/formstu.vue b/pages/Mystudent/formstu.vue
index 8a385f5..e174b40 100644
--- a/pages/Mystudent/formstu.vue
+++ b/pages/Mystudent/formstu.vue
@@ -20,9 +20,11 @@
+ v-model="searchKeyword"
+ placeholder="搜索相关内容..."
+ class="input"
+ placeholder-style="color:#C7CDD3"
+ @input="search()">
@@ -32,51 +34,17 @@
-
+
-
+
-
- 李斯丹妮
+
+
- ID:3324
-
-
-
-
-
-
- 平均成绩/分
-
-
- 6
-
-
-
-
- 作业完成度
-
-
- 80%
-
-
-
-
-
-
-
-
-
-
-
-
- 李斯丹妮
-
-
- ID:3324
+ ID:{{item.memberInfo.id}}
@@ -101,6 +69,7 @@
+