index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="resource-container">
  3. <!-- <BreadCrumb /> -->
  4. <div class="resource">
  5. <VideoDetails :isState="isState" ref="VideoDetailsRef" @onGetPageCommentNew="onGetPageCommentNew" />
  6. <TallList ref="tallList" v-show="!isState" />
  7. </div>
  8. <div class="btn-group" v-if="isAudit && isState">
  9. <a-button @click="handleAuditResult(3)" style="margin-right: 10px">不同意</a-button>
  10. <a-button type="primary" @click="handleAuditResult(2)">同意</a-button>
  11. </div>
  12. <!-- <ResourceDetails v-if="indexType == 'resourceDetails'" ref="ResourceDetailsRef" /> -->
  13. </div>
  14. </template>
  15. <script setup>
  16. import VideoDetails from './components/VideoDetails.vue'
  17. import TallList from './components/TallList.vue'
  18. import { addViewCount, detail, add, queryList } from '@/api/portal'
  19. import resourceAuditApi from '@/api/resourceAudit.js'
  20. import { resourceAuditStore } from '@/store/resourceAudit'
  21. const auditStore = resourceAuditStore()
  22. const itemData = ref({})
  23. const tallList = ref(null)
  24. const VideoDetailsRef = ref(null)
  25. const emit = defineEmits(['auditComplete'])
  26. // 从store中获取参数,如果store中没有则从路由中获取
  27. const isState = ref(auditStore.auditParams.state || null)
  28. const isAudit = ref(auditStore.auditParams.audit || null)
  29. // {
  30. // "fileName": "Kettle文档",
  31. // "courseType": "0",
  32. // "courseTypeName": "必修",
  33. // "collegeAllId": "1938796923484962817,1938796975385280513,1938797957397676033",
  34. // "suffix": "doc",
  35. // "collegeTwoId": "1938796975385280513",
  36. // "verifyStatus": "2",
  37. // "collegeThreeIdName": "维修部",
  38. // "collegeThreeId": "1938797957397676033",
  39. // "collegeId": "1938796923484962817",
  40. // "resourceCreaterUserName": "超管",
  41. // "coverImage": "",
  42. // "coverImagePath": "",
  43. // "fileUrl": "upload/20250626/a37672e03659d06fa618842c9c443910.doc",
  44. // "courseIdName": "胸口碎大石2",
  45. // "id": "1938857816211292161",
  46. // "viewCount": 100,
  47. // "courseId": "1937326992873689091",
  48. // "collegeAllIdName": "汽车工程学院,汽车部门,维修部",
  49. // "FILESIZE": 1105920,
  50. // "majorId": "1",
  51. // "uploadTime": "2025-06-26 18:32:18",
  52. // "verifyStatusName": "已发布",
  53. // "resourceDesc": "大东北,是我的家乡,唢呐吹出了美美滴模样",
  54. // "collegeIdName": "汽车工程学院",
  55. // "majorIdName": "草台班子",
  56. // "collegeTwoIdName": "汽车部门",
  57. // "fileId": "1938183534250917888"
  58. // }
  59. const onGetPageCommentNew = (item) => {
  60. // emit('handlerItemSidebar', item)
  61. tallList.value.onGetPageCommentNew(item)
  62. }
  63. const handleAuditResult = (val) => {
  64. // 优先从store中获取ID,如果没有则从路由中获取
  65. const id = auditStore.auditParams.id
  66. const params = {
  67. ids: id,
  68. verifyStatus: val
  69. }
  70. resourceAuditApi
  71. .updateStatus(params)
  72. .then((res) => {
  73. if (res.code == 200) {
  74. // 清空store中的审核参数
  75. auditStore.clearAuditParams()
  76. emit('auditComplete')
  77. }
  78. })
  79. .catch((err) => {
  80. console.error(err)
  81. })
  82. }
  83. const setData = (item) => {
  84. // emit('handlerItemSidebar', item)
  85. getData(item)
  86. }
  87. const getData = (item) => {
  88. detail({ id: item.id })
  89. .then((res) => {
  90. if (res.code == 200) {
  91. itemData.value = res.data
  92. // VideoDetailsRef.value.setData(res.data)
  93. }
  94. })
  95. .catch((err) => {})
  96. }
  97. onMounted(() => {
  98. // 优先从store中获取ID,如果没有则从路由中获取
  99. const id = auditStore.auditParams.id
  100. if (id != undefined && id != '') {
  101. addViewCount({ id: id })
  102. getData({ id: id })
  103. }
  104. })
  105. defineExpose({
  106. setData
  107. })
  108. </script>
  109. <style lang="less" scoped>
  110. .resource-container {
  111. width: 100%;
  112. .resource {
  113. display: flex;
  114. justify-content: center;
  115. overflow: auto;
  116. width: 100%;
  117. }
  118. .btn-group {
  119. text-align: center;
  120. padding: 10px;
  121. }
  122. }
  123. </style>