AI-VUE/dist2/js/app.0b64eabd.js

2 lines
5.4 KiB
JavaScript

(function(){"use strict";var e={7589:function(e,t,i){var n=i(6848),o=function(){var e=this,t=e._self._c;return t("div",{staticClass:"img_bg_camera"},[t("video",{attrs:{id:"videoCamera",autoplay:"",hidden:""}}),t("canvas",{staticStyle:{display:"none"},attrs:{id:"canvasCamera",width:"250",height:"250"}}),t("div",{staticStyle:{display:"flex","justify-content":"center","align-items":"center",height:"102vh"}},[t("el-card",{staticClass:"contain",staticStyle:{display:"flex","justify-content":"center","align-items":"center"}},[t("p",[e._v("标题")]),t("el-card",{staticStyle:{width:"1100px",height:"450px"}},[t("div",{staticStyle:{height:"400px","overflow-y":"auto"}},[t("div",{staticStyle:{display:"flex","align-items":"flex-start","justify-content":"flex-start"}},[t("el-tag",{staticStyle:{"font-size":"14px","font-weight":"bold"}},[e._v("分析结果:")])],1),e._l(e.AiMessage,(function(i){return t("div",{key:i},[t("el-card",{staticStyle:{margin:"10px"}},[t("p",[e._v(e._s(i))])])],1)}))],2)]),t("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"success"},on:{click:function(t){return e.setImage()}}},[e._v("开启识别")]),t("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"warning"},on:{click:function(t){return e.stopImageCapture()}}},[e._v("停止识别")])],1)],1)])},a=[],s=(i(4114),i(4373)),r={data(){return{imgif:!1,videoWidth:250,videoHeight:250,imgSrc:"",thisCancas:null,thisContext:null,thisVideo:null,imga:"",intervalId:null,AiMessage:[]}},methods:{getCompetence(){if(this.thisCancas=document.getElementById("canvasCamera"),this.thisContext=this.thisCancas.getContext("2d"),this.thisVideo=document.getElementById("videoCamera"),!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)return void console.error("浏览器不支持 mediaDevices API");const e={audio:!1,video:{width:this.videoWidth,height:this.videoHeight,transform:"scaleX(-1)"}};navigator.mediaDevices.getUserMedia(e).then((e=>{this.thisVideo.srcObject=e,this.thisVideo.onloadedmetadata=()=>{this.thisVideo.play()},console.log("打开摄像头")})).catch((e=>{console.error("获取媒体输入失败",e)}))},sendImageToServer(e){s.A.post("http://124.71.135.249:8081/apiSend",{image:e}).then((e=>{"ok"===e.data.msg&&(this.$message({message:"图像识别成功!",type:"success"}),console.log(e.data.choices[0].message.content,"返回的数据"),this.AiMessage.push(e.data.choices[0].message.content),console.log(this.AiMessage))})).catch((e=>{console.error("发送图片时出错",e)}))},setImage(){console.log("开始拍照"),this.$message({message:"开始识别",type:"success"}),this.imgif=!0;var e=this;this.intervalId&&clearInterval(this.intervalId),this.intervalId=setInterval((function(){e.thisContext.drawImage(e.thisVideo,0,0,250,250),console.log(e.thisContext);var t=e.thisCancas.toDataURL("image/png");e.imgSrc=t,window.sessionStorage.setItem("img",e.imgSrc),e.sendImageToServer(e.imgSrc),console.log(e.imgSrc,"图片显示")}),5e3)},stopImageCapture(){this.intervalId&&(this.$message({message:"停止识别",type:"warning"}),clearInterval(this.intervalId),console.log("停止拍照"))},openFullScreen1(){this.thisVideo.srcObject.getTracks()[0].stop(),setTimeout((()=>{this.imga=window.sessionStorage.getItem("img");var e=this.imga;console.log(e);var t=new FormData;t.append("multipartFile",e),console.log(t,"formData")}),2e3)}},mounted(){this.getCompetence()}},c=r,l=i(1656),u=(0,l.A)(c,o,a,!1,null,"0eb681c3",null),d=u.exports,g=i(6178);n["default"].use(g.A);var h=new g.A({routes:[]}),f=i(9143),m=i.n(f);n["default"].config.productionTip=!1,n["default"].use(m()),new n["default"]({router:h,render:e=>e(d)}).$mount("#app")}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,i),a.loaded=!0,a.exports}i.m=e,function(){i.amdO={}}(),function(){var e=[];i.O=function(t,n,o,a){if(!n){var s=1/0;for(u=0;u<e.length;u++){n=e[u][0],o=e[u][1],a=e[u][2];for(var r=!0,c=0;c<n.length;c++)(!1&a||s>=a)&&Object.keys(i.O).every((function(e){return i.O[e](n[c])}))?n.splice(c--,1):(r=!1,a<s&&(s=a));if(r){e.splice(u--,1);var l=o();void 0!==l&&(t=l)}}return t}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[n,o,a]}}(),function(){i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,{a:t}),t}}(),function(){i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}}(),function(){i.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){i.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e}}(),function(){var e={524:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var o,a,s=n[0],r=n[1],c=n[2],l=0;if(s.some((function(t){return 0!==e[t]}))){for(o in r)i.o(r,o)&&(i.m[o]=r[o]);if(c)var u=c(i)}for(t&&t(n);l<s.length;l++)a=s[l],i.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return i.O(u)},n=self["webpackChunkmy_vue_project"]=self["webpackChunkmy_vue_project"]||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var n=i.O(void 0,[504],(function(){return i(7589)}));n=i.O(n)})();
//# sourceMappingURL=app.0b64eabd.js.map