index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <common-header />
  3. <div class="content">
  4. <div class="title">
  5. 在线学习 <span>智慧教研-</span><span>在线学习</span>
  6. </div>
  7. <div class="jy-header">
  8. <p>在线学习</p>
  9. <div class="search">
  10. <input v-model="keyword" type="text" placeholder="搜索关键字" />
  11. <span class="inp-sear" @click="getData"></span>
  12. </div>
  13. </div>
  14. <div class="nav">
  15. <div class="search-list">
  16. <div class="label">年级</div>
  17. <div class="valueDiv">
  18. <div class="item pointer" :class="activeGrade==item.grade_id?'active':''" @click="initGrade(item)" v-for="item in gradeData" :key="item.grade_id">{{item.grade_name}}</div>
  19. </div>
  20. </div>
  21. <div class="search-list">
  22. <div class="label">科目</div>
  23. <div class="valueDiv">
  24. <div class="item pointer" :class="activeSubject==item.subject_id?'active':''" @click="initSubject(item)" v-for="item in subjectData" :key="item.subject_id">{{item.subject_name}}</div>
  25. </div>
  26. </div>
  27. <div class="search-list">
  28. <div class="label">分类</div>
  29. <div class="valueDiv">
  30. <div class="item pointer" :class="activeType==item.v?'active':''" @click="initType(item)" v-for="item in typeData" :key="item.v">{{item.n}}</div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="ysgc-kind">
  35. <ul class="specail">
  36. <li class="kc" v-for="(item, index) in listData" :key="index">
  37. <div>
  38. <video v-if="item.zz_video" class="mask" @click="zxxxspDetail(item.zz_id)" style="width: 100%"></video>
  39. </div>
  40. <img @click="zxxxxqDetail(item.zz_id)" class="kc-back" :src="https + item.zz_img" alt="" />
  41. <div class="kc-des">
  42. <p class="kc-name">{{ item.zz_name }}</p>
  43. <div class="rate">
  44. <!-- <el-rate v-model="item.zz_star_num"></el-rate> -->
  45. <img v-for="star in Number(item.zz_star_num)" :key="star" src="@/assets/img/zhjyzxxx/star.png" alt="" />
  46. </div>
  47. </div>
  48. <div class="dataShow">
  49. <div class="baseInfoPart">
  50. <img src="/kczy/fingerIcon.png" alt="">
  51. <span>{{item.zz_like_num}}</span>
  52. </div>
  53. <div class="baseInfoPart">
  54. <img src="/kczy/cellectIcon.png" alt="">
  55. <span>{{item.zz_fav_num}}</span>
  56. </div>
  57. </div>
  58. </li>
  59. </ul>
  60. </div>
  61. <div class="footer">
  62. <div style="width: 1400px; height: 50px; position: relative; margin: 0 auto">
  63. <el-pagination background layout="total,prev, pager, next" :total="total" style="position: absolute; top: 0; right: 0" @current-change="handleCurrentChange" :page-size="limit">
  64. </el-pagination>
  65. </div>
  66. </div>
  67. </div>
  68. </template>
  69. <script>
  70. import { zxxx_list, grade_list, subject_list } from "./api";
  71. import CommonHeader from "@/components/CommonHeader/index.vue";
  72. export default {
  73. name: "index",
  74. components: {
  75. CommonHeader,
  76. },
  77. data() {
  78. return {
  79. listData: [],
  80. keyword: "",
  81. limit: 10,
  82. total: 0,
  83. cur_page: 1,
  84. https: window.GLOBAL_CONFIG.api,
  85. gradeList: [],
  86. subjectList: [],
  87. grade_id: "",
  88. subject_id: "",
  89. firstForm: {
  90. grade: "",
  91. subject: "",
  92. },
  93. gradeData: [],
  94. activeGrade: "",
  95. subjectData: [],
  96. activeSubject: "",
  97. typeData: [],
  98. activeType: "",
  99. };
  100. },
  101. methods: {
  102. //跳转
  103. zxxxxqDetail(id) {
  104. this.$router.push({ name: "zhjy_zhjyzxxx_zxxxxq", params: { id: id } });
  105. },
  106. zxxxspDetail(id) {
  107. this.$router.push({ name: "zhjy_zhjyzxxx_zxxxsp", params: { id: id } });
  108. },
  109. //数据获取
  110. getData() {
  111. let data = {
  112. page: this.cur_page,
  113. limit: this.limit,
  114. keyword: this.keyword,
  115. grade_id: this.activeGrade,
  116. subject_id: this.activeSubject,
  117. zz_type: this.activeType,
  118. };
  119. zxxx_list(data).then((res) => {
  120. this.listData = res.data.page_data;
  121. console.log(this.listData);
  122. this.cur_page = Number(res.data.page_now);
  123. this.total = Number(res.data.total_rows);
  124. });
  125. },
  126. handleCurrentChange(val) {
  127. this.cur_page = val;
  128. this.listData();
  129. },
  130. //年级
  131. initGradeData() {
  132. this.gradeData = [
  133. {
  134. grade_id: "",
  135. grade_name: "全部",
  136. }
  137. ];
  138. grade_list().then((res) => {
  139. if (res.code == 1) {
  140. this.gradeData = this.gradeData.concat(res.data.page_data);
  141. }
  142. });
  143. },
  144. initGrade(value) {
  145. this.activeGrade = value.grade_id;
  146. this.getData();
  147. },
  148. //科目
  149. initSubjectData() {
  150. this.subjectData = [
  151. {
  152. subject_id: "",
  153. subject_name: "全部",
  154. }
  155. ];
  156. subject_list().then((res) => {
  157. if (res.code == 1) {
  158. this.subjectData = this.subjectData.concat(res.data.page_data);
  159. }
  160. });
  161. },
  162. initSubject(value) {
  163. console.log(value, 123);
  164. this.activeSubject = value.subject_id;
  165. this.getData();
  166. },
  167. // 分类
  168. initTypeData() {
  169. this.typeData = [
  170. {
  171. v: "",
  172. n: "全部"
  173. }
  174. ];
  175. zxxx_list().then((res) => {
  176. if (res.code == 1) {
  177. this.typeData = this.typeData.concat(res.data.table_structure.field.zz_type.option);
  178. }
  179. });
  180. },
  181. initType(value) {
  182. this.activeType = value.v;
  183. this.getData();
  184. },
  185. },
  186. mounted() {
  187. this.getData();
  188. this.initGradeData();
  189. this.initSubjectData();
  190. this.initTypeData();
  191. },
  192. };
  193. </script>
  194. <style lang="scss" scoped>
  195. .dataShow {
  196. position: absolute;
  197. right: 0;
  198. top: 0;
  199. z-index: 13;
  200. width: 160px;
  201. height: 32px;
  202. line-height: 32px;
  203. background: rgba(0, 0, 0, 0.5);
  204. border-bottom-left-radius: 12px;
  205. border-top-right-radius: 12px;
  206. display: flex;
  207. padding-left: 5px;
  208. .baseInfoPart {
  209. width: 50%;
  210. box-sizing: border-box;
  211. padding-left: 4px;
  212. img {
  213. display: inline-block;
  214. vertical-align: middle;
  215. }
  216. span {
  217. font-size: 14px;
  218. font-weight: 400;
  219. text-align: left;
  220. color: #ffffff;
  221. margin-left: 5px;
  222. }
  223. }
  224. }
  225. .search-list {
  226. display: flex;
  227. align-items: baseline;
  228. font-size: 14px;
  229. margin: 20px 0;
  230. .label {
  231. color: #000;
  232. margin-right: 25px;
  233. }
  234. .valueDiv {
  235. flex: 1;
  236. display: flex;
  237. color: #949494;
  238. border-bottom: 1px dashed #e4e6e8;
  239. padding-bottom: 15px;
  240. font-weight: 400;
  241. cursor: pointer;
  242. .item + .item {
  243. margin-left: 20px;
  244. }
  245. .item {
  246. padding: 3px 5px;
  247. &.active {
  248. color: #00a3ff;
  249. border-radius: 6px;
  250. background: rgba($color: #00a3ff, $alpha: 0.1);
  251. }
  252. }
  253. }
  254. }
  255. .content {
  256. width: 100%;
  257. min-width: 1400px;
  258. margin: 0 auto;
  259. }
  260. .title {
  261. width: 1400px;
  262. height: 55px;
  263. line-height: 55px;
  264. font-size: 18px;
  265. font-family: PingFangSC, PingFangSC-Regular;
  266. font-weight: 400;
  267. color: #050026;
  268. margin: 0 auto;
  269. span:first-of-type {
  270. width: 56px;
  271. height: 20px;
  272. font-size: 14px;
  273. font-family: PingFangSC, PingFangSC-Regular;
  274. font-weight: 400;
  275. text-align: left;
  276. color: #949494;
  277. line-height: 20px;
  278. margin-left: 30px;
  279. }
  280. span:last-of-type {
  281. width: 56px;
  282. height: 20px;
  283. font-size: 14px;
  284. font-family: PingFangSC, PingFangSC-Regular;
  285. font-weight: 400;
  286. text-align: left;
  287. color: #000000;
  288. line-height: 20px;
  289. }
  290. }
  291. .jy-header {
  292. width: 100%;
  293. height: 200px;
  294. background: url("@/assets/img/zhjyzxxx/zxxx_bg.png");
  295. background-size: 100% 200px;
  296. background-repeat: no-repeat;
  297. padding-top: 40px;
  298. p {
  299. width: 192px;
  300. height: 67px;
  301. font-size: 48px;
  302. font-family: PingFangSC, PingFangSC-Semibold;
  303. font-weight: 600;
  304. text-align: left;
  305. color: #ffffff;
  306. line-height: 67px;
  307. margin: 0 auto;
  308. margin-bottom: 15px;
  309. }
  310. .search {
  311. position: relative;
  312. height: 50px;
  313. width: 497px;
  314. margin: 0 auto;
  315. input {
  316. background: #ffffff;
  317. border-radius: 8px;
  318. border: 1px solid #00a3ff;
  319. height: 50px;
  320. padding: 20px;
  321. width: 100%;
  322. outline: none;
  323. }
  324. .inp-sear {
  325. display: block;
  326. width: 26px;
  327. height: 26px;
  328. background-color: #00a3ff;
  329. border-radius: 6px;
  330. position: absolute;
  331. top: 11px;
  332. right: 10px;
  333. background-image: url("@/assets/img/zhjyzxxx/search.png");
  334. background-size: 60%;
  335. background-position: center;
  336. background-repeat: no-repeat;
  337. }
  338. }
  339. }
  340. .nav {
  341. width: 1400px;
  342. margin: 0 auto;
  343. display: flex;
  344. flex-direction: column;
  345. margin-bottom: 20px;
  346. div {
  347. display: flex;
  348. span {
  349. padding-top: 10px;
  350. display: inline-block;
  351. width: 50px;
  352. height: 50px;
  353. font-size: 16px;
  354. font-family: PingFangSC, PingFangSC-Semibold;
  355. font-weight: 600;
  356. text-align: center;
  357. color: #000000;
  358. line-height: 21px;
  359. }
  360. }
  361. }
  362. .ysgc-kind {
  363. // width: 1650px;
  364. width: 1400px;
  365. margin: 0 auto;
  366. .specail {
  367. width: 100%;
  368. display: flex;
  369. flex-wrap: wrap;
  370. li {
  371. height: 278px;
  372. display: inline-block;
  373. margin: 0 13px 17px 0;
  374. overflow: hidden;
  375. box-shadow: 0px 10px 24px 0px rgba(161, 153, 168, 0.18);
  376. }
  377. .kc {
  378. width: 330px;
  379. background: #ffffff;
  380. border-radius: 12px;
  381. box-shadow: 0px 10px 24px 0px rgba(161, 153, 168, 0.18);
  382. position: relative;
  383. .kc-back {
  384. width: 100%;
  385. height: 196px;
  386. display: block;
  387. }
  388. .mask {
  389. z-index: 4;
  390. width: 100%;
  391. height: 196px;
  392. display: block;
  393. position: absolute;
  394. top: 0;
  395. left: 0;
  396. background: rgba(0, 0, 0, 0.4) url("@/assets/img/zhjy/start.png")
  397. no-repeat center;
  398. }
  399. .kc-des {
  400. padding: 11px 6px;
  401. box-sizing: border-box;
  402. .kc-name {
  403. height: 22px;
  404. font-size: 16px;
  405. font-family: PingFangSC, PingFangSC-Regular;
  406. font-weight: 400;
  407. color: #000000;
  408. line-height: 22px;
  409. }
  410. .rate {
  411. display: flex;
  412. margin: 11px 0;
  413. img {
  414. margin-right: 6px;
  415. }
  416. }
  417. }
  418. }
  419. }
  420. }
  421. .footer {
  422. width: 100%;
  423. height: 50px;
  424. margin-top: 100px;
  425. display: inline-block;
  426. }
  427. </style>