<template>
  <div class="app-container">
    <!-- <resume-info v-if="isInit" /> -->
    <preview
      v-if="isInit"
      :isEN="isEN"
      :isAll="isAll"
      :reviewerId.sync="reviewerId"
      :trialId.sync="trialId"
    />
  </div>
</template>
<script>
import ResumeInfo from '@/views/resumeInfo'
import { changeURLStatic, getQueryString } from '@/utils/history.js'
import preview from '@/views/reviewers/curriculumVitae/preview.vue'
import store from '@/store'
import { mapMutations } from 'vuex'
export default {
  components: {
    ResumeInfo,
    preview,
  },
  data() {
    return {
      isInit: false,
      reviewerId: '',
      trialId: null,
      isAll: true,
    }
  },
  created() {
    this.reviewerId = this.$route.query.doctorId
    this.trialId = this.$route.query.trialId
  },
  computed: {
    isEN() {
      return this.$i18n.locale !== 'zh'
    },
    // isAll() {
    //   return this.hasPermi(['role:pm', 'role:admin', 'role:apm', 'role:ir'])
    // },
  },
  async mounted() {
    this.isAll = !this.$route.query.blindState
    const token = getQueryString('token')
    if (token) {
      store.dispatch('user/setToken', token)
      changeURLStatic('token', '')
      this.$i18n.locale =
        this.$route.query.lang || zzSessionStorage.getItem('lang')
      this.setLanguage(this.$i18n.locale)
      this.$updateDictionary()
    }
    this.isInit = true
  },
  methods: {
    ...mapMutations({ setLanguage: 'lang/setLanguage' }),
  },
}
</script>
<style lang="scss" scoped>
::v-deep .el-collapse-item__header {
  background-color: #e9eef1;
  padding: 0 10px;
}
</style>
