popup.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view>
  3. <!-- 弹窗 -->
  4. <view class="bgbox" @click="getClose" v-if="type"></view>
  5. <!-- 预览图 -->
  6. <view v-if="type==1" class="prebox">
  7. <image :src="bgaimg" class="prebga"></image>
  8. <image :src="bgimg" class="prebg"></image>
  9. <image :src="ibga" class="ibga"></image>
  10. <image :src="ibgb" class="ibgb"></image>
  11. <image :src="ibgc" class="ibgc"></image>
  12. <image :src="ibgd" class="ibgd"></image>
  13. <image :src="ibge" class="ibge"></image>
  14. <view class="prelists">
  15. <swiper class="swiper" circular :indicator-dots="indicatorDots" @change="getChange" :current="current" :autoplay="autoplay" :interval="interval" :duration="duration">
  16. <swiper-item v-for="(ite,idx) in swiperimg" :key='idx'>
  17. <image :src="baseUrl+ite" class="swimg" @click="getPreview(swiperimg,idx)"></image>
  18. </swiper-item>
  19. </swiper>
  20. <image :src="lbtn" class="btn btn1" @click="getPre"></image>
  21. <image :src="rbtn" class="btn btn2" @click="getNext"></image>
  22. </view>
  23. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import config from '@/config'
  29. const baseUrl = config.baseUrl
  30. export default{
  31. props:{
  32. type: {
  33. type: Number,
  34. default () {
  35. return 0
  36. }
  37. },
  38. imgobj:{
  39. type:Object,
  40. default () {
  41. return {}
  42. }
  43. }
  44. },
  45. watch:{
  46. type(val){
  47. if(val==1){
  48. this.swiperimg=this.imgobj.urls;
  49. this.current=this.imgobj.idx;
  50. }
  51. }
  52. },
  53. data(){
  54. return{
  55. // type:0,
  56. bgimg:require("@/work/static/order/bg.png"),
  57. bgaimg:require("@/work/static/order/bga.png"),
  58. ibga:require("@/work/static/order/ibga.png"),
  59. ibgb:require("@/work/static/order/ibgb.png"),
  60. ibgc:require("@/work/static/order/ibgc.png"),
  61. ibgd:require("@/work/static/order/ibgd.png"),
  62. ibge:require("@/work/static/order/ibge.png"),
  63. closeimg:require("@/static/images/close.png"),
  64. lbtn:require("@/work/static/order/lbtn.png"),
  65. rbtn:require("@/work/static/order/rbtn.png"),
  66. autoplay:false,
  67. indicatorDots:false,
  68. interval:5000,
  69. duration:500,
  70. swiperimg:[],
  71. current:0,
  72. baseUrl:''
  73. }
  74. },
  75. mounted() {
  76. this.baseUrl = baseUrl
  77. },
  78. methods:{
  79. getClose(){
  80. this.$emit("getClose")
  81. },
  82. getChange(e){
  83. var val=e.detail.current;
  84. this.current=val;
  85. },
  86. getPre(){
  87. let curidx = this.current;
  88. let ncurrent = curidx > 0 ? curidx - 1 : this.swiperimg.length - 1;
  89. this.current = ncurrent
  90. },
  91. getNext(){
  92. let curidx = this.current;
  93. let ncurrent = curidx < (this.swiperimg.length - 1) ? curidx + 1 : 0;
  94. this.current = ncurrent
  95. },
  96. getPreview(url,idx) {
  97. var newArr=[];
  98. url.forEach(ite=>{
  99. var ds=this.baseUrl+ite
  100. newArr.push(ds)
  101. })
  102. uni.previewImage({
  103. urls: newArr,
  104. current:idx,
  105. success: function(data) {
  106. },
  107. fail: function(err) {
  108. }
  109. });
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. // 公共
  116. .pbtn{text-align: center;font-size: 30rpx;font-weight: 500;flex:0 0 auto;
  117. &.btn1{background: #1f57e6;color: #ffffff;height: 70rpx;border-radius: 35rpx;line-height: 70rpx;width: 100%;}
  118. &.btn2{color: #aaa;margin-top: 14rpx;padding:10rpx;}
  119. }
  120. .cloimg{width: 56rpx;height: 56rpx;position: absolute;bottom: -80rpx;left: 50%;margin-left: -28rpx;}
  121. // 图片预览
  122. .prebox{position: fixed;width: 580rpx;height: 400rpx;left: 88rpx;right: 78rpx;top: 50%;margin-top: -280rpx;z-index: 10;box-sizing: border-box;
  123. .prebga{width: 100%;height: 100%;}
  124. .prebg{position: absolute;left: -3rpx;right: -3rpx;top: -4rpx;bottom: -4rpx;max-width: none;width: 586rpx;height: 408rpx;}
  125. .ibga{width: 96rpx;height: 116rpx;position: absolute;top: -80rpx;left: 268rpx;z-index: 1;}
  126. .ibgb{width: 76rpx;height: 74rpx;position: absolute;top: -14rpx;right: -22rpx;z-index: 1;}
  127. .ibgc{width: 76rpx;height: 78rpx;position: absolute;bottom: -2rpx;right: -32rpx;z-index: 1;}
  128. .ibgd{width: 84rpx;height: 76rpx;position: absolute;bottom: -18rpx;left: -28rpx;z-index: 1;}
  129. .ibge{width: 56rpx;height: 30rpx;position: absolute;top: 68rpx;left: -36rpx;z-index: 1;}
  130. .btn{
  131. width: 40rpx;height: 40rpx;position: absolute;top: 50%;margin-top: -20rpx;z-index: 1;
  132. &.btn1{left: 14rpx;}
  133. &.btn2{right: 14rpx;}
  134. }
  135. .prelists{position: absolute;top: 18rpx;right: 16rpx;bottom: 14rpx;left: 26rpx;box-sizing: border-box;border-radius: 12rpx;overflow: hidden;
  136. .swiper{width: 100%;height: 100%;
  137. .swimg{width: 100%;height: 100%;}
  138. }
  139. }
  140. }
  141. // 293 204 290 200
  142. </style>