{"remainingRequest":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_photo.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_photo.vue","mtime":1725957645727},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["\nimport Constant from \"@/Constant.js\";\nimport form_operation from \"@/components/form_operation_log\";\nimport controlHidden from \"@/assets/js/controlHidden.js\";\nexport default {\n name: \"o-photo\",\n props: [\"id\"],\n components: {\n form_operation,\n },\n computed: {\n field: function () {\n let formData = this.$parent.findField(this.id);\n if (formData.displayType == 5 || formData.displayType == 3) {\n formData.printHiddenValue = formData.printHiddenValue\n ? formData.printHiddenValue.replace(/ /g, \"\")\n : \"\";\n }\n return formData; //this.$parent.findField(this.id);\n },\n },\n data: function () {\n return {\n Constant,\n dialogVisible: false,\n photo: \"\",\n savePhoto: \"\",\n showLogsDialog: false,\n showLogsIcon: true,\n operationData: \"\",\n dialogWidth: \"576px\", //在线拍照弹框宽度\n };\n },\n mounted() {\n window.onresize = () => {\n return (() => {\n //监听浏览器窗口改变,在线拍照弹窗宽度不变\n this.setDialogWidth();\n })();\n };\n this.$nextTick(() => {\n let field = this.field;\n if (field.isHideType) {\n let id = this.id,\n formShowType = field.formShowType;\n controlHidden({ id, field, formShowType });\n }\n });\n },\n methods: {\n setDialogWidth() {\n this.dialogWidth = \"576px\";\n },\n hiddenLogsDialog() {\n this.showLogsIcon = false;\n this.showLogsDialog = false;\n },\n enter() {\n if (this.field.isModified) {\n this.showLogsIcon = true;\n }\n },\n getOperationLogs() {\n let obj = {};\n obj.fieldName = this.field.name;\n this.operationData = obj;\n this.showLogsDialog = true;\n },\n // 调用摄像头\n callCamera() {\n navigator.mediaDevices\n .getUserMedia({\n video: true,\n })\n .then((success) => {\n // 摄像头开启成功\n this.$refs[\"video\"].srcObject = success;\n // 实时拍照效果\n this.$refs[\"video\"].play();\n })\n .catch((error) => {\n console.error(\"摄像头开启失败,请检查摄像头是否可用!\");\n console.log(error);\n });\n },\n // 拍照\n photograph() {\n let ctx = this.$refs[\"canvas\"].getContext(\"2d\");\n // 把当前视频帧内容渲染到canvas上\n ctx.drawImage(this.$refs[\"video\"], 0, 0, 160, 125);\n // 转base64格式、图片格式转换、图片质量压缩\n let imgBase64 = this.$refs[\"canvas\"].toDataURL(\"image/jpeg\", 0.7);\n console.log(\"拍的图片-->\");\n console.log(imgBase64);\n this.savePhoto = imgBase64;\n },\n // 关闭摄像头\n closeCamera() {\n if (!this.$refs[\"video\"].srcObject) return;\n let stream = this.$refs[\"video\"].srcObject;\n let tracks = stream.getTracks();\n tracks.forEach((track) => {\n track.stop();\n });\n this.$refs[\"video\"].srcObject = null;\n console.log(\"关闭了\");\n },\n showDialog() {\n var explorer = window.navigator.userAgent;\n if (explorer.indexOf(\"MSIE\") >= 0 || explorer.indexOf(\"Edge\") >= 0) {\n alert($(\"photo.unsupport_ie\"));\n } else {\n this.dialogVisible = true;\n this.callCamera();\n }\n },\n onOk() {\n this.photo = this.savePhoto;\n this.dialogVisible = false;\n this.closeCamera();\n },\n handleClose(done) {\n this.$confirm($t(\"close\"))\n .then(() => {\n this.closeCamera();\n done();\n })\n .catch(() => {});\n },\n callOff() {\n this.dialogVisible = false;\n this.closeCamera();\n },\n },\n};\n",null]}