<template>
  <div class="book-preview">
    <ProjectMenu cur-key="book" />

    <CommonPreview ref="preview" :project-id="project_id" :is-show-audit="false" :is-book="true">
      <template #operator="{ courseware }">
        <span class="link">查看教材信息</span>
        <span v-if="isTrue(courseware.is_can_request_xiajia)" class="link">申请下架</span>
        <span class="link" @click="goBackToProjectList">返回教材列表</span>
      </template>
    </CommonPreview>
  </div>
</template>

<script>
import ProjectMenu from '@/views/project_manage/common/ProjectMenu.vue';
import CommonPreview from '@/components/CommonPreview.vue';

import { isTrue } from '@/utils/common';

export default {
  name: 'BookPreview',
  components: {
    ProjectMenu,
    CommonPreview,
  },
  data() {
    return {
      project_id: this.$route.params.projectId || '',
      isTrue,
    };
  },
  methods: {
    goBackToProjectList() {
      this.$router.push({ path: '/project_manage/book' });
    },
  },
};
</script>

<style lang="scss" scoped>
@use '@/styles/mixin.scss' as *;

.book-preview {
  @include page-content(true);
}
</style>
