<template>
  <div class="info-detail-container">
    <evaluation-title
      navBackButton
      :title="`${type}/${title}`"
      :navAction="closeDetail"
    ></evaluation-title>
    <el-card
      class="mt20"
      v-loading="loading"
      v-html="data.content"
      style="padding: 20px"
    />
  </div>
</template>
<script>
import * as career from "@/api/webApi/career-news";

export default {
  props: {
    type: {
      type: String | Number,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
    id: {
      type: String | Number,
      default: "",
    },
  },
  data() {
    return {
      loading: false,
      data: {},
    };
  },
  watch: {
    id(newVal, oldVal) {
      this.getDetail();
    },
  },
  created() {
    this.getDetail();
  },
  methods: {
    closeDetail() {
      this.$emit("close");
    },

    getDetail() {
      if (!this.id) return;
      this.loading = true;
      career.info({ id: this.id }).then((res) => {
        console.log("career news info res", res);
        if (res.code == 200 || res.code == 0) {
          this.data = res.data;
        } else {
          this.msgError(res.msg || "career news info 请求异常");
        }
        this.loading = false;
      });
    },
  },
};
</script>
<style lang="scss" scoped>
</style>