telephone-clients 4.0.0-1-69 → 4.0.0-1-70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telephone-clients",
3
- "version": "4.0.0-1-69",
3
+ "version": "4.0.0-1-70",
4
4
  "description": "呼叫模块前台组件",
5
5
  "main": "src/index.js",
6
6
  "directories": {
@@ -0,0 +1,228 @@
1
+ <template>
2
+ <div>
3
+ <img :src="src" :alt="alt" @click.stop="open()" :width="width" :height="height" title="点击查看图片"
4
+ :id="'vc-imgself-img-'+attach">
5
+ <div class="full-img" v-show="show" @contextmenu.prevent.stop="clearStyle">
6
+ <img :src="src2" alt="" class="img-state" :alt="alt || ''" @mousewheel="bigimg(this)" id="image" draggable="false"
7
+ @mousedown.prevent="dropImage" style="position:fixed">
8
+ <div class="btns row">
9
+ <button type="button" name="button" class="btn btn-primary" @click.stop="leftRevolve()">向左旋转</button>
10
+ <button type="button" name="button" class="btn btn-primary" @click.stop="rightRevolve()">向右旋转</button>
11
+ <button type="button" name="button" class="btn btn-primary" @click.stop="close()">关闭</button>
12
+ <button type="button" name="button" class="btn btn-primary" @click.stop="previousPage()">上一页</button>
13
+ <button type="button" name="button" class="btn btn-primary" @click.stop="nextPage()">下一页</button>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ import $ from 'jquery'
21
+
22
+ export default {
23
+ props: {
24
+ src: {
25
+ type: String
26
+ },
27
+ width: {
28
+ default: 60
29
+ },
30
+ height: {
31
+ default: 60
32
+ },
33
+ alt: {
34
+ default: '图片加载失败'
35
+ },
36
+ attach: {
37
+ type: String,
38
+ default: 'name'
39
+ },
40
+ list: {
41
+ type: Array,
42
+ default: []
43
+ }
44
+ },
45
+ data() {
46
+ return {
47
+ show: false,
48
+ deg: 0,
49
+ odiv: null,
50
+ powerw: 1.0,
51
+ container:null,
52
+ positionX: null,
53
+ positionY: null,
54
+ powerh: 1.0,
55
+ src2:""
56
+ }
57
+ },
58
+ ready(){
59
+ const elementsToMount = document.getElementsByClassName("full-img");
60
+ this.container = document.createElement('div');
61
+ this.container.style.height = '0px'
62
+ // 将要挂载的元素放入新创建的 div中
63
+ for (let i = 0; i < elementsToMount.length; i++) {
64
+ this.container.appendChild(elementsToMount[i]);
65
+ }
66
+ // 将新创建的 div 挂载到 body 上
67
+ document.body.appendChild(this.container);
68
+ this.src2=this.src
69
+ },
70
+ beforeDestroy(){
71
+ // 销毁挂载的
72
+ if (this.container && this.container.parentNode) {
73
+ this.container.parentNode.removeChild(this.container);
74
+ }
75
+ },
76
+ methods: {
77
+ nextPage() {
78
+ console.log(this.list)
79
+ //当前图片,是最后一张图片
80
+ if (this.src2=== this.list[this.list.length - 1].f_overall_path) {
81
+ this.src2= this.list[0].f_overall_path
82
+ } else {
83
+ for (let i = 0; i < this.list.length; i++) {
84
+ if (this.src2=== this.list[i].f_overall_path) {
85
+ this.src2= this.list[i + 1].f_overall_path
86
+ break
87
+ }
88
+ }
89
+ }
90
+
91
+ },
92
+ previousPage() {
93
+ console.log(this.list)
94
+ //当前图片,是第一张图片
95
+ if (this.src2 === this.list[0].f_overall_path) {
96
+ this.src2= this.list[this.list.length - 1].f_overall_path
97
+ } else {
98
+ for (let i = 0; i < this.list.length; i++) {
99
+ if (this.src2=== this.list[i].f_overall_path) {
100
+ this.src2= this.list[i - 1].f_overall_path
101
+ break
102
+ }
103
+ }
104
+ }
105
+ },
106
+ clearStyle(e){
107
+ if (e === null) {
108
+ return
109
+ }
110
+ this.odiv = document.getElementById('image')
111
+ this.odiv.style.left = 500 + 'px';
112
+ this.odiv.style.top = -150 + 'px';
113
+ },
114
+ bigimg() {
115
+ if (event.wheelDelta > 0) {
116
+ this.powerh = this.powerh * 1.15
117
+ this.powerw = 1.15 * this.powerw
118
+ } else {
119
+ this.powerh = this.powerh * 0.85
120
+ this.powerw = 0.85 * this.powerw
121
+ }
122
+ this.imgState()
123
+ },
124
+ dropImage(e) {
125
+ if (e === null) {
126
+ return
127
+ }
128
+ this.odiv = e.target;
129
+ let disX = e.clientX - this.odiv.offsetLeft;
130
+ let disY = e.clientY - this.odiv.offsetTop;
131
+ document.onmousemove = (e) => {
132
+ let left = e.clientX - disX;
133
+ let top = e.clientY - disY;
134
+ this.positionX = top;
135
+ this.positionY = left;
136
+ this.odiv.style.left = left + 'px';
137
+ this.odiv.style.top = top + 'px';
138
+ };
139
+ document.onmouseup = (e) => {
140
+ document.onmousemove = null;
141
+ document.onmouseup = null;
142
+ };
143
+ },
144
+ open() {
145
+ this.deg = 0
146
+ this.powerw = 0.55 // Initial scale X for the image
147
+ this.powerh = 0.65 // Initial scale Y for the image
148
+
149
+ // Make the .full-img (black background) full size by setting its scale to 1,1
150
+ // It will still rotate with the image.
151
+ $('.full-img').css({
152
+ 'transform': 'rotate(' + this.deg + 'deg) scale(1, 1)'
153
+ })
154
+
155
+ // Apply the initial rotation and scale (this.powerw, this.powerh) to the image itself
156
+ this.imgState()
157
+
158
+ // This line was in the original code, related to a '.container' element.
159
+ // Leaving it as is, as it's not directly tied to the black box scale.
160
+ $('.container').css({
161
+ 'opacity': '1'
162
+ })
163
+
164
+ this.show = true
165
+ },
166
+ close() {
167
+ this.show = false
168
+ },
169
+ leftRevolve() {
170
+ //tag
171
+ this.deg -= 90
172
+ this.imgState()
173
+ },
174
+ rightRevolve() {
175
+ //tag
176
+ this.deg += 90
177
+ this.imgState()
178
+ },
179
+ imgState() {
180
+ $('.img-state').css({
181
+ 'transform': 'rotate(' + this.deg + 'deg) scale(' + this.powerh + ' ,' + this.powerw + ')'
182
+ })
183
+
184
+ }
185
+ },
186
+ watch:{
187
+ 'src'(val){
188
+ if(val){
189
+ this.src2 = val
190
+ }
191
+ }
192
+ }
193
+ }
194
+ </script>
195
+ <style media="screen" scoped>
196
+ .full-img {
197
+ position: fixed;
198
+ width: 100%;
199
+ /*height: 1000px;*/
200
+ overflow: hidden;
201
+ top: 0;
202
+ bottom: 0;
203
+ left: 0;
204
+ right: 0;
205
+ z-index: 1070;
206
+ opacity: 1;
207
+ background: rgba(0, 0, 0, 0.8);
208
+ display: flex;
209
+ flex-direction: column;
210
+ justify-content: center;
211
+ align-items: center;
212
+ color: #fff;
213
+ }
214
+
215
+ .btns {
216
+ position: fixed;
217
+ bottom: 100px;
218
+ height: auto;
219
+ }
220
+
221
+ .btns button {
222
+ margin-right: 20px;
223
+ }
224
+
225
+ .img-state {
226
+
227
+ }
228
+ </style>