showPictures.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view>
  3. <view class="title">
  4. <view class="title_text">鲍鱼展览</view>
  5. </view>
  6. <view class="swiperstyle">
  7. <u-swiper style="width:702rpx" :effect3d="true" height="351rpx" :list="swiperlist" indicatorMode="line"
  8. circular indicator keyName="url" @click="clicktabs"></u-swiper>
  9. </view>
  10. <viewer :images="swiperlist" v-if="isPreviewVisible" @close="isPreviewVisible = false"></viewer>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. carouselList
  16. } from '@/http/api/common.js'
  17. export default {
  18. data() {
  19. return {
  20. swiperlist: [],
  21. isPreviewVisible: false
  22. }
  23. },
  24. async mounted() {
  25. this.getCarouselList()
  26. },
  27. methods: {
  28. async getCarouselList() {
  29. //获取轮播图
  30. let res = await carouselList({
  31. modules: '3'
  32. })
  33. if (res.data.code == 200) {
  34. let data = res.data.data.rows
  35. this.swiperlist = data.map(v => {
  36. return {
  37. ...v,
  38. url: v.carouselUrlList[0].fileUrl
  39. }
  40. })
  41. }
  42. },
  43. clicktabs(item) {
  44. console.log(this.swiperlist[item].url)
  45. uni.previewImage({
  46. loop: true,
  47. urls: [this.swiperlist[item].url]
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style>
  54. .title {
  55. display: flex;
  56. width: 90vw;
  57. justify-content: space-between;
  58. margin: 0 auto;
  59. }
  60. .title_text {
  61. width: 128rpx;
  62. height: 45rpx;
  63. font-size: 32rpx;
  64. font-weight: bold;
  65. color: #333333;
  66. line-height: 45rpx;
  67. }
  68. .swiperstyle {
  69. width: 702rpx;
  70. height: 351rpx;
  71. box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.1);
  72. border-radius: 16rpx;
  73. margin-top: 20rpx;
  74. }
  75. </style>