@v2coding/ui 0.1.0 → 0.1.5
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/README.md +1 -1
- package/dist/v2coding-ui.esm.js +9498 -6624
- package/dist/v2coding-ui.min.js +1 -1
- package/dist/v2coding-ui.ssr.js +7780 -4948
- package/package.json +1 -1
- package/src/components/field/field.fence.vue +856 -0
- package/src/components/field/field.lnglat.vue +236 -0
- package/src/components/field/field.rich.vue +0 -10
- package/src/components/fill-view/{index.vue → fill-view.vue} +0 -0
- package/src/components/form/form.item.vue +0 -3
- package/src/components/form/form.vue +48 -39
- package/src/components/head-menu/{index.vue → head-menu.vue} +1 -1
- package/src/components/head-menu/menu-item.vue +8 -12
- package/src/components/history/{index.vue → history.vue} +11 -10
- package/src/components/icon/icon.vue +4 -4
- package/src/components/minimize/{index.vue → minimize.vue} +1 -1
- package/src/components/page/search-page.vue +202 -0
- package/src/components/scroll-view/scroll-view.vue +21 -21
- package/src/components/table/table.select.vue +1 -1
- package/src/components/table/table.vue +8 -6
- package/src/components/field/field.upload.portrait.vue +0 -304
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="ui-image-upload-file">
|
|
4
|
-
<div class="item" v-show="showPhoto">
|
|
5
|
-
<div class="modal">
|
|
6
|
-
<a :href="photoUrl" target="_blank"><i class="el-icon-zoom-in"></i></a>
|
|
7
|
-
<i class="el-icon-delete" @click="remove()"></i>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="image" :style="{'background-image': `url(${imgUrl})`}"></div>
|
|
10
|
-
</div>
|
|
11
|
-
<el-row v-show="!showPhoto">
|
|
12
|
-
<div @click="showDialog" class="item upload-btn">
|
|
13
|
-
<i class="el-icon-fa-camera"></i>
|
|
14
|
-
</div>
|
|
15
|
-
</el-row>
|
|
16
|
-
</div>
|
|
17
|
-
<ui-dialog :title="title" :visible.sync="visible" width="30%" :confirm="onConfirm">
|
|
18
|
-
<el-row v-loading="videoLoading">
|
|
19
|
-
<video id="videos" width="100%"/>
|
|
20
|
-
</el-row>
|
|
21
|
-
<el-row class="close">
|
|
22
|
-
<el-col v-show="false">
|
|
23
|
-
<canvas id="canvas" :width="w + 'px'" :height="h + 'px'"/>
|
|
24
|
-
</el-col>
|
|
25
|
-
<el-col :span="12">
|
|
26
|
-
<img :src="imgUrl" class="show-img" width="100%" alt="">
|
|
27
|
-
</el-col>
|
|
28
|
-
<el-col :span="12" class="buttons">
|
|
29
|
-
<div class="buttons-desc">
|
|
30
|
-
<div class="capture">
|
|
31
|
-
<div
|
|
32
|
-
:class="{'out-circle': true, reduce: isReduce}"
|
|
33
|
-
@click="capture"
|
|
34
|
-
@mousedown="isReduce = true"
|
|
35
|
-
@mouseup="isReduce = false"
|
|
36
|
-
@mouseleave="isReduce = false"
|
|
37
|
-
>
|
|
38
|
-
<i class="el-icon-fa-camera"></i>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<el-button @click="updatePortrait">上传照片</el-button>
|
|
42
|
-
</div>
|
|
43
|
-
</el-col>
|
|
44
|
-
</el-row>
|
|
45
|
-
<span slot="footer" class="dialog-footer">
|
|
46
|
-
<el-button>取 消</el-button>
|
|
47
|
-
<el-button type="primary">确 定</el-button>
|
|
48
|
-
</span>
|
|
49
|
-
</ui-dialog>
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
<script>
|
|
53
|
-
import FieldMixin from './field.mixin';
|
|
54
|
-
import Upload from './field.helper.upload';
|
|
55
|
-
|
|
56
|
-
export default {
|
|
57
|
-
name: 'ui-field-upload-portrait',
|
|
58
|
-
mixins: [FieldMixin],
|
|
59
|
-
data() {
|
|
60
|
-
return {
|
|
61
|
-
videoLoading: true, //相机初始化loading
|
|
62
|
-
isReduce: false, //拍照按钮动画
|
|
63
|
-
front: true,//是否打开后摄像头
|
|
64
|
-
showPhoto: false,
|
|
65
|
-
imgUrl: '',
|
|
66
|
-
photoUrl: '',
|
|
67
|
-
w: 320,
|
|
68
|
-
h: 240,
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
props: {
|
|
72
|
-
params: {
|
|
73
|
-
type: Object,
|
|
74
|
-
default: () => ({
|
|
75
|
-
rootDirName: 'image',
|
|
76
|
-
fileType: 2,
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
title: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: '请上传照片',
|
|
82
|
-
},
|
|
83
|
-
filename: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: 'file',
|
|
86
|
-
},
|
|
87
|
-
url: {
|
|
88
|
-
type: String,
|
|
89
|
-
default: '/api/oss/upload',
|
|
90
|
-
},
|
|
91
|
-
uploadType: {
|
|
92
|
-
type: String,
|
|
93
|
-
validator: (val) => ['oss', 'default'].includes(val),
|
|
94
|
-
default: 'default',
|
|
95
|
-
},
|
|
96
|
-
visible: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
default: false,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
methods: {
|
|
102
|
-
remove() {
|
|
103
|
-
this.imgUrl = '';
|
|
104
|
-
this.showPhoto = false;
|
|
105
|
-
},
|
|
106
|
-
showDialog() {
|
|
107
|
-
this.visible = true;
|
|
108
|
-
this.init();
|
|
109
|
-
},
|
|
110
|
-
onConfirm() {
|
|
111
|
-
if (this.photoUrl === '') {
|
|
112
|
-
this.$message.error('请上传图片后点击确定');
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
this.visible = false;
|
|
116
|
-
this.onChange(this.photoUrl);
|
|
117
|
-
this.showPhoto = true;
|
|
118
|
-
},
|
|
119
|
-
//点击拍照
|
|
120
|
-
capture() {
|
|
121
|
-
const videoDom = document.getElementById('videos');
|
|
122
|
-
const canvas = document.getElementById('canvas');
|
|
123
|
-
const ctx = canvas.getContext('2d');
|
|
124
|
-
ctx.drawImage(videoDom, 0, 0, this.w, this.h);
|
|
125
|
-
this.imgUrl = canvas.toDataURL();
|
|
126
|
-
},
|
|
127
|
-
//初始化 打开摄像头
|
|
128
|
-
init() {
|
|
129
|
-
const _this = this;
|
|
130
|
-
const constraints = {video: {width: this.w, height: this.h, facingMode: {exact: this.front ? 'user' : 'environment'}}};
|
|
131
|
-
navigator.mediaDevices.getUserMedia(constraints).then(function(mediaStream) {
|
|
132
|
-
const video = document.querySelector('video');
|
|
133
|
-
video.srcObject = mediaStream;
|
|
134
|
-
_this.videoLoading = false;
|
|
135
|
-
video.onloadedmetadata = function() {
|
|
136
|
-
video.play();
|
|
137
|
-
};
|
|
138
|
-
}).catch(function(err) {
|
|
139
|
-
console.log(err.name + ': ' + err.message);
|
|
140
|
-
}); // 总是在最后检查错误
|
|
141
|
-
},
|
|
142
|
-
//base64转file
|
|
143
|
-
toFile(value, fileName) {
|
|
144
|
-
if (value !== null || ('' && value.indexOf('base'))) {
|
|
145
|
-
const arr = value.split(','), mime = arr[0].match(/:(.*?);/)[1], bsTr = atob(arr[1]);
|
|
146
|
-
let n = bsTr.length, u8arr = new Uint8Array(n);
|
|
147
|
-
while (n--) {
|
|
148
|
-
u8arr[n] = bsTr.charCodeAt(n);
|
|
149
|
-
}
|
|
150
|
-
return new File([u8arr], fileName, {type: mime});
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
//上传照片
|
|
154
|
-
updatePortrait() {
|
|
155
|
-
if (!this.imgUrl) {
|
|
156
|
-
this.$message.error('请先拍照后上传');
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const file = this.toFile(this.imgUrl, 'file.png');
|
|
160
|
-
console.log(file);
|
|
161
|
-
const uploadServer = Upload[this.uploadType] || Upload.default;
|
|
162
|
-
uploadServer(this.url, this.params, {file, filename: this.filename}).then((result) => {
|
|
163
|
-
console.log(result);
|
|
164
|
-
this.photoUrl = result.content.url;
|
|
165
|
-
if (!result.success) {
|
|
166
|
-
this.$message.error(result.message || '上传失败');
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
this.$message.success('上传成功');
|
|
170
|
-
this.onChange('');
|
|
171
|
-
});
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
</script>
|
|
176
|
-
<style lang="less" scoped>
|
|
177
|
-
.ui-image-upload-file {
|
|
178
|
-
width: 100%;
|
|
179
|
-
display: flex;
|
|
180
|
-
flex-direction: row;
|
|
181
|
-
flex-wrap: wrap;
|
|
182
|
-
|
|
183
|
-
.item {
|
|
184
|
-
position: relative;
|
|
185
|
-
display: flex;
|
|
186
|
-
justify-content: center;
|
|
187
|
-
align-items: center;
|
|
188
|
-
overflow: hidden;
|
|
189
|
-
width: 140px;
|
|
190
|
-
height: 140px;
|
|
191
|
-
margin-bottom: 10px;
|
|
192
|
-
margin-right: 10px;
|
|
193
|
-
border: 1px dashed #d0d2d7;
|
|
194
|
-
padding: 8px;
|
|
195
|
-
border-radius: 2px;
|
|
196
|
-
box-sizing: border-box;
|
|
197
|
-
|
|
198
|
-
.modal {
|
|
199
|
-
position: absolute;
|
|
200
|
-
top: 0;
|
|
201
|
-
right: 0;
|
|
202
|
-
bottom: 0;
|
|
203
|
-
left: 0;
|
|
204
|
-
display: flex;
|
|
205
|
-
align-items: center;
|
|
206
|
-
justify-content: space-around;
|
|
207
|
-
background: rgba(0, 0, 0, 0.5);
|
|
208
|
-
visibility: hidden;
|
|
209
|
-
line-height: initial;
|
|
210
|
-
border-radius: 2px;
|
|
211
|
-
|
|
212
|
-
[class^='el-icon-'] {
|
|
213
|
-
color: #fff;
|
|
214
|
-
font-size: 1.5em;
|
|
215
|
-
cursor: pointer;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
> .image {
|
|
220
|
-
width: 100%;
|
|
221
|
-
height: 100%;
|
|
222
|
-
background: no-repeat center;
|
|
223
|
-
background-size: contain;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
&.upload-btn {
|
|
227
|
-
background: #edeef0;
|
|
228
|
-
display: flex;
|
|
229
|
-
align-items: center;
|
|
230
|
-
justify-content: center;
|
|
231
|
-
border: none;
|
|
232
|
-
cursor: pointer;
|
|
233
|
-
|
|
234
|
-
& > i {
|
|
235
|
-
width: 2em;
|
|
236
|
-
color: #888c94;
|
|
237
|
-
font-size: 20px;
|
|
238
|
-
line-height: 1.2;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.item:hover .modal {
|
|
244
|
-
visibility: visible;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
::v-deep .preview {
|
|
248
|
-
display: inline-block;
|
|
249
|
-
width: auto;
|
|
250
|
-
max-width: 60%;
|
|
251
|
-
left: 50%;
|
|
252
|
-
transform: translateX(-50%);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.show-img {
|
|
257
|
-
border: 1px dashed #ccc;
|
|
258
|
-
padding: 5px;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.capture {
|
|
262
|
-
width: 60px;
|
|
263
|
-
height: 60px;
|
|
264
|
-
border-radius: 50%;
|
|
265
|
-
background: #ccc;
|
|
266
|
-
text-align: center;
|
|
267
|
-
color: #CCC;
|
|
268
|
-
overflow: hidden;
|
|
269
|
-
margin: 0 auto 10px;
|
|
270
|
-
|
|
271
|
-
.out-circle {
|
|
272
|
-
width: 50px;
|
|
273
|
-
height: 50px;
|
|
274
|
-
background: #FFF;
|
|
275
|
-
border-radius: 50%;
|
|
276
|
-
line-height: 55px;
|
|
277
|
-
margin: 5px auto;
|
|
278
|
-
overflow: hidden;
|
|
279
|
-
cursor: pointer;
|
|
280
|
-
|
|
281
|
-
i {
|
|
282
|
-
font-size: 20px;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.reduce {
|
|
287
|
-
transform: scale(.8);
|
|
288
|
-
transition: .2s linear;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.buttons {
|
|
293
|
-
position: relative;
|
|
294
|
-
height: 240px;
|
|
295
|
-
|
|
296
|
-
.buttons-desc {
|
|
297
|
-
position: absolute;
|
|
298
|
-
top: 50%;
|
|
299
|
-
left: 50%;
|
|
300
|
-
transform: translate(-50%, -50%);
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
</style>
|