courseResourcesAll.vue 12 KB

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