|
@@ -11,7 +11,6 @@
|
|
|
<div
|
|
|
v-for="{ student_list, group_id, group_num, is_example } in gList[curPage]"
|
|
|
:key="group_id"
|
|
|
- :style="{}"
|
|
|
class="group-item"
|
|
|
>
|
|
|
<div class="group-item-title">
|
|
@@ -36,30 +35,10 @@
|
|
|
<span>{{ student_name }}</span>
|
|
|
</div>
|
|
|
<div class="student-item-right">
|
|
|
- <el-popover
|
|
|
- :disabled="showAdjustGroup"
|
|
|
- popper-class="student-item-operation"
|
|
|
- trigger="click"
|
|
|
- title="移动到..."
|
|
|
- placement="bottom"
|
|
|
- @hide="handlePopperHide"
|
|
|
- >
|
|
|
- <div class="adjust-group">
|
|
|
- <el-select v-model="adjustGroup">
|
|
|
- <el-option
|
|
|
- v-for="{ group_id: gId, group_name } in adjustGroupList"
|
|
|
- :key="gId"
|
|
|
- :label="group_name"
|
|
|
- :value="gId"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- <div class="operation-button">
|
|
|
- <el-button class="button-cancel" @click="adjustGroupCancel">取消</el-button>
|
|
|
- <el-button class="button-confirm">确定</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <svg-icon slot="reference" icon-class="live-mobile-grouping" />
|
|
|
- </el-popover>
|
|
|
+ <SinglePopover
|
|
|
+ :adjust-group-list="adjustGroupList"
|
|
|
+ :adjust-group="curry(adjustGroup)(student_id)(group_id)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -85,7 +64,12 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed, watch, nextTick } from 'vue';
|
|
|
+import { ref, computed, watch, inject } from 'vue';
|
|
|
+import { curry } from '@/utils/common';
|
|
|
+import { AdjustGroup } from '@/api/live';
|
|
|
+import { Loading, Message } from 'element-ui';
|
|
|
+
|
|
|
+import SinglePopover from './SinglePopover.vue';
|
|
|
|
|
|
const props = defineProps({
|
|
|
groupList: {
|
|
@@ -98,13 +82,14 @@ const props = defineProps({
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-defineEmits(['enterGroup']);
|
|
|
+const emits = defineEmits(['enterGroup', 'getGroupInfo']);
|
|
|
|
|
|
let curPage = ref(0);
|
|
|
function changePage(page) {
|
|
|
curPage.value = page;
|
|
|
}
|
|
|
|
|
|
+// 是否需要两行显示
|
|
|
let isTowLine = computed(() => {
|
|
|
const col = Math.floor((window.innerHeight - 192 - 204 - 68 - 4) / 44);
|
|
|
const col_2 = Math.floor((window.innerHeight - 192 - 204 - 68 - 8 - 100) / 44);
|
|
@@ -113,9 +98,10 @@ let isTowLine = computed(() => {
|
|
|
let groupSize = props.groupList[0]?.student_list.length;
|
|
|
let groupRowNum = Math.ceil(groupSize / col); // 每组需要分成几行
|
|
|
|
|
|
- return groupRowNum === 1 && col_2 / groupSize > 2 && groupNum > row; // 是否需要两行显示
|
|
|
+ return groupRowNum === 1 && col_2 / groupSize > 2 && groupNum > row;
|
|
|
});
|
|
|
|
|
|
+// 分组列表分页
|
|
|
let gList = computed(() => {
|
|
|
const col = Math.floor((window.innerHeight - 192 - 204 - 68 - 4) / 44);
|
|
|
const col_2 = Math.floor((window.innerHeight - 192 - 204 - 112 - 24 - 8) / 44);
|
|
@@ -145,18 +131,39 @@ watch(gList, (newVal) => {
|
|
|
if (curPage.value > newVal.length) curPage.value = newVal.length - 1;
|
|
|
});
|
|
|
|
|
|
-let adjustGroup = ref('');
|
|
|
+// 调整分组用列表
|
|
|
let adjustGroupList = computed(() => {
|
|
|
return props.groupList.map(({ group_id }, i) => {
|
|
|
return { group_id, group_name: `分组${i + 1}` };
|
|
|
});
|
|
|
});
|
|
|
-let showAdjustGroup = ref(false);
|
|
|
-function adjustGroupCancel() {
|
|
|
- // showAdjustGroup.value = true;
|
|
|
-}
|
|
|
-function handlePopperHide() {
|
|
|
- // showAdjustGroup.value = false;
|
|
|
+
|
|
|
+const task_id = inject('task_id');
|
|
|
+/**
|
|
|
+ * 调整分组
|
|
|
+ * @param {String} student_id 学员id
|
|
|
+ * @param {String} studentCurGroupId 学员当前分组id
|
|
|
+ * @param {String} group_id 调整到的分组id
|
|
|
+ */
|
|
|
+function adjustGroup(student_id, studentCurGroupId, group_id) {
|
|
|
+ if (studentCurGroupId === group_id) return Message.warning('学员已在该分组中');
|
|
|
+ let loadingInstance = Loading.service({ text: '调整分组中...', background: '#fff' });
|
|
|
+ AdjustGroup({
|
|
|
+ task_id,
|
|
|
+ student_list: [
|
|
|
+ {
|
|
|
+ student_id,
|
|
|
+ group_id
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ Message.success('调整分组成功');
|
|
|
+ emits('getGroupInfo');
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loadingInstance.close();
|
|
|
+ });
|
|
|
}
|
|
|
</script>
|
|
|
|