TaskTop.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="task-detail-top">
  3. <div class="title">
  4. <span class="title-name">{{ itemInfo.course_name }}</span>
  5. <span class="title-time">{{ itemInfo.cs_item_time }}</span>
  6. </div>
  7. <div class="cs_item_name">
  8. {{ itemInfo.cs_item_name }}
  9. </div>
  10. <div class="courseware-list">
  11. <template v-if="type === 'teacher'">
  12. <div class="task-name">{{ itemInfo.name }}</div>
  13. <div class="task-time">{{ itemInfo.time_space_view_txt }}</div>
  14. <div class="task-content">
  15. <span>任务说明</span>
  16. <!-- eslint-disable-next-line vue/no-v-html -->
  17. <span v-html="contentUrl"></span>
  18. </div>
  19. </template>
  20. <div class="courseware-list-title">
  21. {{ $t('Key309') }}
  22. </div>
  23. <el-tag
  24. v-for="item in itemInfo.courseware_list"
  25. :key="item.courseware_id"
  26. color="#fff"
  27. :title="item.courseware_name"
  28. >
  29. <div class="courseware">
  30. <svg-icon icon-class="courseware" />
  31. <router-link
  32. target="_blank"
  33. :to="{
  34. path: `/task_detail/show_courseware/${item.courseware_id}?group_id_selected_info=${
  35. item.group_id_selected_info ? item.group_id_selected_info : '[]'
  36. }`
  37. }"
  38. class="courseware_name nowrap-ellipsis"
  39. >
  40. {{ item.courseware_name }}
  41. </router-link>
  42. </div>
  43. </el-tag>
  44. </div>
  45. <div class="learning-material">
  46. <div class="learning-material-title">
  47. {{ $t('Key274') }}
  48. </div>
  49. <el-tag
  50. v-for="item in itemInfo.cs_item_learning_material_list"
  51. :key="item.file_id"
  52. color="#fff"
  53. :title="item.file_name"
  54. >
  55. <span @click="emitViewFile(item.file_name, item.file_id)">{{ item.file_name }}</span>
  56. </el-tag>
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. export default {
  62. props: {
  63. itemInfo: {
  64. type: Object,
  65. required: true
  66. },
  67. type: {
  68. type: String,
  69. required: true
  70. }
  71. },
  72. computed: {
  73. contentUrl() {
  74. const content = this.itemInfo.content;
  75. if (!content) return '';
  76. return content.replace(
  77. new RegExp(/(https?:\/\/[\w-]+\.[\w-]+\.[\w-,@?^=%&:/~\\+#]+)/, 'g'),
  78. '<a href="$1" target="_blank">$1</a>'
  79. );
  80. }
  81. },
  82. methods: {
  83. emitViewFile(fileName, fileId) {
  84. this.$emit('viewFile', fileName, fileId);
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .task-detail-top {
  91. padding: 24px 32px;
  92. background-color: #fff;
  93. border-radius: 8px;
  94. .title {
  95. display: flex;
  96. align-items: center;
  97. justify-content: space-between;
  98. &-name {
  99. font-size: 24px;
  100. font-weight: 700;
  101. }
  102. &-time {
  103. color: #737373;
  104. }
  105. }
  106. .cs_item_name {
  107. margin: 8px 0 24px;
  108. }
  109. .learning-material {
  110. margin-bottom: 16px;
  111. &-title {
  112. margin-bottom: 16px;
  113. font-size: 18px;
  114. }
  115. }
  116. .courseware-list {
  117. padding-top: 24px;
  118. margin-bottom: 16px;
  119. border-top: 1px solid #d9d9d9;
  120. .task-name {
  121. margin-bottom: 16px;
  122. font-size: 20px;
  123. font-weight: bold;
  124. }
  125. .task-time {
  126. margin-bottom: 16px;
  127. color: #969696;
  128. }
  129. .task-content {
  130. display: flex;
  131. column-gap: 40px;
  132. margin-bottom: 16px;
  133. white-space: pre-wrap;
  134. ::v-deep a {
  135. color: #18a0fb;
  136. }
  137. :first-child {
  138. min-width: 70px;
  139. }
  140. :last-child {
  141. word-break: break-all;
  142. }
  143. }
  144. &-title {
  145. margin-bottom: 16px;
  146. font-size: 18px;
  147. }
  148. .el-tag {
  149. cursor: pointer;
  150. .courseware {
  151. .svg-icon {
  152. margin-right: 12px;
  153. font-size: 18px;
  154. vertical-align: super;
  155. }
  156. &_name {
  157. display: inline-block;
  158. max-width: 120px;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. </style>