courseSelect.vue 13 KB

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