|  | @@ -1,14 +1,7 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div class="selectStudent">
 | 
	
		
			
				|  |  |      <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>
 | 
	
		
			
				|  |  |            <div @click="onSearch()">搜索</div>
 | 
	
		
			
				|  |  |          </template>
 | 
	
	
		
			
				|  | @@ -27,58 +20,25 @@
 | 
	
		
			
				|  |  |              />
 | 
	
		
			
				|  |  |            </template>
 | 
	
		
			
				|  |  |          </van-dropdown-item> -->
 | 
	
		
			
				|  |  | -        <van-dropdown-item
 | 
	
		
			
				|  |  | -          title="声部"
 | 
	
		
			
				|  |  | -          ref="dropdown"
 | 
	
		
			
				|  |  | -          @close="onOpenDropdown('dropdownDrop')"
 | 
	
		
			
				|  |  | -        >
 | 
	
		
			
				|  |  | +        <van-dropdown-item title="声部" ref="dropdown" @close="onOpenDropdown('dropdownDrop')">
 | 
	
		
			
				|  |  |            <template slot="default">
 | 
	
		
			
				|  |  | -            <DropSelect
 | 
	
		
			
				|  |  | -              :options="option2"
 | 
	
		
			
				|  |  | -              @onFilter="onFilter2"
 | 
	
		
			
				|  |  | -              ref="dropdownDrop"
 | 
	
		
			
				|  |  | -            />
 | 
	
		
			
				|  |  | +            <DropSelect :options="option2" @onFilter="onFilter2" ref="dropdownDrop" />
 | 
	
		
			
				|  |  |            </template>
 | 
	
		
			
				|  |  |          </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>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <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">
 | 
	
		
			
				|  |  |            <span>{{ stu.subjectName }}</span>
 | 
	
		
			
				|  |  |            <span style="margin-left: 10px"> {{ stu.phone }}</span>
 | 
	
		
			
				|  |  |          </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">
 | 
	
		
			
				|  |  | -          <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>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |        </van-cell>
 | 
	
	
		
			
				|  | @@ -87,13 +47,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <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-item>
 | 
	
		
			
				|  |  |            <template #title>
 | 
	
	
		
			
				|  | @@ -103,29 +57,13 @@
 | 
	
		
			
				|  |  |            <template slot="default">
 | 
	
		
			
				|  |  |              <div class="submit-bar-popup-title">已选学生</div>
 | 
	
		
			
				|  |  |              <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">
 | 
	
		
			
				|  |  |                    <span>{{ student.subjectName }}</span>
 | 
	
		
			
				|  |  |                    <span style="margin-left: 10px"> {{ student.phone }}</span>
 | 
	
		
			
				|  |  |                  </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-cell>
 | 
	
		
			
				|  |  |              </div>
 | 
	
	
		
			
				|  | @@ -137,12 +75,7 @@
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import {
 | 
	
		
			
				|  |  | -  getAllOrganization,
 | 
	
		
			
				|  |  | -  studentsFilter,
 | 
	
		
			
				|  |  | -  getStuSubject,
 | 
	
		
			
				|  |  | -  getActivityCourseTimeList,
 | 
	
		
			
				|  |  | -} from "./api";
 | 
	
		
			
				|  |  | +import { getAllOrganization, studentsFilter, getStuSubject, getActivityCourseTimeList } from "./api";
 | 
	
		
			
				|  |  |  import DropSelect from "./components/drop-select.vue";
 | 
	
		
			
				|  |  |  import MEmpty from "../../components/MEmpty.vue";
 | 
	
		
			
				|  |  |  import MHeader from "../../components/MHeader.vue";
 | 
	
	
		
			
				|  | @@ -217,12 +150,8 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      async getStudents() {
 | 
	
		
			
				|  |  |        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({
 | 
	
		
			
				|  |  |          categoryId: this.$route.query.categoryId,
 | 
	
	
		
			
				|  | @@ -233,10 +162,7 @@ export default {
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        if (res && res.data && Array.isArray(res.data)) {
 | 
	
		
			
				|  |  |          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.value = n.userId;
 | 
	
		
			
				|  |  |            return {
 | 
	
	
		
			
				|  | @@ -272,9 +198,7 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //选择学生
 | 
	
		
			
				|  |  |      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 (this.studentsData[index].checked) {
 | 
	
	
		
			
				|  | @@ -295,15 +219,11 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 删除已选学生
 | 
	
		
			
				|  |  |      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);
 | 
	
		
			
				|  |  |        this.selectStudents.splice(index, 1);
 | 
	
		
			
				|  |  |        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) {
 | 
	
		
			
				|  |  |            this.studentsData[studentIndex].checked = false;
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -313,7 +233,7 @@ export default {
 | 
	
		
			
				|  |  |      onSubmit() {
 | 
	
		
			
				|  |  |        // 下一步
 | 
	
		
			
				|  |  |        const studentNum = parseInt(this.$route.query.studentNum);
 | 
	
		
			
				|  |  | -      if (this.$store.state.activeCourse.name == "乐理课") {
 | 
	
		
			
				|  |  | +      if (this.$store.state.activeCourse.name == "小组课") {
 | 
	
		
			
				|  |  |          if (this.selectStudents.length > studentNum) {
 | 
	
		
			
				|  |  |            this.$toast("已到达该类型课程学生人数上限");
 | 
	
		
			
				|  |  |            return;
 | 
	
	
		
			
				|  | @@ -335,9 +255,9 @@ export default {
 | 
	
		
			
				|  |  |            subject.name = this.selectStudents[i].subjectName;
 | 
	
		
			
				|  |  |            continue;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // (乐理课)
 | 
	
		
			
				|  |  | -        if (this.$store.state.activeCourse.name == "乐理课") {
 | 
	
		
			
				|  |  | -          // 乐理课不做处理
 | 
	
		
			
				|  |  | +        // (小组课)
 | 
	
		
			
				|  |  | +        if (this.$store.state.activeCourse.name == "小组课") {
 | 
	
		
			
				|  |  | +          // 小组课不做处理
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |            if (subject.id != this.selectStudents[i].subjectId) {
 | 
	
		
			
				|  |  |              this.$toast("所选学生声部不一致");
 |