stu_wdsj.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="stu_stfx">
  3. <div class="w-1200px m-auto flex flex-row justify-between">
  4. <div class="w-188px h-full" style="background-color: #fff;">
  5. <leftSiderStu :StuLeftMenuNum="StuLeftMenuNum" />
  6. </div>
  7. <div class="w-1012px p-12 blueBg">
  8. <div class="flex my-20px items-center">
  9. <el-select class="mr-10px" v-model="normal_subject" placeholder="请选择学科" size="large">
  10. <el-option label="全部" value="0" />
  11. <el-option v-for="item in subject_list" :key="item.value" :label="item.label" :value="item.value" />
  12. </el-select>
  13. </div>
  14. <swiper :slidesPerView="1" :spaceBetween="30" :loop="true" :centeredSlides="true"
  15. :pagination="{ clickable: true}"
  16. :autoplay="{
  17. delay: 2500,
  18. disableOnInteraction: false
  19. }"
  20. :navigation="true"
  21. :modules="modules"
  22. class="mySwiper"
  23. >
  24. <swiper-slide class="mainSwiper" v-for="(item,index) in imgArr" :key="index" @click="clickCurrent(item)">
  25. <img :src="item" srcset="">
  26. </swiper-slide>
  27. </swiper>
  28. </div>
  29. </div>
  30. <!-- dialog弹出框 -->
  31. <el-dialog
  32. v-model="dialogVisible"
  33. title="试卷预览"
  34. width="70%"
  35. :before-close="handleClose"
  36. >
  37. <span class="dialogShow">
  38. <img :src="examIcon" alt="">
  39. </span>
  40. </el-dialog>
  41. </div>
  42. </template>
  43. <script lang="ts" setup>
  44. import examIcon from '@/assets/ksfx/examPreview.png';
  45. import { useRouter } from "vue-router";
  46. const router = useRouter();
  47. import { student_wdsj_list } from "~/pages/process/api";
  48. import { ElMessageBox } from 'element-plus'
  49. let StuLeftMenuNum = 1;
  50. let normal_subject = $ref("");
  51. let subject_list = [{
  52. value: '1',
  53. label: '语文'
  54. }, {
  55. value: '2',
  56. label: '数学'
  57. }]
  58. const imgArr = ref(["src/assets/ksfx/examPreview.png", "src/assets/ksfx/examPreview.png"]);
  59. import { Swiper, SwiperSlide } from 'swiper/vue'; // swiper所需组件
  60. // 这是分页器和对应方法,swiper好像在6的时候就已经分离了分页器和一些其他工具
  61. import { Autoplay, Navigation, Pagination, A11y } from 'swiper';
  62. // 引入swiper样式,对应css 如果使用less或者css只需要把scss改为对应的即可
  63. import 'swiper/css';
  64. import 'swiper/css/navigation';
  65. import 'swiper/css/pagination';
  66. //默认滑动效果(这里面注释掉的可以不要)
  67. // const onSwiper = swiper => {
  68. // console.log(swiper);
  69. // };
  70. // const onSlideChange = e => {
  71. // // swiper切换的时候执行的方法
  72. // console.log('slide change', e.activeIndex);
  73. // };
  74. // setup语法糖只需要这样创建一个变量就可以正常使用分页器和对应功能,如果没有这个数组则无法使用对应功能
  75. const modules = [Autoplay, Pagination, Navigation, A11y];
  76. const clickCurrent = (item) => {
  77. console.log(item, "87878");
  78. dialogVisible.value = true;
  79. }
  80. const dialogVisible = ref(false)
  81. const handleClose = (done: () => void) => {
  82. ElMessageBox.confirm('确定要关闭吗?')
  83. .then(() => {
  84. done()
  85. })
  86. .catch(() => {
  87. // catch error
  88. })
  89. }
  90. </script>
  91. <style scoped>
  92. @import '@/styles/ksfx.css';
  93. .mainSwiper{
  94. text-align: center;
  95. img{
  96. display:inline-block;
  97. }
  98. }
  99. .dialogShow{
  100. img{
  101. width:100%;
  102. display:inline-block;
  103. }
  104. }
  105. </style>