删除修改

This commit is contained in:
taoxu 2023-12-07 22:13:54 +08:00
parent 33f9ef440d
commit 317c54a1cf
4 changed files with 59 additions and 8 deletions

View File

@ -106,6 +106,12 @@ export default {
const filteredList = JSON.parse(JSON.stringify(this.changeclasslist)).filter(item => item.name.includes(this.searchKeyword)); const filteredList = JSON.parse(JSON.stringify(this.changeclasslist)).filter(item => item.name.includes(this.searchKeyword));
// this.classlist // this.classlist
this.classlist = filteredList; this.classlist = filteredList;
this.selectclass.forEach(selectedItem => {
const index = this.classlist.findIndex(item => item.id === selectedItem.id);
if (index !== -1) {
this.$set(this.classlist, index, { ...this.classlist[index], isSelected: true });
}
});
}else{ }else{
this.fuwei() this.fuwei()
} }
@ -122,6 +128,12 @@ export default {
fuwei() { fuwei() {
this.classlist = JSON.parse(JSON.stringify(this.changeclasslist)); this.classlist = JSON.parse(JSON.stringify(this.changeclasslist));
this.selectclass.forEach(selectedItem => {
const index = this.classlist.findIndex(item => item.id === selectedItem.id);
if (index !== -1) {
this.$set(this.classlist, index, { ...this.classlist[index], isSelected: true });
}
});
}, },
getclassList() { getclassList() {
this.$u.get("https://api.admin-v2.langsi.online/admin-api/classroom/page").then(res => { this.$u.get("https://api.admin-v2.langsi.online/admin-api/classroom/page").then(res => {

View File

@ -57,12 +57,27 @@
}, },
// token // token
getQiniuToken() { getQiniuToken() {
this.$u.get('https://v2.ielts.langsi.online/file/getToken').then(res => { wx.request({
console.log(res.data); url: 'https://v2.ielts.langsi.online/file/getToken',
this.token = res.data.token method: 'get', // Adjust the request method as needed
}).catch(err => { // data: yourData,
console.log(err) header: {
}) 'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJub3RfeWJzX3VzZXJfa2V5IjoiNWZiYzA4YmUtNDZlMi00NDUzLThmYjQtMjFlNzhjZDIxY2EyIn0.jw2fyMnlNEW-zx8cH6aPh_H-WqEAHDQdh4oCpYg3qBIJZEmw6L4oNWJPvKHM9edmRdLO0p2z7_vlCYoY00NqxA '
},
success: (res) => {
console.log(res);
this.token = res.data.data.token
},
fail: (err) => {
console.log(err);
}
});
// this.$u.get('https://v2.ielts.langsi.online/file/getToken').then(res => {
// console.log(res.data);
// this.token = res.data.token
// }).catch(err => {
// console.log(err)
// })
}, },
} }

View File

@ -111,6 +111,12 @@
}); });
// this.classlist // this.classlist
this.stulist = filteredList; this.stulist = filteredList;
this.selectedIds.forEach(selectedItem => {
const index = this.stulist.findIndex(item => item.id === selectedItem.id);
if (index !== -1) {
this.$set(this.stulist, index, { ...this.stulist[index], isSelected: true });
}
});
} else { } else {
this.fuwei(); this.fuwei();
} }
@ -118,6 +124,12 @@
fuwei() { fuwei() {
this.stulist = JSON.parse(JSON.stringify(this.orgstulist)); this.stulist = JSON.parse(JSON.stringify(this.orgstulist));
this.selectedIds.forEach(selectedItem => {
const index = this.stulist.findIndex(item => item.id === selectedItem.id);
if (index !== -1) {
this.$set(this.stulist, index, { ...this.stulist[index], isSelected: true });
}
});
}, },
highlightSearch(name) { highlightSearch(name) {
// 使 searchKeyword // 使 searchKeyword

View File

@ -31,7 +31,10 @@
<view class="class_bj"> <view class="class_bj">
<view class="class_images" > <view class="class_images" >
<view class="class_ys" v-for="(item,index) in classinfo" :key="index"> <view class="class_ys" v-for="(item,index) in classinfo" :key="index" style="position: relative;">
<view class="close" style="position: absolute;top: 0rpx;right: 8rpx;width: 20rpx;height: 20rpx;" @click="delcls(item.id)">
<image src="https://file.langsi.online/yasiimg/web/static/ueH3qwYazyVXmiYoVPJE" mode=""></image>
</view>
<view class="class_tp"> <view class="class_tp">
<image src="https://file.langsi.online/yasiimg/web/static/u4T48EWFfk5p6yrV3gOw" mode=""></image> <image src="https://file.langsi.online/yasiimg/web/static/u4T48EWFfk5p6yrV3gOw" mode=""></image>
</view> </view>
@ -62,7 +65,10 @@
</view> </view>
<view class="class_bj" > <view class="class_bj" >
<view class="class_images"> <view class="class_images">
<view class="class_ys" v-for="(item,index) in stuinfo" :key="index"> <view class="class_ys" v-for="(item,index) in stuinfo" :key="index" style="position: relative;">
<view class="close" style="position: absolute;top: 0rpx;right: 8rpx;width: 20rpx;height: 20rpx;" @click="delstu(item.id)">
<image src="https://file.langsi.online/yasiimg/web/static/ueH3qwYazyVXmiYoVPJE" mode=""></image>
</view>
<view class="class_tp"> <view class="class_tp">
<image :src="item.avatar" mode=""></image> <image :src="item.avatar" mode=""></image>
</view> </view>
@ -312,6 +318,12 @@
} }
}, },
methods:{ methods:{
delcls(id){
this.classinfo = this.classinfo.filter(item => item.id !== id);
},
delstu(id){
this.stuinfo = this.stuinfo.filter(item => item.id !== id);
},
toaddstu(){ toaddstu(){
uni.navigateTo({ uni.navigateTo({
url: "/pages_teacher/pages_add/add_studentsforwork?stuinfo=" + encodeURIComponent(JSON.stringify(this.stuinfo)) url: "/pages_teacher/pages_add/add_studentsforwork?stuinfo=" + encodeURIComponent(JSON.stringify(this.stuinfo))