courseResourcesAll.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <template>
  2. <common-header />
  3. <div class="courseResources allPageWidthBg">
  4. <div class="likeBread">
  5. <div class="likeBread_left">{{ bigTitle }}</div>
  6. <div class="likeBread_right">
  7. <span>{{ bigTitle }}</span>-
  8. <span>查看更多</span>-
  9. <span>全部</span>
  10. </div>
  11. </div>
  12. <div class="widthBg">
  13. <div class="baseTop">
  14. <p>{{ bigTitle }}</p>
  15. <div class="searchValue">
  16. <input type="text" placeholder="搜索关键字" v-model="searchKey">
  17. <div class="searchBtn" @click="handleSearch">
  18. <img src="/kczy/searchIcon.png" alt="">
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="common1280 keyFilter">
  24. <div class="bigTitle">年级</div>
  25. <div class="selectionFilter">
  26. <ul>
  27. <li v-for="(item, index) in filterData" :key="index" @click="gradeChoose(item, index)"><span
  28. :class="{ 'selectActive': num == index }">{{ item.grade_name }}</span></li>
  29. </ul>
  30. </div>
  31. </div>
  32. <div class="common1280 keyFilter">
  33. <div class="bigTitle">学科</div>
  34. <div class="selectionFilter">
  35. <ul>
  36. <li v-for="(item, index) in subjectList" :key="index" @click="subjectChoose(item, index)"><span
  37. :class="{ 'selectActive': subNum == index }">{{ item.subject_name }}</span></li>
  38. </ul>
  39. </div>
  40. </div>
  41. <!-- <div class="common1280 keyFilter">
  42. <div class="bigTitle">分册</div>
  43. <div class="selectionFilter">
  44. <ul>
  45. <li v-for="(item,index) in secFilterData" :key="index" @click="secChoose(item,index)"><span :class="{ 'selectActive':secNum==index }">{{item.name}}</span></li>
  46. </ul>
  47. </div>
  48. </div> -->
  49. <div class="common1280 keyFilter">
  50. <div class="bigTitle">分类</div>
  51. <div class="selectionFilter">
  52. <ul>
  53. <li v-for="(item, index) in secFilterData" :key="index" @click="secChoose(item, index)"><span
  54. :class="{ 'selectActive': secNum == index }">{{ item.kc_name }}</span></li>
  55. </ul>
  56. </div>
  57. </div>
  58. <div class="common1280 contentMain">
  59. <div class="allDetailCourse" v-if="courseDetail && courseDetail.length > 0">
  60. <div class="singlePart" v-for="(item, index) in courseDetail" :key="index" @click="toDetail(item, index)">
  61. <div class="courseCover"> <img :src="item.kk_img" alt=""></div>
  62. <p>{{ item.kk_name }}</p>
  63. <div class="evalStar">
  64. <div class="singleEvalStar_left"><img src="/kczy/stars.png" v-for="(item, index) in item.kk_star_num" :key="index"></div>
  65. <div class="singleEvalStar_right">
  66. <div class="singleEvalStar">{{ item.subject_name }}</div>
  67. <div class="singleEvalStar">{{ item.grade_name }}</div>
  68. <div class="singleEvalStar" v-if="false">{{ item.kk_jgmc }}</div>
  69. </div>
  70. </div>
  71. <!-- positing -->
  72. <div class="dataShow">
  73. <div class="baseInfoPart">
  74. <img src="/kczy/cellectIcon.png" alt="">
  75. <span>{{ item.kk_fav_num }}</span>
  76. </div>
  77. <div class="baseInfoPart">
  78. <img src="/kczy/fingerIcon.png" alt="">
  79. <span>{{ item.kk_like_num }}</span>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="NOdata" v-else>
  85. <img src="../assets/kczy/noData4.png" alt="">
  86. <p class="NOdata_p">暂无数据~</p>
  87. </div>
  88. </div>
  89. <div class="common1280" style="position:relative;">
  90. <div class="paganationPage">
  91. <el-pagination background layout="prev, pager, next, ->" :total="totalRows" @current-change="handleChangePage" />
  92. </div>
  93. </div>
  94. </div>
  95. <common-footer />
  96. </template>
  97. <script>
  98. import CommonHeader from "@/components/CommonHeader/index.vue";
  99. import CommonFooter from "@/components/CommonFooter/index.vue";
  100. import { baseCourseList, defaultGrade, defaultSubject } from "./kczy/allApi.js";
  101. import { user } from "@/store/user.js";
  102. import request from '@/utils/request';
  103. export default {
  104. name: 'courseResources',
  105. components: {
  106. CommonHeader,
  107. CommonFooter
  108. },
  109. data() {
  110. return {
  111. bigTitle: '基础课程',
  112. searchKey: '',
  113. num: 0,
  114. secNum: 0,
  115. filterData: [],
  116. secFilterData: [
  117. // {
  118. // keyV: '',
  119. // name:"全部"
  120. // },
  121. // {
  122. // keyV: 1,
  123. // name:"上册"
  124. // },
  125. // {
  126. // keyV: 2,
  127. // name:"下册"
  128. // }
  129. ],
  130. subjectList: [],
  131. courseDetail: [],
  132. page: 1,
  133. totalRows: '',
  134. prefixImg: 'https://tyyxopenapi.bozedu.top/',
  135. chooseGradeId: '',//选中的年级id
  136. chooseGradeName: '',
  137. chooseVolume: '',//选中的分册
  138. kcID: '',
  139. subNum: 0,
  140. chooseSubjectId: '',
  141. chooseSubjectName: '',
  142. }
  143. },
  144. async mounted() {
  145. this.kcID = this.$route.query.kcId;
  146. //获取上个页面的标识 判定是种课程(待串联)
  147. this.initGrade();
  148. this.initSubject();
  149. await this.initType();
  150. this.initData(this.page);
  151. },
  152. methods: {
  153. initType() {
  154. return request({
  155. url: '/kczy/cate/index',
  156. data: {
  157. kc_pid: this.kcID,
  158. }
  159. }).then(res => {
  160. if (res.code == "1") {
  161. this.secFilterData = [{ kc_id: undefined, kc_name: '全部' }, ...(res.data.page_data || [])];
  162. this.chooseVolume = undefined;
  163. }
  164. }).catch(error => {
  165. console.log(error);
  166. })
  167. },
  168. /**初始化年级*/
  169. initGrade() {
  170. let transObj = {
  171. token: user?.token,
  172. };
  173. return defaultGrade(transObj)
  174. .then(res => {
  175. if (res.code == "1") {
  176. this.filterData = res.data.page_data;
  177. let allSection = {
  178. area_id1: "0",
  179. area_id2: "0",
  180. area_id3: "0",
  181. area_id4: "0",
  182. create_dateline: "1662016924",
  183. create_user_id: "0",
  184. dept_id: "0",
  185. grade_id: "",
  186. grade_name: "全部",
  187. id: "30",
  188. isdelete: "0",
  189. modify_dateline: "0",
  190. modify_user_id: "0",
  191. sm_id: "0",
  192. user_id: "0",
  193. }
  194. this.filterData.unshift(allSection);
  195. }
  196. })
  197. .catch(error => { console.log(error) });
  198. },
  199. /**初始化学科*/
  200. initSubject() {
  201. let transObj = {
  202. token: user?.token,
  203. };
  204. return defaultSubject(transObj)
  205. .then(res => {
  206. if (res.code == "1") {
  207. this.subjectList = res.data.page_data;
  208. let allSection = {
  209. area_id1: "0",
  210. area_id2: "0",
  211. area_id3: "0",
  212. area_id4: "0",
  213. create_dateline: "0",
  214. create_user_id: "0",
  215. dept_id: "0",
  216. isdelete: "0",
  217. modify_dateline: "0",
  218. modify_user_id: "0",
  219. sm_id: "0",
  220. subject_id: "0",
  221. subject_name: "全部",
  222. subject_name_short: "全部",
  223. user_id: "0",
  224. };
  225. this.subjectList.unshift(allSection)
  226. }
  227. })
  228. .catch(error => { console.log(error) })
  229. },
  230. /**初始化数据*/
  231. initData(changePage) {
  232. //获取上级的标记
  233. let trans_kkId = this.$route.query.kkId;
  234. let trans_kcName = this.$route.query.kcName;
  235. this.kcID = this.$route.query.kcId;
  236. this.bigTitle = trans_kcName;
  237. let transObj = {
  238. token: user?.token,
  239. page: changePage,
  240. limit: 10,
  241. kc_cate_level_1: '',//一级目录的ID
  242. grade_id: this.chooseGradeId,
  243. subject_id: this.chooseSubjectId,//学科
  244. // team_id: this.chooseVolume,//分页 1:上册 2下册
  245. keyword: this.searchKey,
  246. kc_cate_level_1: this.kcID,//
  247. kk_shzt: '1',
  248. kc_cate_level_2: this.chooseVolume
  249. };
  250. return baseCourseList(transObj)
  251. .then(res => {
  252. if (res.code == "1") {
  253. console.log('re333',res.data.page_data);
  254. this.courseDetail = res.data.page_data;
  255. this.totalRows = Number(res.data.total_rows);
  256. }
  257. })
  258. .catch(error => {
  259. console.log(error);
  260. })
  261. },
  262. //关键字搜索
  263. handleSearch() {
  264. this.initData(this.page);
  265. },
  266. //年级选择
  267. gradeChoose(item, index) {
  268. this.num = index;
  269. this.chooseGradeId = item.grade_id;
  270. this.chooseGradeName = item.grade_name;
  271. this.initData(this.page);
  272. },
  273. //学科选择
  274. subjectChoose(item, index) {
  275. this.subNum = index;
  276. this.chooseSubjectId = item.subject_id;
  277. this.chooseSubjectName = item.subject_name;
  278. this.initData(this.page);
  279. },
  280. //分册选择
  281. secChoose(item, index) {
  282. this.secNum = index;
  283. this.chooseVolume = item.kc_id;
  284. this.initData(this.page);
  285. },
  286. //移步详情页
  287. toDetail(row, index) {
  288. if (row.is_wlzy == '1') {
  289. this.$router.push({ path: '/resourceChapterList', query: { id: row.kk_id } });
  290. }else {
  291. this.$router.push({ path: '/resourceChapter', query: { id: row.kk_id } })
  292. }
  293. },
  294. //翻页
  295. handleChangePage(val) {
  296. this.page = val;
  297. this.initData(val);
  298. }
  299. },
  300. }
  301. </script>
  302. <style scoped lang="scss">
  303. @import "../styles/common_resource.scss";
  304. .courseResources {
  305. width: 100%;
  306. .widthBg {
  307. width: 100%;
  308. height: 200px;
  309. background: url("../../src/assets/kczy/sourcebg2.png") no-repeat left top;
  310. background-size: 100% 100%;
  311. }
  312. .baseTop {
  313. width: 1280px;
  314. margin: 0 auto;
  315. p {
  316. font-size: 48px;
  317. font-weight: 600;
  318. text-align: center;
  319. color: #fff;
  320. padding-top: 35px;
  321. }
  322. .searchValue {
  323. width: 497px;
  324. height: 50px;
  325. margin: 0 auto;
  326. background: #ffffff;
  327. border: 1px solid #00a3ff;
  328. border-radius: 8px;
  329. margin-top: 13px;
  330. overflow: hidden;
  331. position: relative;
  332. input {
  333. width: 100%;
  334. height: 100%;
  335. outline: 0;
  336. box-sizing: border-box;
  337. padding-left: 10px;
  338. }
  339. .searchBtn {
  340. width: 26px;
  341. height: 26px;
  342. background: #00a3ff;
  343. border-radius: 6px;
  344. position: absolute;
  345. right: 5px;
  346. top: 50%;
  347. transform: translate(-50%, -50%);
  348. text-align: center;
  349. vertical-align: middle;
  350. cursor: pointer;
  351. img {
  352. display: inline-block;
  353. text-align: center;
  354. }
  355. }
  356. }
  357. }
  358. .keyFilter {
  359. display: flex;
  360. height: 50px;
  361. line-height: 50px;
  362. margin: 5px auto;
  363. .bigTitle {
  364. font-size: 16px;
  365. font-weight: 600;
  366. text-align: center;
  367. color: #000000;
  368. margin-right: 10px;
  369. }
  370. .selectionFilter {
  371. flex: 1;
  372. ul {
  373. display: flex;
  374. border-bottom: 1px dashed #e4e6e8;
  375. li {
  376. display: inline-block;
  377. font-size: 16px;
  378. font-weight: 400;
  379. text-align: center;
  380. color: #949494;
  381. margin-right: 4%;
  382. cursor: pointer;
  383. }
  384. }
  385. }
  386. }
  387. }
  388. .allDetailCourse {
  389. margin-top: 30px;
  390. display: flex;
  391. align-items: center;
  392. justify-content: flex-start;
  393. flex-wrap: wrap;
  394. .singlePart {
  395. width: 19.2%;
  396. height: 234px;
  397. border-radius: 12px;
  398. box-shadow: 0px 10px 24px 0px rgba(153, 160, 168, 0.18);
  399. margin-right: 1%;
  400. margin-bottom: 30px;
  401. position: relative;
  402. cursor: pointer;
  403. .courseCover {
  404. height: 157px;
  405. img {
  406. width: 100%;
  407. height: 100%;
  408. }
  409. }
  410. p {
  411. height: 22px;
  412. font-size: 16px;
  413. font-weight: 400;
  414. text-align: left;
  415. color: #000000;
  416. box-sizing: border-box;
  417. padding: 0 6px;
  418. margin: 10px 0;
  419. overflow: hidden;
  420. text-overflow: ellipsis;
  421. white-space: nowrap;
  422. }
  423. .evalStar {
  424. box-sizing: border-box;
  425. padding: 0 6px;
  426. margin-top: 5px;
  427. display: flex;
  428. flex-direction: row;
  429. flex-wrap: nowrap;
  430. justify-content: space-between;
  431. align-items: center;
  432. .singleEvalStar_left{
  433. width: 70%;
  434. img {
  435. width: 18px;
  436. display: inline-block;
  437. }
  438. }
  439. .singleEvalStar_right{
  440. width: 30%;
  441. display: flex;
  442. flex-direction: row;
  443. flex-wrap: nowrap;
  444. justify-content: space-between;
  445. align-items: center;
  446. font-size: 12px;
  447. color: #a6a4a5;
  448. }
  449. }
  450. .dataShow {
  451. position: absolute;
  452. right: 0;
  453. top: 0;
  454. z-index: 13;
  455. width: 160px;
  456. height: 32px;
  457. background: rgba(0, 0, 0, 0.5);
  458. border-bottom-left-radius: 12px;
  459. border-top-right-radius: 12px;
  460. display: flex;
  461. .baseInfoPart {
  462. width: 50%;
  463. box-sizing: border-box;
  464. padding-left: 4px;
  465. img {
  466. display: inline-block;
  467. vertical-align: middle;
  468. }
  469. span {
  470. font-size: 14px;
  471. font-weight: 400;
  472. text-align: left;
  473. color: #ffffff;
  474. margin-left: 5px;
  475. }
  476. }
  477. }
  478. }
  479. .singlePart:nth-child(5n) {
  480. margin-right: 0 !important;
  481. }
  482. }
  483. .active {
  484. color: #000000 !important;
  485. font-weight: bold;
  486. }
  487. .selectActive {
  488. background: #DCF1FF;
  489. border-radius: 6px;
  490. color: #00a3ff !important;
  491. padding: 5px;
  492. }
  493. .paganationPage {
  494. position: absolute;
  495. right: 0;
  496. top: 0;
  497. z-index: 11;
  498. }
  499. .contentMain {
  500. min-height: 500px;
  501. }
  502. </style>