listViewStudyDetailCourseView.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <a-modal v-model:visible="visible" width="600" @ok="handleOk" title="视频访问" :footer="null">
  3. <a-table
  4. ref="table"
  5. :columns="columns"
  6. :data-source="dataSources"
  7. :row-key="(record) => record.courseId"
  8. bordered
  9. :expand-row-by-click="true"
  10. :pagination="false"
  11. size="small"
  12. >
  13. <template #bodyCell="{ column, text, record }">
  14. <!-- <template v-if="column.dataIndex === 'createTime'">-->
  15. <!-- <span>{{ formatDateTime(record.createTime) }}</span>-->
  16. <!-- </template>-->
  17. <!-- <template v-if="column.dataIndex === 'action'">-->
  18. <!-- &lt;!&ndash; <a-button size="small" @click="handleDetail(record)" style="margin-right: 5px">详情</a-button>&ndash;&gt;-->
  19. <!-- &lt;!&ndash; <a-button size="small" @click="handleEdit(record)" style="margin-right: 5px">编辑</a-button>&ndash;&gt;-->
  20. <!-- <a-popover v-model:visible="popoverVisibles[record.collegeId]" title="确定删除?" trigger="click">-->
  21. <!-- <template #content>-->
  22. <!-- <a-button style="margin-right: 10px" type="primary" @click="handleShelf(record,1)">确定-->
  23. <!-- </a-button>-->
  24. <!-- <a-button @click="()=>{ popoverVisibles[record.collegeId] = false}">取消</a-button>-->
  25. <!-- </template>-->
  26. <!-- &lt;!&ndash; <a-button size="small" style="margin-right: 5px">选择</a-button>&ndash;&gt;-->
  27. <!-- <a-button size="small" @click="handleDelete(record)" style="margin-right: 5px">删除</a-button>-->
  28. <!-- </a-popover>-->
  29. <!-- </template>-->
  30. </template>
  31. </a-table>
  32. <div style="display: flex; width: 100%; justify-content: flex-end; margin-top: 10px">
  33. <a-pagination
  34. v-model:current="pagination.current"
  35. v-model:pageSize="pagination.size"
  36. :total="total"
  37. show-less-items
  38. @change="handlerChange"
  39. />
  40. </div>
  41. </a-modal>
  42. </template>
  43. <script setup>
  44. import tool from '@/utils/tool'
  45. import {ref, onMounted} from 'vue'
  46. import {useRouter} from 'vue-router'
  47. import {parseTime} from "@/utils/exam";
  48. const router = useRouter()
  49. import { overviewLearningProgressApi } from '@/api/statisticalAnalysis/overviewLearningProgress'
  50. const emit = defineEmits(['handleEdit'])
  51. //发布按钮状态
  52. const releaseVisible = ref(false)
  53. const loading = ref(false) // 列表loading
  54. const dataSources = ref([])
  55. const popoverVisible = ref({})
  56. const popoverVisibles = ref({})
  57. const courseId = ref(null)
  58. const visible = ref(false)
  59. const formState = ref({
  60. name: '',
  61. loacl: ''
  62. }) // 列表loading
  63. const columns = [
  64. {
  65. title: '课程课时名称',
  66. dataIndex: 'courseHourName',
  67. // sorter: true,
  68. width: '15%'
  69. },
  70. {
  71. title: '学生名称',
  72. dataIndex: 'userName',
  73. // sorter: true,
  74. width: '15%'
  75. },
  76. {
  77. title: '观看次数',
  78. dataIndex: 'viewCount',
  79. // sorter: true,
  80. width: '15%'
  81. },
  82. {
  83. title: '课时id',
  84. dataIndex: 'hourId',
  85. // sorter: true,
  86. width: '15%'
  87. },
  88. {
  89. title: '学生id',
  90. dataIndex: 'userId',
  91. // sorter: true,
  92. width: '15%'
  93. },
  94. {
  95. title: '创建日期',
  96. dataIndex: 'createDate',
  97. // sorter: true,
  98. width: '12%'
  99. },
  100. ]
  101. // tool.formatTimestamp()
  102. const formatDateTime = (val) => {
  103. if (!val) return ''
  104. return parseTime(val, '{y}-{m}-{d} {h}:{i}:{s}')
  105. }
  106. const formatTimestamp = (time) => {
  107. return tool.formatTimestamp(time)
  108. }
  109. const total = ref(0)
  110. const pagination = ref({
  111. size: 10,
  112. current: 1,
  113. })
  114. // const onChangeCurrent = (current) => {
  115. // router.push({
  116. // path: '/' + current
  117. // })
  118. // }
  119. const handlerChange = (page, pageSize) => {
  120. console.log('分页参数', page, pageSize)
  121. // pagination.value.size = pageSize
  122. // pagination.value.current = page
  123. getList()
  124. }
  125. const handleOk = () => {
  126. visible.value = false
  127. }
  128. const open = (id) => {
  129. visible.value = true
  130. pagination.value.size = 10
  131. pagination.value.current = 1
  132. courseId.value = id
  133. getList()
  134. }
  135. const handleDetail = (record) => {
  136. console.log('查看详情', record)
  137. router.push({
  138. path: '/portal/courseDetails',
  139. query: {
  140. id: record.courseId
  141. }
  142. })
  143. // 在这里添加查看详情的逻辑
  144. }
  145. // 编辑按钮点击事件
  146. const handleEdit = (record) => {
  147. console.log('编辑记录', record)
  148. // 在这里添加编辑记录的逻辑
  149. emit('handleEdit', record)
  150. }
  151. // 上架按钮点击事件
  152. const handleShelf = (record,num) => {
  153. console.log('上架记录', record)
  154. popoverVisible.value[record.collegeId] = false
  155. // 在这里添加上架记录的逻辑
  156. // {
  157. // "courseId": "1948183431150227458",
  158. // "putawayStatus": 1
  159. // }
  160. // updateCourseStatus({courseId : record.courseId,putawayStatus : num}).then((res)=>{
  161. // getList()
  162. // })
  163. }
  164. // 删除按钮点击事件
  165. const handleDelete = (record) => {
  166. console.log('删除记录', record)
  167. // 在这里添加删除记录的逻辑
  168. }
  169. const getList = () => {
  170. const params = {
  171. courseId: courseId.value,
  172. startTime: undefined,
  173. endTime: undefined,
  174. size : pagination.value.size,
  175. current : pagination.value.current
  176. }
  177. overviewLearningProgressApi.getStudyDetailCourseView(params).then((data)=>{
  178. console.log('获取列表', data)
  179. dataSources.value = data.records
  180. pagination.value.current = data.current
  181. pagination.value.size = data.size
  182. total.value = data.total
  183. })
  184. }
  185. const setList = (search) => {
  186. console.log('获取列表 setList',search)
  187. // courseName: '',
  188. // collegeId: '',
  189. // majorId: '',
  190. // courseType: '',
  191. // loacl: []
  192. formState.value = search
  193. pagination.value.current = 1
  194. list({...pagination.value, ...formState.value}).then((data) => {
  195. if (data.code == 200) {
  196. dataSources.value = data.data.records
  197. pagination.value.current = data.data.current
  198. pagination.value.size = data.data.size
  199. total.value = data.data.total
  200. }
  201. // data.records
  202. })
  203. }
  204. // 重置按钮点击事件
  205. onMounted(() => {
  206. // getListData()
  207. // getList()
  208. })
  209. // watch(
  210. // () => dataSources.value,
  211. // (newVal, oldVal) => {
  212. // console.log('数据源变化了 ', ' 新的 ',newVal, ' 旧的 ',oldVal)
  213. // },
  214. // { deep: true, immediate: true }
  215. // )
  216. defineExpose({
  217. open
  218. })
  219. </script>
  220. <style scoped>
  221. .desc p {
  222. margin-bottom: 1em;
  223. }
  224. </style>