mykaoshi.vue 3.2 KB
<template>
  <div class="container">
    <div class="mykaoshitop flexone" v-if="show">
      <div class="tieziimg">
        <img :src="userinfo.avatar" alt="" />
      </div>
      <div class="tieziright">
        <div class="tiezirighttop flex">
          <div>
            <div class="tieziming">{{ userinfo.nickname }}</div>
          </div>

          <div>
            <div class="vipimg">
              <img src="../../../assets/vip_icon@2x.png" alt="" />
              <div class="vipname">{{ userinfo.level.name1 }}</div>
            </div>
          </div>
          <img
            src="../../../assets/banggong_icon@2x.png"
            class="banggongimg"
            alt=""
          />
          <img
            src="../../../assets/peisong_icon@2x.png"
            class="banggongimg"
            alt=""
          />
          <img
            src="../../../assets/yirenzheng_icon@2x.png"
            class="banggongimg"
            alt=""
          />
        </div>
        <div class="tiezibto flexone"></div>
      </div>
    </div>
    <div class="kaoshilist flextwo">
      <div
        class="homepageboxitem flexfour"
        v-for="(item, index) in questionlist"
        :key="index"
        @click="examinetext(item)"
      >
        <img :src="item.image" alt="" class="homepageitemimg" />
        <div class="homepageitemname">{{ item.name }}</div>
      </div>
    </div>
    <div class="kaoshirule">
      <div class="kaoshiruletitle">考试规则</div>
      <div class="kaoshiruletext">
        {{ rulecontent }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      rulecontent: '',//考试规则
      userinfo: '',
      show: false,
      questionlist: []
    }
  },
  created() {
    this.getuserinfo()
    this.getrulecontent();
    this.getquestionlist()
  },
  methods: {
    // 获取用户信息
    getuserinfo() {
      let that = this;
      var url = '/api/member/index';
      var params = {

      }
      console.log('7766554', params)
      that.$axios.post(url, params).then((res) => {
        console.log('用户信息', res);
        that.userinfo = res.data;
        setTimeout(function () {
          that.show = true
        }, 200)



      }).catch((err) => {
        console.log(err)

      })
    },
    // 获取问卷列表
    getquestionlist() {
      let that = this;
      var url = '/api/question/get_questionnaire';
      var params = {

      }
      console.log('7766554', params)
      that.$axios.post(url, params).then((res) => {
        console.log(res);
        that.questionlist = res.data

      }).catch((err) => {

      })
    },

    // 考试规则
    getrulecontent() {
      let that = this;
      var url = '/api/sundry/get_page';
      var params = {
        id: 5
      }
      console.log('7766554', params)
      that.$axios.post(url, params).then((res) => {
        console.log(res);
        that.rulecontent = res.data.content == null ? '' : res.data.content



      }).catch((err) => {
        console.log(err)

      })
    },
    //帮工考试
    examinetext(item) {
      this.$router.push({
        path: '/examinetext',
        query: { id: item.id }
      })

    },
  }
};
</script>

<style scoped>
@import "../../style/homepage.css";
</style>