<template>
  <div id="corpInfo">
    <el-row v-if="corpInfo && corpInfo.id">
      <el-col>
        <el-image class="firmLogo" :src="corpInfo.logo_url"></el-image>
      </el-col>
      <el-col style="padding-bottom: 10px; border-bottom: 1px dashed #ddd;">
        <el-link :underline="false" @click="$router.push({ path: '/corp/detail', query: { id: corpInfo.id } })">
          <span style="font-size: 14px; color: #850000;">{{ corpInfo.corpname }}</span>
        </el-link>
      </el-col>
      <el-col class="right_Detail" style="padding-top: 10px;">
        <el-row>
          <el-col>
            <span>邮箱：{{ corpInfo.job_email }}</span>
          </el-col>
          <el-col>
            <span>地址：{{ corpInfo.address }}</span>
          </el-col>
          <el-col>
            <span>电话：{{ corpInfo.tel }}</span>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapActions, mapState } from 'vuex';
export default {
  name: 'corpInfo',
  props: {
    corpid: null,
  },
  components: {},
  data: () => ({
    corpInfo: {},
  }),
  created() {},
  computed: {},
  watch: {
    corpid: {
      handler(val) {
        this.search();
      },
    },
  },
  methods: {
    ...mapActions(['corpOperation']),
    async search() {
      if (!this.corpid) return;
      let corpid = this.corpid;
      let result = await this.corpOperation({ type: 'component', data: { corpid: corpid } });
      if (`${result.errcode}` === '0') {
        this.$set(this, 'corpInfo', result.data);
        this.$set(this.corpInfo, `id`, this.corpid);
      } else {
        this.$message.error(result.errmsg ? result.errmsg : 'error');
      }
    },
  },
};
</script>

<style lang="less" scoped></style>
