|
@@ -1,14 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="selectStudent">
|
|
<div class="selectStudent">
|
|
<div class="selectStudentWrap">
|
|
<div class="selectStudentWrap">
|
|
- <van-search
|
|
|
|
- class="searchWrap"
|
|
|
|
- shape="round"
|
|
|
|
- show-action
|
|
|
|
- placeholder="学员姓名/编号/手机号"
|
|
|
|
- v-model="search"
|
|
|
|
- @search="onSearch()"
|
|
|
|
- >
|
|
|
|
|
|
+ <van-search class="searchWrap" shape="round" show-action placeholder="学员姓名/编号/手机号" v-model="search" @search="onSearch()">
|
|
<template #action>
|
|
<template #action>
|
|
<div @click="onSearch()">搜索</div>
|
|
<div @click="onSearch()">搜索</div>
|
|
</template>
|
|
</template>
|
|
@@ -27,58 +20,25 @@
|
|
/>
|
|
/>
|
|
</template>
|
|
</template>
|
|
</van-dropdown-item> -->
|
|
</van-dropdown-item> -->
|
|
- <van-dropdown-item
|
|
|
|
- title="声部"
|
|
|
|
- ref="dropdown"
|
|
|
|
- @close="onOpenDropdown('dropdownDrop')"
|
|
|
|
- >
|
|
|
|
|
|
+ <van-dropdown-item title="声部" ref="dropdown" @close="onOpenDropdown('dropdownDrop')">
|
|
<template slot="default">
|
|
<template slot="default">
|
|
- <DropSelect
|
|
|
|
- :options="option2"
|
|
|
|
- @onFilter="onFilter2"
|
|
|
|
- ref="dropdownDrop"
|
|
|
|
- />
|
|
|
|
|
|
+ <DropSelect :options="option2" @onFilter="onFilter2" ref="dropdownDrop" />
|
|
</template>
|
|
</template>
|
|
</van-dropdown-item>
|
|
</van-dropdown-item>
|
|
- <van-dropdown-item
|
|
|
|
- v-if="options3.length"
|
|
|
|
- v-model="value3"
|
|
|
|
- :options="options3"
|
|
|
|
- @change="getStudents"
|
|
|
|
- ></van-dropdown-item>
|
|
|
|
|
|
+ <van-dropdown-item v-if="options3.length" v-model="value3" :options="options3" @change="getStudents"></van-dropdown-item>
|
|
</van-dropdown-menu>
|
|
</van-dropdown-menu>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="students">
|
|
<div class="students">
|
|
- <van-cell
|
|
|
|
- v-for="(stu, index) in studentsData"
|
|
|
|
- :key="stu.value"
|
|
|
|
- :title="stu.text"
|
|
|
|
- :label="stu.subjectName"
|
|
|
|
- center
|
|
|
|
- clickable
|
|
|
|
- @click="onSelectStudent(index)"
|
|
|
|
- >
|
|
|
|
|
|
+ <van-cell v-for="(stu, index) in studentsData" :key="stu.value" :title="stu.text" :label="stu.subjectName" center clickable @click="onSelectStudent(index)">
|
|
<div slot="label">
|
|
<div slot="label">
|
|
<span>{{ stu.subjectName }}</span>
|
|
<span>{{ stu.subjectName }}</span>
|
|
<span style="margin-left: 10px"> {{ stu.phone }}</span>
|
|
<span style="margin-left: 10px"> {{ stu.phone }}</span>
|
|
</div>
|
|
</div>
|
|
- <img
|
|
|
|
- v-if="stu.avatar"
|
|
|
|
- slot="icon"
|
|
|
|
- class="stuAvatar"
|
|
|
|
- :src="stu.avatar"
|
|
|
|
- />
|
|
|
|
- <img
|
|
|
|
- v-else
|
|
|
|
- slot="icon"
|
|
|
|
- class="stuAvatar"
|
|
|
|
- src="@/assets/images/common/default_head_img.png"
|
|
|
|
- />
|
|
|
|
|
|
+ <img v-if="stu.avatar" slot="icon" class="stuAvatar" :src="stu.avatar" />
|
|
|
|
+ <img v-else slot="icon" class="stuAvatar" src="@/assets/images/common/default_head_img.png" />
|
|
<div class="students-right">
|
|
<div class="students-right">
|
|
- <span style="margin-left: auto; margin-right: 20px"
|
|
|
|
- >{{ stu.subCourseNum }}课时</span
|
|
|
|
- >
|
|
|
|
|
|
+ <span style="margin-left: auto; margin-right: 20px">{{ stu.subCourseNum }}课时</span>
|
|
<van-checkbox :value="stu.checked"></van-checkbox>
|
|
<van-checkbox :value="stu.checked"></van-checkbox>
|
|
</div>
|
|
</div>
|
|
</van-cell>
|
|
</van-cell>
|
|
@@ -87,13 +47,7 @@
|
|
|
|
|
|
<div style="height: 50px"></div>
|
|
<div style="height: 50px"></div>
|
|
|
|
|
|
- <van-submit-bar
|
|
|
|
- button-text="下一步"
|
|
|
|
- button-type="info"
|
|
|
|
- class="selectStudent-submit-bar"
|
|
|
|
- @submit="onSubmit"
|
|
|
|
- :disabled="!selectStudents.length"
|
|
|
|
- >
|
|
|
|
|
|
+ <van-submit-bar button-text="下一步" button-type="info" class="selectStudent-submit-bar" @submit="onSubmit" :disabled="!selectStudents.length">
|
|
<van-dropdown-menu active-color="#01C1B5" direction="up">
|
|
<van-dropdown-menu active-color="#01C1B5" direction="up">
|
|
<van-dropdown-item>
|
|
<van-dropdown-item>
|
|
<template #title>
|
|
<template #title>
|
|
@@ -103,29 +57,13 @@
|
|
<template slot="default">
|
|
<template slot="default">
|
|
<div class="submit-bar-popup-title">已选学生</div>
|
|
<div class="submit-bar-popup-title">已选学生</div>
|
|
<div class="students" style="padding: 0">
|
|
<div class="students" style="padding: 0">
|
|
- <van-cell
|
|
|
|
- v-for="student in selectStudents"
|
|
|
|
- :key="student.value"
|
|
|
|
- :title="student.text"
|
|
|
|
- :label="student.subjectName"
|
|
|
|
- center
|
|
|
|
- >
|
|
|
|
|
|
+ <van-cell v-for="student in selectStudents" :key="student.value" :title="student.text" :label="student.subjectName" center>
|
|
<div slot="label">
|
|
<div slot="label">
|
|
<span>{{ student.subjectName }}</span>
|
|
<span>{{ student.subjectName }}</span>
|
|
<span style="margin-left: 10px"> {{ student.phone }}</span>
|
|
<span style="margin-left: 10px"> {{ student.phone }}</span>
|
|
</div>
|
|
</div>
|
|
- <img
|
|
|
|
- v-if="student.avatar"
|
|
|
|
- slot="icon"
|
|
|
|
- class="stuAvatar"
|
|
|
|
- :src="student.avatar"
|
|
|
|
- />
|
|
|
|
- <img
|
|
|
|
- v-else
|
|
|
|
- slot="icon"
|
|
|
|
- class="stuAvatar"
|
|
|
|
- src="@/assets/images/common/default_head_img.png"
|
|
|
|
- />
|
|
|
|
|
|
+ <img v-if="student.avatar" slot="icon" class="stuAvatar" :src="student.avatar" />
|
|
|
|
+ <img v-else slot="icon" class="stuAvatar" src="@/assets/images/common/default_head_img.png" />
|
|
<van-icon name="clear" size="25" @click="onDelete(student)" />
|
|
<van-icon name="clear" size="25" @click="onDelete(student)" />
|
|
</van-cell>
|
|
</van-cell>
|
|
</div>
|
|
</div>
|
|
@@ -137,12 +75,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import {
|
|
|
|
- getAllOrganization,
|
|
|
|
- studentsFilter,
|
|
|
|
- getStuSubject,
|
|
|
|
- getActivityCourseTimeList,
|
|
|
|
-} from "./api";
|
|
|
|
|
|
+import { getAllOrganization, studentsFilter, getStuSubject, getActivityCourseTimeList } from "./api";
|
|
import DropSelect from "./components/drop-select.vue";
|
|
import DropSelect from "./components/drop-select.vue";
|
|
import MEmpty from "../../components/MEmpty.vue";
|
|
import MEmpty from "../../components/MEmpty.vue";
|
|
import MHeader from "../../components/MHeader.vue";
|
|
import MHeader from "../../components/MHeader.vue";
|
|
@@ -217,12 +150,8 @@ export default {
|
|
},
|
|
},
|
|
async getStudents() {
|
|
async getStudents() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
- const subjectIds = this.option2
|
|
|
|
- .map((n) => (n.checked ? n.value : undefined))
|
|
|
|
- .filter((n) => n);
|
|
|
|
- const organIds = this.option1
|
|
|
|
- .map((n) => (n.checked ? n.value : undefined))
|
|
|
|
- .filter((n) => n);
|
|
|
|
|
|
+ const subjectIds = this.option2.map((n) => (n.checked ? n.value : undefined)).filter((n) => n);
|
|
|
|
+ const organIds = this.option1.map((n) => (n.checked ? n.value : undefined)).filter((n) => n);
|
|
// 获取学员列表
|
|
// 获取学员列表
|
|
const res = await studentsFilter({
|
|
const res = await studentsFilter({
|
|
categoryId: this.$route.query.categoryId,
|
|
categoryId: this.$route.query.categoryId,
|
|
@@ -233,10 +162,7 @@ export default {
|
|
});
|
|
});
|
|
if (res && res.data && Array.isArray(res.data)) {
|
|
if (res && res.data && Array.isArray(res.data)) {
|
|
this.studentsData = res.data.map((n) => {
|
|
this.studentsData = res.data.map((n) => {
|
|
- n.checked =
|
|
|
|
- this.selectStudents.filter((s) => s.value == n.userId).length > 0
|
|
|
|
- ? true
|
|
|
|
- : false;
|
|
|
|
|
|
+ n.checked = this.selectStudents.filter((s) => s.value == n.userId).length > 0 ? true : false;
|
|
n.text = n.username;
|
|
n.text = n.username;
|
|
n.value = n.userId;
|
|
n.value = n.userId;
|
|
return {
|
|
return {
|
|
@@ -272,9 +198,7 @@ export default {
|
|
},
|
|
},
|
|
//选择学生
|
|
//选择学生
|
|
onSelectStudent(index) {
|
|
onSelectStudent(index) {
|
|
- const i = this.selectStudents.findIndex(
|
|
|
|
- (n) => n.value == this.studentsData[index].value
|
|
|
|
- );
|
|
|
|
|
|
+ const i = this.selectStudents.findIndex((n) => n.value == this.studentsData[index].value);
|
|
|
|
|
|
if (i > -1) {
|
|
if (i > -1) {
|
|
if (this.studentsData[index].checked) {
|
|
if (this.studentsData[index].checked) {
|
|
@@ -295,15 +219,11 @@ export default {
|
|
},
|
|
},
|
|
// 删除已选学生
|
|
// 删除已选学生
|
|
onDelete(student) {
|
|
onDelete(student) {
|
|
- const index = this.selectStudents.findIndex(
|
|
|
|
- (n) => n.value == student.value
|
|
|
|
- );
|
|
|
|
|
|
+ const index = this.selectStudents.findIndex((n) => n.value == student.value);
|
|
const stu = this.selectStudents.find((n) => n.value == student.value);
|
|
const stu = this.selectStudents.find((n) => n.value == student.value);
|
|
this.selectStudents.splice(index, 1);
|
|
this.selectStudents.splice(index, 1);
|
|
if (stu) {
|
|
if (stu) {
|
|
- const studentIndex = this.studentsData.findIndex(
|
|
|
|
- (n) => n.value == student.value
|
|
|
|
- );
|
|
|
|
|
|
+ const studentIndex = this.studentsData.findIndex((n) => n.value == student.value);
|
|
if (studentIndex > -1) {
|
|
if (studentIndex > -1) {
|
|
this.studentsData[studentIndex].checked = false;
|
|
this.studentsData[studentIndex].checked = false;
|
|
}
|
|
}
|
|
@@ -313,7 +233,7 @@ export default {
|
|
onSubmit() {
|
|
onSubmit() {
|
|
// 下一步
|
|
// 下一步
|
|
const studentNum = parseInt(this.$route.query.studentNum);
|
|
const studentNum = parseInt(this.$route.query.studentNum);
|
|
- if (this.$store.state.activeCourse.name == "乐理课") {
|
|
|
|
|
|
+ if (this.$store.state.activeCourse.name == "小组课") {
|
|
if (this.selectStudents.length > studentNum) {
|
|
if (this.selectStudents.length > studentNum) {
|
|
this.$toast("已到达该类型课程学生人数上限");
|
|
this.$toast("已到达该类型课程学生人数上限");
|
|
return;
|
|
return;
|
|
@@ -335,9 +255,9 @@ export default {
|
|
subject.name = this.selectStudents[i].subjectName;
|
|
subject.name = this.selectStudents[i].subjectName;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- // (乐理课)
|
|
|
|
- if (this.$store.state.activeCourse.name == "乐理课") {
|
|
|
|
- // 乐理课不做处理
|
|
|
|
|
|
+ // (小组课)
|
|
|
|
+ if (this.$store.state.activeCourse.name == "小组课") {
|
|
|
|
+ // 小组课不做处理
|
|
} else {
|
|
} else {
|
|
if (subject.id != this.selectStudents[i].subjectId) {
|
|
if (subject.id != this.selectStudents[i].subjectId) {
|
|
this.$toast("所选学生声部不一致");
|
|
this.$toast("所选学生声部不一致");
|