index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <script setup>
  2. import { getFullUrl, getAvatarUrl } from '~/utils/helper';
  3. import { Search as IconSearch } from '@element-plus/icons-vue';
  4. import { ElMessage } from 'element-plus';
  5. let nj = $ref([])
  6. request({
  7. url: '/jcxx/grade/index',
  8. data: {
  9. limit: 99
  10. }
  11. }).then(res => {
  12. if (res.code === '1') {
  13. nj = [{ n: '全部', v: undefined }].concat(res.data.page_data.map(({ grade_name, grade_id }) => ({ v: grade_id, n: grade_name })))
  14. }
  15. })
  16. const queryForm = reactive({
  17. keyword: '',
  18. grade_id: undefined,
  19. page: 1
  20. })
  21. // 我创建的
  22. let data_wcjd = $ref([])
  23. let total = $ref(0)
  24. function queryData() {
  25. request({
  26. url: '/kzkt/zbkc/index',
  27. data: queryForm
  28. }).then(res => {
  29. if (res.code === '1') {
  30. data_wcjd = res.data.page_data
  31. total = res.data.total_rows * 1
  32. }
  33. })
  34. }
  35. queryData()
  36. watch(queryForm, () => {
  37. queryData()
  38. })
  39. const router = useRouter()
  40. function handleClickAdd() {
  41. router.push({ name: 'personal_create_wlzb_add' })
  42. }
  43. function handleClickEdit(i) {
  44. router.push({ name: 'personal_create_wlzb_edit', params: { id: i.id } })
  45. }
  46. function handleClickDetail(i) {
  47. router.push({ name: 'personal_create_wlzb_kcdg', params: { id: i.id } })
  48. }
  49. function handleClickDel(i) {
  50. request({
  51. url: '/kzkt/zbkc/delete',
  52. data: {
  53. kz_id: i.id
  54. }
  55. }).then(res => {
  56. if (res.code === '1') {
  57. ElMessage.success('已删除')
  58. queryData()
  59. }
  60. })
  61. }
  62. </script>
  63. <template>
  64. <div class="w-full shadow bg-white rounded-md flex items-center px-36 py-4">
  65. <div class="text-lg text-hex-050026">网络直播</div>
  66. <el-divider direction="vertical" />
  67. <div class="text-sm">
  68. <span class="text-hex-949494">我的课程</span>
  69. <span class="text-hex-949494"> - 我创建的</span>
  70. <span> - 网络直播</span>
  71. </div>
  72. </div>
  73. <div class="w-full shadow bg-white flex flex-col rounded-md divide-y mt-4">
  74. <div class="flex justify-end px-8 py-2">
  75. <div class="w-100px h-50px flex_center rounded bg-hex-00A3FF text-white cursor-pointer" @click="handleClickAdd">创建
  76. </div>
  77. <div class="w-500px h-50px ml-8">
  78. <el-input class="w-500px h-full rounded-md" placeholder="搜索关键字" v-model="queryForm.keyword">
  79. <template #suffix>
  80. <div class="w-26px h-26px bg-hex-00A3FF rounded-md flex justify-center items-center cursor-pointer"
  81. @click="queryData()">
  82. <el-icon size="13" color="#fff">
  83. <IconSearch />
  84. </el-icon>
  85. </div>
  86. </template>
  87. </el-input>
  88. </div>
  89. </div>
  90. <div class="p-4">
  91. <check-row v-model="queryForm.grade_id" label="年级" :items="nj"></check-row>
  92. <!-- <check-row v-model="queryForm.subject_id" label="分册" :items="fc"></check-row> -->
  93. <div class="flex flex-wrap justify-between">
  94. <template v-if="data_wcjd.length">
  95. <div class="w-647px h-155px rounded-xl shadow-lg cursor-pointer mb-7 flex" v-for="i in data_wcjd"
  96. @click="handleClickDetail(i)">
  97. <div class="w-264px h-full flex-none">
  98. <img :src="getFullUrl(i.img)" alt="" class="w-full h-full" />
  99. </div>
  100. <div class="p-2 pr-6 flex-auto flex flex-col">
  101. <div class="flex justify-between w-full items-center py-1">
  102. <div class="font-bold">{{ i.name }}</div>
  103. <div class="text-hex-949494 text-sm flex justify-between items-center">
  104. <i-bx:edit-alt class="mr-2 cursor-pointer" @click.stop="handleClickEdit(i)" />
  105. <i-ep:delete class="cursor-pointer" @click.stop="handleClickDel(i)" />
  106. </div>
  107. </div>
  108. <div class="text-sm text-hex-949494 py-1 line-clamp-2 overflow-ellipsis h-12 ">
  109. {{ i.kcjj }}
  110. </div>
  111. <div class="text-sm py-1 flex-auto">
  112. <span>{{ i.grade_name }}</span>
  113. <span class="mx-2">|</span>
  114. <span>{{ i.subject_name }}</span>
  115. </div>
  116. <div class="flex text-sm justify-between items-center">
  117. <div class="cursor-pointer flex items-center">
  118. <el-avatar :size="16" :src="getFullUrl(i.master_user_avatar)" />
  119. <span class="ml-1">{{
  120. i.master_teacher
  121. }}</span>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </template>
  127. <div v-else class="flex justify-center w-full">
  128. <el-empty description="暂无数据" />
  129. </div>
  130. </div>
  131. <div class="flex justify-end mb-8">
  132. <el-pagination background layout="prev, pager, next" :total="total" v-model:current-page="queryForm.page" />
  133. </div>
  134. </div>
  135. </div>
  136. </template>