OrgFinalPreview.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="org-final-preview">
  3. <ProjectMenu cur-key="org/final" />
  4. <CommonPreview ref="preview" :project-id="project_id">
  5. <template #operator="{ courseware }">
  6. <span class="link">查看项目信息</span>
  7. <span class="link">查看教材信息</span>
  8. <span v-if="isTrue(courseware.is_can_shangjia_book)" class="link" @click="openConfirmBookDialog">上架</span>
  9. <span v-if="isTrue(courseware.is_can_rollback_project)" class="link" @click="rollbackProject">退改</span>
  10. <span class="link" @click="goBackBookList">返回项目列表</span>
  11. </template>
  12. </CommonPreview>
  13. <ConfirmBookInfo :project-id="project_id" :visible.sync="visible" @confirm="shangjiaBook" />
  14. </div>
  15. </template>
  16. <script>
  17. import ProjectMenu from '@/views/project_manage/common/ProjectMenu.vue';
  18. import CommonPreview from '@/components/CommonPreview.vue';
  19. import ConfirmBookInfo from './components/ConfirmBookInfo.vue';
  20. import { isTrue } from '@/utils/common';
  21. import { ShangjiaBook, RollbackProject } from '@/api/project';
  22. export default {
  23. name: 'OrgFinalPreview',
  24. components: {
  25. ProjectMenu,
  26. CommonPreview,
  27. ConfirmBookInfo,
  28. },
  29. data() {
  30. return {
  31. project_id: this.$route.params.projectId || '',
  32. isTrue,
  33. visible: false,
  34. };
  35. },
  36. methods: {
  37. openConfirmBookDialog() {
  38. this.visible = true;
  39. },
  40. shangjiaBook() {
  41. const loading = this.$loading('正在上架教材,请稍等...');
  42. ShangjiaBook({ project_id: this.project_id })
  43. .then(() => {
  44. this.$message.success('上架成功');
  45. this.$refs.preview.getProjectBaseInfo();
  46. })
  47. .finally(() => {
  48. loading.close();
  49. this.visible = false;
  50. });
  51. },
  52. rollbackProject() {
  53. this.$confirm('确定要退改吗?', '提示', {
  54. confirmButtonText: '确定',
  55. cancelButtonText: '取消',
  56. type: 'warning',
  57. })
  58. .then(() => {
  59. RollbackProject({ project_id: this.project_id }).then(() => {
  60. this.$message.success('退改成功');
  61. this.$refs.preview.getProjectBaseInfo();
  62. });
  63. })
  64. .catch(() => {});
  65. },
  66. goBackBookList() {
  67. this.$router.push({ path: '/project_manage/org/final' });
  68. },
  69. },
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. @use '@/styles/mixin.scss' as *;
  74. .org-final-preview {
  75. @include page-content(true);
  76. }
  77. </style>