Commit a008214a authored by lvtz's avatar lvtz

fix

parent baf06530
......@@ -456,34 +456,78 @@ Page({
});
},
kickOutStudent(e) {
var id = e.currentTarget.dataset.id;
var that = this;
let that = this;
const { id, index, bigindex } = e.currentTarget.dataset;
wx.showModal({
title: "提示",
content: "该学生将从此打卡活动活动中踢出,此次打卡记录也将会清除。",
content: "该学生将从此打卡活动中踢出,此次打卡记录也将会清除。",
confirmText: "踢出",
confirmColor: "#16B0FD",
success(res1) {
if (res1.confirm) {
deleteSubjectStudent({
id
}).then(res => {
const { code, data } = res;
if (code != 200) {
} else {
wx.showToast({
title: "移除成功",
icon: "success",
duration: 1000
});
that.setData({
studentPage: 1,
studentHasmore: true
});
that.getStudents("init");
wx.showModal({
title: "提示",
content: "该学生将从此打卡活动中踢出,是否要清除该学生在当前打卡的历史记录",
confirmText: "清除",
cancelText: "不清除",
confirmColor: "#FF3520",
success (res2) {
if (res2.confirm) {
// 清除
deleteSubjectStudent({
id,
type: 1
}).then(res => {
const { code, data } = res;
if (code != 200) {
} else {
wx.showToast({
title: "移除成功",
icon: "success",
duration: 1000
});
let studentList = that.data.studentList[bigindex].filter(ele => ele.id != id);
that.setData({
[`studentList[${bigindex}]`]: studentList
})
if (that.caculateArrLength(that.data.studentList) == 0) {
that.setData({
studentEmptyPage: true
});
}
}
});
} else if (res2.cancel){
// 不清除
deleteSubjectStudent({
id,
type: 2
}).then(res => {
const { code, data } = res;
if (code != 200) {
} else {
wx.showToast({
title: "移除成功",
icon: "success",
duration: 1000
});
let studentList = that.data.studentList[bigindex].filter(ele => ele.id != id);
that.setData({
[`studentList[${bigindex}]`]: studentList
})
if (that.caculateArrLength(that.data.studentList) == 0) {
that.setData({
studentEmptyPage: true
});
}
}
});
}
}
});
})
} else if (res1.cancel) {
console.log('取消1')
}
}
});
......
......@@ -17,15 +17,15 @@
<view class='list-wrap' hidden='{{currentTabsIndex != 0}}'>
<empty-content wx:if='{{studentEmptyPage}}' text="暂无打卡学生" emptyimg="common/empty/empty_no.png" />
<view wx:else class="list-box">
<block wx:for="{{studentList}}" wx:for-item="studentItem" wx:key="studentList">
<view class="list-item" wx:for="{{studentItem}}" wx:key="index" catchtap="toGrowth" data-id="{{item.school_student.id}}">
<block wx:for="{{studentList}}" wx:for-item="studentItem" wx:key="studentList" wx:for-index="bigindex">
<view class="list-item" wx:for="{{studentItem}}" wx:key="index" wx:for-index="index" catchtap="toGrowth" data-id="{{item.school_student.id}}">
<view class="left">
<image class="item-avatar" src="{{filter.imagify(item.avatar? item.avatar:item.school_student.avatar)}}" wx:if="{{item.avatar}}"></image>
<image class="item-avatar" src="{{imageRoot}}common/empty/avatar_user.png?{{imageVersion}}" wx:else></image>
<view class="info-box">
<view class="name-box">
<view class="item-name">{{item.school_student && item.school_student.nickname ? item.school_student.nickname: item.name }}</view>
<view class="item-opt" data-id="{{item.id}}" catchtap="kickOutStudent">踢出本次打卡</view>
<view class="item-opt" data-id="{{item.id}}" catchtap="kickOutStudent" data-index="{{index}}" data-bigindex="{{bigindex}}">踢出本次打卡</view>
</view>
<view class="item-textbox" wx:if="{{subject_type==3}}">
<text>已闯{{item.max_clock_count || 0}}关</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment