EvaluteManage.vue 5.7 KB
<template>
  <!-- 个人中心 测评管理 -->
  <div class="personal_manage">
    <div class="test_content clearfix" v-if="timeList.length>0">
      <!-- 测评时间 -->
      <div class="test_time">
        <div
          class="test_year"
          v-for="item in timeList"
          :key="item.id"
          :class="{test_border:isBorder == item.id}"
          @click="changeBorder(item.id)"
        >
          <p class="test_det_year">{{item.year}} {{item.group}}</p>
          <p class="test_det_term">{{item.term}}</p>
        </div>
      </div>
      <!-- 具体内容 -->
      <div class="test_det clearfix">
        <div class="test_det_list clearfix" v-for="item in testList" :key="item.id">
          <!-- 测评类型 -->
          <div class="test_style clearfix">
            <div class="test_style_l">
              <div class="test_interest">
                <p>{{item.test_category == 'interest'?"兴趣测评":"多元性向GS"}}</p>
                <p>{{item.title}}</p>
              </div>
              <div class="test_start_end">
                <p>开始时间:{{item.starttime}}</p>
                <p>结束时间:{{item.endtime}}</p>
              </div>
            </div>
          </div>
          <!-- 测评说明 -->
          <div class="test_induction clearfix">
            <!-- 左侧 -->
            <div class="test_induction_l">
              <div class="test_l_title">测评说明:</div>
              <div class="test_l_content">{{item.text}}</div>
            </div>

            <!-- 右侧 -->
            <div class="test_induction_r layout align_center justify_center">
              <div
                v-show="groupId == 1"
                class="test_btn"
                :class="{test_btned:item.button_status != 2}"
                @click="toInduction(item)"
              >{{item.button_status == 1?"查看报告":item.button_status == 2?"开始测评":item.button_status == 3?"已过期":"未开始"}}</div>
              <div
                v-show="groupId == 2"
                class="test_no"
                :class="{test_parent:item.status == 1}"
                @click="toInduction(item)"
              >{{item.status == 1?"查看报告":"未测评"}}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 暂无测评 -->
      <div class="no_test_lis" v-else>
        暂无测评
      </div>
  </div>
</template>
<script>
import { post } from "@/api/http";
import { Notification } from "element-ui";
export default {
  data() {
    return {
      timeList: [],
      isBorder: 2,
      testList: [],
      groupId:"",
    };
  },
  methods: {
    // 学期列表
    changeBorder: function(id) {
      this.isBorder = id;
      this.getTestList(id);
    },
    // 施测说明 查看报告
    toInduction: function(item) {
      // 测评id
      localStorage.setItem("evaluteId", item.id);
      // 学生
      if (this.groupId == 1) {
        if (item.button_status == 1) {
          if (item.is_to_show_student == 1) {
            // 查看报告
            if (item.test_category == "interest") {
              // 兴趣测评报告
              this.$router.push({
                path: "/AssessmentReport",
                query: { testId: item.test_student_id }
              });
            } else if (item.test_category == "pluralistic") {
              // 多元测评报告
              this.$router.push({ path: "/MulReport" });
            }
          } else {
            Notification.info({
              title: "提示",
              message: "无查看权限",
              duration: 1500
            });
          }
        } else if (item.button_status == 2) {
          if (item.test_category == "interest") {
            // 兴趣测评
            this.$router.push({ path: "/Inducte" });
          } else if (item.test_category == "pluralistic") {
            // 多元性向测评
            this.$router.push({ path: "/MulAgreement" });
          }
        }
      } else if (this.groupId == 2) {
        // 家长
        // 查看报告
        if (item.status == 1) {
          if (item.test_category == "interest") {
            // 兴趣测评报告
            this.$router.push({
              path: "/AssessmentReport",
              query: { testId: item.test_student_id }
            });
          } else if (item.test_category == "pluralistic") {
            // 多元测评报告
            this.$router.push({ path: "/MulReport" });
          }
        }
      }
    },
    // 获取学期列表
    getTermList: function() {
      let url = "/api/test/getTermList";
      post(url)
        .then(res => {
          this.timeList = res;
          for(let obj of res){
            if(obj.this_term == 1){
              this.isBorder = obj.id;
              this.getTestList(obj.id);
            }
          }
          // 学校id
          localStorage.setItem("schoolId", res[0].school_id);
          // 学期id
          localStorage.setItem("termId", res[0].id);
          for (var obj of this.timeList) {
            if (obj.term == "first") {
              obj.term = "第一学期";
            } else if (obj.term == "second") {
              obj.term = "第二学期";
            }
          }
        })
        .catch(err => {
          console.log("err=" + err);
        });
    },
    // 测评列表
    getTestList: function(id) {
      let url = "/api/test/getTestList";
      let params = {
        id: id
      };
      post(url, params).then(res => {
        this.testList = res;
      });
    }
  },
  mounted() {
    this.getTermList();
    this.groupId = localStorage.getItem("groupId")
  }
};
</script>
<style scoped>
@import "../../../style/evaluteManage.css";
/* 暂无测评 */
.no_test_lis{
  font-size: 16px;
  font-weight: bold;
  color: #34485e;
  margin:100px auto;
}
</style>