GradeStandardPaper.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="grade-standard-paper paper-carousel">
  3. <div class="carousel-title">
  4. <h3>标准卷</h3>
  5. <Select v-model="curLevel" @on-change="getPapers">
  6. <Option
  7. v-for="(level, gindex) in levels"
  8. :key="gindex"
  9. :value="level.id"
  10. :label="level.code"
  11. ></Option>
  12. </Select>
  13. </div>
  14. <div class="carousel-body">
  15. <!-- 换一个轮播组件 -->
  16. <Carousel
  17. v-model="curPaperIndex"
  18. arrow="always"
  19. dots="none"
  20. :loop="false"
  21. ref="Carousel"
  22. >
  23. <CarouselItem v-for="(paper, pindex) in papers" :key="pindex">
  24. <div class="image-view-contain">
  25. <img :src="paper.thumbSrc" :alt="paper.title" />
  26. </div>
  27. </CarouselItem>
  28. </Carousel>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import { paperList } from "@/api";
  34. export default {
  35. name: "grade-standard-paper",
  36. props: {
  37. levels: {
  38. type: Array,
  39. default() {
  40. return [];
  41. }
  42. }
  43. },
  44. data() {
  45. return {
  46. curLevel: "",
  47. papers: [],
  48. curPaperIndex: 0
  49. };
  50. },
  51. mounted() {
  52. this.initData();
  53. },
  54. methods: {
  55. async getPapers() {
  56. const datas = {
  57. level: this.curLevel,
  58. sort: "secretNumber",
  59. isSample: true,
  60. page: 0,
  61. size: 100
  62. };
  63. const data = await paperList(datas);
  64. this.papers = data.data;
  65. this.curPaperIndex = 0;
  66. }
  67. }
  68. };
  69. </script>