courseSelect.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <h2 class="contentTitle">课程列表</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. <span class="grandTitle">{{ value }}</span>
  14. <div v-if="currentData && currentData.shang.length > 0">
  15. <el-row :gutter="20">
  16. <el-col :span="6" v-for="item in currentData.shang" :key="item.title">
  17. <div class="grid-content ep-bg-purple">
  18. <img :src="getImageUrl(item.url)" alt="">
  19. <div class="course_content">
  20. <p>{{ item.title }}<span>上册</span></p>
  21. <div class="class_button" v-if="isupdateCourse">
  22. <el-button
  23. style="width: 30%;background: rgba(240, 242, 245, 1);color: rgba(0, 0, 0, 0.6);">还原</el-button>
  24. <el-button style="width: 30%;background: #fff" @click="updateCourse(item.id)">修改</el-button>
  25. <el-button class="el_button_active" @click="openCourseDetail(item.id)">查看</el-button>
  26. </div>
  27. </div>
  28. </div>
  29. </el-col>
  30. </el-row>
  31. </div>
  32. <div v-if="currentData && currentData.xia.length > 0">
  33. <el-row :gutter="20">
  34. <el-col :span="6" v-for="item in currentData.xia" :key="item.title">
  35. <div class="grid-content ep-bg-purple">
  36. <img :src="getImageUrl(item.url)" alt="">
  37. <div class="course_content">
  38. <div class="div_title">
  39. <span>下册</span>
  40. {{ item.title }}
  41. <!-- <el-popover placement="bottom" :width="200" trigger="click" show-after="1000">
  42. <template #reference>
  43. <img :src="DownloadImg" alt="" @click="getDate(item.id)">
  44. </template>
  45. <div>
  46. <div>
  47. <span>资源列表({{ item.data.length }})</span>
  48. <el-checkbox v-model="checked1" label="全选" size="large" @click="checkedAll(item.id)" />
  49. </div>
  50. <div v-if="item.data.length>0">
  51. <div v-for="dataitem in item.data" :key="dataitem.id">
  52. {{ dataitem }}
  53. <img :src="PDFImg" alt="">
  54. <span>资料下载</span>
  55. <img :src="DownloadImg" alt="">
  56. </div>
  57. </div>
  58. <div v-else>
  59. 暂无数据
  60. </div>
  61. </div>
  62. </el-popover> -->
  63. </div>
  64. </div>
  65. <div class="class_button" v-if="isupdateCourse">
  66. <el-button style="width: 30%;background: rgba(240, 242, 245, 1);color: rgba(0, 0, 0, 0.6);"
  67. @click="ReductionCourse(item.id)">还原</el-button>
  68. <el-button style="width: 30%;background: #fff" @click="updateCourse(item.id)">修改</el-button>
  69. <el-button style="width: 30%;" class="el_button_active" @click="openCourseDetail(item.id)">查看</el-button>
  70. </div>
  71. </div>
  72. </el-col>
  73. </el-row>
  74. </div>
  75. </div>
  76. <el-dialog v-model="dialogVisible" :before-close="handleClose" width=500>
  77. <template #header>
  78. <div class="dialog-header img_text_middle">
  79. <img :src="WarningImg" alt="">
  80. <span class="warning_text">操作警告</span>
  81. </div>
  82. </template>
  83. <span>启用还原功能将重置当前修改,并将课程内容恢复至标准版本。请确认是否继续执行相关操作。</span>
  84. <template #footer>
  85. <div class="dialog-footer">
  86. <el-button type="primary" @click="updateReduction()">
  87. 确认修改
  88. </el-button>
  89. <el-button @click="dialogVisible = false">取消</el-button>
  90. </div>
  91. </template>
  92. </el-dialog>
  93. </template>
  94. <script setup>
  95. import { ref, onMounted, watchEffect } from 'vue';
  96. import { userCurrentRole, userInfoStore } from '../../stores/counter'
  97. import DownloadImg from '@/assets/img/download.png'
  98. import PDFImg from '@/assets/img/PDF.png'
  99. import WarningImg from '@/assets/icon/icon.png'
  100. import san1 from '../../assets/img/三下1.png'
  101. import san2 from '@/assets/img/三下2.png'
  102. import san3 from '@/assets/img/三下3.png'
  103. import san4 from '@/assets/img/三下4.png'
  104. import si1 from '@/assets/img/四下1.png'
  105. import si2 from '@/assets/img/四下2.png'
  106. import si3 from '@/assets/img/四下3.png'
  107. import si4 from '@/assets/img/四下4.png'
  108. import wu1 from '@/assets/img/五下1.png'
  109. import wu2 from '@/assets/img/五下2.png'
  110. import wu3 from '@/assets/img/五下3.png'
  111. import wu4 from '@/assets/img/五下4.png'
  112. import liu1 from '@/assets/img/六下1.png'
  113. import liu2 from '@/assets/img/六下2.png'
  114. import liu3 from '@/assets/img/六下3.png'
  115. import liu4 from '@/assets/img/六下4.png'
  116. import qi1 from '@/assets/img/七下1.png'
  117. import qi2 from '@/assets/img/七下2.png'
  118. import qi3 from '@/assets/img/七下3.png'
  119. import qi4 from '@/assets/img/七下4.png'
  120. import ba1 from '@/assets/img/八下1.png'
  121. import ba2 from '@/assets/img/八下2.png'
  122. import ba3 from '@/assets/img/八下3.png'
  123. import ba4 from '@/assets/img/八下4.png'
  124. import { TRUE } from 'sass';
  125. const user = userInfoStore()
  126. const CurrentRole = userCurrentRole()
  127. const selectGrand = ref('三年级')
  128. const isupdateCourse = ref(false)
  129. const currentData = ref({
  130. shang: [
  131. ],
  132. xia: [
  133. {
  134. id: "8d4c47d5-ed72-11ee-b534-005056b86db5",
  135. title: "智能安防",
  136. url: "../../assets/img/三下1.png"
  137. }, {
  138. id: "8680f2e5-ed72-11ee-b534-005056b86db5",
  139. title: "人脸检测与识别",
  140. url: "../../assets/img/三下1.png"
  141. }, {
  142. id: "90fed959-ed72-11ee-b534-005056b86db5",
  143. title: "电子警察",
  144. url: "../../assets/img/三下1.png"
  145. }, {
  146. id: "d84245f0-ec02-11ee-b534-005056b86db5",
  147. title: "音频播报",
  148. url: "../../assets/img/三下1.png"
  149. },
  150. ]
  151. })
  152. const dialogVisible = ref(false)
  153. const updateReductionId = ref("")
  154. const checked1 = ref(false)
  155. const visible = ref(false)
  156. const courseData = {
  157. "三年级": {
  158. shang: [
  159. ],
  160. xia: [
  161. {
  162. id: "8d4c47d5-ed72-11ee-b534-005056b86db5",
  163. title: "初识人工智能",
  164. url: san1
  165. }, {
  166. id: "8680f2e5-ed72-11ee-b534-005056b86db5",
  167. title: "机器的眼睛",
  168. url: san2
  169. }, {
  170. id: "90fed959-ed72-11ee-b534-005056b86db5",
  171. title: "机器的耳朵",
  172. url: san3
  173. }, {
  174. id: "d84245f0-ec02-11ee-b534-005056b86db5",
  175. title: "音频播报",
  176. url: san4
  177. },
  178. ]
  179. },
  180. "四年级": {
  181. shang: [
  182. ],
  183. xia: [
  184. {
  185. id: "2a4a7d77-ed73-11ee-b534-005056b86db5",
  186. title: "人工智能进阶",
  187. url: si1
  188. }, {
  189. id: "29120fad-ed73-11ee-b534-005056b86db5",
  190. title: "情绪识别",
  191. url: si2
  192. }, {
  193. id: "283d7d77-ed73-11ee-b534-005056b86db5",
  194. title: "情绪小怪兽",
  195. url: si3
  196. }, {
  197. id: "274ad423-ed73-11ee-b534-005056b86db5",
  198. title: "灯光交互",
  199. url: si4
  200. },
  201. ]
  202. },
  203. "五年级": {
  204. shang: [
  205. ],
  206. xia: [
  207. {
  208. id: "dbff4503-ed72-11ee-b534-005056b86db5",
  209. title: "游戏与生活概率",
  210. url: wu1
  211. }, {
  212. id: "db1ece3b-ed72-11ee-b534-005056b86db5",
  213. title: "手势识别",
  214. url: wu2
  215. }, {
  216. id: "d98c8624-ed72-11ee-b534-005056b86db5",
  217. title: "猜拳机器人",
  218. url: wu3
  219. }, {
  220. id: "d7f54a65-ed72-11ee-b534-005056b86db5",
  221. title: "猜拳大战",
  222. url: wu4
  223. },
  224. ]
  225. },
  226. "六年级": {
  227. shang: [
  228. ],
  229. xia: [
  230. {
  231. id: "a56bb310-ed73-11ee-b534-005056b86db5",
  232. title: "人脸检测知多少",
  233. url: liu1
  234. }, {
  235. id: "a4aaba64-ed73-11ee-b534-005056b86db5",
  236. title: "人脸检测全流程",
  237. url: liu2
  238. }, {
  239. id: "a06a3cda-ed73-11ee-b534-005056b86db5",
  240. title: "人脸检测功能实现",
  241. url: liu3
  242. }, {
  243. id: "9ed59589-ed73-11ee-b534-005056b86db5",
  244. title: "人脸追踪向日葵功能实现",
  245. url: liu4
  246. },
  247. ]
  248. },
  249. "七年级": {
  250. shang: [
  251. ],
  252. xia: [
  253. {
  254. id: "8698d3c0-ed73-11ee-b534-005056b86db5",
  255. title: "机器学习",
  256. url: qi1
  257. }, {
  258. id: "84c7c1a1-ed73-11ee-b534-005056b86db5",
  259. title: "萌宠生活(一)",
  260. url: qi2
  261. }, {
  262. id: "88b0ce2a-ed73-11ee-b534-005056b86db5",
  263. title: "萌宠生活(二)",
  264. url: qi3
  265. }, {
  266. id: "8741cd4a-ed73-11ee-b534-005056b86db5",
  267. title: "萌宠生活(三)",
  268. url: qi4
  269. },
  270. ]
  271. },
  272. "八年级": {
  273. shang: [
  274. ],
  275. xia: [
  276. {
  277. id: "c29cf14a-ed72-11ee-b534-005056b86db5",
  278. title: "探秘人工智能",
  279. url: ba1
  280. }, {
  281. id: "c1bc1265-ed72-11ee-b534-005056b86db5",
  282. title: "无所不在的人工智能",
  283. url: ba2
  284. }, {
  285. id: "c0d7053f-ed72-11ee-b534-005056b86db5",
  286. title: "机器翻译鸟(上)",
  287. url: ba3
  288. }, {
  289. id: "bd49ea05-ed72-11ee-b534-005056b86db5",
  290. title: "机器翻译鸟(下)",
  291. url: ba4
  292. },
  293. ]
  294. }
  295. }
  296. onMounted(() => {
  297. // for (let i = 0; i < courseData["三年级"].xia.length; i++) {
  298. // let o = courseData["三年级"].xia[i]
  299. // courseData["三年级"].xia[i].data = getDate(o.id)
  300. // }
  301. getDate("bd49ea05-ed72-11ee-b534-005056b86db5")
  302. currentData.value = courseData["三年级"]
  303. })
  304. const clickGrand = val => {
  305. selectGrand.value = val
  306. currentData.value = courseData[val]
  307. }
  308. const getImageUrl = (url) => {
  309. return new URL(url, import.meta.url).href
  310. }
  311. const openCourseDetail = (id) => {
  312. console.log(user.user)
  313. // 会返回复制得课程
  314. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseSz", [id], function (res) {
  315. console.log(res)
  316. if (res.value[0].length > 0) {
  317. // let isSave = res.value[0].filter(x => {
  318. // return x.courseId == id
  319. // })
  320. //这个是打开指定的课程接口
  321. top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 2, user.user.type);
  322. } else {
  323. updateCourseId(id, "studyDetail")
  324. }
  325. }, [], { "type": "POST", "withCredentials": true });
  326. }
  327. const updateCourse = id => {
  328. // 会返回courseId和state 两个参数 然后打开
  329. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseSz", [id], function (res) {
  330. console.log(res)
  331. if (res.value[0].length > 0) {
  332. // let isSave = res.value[0].filter(x => {
  333. // return x.courseId == id
  334. // })
  335. top.U.MD.D.I.openInApplication('openCourseNewUpdate', res.value[0][0].courseId); //这个是打开指定的课程接口
  336. } else {
  337. updateCourseId(id, "openCourseNewUpdate")
  338. }
  339. }, [], { "type": "POST", "withCredentials": true });
  340. }
  341. const updateCourseId = (id, type) => {
  342. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/copyCourseSz", [id, user.user.userid], function (res) {
  343. console.log(res)
  344. if (res.value[0][0].courseId != "") {
  345. if (type == "openCourseNewUpdate") {
  346. top.U.MD.D.I.openInApplication("openCourseNewUpdate", res.value[0][0].courseId)
  347. } else {
  348. top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 3, user.user.type);
  349. }
  350. }
  351. }, [], { "type": "POST", "withCredentials": true });
  352. }
  353. const ReductionCourse = id => {
  354. // updateReductionId.value = id
  355. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseSz", [id], function (res) {
  356. console.log(res)
  357. if (res.value[0].length > 0) {
  358. // let isSave = res.value[0].filter(x => {
  359. // return x.courseId == id
  360. // })
  361. dialogVisible.value = true
  362. updateReductionId.value = res.value[0][0].courseId
  363. } else {
  364. ElMessage({
  365. message: '该课程就是最初课程,不能还原',
  366. type: 'warning',
  367. })
  368. }
  369. }, [], { "type": "POST", "withCredentials": true });
  370. }
  371. const updateReduction = () => {
  372. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/revertCourseSz", [updateReductionId.value], function (res) {
  373. console.log(res, "还原")
  374. dialogVisible.value = false
  375. }, [], { "type": "POST", "withCredentials": true });
  376. }
  377. const getDate = id => {
  378. console.log(id)
  379. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", [id], function (res) {
  380. console.log(res)
  381. }, [], { "type": "POST", "withCredentials": true });
  382. }
  383. const checkedAll = (id) => {
  384. console.log(id, checked1.value)
  385. // checked1.value = true
  386. }
  387. // 获取课程下载资料
  388. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", ['课程id'], function (res) {}, [], { "type": "POST", "withCredentials": true });
  389. watchEffect(() => {
  390. if (JSON.stringify(user.user) != "{}") {
  391. if (CurrentRole.currentRole == "edupersonnel" || CurrentRole.currentRole == "areaAdministrator" || CurrentRole.currentRole == "userAdministrator" || CurrentRole.currentRole == "securityAuditor" || CurrentRole.currentRole == "schoolAdministrator" || CurrentRole.currentRole == "schoolSecurityAuditor" || CurrentRole.currentRole == "teacher" || user.user.type != 2) {
  392. isupdateCourse.value = true
  393. }
  394. }
  395. })
  396. </script>
  397. <style lang="scss" scoped>
  398. .course_select {
  399. margin-top: 10px;
  400. .grid-content {
  401. border-radius: 4px;
  402. min-height: 36px;
  403. background: #fff;
  404. padding: 12px;
  405. // height: 300px;
  406. img {
  407. width: 100%;
  408. border-radius: 5px;
  409. }
  410. .course_content {
  411. .div_title {
  412. margin-top: 10px;
  413. span {
  414. // display: inline-block;
  415. padding: 2px 8px;
  416. background: rgba(224, 234, 251, 1);
  417. border-radius: 5px;
  418. font-size: 12px;
  419. color: rgba(54, 129, 252, 1);
  420. }
  421. img {
  422. width: 28px;
  423. cursor: pointer;
  424. float: right;
  425. }
  426. }
  427. }
  428. }
  429. .Screening {
  430. font-size: 20px;
  431. font-weight: 400;
  432. line-height: 28px;
  433. letter-spacing: 0em;
  434. text-align: center;
  435. color: rgba(0, 0, 0, 0.9);
  436. }
  437. .grandTitle {
  438. font-size: 20px;
  439. font-weight: 400;
  440. line-height: 28px;
  441. letter-spacing: 0em;
  442. text-align: center;
  443. }
  444. .el-button {
  445. // background: rgba(54, 129, 252, 1);
  446. color: rgba(54, 129, 252, 1);
  447. }
  448. .el_button_active {
  449. background: rgba(54, 129, 252, 1);
  450. color: #fff;
  451. }
  452. .class_button {
  453. margin-top: 15px;
  454. display: flex;
  455. justify-content: space-between;
  456. }
  457. }
  458. .el-row {
  459. margin-top: 20px;
  460. margin-bottom: 20px;
  461. }
  462. .el-row:last-child {
  463. margin-bottom: 0;
  464. }
  465. .el-col {
  466. border-radius: 4px;
  467. }
  468. .warning_text {
  469. font-weight: bold;
  470. font-size: 16px;
  471. color: rgba(0, 0, 0, 0.9);
  472. margin-left: 8px;
  473. }
  474. </style>