docContent.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <div>
  3. <page-header
  4. :loading="loadingDocContent"
  5. :routes="[
  6. { name: '文档作业', path: 'document' },
  7. {
  8. name: `作业详情`,
  9. path: `document/${docId}`
  10. },
  11. { name: `文档内容`, path: `${$route.path}` }
  12. ]"
  13. >
  14. <template slot="title">
  15. 文档内容
  16. </template>
  17. <template slot="content">
  18. 题目名称:{{ contentResult.name }} <br />
  19. <br />
  20. 小组成员:<span
  21. v-for="member in contentResult.group.members"
  22. :key="member.id"
  23. >{{ member.username }}&emsp;</span
  24. >
  25. </template>
  26. <template slot="extraContent">
  27. 上次修改时间:{{ displayUnixTime(contentResult.lastUpdateAt) }}
  28. </template>
  29. </page-header>
  30. <page-body>
  31. <div class="data-table">
  32. <page-section-loading :show="loadingDocContent" />
  33. <div v-if="!loadingDocContent" class="page-section">
  34. <div v-if="contentResult.content" class="content">
  35. <vue-markdown>{{ contentResult.content }}</vue-markdown>
  36. </div>
  37. </div>
  38. </div>
  39. </page-body>
  40. </div>
  41. </template>
  42. <script>
  43. import PageHeader from "@/components/PageHeader";
  44. import PageBody from "@/components/PageBody/index";
  45. import { getDocContentByDocId } from "@/api/assignment";
  46. import VueMarkdown from "vue-markdown";
  47. import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
  48. import timeMixins from "@/mixins/time";
  49. export default {
  50. mixins: [timeMixins],
  51. components: {
  52. PageBody,
  53. PageHeader,
  54. VueMarkdown,
  55. PageSectionLoading
  56. },
  57. data() {
  58. return {
  59. docId: null,
  60. contentResult: {
  61. content: "",
  62. group: "",
  63. lastUpdateAt: "",
  64. name: ""
  65. },
  66. loadingDocContent: false
  67. };
  68. },
  69. created() {
  70. this.docId = this.$route.query.assignId;
  71. },
  72. mounted() {
  73. this.loadingDocContent = true;
  74. getDocContentByDocId(this.docId).then(res => {
  75. this.contentResult = res.data;
  76. this.loadingDocContent = false;
  77. });
  78. }
  79. };
  80. </script>
  81. <style lang="scss" scoped>
  82. @import "../../../assets/scss/app";
  83. .right-part {
  84. margin-bottom: -1.5rem;
  85. margin-right: -1.5rem;
  86. background: white;
  87. border-top: 1px solid #eff2f7;
  88. position: sticky;
  89. top: 0;
  90. max-height: 100vh;
  91. overflow-y: auto;
  92. box-shadow: $default-shadow;
  93. }
  94. .action-button {
  95. width: 100%;
  96. border-radius: 0;
  97. }
  98. </style>