index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318
  1. <template>
  2. <div class="pb_content">
  3. <div class="pb_content_body">
  4. <div class="student_head">
  5. <!-- <img src="../assets/banner.png" alt="" /> -->
  6. <el-carousel trigger="click" style="width: 100%; height: 100%">
  7. <el-carousel-item v-for="item in bannerList" :key="item.id">
  8. <!-- <h3 class="small">{{ item }}</h3> -->
  9. <img class="imgS" :src="item.poster" alt="" />
  10. </el-carousel-item>
  11. </el-carousel>
  12. </div>
  13. <div class="reBox">
  14. <div class="reTop">
  15. <div>课程</div>
  16. <div>
  17. <div class="search" @click="search">
  18. <img src="../assets/icon/search.png" alt="" />
  19. </div>
  20. <input class="sInput" type="text" placeholder="请输入关键字" v-model="sCourse" @keyup.enter="search"/>
  21. </div>
  22. </div>
  23. <div class="pType_box all_choose" v-if="oid == '69893dca-1d47-11ed-8c78-005056b86db5'">
  24. <span>类型</span>
  25. <el-radio-group v-model="pTypeCheckName" style="display: flex; align-items: center">
  26. <div class="all_choose" style="width: 100px" v-for="(item, index) in CourseType3" :key="index">
  27. <el-radio :label="item.name" @click.native.prevent="CourseType2Click(item.name)">{{
  28. item.name
  29. }}</el-radio>
  30. </div>
  31. </el-radio-group>
  32. </div>
  33. <div class="choose" v-if="oid != '91796dfb-8791-11ef-9b30-005056b86db5'">
  34. <div class="all_choose" v-for="(item, index) in CourseType[0]" :key="index"
  35. :style="{ margin: !CourseTypeJson[item.id].length && 0 }">
  36. <span v-if="CourseTypeJson[item.id].length &&
  37. (oid == '69893dca-1d47-11ed-8c78-005056b86db5'
  38. ? pTypeCheck.indexOf(item.id) != -1
  39. : true)">{{ item.name }}:</span>
  40. <div class="typeCss" v-if="CourseTypeJson[item.id].length &&
  41. (oid == '69893dca-1d47-11ed-8c78-005056b86db5'
  42. ? pTypeCheck.indexOf(item.id) != -1
  43. : true)">
  44. <div class="cName" @click="getCourse(item.name, '', item.id, 1)"
  45. :class="typeE.indexOf(item.id) != -1 ? 'isCType' : ''">
  46. 全部
  47. </div>
  48. <div v-for="(item1, index1) in CourseTypeJson[item.id]" :key="index + '-' + index1" :label="item1.id"
  49. @click="getCourse(item.name, item.id, item1.id, 2)">
  50. <div class="cName" :class="
  51. typea == item1.id || typeb == item1.id || typed == item1.id
  52. ? 'isCType'
  53. : ''
  54. ">
  55. {{ item1.name }}
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="body_student" v-loading="loading">
  63. <div class="typeCheck">
  64. <div><el-switch v-model="orderBy"></el-switch><span>按名字排序</span></div>
  65. <div><el-switch v-model="typeCheck"></el-switch><span>分类显示</span></div>
  66. </div>
  67. <div>
  68. <div class="main_box">
  69. <div style="display:flex;flex-wrap:wrap" v-if="!typeCheck">
  70. <div class="box_course" v-for="(item, index) in zoneClass" :key="index" @click="
  71. goTo(
  72. '/courseDetail?courseId=' +
  73. item.courseId +
  74. '&userid=' +
  75. userid +
  76. '&oid=' +
  77. oid +
  78. '&org=' +
  79. org +
  80. '&cid=' +
  81. classId +
  82. '&tType=' +
  83. tType +
  84. '&screenType=' +
  85. screenType,item.courseId
  86. )
  87. ">
  88. <div class="wheel">
  89. <img :src="
  90. item.cover
  91. ? JSON.parse(item.cover)[0].url
  92. : require('../assets/wheel.png')
  93. " alt="" />
  94. </div>
  95. <div class="middle_white">
  96. <div class="textOverflow">
  97. <el-tooltip effect="light" :content="item.title" placement="top">
  98. <span class="utitle">{{ item.title }}</span>
  99. </el-tooltip>
  100. <el-tooltip effect="light" :content="item.uname" placement="top">
  101. <span class="uname">{{ item.uname }}</span>
  102. </el-tooltip>
  103. </div>
  104. <div class="nameAndLength">
  105. <el-tooltip class="typeN" effect="light" :content="item.typename" placement="top">
  106. <div>{{ item.typename }}</div>
  107. </el-tooltip>
  108. <div>{{ JSON.parse(item.chapters).length }}阶段</div>
  109. </div>
  110. <div class="school_box">
  111. <el-tooltip effect="light" :content="item.school" placement="top">
  112. <div class="school">
  113. {{ item.school }}
  114. </div>
  115. </el-tooltip>
  116. <div style="color: #b4b4b4">{{ item.utime }}</div>
  117. </div>
  118. </div>
  119. <div class="now_study" @click="
  120. goTo(
  121. '/courseDetail?courseId=' +
  122. item.courseId +
  123. '&userid=' +
  124. userid +
  125. '&oid=' +
  126. oid +
  127. '&org=' +
  128. org +
  129. '&cid=' +
  130. classId +
  131. '&tType=' +
  132. tType +
  133. '&screenType=' +
  134. screenType,item.courseId
  135. )
  136. ">
  137. 立即学习
  138. </div>
  139. </div>
  140. </div>
  141. <div v-else>
  142. <div class="FirstTypeBox" v-for="(type, tindex) in CourseType2" :key="tindex">
  143. <div class="title">{{ type.name }}</div>
  144. <div style="display: flex;flex-flow: wrap;margin-top: 20px;">
  145. <div class="box_course" v-for="(item, index) in type.course" :key="tindex + '-' + index" @click="
  146. goTo(
  147. '/courseDetail?courseId=' +
  148. item.courseId +
  149. '&userid=' +
  150. userid +
  151. '&oid=' +
  152. oid +
  153. '&org=' +
  154. org +
  155. '&cid=' +
  156. classId +
  157. '&tType=' +
  158. tType +
  159. '&screenType=' +
  160. screenType,item.courseId
  161. )
  162. ">
  163. <div class="wheel">
  164. <img :src="
  165. item.cover
  166. ? JSON.parse(item.cover)[0].url
  167. : require('../assets/wheel.png')
  168. " alt="" />
  169. </div>
  170. <div class="middle_white">
  171. <div class="textOverflow">
  172. <el-tooltip effect="light" :content="item.title" placement="top">
  173. <span class="utitle">{{ item.title }}</span>
  174. </el-tooltip>
  175. <el-tooltip effect="light" :content="item.uname" placement="top">
  176. <span class="uname">{{ item.uname }}</span>
  177. </el-tooltip>
  178. </div>
  179. <div class="nameAndLength">
  180. <el-tooltip class="typeN" effect="light" :content="item.typename" placement="top">
  181. <div>{{ item.typename }}</div>
  182. </el-tooltip>
  183. <div>{{ JSON.parse(item.chapters).length }}阶段</div>
  184. </div>
  185. <div class="school_box">
  186. <el-tooltip effect="light" :content="item.school" placement="top">
  187. <div class="school">
  188. {{ item.school }}
  189. </div>
  190. </el-tooltip>
  191. <div style="color: #b4b4b4">{{ item.utime }}</div>
  192. </div>
  193. </div>
  194. <div class="now_study" @click="
  195. goTo(
  196. '/courseDetail?courseId=' +
  197. item.courseId +
  198. '&userid=' +
  199. userid +
  200. '&oid=' +
  201. oid +
  202. '&org=' +
  203. org +
  204. '&cid=' +
  205. classId +
  206. '&tType=' +
  207. tType +
  208. '&screenType=' +
  209. screenType,item.courseId
  210. )
  211. ">
  212. 立即学习
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <div class="course_empty" v-if="zoneClass.length == 0">
  219. 暂无课程
  220. </div>
  221. </div>
  222. </div>
  223. <div class="student_page" style="margin: 15px 0 0" v-if="zoneClass.length > 0 && !typeCheck">
  224. <el-pagination background layout="prev, pager, next" :page-size="pageSize" :total="total" v-if="page"
  225. @current-change="handleCurrentChange">
  226. </el-pagination>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. </template>
  232. <script>
  233. import { myMixin } from "@/mixins/mixin.js"
  234. export default {
  235. mixins: [ myMixin ],
  236. data() {
  237. return {
  238. zoneList: [],
  239. zoneClass: [],
  240. page: 1,
  241. total: 0,
  242. pageSize: 20, //每页显示记录数(10)。必须设置为正确的值,以便生成href
  243. isListAjax: false,
  244. zoneListId: "",
  245. bannerList: [],
  246. userid: this.$route.query.userid,
  247. oid: this.$route.query.oid,
  248. classId: this.$route.query.cid,
  249. tType: this.$route.query.tType,
  250. org: this.$route.query.org,
  251. screenType: this.$route.query.screenType,
  252. CourseType: [],
  253. CourseType2: [],
  254. CourseTypeJson: {},
  255. courseTypeId: {},
  256. sCourse: "",
  257. isCType: "",
  258. typea: "",
  259. typeb: "",
  260. typed: "",
  261. typeE: [],
  262. loading: "",
  263. typeCheck: false,
  264. orderBy: false,
  265. CourseType3: [],
  266. pTypeCheck:[],
  267. pTypeCheckName: [],
  268. };
  269. },
  270. watch: {
  271. typeCheck(newValue, oldValue) {
  272. this.loading = true
  273. if (newValue) {
  274. this.selectAll()
  275. } else {
  276. this.page = 1
  277. this.selectAll2()
  278. }
  279. },
  280. orderBy(newValue, oldValue) {
  281. this.loading = true
  282. if (this.typeCheck) {
  283. this.selectAll()
  284. } else {
  285. this.page = 1
  286. this.selectAll2()
  287. }
  288. },
  289. },
  290. methods: {
  291. search(){
  292. if(this.typeCheck){
  293. this.selectAll()
  294. }else{
  295. this.page = 1
  296. this.selectAll2()
  297. }
  298. this.$forceUpdate();
  299. },
  300. goTo(path,id) {
  301. this.$router.push(path);
  302. this.addOp3('1', "", { courseid: id,type: "course_open" }, "success")
  303. },
  304. //获取专区下的课程
  305. getZoneClass(zid) {
  306. this.isListAjax = true;
  307. // const loading = this.openLoading(document.querySelector(".main_box"));
  308. let params = {
  309. bid: zid,
  310. oid: this.oid,
  311. page: this.page,
  312. };
  313. this.ajax
  314. .get(this.$store.state.api + "getZoneClassStudent", params)
  315. .then((res) => {
  316. // loading.close();
  317. this.isListAjax = false;
  318. this.zoneClass = res.data[0];
  319. this.total = res.data[0].length ? res.data[0][0].num : 0;
  320. })
  321. .catch((err) => {
  322. console.error(err);
  323. });
  324. },
  325. getCourse(typeName, ftypeId, typeid, type) {
  326. this.page = 1;
  327. this.zoneClass = [];
  328. if (typeid == "34628934-d02f-11ec-8c78-005056b86db5" || ftypeId == '34628934-d02f-11ec-8c78-005056b86db5' || typeid == "34628934-d02f-11ec-8c78-005056b86ac5" || ftypeId == "34628934-d02f-11ec-8c78-005056b86ac5") {
  329. if (type == 1) {
  330. if (this.typeE.indexOf(typeid) != -1) {
  331. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  332. return
  333. }else{
  334. this.typeE.splice(this.typeE.indexOf(typeid), 1);
  335. }
  336. } else {
  337. this.typeE.push(typeid);
  338. if (this.typea != "") {
  339. this.typea = "";
  340. }
  341. }
  342. } else {
  343. if (this.typea == typeid) {
  344. this.typea = "";
  345. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  346. this.typeE.push(ftypeId);
  347. }
  348. } else {
  349. this.typea = typeid;
  350. if (this.typeE.indexOf(ftypeId) != -1) {
  351. this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
  352. }
  353. }
  354. }
  355. } else if (typeName == "专栏") {
  356. if (type == 1) {
  357. if (this.typeE.indexOf(typeid) != -1) {
  358. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  359. return
  360. }else{
  361. this.typeE.splice(this.typeE.indexOf(typeid), 1);
  362. }
  363. } else {
  364. this.typeE.push(typeid);
  365. if (this.typeb != "") {
  366. this.typeb = "";
  367. }
  368. }
  369. } else {
  370. if (this.typeb == typeid) {
  371. this.typeb = "";
  372. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  373. this.typeE.push(ftypeId);
  374. }
  375. } else {
  376. this.typeb = typeid;
  377. if (this.typeE.indexOf(ftypeId) != -1) {
  378. this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
  379. }
  380. }
  381. }
  382. } else if (typeName == "栏目") {
  383. if (type == 1) {
  384. if (this.typeE.indexOf(typeid) != -1) {
  385. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  386. return
  387. }else{
  388. this.typeE.splice(this.typeE.indexOf(typeid), 1);
  389. }
  390. } else {
  391. this.typeE.push(typeid);
  392. if (this.typeb != "") {
  393. this.typeb = "";
  394. }
  395. }
  396. } else {
  397. if (this.typeb == typeid) {
  398. this.typeb = "";
  399. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  400. this.typeE.push(ftypeId);
  401. }
  402. } else {
  403. this.typeb = typeid;
  404. if (this.typeE.indexOf(ftypeId) != -1) {
  405. this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
  406. }
  407. }
  408. }
  409. } else if (typeName == "主题") {
  410. if (type == 1) {
  411. if (this.typeE.indexOf(typeid) != -1) {
  412. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  413. return
  414. }else{
  415. this.typeE.splice(this.typeE.indexOf(typeid), 1);
  416. }
  417. } else {
  418. this.typeE.push(typeid);
  419. if (this.typeb != "") {
  420. this.typeb = "";
  421. }
  422. }
  423. } else {
  424. if (this.typeb == typeid) {
  425. this.typeb = "";
  426. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  427. this.typeE.push(ftypeId);
  428. }
  429. } else {
  430. this.typeb = typeid;
  431. if (this.typeE.indexOf(ftypeId) != -1) {
  432. this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
  433. }
  434. }
  435. }
  436. } else if (typeName == "学院") {
  437. if (type == 1) {
  438. if (this.typeE.indexOf(typeid) != -1) {
  439. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  440. return
  441. }else{
  442. this.typeE.splice(this.typeE.indexOf(typeid), 1);
  443. }
  444. } else {
  445. this.typeE.push(typeid);
  446. if (this.typeb != "") {
  447. this.typeb = "";
  448. }
  449. }
  450. } else {
  451. if (this.typeb == typeid) {
  452. this.typeb = "";
  453. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  454. this.typeE.push(ftypeId);
  455. }
  456. } else {
  457. this.typeb = typeid;
  458. if (this.typeE.indexOf(ftypeId) != -1) {
  459. this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
  460. }
  461. }
  462. }
  463. } else if (typeid == "34629907-d02f-11ec-8c78-005056b86db5" || ftypeId == '34629907-d02f-11ec-8c78-005056b86db5' || typeid == "34629907-d02f-11ec-8c78-005056b86ac5" || ftypeId == "34629907-d02f-11ec-8c78-005056b86ac5") {
  464. if (type == 1) {
  465. if (this.typeE.indexOf(typeid) != -1) {
  466. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  467. return
  468. }else{
  469. this.typeE.splice(this.typeE.indexOf(typeid), 1);
  470. }
  471. } else {
  472. this.typeE.push(typeid);
  473. if (this.typed != "") {
  474. this.typed = "";
  475. }
  476. }
  477. } else {
  478. if (this.typed == typeid) {
  479. this.typed = "";
  480. if(this.oid == '69893dca-1d47-11ed-8c78-005056b86db5'){
  481. this.typeE.push(ftypeId);
  482. }
  483. } else {
  484. this.typed = typeid;
  485. if (this.typeE.indexOf(ftypeId) != -1) {
  486. this.typeE.splice(this.typeE.indexOf(ftypeId), 1);
  487. }
  488. }
  489. }
  490. }
  491. this.loading = true;
  492. if (this.typeCheck) {
  493. this.selectAll();
  494. } else {
  495. this.selectAll2();
  496. }
  497. },
  498. CourseType2Click(val){
  499. this.pTypeCheck = [];
  500. this.typeE = []
  501. if(val === this.pTypeCheckName){
  502. this.pTypeCheckName = ''
  503. }else{
  504. this.pTypeCheckName = val
  505. for (var i = 0; i < this.CourseType3.length; i++) {
  506. let typeA = this.CourseType3[i];
  507. if (val.indexOf(typeA.name) != -1) {
  508. this.pTypeCheck.push(...typeA.id);
  509. this.typeE = [...typeA.id]
  510. }
  511. }
  512. }
  513. this.typea = ""
  514. this.typeb = ""
  515. this.typed = ""
  516. this.loading = true;
  517. if (this.typeCheck) {
  518. this.selectAll();
  519. } else {
  520. this.selectAll2();
  521. }
  522. },
  523. arrayToArray(arrayo, arrayt) {
  524. let array1 = arrayo;
  525. let array2 = arrayt;
  526. let commonElements = [];
  527. for (let i = 0; i < array1.length; i++) {
  528. for (let j = 0; j < array2.length; j++) {
  529. if (array1[i] === array2[j]) {
  530. commonElements.push(array1[i]);
  531. }
  532. }
  533. }
  534. return commonElements;
  535. },
  536. selectAll() {
  537. this.zoneListId = 0;
  538. this.isListAjax = true;
  539. let params = {
  540. uid: this.userid,
  541. oid: this.oid,
  542. typea: this.typea != undefined ? this.typea : "",
  543. typeb: this.typeb != undefined ? this.typeb : "",
  544. typec: "",
  545. typed: this.typed != undefined ? this.typed : "",
  546. typeE: this.typeE.join(","),
  547. // typeE: "",
  548. cu: "",
  549. cn: this.sCourse,
  550. classid: this.classId,
  551. org: this.org,
  552. page: this.page,
  553. orderBy: this.orderBy ? '2' : '1'
  554. };
  555. this.ajax
  556. .get(this.$store.state.api + "selectTypeCourse2Mode2", params)
  557. .then((res) => {
  558. this.loading = false;
  559. this.isListAjax = false;
  560. this.zoneClass = res.data[0];
  561. // this.total = res.data[0].length ? res.data[0][0].num : 0;
  562. let CourseType2 = JSON.parse(JSON.stringify(this.CourseType[0]))
  563. if(this.oid == "69893dca-1d47-11ed-8c78-005056b86db5"){
  564. if(this.pTypeCheckName.length){
  565. CourseType2 = this.CourseType3.filter(el => {
  566. return el.name == this.pTypeCheckName
  567. })
  568. }else{
  569. CourseType2 = JSON.parse(JSON.stringify(this.CourseType3))
  570. }
  571. }
  572. for (var i = 0; i < CourseType2.length; i++) {
  573. CourseType2[i].course = []
  574. for (var j = 0; j < res.data[0].length; j++) {
  575. // if (res.data[0][j].pid && res.data[0][j].pid.indexOf(CourseType2[i].id) != -1) {
  576. // CourseType2[i].course.push(res.data[0][j])
  577. // }
  578. let pid = CourseType2[i].id
  579. if(typeof pid != "object") pid = pid.split(",")
  580. if(res.data[0][j].pid && this.arrayToArray(pid,res.data[0][j].pid.split(",")).length){
  581. CourseType2[i].course.push(res.data[0][j])
  582. }
  583. }
  584. }
  585. let noTypeCourse = []
  586. for (var j = 0; j < res.data[0].length; j++) {
  587. if (!res.data[0][j].pid) {
  588. noTypeCourse.push(res.data[0][j])
  589. }
  590. }
  591. if (noTypeCourse.length > 0 && !this.pTypeCheckName.length) {
  592. CourseType2.push({
  593. course: noTypeCourse,
  594. name: '其他'
  595. })
  596. }
  597. CourseType2 = CourseType2.filter(item => {
  598. return item.course.length > 0;
  599. })
  600. this.CourseType2 = CourseType2
  601. // this.selectType({
  602. // data: [res.data[1], res.data[2], res.data[3], res.data[4]],
  603. // });
  604. this.getBanner({
  605. data: [res.data[6], res.data[5], res.data[7]],
  606. });
  607. })
  608. .catch((err) => {
  609. console.error(err);
  610. });
  611. },
  612. selectAll2() {
  613. this.zoneListId = 0;
  614. this.isListAjax = true;
  615. let params = {
  616. uid: this.userid,
  617. oid: this.oid,
  618. typea: this.typea != undefined ? this.typea : "",
  619. typeb: this.typeb != undefined ? this.typeb : "",
  620. typec: "",
  621. typed: this.typed != undefined ? this.typed : "",
  622. typeE: this.typeE.join(","),
  623. // typeE: "",
  624. cu: "",
  625. cn: this.sCourse,
  626. classid: this.classId,
  627. org: this.org,
  628. page: this.page,
  629. pageSize:this.pageSize,
  630. orderBy: this.orderBy ? '2' : '1'
  631. };
  632. this.ajax
  633. .get(this.$store.state.api + "selectTypeCourse22", params)
  634. .then((res) => {
  635. this.loading = false;
  636. this.isListAjax = false;
  637. this.zoneClass = res.data[0];
  638. this.total = res.data[0].length ? res.data[0][0].num : 0;
  639. let CourseType2 = []
  640. // this.selectType({
  641. // data: [res.data[1], res.data[2], res.data[3], res.data[4]],
  642. // });
  643. this.getBanner({
  644. data: [res.data[6], res.data[5], res.data[7]],
  645. });
  646. })
  647. .catch((err) => {
  648. console.error(err);
  649. });
  650. },
  651. checkZone(id) {
  652. this.page = 1;
  653. this.zoneListId = id;
  654. this.getZoneClass(id);
  655. },
  656. // handleCurrentChange(val) {
  657. // this.page = val;
  658. // this.getZoneClass(this.zoneListId);
  659. // },
  660. handleCurrentChange(val) {
  661. this.loading = true;
  662. this.page = val;
  663. this.selectAll2();
  664. },
  665. //获取banner
  666. getBanner(res) {
  667. // var a = false;
  668. // if (this.org == "eb2af5e9-ac3d-46b6-9fe3-3c1c364f018d") {
  669. // a = true;
  670. // }
  671. // let params = {
  672. // oid: this.org,
  673. // };
  674. // this.ajax
  675. // .get(this.$store.state.api + "selectBannerByOid", params)
  676. // .then((res) => {
  677. if (res.data[0].length > 0) {
  678. this.bannerList = res.data[0];
  679. } else {
  680. this.getBannerByOid({
  681. data: [res.data[1], res.data[2]],
  682. });
  683. }
  684. // })
  685. // .catch((err) => {
  686. // console.error(err);
  687. // });
  688. },
  689. getBannerByOid(res) {
  690. // let params = {
  691. // oid: this.oid,
  692. // };
  693. // this.ajax
  694. // .get(this.$store.state.api + "selectBannerByOid", params)
  695. // .then((res) => {
  696. if (res.data[0].length > 0) {
  697. this.bannerList = res.data[0];
  698. } else {
  699. this.getOldBanner({
  700. data: [res.data[1]],
  701. });
  702. }
  703. // })
  704. // .catch((err) => {
  705. // console.error(err);
  706. // });
  707. },
  708. getOldBanner(res) {
  709. // this.ajax
  710. // .get(this.$store.state.api + "getBanner", "")
  711. // .then((res) => {
  712. this.bannerList = res.data[0];
  713. // })
  714. // .catch((err) => {
  715. // console.error(err);
  716. // });
  717. },
  718. selectAllType() {
  719. let params = {
  720. org: this.org && this.org != "" ? this.org : "",
  721. oid: this.oid && this.oid != "" ? this.oid : "",
  722. stand: "cn"
  723. };
  724. this.ajax
  725. .get(this.$store.state.api + "selectAllTypeStand", params)
  726. .then((res) => {
  727. if(this.oid == "69893dca-1d47-11ed-8c78-005056b86db5"){
  728. res.data[0] = [...res.data[0],...res.data[4]]
  729. }
  730. this.CourseTypeJson = {};
  731. this.CourseType = res.data;
  732. this.CourseType3 = [
  733. { name: "智见课程", id: [] },
  734. { name: "智行课程", id: [] },
  735. { name: "智创课程", id: [] },
  736. ];
  737. for (var cti = 0; cti < res.data[0].length; cti++) {
  738. if (
  739. res.data[0][cti].id == "34628934-d02f-11ec-8c78-005056b86db5" ||
  740. res.data[0][cti].id == "34629907-d02f-11ec-8c78-005056b86db5"
  741. ) {
  742. this.CourseType3[0].id.push(res.data[0][cti].id);
  743. }else if(res.data[0][cti].id == "34628934-d02f-11ec-8c78-005056b86ac5" ||
  744. res.data[0][cti].id == "34629907-d02f-11ec-8c78-005056b86ac5"){
  745. this.CourseType3[1].id.push(res.data[0][cti].id);
  746. } else if (res.data[0][cti].id == "34629bcc-d02f-11ec-8c78-005056b86db5") {
  747. this.CourseType3[2].id.push(res.data[0][cti].id);
  748. }
  749. if(res.data[0][cti].id == "34628934-d02f-11ec-8c78-005056b86db5" || res.data[0][cti].id == "34628934-d02f-11ec-8c78-005056b86ac5"){
  750. res.data[0][cti].name = "年级";
  751. }else if(res.data[0][cti].id == "34629907-d02f-11ec-8c78-005056b86db5" || res.data[0][cti].id == "34629907-d02f-11ec-8c78-005056b86ac5"){
  752. res.data[0][cti].name = "学科";
  753. }else if(res.data[0][cti].id == "34629bcc-d02f-11ec-8c78-005056b86db5"){
  754. res.data[0][cti].name = "主题";
  755. }
  756. }
  757. for (var i = 0; i < res.data[0].length; i++) {
  758. if (!this.cid) {
  759. this.courseTypeId[res.data[0][i].id] = "";
  760. }
  761. if (!this.CourseTypeJson[res.data[0][i].id]) {
  762. this.CourseTypeJson[res.data[0][i].id] = [];
  763. }
  764. if (this.oid == "69893dca-1d47-11ed-8c78-005056b86db5") {
  765. if (res.data[0][i].name == "栏目") {
  766. this.CourseType[0][i].name = "主题";
  767. }
  768. }
  769. if (res.data[2].length == 0 && res.data[3].length == 0) {
  770. for (var j = 0; j < res.data[1].length; j++) {
  771. if (res.data[0][i].id == res.data[1][j].pid) {
  772. if (!this.CourseTypeJson[res.data[0][i].id]) {
  773. this.CourseTypeJson[res.data[0][i].id] = [];
  774. }
  775. this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]); // 去除公共分类
  776. }
  777. }
  778. } else {
  779. if (res.data[2].length > 0) {
  780. for (var j = 0; j < res.data[2].length; j++) {
  781. if (res.data[0][i].id == res.data[2][j].pid) {
  782. this.CourseTypeJson[res.data[0][i].id].push(res.data[2][j]); // 去除公共分类
  783. }
  784. }
  785. }
  786. if (res.data[3].length > 0) {
  787. for (var j = 0; j < res.data[3].length; j++) {
  788. if (res.data[0][i].id == res.data[3][j].pid) {
  789. this.CourseTypeJson[res.data[0][i].id].push(res.data[3][j]); // 去除公共分类
  790. }
  791. }
  792. }
  793. }
  794. }
  795. if (this.typeCheck) {
  796. this.selectAll();
  797. } else {
  798. this.selectAll2();
  799. }
  800. this.$forceUpdate();
  801. })
  802. .catch((err) => {
  803. console.error(err);
  804. });
  805. },
  806. selectType(res) {
  807. // this.ajax
  808. // .get(this.$store.state.api + "selectType")
  809. // .then((res) => {
  810. this.CourseTypeJson = {};
  811. this.CourseType = res.data;
  812. for (var i = 0; i < res.data[0].length; i++) {
  813. if (!this.cid) {
  814. this.courseTypeId[res.data[0][i].id] = "";
  815. }
  816. if (this.oid == "69893dca-1d47-11ed-8c78-005056b86db5") {
  817. if (res.data[0][i].name == "栏目") {
  818. this.CourseType[0][i].name = "主题";
  819. }
  820. }
  821. for (var j = 0; j < res.data[1].length; j++) {
  822. if (res.data[0][i].id == res.data[1][j].pid) {
  823. if (!this.CourseTypeJson[res.data[0][i].id]) {
  824. this.CourseTypeJson[res.data[0][i].id] = [];
  825. }
  826. this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]); // 去除公共分类
  827. }
  828. }
  829. }
  830. this.selectTypeByOid({ data: [res.data[0], res.data[2]] });
  831. this.selectTypeByOrg({ data: [res.data[0], res.data[3]] });
  832. // })
  833. // .catch((err) => {
  834. // console.error(err);
  835. // });
  836. },
  837. selectTypeByOid(res) {
  838. // let params = {
  839. // oid: this.oid,
  840. // };
  841. // this.ajax
  842. // .get(this.$store.state.api + "selectTypeByOid", params)
  843. // .then((res) => {
  844. for (var i = 0; i < res.data[0].length; i++) {
  845. for (var j = 0; j < res.data[1].length; j++) {
  846. if (res.data[0][i].id == res.data[1][j].pid) {
  847. if (!this.CourseTypeJson[res.data[0][i].id]) {
  848. this.CourseTypeJson[res.data[0][i].id] = [];
  849. }
  850. this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
  851. }
  852. }
  853. }
  854. this.$forceUpdate();
  855. // })
  856. // .catch((err) => {
  857. // console.error(err);
  858. // });
  859. },
  860. selectTypeByOrg(res) {
  861. // let params = {
  862. // oid: this.org,
  863. // };
  864. // this.ajax
  865. // .get(this.$store.state.api + "selectTypeByOrg", params)
  866. // .then((res) => {
  867. for (var i = 0; i < res.data[0].length; i++) {
  868. for (var j = 0; j < res.data[1].length; j++) {
  869. if (res.data[0][i].id == res.data[1][j].pid) {
  870. if (!this.CourseTypeJson[res.data[0][i].id]) {
  871. this.CourseTypeJson[res.data[0][i].id] = [];
  872. }
  873. this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
  874. }
  875. }
  876. }
  877. this.$forceUpdate();
  878. // })
  879. // .catch((err) => {
  880. // console.error(err);
  881. // });
  882. },
  883. },
  884. beforeDestroy() {
  885. clearInterval(this.timer);
  886. this.timer = null;
  887. },
  888. created() {
  889. let typea = this.$route.query.typea
  890. let typeb = this.$route.query.typeb
  891. let typed = this.$route.query.typed
  892. if(typea || typeb || typed){
  893. this.typea = typea ? typea : ''
  894. this.typeb = typeb ? typeb : ''
  895. this.typed = typed ? typed : ''
  896. }
  897. this.loading = true;
  898. // this.selectType();
  899. this.selectAllType();
  900. // this.getBanner();
  901. this.timer = setInterval(() => {
  902. this.selectAllType();
  903. // this.getBanner();
  904. }, 60000);
  905. document.scrollingElement.scrollTop = 0;
  906. },
  907. };
  908. </script>
  909. <style scoped>
  910. @media screen and (max-width: 1024px) {
  911. .box_course {
  912. margin: 0px 5px 20px 5px !important;
  913. }
  914. }
  915. .student_head .imgS {
  916. width: 100%;
  917. height: 100%;
  918. cursor: pointer;
  919. object-fit: cover;
  920. }
  921. .top {
  922. padding: 20px 30px 20px 1%;
  923. box-sizing: border-box;
  924. display: flex;
  925. align-items: center;
  926. }
  927. .top div {
  928. cursor: pointer;
  929. box-sizing: border-box;
  930. height: 35px;
  931. line-height: 35px;
  932. margin: 0 10px 0 0;
  933. padding-bottom: 5px;
  934. width: 80px;
  935. text-align: center;
  936. }
  937. .top .active {
  938. border-bottom: 3px solid #0e71e6;
  939. }
  940. .isactive {
  941. border-bottom: 3px solid #0e71e6;
  942. }
  943. .box_fk {
  944. width: 8px;
  945. height: 21px;
  946. background: #0e71e6;
  947. margin-right: 5px;
  948. }
  949. .wheel {
  950. width: 100%;
  951. height: 140px;
  952. }
  953. .man {
  954. width: 16px;
  955. height: 16px;
  956. }
  957. .wheel>img,
  958. .man>img {
  959. width: 100%;
  960. height: 100%;
  961. object-fit: cover;
  962. }
  963. .box_course {
  964. display: flex;
  965. flex-direction: column;
  966. flex-wrap: nowrap;
  967. /* margin: 0px 1% 20px; */
  968. margin: 0 15px 20px 0;
  969. width: 300px;
  970. /* height: 260px; */
  971. /*border: 1px solid #cecece; */
  972. border-radius: 10px;
  973. overflow: hidden;
  974. box-shadow: 0px 1px 3px 0px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%),
  975. 0px 2px 1px -1px rgb(0 0 0 / 12%);
  976. justify-content: space-between;
  977. cursor: pointer;
  978. }
  979. .middle_white {
  980. font-size: 14px;
  981. margin: 5px 10px 10px;
  982. }
  983. .people {
  984. display: flex;
  985. align-items: center;
  986. }
  987. .people>div:nth-child(2) {
  988. margin-left: 10px;
  989. }
  990. .now_study {
  991. width: 100%;
  992. height: 40px;
  993. color: #fff;
  994. background: #4a9eed;
  995. text-align: center;
  996. line-height: 40px;
  997. font-size: 13px;
  998. cursor: pointer;
  999. display: none;
  1000. }
  1001. .now_study:hover {
  1002. background: #205cc6;
  1003. }
  1004. .main_box {
  1005. width: 100%;
  1006. /* display: flex; */
  1007. /* flex-direction: row; */
  1008. /* flex-wrap: wrap; */
  1009. /* justify-content: flex-start; */
  1010. margin: 0 auto;
  1011. }
  1012. .right_bottom_flex {
  1013. width: 219px;
  1014. height: 144px;
  1015. margin: auto 0;
  1016. }
  1017. .right_bottom_flex>img {
  1018. width: 100%;
  1019. height: 100%;
  1020. }
  1021. .body_student {
  1022. margin: 0 auto;
  1023. width: 90%;
  1024. height: 100%;
  1025. }
  1026. .student_head {
  1027. width: 100%;
  1028. /* height: 30%; */
  1029. }
  1030. .textOverflow {
  1031. padding: 0 5px 0 0px;
  1032. width: 100%;
  1033. display: flex;
  1034. align-items: center;
  1035. justify-content: space-between;
  1036. font-size: 16px;
  1037. }
  1038. .textOverflow > .utitle{
  1039. max-width: calc(100%);
  1040. overflow: hidden;
  1041. white-space: nowrap;
  1042. text-overflow: ellipsis;
  1043. font-weight: bold;
  1044. display: block;
  1045. }
  1046. .textOverflow > .uname{
  1047. min-width: fit-content;
  1048. overflow: hidden;
  1049. white-space: nowrap;
  1050. text-overflow: ellipsis;
  1051. display: block;
  1052. }
  1053. .student_page {
  1054. margin-top: 10px;
  1055. }
  1056. .course_empty {
  1057. width: 100%;
  1058. height: 200px;
  1059. display: flex;
  1060. align-items: center;
  1061. justify-content: center;
  1062. }
  1063. .choose {
  1064. display: flex;
  1065. flex-direction: column;
  1066. flex-wrap: nowrap;
  1067. height: 100%;
  1068. justify-content: space-evenly;
  1069. align-items: flex-start;
  1070. padding: 10px 0;
  1071. }
  1072. .all_choose {
  1073. display: flex;
  1074. flex-direction: row;
  1075. align-items: baseline;
  1076. /* margin: 2px 0; */
  1077. width: 100%;
  1078. }
  1079. .all_choose>span {
  1080. min-width: 85px;
  1081. display: block;
  1082. letter-spacing: 14px;
  1083. }
  1084. .all_choose>span:nth-child(1) {
  1085. font-weight: bold;
  1086. }
  1087. .all_choose>>>.el-checkbox-group {
  1088. display: flex;
  1089. flex-direction: row;
  1090. width: 820px;
  1091. flex-wrap: wrap;
  1092. align-content: center;
  1093. justify-content: flex-start;
  1094. align-items: center;
  1095. margin-top: 3px;
  1096. }
  1097. .all_choose>.el-checkbox-group>>>.el-checkbox {
  1098. margin-bottom: 10px;
  1099. display: flex;
  1100. flex-direction: row;
  1101. align-items: center;
  1102. }
  1103. .all_choose>.el-checkbox-group>.el-checkbox>>>.el-checkbox__label {
  1104. min-width: 80px;
  1105. overflow: hidden;
  1106. width: 80px;
  1107. text-overflow: ellipsis;
  1108. white-space: nowrap;
  1109. }
  1110. .all_choose>.el-checkbox-group>.el-checkbox>>>.el-checkbox__label:hover {
  1111. width: auto;
  1112. }
  1113. .cName {
  1114. cursor: pointer;
  1115. margin: 0 10px 10px 0;
  1116. color: #b9b6b9;
  1117. min-width: 80px;
  1118. width: 80px;
  1119. white-space: nowrap;
  1120. overflow: hidden;
  1121. text-overflow: ellipsis;
  1122. }
  1123. .reBox {
  1124. position: relative;
  1125. top: -25px;
  1126. z-index: 999;
  1127. /* left: auto; */
  1128. /* right: auto; */
  1129. background: #fff;
  1130. width: 90%;
  1131. border-radius: 5px;
  1132. padding-left: 20px;
  1133. margin: 0 auto;
  1134. box-sizing: border-box;
  1135. }
  1136. .reTop {
  1137. padding: 20px 0 0 0;
  1138. border-bottom: 1px solid #eee;
  1139. width: 98%;
  1140. display: flex;
  1141. flex-direction: row;
  1142. flex-wrap: nowrap;
  1143. align-items: center;
  1144. justify-content: space-between;
  1145. }
  1146. .reTop>div:nth-child(1) {
  1147. font-weight: bold;
  1148. width: 40px;
  1149. border-bottom: 1px solid #205cc6;
  1150. padding-bottom: 20px;
  1151. color: #205cc6;
  1152. font-size: 20px;
  1153. }
  1154. .reTop>div:nth-child(2) {
  1155. display: flex;
  1156. flex-direction: row;
  1157. align-items: center;
  1158. border: 1px solid #ccced3;
  1159. width: 300px;
  1160. border-radius: 8px;
  1161. padding: 5px 0;
  1162. margin-bottom: 10px;
  1163. }
  1164. .search {
  1165. width: 20px;
  1166. padding: 0 5px;
  1167. }
  1168. .search>img {
  1169. width: 100%;
  1170. height: 100%;
  1171. }
  1172. .sInput {
  1173. border: none;
  1174. width: 85%;
  1175. }
  1176. .sInput:focus-visible {
  1177. outline: none;
  1178. }
  1179. .nameAndLength {
  1180. display: flex;
  1181. flex-direction: row;
  1182. flex-wrap: nowrap;
  1183. align-items: center;
  1184. justify-content: space-between;
  1185. margin: 5px 0;
  1186. }
  1187. .typeN {
  1188. width: 200px;
  1189. white-space: nowrap;
  1190. overflow: hidden;
  1191. text-overflow: ellipsis;
  1192. }
  1193. .isCType {
  1194. color: #6282c2;
  1195. }
  1196. .typeCss {
  1197. display: flex;
  1198. flex-direction: row;
  1199. flex-wrap: wrap;
  1200. justify-content: flex-start;
  1201. align-items: center;
  1202. }
  1203. .school {
  1204. white-space: nowrap;
  1205. overflow: hidden;
  1206. text-overflow: ellipsis;
  1207. max-width: 50%;
  1208. box-sizing: border-box;
  1209. }
  1210. .school_box {
  1211. display: flex;
  1212. align-items: center;
  1213. justify-content: space-between;
  1214. }
  1215. .FirstTypeBox {}
  1216. .FirstTypeBox+.FirstTypeBox {
  1217. margin-top: 20px;
  1218. }
  1219. .FirstTypeBox>.title {
  1220. font-size: 24px;
  1221. font-weight: 700;
  1222. }
  1223. .typeCheck > div + div{
  1224. margin-left: 10px;
  1225. }
  1226. .typeCheck {
  1227. display: flex;
  1228. align-items: center;
  1229. justify-content: flex-end;
  1230. margin-bottom: 10px;
  1231. }
  1232. .typeCheck > div{
  1233. display: flex;
  1234. align-items: center;
  1235. justify-content: flex-end;
  1236. }
  1237. .typeCheck > div >span {
  1238. margin-left: 10px;
  1239. }
  1240. .pType_box {
  1241. margin-top: 10px;
  1242. }
  1243. .pType_box >>> .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
  1244. -webkit-box-shadow: none !important;
  1245. box-shadow: none !important;
  1246. }
  1247. </style>