pageList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div style="margin: 20px 0;">
  3. <div v-for="(item, index) in contents" :key="index">
  4. <div class="inside">
  5. <template v-if="item.type == 1">
  6. <div>{{ item.outerSystemName }}</div>
  7. </template>
  8. <template v-else>
  9. <div>{{ item.titles }}</div>
  10. <div class="classify">{{ item.category.join(" ") }}</div>
  11. <div>
  12. {{ item.summary }}
  13. </div>
  14. </template>
  15. <div class="flex-ac" :class="item.type == 2 && 'userinfo'">
  16. <div class="flex-ac" style="width: 50%;">
  17. <template v-if="item.type == 1">
  18. 位于: {{ item.outerContentName }}
  19. </template>
  20. <template v-else>
  21. <div><img style="width:24px;height:24px;" :src="item.authorHead ? ('/api/api-system/system/core/sysFile/previewFile?fileId='+item.authorHead) : header0"/></div>
  22. <div>{{ item.author }}</div>
  23. <div>{{ item.createTime }}</div>
  24. </template>
  25. </div>
  26. <div class="flex-ac" style="width: 50%;justify-content: flex-end;">
  27. <div class="button-style" @click="handleDelDataClick(index)">
  28. <span>移除</span>
  29. </div>
  30. <div v-if="index != (contents.length - 1)" class="button-style" @click="handleActionDataClick(index, 'down')">
  31. <span>下降</span>
  32. </div>
  33. <div v-if="index != 0" class="button-style" @click="handleActionDataClick(index, 'up')">
  34. <span>上升</span>
  35. </div>
  36. <div class="button-style" @click="handleLookDataClick(item)">
  37. <span>查看</span>
  38. </div>
  39. </div>
  40. </div>
  41. <template v-if="item.type == 2">
  42. <div class="other flex-ac">
  43. <div class="flex-ac">
  44. <img :src="lookTime"/>
  45. <span>{{ item.views }}</span>
  46. </div>
  47. <template v-if="item.attachmentType">
  48. <div class="flex-ac">
  49. <img :src="computedFile(item.attachmentType)"/>
  50. <span>{{ item.attachmentType }}</span>
  51. </div>
  52. </template>
  53. </div>
  54. </template>
  55. </div>
  56. <a-divider />
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. import header0 from '@/assets/img/header0.png'
  62. import header1 from '@/assets/img/header1.png'
  63. import fileType0 from '@/assets/img/fileType0.png'
  64. import fileType1 from '@/assets/img/fileType1.png'
  65. import fileType2 from '@/assets/img/fileType2.png'
  66. import fileType3 from '@/assets/img/fileType3.png'
  67. import fileType4 from '@/assets/img/fileType4.png'
  68. import lookTime from '@/assets/img/lookTime.png'
  69. import {mapState} from "vuex";
  70. export default {
  71. props: {
  72. contents: {
  73. type: Array,
  74. default: () => []
  75. }
  76. },
  77. created() {
  78. },
  79. computed: {
  80. ...mapState({
  81. user: (state) => state.appSetting.user,
  82. }),
  83. computedFile() {
  84. return function(type) {
  85. if(type.indexOf("pdf")>-1) {
  86. return this.fileType1
  87. } else if (type.indexOf("doc")>-1) {
  88. return this.fileType2
  89. } else if (type.indexOf("xls")>-1) {
  90. return this.fileType3
  91. } else if (type.indexOf("ppt")>-1) {
  92. return this.fileType4
  93. } else {
  94. return this.fileType0
  95. }
  96. }
  97. }
  98. },
  99. data() {
  100. return {
  101. header0,
  102. header1,
  103. lookTime,
  104. fileType0,
  105. fileType1,
  106. fileType2,
  107. fileType3,
  108. fileType4,
  109. typeArr:['pdf','word','excel','ppt','其他']
  110. }
  111. },
  112. created() {
  113. },
  114. methods: {
  115. // 移除
  116. handleDelDataClick(index){
  117. let that = this
  118. this.$confirm({
  119. title: '确认要移除这个学习内容吗?',
  120. content: '删除后将无法恢复数据,请慎重选择',
  121. centered: true,
  122. icon: 'info-circle',
  123. okText:'确定',
  124. cancelText: '取消',
  125. onOk() {
  126. that.$emit('delItem', index)
  127. },
  128. });
  129. },
  130. // 上升
  131. handleActionDataClick(index, action) {
  132. this.$emit('actionItem',{index, action})
  133. },
  134. // 查看
  135. handleLookDataClick(item) {
  136. if(item.type == 1) {
  137. window.open(item.outerAccessUrl)
  138. } else {
  139. // this.jump(item.knowledgeId)
  140. window.open(`knowledgeAddUpdate?pkId=${item.knowledgeId}&show=true`)
  141. }
  142. },
  143. jump(pkId){
  144. this.$router.push({
  145. path: '/knowledge/knowledgeAddUpdate',
  146. query: { pkId, show: true }
  147. })
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="less" scoped>
  153. .inside {
  154. >div {
  155. margin-bottom: 8px;
  156. }
  157. .classify {
  158. color: #aaa;
  159. }
  160. .userinfo {
  161. color: #aaa;
  162. >div:first-child {
  163. div {
  164. margin-right: 20px;
  165. }
  166. }
  167. }
  168. .other {
  169. color: #aaa;
  170. >div {
  171. margin-right: 20px;
  172. img {
  173. width:16px;
  174. height:16px;
  175. margin-right: 6px;
  176. }
  177. }
  178. }
  179. }
  180. .flex-ac {
  181. display: flex;
  182. align-items: center;
  183. }
  184. .button-style {
  185. color: #3294F7;
  186. margin-right: 30px;
  187. cursor: pointer;
  188. }
  189. </style>