userPhotoModal.vue 2.75 KB
<template>
    <!-- 图片放大 -->
	<el-dialog id="userPhotoModal" @click="clickUser"  :visible="userPhotoVisible" @open="openDialog" @close="closeDialog" append-to-body width="800" height="550" >
	  	
           
            <div class="showImg" >
            	 <span  @click.stop="prev" class="prev fa fa-chevron-left" style="font-size:41px"></span>
                <img class="bigImg" :src="imgList[num]">
            	<span  @click.stop="next" class="next fa fa-chevron-right" style="font-size:41px"></span>
            </div>
          	
       
	</el-dialog>
	<!-- 查看详情弹框 /-->
</template>
<script>
import {services} from '../../api'

const BUSINESS_SERVICE =  services.business;

export default{
	props: ['userPhotoVisible', 'photoForm'],
	data(){
		return {
			scrollToRef: '',
			showBigImg:false,
			imgList:[],
			num:0,
            numIndex:0
		}
	},
	methods: {
		openDialog(){
			this.$emit('onUserPhotoModalChange', true)
			//if(this.photoForm.index){
				this.num = this.photoForm.index;
                this.numIndex = this.photoForm.index
				this.imgList = this.photoForm.data;
                console.log(this.imgList)
			//}
		},
		closeDialog(){
			this.$emit('onUserPhotoModalChange', false)
		},
      	
        prev(){
           /* if(this.num==0){
                this.num =this.photoForm.length;
            }
            this.num--;
            */
            this.numIndex--; 
            this.num = Math.abs(this.numIndex) % this.photoForm.length;
            console.log(this.num)
        },
        next(){
           /* if(this.num==this.photoForm.length){
                this.num=this.photoForm.length-1;
            }
            this.num++;*/
            this.numIndex++; 
            this.num = Math.abs(this.numIndex) % this.photoForm.length;
            console.log(this.num)
        }
            
    },
   
	components:{
		
	}
}
</script>
<style scoped>
    .imgMask{
        position: absolute;
        height: 100%;
        width:100%;
        top:0;
        left:0;
        z-index: 100;
        background:rgba(0,0,0,.6); 
    }
     .showImg{
        height:550px;
        position: relative;
        /* position: absolute;
        left:50%;
        top:50%;
        transform:translate(-50%,-50%);
        border:10px solid #fff; */
    } 
    .bigImg{
        width:100%;
        height:100%;
    }
    .prev{
    	position: absolute;
	    top: 50%;
	    width: 27px;
	    height: 44px;
	    margin-top: -22px;
	    outline: 0;
	    left: 10px;
    	background-position: -5px -50px;
		z-index: 999;
    }
   .next {
    	position: absolute;
	    top: 50%;
	    width: 27px;
	    height: 44px;
	    margin-top: -22px;
	    outline: 0;
	    right: 10px;
    	background-position: -5px -50px;
    }
    .el-dialog__body{
        background: red
    }
</style>