fhrons-mobile-next 2.0.0 → 2.0.2
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/.env.poc +8 -0
- package/assets/css/colors.js +6 -0
- package/assets/css/customVant.less +60 -0
- package/assets/css/extra.css +32 -0
- package/assets/css/global.css +1 -0
- package/assets/css/global.less +1637 -0
- package/assets/css/index.js +63 -0
- package/assets/css/static.less +607 -0
- package/assets/js/func.js +361 -0
- package/assets/js/globalData.js +18 -0
- package/assets/js/qywxapi.js +484 -0
- package/{packages → assets/js}/storage.js +1 -20
- package/assets/js/upload.js +269 -0
- package/assets/js/validate.js +48 -0
- package/assets/js/vant.js +39 -0
- package/assets/js/wxapi.js +297 -0
- package/assets/vantLang/index.js +172 -0
- package/assets/vantLang/lib/en-US.js +95 -0
- package/assets/vantLang/lib/es-ES.js +95 -0
- package/assets/vantLang/lib/pt-PT.js +96 -0
- package/assets/vantLang/lib/zh-CN.js +96 -0
- package/assets/vantLang/lib/zh-HK.js +96 -0
- package/assets/vantLang/locales/en_US.js +102 -0
- package/assets/vantLang/locales/es_ES.js +102 -0
- package/assets/vantLang/locales/index.js +12 -0
- package/assets/vantLang/locales/pt_PT.js +102 -0
- package/assets/vantLang/locales/zh_CN.js +102 -0
- package/assets/vantLang/locales/zh_T.js +102 -0
- package/babel.config.js +15 -0
- package/index.js +68 -33
- package/inject-env-plugin.js +29 -0
- package/package.json +46 -32
- package/packages/areaMobile/index.js +5 -0
- package/packages/areaMobile/index.vue +260 -0
- package/packages/autoGraph/VueEsign.vue +309 -0
- package/packages/autoGraph/index.js +5 -0
- package/packages/autoGraph/index.vue +472 -0
- package/packages/commonForm/CommonAsyncAreaPicker.vue +223 -0
- package/packages/commonForm/CommonDatePicker.vue +152 -0
- package/packages/commonForm/CommonForm.vue +786 -0
- package/packages/commonForm/CommonFullTimePicker.vue +137 -0
- package/packages/commonForm/CommonSinglePicker.vue +121 -0
- package/packages/commonForm/CommonYearMonthPicker.vue +127 -0
- package/packages/commonForm/index.js +33 -0
- package/packages/dialog/index.js +32 -0
- package/packages/dialog/index.vue +379 -0
- package/packages/index.js +7 -3
- package/packages/introduce/index.js +5 -0
- package/packages/introduce/index.vue +31 -0
- package/packages/loading/Loading.vue +70 -0
- package/packages/loading/index.js +43 -0
- package/packages/mindMap/index.js +5 -0
- package/packages/mindMap/index.vue +437 -0
- package/packages/pdfViewer/index.js +12 -0
- package/packages/pdfViewer/index.vue +131 -0
- package/packages/sharePanel/SheetPanel.vue +316 -0
- package/packages/sharePanel/index.js +5 -0
- package/packages/sharePanel/index.vue +476 -0
- package/packages/sharePanel/props.js +58 -0
- package/packages/sharePanel/utils/QyWxShareMixin.js +93 -0
- package/packages/sharePanel/utils/shareWay.js +81 -0
- package/packages/theme/index copy.js +89 -0
- package/packages/theme/index.js +38 -0
- package/packages/theme/theme.css +910 -0
- package/packages/theme/theme.less +26 -0
- package/packages/uploadFile/VanUploadFile.vue +80 -0
- package/packages/uploadFile/index.js +5 -0
- package/packages/uploadFile/index.vue +725 -0
- package/packages/uploadFile/vanUpload.js +5 -0
- package/packages/verify/Verify/VerifyPoints.vue +247 -0
- package/packages/verify/Verify/VerifySlide.vue +364 -0
- package/packages/verify/index.js +5 -0
- package/packages/verify/index.vue +416 -0
- package/packages/verify/utils/verify.js +53 -0
- package/packages/videoPage/index.js +5 -0
- package/packages/videoPage/index.vue +440 -0
- package/plugins/sensors/fhsensors.js +84 -0
- package/plugins/sensors/sensors.js +175 -0
- package/plugins/sensors/sensorsFun.js +1387 -0
- package/fhrons-mobile-next-2.0.0.tgz +0 -0
- package/packages/fhImage/index.js +0 -5
- package/packages/fhImage/index.vue +0 -57
- package/packages/fhPresetImage/index.js +0 -5
- package/packages/fhPresetImage/index.vue +0 -39
- package/packages/html2canvas/index.js +0 -29
- package/upload copy.js +0 -468
- package/utils/tools.js +0 -22
- /package/{dist → fhcommon/dist}/fhcommon.min.js +0 -0
- /package/{dist → fhcommon/dist}/fhcommon.min.js.LICENSE.txt +0 -0
- /package/{upload.js → fhcommon/upload.js} +0 -0
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="UploadFile">
|
|
3
|
+
<div class="ps-r content-width">
|
|
4
|
+
<input :id="uploadFileId" ref="inputer" type="file" :accept="uploadObj.type" class="filter0 inputer ps-a z-index2" :class="[type || type === '' ? 'full-content' : 'default-upload']" maxCount="1" :placeholder="i18n.t('financialinfo.carinfo.42bfwl')" @change="upLoad" />
|
|
5
|
+
<div v-if="deleteFlag && loadingObj.type !== 'loading'" class="delete-btn" @click="deleteFile">
|
|
6
|
+
<i class="c-ffffff delete-icon iconfont icon-guanbixian" />
|
|
7
|
+
</div>
|
|
8
|
+
<slot>
|
|
9
|
+
<!-- 头像上传 -->
|
|
10
|
+
<div v-if="type === 'Avatar'">
|
|
11
|
+
<img class="head-img head-cont-img" :src="uploadUrl || 'https://dop-pro-1251973116.file.myqcloud.com/upload/img/funzg/header.png'" />
|
|
12
|
+
</div>
|
|
13
|
+
<div v-else class="ps-r flex-center-center br4 over-hidden border-thin bdc-theme-24" :class="[type ? '' : 'default-upload']">
|
|
14
|
+
<img v-if="type" class="full-width" :src="bgUrl" alt="" />
|
|
15
|
+
<div class="circle ps-a camera-icon theme-dark-bg flex-center">
|
|
16
|
+
<svg t="1713249822868" class="icon-xiangji" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16455" width="200" height="200">
|
|
17
|
+
<path d="M624.64 109.714286a73.142857 73.142857 0 0 1 55.533714 25.545143L768 237.714286h146.285714a73.142857 73.142857 0 0 1 73.142857 73.142857v530.285714a73.142857 73.142857 0 0 1-73.142857 73.142857H109.714286a73.142857 73.142857 0 0 1-73.142857-73.142857V310.857143a73.142857 73.142857 0 0 1 73.142857-73.142857h146.285714l87.826286-102.454857A73.142857 73.142857 0 0 1 399.36 109.714286h225.28zM512 365.714286c-111.085714 0-201.142857 90.057143-201.142857 201.142857s90.057143 201.142857 201.142857 201.142857 201.142857-90.057143 201.142857-201.142857-90.057143-201.142857-201.142857-201.142857z m0 91.428571a109.714286 109.714286 0 1 1 0 219.428572 109.714286 109.714286 0 0 1 0-219.428572z" fill="#ffffff" p-id="16456"></path>
|
|
18
|
+
</svg>
|
|
19
|
+
</div>
|
|
20
|
+
<img v-if="urlList[0]" class="full-width ps-a z-index2" :src="urlList[0]" alt="" @click="loadingClick" />
|
|
21
|
+
<!-- 上传中loading框 -->
|
|
22
|
+
<!--- isIconUpload标识是否是按钮上传 -->
|
|
23
|
+
</div>
|
|
24
|
+
</slot>
|
|
25
|
+
<!-- deleteFlag 表示上传框是否有删除按钮 -->
|
|
26
|
+
<div v-show="deleteFlag && !uploadObj.isIconUpload && loadingObj.visible" :class="[loadingObj.visible ? 'loading-content' : '']" class="ps-a full-content top0 full-content flex-column-center br4" @click="loadingClick">
|
|
27
|
+
<div v-if="loadingObj.type === 'loading'">
|
|
28
|
+
<van-loading style="width: 23px; height: 23px" />
|
|
29
|
+
</div>
|
|
30
|
+
<div v-else>
|
|
31
|
+
<i class="iconfont ft23 icon-guanbi c-ffffff" />
|
|
32
|
+
</div>
|
|
33
|
+
<span class="c-ffffff mt8">
|
|
34
|
+
{{ loadingObj.text }}
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- 裁剪遮罩层 -->
|
|
39
|
+
<div v-show="copperDialogVisible" class="mask-layer" :title="i18n.t('componentsfile.uploadfile.5j20wn')" />
|
|
40
|
+
<!-- 裁剪区域 -->
|
|
41
|
+
<div v-show="copperDialogVisible" :title="i18n.t('componentsfile.uploadfile.2hih6y')">
|
|
42
|
+
<div class="cropper-content">
|
|
43
|
+
<div class="cropper t-center">
|
|
44
|
+
<vueCropper v-if="option.img" ref="cropper" :img="option.img" :output-size="option.outputSize" :output-type="option.outputType" :info="option.info" :can-scale="option.canScale" :auto-crop="option.autoCrop" :auto-crop-width="option.autoCropWidth" :auto-crop-height="option.autoCropHeight" :fixed="option.fixed" :fixed-box="option.fixedBox" :fixed-number="option.fixedNumber" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="cou-top-panel bg13 zindex">
|
|
48
|
+
<span class="mess-back" @click="cancel">
|
|
49
|
+
<div class="cont-wh" />
|
|
50
|
+
</span>
|
|
51
|
+
<span class="right ft14 c10" @click="finish">{{ i18n.t("product.product.n352cz") }}</span>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
<script>
|
|
58
|
+
import { blobToDataURL, loadJavaScript, isPerfectObj } from "../../assets/js/func";
|
|
59
|
+
if (!window["vue-cropper"]) {
|
|
60
|
+
loadJavaScript("https://dop-pro-1251973116.file.myqcloud.com/upload/jsfile/vue-cropper@0.4.9/vue-cropper.js").then(() => {
|
|
61
|
+
console.log("vue-cropper 加载成功");
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
import i18n from "../../assets/vantLang";
|
|
65
|
+
/**
|
|
66
|
+
* ID_CARD("1","身份证"),
|
|
67
|
+
CARD_PHOTO("2","免冠证件照"),
|
|
68
|
+
DRIVER_CARD("3","驾驶证"),
|
|
69
|
+
OFFICIAL_CARD("4","军官证"),
|
|
70
|
+
SOLDIER("5","士兵证"),
|
|
71
|
+
LiSENCE("6","营业执照"),
|
|
72
|
+
CHINA_PASSPORT("7","中国护照"),
|
|
73
|
+
HM_PASSPORT("9","港澳通行证"),
|
|
74
|
+
TAIWAN_PASSPORT("10","台湾通行证"),
|
|
75
|
+
FOREIGN_PASSPORT("51","外国护照"),
|
|
76
|
+
BACK_HOME_CARD("11","回乡证"),
|
|
77
|
+
OTHER_CARD("99","其他");
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
name: "UploadFile",
|
|
83
|
+
props: {
|
|
84
|
+
uploadObj: {
|
|
85
|
+
type: Object,
|
|
86
|
+
default: function () {
|
|
87
|
+
return {
|
|
88
|
+
name: {
|
|
89
|
+
// 名称
|
|
90
|
+
type: String,
|
|
91
|
+
default: () => "",
|
|
92
|
+
},
|
|
93
|
+
uploadId: {
|
|
94
|
+
// 上传id
|
|
95
|
+
type: String,
|
|
96
|
+
default: () => "",
|
|
97
|
+
},
|
|
98
|
+
type: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: () => "",
|
|
101
|
+
},
|
|
102
|
+
fileType: {
|
|
103
|
+
// accept类型
|
|
104
|
+
type: String,
|
|
105
|
+
default: () => "",
|
|
106
|
+
}, // course 目录类型
|
|
107
|
+
fileSize: {
|
|
108
|
+
// 最大上传文件体积
|
|
109
|
+
type: String,
|
|
110
|
+
default: () => "",
|
|
111
|
+
},
|
|
112
|
+
uploadType: {
|
|
113
|
+
// 上传的图片类型,用于ocr传参,可选值如下 影像识别类型 1-身份证 2-驾驶证 3-银行卡 4-户口本 5-护照 6-通告证
|
|
114
|
+
type: String,
|
|
115
|
+
default: () => "",
|
|
116
|
+
},
|
|
117
|
+
uploadIndex: {
|
|
118
|
+
type: Number,
|
|
119
|
+
default: () => null,
|
|
120
|
+
},
|
|
121
|
+
loadingType: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: "loading",
|
|
124
|
+
},
|
|
125
|
+
cosArea: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: "Tencent",
|
|
128
|
+
},
|
|
129
|
+
cropper: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: false,
|
|
132
|
+
},
|
|
133
|
+
keyFunc: {
|
|
134
|
+
type: Object,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
type: {
|
|
140
|
+
type: String,
|
|
141
|
+
validator: function (value) {
|
|
142
|
+
return ["ID_F", "ID_B", "BANK", "Avatar", ""].includes(value);
|
|
143
|
+
},
|
|
144
|
+
default: () => "",
|
|
145
|
+
},
|
|
146
|
+
cropWidth: {
|
|
147
|
+
type: Number,
|
|
148
|
+
default: () => 100,
|
|
149
|
+
},
|
|
150
|
+
cropHeight: {
|
|
151
|
+
type: Number,
|
|
152
|
+
default: () => 100,
|
|
153
|
+
},
|
|
154
|
+
cropRate: {
|
|
155
|
+
type: Array,
|
|
156
|
+
default: () => [16, 9],
|
|
157
|
+
},
|
|
158
|
+
fixed: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
default: () => true,
|
|
161
|
+
},
|
|
162
|
+
previewImage: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
default: () => true,
|
|
165
|
+
},
|
|
166
|
+
uploadUrl: {
|
|
167
|
+
type: String,
|
|
168
|
+
default: () => "",
|
|
169
|
+
},
|
|
170
|
+
deleteFlag: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: true,
|
|
173
|
+
},
|
|
174
|
+
uploadFileId: {
|
|
175
|
+
type: String,
|
|
176
|
+
required: true,
|
|
177
|
+
default: () => "",
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
data() {
|
|
181
|
+
return {
|
|
182
|
+
i18n,
|
|
183
|
+
fileArr: {},
|
|
184
|
+
showProcess: false,
|
|
185
|
+
// showPreview: false, // 展示预览遮罩层
|
|
186
|
+
processLen: 0,
|
|
187
|
+
urlList: [], // cos返回链接的集合
|
|
188
|
+
copperDialogVisible: false,
|
|
189
|
+
loadingObj: {
|
|
190
|
+
loading: false, // loading为true则表示上传成功、false则表示未上传上传中或者上传失败
|
|
191
|
+
visible: false,
|
|
192
|
+
type: "loading",
|
|
193
|
+
text: "",
|
|
194
|
+
},
|
|
195
|
+
ocrAvailableList: [1, 2, 3, 4, 5, 6], // 上传的图片类型,用于ocr传参,可选值如下 影像识别类型 1-身份证 2-驾驶证 3-银行卡 4-户口本 5-护照 6-通告证
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
computed: {
|
|
199
|
+
option() {
|
|
200
|
+
return {
|
|
201
|
+
// 裁剪组件的基础配置option
|
|
202
|
+
img: "", // 裁剪图片的地址
|
|
203
|
+
info: true, // 裁剪框的大小信息
|
|
204
|
+
outputSize: 0.8, // 裁剪生成图片的质量
|
|
205
|
+
outputType: "jpeg", // 裁剪生成图片的格式
|
|
206
|
+
canScale: false, // 图片是否允许滚轮缩放
|
|
207
|
+
autoCrop: true, // 是否默认生成截图框
|
|
208
|
+
autoCropWidth: this.cropWidth, // 默认生成截图框宽度
|
|
209
|
+
autoCropHeight: this.cropHeight, // 默认生成截图框高度
|
|
210
|
+
fixedBox: false, // 固定截图框大小 不允许改变
|
|
211
|
+
fixed: this.fixed, // 是否开启截图框宽高固定比例
|
|
212
|
+
fixedNumber: this.type === "Avatar" ? [1, 1] : this.cropRate, // 截图框的宽高比例
|
|
213
|
+
full: true, // 是否输出原图比例的截图
|
|
214
|
+
canMoveBox: false, // 截图框能否拖动
|
|
215
|
+
original: false, // 上传图片按照原始比例渲染
|
|
216
|
+
centerBox: false, // 截图框是否被限制在图片里面
|
|
217
|
+
infoTrue: true, // true 为展示真实输出图片宽高 false 展示看到的截图框宽高
|
|
218
|
+
canMove: true,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
bgUrl() {
|
|
222
|
+
let result = "";
|
|
223
|
+
if (this.type === "ID_F") {
|
|
224
|
+
result = "https://dop-pro-1251973116.file.myqcloud.com/upload/img/funzg/renxiangmian.png";
|
|
225
|
+
} else if (this.type === "ID_B") {
|
|
226
|
+
result = "https://dop-pro-1251973116.file.myqcloud.com/upload/img/funzg/guohuimian.png";
|
|
227
|
+
} else if (this.type === "BANK") {
|
|
228
|
+
result = "https://dop-pro-1251973116.file.myqcloud.com/upload/img/funzg/bank-label.png";
|
|
229
|
+
}
|
|
230
|
+
return result;
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
watch: {
|
|
234
|
+
uploadObj: {
|
|
235
|
+
handler(newVal, oldVal) {
|
|
236
|
+
let { type, visible } = this.loadingObj;
|
|
237
|
+
if (newVal.loadingType && newVal.loadingType !== type) {
|
|
238
|
+
type = newVal.loadingType;
|
|
239
|
+
}
|
|
240
|
+
if ((newVal.visible || newVal.visible === false) && newVal.visible !== visible) {
|
|
241
|
+
visible = newVal.visible;
|
|
242
|
+
}
|
|
243
|
+
// if (newVal.loading && newVal.loading !== loading) {
|
|
244
|
+
// loading = newVal.loading;
|
|
245
|
+
// }
|
|
246
|
+
},
|
|
247
|
+
deep: true,
|
|
248
|
+
immediate: true,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
created() {
|
|
252
|
+
if (this.uploadUrl) {
|
|
253
|
+
this.$set(this, "loadingObj", Object.assign(this.loadingObj, { type: "finish", loading: true }));
|
|
254
|
+
this.urlList.push(this.uploadUrl);
|
|
255
|
+
}
|
|
256
|
+
this.loadingObj.text = i18n.t("workorder.uploadfile.224534");
|
|
257
|
+
},
|
|
258
|
+
methods: {
|
|
259
|
+
// 删除上传的文件
|
|
260
|
+
deleteFile() {
|
|
261
|
+
const { loading, visible } = this.loadingObj;
|
|
262
|
+
// loading展示且不可见 表示上传成功
|
|
263
|
+
if (loading && !visible) {
|
|
264
|
+
this.$set(this.loadingObj, "loading", false);
|
|
265
|
+
this.$set(this.loadingObj, "type", "loading");
|
|
266
|
+
this.$refs.inputer.value = ""; // 清除inputer的value
|
|
267
|
+
this.$set(this, "urlList", []);
|
|
268
|
+
this.$emit("deleteFile", this.uploadObj.uploadIndex);
|
|
269
|
+
} else {
|
|
270
|
+
// 上传失败的删除事件
|
|
271
|
+
this.$set(this, "loadingObj", {
|
|
272
|
+
loading: false,
|
|
273
|
+
visible: false,
|
|
274
|
+
type: "loading",
|
|
275
|
+
text: "",
|
|
276
|
+
});
|
|
277
|
+
this.$refs.inputer.value = "";
|
|
278
|
+
this.$emit("deleteFile", this.uploadObj.uploadIndex);
|
|
279
|
+
this.$refs.inputer.click();
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
// 点击输入控件
|
|
283
|
+
clickWidget() {
|
|
284
|
+
this.$refs.inputer.click();
|
|
285
|
+
},
|
|
286
|
+
loadingClick() {
|
|
287
|
+
const { loading, visible } = this.loadingObj;
|
|
288
|
+
// loading展示且不可见 表示上传成功
|
|
289
|
+
if (loading && !visible && this.urlList?.length) {
|
|
290
|
+
// 展示图片预览
|
|
291
|
+
vant.ImagePreview({
|
|
292
|
+
images: this.urlList,
|
|
293
|
+
startPosition: 0,
|
|
294
|
+
closeable: true,
|
|
295
|
+
});
|
|
296
|
+
} else {
|
|
297
|
+
this.$set(this, "loadingObj", {
|
|
298
|
+
loading: false,
|
|
299
|
+
visible: false,
|
|
300
|
+
type: "loading",
|
|
301
|
+
text: "",
|
|
302
|
+
});
|
|
303
|
+
this.$refs.inputer.value = "";
|
|
304
|
+
this.$emit("deleteFile", this.uploadObj.uploadIndex);
|
|
305
|
+
this.$refs.inputer.click();
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
finish() {
|
|
309
|
+
const { getCropData, getCropBlob } = this.$refs.cropper;
|
|
310
|
+
getCropData((base64) => {
|
|
311
|
+
getCropBlob((file) => {
|
|
312
|
+
console.log(arguments);
|
|
313
|
+
this.uploadFile(file, "img", "assistant", base64);
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
cancel() {
|
|
318
|
+
this.copperDialogVisible = false;
|
|
319
|
+
this.urlList = [];
|
|
320
|
+
},
|
|
321
|
+
// 触发上传
|
|
322
|
+
upLoad() {
|
|
323
|
+
// const file = document.getElementById(this.uploadFileId).files;
|
|
324
|
+
const file = Array.from(document.getElementById(this.uploadFileId).files);
|
|
325
|
+
|
|
326
|
+
file.forEach( (item) => {
|
|
327
|
+
if (!this.deleteFlag) this.$loading(i18n.t("aqcomponents.offline.gl1k2s"));
|
|
328
|
+
this.upLoadFileObj(item);
|
|
329
|
+
});
|
|
330
|
+
},
|
|
331
|
+
upLoadFileObj(fileObj) {
|
|
332
|
+
// 拿到base64文件
|
|
333
|
+
// base64转成blob文件
|
|
334
|
+
const blobFile = this.$options.methods.dataURLtoBlob.bind(this)(fileObj);
|
|
335
|
+
const filename = fileObj.name;
|
|
336
|
+
if (fileObj.size === 0) return;
|
|
337
|
+
this.$set(this, "loadingObj", {
|
|
338
|
+
loading: false,
|
|
339
|
+
visible: true,
|
|
340
|
+
type: "loading",
|
|
341
|
+
text: i18n.t("workorder.uploadfile.224534"),
|
|
342
|
+
});
|
|
343
|
+
if (this.uploadObj.needLoading) {
|
|
344
|
+
this.$loading(i18n.t("aqcomponents.offline.gl1k2s"));
|
|
345
|
+
}
|
|
346
|
+
// this.$loading('处理中');
|
|
347
|
+
const isLt10M = fileObj.size / 1024 / 1024 < this.uploadObj.fileSize; // M
|
|
348
|
+
// mp4的话,限制300M
|
|
349
|
+
const isLt300M = fileObj.size / 1024 / 1024 / 30 < this.uploadObj.fileSize;
|
|
350
|
+
const HasFileType = fileObj.type ? fileObj.type.split("/")[0] : "";
|
|
351
|
+
|
|
352
|
+
blobToDataURL(fileObj).then((res) => {
|
|
353
|
+
// 如果图片不需要裁剪则直接提示不能超过多少
|
|
354
|
+
if (HasFileType === "video" && !isLt300M) {
|
|
355
|
+
this.$toast(i18n.t("componentsfile.uploadfile.0t6ddr", [this.uploadObj.fileSize * 30]));
|
|
356
|
+
this.loadingObj.visible = false;
|
|
357
|
+
return false;
|
|
358
|
+
} else if ((HasFileType === "image" || HasFileType === "application") && !isLt10M) {
|
|
359
|
+
// 如果图片需要裁剪
|
|
360
|
+
if (this.uploadObj["cropper"]) {
|
|
361
|
+
this.$loading(false);
|
|
362
|
+
this.copperDialogVisible = true;
|
|
363
|
+
this.option.img = res;
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
this.$toast(i18n.t("componentsfile.uploadfile.0t6ddr", [this.uploadObj.fileSize]));
|
|
367
|
+
this.loadingObj.visible = false;
|
|
368
|
+
return false;
|
|
369
|
+
} else if (this.type === "Avatar") {
|
|
370
|
+
// 上传类型为 头像 时 需要进行裁剪
|
|
371
|
+
this.$loading(false);
|
|
372
|
+
this.copperDialogVisible = true;
|
|
373
|
+
this.option.img = res;
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
// 将识别到的base64传给父组件回显
|
|
377
|
+
this.$emit("getImageDataUrl", { index: this.uploadObj.uploadIndex, base64: res });
|
|
378
|
+
// 开始上传
|
|
379
|
+
this.$loading(false);
|
|
380
|
+
this.uploadFile(blobFile, filename, "assistant", res, fileObj.type);
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
// 直接上传不裁剪
|
|
384
|
+
async uploadFile(file, filename, type, base64Img, fileType) {
|
|
385
|
+
// 港险环境就上传到亚马逊,其余上传到腾讯
|
|
386
|
+
const temp = filename.split(".");
|
|
387
|
+
const fileSffix = temp[temp.length - 1];
|
|
388
|
+
file.filename = filename;
|
|
389
|
+
try {
|
|
390
|
+
const param = {
|
|
391
|
+
file,
|
|
392
|
+
keyFunc: () => (typeof this.uploadObj.keyFunc === "function" ? `${this.uploadObj.keyFunc(filename)}.${fileSffix}` : this.uploadObj.keyFunc ? `${this.uploadObj.keyFunc}.${fileSffix}` : ""),
|
|
393
|
+
urlMaxLength: 12,
|
|
394
|
+
};
|
|
395
|
+
const fileUrl = await FHCommon.upload(param, (progress) => this.$emit("onProgress", progress));
|
|
396
|
+
console.log('20251216',param,fileUrl);
|
|
397
|
+
|
|
398
|
+
this.handleUploadResult({ filename, url: fileUrl, base64Img, fileType });
|
|
399
|
+
} catch (err) {
|
|
400
|
+
this.$toast(typeof err === "string" ? err : i18n.t("applyprocess.examine.hdrtrf"), "error");
|
|
401
|
+
console.log(err);
|
|
402
|
+
if (err) {
|
|
403
|
+
this.$set(this, "loadingObj", {
|
|
404
|
+
loading: false,
|
|
405
|
+
visible: true,
|
|
406
|
+
type: "error",
|
|
407
|
+
text: i18n.t("aqcomponents.offline.u15l63"),
|
|
408
|
+
});
|
|
409
|
+
const result = {
|
|
410
|
+
uploadProgress: "error",
|
|
411
|
+
};
|
|
412
|
+
this.$emit("photoChanged", result);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
handleUploadResult({ filename, url, base64Img, fileType }) {
|
|
417
|
+
this.fileArr = {
|
|
418
|
+
enclosureName: filename,
|
|
419
|
+
url,
|
|
420
|
+
id: this.uploadFileId,
|
|
421
|
+
};
|
|
422
|
+
this.copperDialogVisible = false;
|
|
423
|
+
this.$set(this, "loadingObj", {
|
|
424
|
+
loading: true,
|
|
425
|
+
visible: false,
|
|
426
|
+
type: "finish",
|
|
427
|
+
text: i18n.t("componentsfile.uploadfile.7b44sh"),
|
|
428
|
+
});
|
|
429
|
+
const { needOCR = false, uploadType, uploadIndex } = this.uploadObj;
|
|
430
|
+
// 只有needOCR和uploadType为1或3时才执行图片识别
|
|
431
|
+
if (needOCR && this.ocrAvailableList.includes(+uploadType)) {
|
|
432
|
+
this.imageRecognition(this.uploadObj.uploadType, base64Img);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
this.urlList = [decodeURIComponent(this.fileArr.url)];
|
|
436
|
+
console.log('20251216 this.urlList[0]',this.urlList[0]);
|
|
437
|
+
|
|
438
|
+
this.$emit("photoChanged", { data: this.urlList[0], index: uploadIndex, base64Img, filename, fileType });
|
|
439
|
+
},
|
|
440
|
+
async imageRecognition(type, base64Img) {
|
|
441
|
+
this.$set(this, "loadingObj", {
|
|
442
|
+
loading: true,
|
|
443
|
+
visible: true,
|
|
444
|
+
type: "loading",
|
|
445
|
+
text: i18n.t("uploadfile.index.eo0cn6"),
|
|
446
|
+
});
|
|
447
|
+
const { uploadIndex, uploadType } = this.uploadObj;
|
|
448
|
+
const param = {
|
|
449
|
+
ocrtype: type, // 图片类型
|
|
450
|
+
// platformSaasId: appInfo.getPlatSaasId(),
|
|
451
|
+
cosPath: this.fileArr.url, // 图片地址
|
|
452
|
+
};
|
|
453
|
+
let res
|
|
454
|
+
try {
|
|
455
|
+
// 调用识别身份证接口
|
|
456
|
+
res = await axios.post(`/funapi/config/ocr`, param);
|
|
457
|
+
console.log(res)
|
|
458
|
+
if(res.status === 'FAILED')throw new Error(res.message)
|
|
459
|
+
res = res.data || res;
|
|
460
|
+
if (this.uploadObj.isIconUpload) {
|
|
461
|
+
if (res.bankCard?.msg) {
|
|
462
|
+
// this.$toast(res.bankCard.msg);
|
|
463
|
+
this.urlList = [];
|
|
464
|
+
throw new Error(res.bankCard.msg);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
} catch (err) {
|
|
468
|
+
this.$toast({ message: err.message, duration: 2000 });
|
|
469
|
+
return
|
|
470
|
+
}
|
|
471
|
+
let target = {};
|
|
472
|
+
if (type === "1") {
|
|
473
|
+
// 识别身份证 提取res中的数据
|
|
474
|
+
const { idCard } = res;
|
|
475
|
+
const { issueauthority, validperiod } = idCard;
|
|
476
|
+
const isNationalEmblemCover = !!issueauthority; // 国徽面
|
|
477
|
+
if (uploadIndex === 0 || (!uploadIndex && !isNationalEmblemCover)) {
|
|
478
|
+
// 删除非人像面的数据
|
|
479
|
+
delete idCard.issueauthority;
|
|
480
|
+
delete idCard.validperiod;
|
|
481
|
+
// 身份证人像面
|
|
482
|
+
target = idCard;
|
|
483
|
+
} else if (uploadIndex === 1 || (!uploadIndex && isNationalEmblemCover)) {
|
|
484
|
+
// 身份证国徽面
|
|
485
|
+
target = { issueauthority, validperiod };
|
|
486
|
+
}
|
|
487
|
+
} else if (type === "3") {
|
|
488
|
+
// 识别银行卡
|
|
489
|
+
const { bankCard } = res;
|
|
490
|
+
// delete bankCard.msg;
|
|
491
|
+
// delete bankCard.status;
|
|
492
|
+
// 银行卡
|
|
493
|
+
target = bankCard;
|
|
494
|
+
} else if (type === "4") {
|
|
495
|
+
// 识别户口本 提取res中的数据
|
|
496
|
+
target = res;
|
|
497
|
+
}
|
|
498
|
+
// 判断对象中是否有空属性
|
|
499
|
+
const isPerfect = isPerfectObj(target);
|
|
500
|
+
// 上传身份证不是完整的对象则中止执行
|
|
501
|
+
if ((!isPerfect && uploadType === "1") || (uploadType === "3" && res.bankCard.msg === i18n.t("componentsfile.uploadfile.h2m4ki"))) {
|
|
502
|
+
this.$loading(false);
|
|
503
|
+
const ocrMessage = this.getOcrMessage(uploadIndex, uploadType);
|
|
504
|
+
this.$toast({ message: ocrMessage, duration: 2000 });
|
|
505
|
+
this.$set(this, "loadingObj", {
|
|
506
|
+
loading: false,
|
|
507
|
+
visible: true,
|
|
508
|
+
type: "error",
|
|
509
|
+
text: i18n.t("aqcomponents.offline.u15l63"),
|
|
510
|
+
});
|
|
511
|
+
throw new Error();
|
|
512
|
+
}
|
|
513
|
+
const result = {
|
|
514
|
+
data: this.fileArr.url,
|
|
515
|
+
Card: target,
|
|
516
|
+
index: uploadIndex,
|
|
517
|
+
base64Img,
|
|
518
|
+
};
|
|
519
|
+
this.urlList = [decodeURIComponent(this.fileArr.url)];
|
|
520
|
+
this.$emit("photoChanged", result);
|
|
521
|
+
this.$set(this, "loadingObj", {
|
|
522
|
+
loading: true,
|
|
523
|
+
visible: false,
|
|
524
|
+
type: "finish",
|
|
525
|
+
text: i18n.t("componentsfile.uploadfile.7b44sh"),
|
|
526
|
+
});
|
|
527
|
+
this.copperDialogVisible = false;
|
|
528
|
+
if (this.uploadObj.needLoading) {
|
|
529
|
+
this.$loading(false);
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
getOcrMessage(index, type) {
|
|
533
|
+
let result = "";
|
|
534
|
+
// 如果是身份证
|
|
535
|
+
if (type === "1") {
|
|
536
|
+
result = index === 0 ? i18n.t("applyprocess.materials.5nk04d") : i18n.t("applyprocess.materials.2mi48o");
|
|
537
|
+
} else if (type === "3") {
|
|
538
|
+
result = i18n.t("aqcomponents.inputdata.w66u66");
|
|
539
|
+
}
|
|
540
|
+
return i18n.t("componentsfile.uploadfile.1uffo7", [result]);
|
|
541
|
+
},
|
|
542
|
+
// DataURL转Blob
|
|
543
|
+
dataURLtoBlob(fileObj) {
|
|
544
|
+
if (!fileObj) return;
|
|
545
|
+
return new Blob([fileObj], { type: fileObj.type });
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
};
|
|
549
|
+
</script>
|
|
550
|
+
|
|
551
|
+
<style scoped lang="less">
|
|
552
|
+
#UploadFile {
|
|
553
|
+
// width: max-content;
|
|
554
|
+
.fileBox {
|
|
555
|
+
display: inline-block;
|
|
556
|
+
width: 70px;
|
|
557
|
+
position: absolute;
|
|
558
|
+
overflow: hidden;
|
|
559
|
+
right: 0;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.file-ip {
|
|
563
|
+
position: absolute;
|
|
564
|
+
z-index: 1;
|
|
565
|
+
top: 0;
|
|
566
|
+
right: 0;
|
|
567
|
+
bottom: 0;
|
|
568
|
+
left: 0;
|
|
569
|
+
opacity: 0;
|
|
570
|
+
width: 100%;
|
|
571
|
+
height: 100%;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.inputer {
|
|
575
|
+
left: 0;
|
|
576
|
+
top: 0;
|
|
577
|
+
// width: 0;
|
|
578
|
+
// height: 0;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.cropper-content,
|
|
582
|
+
.cropper-view-box img {
|
|
583
|
+
width: 100%;
|
|
584
|
+
height: 100%;
|
|
585
|
+
position: fixed;
|
|
586
|
+
z-index: 100;
|
|
587
|
+
top: 0;
|
|
588
|
+
left: 0;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.cropper {
|
|
592
|
+
width: 100%;
|
|
593
|
+
height: 100%;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.dialog-footer /deep/ .left {
|
|
597
|
+
position: absolute;
|
|
598
|
+
z-index: 30;
|
|
599
|
+
bottom: 0;
|
|
600
|
+
left: 0;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.dialog-footer /deep/ .right {
|
|
604
|
+
position: absolute;
|
|
605
|
+
z-index: 30;
|
|
606
|
+
bottom: 0;
|
|
607
|
+
right: 0;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.cou-top-panel {
|
|
611
|
+
position: fixed;
|
|
612
|
+
top: 0;
|
|
613
|
+
left: 0px;
|
|
614
|
+
height: 45px;
|
|
615
|
+
right: 0px;
|
|
616
|
+
z-index: 9;
|
|
617
|
+
|
|
618
|
+
.zindex {
|
|
619
|
+
z-index: 999;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.right {
|
|
623
|
+
display: block;
|
|
624
|
+
position: absolute;
|
|
625
|
+
right: 15px;
|
|
626
|
+
top: 13px;
|
|
627
|
+
display: block;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.c10 {
|
|
632
|
+
color: #178dff;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
.bg13 {
|
|
636
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
637
|
+
z-index: 999;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.delete-btn {
|
|
641
|
+
position: absolute;
|
|
642
|
+
width: 18px;
|
|
643
|
+
height: 18px;
|
|
644
|
+
// width: calc(100% * 16 / 158);
|
|
645
|
+
// height: calc(100% * 16 / 99);
|
|
646
|
+
right: 0;
|
|
647
|
+
top: 0;
|
|
648
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
649
|
+
border-radius: 0px 4px 0px 4px;
|
|
650
|
+
z-index: 3;
|
|
651
|
+
|
|
652
|
+
.delete-icon {
|
|
653
|
+
font-size: 14px;
|
|
654
|
+
line-height: 12px;
|
|
655
|
+
// width: calc(100% * 18 / 158);
|
|
656
|
+
// height: calc(100% * 18 / 99);
|
|
657
|
+
position: absolute;
|
|
658
|
+
left: 50%;
|
|
659
|
+
top: 50%;
|
|
660
|
+
transform: translate(-50%, -50%);
|
|
661
|
+
// position: absolute;
|
|
662
|
+
// right: 50%;
|
|
663
|
+
// bottom: 54%;
|
|
664
|
+
// transform: translate(50%, 50%);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.loading-content {
|
|
669
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/*黑色*/
|
|
673
|
+
.mess-back {
|
|
674
|
+
position: absolute;
|
|
675
|
+
display: block;
|
|
676
|
+
top: 5px;
|
|
677
|
+
left: 5px;
|
|
678
|
+
width: 33px;
|
|
679
|
+
z-index: 11;
|
|
680
|
+
padding-left: 10px;
|
|
681
|
+
padding-top: 11px;
|
|
682
|
+
height: 30px;
|
|
683
|
+
|
|
684
|
+
.cont-wh {
|
|
685
|
+
width: 13px;
|
|
686
|
+
height: 13px;
|
|
687
|
+
border-top: 2px solid #fff;
|
|
688
|
+
border-left: 2px solid #fff;
|
|
689
|
+
-moz-transform: rotate(-45deg);
|
|
690
|
+
-webkit-transform: rotate(-45deg);
|
|
691
|
+
transform: rotate(-45deg);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/*返回*/
|
|
696
|
+
.camera-icon {
|
|
697
|
+
width: calc(100% * 32 / 158);
|
|
698
|
+
height: calc(100% * 32 / 99);
|
|
699
|
+
z-index: 0;
|
|
700
|
+
top: 50%;
|
|
701
|
+
left: 50%;
|
|
702
|
+
transform: translate(-50%, -50%);
|
|
703
|
+
.icon-xiangji {
|
|
704
|
+
width: calc(100% * 14 / 32);
|
|
705
|
+
height: calc(100% * 14 / 32);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
.default-upload {
|
|
709
|
+
width: 158px;
|
|
710
|
+
height: 99px;
|
|
711
|
+
}
|
|
712
|
+
// 头像上传
|
|
713
|
+
.head-img {
|
|
714
|
+
width: 24px;
|
|
715
|
+
height: 24px;
|
|
716
|
+
border-radius: 50%;
|
|
717
|
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
718
|
+
box-sizing: border-box;
|
|
719
|
+
}
|
|
720
|
+
.head-cont-img {
|
|
721
|
+
width: 80px;
|
|
722
|
+
height: 80px;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
</style>
|