TaskTop.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. name: 'TaskTop'
  63. };
  64. </script>
  65. <script setup>
  66. import { computed } from 'vue';
  67. const props = defineProps({
  68. itemInfo: {
  69. type: Object,
  70. required: true
  71. },
  72. type: {
  73. type: String,
  74. required: true
  75. }
  76. });
  77. let contentUrl = computed(() => {
  78. const content = props.itemInfo.content;
  79. if (!content) return '';
  80. return content.replace(
  81. new RegExp(/(https?:\/\/[\w-]+\.[\w-]+\.[\w-,@?^=%&:/~\\+#]+)/, 'g'),
  82. '<a href="$1" target="_blank">$1</a>'
  83. );
  84. });
  85. const emits = defineEmits(['viewFile']);
  86. function emitViewFile(fileName, fileId) {
  87. emits('viewFile', fileName, fileId);
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .task-detail-top {
  92. padding: 24px 32px;
  93. background-color: #fff;
  94. border-radius: 8px;
  95. .title {
  96. display: flex;
  97. align-items: center;
  98. justify-content: space-between;
  99. &-name {
  100. font-size: 24px;
  101. font-weight: 700;
  102. }
  103. &-time {
  104. color: #737373;
  105. }
  106. }
  107. .cs_item_name {
  108. margin: 8px 0 24px;
  109. }
  110. .learning-material {
  111. margin-bottom: 16px;
  112. &-title {
  113. margin-bottom: 16px;
  114. font-size: 18px;
  115. }
  116. }
  117. .courseware-list {
  118. padding-top: 24px;
  119. margin-bottom: 16px;
  120. border-top: 1px solid #d9d9d9;
  121. .task-name {
  122. margin-bottom: 16px;
  123. font-size: 20px;
  124. font-weight: bold;
  125. }
  126. .task-time {
  127. margin-bottom: 16px;
  128. color: #969696;
  129. }
  130. .task-content {
  131. display: flex;
  132. column-gap: 40px;
  133. margin-bottom: 16px;
  134. white-space: pre-wrap;
  135. :deep a {
  136. color: #18a0fb;
  137. }
  138. :first-child {
  139. min-width: 70px;
  140. }
  141. :last-child {
  142. word-break: break-all;
  143. }
  144. }
  145. &-title {
  146. margin-bottom: 16px;
  147. font-size: 18px;
  148. }
  149. .el-tag {
  150. cursor: pointer;
  151. .courseware {
  152. .svg-icon {
  153. margin-right: 12px;
  154. font-size: 18px;
  155. vertical-align: super;
  156. }
  157. &_name {
  158. display: inline-block;
  159. max-width: 120px;
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>