userPhotoModal.vue
2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<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>