fstarter 2.10.42 → 2.10.46
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/.babelrc +6 -6
- package/.editorconfig +9 -9
- package/README.md +18 -18
- package/fstarter.iml +9 -0
- package/index.html +22 -22
- package/index.js +222 -222
- package/package.json +104 -104
- package/src/App.vue +38 -38
- package/src/i18n/en-US.js +35 -35
- package/src/i18n/zh-CN.js +35 -35
- package/src/main.js +87 -87
- package/src/plugins/assets/ak.js +948 -948
- package/src/plugins/assets/callNative.js +488 -488
- package/src/plugins/assets/compressImg.js +75 -75
- package/src/plugins/assets/config.js +106 -106
- package/src/plugins/assets/fileServer.js +469 -469
- package/src/plugins/assets/http.js +343 -343
- package/src/plugins/assets/ua.js +27 -27
- package/src/plugins/components/BSButton.vue +61 -61
- package/src/plugins/components/BSCascader.vue +465 -465
- package/src/plugins/components/BSCell.vue +48 -48
- package/src/plugins/components/BSDatePicker.vue +167 -165
- package/src/plugins/components/BSImage.vue +42 -42
- package/src/plugins/components/BSInput.vue +140 -140
- package/src/plugins/components/BSList.vue +81 -81
- package/src/plugins/components/BSPicCode.vue +96 -96
- package/src/plugins/components/BSPopup.vue +43 -43
- package/src/plugins/components/BSRadio.vue +97 -97
- package/src/plugins/components/BSSearch.vue +109 -109
- package/src/plugins/components/BSSelect.vue +144 -144
- package/src/plugins/components/BSSign.vue +454 -454
- package/src/plugins/components/BSStepper.vue +115 -115
- package/src/plugins/components/BSUpload.vue +92 -92
- package/src/plugins/components/BSUpload2.vue +382 -382
- package/src/plugins/components/BSVerCode.vue +131 -134
- package/src/plugins/components/BSViewer.vue +92 -92
- package/src/plugins/components/base.js +496 -496
- package/src/plugins/components/base2.js +489 -489
- package/src/plugins/lib/weixin.js +20 -20
- package/src/plugins/platform/index.js +7 -7
- package/src/plugins/platform/isp_phone.js +306 -306
- package/src/plugins/route/index.js +140 -140
- package/src/plugins/selector/index.js +342 -342
- package/src/plugins/service/index.js +81 -81
- package/src/plugins/services/callCamera.js +53 -53
- package/src/plugins/services/exit.js +36 -36
- package/src/plugins/services/face.js +69 -69
- package/src/plugins/services/faceInApp.js +31 -31
- package/src/plugins/services/getFaceResult.js +104 -104
- package/src/plugins/services/getMenus.js +40 -40
- package/src/plugins/services/getSystemData.js +128 -128
- package/src/plugins/services/getToken.js +79 -79
- package/src/plugins/services/getUserInfo.js +47 -47
- package/src/plugins/services/goSetPage.js +40 -40
- package/src/plugins/services/hideFhoneTitle.js +36 -36
- package/src/plugins/services/index.js +37 -37
- package/src/plugins/services/init.js +35 -35
- package/src/plugins/services/jumpView.js +40 -40
- package/src/plugins/services/logout.js +43 -43
- package/src/plugins/services/share.js +113 -113
- package/src/plugins/services/statusBarHeight.js +39 -39
- package/src/plugins/session/index.js +32 -32
- package/src/services/getAuthInfo.js +22 -22
- package/src/services/index.js +9 -9
- package/src/services/sendVerCode.js +23 -23
- package/src/views/auth.vue +354 -353
- package/src/views/auth2.vue +90 -90
- package/src/views/auth3.vue +148 -148
- package/src/views/auth4.vue +8979 -8979
- package/src/views/auth5.vue +50 -50
- package/src/views/components/BankSelect.vue +55 -55
- package/src/views/foot.vue +140 -140
- package/src/views/page.vue +219 -219
- package/src/views/shellFunc.vue +41 -41
- package/themes/basic.css +1 -1
- package/webpack.config.js +144 -144
|
@@ -1,382 +1,382 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="uploadWrapper">
|
|
3
|
-
<!-- v-if="model.preview" -->
|
|
4
|
-
<van-uploader
|
|
5
|
-
|
|
6
|
-
v-model="fileList"
|
|
7
|
-
preview-size="100%"
|
|
8
|
-
:after-read="afterRead"
|
|
9
|
-
:max-count="model.preview ? 1 : 1000"
|
|
10
|
-
:show-upload="true"
|
|
11
|
-
:upload-icon="model.bgImage"
|
|
12
|
-
:accept="model.accept"
|
|
13
|
-
:preview-image="model.preview"
|
|
14
|
-
capture="camera"
|
|
15
|
-
@delete="deleteFn"
|
|
16
|
-
>
|
|
17
|
-
<van-image :src="model.bgImage"/>
|
|
18
|
-
</van-uploader>
|
|
19
|
-
|
|
20
|
-
<van-popup
|
|
21
|
-
v-model="showCooper"
|
|
22
|
-
position="right"
|
|
23
|
-
closeable
|
|
24
|
-
:overlay="false"
|
|
25
|
-
:style="{
|
|
26
|
-
width: '100%',
|
|
27
|
-
height: '100%'
|
|
28
|
-
}"
|
|
29
|
-
@click-close-icon="cancel"
|
|
30
|
-
>
|
|
31
|
-
<vueCropper
|
|
32
|
-
:img="cooperImage"
|
|
33
|
-
:autoCrop="true"
|
|
34
|
-
:canScale="false"
|
|
35
|
-
:canMove="false"
|
|
36
|
-
:canMoveBox="true"
|
|
37
|
-
:fixedBox="false"
|
|
38
|
-
:info="false"
|
|
39
|
-
:autoCropWidth="270"
|
|
40
|
-
:autoCropHeight="160"
|
|
41
|
-
:fixed="true"
|
|
42
|
-
:fixedNumber='[1.6,1]'
|
|
43
|
-
:enlarge="1"
|
|
44
|
-
:outputSize="1"
|
|
45
|
-
:centerBox="false"
|
|
46
|
-
class="cropper"
|
|
47
|
-
ref="cropper"
|
|
48
|
-
outputType="jpg"
|
|
49
|
-
|
|
50
|
-
>
|
|
51
|
-
|
|
52
|
-
</vueCropper>
|
|
53
|
-
<div class="control">
|
|
54
|
-
<div class="btnWrapper">
|
|
55
|
-
<van-button
|
|
56
|
-
type="primary"
|
|
57
|
-
@click="right"
|
|
58
|
-
>
|
|
59
|
-
旋转
|
|
60
|
-
</van-button>
|
|
61
|
-
</div>
|
|
62
|
-
<div class="btnWrapper">
|
|
63
|
-
<van-button
|
|
64
|
-
type="info"
|
|
65
|
-
loading-text="上传中..."
|
|
66
|
-
:loading="loading"
|
|
67
|
-
@click="copper"
|
|
68
|
-
>
|
|
69
|
-
确定
|
|
70
|
-
</van-button>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</van-popup>
|
|
74
|
-
</div>
|
|
75
|
-
</template>
|
|
76
|
-
|
|
77
|
-
<script>
|
|
78
|
-
import Vue from 'vue'
|
|
79
|
-
import base2 from './base2.js'
|
|
80
|
-
import config from '../assets/config'
|
|
81
|
-
import { compressImg } from '../assets/compressImg'
|
|
82
|
-
|
|
83
|
-
import vueCropper from 'vue-cropper' // 截图插件
|
|
84
|
-
Vue.use(vueCropper)
|
|
85
|
-
|
|
86
|
-
export default {
|
|
87
|
-
name: "bs-upload2",
|
|
88
|
-
mixins: [base2],
|
|
89
|
-
props: {
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
data() {
|
|
93
|
-
return {
|
|
94
|
-
fileList:[],
|
|
95
|
-
fileList2:[],
|
|
96
|
-
showCooper: false,
|
|
97
|
-
cooperImage: '',
|
|
98
|
-
fileObj: null,
|
|
99
|
-
loading: false,
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
mounted() {
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
methods: {
|
|
106
|
-
right() {
|
|
107
|
-
this.$refs.cropper.rotateRight()
|
|
108
|
-
},
|
|
109
|
-
copper() {
|
|
110
|
-
this.loading = true
|
|
111
|
-
this.$refs.cropper.getCropData((file) => {
|
|
112
|
-
let arr = file.split(",")
|
|
113
|
-
let mime = arr[0].match(/:(.*?);/)[1]
|
|
114
|
-
|
|
115
|
-
let bstr = atob(arr[1])
|
|
116
|
-
let n = bstr.length
|
|
117
|
-
let u8arr = new Uint8Array(n)
|
|
118
|
-
while (n--) {
|
|
119
|
-
u8arr[n] = bstr.charCodeAt(n)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var fileObj1 = new File([u8arr], this.file.file.name, { type: mime })
|
|
123
|
-
this._upLoadFile(fileObj1)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
cancel() {
|
|
128
|
-
debugger
|
|
129
|
-
this.showCooper = false
|
|
130
|
-
this.fileList.splice(0, this.fileList.length)
|
|
131
|
-
},
|
|
132
|
-
deleteFn() {
|
|
133
|
-
|
|
134
|
-
//将废弃delete
|
|
135
|
-
this.$emit('delete', this.model.actions)
|
|
136
|
-
this.$emit('del',function(){
|
|
137
|
-
|
|
138
|
-
},this.fullName)
|
|
139
|
-
},
|
|
140
|
-
createDefaultModel() {
|
|
141
|
-
return {
|
|
142
|
-
value:'',
|
|
143
|
-
data:{},
|
|
144
|
-
label:'点击上传',
|
|
145
|
-
bgImage: 'https://img.yzcdn.cn/vant/cat.jpeg',
|
|
146
|
-
remark:'只能上传jpg/png文件,且不超过500kb',
|
|
147
|
-
expired : -1,
|
|
148
|
-
buzId:'1111',
|
|
149
|
-
buz:'SelfReturnVisit',
|
|
150
|
-
domain:'capp',
|
|
151
|
-
actions: '',
|
|
152
|
-
preview:true,
|
|
153
|
-
accept:'image/*',
|
|
154
|
-
type:'BSUpload',
|
|
155
|
-
needCooper: true,
|
|
156
|
-
};
|
|
157
|
-
},
|
|
158
|
-
isGetRightInfo(data) {
|
|
159
|
-
const actions = this.model.actions
|
|
160
|
-
switch (actions) {
|
|
161
|
-
case 'ocr_id0':
|
|
162
|
-
if (data[actions].data.hasOwnProperty('issued_by')) {
|
|
163
|
-
return false
|
|
164
|
-
}
|
|
165
|
-
break
|
|
166
|
-
case 'ocr_id1':
|
|
167
|
-
if (data[actions].data.hasOwnProperty('issued_by')) {
|
|
168
|
-
return false
|
|
169
|
-
}
|
|
170
|
-
break
|
|
171
|
-
case 'ocr_bc':
|
|
172
|
-
if (data[actions].data.bank_cards.length === 0) {
|
|
173
|
-
return false
|
|
174
|
-
}
|
|
175
|
-
break
|
|
176
|
-
default: {
|
|
177
|
-
return true
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return true
|
|
181
|
-
},
|
|
182
|
-
_upLoadFile(fileObj){
|
|
183
|
-
let self = this
|
|
184
|
-
this.$http.uploadFile(
|
|
185
|
-
{
|
|
186
|
-
process: function(msg){
|
|
187
|
-
|
|
188
|
-
if(self.model.preview){
|
|
189
|
-
self.fileList[0].message = msg
|
|
190
|
-
}
|
|
191
|
-
self.session.sys.loadmsg = msg
|
|
192
|
-
},
|
|
193
|
-
file: fileObj,
|
|
194
|
-
name: this.file.file.name,
|
|
195
|
-
domain: this.model.domain,
|
|
196
|
-
buz: this.model.buz,
|
|
197
|
-
buzId: this.model.buzId,
|
|
198
|
-
expired: this.model.expired,
|
|
199
|
-
actions: this.model.actions
|
|
200
|
-
}, false, true, false).then((data) => {
|
|
201
|
-
|
|
202
|
-
self.model.data = data
|
|
203
|
-
self.model.value = data.fileId + '.' + data.ext
|
|
204
|
-
|
|
205
|
-
this.showCooper = false
|
|
206
|
-
if (this.isGetRightInfo(data.actions)) {
|
|
207
|
-
self.$ak.msg.toast('上传成功')
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
this.loading = false
|
|
211
|
-
self.$emit('done', function(){
|
|
212
|
-
|
|
213
|
-
},self.fullName)
|
|
214
|
-
|
|
215
|
-
}).catch(function(err) {
|
|
216
|
-
console.log(err)
|
|
217
|
-
this.loading = false
|
|
218
|
-
self.fileList.splice(0,self.fileList.length)
|
|
219
|
-
self.$emit('fail',function(){
|
|
220
|
-
|
|
221
|
-
},self.fullName)
|
|
222
|
-
})
|
|
223
|
-
},
|
|
224
|
-
async afterRead(file) {
|
|
225
|
-
|
|
226
|
-
if(this.model.preview) this.fileList[0].status = 'uploading'
|
|
227
|
-
this.file = file
|
|
228
|
-
if (this.model.needCooper) {
|
|
229
|
-
this.showCooper = true
|
|
230
|
-
let arr = file.content.split(",")
|
|
231
|
-
let mime = arr[0].match(/:(.*?);/)[1]
|
|
232
|
-
|
|
233
|
-
// let bstr = atob(arr[1])
|
|
234
|
-
// let n = bstr.length
|
|
235
|
-
// let u8arr = new Uint8Array(n)
|
|
236
|
-
// while (n--) {
|
|
237
|
-
// u8arr[n] = bstr.charCodeAt(n)
|
|
238
|
-
// }
|
|
239
|
-
|
|
240
|
-
// var fileObj1 = new File([u8arr], file.file.name, { type: mime })
|
|
241
|
-
console.log(file)
|
|
242
|
-
|
|
243
|
-
// 下面两行为压缩代码
|
|
244
|
-
var fileObj = await compressImg(file.file, file.file.name, mime)
|
|
245
|
-
this.cooperImage = fileObj.base64
|
|
246
|
-
|
|
247
|
-
// this.cooperImage = file.content
|
|
248
|
-
} else {
|
|
249
|
-
// 不需要裁剪
|
|
250
|
-
let arr = file.content.split(",")
|
|
251
|
-
let mime = arr[0].match(/:(.*?);/)[1]
|
|
252
|
-
|
|
253
|
-
// let bstr = atob(arr[1])
|
|
254
|
-
// let n = bstr.length
|
|
255
|
-
// let u8arr = new Uint8Array(n)
|
|
256
|
-
// while (n--) {
|
|
257
|
-
// u8arr[n] = bstr.charCodeAt(n)
|
|
258
|
-
// }
|
|
259
|
-
|
|
260
|
-
// var fileObj1 = new File([u8arr], file.file.name, { type: mime })
|
|
261
|
-
console.log(file)
|
|
262
|
-
var fileObj = await compressImg(file.file, file.file.name, mime)
|
|
263
|
-
this._upLoadFile(fileObj.file)
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
watch:{
|
|
270
|
-
|
|
271
|
-
'model.value':{
|
|
272
|
-
handler(val,oldval){
|
|
273
|
-
|
|
274
|
-
if(this.$ak.utils.isEmpty(val))
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
this.fileList.splice(0,this.fileList.length)
|
|
278
|
-
this.fileList.push({
|
|
279
|
-
url: config.file.baseURL + '/file/v1/hasl/fileAdmin/fileAdmin/get/' + this.model.data.fileId + "." + this.model.data.ext,
|
|
280
|
-
status: 'done'
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
this.setEventString(this.fullName,this.sname,'value',val,oldval)
|
|
285
|
-
},
|
|
286
|
-
deep:false
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
</script>
|
|
292
|
-
|
|
293
|
-
<style scoped lang="less">
|
|
294
|
-
/deep/ .van-uploader__preview {
|
|
295
|
-
margin: 0;
|
|
296
|
-
}
|
|
297
|
-
/deep/ .van-uploader__preview-delete-icon {
|
|
298
|
-
font-size: 20px;
|
|
299
|
-
}
|
|
300
|
-
/deep/ .van-uploader__preview-delete {
|
|
301
|
-
width: 18px;
|
|
302
|
-
height: 18px;
|
|
303
|
-
border-radius: 0 0 0 14px;
|
|
304
|
-
}
|
|
305
|
-
.uploadWrapper {
|
|
306
|
-
width: 60%;
|
|
307
|
-
margin: 0 auto;
|
|
308
|
-
.cropper {
|
|
309
|
-
margin: 40% auto 0 auto;
|
|
310
|
-
width: 260px;
|
|
311
|
-
height: 260px;
|
|
312
|
-
}
|
|
313
|
-
.cropper-container{
|
|
314
|
-
width: 100vw;
|
|
315
|
-
height: 100vh;
|
|
316
|
-
div{
|
|
317
|
-
width: 100%;
|
|
318
|
-
height: 100%;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
.cropper > :nth-child(1) {
|
|
322
|
-
background-color: #f6f6f6 !important;
|
|
323
|
-
}
|
|
324
|
-
.cropper-container .footer{
|
|
325
|
-
width: 100%;
|
|
326
|
-
height:88px;
|
|
327
|
-
display: flex;
|
|
328
|
-
position: fixed;
|
|
329
|
-
bottom: 0px;
|
|
330
|
-
left:0px;
|
|
331
|
-
}
|
|
332
|
-
.cropper {
|
|
333
|
-
width: 100%;
|
|
334
|
-
height: 260px;
|
|
335
|
-
}
|
|
336
|
-
.cropper-container{
|
|
337
|
-
width: 100vw;
|
|
338
|
-
height: 100vh;
|
|
339
|
-
div{
|
|
340
|
-
width: 100%;
|
|
341
|
-
height: 100%;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
.cropper > :nth-child(1) {
|
|
345
|
-
background-color: #f6f6f6 !important;
|
|
346
|
-
}
|
|
347
|
-
.cropper-container .footer{
|
|
348
|
-
width: 100%;
|
|
349
|
-
height:88px;
|
|
350
|
-
display: flex;
|
|
351
|
-
position: fixed;
|
|
352
|
-
bottom: 0px;
|
|
353
|
-
left:0px;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
.van-button {
|
|
357
|
-
width: 100%;
|
|
358
|
-
}
|
|
359
|
-
.control {
|
|
360
|
-
position: fixed;
|
|
361
|
-
bottom: 0;
|
|
362
|
-
display: flex;
|
|
363
|
-
justify-content: space-between;
|
|
364
|
-
width: 100%;
|
|
365
|
-
.btnWrapper {
|
|
366
|
-
width: 50%;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
</style>
|
|
370
|
-
<style scoped>
|
|
371
|
-
/* .cropper-container >>> .van-button--info{
|
|
372
|
-
width: 50%;
|
|
373
|
-
background:rgba(54,95,170,1);
|
|
374
|
-
box-shadow:0px 9px 24px 0px rgba(54,95,170,0.39);
|
|
375
|
-
border: 1px solid rgba(69,104,186,1);
|
|
376
|
-
}
|
|
377
|
-
.cropper-container >>> .van-button{
|
|
378
|
-
height: 88px;
|
|
379
|
-
line-height: 88px;
|
|
380
|
-
} */
|
|
381
|
-
|
|
382
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="uploadWrapper">
|
|
3
|
+
<!-- v-if="model.preview" -->
|
|
4
|
+
<van-uploader
|
|
5
|
+
|
|
6
|
+
v-model="fileList"
|
|
7
|
+
preview-size="100%"
|
|
8
|
+
:after-read="afterRead"
|
|
9
|
+
:max-count="model.preview ? 1 : 1000"
|
|
10
|
+
:show-upload="true"
|
|
11
|
+
:upload-icon="model.bgImage"
|
|
12
|
+
:accept="model.accept"
|
|
13
|
+
:preview-image="model.preview"
|
|
14
|
+
capture="camera"
|
|
15
|
+
@delete="deleteFn"
|
|
16
|
+
>
|
|
17
|
+
<van-image :src="model.bgImage"/>
|
|
18
|
+
</van-uploader>
|
|
19
|
+
|
|
20
|
+
<van-popup
|
|
21
|
+
v-model="showCooper"
|
|
22
|
+
position="right"
|
|
23
|
+
closeable
|
|
24
|
+
:overlay="false"
|
|
25
|
+
:style="{
|
|
26
|
+
width: '100%',
|
|
27
|
+
height: '100%'
|
|
28
|
+
}"
|
|
29
|
+
@click-close-icon="cancel"
|
|
30
|
+
>
|
|
31
|
+
<vueCropper
|
|
32
|
+
:img="cooperImage"
|
|
33
|
+
:autoCrop="true"
|
|
34
|
+
:canScale="false"
|
|
35
|
+
:canMove="false"
|
|
36
|
+
:canMoveBox="true"
|
|
37
|
+
:fixedBox="false"
|
|
38
|
+
:info="false"
|
|
39
|
+
:autoCropWidth="270"
|
|
40
|
+
:autoCropHeight="160"
|
|
41
|
+
:fixed="true"
|
|
42
|
+
:fixedNumber='[1.6,1]'
|
|
43
|
+
:enlarge="1"
|
|
44
|
+
:outputSize="1"
|
|
45
|
+
:centerBox="false"
|
|
46
|
+
class="cropper"
|
|
47
|
+
ref="cropper"
|
|
48
|
+
outputType="jpg"
|
|
49
|
+
|
|
50
|
+
>
|
|
51
|
+
|
|
52
|
+
</vueCropper>
|
|
53
|
+
<div class="control">
|
|
54
|
+
<div class="btnWrapper">
|
|
55
|
+
<van-button
|
|
56
|
+
type="primary"
|
|
57
|
+
@click="right"
|
|
58
|
+
>
|
|
59
|
+
旋转
|
|
60
|
+
</van-button>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="btnWrapper">
|
|
63
|
+
<van-button
|
|
64
|
+
type="info"
|
|
65
|
+
loading-text="上传中..."
|
|
66
|
+
:loading="loading"
|
|
67
|
+
@click="copper"
|
|
68
|
+
>
|
|
69
|
+
确定
|
|
70
|
+
</van-button>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</van-popup>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script>
|
|
78
|
+
import Vue from 'vue'
|
|
79
|
+
import base2 from './base2.js'
|
|
80
|
+
import config from '../assets/config'
|
|
81
|
+
import { compressImg } from '../assets/compressImg'
|
|
82
|
+
|
|
83
|
+
import vueCropper from 'vue-cropper' // 截图插件
|
|
84
|
+
Vue.use(vueCropper)
|
|
85
|
+
|
|
86
|
+
export default {
|
|
87
|
+
name: "bs-upload2",
|
|
88
|
+
mixins: [base2],
|
|
89
|
+
props: {
|
|
90
|
+
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
fileList:[],
|
|
95
|
+
fileList2:[],
|
|
96
|
+
showCooper: false,
|
|
97
|
+
cooperImage: '',
|
|
98
|
+
fileObj: null,
|
|
99
|
+
loading: false,
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
mounted() {
|
|
103
|
+
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
right() {
|
|
107
|
+
this.$refs.cropper.rotateRight()
|
|
108
|
+
},
|
|
109
|
+
copper() {
|
|
110
|
+
this.loading = true
|
|
111
|
+
this.$refs.cropper.getCropData((file) => {
|
|
112
|
+
let arr = file.split(",")
|
|
113
|
+
let mime = arr[0].match(/:(.*?);/)[1]
|
|
114
|
+
|
|
115
|
+
let bstr = atob(arr[1])
|
|
116
|
+
let n = bstr.length
|
|
117
|
+
let u8arr = new Uint8Array(n)
|
|
118
|
+
while (n--) {
|
|
119
|
+
u8arr[n] = bstr.charCodeAt(n)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var fileObj1 = new File([u8arr], this.file.file.name, { type: mime })
|
|
123
|
+
this._upLoadFile(fileObj1)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
},
|
|
127
|
+
cancel() {
|
|
128
|
+
debugger
|
|
129
|
+
this.showCooper = false
|
|
130
|
+
this.fileList.splice(0, this.fileList.length)
|
|
131
|
+
},
|
|
132
|
+
deleteFn() {
|
|
133
|
+
|
|
134
|
+
//将废弃delete
|
|
135
|
+
this.$emit('delete', this.model.actions)
|
|
136
|
+
this.$emit('del',function(){
|
|
137
|
+
|
|
138
|
+
},this.fullName)
|
|
139
|
+
},
|
|
140
|
+
createDefaultModel() {
|
|
141
|
+
return {
|
|
142
|
+
value:'',
|
|
143
|
+
data:{},
|
|
144
|
+
label:'点击上传',
|
|
145
|
+
bgImage: 'https://img.yzcdn.cn/vant/cat.jpeg',
|
|
146
|
+
remark:'只能上传jpg/png文件,且不超过500kb',
|
|
147
|
+
expired : -1,
|
|
148
|
+
buzId:'1111',
|
|
149
|
+
buz:'SelfReturnVisit',
|
|
150
|
+
domain:'capp',
|
|
151
|
+
actions: '',
|
|
152
|
+
preview:true,
|
|
153
|
+
accept:'image/*',
|
|
154
|
+
type:'BSUpload',
|
|
155
|
+
needCooper: true,
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
isGetRightInfo(data) {
|
|
159
|
+
const actions = this.model.actions
|
|
160
|
+
switch (actions) {
|
|
161
|
+
case 'ocr_id0':
|
|
162
|
+
if (data[actions].data.hasOwnProperty('issued_by')) {
|
|
163
|
+
return false
|
|
164
|
+
}
|
|
165
|
+
break
|
|
166
|
+
case 'ocr_id1':
|
|
167
|
+
if (data[actions].data.hasOwnProperty('issued_by')) {
|
|
168
|
+
return false
|
|
169
|
+
}
|
|
170
|
+
break
|
|
171
|
+
case 'ocr_bc':
|
|
172
|
+
if (data[actions].data.bank_cards.length === 0) {
|
|
173
|
+
return false
|
|
174
|
+
}
|
|
175
|
+
break
|
|
176
|
+
default: {
|
|
177
|
+
return true
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return true
|
|
181
|
+
},
|
|
182
|
+
_upLoadFile(fileObj){
|
|
183
|
+
let self = this
|
|
184
|
+
this.$http.uploadFile(
|
|
185
|
+
{
|
|
186
|
+
process: function(msg){
|
|
187
|
+
|
|
188
|
+
if(self.model.preview){
|
|
189
|
+
self.fileList[0].message = msg
|
|
190
|
+
}
|
|
191
|
+
self.session.sys.loadmsg = msg
|
|
192
|
+
},
|
|
193
|
+
file: fileObj,
|
|
194
|
+
name: this.file.file.name,
|
|
195
|
+
domain: this.model.domain,
|
|
196
|
+
buz: this.model.buz,
|
|
197
|
+
buzId: this.model.buzId,
|
|
198
|
+
expired: this.model.expired,
|
|
199
|
+
actions: this.model.actions
|
|
200
|
+
}, false, true, false).then((data) => {
|
|
201
|
+
|
|
202
|
+
self.model.data = data
|
|
203
|
+
self.model.value = data.fileId + '.' + data.ext
|
|
204
|
+
|
|
205
|
+
this.showCooper = false
|
|
206
|
+
if (this.isGetRightInfo(data.actions)) {
|
|
207
|
+
self.$ak.msg.toast('上传成功')
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.loading = false
|
|
211
|
+
self.$emit('done', function(){
|
|
212
|
+
|
|
213
|
+
},self.fullName)
|
|
214
|
+
|
|
215
|
+
}).catch(function(err) {
|
|
216
|
+
console.log(err)
|
|
217
|
+
this.loading = false
|
|
218
|
+
self.fileList.splice(0,self.fileList.length)
|
|
219
|
+
self.$emit('fail',function(){
|
|
220
|
+
|
|
221
|
+
},self.fullName)
|
|
222
|
+
})
|
|
223
|
+
},
|
|
224
|
+
async afterRead(file) {
|
|
225
|
+
|
|
226
|
+
if(this.model.preview) this.fileList[0].status = 'uploading'
|
|
227
|
+
this.file = file
|
|
228
|
+
if (this.model.needCooper) {
|
|
229
|
+
this.showCooper = true
|
|
230
|
+
let arr = file.content.split(",")
|
|
231
|
+
let mime = arr[0].match(/:(.*?);/)[1]
|
|
232
|
+
|
|
233
|
+
// let bstr = atob(arr[1])
|
|
234
|
+
// let n = bstr.length
|
|
235
|
+
// let u8arr = new Uint8Array(n)
|
|
236
|
+
// while (n--) {
|
|
237
|
+
// u8arr[n] = bstr.charCodeAt(n)
|
|
238
|
+
// }
|
|
239
|
+
|
|
240
|
+
// var fileObj1 = new File([u8arr], file.file.name, { type: mime })
|
|
241
|
+
console.log(file)
|
|
242
|
+
|
|
243
|
+
// 下面两行为压缩代码
|
|
244
|
+
var fileObj = await compressImg(file.file, file.file.name, mime)
|
|
245
|
+
this.cooperImage = fileObj.base64
|
|
246
|
+
|
|
247
|
+
// this.cooperImage = file.content
|
|
248
|
+
} else {
|
|
249
|
+
// 不需要裁剪
|
|
250
|
+
let arr = file.content.split(",")
|
|
251
|
+
let mime = arr[0].match(/:(.*?);/)[1]
|
|
252
|
+
|
|
253
|
+
// let bstr = atob(arr[1])
|
|
254
|
+
// let n = bstr.length
|
|
255
|
+
// let u8arr = new Uint8Array(n)
|
|
256
|
+
// while (n--) {
|
|
257
|
+
// u8arr[n] = bstr.charCodeAt(n)
|
|
258
|
+
// }
|
|
259
|
+
|
|
260
|
+
// var fileObj1 = new File([u8arr], file.file.name, { type: mime })
|
|
261
|
+
console.log(file)
|
|
262
|
+
var fileObj = await compressImg(file.file, file.file.name, mime)
|
|
263
|
+
this._upLoadFile(fileObj.file)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
watch:{
|
|
270
|
+
|
|
271
|
+
'model.value':{
|
|
272
|
+
handler(val,oldval){
|
|
273
|
+
|
|
274
|
+
if(this.$ak.utils.isEmpty(val))
|
|
275
|
+
return
|
|
276
|
+
|
|
277
|
+
this.fileList.splice(0,this.fileList.length)
|
|
278
|
+
this.fileList.push({
|
|
279
|
+
url: config.file.baseURL + '/file/v1/hasl/fileAdmin/fileAdmin/get/' + this.model.data.fileId + "." + this.model.data.ext,
|
|
280
|
+
status: 'done'
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
this.setEventString(this.fullName,this.sname,'value',val,oldval)
|
|
285
|
+
},
|
|
286
|
+
deep:false
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
</script>
|
|
292
|
+
|
|
293
|
+
<style scoped lang="less">
|
|
294
|
+
/deep/ .van-uploader__preview {
|
|
295
|
+
margin: 0;
|
|
296
|
+
}
|
|
297
|
+
/deep/ .van-uploader__preview-delete-icon {
|
|
298
|
+
font-size: 20px;
|
|
299
|
+
}
|
|
300
|
+
/deep/ .van-uploader__preview-delete {
|
|
301
|
+
width: 18px;
|
|
302
|
+
height: 18px;
|
|
303
|
+
border-radius: 0 0 0 14px;
|
|
304
|
+
}
|
|
305
|
+
.uploadWrapper {
|
|
306
|
+
width: 60%;
|
|
307
|
+
margin: 0 auto;
|
|
308
|
+
.cropper {
|
|
309
|
+
margin: 40% auto 0 auto;
|
|
310
|
+
width: 260px;
|
|
311
|
+
height: 260px;
|
|
312
|
+
}
|
|
313
|
+
.cropper-container{
|
|
314
|
+
width: 100vw;
|
|
315
|
+
height: 100vh;
|
|
316
|
+
div{
|
|
317
|
+
width: 100%;
|
|
318
|
+
height: 100%;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
.cropper > :nth-child(1) {
|
|
322
|
+
background-color: #f6f6f6 !important;
|
|
323
|
+
}
|
|
324
|
+
.cropper-container .footer{
|
|
325
|
+
width: 100%;
|
|
326
|
+
height:88px;
|
|
327
|
+
display: flex;
|
|
328
|
+
position: fixed;
|
|
329
|
+
bottom: 0px;
|
|
330
|
+
left:0px;
|
|
331
|
+
}
|
|
332
|
+
.cropper {
|
|
333
|
+
width: 100%;
|
|
334
|
+
height: 260px;
|
|
335
|
+
}
|
|
336
|
+
.cropper-container{
|
|
337
|
+
width: 100vw;
|
|
338
|
+
height: 100vh;
|
|
339
|
+
div{
|
|
340
|
+
width: 100%;
|
|
341
|
+
height: 100%;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
.cropper > :nth-child(1) {
|
|
345
|
+
background-color: #f6f6f6 !important;
|
|
346
|
+
}
|
|
347
|
+
.cropper-container .footer{
|
|
348
|
+
width: 100%;
|
|
349
|
+
height:88px;
|
|
350
|
+
display: flex;
|
|
351
|
+
position: fixed;
|
|
352
|
+
bottom: 0px;
|
|
353
|
+
left:0px;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
.van-button {
|
|
357
|
+
width: 100%;
|
|
358
|
+
}
|
|
359
|
+
.control {
|
|
360
|
+
position: fixed;
|
|
361
|
+
bottom: 0;
|
|
362
|
+
display: flex;
|
|
363
|
+
justify-content: space-between;
|
|
364
|
+
width: 100%;
|
|
365
|
+
.btnWrapper {
|
|
366
|
+
width: 50%;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
</style>
|
|
370
|
+
<style scoped>
|
|
371
|
+
/* .cropper-container >>> .van-button--info{
|
|
372
|
+
width: 50%;
|
|
373
|
+
background:rgba(54,95,170,1);
|
|
374
|
+
box-shadow:0px 9px 24px 0px rgba(54,95,170,0.39);
|
|
375
|
+
border: 1px solid rgba(69,104,186,1);
|
|
376
|
+
}
|
|
377
|
+
.cropper-container >>> .van-button{
|
|
378
|
+
height: 88px;
|
|
379
|
+
line-height: 88px;
|
|
380
|
+
} */
|
|
381
|
+
|
|
382
|
+
</style>
|