courseSelect.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026
  1. <template>
  2. <h2 class="contentTitle" v-if="classDown">
  3. <div class="Levelone">
  4. {{ lang.lang == 'hk' ? lang.ssAiTeachRes : lang.ssCourseList }}
  5. </div>
  6. </h2>
  7. <div class="grandTitle2" v-if="lang.lang != 'hk'">{{ lang.ssAiGeneral }}</div>
  8. <div class="course_select" v-if="lang.lang != 'hk'">
  9. <span class="grandTitle">{{ lang.ssCourseType }}</span>
  10. <el-button v-for="item in yearList"
  11. :key="item.value" :class="activeyear == item.value ? 'el_button_active' : ''"
  12. @click="clickYear(item.value)">{{ item.label }}</el-button>
  13. <!-- <el-button :class="!courseTypeShow ? 'el_button_active' : ''" @click="SwitchCourseType(false)">AI通识课2024版</el-button> -->
  14. </div>
  15. <div class="course_select">
  16. <span class="grandTitle">{{ lang.ssGrade }}</span>
  17. <el-button
  18. v-for="item in classList" :key="item.value"
  19. :class="activegrade == item.value ? 'el_button_active' : ''"
  20. @click="clickGrand(item.value)">
  21. {{ item.label }}
  22. </el-button>
  23. </div>
  24. <div class="course_select">
  25. <template v-if="lang.lang != 'hk'">
  26. <span class="grandTitle">{{ lang.ssTerm }}</span>
  27. <el-button :class="activeterm == 0 ? 'el_button_active' : ''" @click="activeterm = 0,getCourseList()">{{ lang.ssTermUp }}</el-button>
  28. <el-button :class="activeterm == 1 ? 'el_button_active' : ''"
  29. @click="activeterm = 1,getCourseList()">{{ lang.ssTermDown }}</el-button>
  30. </template>
  31. <!-- 课程上下册区域 -->
  32. <div v-loading="courseLoading">
  33. <el-row :gutter="20" v-if="activeCurrentData.length > 0">
  34. <el-col :span="6" v-for="item in activeCurrentData" :key="item.id" style="margin-top: 10px;">
  35. <div class="grid-content ep-bg-purple">
  36. <img :src="getImageUrl(item.json.url)" alt="">
  37. <div class="course_content">
  38. <div class="div_title">
  39. <span v-if="lang.lang != 'hk'">{{ lang.ssTermUp }}</span>
  40. <el-tooltip class="item" effect="dark" :content="item.json.title" placement="top">
  41. <div class="div_title_text">{{ item.json.title }}</div>
  42. </el-tooltip>
  43. <!-- v-if="isupdateCourse" -->
  44. <!-- v-if="isupdateCourse && item.courseType == '1'" -->
  45. <el-popover v-if="isupdateCourse" placement="bottom" :width="210"
  46. trigger="click" :show-after="500" @hide="checked1 = false">
  47. <template #reference>
  48. <img :src="DownloadImg" v-if="item.json.courseType == '2'" alt="">
  49. <img :src="DownloadImg" v-else alt="" @click="getDate(item.json.dataId)">
  50. </template>
  51. <div>
  52. <div>
  53. <span>{{ lang.ssResList.replace(/\*/g, item.json.dataList.length) }}</span>
  54. <el-checkbox style="position: relative;top: 0;left: 35px;height: 30px;" v-model="checked1"
  55. :label="lang.ssSelectAll" size="large" @click="checkedAll(item.json.dataId)" />
  56. </div>
  57. <div v-if="item.json.dataList.length > 0">
  58. <div class="div_hover" v-for="dataitem in item.json.dataList" :key="dataitem.dataId">
  59. <span style="display: inline-block;width: 130px;" :title="dataitem.name">{{
  60. dataitem.name.length > 10 ?
  61. dataitem.name.substring(0, 8) + '...' : dataitem.name }}</span>
  62. <span v-if="!checked1" class="el_popover_a" style="position: relative;left: 20px;top: 5px;"
  63. @click="downloadOne(dataitem.url, dataitem.name)">
  64. <img :src="DownloadImg" alt="">
  65. </span>
  66. <el-checkbox v-if="checked1" v-model="dataitem.checked" :label="lang.ssSelectAll" size="large" />
  67. </div>
  68. <el-button style="margin-top: 10px;" v-if="checked1"
  69. @click="DownloadProcessing()">{{ lang.ssBatchDown }}</el-button>
  70. </div>
  71. <div v-else>
  72. {{ lang.ssNoData }}
  73. </div>
  74. </div>
  75. </el-popover>
  76. </div>
  77. </div>
  78. <div class="class_button" v-if="isupdateCourse">
  79. <!-- <el-popover v-if="item.courseType == '1'" placement="bottom" trigger="hover">
  80. <template #reference> -->
  81. <el-button
  82. @click="getCourseid(item.json.id)"
  83. style="width: 50%;background: rgba(255, 255, 245, 1);color: rgba(0, 0, 0, 0.6);">
  84. {{ lang.ssPrep }}</el-button>
  85. <!-- </template>
  86. <ul class="beike">
  87. <li @click="openCourseDetail(item.id)">查看</li>
  88. <li @click="updateCourse(item.id, item)">修改</li>
  89. <li @click="ReductionCourse(item.id)">还原</li>
  90. </ul>
  91. </el-popover> -->
  92. <el-button style="width: 50%;" class="el_button_active"
  93. @click="openCourseDetail(item.json.id, item.json)">{{ lang.ssInClass }}</el-button>
  94. </div>
  95. </div>
  96. </el-col>
  97. </el-row>
  98. <div v-else>
  99. <el-empty :description="lang.ssNoCrsGrdTip" />
  100. </div>
  101. </div>
  102. <!-- <div v-if="currentData && currentData.xia.length > 0 && !volumes">
  103. <el-row :gutter="20">
  104. <el-col :span="6" v-for="item in currentData.xia" :key="item.title" style="margin-top: 10px;">
  105. <div class="grid-content ep-bg-purple">
  106. <img :src="getImageUrl(item.url)" alt="">
  107. <div class="course_content">
  108. <div class="div_title" style="">
  109. <span>下册</span>
  110. <el-tooltip class="item" effect="dark" :content="item.title" placement="top">
  111. <div class="div_title_text">{{ item.title }}</div>
  112. </el-tooltip>
  113. <el-popover v-if="isupdateCourse" placement="bottom" :width="210"
  114. trigger="click" :show-after="500" @hide="checked1 = false">
  115. <template #reference>
  116. <img :src="DownloadImg" v-if="item.courseType == '2'" alt="">
  117. <img :src="DownloadImg" v-else alt="" @click="getDate(item.dataId)">
  118. </template>
  119. <div>
  120. <div>
  121. <span>资源列表({{ item.dataList.length }})</span>
  122. <el-checkbox style="position: relative;top: 0;left: 35px;height: 30px;" v-model="checked1"
  123. label="全选" size="large" @click="checkedAll(item.dataId)" />
  124. </div>
  125. <div v-if="item.dataList.length > 0">
  126. <div class="div_hover" v-for="dataitem in item.dataList" :key="dataitem.dataId">
  127. <span style="display: inline-block;width: 130px;" :title="dataitem.name">{{
  128. dataitem.name.length > 10 ?
  129. dataitem.name.substring(0, 8) + '...' : dataitem.name }}</span>
  130. <span v-if="!checked1" class="el_popover_a" style="position: relative;left: 20px;top: 5px;"
  131. @click="downloadOne(dataitem.url, dataitem.name)">
  132. <img :src="DownloadImg" alt="">
  133. </span>
  134. <el-checkbox v-if="checked1" v-model="dataitem.checked" label="全选" size="large" />
  135. </div>
  136. <el-button style="margin-top: 10px;" v-if="checked1"
  137. @click="DownloadProcessing()">批量下载</el-button>
  138. </div>
  139. <div v-else>
  140. 暂无数据
  141. </div>
  142. </div>
  143. </el-popover>
  144. </div>
  145. </div>
  146. <div class="class_button" v-if="isupdateCourse">
  147. <el-button
  148. @click="getCourseid(item.id)"
  149. style="width: 50%;background: rgba(255, 255, 245, 1);color: rgba(0, 0, 0, 0.6);">
  150. 备课</el-button>
  151. <el-button style="width: 50%;" class="el_button_active"
  152. @click="openCourseDetail(item.id, item)">上课</el-button>
  153. </div>
  154. </div>
  155. </el-col>
  156. </el-row>
  157. </div> -->
  158. </div>
  159. <template v-if="false">
  160. <div style="margin-top: 20px;">
  161. <span class="grandTitle2" v-if="gotype.gotype == 'bjs'">人工智能竞赛课</span>
  162. <span class="grandTitle2" v-else>竞赛主题课程</span>
  163. </div>
  164. <div class="course_select">
  165. <span class="grandTitle">课程类型:</span>
  166. <el-button @click="cutmod(0)" :class="[cutmodpage == 0 ? 'el_button_active' :'']">
  167. <span v-if="gotype.gotype == 'bjs'">智能体课程</span>
  168. <span v-else>智能体设计与应用课程</span>
  169. </el-button>
  170. <el-button @click="cutmod(1)" :class="[cutmodpage == 1 ? 'el_button_active' :'']">
  171. <span>创意智造课程</span>
  172. </el-button>
  173. <!-- <el-button :class="!courseTypeShow ? 'el_button_active' : ''" @click="SwitchCourseType(false)">AI通识课2024版</el-button> -->
  174. </div>
  175. <div class="course_select">
  176. <span class="grandTitle">模块:</span>
  177. <el-button :class="selectmod == '模块一' ? 'el_button_active' : ''" @click="clickmod('模块一')">模块一</el-button>
  178. <el-button v-if="cutmodpage == 0" :class="selectmod == '模块二' ? 'el_button_active' : ''" @click="clickmod('模块二')">模块二</el-button>
  179. <el-button v-if="cutmodpage == 0" :class="selectmod == '模块三' ? 'el_button_active' : ''" @click="clickmod('模块三')">模块三</el-button>
  180. <el-button v-if="gotype.gotype == 'bjs' && cutmodpage == 0" :class="selectmod == '模块四' ? 'el_button_active' : ''" @click="clickmod('模块四')">模块四</el-button>
  181. </div>
  182. <div class="course_select" v-if="gotype.gotype == 'bjs' && cutmodpage == 0">
  183. <div v-if="currentmodData && currentmodData.shang.length > 0">
  184. <el-row :gutter="20">
  185. <el-col :span="6" v-for="item in currentmodData.shang" :key="item.title" style="margin-top: 10px;">
  186. <div class="grid-content ep-bg-purple">
  187. <img :src="getImageUrl(item.url)" alt="">
  188. <div class="course_content">
  189. <div class="div_title">
  190. <el-tooltip class="item" effect="dark" :content="item.title" placement="top">
  191. <div class="div_title_text">{{ item.title }}</div>
  192. </el-tooltip>
  193. </div>
  194. </div>
  195. <div class="class_button" v-if="isupdateCourse">
  196. <el-button :style="item.courseType == '1' ? 'width: 50%;' : 'width: 100%;'" class="el_button_active"
  197. @click="openCourseDetail(item.id, item)">上课</el-button>
  198. </div>
  199. </div>
  200. </el-col>
  201. </el-row>
  202. </div>
  203. </div>
  204. <div class="course_select" v-if="cutmodpage == 1">
  205. <div v-if="currentAI6TwoData && currentAI6TwoData.shang.length > 0">
  206. <el-row :gutter="20">
  207. <el-col :span="6" v-for="item in currentAI6TwoData.shang" :key="item.title" style="margin-top: 10px;">
  208. <div class="grid-content ep-bg-purple">
  209. <img :src="getImageUrl(item.url)" alt="">
  210. <div class="course_content">
  211. <div class="div_title">
  212. <el-tooltip class="item" effect="dark" :content="item.title" placement="top">
  213. <div class="div_title_text">{{ item.title }}</div>
  214. </el-tooltip>
  215. </div>
  216. </div>
  217. <div class="class_button" v-if="isupdateCourse">
  218. <el-button :style="item.courseType == '1' ? 'width: 50%;' : 'width: 100%;'" class="el_button_active"
  219. @click="openCourseDetail(item.id, item)">上课</el-button>
  220. </div>
  221. </div>
  222. </el-col>
  223. </el-row>
  224. </div>
  225. </div>
  226. <div class="course_select" v-if="gotype.gotype != 'bjs' && cutmodpage == 0">
  227. <div v-if="currentAI6Data && currentAI6Data.shang.length > 0">
  228. <el-row :gutter="20">
  229. <el-col :span="6" v-for="item in currentAI6Data.shang" :key="item.title" style="margin-top: 10px;">
  230. <div class="grid-content ep-bg-purple">
  231. <img :src="getImageUrl(item.url)" alt="">
  232. <div class="course_content">
  233. <div class="div_title">
  234. <el-tooltip class="item" effect="dark" :content="item.title" placement="top">
  235. <div class="div_title_text">{{ item.title }}</div>
  236. </el-tooltip>
  237. </div>
  238. </div>
  239. <div class="class_button" v-if="isupdateCourse">
  240. <el-button :style="item.courseType == '1' ? 'width: 50%;' : 'width: 100%;'" class="el_button_active"
  241. @click="openCourseDetail(item.id, item)">上课</el-button>
  242. </div>
  243. </div>
  244. </el-col>
  245. </el-row>
  246. </div>
  247. </div>
  248. </template>
  249. <el-dialog v-model="dialogVisible" :before-close="handleClose" width=500>
  250. <template #header>
  251. <div class="dialog-header img_text_middle">
  252. <img :src="WarningImg" alt="">
  253. <span class="warning_text">操作警告</span>
  254. </div>
  255. </template>
  256. <span>启用还原功能将重置当前修改,并将课程内容恢复至标准版本。请确认是否继续执行相关操作。</span>
  257. <template #footer>
  258. <div class="dialog-footer">
  259. <el-button type="primary" @click="updateReduction()">
  260. 确认修改
  261. </el-button>
  262. <el-button @click="dialogVisible = false">取消</el-button>
  263. </div>
  264. </template>
  265. </el-dialog>
  266. <selectTeachingClassDialog
  267. ref="DialogRef" />
  268. </template>
  269. <script setup>
  270. import { ref, onMounted, watchEffect, inject } from 'vue';
  271. import { userCurrentRole, userInfoStore, userCurrent,pageGotype } from '../../stores/counter'
  272. // import JSZip from 'jszip';
  273. // import { saveAs } from 'file-saver';
  274. import DownloadImg from '@/assets/img/download.png'
  275. // import PDFImg from '@/assets/img/PDF.png'
  276. import WarningImg from '@/assets/icon/icon.png'
  277. import courseDataJson from '@/assets/course.json'
  278. import selectTeachingClassDialog from '../dialog/selectTeachingClassDialog.vue'
  279. // import { Value } from 'sass';
  280. // import { dataType } from 'element-plus/es/components/table-v2/src/common';
  281. import axios from 'axios';
  282. const lang = inject('lang')
  283. const props = defineProps({
  284. classDown: {
  285. type: Boolean,
  286. default: true
  287. }
  288. })
  289. const volumes = ref(false)
  290. const user = userInfoStore()
  291. const CurrentRole = userCurrentRole()
  292. const Current = userCurrent()
  293. const selectGrand = ref(lang.ssGradeThree)
  294. const selectmod = ref(lang.ssModuleOne)
  295. const gotype = pageGotype()
  296. const classList = ref(lang.lang != 'hk' ? [
  297. {value: 3, label: lang.ssGradeThree},
  298. {value: 4, label: lang.ssGradeFour},
  299. {value: 5, label: lang.ssGradeFive},
  300. {value: 6, label: lang.ssGradeSix},
  301. {value: 7, label: lang.ssGradeSeven},
  302. {value: 8, label: lang.ssGradeEight},
  303. {value: 9, label: lang.ssGradeNine}
  304. ] : [
  305. {value: 4, label: lang.ssGradeFour},
  306. {value: 5, label: lang.ssGradeFive},
  307. {value: 6, label: lang.ssGradeSix},
  308. {value: 7, label: lang.ssGradeSeven},
  309. {value: 8, label: lang.ssGradeEight},
  310. {value: 9, label: lang.ssGradeNine}
  311. ])
  312. const activeyear = ref(2025)
  313. const courseLoading = ref(false)
  314. const yearList = ref([
  315. {value: 2025, label: 'AI通识课2025版'},
  316. ])
  317. const clickYear = (val) => {
  318. activeyear.value = val
  319. getCourseList()
  320. }
  321. const isupdateCourse = ref(false)
  322. const currentData = ref(courseDataJson.new.三年级)
  323. const currentmodData = ref(courseDataJson.mod.模块一)
  324. const currentAI6Data = ref(courseDataJson.AI6one.模块一)
  325. const currentAI6TwoData = ref(courseDataJson.AI6Two.模块一)
  326. const cutmodpage = ref('0')
  327. const dialogVisible = ref(false)
  328. const updateReductionId = ref("")
  329. const checked1 = ref(false)
  330. // const visible = ref(false)
  331. const getUpdateCourseId = ref("")
  332. const courseTypeShow = ref(true) // old 旧版 new 纲要
  333. const setIntervalNum = ref(null)
  334. const DialogRef = ref(null)
  335. const courseData = ref(courseDataJson.new)
  336. const modData = ref(courseDataJson.mod)
  337. const AI6Data = ref(courseDataJson.AI6one)
  338. const AI6TwoData = ref(courseDataJson.AI6Two)
  339. const activegrade = ref(lang.lang != 'hk' ? '3' : '4')
  340. const activeterm = ref('1')
  341. const activeCurrentData = ref([])
  342. onMounted(() => {
  343. currentData.value = courseData.value["三年级"]
  344. getTimeCourse(1, 1)
  345. getCourseList() // 获取课程列表
  346. })
  347. const getCourseList = () => {
  348. courseLoading.value = true
  349. let params = {
  350. ter: activeterm.value,
  351. gra: activegrade.value,
  352. ar: lang.lang,
  353. typ: gotype.gotype == 'bjs' ? 0 : 0,
  354. yea: activeyear.value
  355. }
  356. axios.get('https://pbl.cocorobo.cn/api/pbl/selectaisixCourse', { params })
  357. .then(res => {
  358. // console.log(res);
  359. let data = res.data[0]
  360. data.forEach(item => {
  361. item.json = JSON.parse(item.json)
  362. })
  363. activeCurrentData.value = data
  364. courseLoading.value = false
  365. console.log('activeCurrentData.value',activeCurrentData.value);
  366. })
  367. .catch(err => {
  368. console.error(err);
  369. courseLoading.value = false
  370. });
  371. };
  372. const clickGrand = val => {
  373. activegrade.value = val
  374. getCourseList()
  375. // console.log('courseData.value',courseData.value);
  376. // currentData.value = courseData.value[val]
  377. }
  378. const handleClose =(done)=>{
  379. done()
  380. }
  381. const cutmod = (val) => {
  382. cutmodpage.value = val
  383. clickmod(selectmod.value)
  384. }
  385. const clickmod = val => {
  386. selectmod.value = val
  387. if (gotype.gotype === 'bjs' && cutmodpage.value == 0) {
  388. currentmodData.value = modData.value[val]
  389. } else if (cutmodpage.value == 1) {
  390. currentAI6TwoData.value = AI6TwoData.value[val]
  391. } else if (gotype.gotype != 'bjs' && cutmodpage.value == 0){
  392. currentAI6Data.value = AI6Data.value[val]
  393. }
  394. }
  395. // const SwitchCourseType = (val) => {
  396. // courseTypeShow.value = val
  397. // if (val) {
  398. // courseData.value = courseDataJson.new
  399. // volumes.value = true
  400. // } else {
  401. // courseData.value = courseDataJson.old
  402. // }
  403. // currentData.value = courseData.value[selectGrand.value]
  404. // }
  405. const getImageUrl = (url) => {
  406. return new URL(url, import.meta.url).href
  407. }
  408. // 新课备课 获取id
  409. const getCourseid = (id) => {
  410. // 会返回复制得课程
  411. let params ={id: id +','+ user.user.userid};
  412. axios.post('https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz', params, {
  413. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  414. withCredentials: true
  415. })
  416. .then(res => {
  417. console.log(res);
  418. console.log(res.data[0]);
  419. // console.log(res.data[0][0].courseId);
  420. if (res.data[0].length > 0) {
  421. DialogRef.value.getClasslist(res.data[0][0])
  422. } else {
  423. getCourseid2(id, "studyDetail")
  424. }
  425. })
  426. .catch(err=>{
  427. console.log(err);
  428. })
  429. }
  430. // 复制课程并获取id
  431. const getCourseid2 = (id, type) => {
  432. let params ={id: id +','+ user.user.userid};
  433. axios.post('https://pbl.cocorobo.cn/api/pbl/copyCourseSz', params, {
  434. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  435. withCredentials: true
  436. })
  437. .then(res => {
  438. console.log(res);
  439. // console.log(res.data[0][0].courseId);
  440. DialogRef.value.getClasslist(res.data[0][0])
  441. })
  442. .catch(err=>{
  443. console.log(err);
  444. })
  445. }
  446. const openCourseDetail = (id) => {
  447. console.log(user.user)
  448. axios.post('https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz', {id: id +','+ user.user.userid}, {
  449. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  450. withCredentials: true
  451. })
  452. .then(res => {
  453. console.log('openCourseDetail',res)
  454. if (res.data[0].length > 0) {
  455. // let isSave = res.value[0].filter(x => {
  456. // return x.courseId == id
  457. // })
  458. //这个是打开指定的课程接口
  459. let url = '';
  460. if (lang.lang == 'hk') {
  461. url = "https://pbl.cocorobo.hk"
  462. }else if (lang.lang == 'en') {
  463. url = "https://pbl.cocorobo.com"
  464. }else{
  465. url = "https://pbl.cocorobo.cn"
  466. }
  467. // https://pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?userid=0c3735c9-a2ef-11ef-9b30-005056b86db5&oid=414f2361-ad04-11ed-b13d-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5&courseId=91886917-2f3b-11f1-bcd9-005056924926&tType=1&cid=&screenType=2
  468. let url2 = `${url}/pbl-student-table/dist/#/courseDetail?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&courseId=${res.data[0][0].courseId}&tType=1&cid=&screenType=2`
  469. console.log(url2, "url2")
  470. // top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 2, user.user.type);
  471. top.U.MD.D.I.openInApplication('setUrl',{url:url2,title:'课程详情',id:new Date().getTime()})
  472. } else {
  473. updateCourseId(id, "studyDetail")
  474. }
  475. })
  476. .catch(err => {
  477. console.log(err)
  478. })
  479. // 会返回复制得课程
  480. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
  481. // console.log(res)
  482. // if (res.value[0].length > 0) {
  483. // // let isSave = res.value[0].filter(x => {
  484. // // return x.courseId == id
  485. // // })
  486. // //这个是打开指定的课程接口
  487. // let url = '';
  488. // if (lang.lang == 'hk') {
  489. // url = "https://pbl.cocorobo.hk"
  490. // }else if (lang.lang == 'en') {
  491. // url = "https://pbl.cocorobo.com"
  492. // }else{
  493. // url = "https://pbl.cocorobo.cn"
  494. // }
  495. // // https://pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?userid=0c3735c9-a2ef-11ef-9b30-005056b86db5&oid=414f2361-ad04-11ed-b13d-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5&courseId=91886917-2f3b-11f1-bcd9-005056924926&tType=1&cid=&screenType=2
  496. // let url2 = `${url}/pbl-student-table/dist/#/courseDetail?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&courseId=${res.value[0][0].courseId}&tType=1&cid=&screenType=2`
  497. // // top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 2, user.user.type);
  498. // top.U.MD.D.I.openInApplication('setUrl',{url:url2,title:'课程详情',id:new Date().getTime()})
  499. // } else {
  500. // updateCourseId(id, "studyDetail")
  501. // }
  502. // }, [], { "type": "POST", "withCredentials": true });
  503. }
  504. const getTimeCourse = (id, item) => {
  505. if (setIntervalNum.value) {
  506. clearInterval(setIntervalNum.value)
  507. }
  508. try {
  509. setIntervalNum.value = setInterval(() => {
  510. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, id, '5', 30], function (res) {
  511. console.log(res, "22222222222222222");
  512. }, [], { "type": "POST", "withCredentials": true });
  513. }, 30000)
  514. } catch (e) {
  515. console.log(e)
  516. }
  517. //
  518. const middleTime = Math.random() * 2 + 6;
  519. const interValtTime = Math.floor(middleTime * 60) * 1000 + 30000;
  520. const params = {
  521. serverName: "深教AI6",
  522. dataType: 0,
  523. teacherName: user.user.name,
  524. teacherAccount: "",
  525. eduId: userInfo.user.eduid || userInfo.user.sessionid,
  526. schoolName: user.user.schoolName,
  527. schoolType: "",
  528. area: "",
  529. coursePackageName: "AI课程",
  530. courseId: id,
  531. courseName: item.title,
  532. courseGrade: selectGrand.value,
  533. courseTime: Math.round(middleTime),
  534. startTime: new Date().toLocaleString().replace(/\//g, "-"),
  535. endTime: "",
  536. }
  537. setTimeout(() => {
  538. params.endTime = new Date().toLocaleString().replace(/\//g, "-")
  539. console.log(params, interValtTime)
  540. axios.post("//pbl.cocorobo.cn/api/szdjg/sync/class", JSON.stringify(params), {
  541. headers: {
  542. 'Content-Type': 'application/json'
  543. }
  544. }).then(res => {
  545. console.log(res)
  546. })
  547. }, interValtTime);
  548. }
  549. // const updateCourse = (id, item) => {
  550. // // 会返回courseId和state 两个参数 然后打开
  551. // getTimeCourse(id, item)
  552. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
  553. // console.log(res)
  554. // if (res.value[0].length > 0) {
  555. // // let isSave = res.value[0].filter(x => {
  556. // // return x.courseId == id
  557. // // })
  558. // top.U.MD.D.I.openInApplication('openCourseNewUpdate', res.value[0][0].courseId); //这个是打开指定的课程接口
  559. // } else {
  560. // updateCourseId(id, "openCourseNewUpdate")
  561. // }
  562. // }, [], { "type": "POST", "withCredentials": true });
  563. // }
  564. const updateCourseId = (id, type) => {
  565. axios.post('https://pbl.cocorobo.cn/api/pbl/copyCourseSz', {id: id +','+ user.user.userid}, {
  566. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  567. withCredentials: true
  568. })
  569. .then(res => {
  570. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/copyCourseSz", [id, user.user.userid], function (res) {
  571. console.log(res)
  572. if (res.data[0][0].courseId != "") {
  573. if (type == "openCourseNewUpdate") {
  574. top.U.MD.D.I.openInApplication("openCourseNewUpdate", res.data[0][0].courseId)
  575. } else {
  576. let url = '';
  577. if (lang.lang == 'hk') {
  578. url = "https://pbl.cocorobo.hk"
  579. }else if (lang.lang == 'en') {
  580. url = "https://pbl.cocorobo.com"
  581. }else{
  582. url = "https://pbl.cocorobo.cn"
  583. }
  584. // https://pbl.cocorobo.cn/pbl-student-table/dist/#/courseDetail?userid=0c3735c9-a2ef-11ef-9b30-005056b86db5&oid=414f2361-ad04-11ed-b13d-005056b86db5&org=0fec3a8a-ad04-11ed-b13d-005056b86db5&courseId=91886917-2f3b-11f1-bcd9-005056924926&tType=1&cid=&screenType=2
  585. let url2 = `${url}/pbl-student-table/dist/#/courseDetail?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&courseId=${res.data[0][0].courseId}&tType=1&cid=&screenType=2`
  586. // top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 2, user.user.type);
  587. top.U.MD.D.I.openInApplication('setUrl',{url:url2,title:'课程详情',id:new Date().getTime()})
  588. // top.U.MD.D.I.openInApplication("studyDetail", res.value[0][0].courseId, 3, user.user.type);
  589. }
  590. }
  591. })
  592. .catch(err => {
  593. console.log(err)
  594. })
  595. }
  596. // const ReductionCourse = id => {
  597. // // updateReductionId.value = id
  598. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/getcopyCourseByUseridSz", [id, user.user.userid], function (res) {
  599. // console.log(res)
  600. // if (res.value[0].length > 0) {
  601. // // let isSave = res.value[0].filter(x => {
  602. // // return x.courseId == id
  603. // // })
  604. // dialogVisible.value = true
  605. // updateReductionId.value = res.value[0][0].courseId
  606. // } else {
  607. // ElMessage({
  608. // message: '该课程就是最初课程,不能还原',
  609. // type: 'warning',
  610. // })
  611. // }
  612. // }, [], { "type": "POST", "withCredentials": true });
  613. // }
  614. const updateReduction = () => {
  615. axios.post('https://pbl.cocorobo.cn/api/pbl/revertCourseSz', {id: updateReductionId.value}, {
  616. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  617. withCredentials: true
  618. })
  619. .then(res => {
  620. console.log(res, "还原")
  621. dialogVisible.value = false
  622. })
  623. .catch(err => {
  624. console.log(err, "还原")
  625. dialogVisible.value = false
  626. });
  627. }
  628. const getDate = async (id) => {
  629. // currentData
  630. let dataList = [];
  631. return new Promise((resolve, reject) => {
  632. axios.post('https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz', {id: id}, {
  633. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  634. withCredentials: true
  635. })
  636. .then(res => {
  637. console.log(res);
  638. console.log(res);
  639. if (!res || !res.data || res.data[0].length === 0 || res.data[0][0].chapters.length === 0) {
  640. reject(new Error("Invalid response or no chapters found"));
  641. return;
  642. }
  643. const datachapters = JSON.parse(res.data[0][0].chapters);
  644. for (let i = 0; i < datachapters.length; i++) {
  645. const data = datachapters[i];
  646. for (let j = 0; j < data.chapterInfo.length; j++) {
  647. const dataChapterInfo = data.chapterInfo[j];
  648. for (let k = 0; k < dataChapterInfo.taskJson.length; k++) {
  649. const DatahapterData = dataChapterInfo.taskJson[k];
  650. for (let l = 0; l < DatahapterData.chapterData.length; l++) {
  651. const obj = DatahapterData.chapterData[l];
  652. obj.checked = false;
  653. dataList.push(obj);
  654. }
  655. }
  656. }
  657. }
  658. resolve(dataList);
  659. })
  660. .catch(err => {
  661. console.error("Error fetching data:", err);
  662. });
  663. })
  664. .then((dataList) => {
  665. getUpdateCourse(dataList, id);
  666. })
  667. .catch((error) => {
  668. console.error("Error fetching data:", error);
  669. });
  670. };
  671. const getUpdateCourse = async (dataList, id) => {
  672. let m = currentData.value
  673. if (volumes.value) {
  674. await m.shang.map(x => {
  675. if (x.dataId == id) {
  676. x.dataList = dataList
  677. }
  678. return x
  679. })
  680. } else {
  681. await m.xia.map(x => {
  682. if (x.dataId == id) {
  683. x.dataList = dataList
  684. }
  685. return x
  686. })
  687. }
  688. currentData.value = m
  689. getUpdateCourseId.value = id
  690. }
  691. const checkedAll = (id) => {
  692. let data = currentData.value
  693. if (volumes.value) {
  694. data.shang.map(x => {
  695. x.dataList.map(y => {
  696. y.checked = false
  697. })
  698. })
  699. data.shang.map(x => {
  700. if (x.dataId == id) {
  701. x.dataList.map(y => {
  702. y.checked = !checked1.value
  703. })
  704. }
  705. return x
  706. })
  707. } else {
  708. data.xia.map(x => {
  709. if (x.dataId == id) {
  710. x.dataList.map(y => {
  711. y.checked = !checked1.value
  712. })
  713. }
  714. return x
  715. })
  716. }
  717. console.log(id, checked1.value)
  718. console.log(data)
  719. currentData.value = data
  720. // checked1.value = true
  721. }
  722. const downloadOne = async (url, fileName) => {
  723. try {
  724. console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', 1])
  725. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', 1], function (res) {
  726. console.log(res, '11111111111')
  727. }, [], { "type": "POST", "withCredentials": true });
  728. } catch (error) {
  729. console.log(error);
  730. }
  731. try {
  732. // 使用fetch获取文件,然后创建blob下载
  733. const response = await fetch(url);
  734. const blob = await response.blob();
  735. // 创建blob URL
  736. const blobUrl = window.URL.createObjectURL(blob);
  737. const a = document.createElement('a');
  738. a.style.display = 'none';
  739. a.href = blobUrl;
  740. a.download = fileName || 'download.pdf';
  741. document.body.appendChild(a);
  742. a.click();
  743. document.body.removeChild(a);
  744. // 清理blob URL
  745. setTimeout(() => {
  746. window.URL.revokeObjectURL(blobUrl);
  747. }, 100);
  748. } catch (error) {
  749. console.log('Fetch下载失败:', error);
  750. // 回退方案:直接在新窗口打开,让用户手动保存
  751. window.open(url, '_blank');
  752. }
  753. }
  754. const DownloadProcessing = async () => {
  755. let data = currentData.value
  756. let urls = []
  757. if (volumes.value) {
  758. await data.shang.map(x => {
  759. // console.log(x)
  760. x.dataList.length > 0 && x.dataList.map(m => {
  761. if (m.checked) {
  762. urls.push(m)
  763. }
  764. return m
  765. })
  766. return x
  767. })
  768. } else {
  769. await data.xia.map(x => {
  770. // console.log(x)
  771. x.dataList.length > 0 && x.dataList.map(m => {
  772. if (m.checked) {
  773. urls.push(m)
  774. }
  775. return m
  776. })
  777. return x
  778. })
  779. }
  780. try {
  781. console.log("urls", [user.user.userid, getUpdateCourseId.value, '4', urls.length])
  782. top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/addOperationTimeT", [user.user.userid, getUpdateCourseId.value, '4', urls.length], function (res) {
  783. console.log(res, '11111111111')
  784. }, [], { "type": "POST", "withCredentials": true });
  785. } catch (error) {
  786. console.log(error);
  787. }
  788. for (let i = 0; i < urls.length; i++) {
  789. fetch(urls[i].url)
  790. .then(response => response.blob()) // 获取文件数据流
  791. .then(blob => {
  792. const url = window.URL.createObjectURL(blob); // 生成文件在浏览器中的链接
  793. const a = document.createElement('a');
  794. a.href = url;
  795. a.download = urls[i].name; // 文件名
  796. a.style.display = 'none';
  797. document.body.appendChild(a);
  798. a.click();
  799. document.body.removeChild(a);
  800. window.URL.revokeObjectURL(url); // 清除文件链接
  801. })
  802. .catch(console.error);
  803. }
  804. }
  805. // 获取课程下载资料
  806. // top.U.A.Request("https://pbl.cocorobo.cn/api/pbl/selectCourseDetailSz", ['课程id'], function (res) {}, [], { "type": "POST", "withCredentials": true });
  807. watchEffect(() => {
  808. if (JSON.stringify(user.user) != "{}") {
  809. 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) {
  810. isupdateCourse.value = true
  811. }
  812. }
  813. })
  814. </script>
  815. <style lang="scss" scoped>
  816. .course_select {
  817. margin-top: 10px;
  818. .grid-content {
  819. border-radius: 4px;
  820. min-height: 36px;
  821. background: #fff;
  822. padding: 12px;
  823. // height: 300px;
  824. img {
  825. width: 100%;
  826. border-radius: 5px;
  827. }
  828. .course_content {
  829. .div_title {
  830. margin-top: 10px;
  831. white-space: nowrap;
  832. text-overflow: ellipsis;
  833. overflow: hidden;
  834. display: flex;
  835. gap: 5px;
  836. justify-content: space-between;
  837. align-items: center;
  838. .div_title_text{
  839. flex: 1;
  840. overflow: hidden;
  841. text-overflow: ellipsis;
  842. white-space: nowrap;
  843. }
  844. span {
  845. // display: inline-block;
  846. flex-shrink: 0;
  847. padding: 2px 8px;
  848. background: rgba(224, 234, 251, 1);
  849. border-radius: 5px;
  850. font-size: 12px;
  851. color: rgba(54, 129, 252, 1);
  852. }
  853. img {
  854. width: 28px;
  855. cursor: pointer;
  856. float: right;
  857. }
  858. }
  859. }
  860. }
  861. .Screening {
  862. font-size: 20px;
  863. font-weight: 400;
  864. line-height: 28px;
  865. letter-spacing: 0em;
  866. text-align: center;
  867. color: rgba(0, 0, 0, 0.9);
  868. }
  869. .grandTitle {
  870. font-size: 15px;
  871. font-weight: 400;
  872. line-height: 28px;
  873. letter-spacing: 0em;
  874. text-align: center;
  875. }
  876. .el-button {
  877. // background: rgba(54, 129, 252, 1);
  878. color: rgba(54, 129, 252, 1);
  879. }
  880. .el_button_active {
  881. background: rgba(54, 129, 252, 1);
  882. color: #fff;
  883. }
  884. .class_button {
  885. margin-top: 15px;
  886. display: flex;
  887. justify-content: space-between;
  888. }
  889. }
  890. .el-row {
  891. margin-top: 20px;
  892. margin-bottom: 20px;
  893. }
  894. .el-row:last-child {
  895. margin-bottom: 0;
  896. }
  897. .el-col {
  898. border-radius: 4px;
  899. }
  900. .warning_text {
  901. font-weight: bold;
  902. font-size: 16px;
  903. color: rgba(0, 0, 0, 0.9);
  904. margin-left: 8px;
  905. }
  906. .div_hover {
  907. // padding: 8px 0 10px;
  908. height: 35px;
  909. line-height: 35px;
  910. }
  911. .div_hover:hover {
  912. background: rgb(240, 242, 245);
  913. }
  914. .el_popover_a {
  915. display: none;
  916. }
  917. .div_hover:hover .el_popover_a {
  918. display: inline-block;
  919. }
  920. .beike {
  921. li {
  922. padding: 8px 5px;
  923. border-radius: 5px;
  924. }
  925. li:hover {
  926. background: rgba(0, 0, 0, 0.1);
  927. cursor: pointer;
  928. }
  929. }
  930. .Levelone{
  931. width: 120px;
  932. background: #E0EAFB;
  933. border-radius: 5px;
  934. color: #5D8AFB;
  935. display: flex;
  936. justify-content: center;
  937. align-items: center;
  938. height: 33px;
  939. font-size: 16px;
  940. font-weight: 500;
  941. }
  942. .grandTitle2 {
  943. font-size: 16px;
  944. font-weight: 600 !important;
  945. line-height: 28px;
  946. letter-spacing: 0em;
  947. // text-align: center;
  948. }
  949. .grandTitle3{
  950. margin-top: 0;
  951. }
  952. </style>