CourseSuggest.vue 11.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
<template>
  <!-- 选课建议 -->
  <div class="course_suggest">
    <Top :active="active"></Top>
    <div class="course_suggest_wrap">
      <h2>选课建议系统</h2>
      <div class="course_suggest_box">
        <!-- 导航栏 -->
        <div class="course_nav">
          <div
            class="nav_single"
            :class="{nav_bottom:isNav == index}"
            v-for="(item,index) in courseList"
            :key="index"
            @click="changeNav(index)"
            v-show="groupId == 1"
          >{{item}}</div>
          <div class="nav_single nav_bottom" v-show="groupId == 2">选课建议</div>
        </div>
        <!-- 选课建议 -->
        <div class="course_suggest_main" v-show="isNav == 0">
          <!-- 考试成绩 -->
          <div class="test_score">
            <h3>考试成绩</h3>
            <el-table
              :data="tableData"
              border
              style="width: 100%"
              :header-cell-style="changeHeader"
            >
              <el-table-column prop="name" label="科目" align="center"></el-table-column>
              <el-table-column prop="score" label="分数" align="center"></el-table-column>
              <el-table-column prop="date" label="时间" align="center"></el-table-column>
            </el-table>
          </div>
          <!-- 测评结果 -->
          <div class="course_result">
            <h3>测评结果</h3>
            <div class="course_result_box">
              <div class="course_res_top">多元性向潜能</div>
              <div class="course_res_bot no_mul" v-show="!resultList.average">暂未测评</div>
              <div class="course_res_bot" v-show="resultList.average">
                <div class="layout flex_row course_bottom">
                  <div class="result_l">结果分析</div>
                  <div
                    class="result_r"
                  >{{resultList.average+"%"}} 在多元性向潜能测评中,您超过了{{resultList.average+"%"}}的测评者</div>
                </div>
                <div class="layout flex_row course_bottom">
                  <div class="result_l">最高性向</div>
                  <div class="result_r">{{resultList.xx_highs}}</div>
                </div>
                <div class="layout flex_row course_bottom">
                  <div class="result_l">最低性向</div>
                  <div class="result_r">{{resultList.xx_lows}}</div>
                </div>
                <div class="layout flex_row course_bottom">
                  <div class="result_l">适合专业</div>
                  <div class="result_r">{{resultList.ss_profession}}</div>
                </div>
                <div class="layout flex_row">
                  <div class="result_l">学习风格</div>
                  <div class="result_r">{{resultList.fengge}}</div>
                </div>
              </div>
            </div>
          </div>
          <!-- 综合建议 -->
          <div class="multiple_suggest">
            <h3>综合建议</h3>
            <div class="multiple_content no_course" v-show="!resultList.average">暂无数据</div>
            <div class="multiple_content" v-show="resultList.average">
              你的多元性向潜能暨学习风格测验结果,显示你最高的性向为 {{resultList.xx_high}},是你较具有优势的部分,而你最低的性向为
              {{resultList.xx_low}},是你可以在加强的部分。因此建议你可以选择 {{resultList.zhuanye}}的学科类别方向努力。你的学习风格为
              {{resultList.fengge_result}},建议你可以使用适合你的学习方法和思考模式,以增进学习效率。
            </div>
          </div>
          <!-- 选课结果 -->
          <div class="multiple_suggest" v-show="groupId == 2">
            <h3>选课结果</h3>
            <div class="multiple_content no_course" v-show="parentView == 2">您的孩子暂未选课,请及时选课</div>
            <div class="multiple_content no_course" v-show="parentView == 0">该学校暂未开放选课请耐心等待</div>
            <div class="sbuject_choiced layout flex_row">
              <div
                v-show="parentView == 1"
                v-for="(item,index) in parentScore"
                :key="index"
                class="choiced_child"
                :class="{choiced_child_center:index == 1}"
              >{{item}}</div>
            </div>
          </div>
          <!-- 下一步 -->
          <div class="second_btn" @click="nextPage()" v-show="groupId == 1">下一步</div>
        </div>
        <!-- 选课意向 -->
        <div class="course_purpose" v-show="isNav == 1">
          <!-- 有选课 -->
          <div class="course_purpose_had" v-if="courseId">
            <div class="choice_tips">
              请选择一组
              <i class="choice_warn">(只能选择一次,请慎重选择)</i>
            </div>
            <div class="clearfix">
              <div
                class="layout flex_row align_center single_group"
                v-for="(item,index) in intentionList"
                :key="index"
                @click="choiceCourse(item)"
              >
                <div>
                  <img :src="item.is_choose?src2:src1" alt />
                </div>
                <div class="sbuject_choice layout flex_row">
                  <div
                    v-for="(items,index) in item.project_array"
                    :key="index"
                    :class="{sub_center:index == 1}"
                  >{{items}}</div>
                </div>
              </div>
            </div>
            <div class="second_btn have_btn" @click="submit()" v-show="isAllow != 0">提交</div>
          </div>
          <!-- 无选课 -->
          <div class="course_purpose_no" v-else>管理员后台未设置选课模式,请联系管理员</div>
        </div>
      </div>
    </div>
    <Bottom2></Bottom2>
  </div>
</template>
<script>
import Top from "../../common/Top";
import Bottom2 from "../../common/Bottom2";
import { post } from "@/api/http";
import { Notification } from "element-ui";
export default {
  data() {
    return {
      active: 2,
      isNav: 0,
      courseList: ["选课建议", "选课意向"],
      // 考试成绩
      tableData: [],
      // 选课结果
      resultList: [],
      // 选课意向
      intentionList: [],
      // 选课id
      courseId: "",
      // 是否可选课
      isAllow: "",
      isShow: false,
      // 选课
      src1: require("@/assets/img/9.png"),
      src2: require("@/assets/img/15.png"),
      // 选课套餐id
      courseMealId: "",
      parentScore: [],
      groupId: "",
      // 是否选课状态
      parentView: ""
    };
  },
  methods: {
    // 选课建议
    suggest() {
      let url = "/api/student/suggest";
      post(url).then(res => {
        // 考试成绩
        this.tableData = res.score_list;
        // 选课结果
        this.resultList = res.test_result;
        // 家长可看的选课结果
        this.parentScore = res.choose_subjects;
        this.parentView = res.choose_status;
      });
    },
    // 下一步
    nextPage() {
      this.isNav = 1;
      if (this.groupId == 1) {
        this.courseIntention();
      }
    },
    changeNav(index) {
      this.isNav = index;
      if (this.isNav == 1) {
        if (this.groupId == 1) {
          this.courseIntention();
        }
      }
    },
    // 选课意向
    courseIntention() {
      let url = "/api/student/yixiang";
      post(url).then(res => {
        this.intentionList = res.meal_list;
        this.courseId = res.mission_id;
        this.isAllow = res.is_allow;
      });
    },
    // 选课
    choiceCourse(item) {
      if (this.isAllow) {
        for (let obj of this.intentionList) {
          obj.is_choose = false;
        }
        item.is_choose = !item.is_choose;
        this.courseMealId = item.id;
      }
    },
    // 选课提交
    submit() {
      if (this.courseMealId) {
        let url = "/api/student/setUserMeal";
        let params = {
          id: this.courseId,
          project_meal_id: this.courseMealId
        };
        post(url, params).then(res => {
          localStorage.setItem("personalIndex", 3);
          Notification.info({
            title: "提示",
            message: "选择成功",
            duration: 1500
          });
          this.isAllow = 1;
          this.$router.push({ path: "/CourseSelect" });
        });
      } else {
        Notification.info({
          title: "提示",
          message: "请选择",
          duration: 1500
        });
      }
    },
    changeHeader({ row, rowIndex }) {
      if (rowIndex == 0) {
        return "background-color:#409eff!important;color:#fff!important;font-weight:400";
      }
    }
  },
  components: {
    Top,
    Bottom2
  },
  mounted() {
    this.groupId = localStorage.getItem("groupId");
    this.suggest();
  }
};
</script>
<style scoped>
@import "../../../style/btn.css";

.course_suggest {
  width: 100%;
  background-color: #f2f5fa;
}

.course_suggest_wrap {
  width: 1200px;
  margin: 0 auto;
  text-align: left;
}

h2 {
  color: #34485e;
  font-size: 20px;
  margin: 28px 0 20px 14px;
  position: relative;
}

h2::after {
  content: "";
  width: 4px;
  height: 14px;
  background-color: #409eff;
  border-radius: 2px;
  position: absolute;
  top: 7px;
  left: -14px;
}

.course_suggest_box {
  width: 1200px;
  background-color: #fff;
}

/* 导航栏 */
.course_nav {
  height: 66px;
  width: 100%;
  border-bottom: 1px solid #eee;
  line-height: 65px;
}

.nav_single {
  width: 98px;
  margin-left: 36px;
  float: left;
  color: #34485e;
  font-size: 16px;
  text-align: center;
}

.nav_bottom {
  border-bottom: 2px solid #409eff;
}

/* 因素 */
.course_suggest_main {
  padding: 28px 36px;
}

h3 {
  color: #5b5e63;
  font-size: 16px;
  text-align: left;
  margin-bottom: 20px;
}

.test_score,
.course_result,
.multiple_suggest {
  margin-bottom: 28px;
}

/* 选课结果 */
.course_res_top {
  height: 40px;
  background: #409eff;
  font-size: 14px;
  color: #fff;
  text-align: center;
  line-height: 40px;
  border-radius: 3px 3px 0 0;
}

.course_res_bot {
  border: 1px solid #eee;
  border-radius: 0 0 3px 3px;
  font-size: 14px;
  color: #34485e;
}

.result_l {
  padding: 20px 33px;
  border-right: 1px solid #eee;
}

.course_bottom {
  border-bottom: 1px solid #eee;
}

.result_r {
  padding: 20px 0;
  width: 1000px;
  text-align: center;
}

/* 综合建议 */
.multiple_content {
  font-size: 14px;
  color: #34485e;
  text-align: left;
}
/* 家长端 无选课 */
.no_course {
  color: #909399;
}
/* 下一步 */
.second_btn {
  margin-top: 53px;
}

/* 选课意向 */
.course_purpose {
  padding: 28px 52px;
  font-size: 14px;
  color: #8c9198;
  text-align: left;
}

.choice_tips {
  margin-bottom: 18px;
}

/* 未测评 */
.no_mul {
  padding: 22px 0;
  text-align: center;
  color: #909399;
}

/* 有选课 */
.single_group {
  width: 40%;
  margin-bottom: 40px;
  float: left;
}

.sbuject_choice {
  border: 1px solid #8c9198;
  margin-left: 28px;
}

.sbuject_choice div {
  padding: 11px 30px;
}
.choiced_child {
  padding: 11px 30px;
  border: 1px solid #8c9198;
}
.choiced_child_center {
  border-left: none;
  border-right: none;
}
.sub_center {
  border: 1px solid #8c9198;
  border-top: none;
  border-bottom: none;
}

.have_btn {
  margin-top: 200px;
}

.choice_warn {
  color: #f44a5e;
}

/* 无选课 */
.course_purpose_no {
  height: 631px;
  text-align: center;
  line-height: 631px;
  font-size: 16px;
  color: #bdc4ce;
}
</style>