courseSelect.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. <template>
  2. <h2 class="contentTitle" v-if="classDown">课程列表</h2>
  3. <div class="course_select">
  4. <span class="grandTitle">年级:</span>
  5. <el-button :class="selectGrand == '三年级' ? 'el_button_active' : ''" @click="clickGrand('三年级')">三年级</el-button>
  6. <el-button :class="selectGrand == '四年级' ? 'el_button_active' : ''" @click="clickGrand('四年级')">四年级</el-button>
  7. <el-button :class="selectGrand == '五年级' ? 'el_button_active' : ''" @click="clickGrand('五年级')">五年级</el-button>
  8. <el-button :class="selectGrand == '六年级' ? 'el_button_active' : ''" @click="clickGrand('六年级')">六年级</el-button>
  9. <el-button :class="selectGrand == '七年级' ? 'el_button_active' : ''" @click="clickGrand('七年级')">七年级</el-button>
  10. <el-button :class="selectGrand == '八年级' ? 'el_button_active' : ''" @click="clickGrand('八年级')">八年级</el-button>
  11. </div>
  12. <div class="course_select">
  13. <el-button :class="volumes ? 'el_button_active' : ''" @click="volumes = true">上册</el-button>
  14. <el-button :class="!volumes ? 'el_button_active' : ''" @click="volumes = false">下册</el-button>
  15. <div v-if="currentData && currentData.shang.length > 0 && volumes">
  16. <el-row :gutter="20">
  17. <el-col :span="6" v-for="item in currentData.shang" :key="item.title">
  18. <div class="grid-content ep-bg-purple">
  19. <img :src="getImageUrl(item.url)" alt="">
  20. <div class="course_content">
  21. <div class="div_title">
  22. <span>上册</span>
  23. {{ item.title }}
  24. <!-- v-if="isupdateCourse" -->
  25. <el-popover v-if="isupdateCourse" placement="bottom" :width="210" trigger="click" show-after="500"
  26. @hide="checked1 = false">
  27. <template #reference>
  28. <img :src="DownloadImg" alt="" @click="getDate(item.dataId)">
  29. </template>
  30. <div>
  31. <div>
  32. <span>资源列表({{ item.dataList.length }})</span>
  33. <el-checkbox style="position: relative;top: 0;left: 35px;height: 30px;" v-model="checked1"
  34. label="全选" size="large" @click="checkedAll(item.dataId)" />
  35. </div>
  36. <div v-if="item.dataList.length > 0">
  37. <div class="div_hover" v-for="dataitem in item.dataList" :key="dataitem.dataId">
  38. <span style="display: inline-block;width: 130px;" :title="dataitem.name">{{
  39. dataitem.name.length > 10 ?
  40. dataitem.name.substring(0, 8) + '...' : dataitem.name }}</span>
  41. <span v-if="!checked1" class="el_popover_a" style="position: relative;left: 20px;top: 5px;"
  42. @click="downloadOne(dataitem.url, dataitem.name)">
  43. <img :src="DownloadImg" alt="">
  44. </span>
  45. <el-checkbox v-if="checked1" v-model="dataitem.checked" label="全选" size="large" />
  46. </div>
  47. <el-button style="margin-top: 10px;" v-if="checked1"
  48. @click="DownloadProcessing()">批量下载</el-button>
  49. </div>
  50. <div v-else>
  51. 暂无数据
  52. </div>
  53. </div>
  54. </el-popover>
  55. </div>
  56. </div>
  57. <div class="class_button" v-if="isupdateCourse">
  58. <el-popover placement="bottom" trigger="hover">
  59. <template #reference>
  60. <el-button
  61. style="width: 50%;background: rgba(255, 255, 245, 1);color: rgba(0, 0, 0, 0.6);">备课</el-button>
  62. </template>
  63. <ul class="beike">
  64. <li @click="openCourseDetail(item.id)">查看</li>
  65. <li @click="updateCourse(item.id)">修改</li>
  66. <li @click="ReductionCourse(item.id)">还原</li>
  67. </ul>
  68. </el-popover>
  69. <el-button style="width: 50%;" class="el_button_active" @click="openCourseDetail(item.id)">上课</el-button>
  70. </div>
  71. </div>
  72. </el-col>
  73. </el-row>
  74. </div>
  75. <div v-if="currentData && currentData.xia.length > 0 && !volumes">
  76. <el-row :gutter="20">
  77. <el-col :span="6" v-for="item in currentData.xia" :key="item.title">
  78. <div class="grid-content ep-bg-purple">
  79. <img :src="getImageUrl(item.url)" alt="">
  80. <div class="course_content">
  81. <div class="div_title" style="">
  82. <span>下册</span>
  83. {{ item.title }}
  84. <!-- v-if="isupdateCourse" -->
  85. <el-popover v-if="isupdateCourse" placement="bottom" :width="210" trigger="click" show-after="500"
  86. @hide="checked1 = false">
  87. <template #reference>
  88. <img :src="DownloadImg" alt="" @click="getDate(item.dataId)">
  89. </template>
  90. <div>
  91. <div>
  92. <span>资源列表({{ item.dataList.length }})</span>
  93. <el-checkbox style="position: relative;top: 0;left: 35px;height: 30px;" v-model="checked1"
  94. label="全选" size="large" @click="checkedAll(item.dataId)" />
  95. </div>
  96. <div v-if="item.dataList.length > 0">
  97. <div class="div_hover" v-for="dataitem in item.dataList" :key="dataitem.dataId">
  98. <span style="display: inline-block;width: 130px;" :title="dataitem.name">{{
  99. dataitem.name.length > 10 ?
  100. dataitem.name.substring(0, 8) + '...' : dataitem.name }}</span>
  101. <span v-if="!checked1" class="el_popover_a" style="position: relative;left: 20px;top: 5px;"
  102. @click="downloadOne(dataitem.url, dataitem.name)">
  103. <img :src="DownloadImg" alt="">
  104. </span>
  105. <el-checkbox v-if="checked1" v-model="dataitem.checked" label="全选" size="large" />
  106. </div>
  107. <el-button style="margin-top: 10px;" v-if="checked1"
  108. @click="DownloadProcessing()">批量下载</el-button>
  109. </div>
  110. <div v-else>
  111. 暂无数据
  112. </div>
  113. </div>
  114. </el-popover>
  115. </div>
  116. </div>
  117. <div class="class_button" v-if="isupdateCourse">
  118. <el-popover placement="bottom" trigger="hover">
  119. <template #reference>
  120. <el-button
  121. style="width: 50%;background: rgba(255, 255, 245, 1);color: rgba(0, 0, 0, 0.6);">备课</el-button>
  122. </template>
  123. <ul class="beike">
  124. <li @click="openCourseDetail(item.id)">查看</li>
  125. <li @click="updateCourse(item.id)">修改</li>
  126. <li @click="ReductionCourse(item.id)">还原</li>
  127. </ul>
  128. </el-popover>
  129. <el-button style="width: 50%;" class="el_button_active" @click="openCourseDetail(item.id)">上课</el-button>
  130. </div>
  131. </div>
  132. </el-col>
  133. </el-row>
  134. </div>
  135. </div>
  136. <el-dialog v-model="dialogVisible" :before-close="handleClose" width=500>
  137. <template #header>
  138. <div class="dialog-header img_text_middle">
  139. <img :src="WarningImg" alt="">
  140. <span class="warning_text">操作警告</span>
  141. </div>
  142. </template>
  143. <span>启用还原功能将重置当前修改,并将课程内容恢复至标准版本。请确认是否继续执行相关操作。</span>
  144. <template #footer>
  145. <div class="dialog-footer">
  146. <el-button type="primary" @click="updateReduction()">
  147. 确认修改
  148. </el-button>
  149. <el-button @click="dialogVisible = false">取消</el-button>
  150. </div>
  151. </template>
  152. </el-dialog>
  153. </template>
  154. <script setup>
  155. import { ref, onMounted, watchEffect, defineProps } from 'vue';
  156. import { userCurrentRole, userInfoStore } from '../../stores/counter'
  157. import JSZip from 'jszip';
  158. import { saveAs } from 'file-saver';
  159. import DownloadImg from '@/assets/img/download.png'
  160. import PDFImg from '@/assets/img/PDF.png'
  161. import WarningImg from '@/assets/icon/icon.png'
  162. import san1 from '../../assets/img/三下1.png'
  163. import san2 from '@/assets/img/三下2.png'
  164. import san3 from '@/assets/img/三下3.png'
  165. import san4 from '@/assets/img/三下4.png'
  166. import si1 from '@/assets/img/四下1.png'
  167. import si2 from '@/assets/img/四下2.png'
  168. import si3 from '@/assets/img/四下3.png'
  169. import si4 from '@/assets/img/四下4.png'
  170. import wu1 from '@/assets/img/五下1.png'
  171. import wu2 from '@/assets/img/五下2.png'
  172. import wu3 from '@/assets/img/五下3.png'
  173. import wu4 from '@/assets/img/五下4.png'
  174. import liu1 from '@/assets/img/六下1.png'
  175. import liu2 from '@/assets/img/六下2.png'
  176. import liu3 from '@/assets/img/六下3.png'
  177. import liu4 from '@/assets/img/六下4.png'
  178. import qi1 from '@/assets/img/七下1.png'
  179. import qi2 from '@/assets/img/七下2.png'
  180. import qi3 from '@/assets/img/七下3.png'
  181. import qi4 from '@/assets/img/七下4.png'
  182. import ba1 from '@/assets/img/八下1.png'
  183. import ba2 from '@/assets/img/八下2.png'
  184. import ba3 from '@/assets/img/八下3.png'
  185. import ba4 from '@/assets/img/八下4.png'
  186. import san11 from '../../assets/img/三上1.png'
  187. import san21 from '@/assets/img/三上2.png'
  188. import san31 from '@/assets/img/三上3.png'
  189. import san41 from '@/assets/img/三上4.png'
  190. import si11 from '@/assets/img/四上1.png'
  191. import si21 from '@/assets/img/四上2.png'
  192. import si31 from '@/assets/img/四上3.png'
  193. import si41 from '@/assets/img/四上4.png'
  194. import wu11 from '@/assets/img/五上1.png'
  195. import wu21 from '@/assets/img/五上2.png'
  196. import wu31 from '@/assets/img/五上3.png'
  197. import wu41 from '@/assets/img/五上4.png'
  198. import liu11 from '@/assets/img/六上1.png'
  199. import liu21 from '@/assets/img/六上2.png'
  200. import liu31 from '@/assets/img/六上3.png'
  201. import liu41 from '@/assets/img/六上4.png'
  202. import qi11 from '@/assets/img/七上1.png'
  203. import qi21 from '@/assets/img/七上2.png'
  204. import qi31 from '@/assets/img/七上3.png'
  205. import qi41 from '@/assets/img/七上4.png'
  206. import ba11 from '@/assets/img/八上1.png'
  207. import ba21 from '@/assets/img/八上2.png'
  208. import ba31 from '@/assets/img/八上3.png'
  209. import ba41 from '@/assets/img/八上4.png'
  210. import axios from 'axios';
  211. const props = defineProps({
  212. classDown: {
  213. type: Boolean,
  214. default: true
  215. }
  216. })
  217. const volumes = ref(true)
  218. const user = userInfoStore()
  219. const CurrentRole = userCurrentRole()
  220. const selectGrand = ref('三年级')
  221. const isupdateCourse = ref(false)
  222. const currentData = ref({
  223. shang: [
  224. {
  225. id: "542e8781-6910-11ef-b873-005056b86db5",
  226. title: "初识人工智能",
  227. url: san11,
  228. dataId: "e7790fae-690b-11ef-b873-005056b86db5",
  229. dataList: [
  230. ]
  231. }, {
  232. id: "b4512e21-6910-11ef-b873-005056b86db5",
  233. title: "无处不在的人工智能",
  234. url: san21,
  235. dataId: "558fa5a8-690c-11ef-b873-005056b86db5",
  236. dataList: []
  237. }, {
  238. id: "2b0b9712-6911-11ef-b873-005056b86db5",
  239. title: "机器的眼睛",
  240. url: san31,
  241. dataId: "9c1c1554-690c-11ef-b873-005056b86db5",
  242. dataList: []
  243. }, {
  244. id: "f8631158-6911-11ef-b873-005056b86db5",
  245. title: "神奇的相机",
  246. url: san41,
  247. dataId: "d664ecbb-690c-11ef-b873-005056b86db5",
  248. dataList: []
  249. }
  250. ],
  251. xia: [
  252. {
  253. id: "a1d5bf2b-f4a1-11ee-b534-005056b86db5",
  254. title: "初识人工智能",
  255. url: san1,
  256. dataId: "7219cb51-f4a5-11ee-b534-005056b86db5",
  257. dataList: [
  258. ]
  259. }, {
  260. id: "0b7610fa-f4a3-11ee-b534-005056b86db5",
  261. title: "人工智能畅想曲",
  262. url: san2,
  263. dataId: "f1f1b76d-f4c4-11ee-b534-005056b86db5",
  264. dataList: []
  265. }, {
  266. id: "058840d5-f4a4-11ee-b534-005056b86db5",
  267. title: "慧眼识人",
  268. url: san3,
  269. dataId: "ef05900d-f657-11ee-b534-005056b86db5",
  270. dataList: []
  271. }, {
  272. id: "3b877b4c-fa1a-11ee-b534-005056b86db5",
  273. title: "人工智能有缺点吗?",
  274. url: san4,
  275. dataId: "abac4a42-fa1a-11ee-b534-005056b86db5",
  276. dataList: []
  277. }
  278. ]
  279. })
  280. const dialogVisible = ref(false)
  281. const updateReductionId = ref("")
  282. const checked1 = ref(false)
  283. const visible = ref(false)
  284. const getUpdateCourseId = ref("")
  285. const courseData = {
  286. "三年级": {
  287. shang: [
  288. {
  289. id: "542e8781-6910-11ef-b873-005056b86db5",
  290. title: "初识人工智能",
  291. url: san11,
  292. dataId: "e7790fae-690b-11ef-b873-005056b86db5",
  293. dataList: [
  294. ]
  295. }, {
  296. id: "b4512e21-6910-11ef-b873-005056b86db5",
  297. title: "无处不在的人工智能",
  298. url: san21,
  299. dataId: "558fa5a8-690c-11ef-b873-005056b86db5",
  300. dataList: []
  301. }, {
  302. id: "2b0b9712-6911-11ef-b873-005056b86db5",
  303. title: "机器的眼睛",
  304. url: san31,
  305. dataId: "9c1c1554-690c-11ef-b873-005056b86db5",
  306. dataList: []
  307. }, {
  308. id: "f8631158-6911-11ef-b873-005056b86db5",
  309. title: "神奇的相机",
  310. url: san41,
  311. dataId: "d664ecbb-690c-11ef-b873-005056b86db5",
  312. dataList: []
  313. }
  314. ],
  315. xia: [
  316. {
  317. id: "a1d5bf2b-f4a1-11ee-b534-005056b86db5",
  318. title: "初识人工智能",
  319. url: san1,
  320. dataId: "7219cb51-f4a5-11ee-b534-005056b86db5",
  321. dataList: [
  322. ]
  323. }, {
  324. id: "0b7610fa-f4a3-11ee-b534-005056b86db5",
  325. title: "人工智能畅想曲",
  326. url: san2,
  327. dataId: "f1f1b76d-f4c4-11ee-b534-005056b86db5",
  328. dataList: []
  329. }, {
  330. id: "058840d5-f4a4-11ee-b534-005056b86db5",
  331. title: "慧眼识人",
  332. url: san3,
  333. dataId: "ef05900d-f657-11ee-b534-005056b86db5",
  334. dataList: []
  335. }, {
  336. id: "3b877b4c-fa1a-11ee-b534-005056b86db5",
  337. title: "人工智能有缺点吗?",
  338. url: san4,
  339. dataId: "abac4a42-fa1a-11ee-b534-005056b86db5",
  340. dataList: []
  341. }
  342. ]
  343. },
  344. "四年级": {
  345. shang: [
  346. {
  347. id: "65b18fae-6912-11ef-b873-005056b86db5",
  348. title: "人工智能交互",
  349. url: si11,
  350. dataId: "2a023dbd-690d-11ef-b873-005056b86db5",
  351. dataList: []
  352. }, {
  353. id: "cfcb66e1-6912-11ef-b873-005056b86db5",
  354. title: "情绪小怪兽(上)",
  355. url: si21,
  356. dataId: "73589a83-690d-11ef-b873-005056b86db5",
  357. dataList: []
  358. }, {
  359. id: "607f9c77-6913-11ef-b873-005056b86db5",
  360. title: "情绪小怪兽(下)",
  361. url: si31,
  362. dataId: "2d796dde-f328-11ee-b534-005056b86db5",
  363. dataList: []
  364. }, {
  365. id: "cf08ea0d-6913-11ef-b873-005056b86db5",
  366. title: "人工智能进化论",
  367. url: si41,
  368. dataId: "87c47fbc-690e-11ef-b873-005056b86db5",
  369. dataList: []
  370. }
  371. ],
  372. xia: [
  373. {
  374. id: "442c41c8-f3ec-11ee-b534-005056b86db5",
  375. title: "人工智能进阶",
  376. url: si1,
  377. dataId: "2a4a7d77-ed73-11ee-b534-005056b86db5",
  378. dataList: []
  379. }, {
  380. id: "b01fae58-f3ec-11ee-b534-005056b86db5",
  381. title: "情绪识别",
  382. url: si2,
  383. dataId: "ab94d614-f327-11ee-b534-005056b86db5",
  384. dataList: []
  385. }, {
  386. id: "2c32abc1-f3ee-11ee-b534-005056b86db5",
  387. title: "情感分析",
  388. url: si3,
  389. dataId: "2d796dde-f328-11ee-b534-005056b86db5",
  390. dataList: []
  391. }, {
  392. id: "9f6d6f69-f3f0-11ee-b534-005056b86db5",
  393. title: "身姿妙趣",
  394. url: si4,
  395. dataId: "783f7a58-f328-11ee-b534-005056b86db5",
  396. dataList: []
  397. }
  398. ]
  399. },
  400. "五年级": {
  401. shang: [
  402. {
  403. id: "4d102c5f-690f-11ef-b873-005056b86db5",
  404. title: "机器学习的方式",
  405. url: wu11,
  406. dataId: "8ad02591-690f-11ef-b873-005056b86db5",
  407. dataList: []
  408. }, {
  409. id: "af606f2f-690f-11ef-b873-005056b86db5",
  410. title: "停车场助手",
  411. url: wu21,
  412. dataId: "d5871b3f-690f-11ef-b873-005056b86db5",
  413. dataList: []
  414. }, {
  415. id: "e7093e14-690f-11ef-b873-005056b86db5",
  416. title: "会看的汽车",
  417. url: wu31,
  418. dataId: "1ed9f8c2-6910-11ef-b873-005056b86db5",
  419. dataList: []
  420. }, {
  421. id: "3a711ccc-6910-11ef-b873-005056b86db5",
  422. title: "手写字符识别",
  423. url: wu41,
  424. dataId: "5b03308f-6910-11ef-b873-005056b86db5",
  425. dataList: []
  426. },
  427. ],
  428. xia: [
  429. {
  430. id: "61dde5e8-f1a9-11ee-b534-005056b86db5",
  431. title: "科幻作品中的人工智能",
  432. url: wu1,
  433. dataId: "806d06b7-f193-11ee-b534-005056b86db5",
  434. dataList: []
  435. }, {
  436. id: "81d3e3ad-f1ac-11ee-b534-005056b86db5",
  437. title: "游戏与生活的概率",
  438. url: wu2,
  439. dataId: "6daecf3a-f194-11ee-b534-005056b86db5",
  440. dataList: []
  441. }, {
  442. id: "66bc069a-f1ae-11ee-b534-005056b86db5",
  443. title: "手势识别",
  444. url: wu3,
  445. dataId: "3ac06df4-f196-11ee-b534-005056b86db5",
  446. dataList: []
  447. }, {
  448. id: "02c626b9-f65c-11ee-b534-005056b86db5",
  449. title: "和电脑比赛",
  450. url: wu4,
  451. dataId: "098ab7cc-f65b-11ee-b534-005056b86db5",
  452. dataList: []
  453. },
  454. ]
  455. },
  456. "六年级": {
  457. shang: [
  458. {
  459. id: "793300d4-6910-11ef-b873-005056b86db5",
  460. title: "智慧机器",
  461. url: liu11,
  462. dataId: "d6040736-6910-11ef-b873-005056b86db5",
  463. dataList: []
  464. }, {
  465. id: "0cb38994-6911-11ef-b873-005056b86db5",
  466. title: "天气如何预报",
  467. url: liu21,
  468. dataId: "118a7086-6912-11ef-b873-005056b86db5",
  469. dataList: []
  470. }, {
  471. id: "e7999969-6912-11ef-b873-005056b86db5",
  472. title: "人工智能与预测",
  473. url: liu31,
  474. dataId: "d4723f15-6914-11ef-b873-005056b86db5",
  475. dataList: []
  476. }, {
  477. id: "2d2b94c4-6915-11ef-b873-005056b86db5",
  478. title: "人工智能与物联网",
  479. url: liu41,
  480. dataId: "c94d4ad7-6915-11ef-b873-005056b86db5",
  481. dataList: []
  482. },
  483. ],
  484. xia: [
  485. {
  486. id: "12734ea5-f58a-11ee-b534-005056b86db5",
  487. title: "人脸检测知多少",
  488. url: liu1,
  489. dataId: "4f24acbd-f58d-11ee-b534-005056b86db5",
  490. dataList: []
  491. }, {
  492. id: "63494f9d-f58d-11ee-b534-005056b86db5",
  493. title: "人脸检测全流程",
  494. url: liu2,
  495. dataId: "cc528b70-f58e-11ee-b534-005056b86db5",
  496. dataList: []
  497. }, {
  498. id: "7187af69-f590-11ee-b534-005056b86db5",
  499. title: "人工智能与军事",
  500. url: liu3,
  501. dataId: "5ad4dc91-f665-11ee-b534-005056b86db5",
  502. dataList: []
  503. }, {
  504. id: "29ebe57f-f7c7-11ee-b534-005056b86db5",
  505. title: "人工智能音乐家",
  506. url: liu4,
  507. dataId: "e44635ed-f7ea-11ee-b534-005056b86db5",
  508. dataList: []
  509. },
  510. ]
  511. },
  512. "七年级": {
  513. shang: [
  514. {
  515. id: "d4d39bc3-6901-11ef-b873-005056b86db5",
  516. title: "短信过滤",
  517. url: qi11,
  518. dataId: "2aa17bbf-690a-11ef-b873-005056b86db5",
  519. dataList: []
  520. }, {
  521. id: "e69f529b-690e-11ef-b873-005056b86db5",
  522. title: "朴素贝叶斯算法",
  523. url: qi21,
  524. dataId: "050ef4e7-690e-11ef-b873-005056b86db5",
  525. dataList: []
  526. }, {
  527. id: "f9f0970d-690e-11ef-b873-005056b86db5",
  528. title: "人工智能数据处理",
  529. url: qi31,
  530. dataId: "28aec952-690e-11ef-b873-005056b86db5",
  531. dataList: []
  532. }, {
  533. id: "20076164-690f-11ef-b873-005056b86db5",
  534. title: "模型训练与评估",
  535. url: qi41,
  536. dataId: "491deed0-690e-11ef-b873-005056b86db5",
  537. dataList: []
  538. }
  539. ],
  540. xia: [
  541. {
  542. id: "16ed7a65-f186-11ee-b534-005056b86db5",
  543. title: "大数据与人工智能",
  544. url: qi1,
  545. dataId: "c39dcb26-f163-11ee-b534-005056b86db5",
  546. dataList: []
  547. }, {
  548. id: "6db889c2-f187-11ee-b534-005056b86db5",
  549. title: "挖掘数据“金矿”",
  550. url: qi2,
  551. dataId: "e4ab3b4f-f163-11ee-b534-005056b86db5",
  552. dataList: []
  553. }, {
  554. id: "328cb885-f188-11ee-b534-005056b86db5",
  555. title: "机器学习(上)",
  556. url: qi3,
  557. dataId: "f65043b1-f163-11ee-b534-005056b86db5",
  558. dataList: []
  559. }, {
  560. id: "a03b3cd5-facc-11ee-b534-005056b86db5",
  561. title: "机器学习(下)",
  562. url: qi4,
  563. dataId: "c530dd85-facc-11ee-b534-005056b86db5",
  564. dataList: []
  565. }
  566. ]
  567. },
  568. "八年级": {
  569. shang: [
  570. {
  571. id: "a0a70192-6910-11ef-b873-005056b86db5",
  572. title: "猫狗分类",
  573. url: ba11,
  574. dataId: "1f6d57a7-6910-11ef-b873-005056b86db5",
  575. dataList: []
  576. }, {
  577. id: "8737c17d-6910-11ef-b873-005056b86db5",
  578. title: "卷积神经网络",
  579. url: ba21,
  580. dataId: "13b0c133-6910-11ef-b873-005056b86db5",
  581. dataList: []
  582. }, {
  583. id: "6fdc7fce-6910-11ef-b873-005056b86db5",
  584. title: "模型调整与使用",
  585. url: ba31,
  586. dataId: "ffe92109-690f-11ef-b873-005056b86db5",
  587. dataList: []
  588. }, {
  589. id: "af727025-6910-11ef-b873-005056b86db5",
  590. title: "动物分类",
  591. url: ba41,
  592. dataId: "e70b7077-690f-11ef-b873-005056b86db5",
  593. dataList: []
  594. },
  595. ],
  596. xia: [
  597. {
  598. id: "ecd08b4f-f1b1-11ee-b534-005056b86db5",
  599. title: "探秘人工智能",
  600. url: ba1,
  601. dataId: "488da74d-f1af-11ee-b534-005056b86db5",
  602. dataList: []
  603. }, {
  604. id: "93069885-f1b4-11ee-b534-005056b86db5",
  605. title: "无所不在的人工智能",
  606. url: ba2,
  607. dataId: "35b321aa-f1b0-11ee-b534-005056b86db5",
  608. dataList: []
  609. }, {
  610. id: "ea32c84d-f3e4-11ee-b534-005056b86db5",
  611. title: "自然语言处理",
  612. url: ba3,
  613. dataId: "8f06148d-f1b0-11ee-b534-005056b86db5",
  614. dataList: []
  615. }, {
  616. id: "8012207b-f64c-11ee-b534-005056b86db5",
  617. title: "智慧创作",
  618. url: ba4,
  619. dataId: "ef27fd65-f648-11ee-b534-005056b86db5",
  620. dataList: []
  621. },
  622. ]
  623. }
  624. }
  625. onMounted(() => {
  626. currentData.value = courseData["三年级"]
  627. })
  628. const clickGrand = val => {
  629. selectGrand.value = val
  630. currentData.value = courseData[val]
  631. }
  632. const getImageUrl = (url) => {
  633. return new URL(url, import.meta.url).href
  634. }
  635. const openCourseDetail = (id) => {
  636. console.log(user.user)
  637. // 会返回复制得课程
  638. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
  639. console.log(res)
  640. if (res.value[0].length > 0) {
  641. // let isSave = res.value[0].filter(x => {
  642. // return x.courseId == id
  643. // })
  644. //这个是打开指定的课程接口
  645. top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 2, user.user.type);
  646. } else {
  647. updateCourseId(id, "studyDetail")
  648. }
  649. }, [], { "type": "POST", "withCredentials": true });
  650. }
  651. const getTimeCourse = (id) => {
  652. try {
  653. setInterval(() => {
  654. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, id, '5', 30], function (res) {
  655. console.log(res, "22222222222222222");
  656. }, [], { "type": "POST", "withCredentials": true });
  657. }, 30000)
  658. } catch (e) {
  659. console.log(e)
  660. }
  661. }
  662. const updateCourse = id => {
  663. // 会返回courseId和state 两个参数 然后打开
  664. getTimeCourse(id)
  665. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
  666. console.log(res)
  667. if (res.value[0].length > 0) {
  668. // let isSave = res.value[0].filter(x => {
  669. // return x.courseId == id
  670. // })
  671. top.U.MD.D.I.openInApplication('openCourseNewUpdate', res.value[0][0].courseId); //这个是打开指定的课程接口
  672. } else {
  673. updateCourseId(id, "openCourseNewUpdate")
  674. }
  675. }, [], { "type": "POST", "withCredentials": true });
  676. }
  677. const updateCourseId = (id, type) => {
  678. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/copyCourseSz", [id, user.user.userid], function (res) {
  679. console.log(res)
  680. if (res.value[0][0].courseId != "") {
  681. if (type == "openCourseNewUpdate") {
  682. top.U.MD.D.I.openInApplication("openCourseNewUpdate", res.value[0][0].courseId)
  683. } else {
  684. top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 3, user.user.type);
  685. }
  686. }
  687. }, [], { "type": "POST", "withCredentials": true });
  688. }
  689. const ReductionCourse = id => {
  690. // updateReductionId.value = id
  691. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
  692. console.log(res)
  693. if (res.value[0].length > 0) {
  694. // let isSave = res.value[0].filter(x => {
  695. // return x.courseId == id
  696. // })
  697. dialogVisible.value = true
  698. updateReductionId.value = res.value[0][0].courseId
  699. } else {
  700. ElMessage({
  701. message: '该课程就是最初课程,不能还原',
  702. type: 'warning',
  703. })
  704. }
  705. }, [], { "type": "POST", "withCredentials": true });
  706. }
  707. const updateReduction = () => {
  708. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/revertCourseSz", [updateReductionId.value], function (res) {
  709. console.log(res, "还原")
  710. dialogVisible.value = false
  711. }, [], { "type": "POST", "withCredentials": true });
  712. }
  713. const getDate = async (id) => {
  714. // currentData
  715. let dataList = [];
  716. return new Promise((resolve, reject) => {
  717. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", [id], function (res) {
  718. console.log(res);
  719. if (!res || !res.value || res.value[0].length === 0 || res.value[0][0].chapters.length === 0) {
  720. reject(new Error("Invalid response or no chapters found"));
  721. return;
  722. }
  723. const datachapters = JSON.parse(res.value[0][0].chapters);
  724. for (let i = 0; i < datachapters.length; i++) {
  725. const data = datachapters[i];
  726. for (let j = 0; j < data.chapterInfo.length; j++) {
  727. const dataChapterInfo = data.chapterInfo[j];
  728. for (let k = 0; k < dataChapterInfo.taskJson.length; k++) {
  729. const DatahapterData = dataChapterInfo.taskJson[k];
  730. for (let l = 0; l < DatahapterData.chapterData.length; l++) {
  731. const obj = DatahapterData.chapterData[l];
  732. obj.checked = false;
  733. dataList.push(obj);
  734. }
  735. }
  736. }
  737. }
  738. resolve(dataList);
  739. }, [], { "type": "POST", "withCredentials": true });
  740. })
  741. .then((dataList) => {
  742. getUpdateCourse(dataList, id);
  743. })
  744. .catch((error) => {
  745. console.error("Error fetching data:", error);
  746. });
  747. };
  748. const getUpdateCourse = async (dataList, id) => {
  749. let m = currentData.value
  750. if (volumes.value) {
  751. await m.shang.map(x => {
  752. if (x.dataId == id) {
  753. x.dataList = dataList
  754. }
  755. return x
  756. })
  757. } else {
  758. await m.xia.map(x => {
  759. if (x.dataId == id) {
  760. x.dataList = dataList
  761. }
  762. return x
  763. })
  764. }
  765. currentData.value = m
  766. getUpdateCourseId.value = id
  767. }
  768. const checkedAll = (id) => {
  769. let data = currentData.value
  770. if (volumes.value) {
  771. data.shang.map(x => {
  772. if (x.dataId == id) {
  773. x.dataList.map(y => {
  774. y.checked = !checked1.value
  775. })
  776. }
  777. return x
  778. })
  779. } else {
  780. data.xia.map(x => {
  781. if (x.dataId == id) {
  782. x.dataList.map(y => {
  783. y.checked = !checked1.value
  784. })
  785. }
  786. return x
  787. })
  788. }
  789. console.log(id, checked1.value)
  790. console.log(data)
  791. currentData.value = data
  792. // checked1.value = true
  793. }
  794. const downloadOne = (url, fileName) => {
  795. try {
  796. console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', 1])
  797. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', 1], function (res) {
  798. console.log(res, '11111111111')
  799. }, [], { "type": "POST", "withCredentials": true });
  800. } catch (error) {
  801. console.log(error);
  802. }
  803. const a = document.createElement('a');
  804. a.style.display = 'none';
  805. a.href = url;
  806. a.download = fileName;
  807. document.body.appendChild(a);
  808. a.click();
  809. document.body.removeChild(a);
  810. }
  811. const DownloadProcessing = async () => {
  812. let data = currentData.value
  813. let urls = []
  814. if (volumes.value) {
  815. await data.shang.map(x => {
  816. // console.log(x)
  817. x.dataList.length > 0 && x.dataList.map(m => {
  818. if (m.checked) {
  819. urls.push(m)
  820. }
  821. return m
  822. })
  823. return x
  824. })
  825. } else {
  826. await data.xia.map(x => {
  827. // console.log(x)
  828. x.dataList.length > 0 && x.dataList.map(m => {
  829. if (m.checked) {
  830. urls.push(m)
  831. }
  832. return m
  833. })
  834. return x
  835. })
  836. }
  837. try {
  838. console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', urls.length])
  839. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', urls.length], function (res) {
  840. console.log(res, '11111111111')
  841. }, [], { "type": "POST", "withCredentials": true });
  842. } catch (error) {
  843. console.log(error);
  844. }
  845. for (let i = 0; i < urls.length; i++) {
  846. fetch(urls[i].url)
  847. .then(response => response.blob()) // 获取文件数据流
  848. .then(blob => {
  849. const url = window.URL.createObjectURL(blob); // 生成文件在浏览器中的链接
  850. const a = document.createElement('a');
  851. a.href = url;
  852. a.download = urls[i].name; // 文件名
  853. a.style.display = 'none';
  854. document.body.appendChild(a);
  855. a.click();
  856. document.body.removeChild(a);
  857. window.URL.revokeObjectURL(url); // 清除文件链接
  858. })
  859. .catch(console.error);
  860. }
  861. }
  862. // 获取课程下载资料
  863. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", ['课程id'], function (res) {}, [], { "type": "POST", "withCredentials": true });
  864. watchEffect(() => {
  865. if (JSON.stringify(user.user) != "{}") {
  866. if (CurrentRole.currentRole == "edupersonnel" || CurrentRole.currentRole == "areaAdministrator" || CurrentRole.currentRole == "userAdministrator" || CurrentRole.currentRole == "securityAuditor" || CurrentRole.currentRole == "schoolAdministrator" || CurrentRole.currentRole == "schoolSecurityAuditor" || CurrentRole.currentRole == "teacher" || user.type != 2) {
  867. isupdateCourse.value = true
  868. }
  869. }
  870. })
  871. </script>
  872. <style lang="scss" scoped>
  873. .course_select {
  874. margin-top: 10px;
  875. .grid-content {
  876. border-radius: 4px;
  877. min-height: 36px;
  878. background: #fff;
  879. padding: 12px;
  880. // height: 300px;
  881. img {
  882. width: 100%;
  883. border-radius: 5px;
  884. }
  885. .course_content {
  886. .div_title {
  887. margin-top: 10px;
  888. white-space: nowrap;
  889. text-overflow: ellipsis;
  890. overflow: hidden;
  891. span {
  892. // display: inline-block;
  893. padding: 2px 8px;
  894. background: rgba(224, 234, 251, 1);
  895. border-radius: 5px;
  896. font-size: 12px;
  897. color: rgba(54, 129, 252, 1);
  898. }
  899. img {
  900. width: 28px;
  901. cursor: pointer;
  902. float: right;
  903. }
  904. }
  905. }
  906. }
  907. .Screening {
  908. font-size: 20px;
  909. font-weight: 400;
  910. line-height: 28px;
  911. letter-spacing: 0em;
  912. text-align: center;
  913. color: rgba(0, 0, 0, 0.9);
  914. }
  915. .grandTitle {
  916. font-size: 20px;
  917. font-weight: 400;
  918. line-height: 28px;
  919. letter-spacing: 0em;
  920. text-align: center;
  921. }
  922. .el-button {
  923. // background: rgba(54, 129, 252, 1);
  924. color: rgba(54, 129, 252, 1);
  925. }
  926. .el_button_active {
  927. background: rgba(54, 129, 252, 1);
  928. color: #fff;
  929. }
  930. .class_button {
  931. margin-top: 15px;
  932. display: flex;
  933. justify-content: space-between;
  934. }
  935. }
  936. .el-row {
  937. margin-top: 20px;
  938. margin-bottom: 20px;
  939. }
  940. .el-row:last-child {
  941. margin-bottom: 0;
  942. }
  943. .el-col {
  944. border-radius: 4px;
  945. }
  946. .warning_text {
  947. font-weight: bold;
  948. font-size: 16px;
  949. color: rgba(0, 0, 0, 0.9);
  950. margin-left: 8px;
  951. }
  952. .div_hover {
  953. // padding: 8px 0 10px;
  954. height: 35px;
  955. line-height: 35px;
  956. }
  957. .div_hover:hover {
  958. background: rgb(240, 242, 245);
  959. }
  960. .el_popover_a {
  961. display: none;
  962. }
  963. .div_hover:hover .el_popover_a {
  964. display: inline-block;
  965. }
  966. .beike {
  967. li {
  968. padding: 8px 5px;
  969. border-radius: 5px;
  970. }
  971. li:hover {
  972. background: rgba(0, 0, 0, 0.1);
  973. cursor: pointer;
  974. }
  975. }
  976. </style>