index.vue 36 KB

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