123456 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ab7ccd9c"],{7870:function(t,e,i){"use strict";i.d(e,"b",(function(){return s})),i.d(e,"a",(function(){return o})),i.d(e,"c",(function(){return a}));var n=i("9f4c");function s(t){return Object(n["a"])({url:"qiniu/token",method:"get",params:t})}function o(t){return Object(n["a"])({url:"send_verify_code",method:"get",params:t})}function a(t,e){return Object(n["a"])({url:"worksites/".concat(t),method:"get",params:e})}},"90e2":function(t,e,i){"use strict";i.d(e,"a",(function(){return r}));
- /*!
- * Signature Pad v4.2.0 | https://github.com/szimek/signature_pad
- * (c) 2024 Szymon Nowak | Released under the MIT license
- */
- class n{constructor(t,e,i,n){if(isNaN(t)||isNaN(e))throw new Error(`Point is invalid: (${t}, ${e})`);this.x=+t,this.y=+e,this.pressure=i||0,this.time=n||Date.now()}distanceTo(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))}equals(t){return this.x===t.x&&this.y===t.y&&this.pressure===t.pressure&&this.time===t.time}velocityFrom(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):0}}class s{static fromPoints(t,e){const i=this.calculateControlPoints(t[0],t[1],t[2]).c2,n=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new s(t[1],i,n,t[2],e.start,e.end)}static calculateControlPoints(t,e,i){const s=t.x-e.x,o=t.y-e.y,a=e.x-i.x,r=e.y-i.y,h={x:(t.x+e.x)/2,y:(t.y+e.y)/2},c={x:(e.x+i.x)/2,y:(e.y+i.y)/2},l=Math.sqrt(s*s+o*o),d=Math.sqrt(a*a+r*r),u=h.x-c.x,p=h.y-c.y,v=d/(l+d),m={x:c.x+u*v,y:c.y+p*v},f=e.x-m.x,_=e.y-m.y;return{c1:new n(h.x+f,h.y+_),c2:new n(c.x+f,c.y+_)}}constructor(t,e,i,n,s,o){this.startPoint=t,this.control2=e,this.control1=i,this.endPoint=n,this.startWidth=s,this.endWidth=o}length(){const t=10;let e,i,n=0;for(let s=0;s<=t;s+=1){const o=s/t,a=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),r=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(s>0){const t=a-e,s=r-i;n+=Math.sqrt(t*t+s*s)}e=a,i=r}return n}point(t,e,i,n,s){return e*(1-t)*(1-t)*(1-t)+3*i*(1-t)*(1-t)*t+3*n*(1-t)*t*t+s*t*t*t}}class o{constructor(){try{this._et=new EventTarget}catch(t){this._et=document}}addEventListener(t,e,i){this._et.addEventListener(t,e,i)}dispatchEvent(t){return this._et.dispatchEvent(t)}removeEventListener(t,e,i){this._et.removeEventListener(t,e,i)}}function a(t,e=250){let i,n,s,o=0,a=null;const r=()=>{o=Date.now(),a=null,i=t.apply(n,s),a||(n=null,s=[])};return function(...h){const c=Date.now(),l=e-(c-o);return n=this,s=h,l<=0||l>e?(a&&(clearTimeout(a),a=null),o=c,i=t.apply(n,s),a||(n=null,s=[])):a||(a=window.setTimeout(r,l)),i}}class r extends o{constructor(t,e={}){super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=t=>{1===t.buttons&&this._strokeBegin(t)},this._handleMouseMove=t=>{this._strokeMoveUpdate(t)},this._handleMouseUp=t=>{1===t.buttons&&this._strokeEnd(t)},this._handleTouchStart=t=>{if(t.cancelable&&t.preventDefault(),1===t.targetTouches.length){const e=t.changedTouches[0];this._strokeBegin(e)}},this._handleTouchMove=t=>{t.cancelable&&t.preventDefault();const e=t.targetTouches[0];this._strokeMoveUpdate(e)},this._handleTouchEnd=t=>{const e=t.target===this.canvas;if(e){t.cancelable&&t.preventDefault();const e=t.changedTouches[0];this._strokeEnd(e)}},this._handlePointerStart=t=>{t.preventDefault(),this._strokeBegin(t)},this._handlePointerMove=t=>{this._strokeMoveUpdate(t)},this._handlePointerEnd=t=>{this._drawingStroke&&(t.preventDefault(),this._strokeEnd(t))},this.velocityFilterWeight=e.velocityFilterWeight||.7,this.minWidth=e.minWidth||.5,this.maxWidth=e.maxWidth||2.5,this.throttle="throttle"in e?e.throttle:16,this.minDistance="minDistance"in e?e.minDistance:5,this.dotSize=e.dotSize||0,this.penColor=e.penColor||"black",this.backgroundColor=e.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=e.compositeOperation||"source-over",this.canvasContextOptions="canvasContextOptions"in e?e.canvasContextOptions:{},this._strokeMoveUpdate=this.throttle?a(r.prototype._strokeUpdate,this.throttle):r.prototype._strokeUpdate,this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:t,canvas:e}=this;t.fillStyle=this.backgroundColor,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(t,e={}){return new Promise((i,n)=>{const s=new Image,o=e.ratio||window.devicePixelRatio||1,a=e.width||this.canvas.width/o,r=e.height||this.canvas.height/o,h=e.xOffset||0,c=e.yOffset||0;this._reset(this._getPointGroupOptions()),s.onload=()=>{this._ctx.drawImage(s,h,c,a,r),i()},s.onerror=t=>{n(t)},s.crossOrigin="anonymous",s.src=t,this._isEmpty=!1})}toDataURL(t="image/png",e){switch(t){case"image/svg+xml":return"object"!==typeof e&&(e=void 0),"data:image/svg+xml;base64,"+btoa(this.toSVG(e));default:return"number"!==typeof e&&(e=void 0),this.canvas.toDataURL(t,e)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerStart),this.canvas.removeEventListener("pointermove",this._handlePointerMove),this.canvas.ownerDocument.removeEventListener("pointerup",this._handlePointerEnd),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("mousemove",this._handleMouseMove),this.canvas.ownerDocument.removeEventListener("mouseup",this._handleMouseUp),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this.canvas.removeEventListener("touchmove",this._handleTouchMove),this.canvas.removeEventListener("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(t,{clear:e=!0}={}){e&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}toData(){return this._data}_getPointGroupOptions(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}_strokeBegin(t){const e=!this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0}));if(e)return;this._drawingStroke=!0;const i=this._getPointGroupOptions(),n=Object.assign(Object.assign({},i),{points:[]});this._data.push(n),this._reset(i),this._strokeUpdate(t)}_strokeUpdate(t){if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(t);this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));const e=t.clientX,i=t.clientY,n=void 0!==t.pressure?t.pressure:void 0!==t.force?t.force:0,s=this._createPoint(e,i,n),o=this._data[this._data.length-1],a=o.points,r=a.length>0&&a[a.length-1],h=!!r&&s.distanceTo(r)<=this.minDistance,c=this._getPointGroupOptions(o);if(!r||!r||!h){const t=this._addPoint(s,c);r?t&&this._drawCurve(t,c):this._drawDot(s,c),a.push({time:s.time,x:s.x,y:s.y,pressure:s.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}_strokeEnd(t){this._drawingStroke&&(this._strokeUpdate(t),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerStart),this.canvas.addEventListener("pointermove",this._handlePointerMove),this.canvas.ownerDocument.addEventListener("pointerup",this._handlePointerEnd)}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown),this.canvas.addEventListener("mousemove",this._handleMouseMove),this.canvas.ownerDocument.addEventListener("mouseup",this._handleMouseUp)}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart),this.canvas.addEventListener("touchmove",this._handleTouchMove),this.canvas.addEventListener("touchend",this._handleTouchEnd)}_reset(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}_createPoint(t,e,i){const s=this.canvas.getBoundingClientRect();return new n(t-s.left,e-s.top,i,(new Date).getTime())}_addPoint(t,e){const{_lastPoints:i}=this;if(i.push(t),i.length>2){3===i.length&&i.unshift(i[0]);const t=this._calculateCurveWidths(i[1],i[2],e),n=s.fromPoints(i,t);return i.shift(),n}return null}_calculateCurveWidths(t,e,i){const n=i.velocityFilterWeight*e.velocityFrom(t)+(1-i.velocityFilterWeight)*this._lastVelocity,s=this._strokeWidth(n,i),o={end:s,start:this._lastWidth};return this._lastVelocity=n,this._lastWidth=s,o}_strokeWidth(t,e){return Math.max(e.maxWidth/(t+1),e.minWidth)}_drawCurveSegment(t,e,i){const n=this._ctx;n.moveTo(t,e),n.arc(t,e,i,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,e){const i=this._ctx,n=t.endWidth-t.startWidth,s=2*Math.ceil(t.length());i.beginPath(),i.fillStyle=e.penColor;for(let o=0;o<s;o+=1){const i=o/s,a=i*i,r=a*i,h=1-i,c=h*h,l=c*h;let d=l*t.startPoint.x;d+=3*c*i*t.control1.x,d+=3*h*a*t.control2.x,d+=r*t.endPoint.x;let u=l*t.startPoint.y;u+=3*c*i*t.control1.y,u+=3*h*a*t.control2.y,u+=r*t.endPoint.y;const p=Math.min(t.startWidth+r*n,e.maxWidth);this._drawCurveSegment(d,u,p)}i.closePath(),i.fill()}_drawDot(t,e){const i=this._ctx,n=e.dotSize>0?e.dotSize:(e.minWidth+e.maxWidth)/2;i.beginPath(),this._drawCurveSegment(t.x,t.y,n),i.closePath(),i.fillStyle=e.penColor,i.fill()}_fromData(t,e,i){for(const s of t){const{points:t}=s,o=this._getPointGroupOptions(s);if(t.length>1)for(let i=0;i<t.length;i+=1){const s=t[i],a=new n(s.x,s.y,s.pressure,s.time);0===i&&this._reset(o);const r=this._addPoint(a,o);r&&e(r,o)}else this._reset(o),i(t[0],o)}}toSVG({includeBackgroundColor:t=!1}={}){const e=this._data,i=Math.max(window.devicePixelRatio||1,1),n=0,s=0,o=this.canvas.width/i,a=this.canvas.height/i,r=document.createElementNS("http://www.w3.org/2000/svg","svg");if(r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),r.setAttribute("viewBox",`${n} ${s} ${o} ${a}`),r.setAttribute("width",o.toString()),r.setAttribute("height",a.toString()),t&&this.backgroundColor){const t=document.createElement("rect");t.setAttribute("width","100%"),t.setAttribute("height","100%"),t.setAttribute("fill",this.backgroundColor),r.appendChild(t)}return this._fromData(e,(t,{penColor:e})=>{const i=document.createElement("path");if(!isNaN(t.control1.x)&&!isNaN(t.control1.y)&&!isNaN(t.control2.x)&&!isNaN(t.control2.y)){const n=`M ${t.startPoint.x.toFixed(3)},${t.startPoint.y.toFixed(3)} C ${t.control1.x.toFixed(3)},${t.control1.y.toFixed(3)} ${t.control2.x.toFixed(3)},${t.control2.y.toFixed(3)} ${t.endPoint.x.toFixed(3)},${t.endPoint.y.toFixed(3)}`;i.setAttribute("d",n),i.setAttribute("stroke-width",(2.25*t.endWidth).toFixed(3)),i.setAttribute("stroke",e),i.setAttribute("fill","none"),i.setAttribute("stroke-linecap","round"),r.appendChild(i)}},(t,{penColor:e,dotSize:i,minWidth:n,maxWidth:s})=>{const o=document.createElement("circle"),a=i>0?i:(n+s)/2;o.setAttribute("r",a.toString()),o.setAttribute("cx",t.x.toString()),o.setAttribute("cy",t.y.toString()),o.setAttribute("fill",e),r.appendChild(o)}),r.outerHTML}}},a9f5:function(t,e,i){"use strict";var n=function(){var t=this,e=t._self._c;return e("div",[e("van-field",{attrs:{readonly:"",border:t.border,label:t.label,placeholder:t.placeholder,disabled:t.disabled},scopedSlots:t._u([{key:"input",fn:function(){return[e("van-uploader",{attrs:{accept:t.accept,"before-read":t.beforeUpload,"after-read":t.afterRead,disabled:t.disabled,"show-upload":t.edit,deletable:t.edit},on:{delete:t.update},scopedSlots:t._u([{key:"preview-cover",fn:function(i){return[i.url&&"mp4"==i.url.split("/").pop().split(".").pop()?e("div",{staticClass:"w-full h-full overflow-hidden flex justify-center items-center"},[e("video",{staticClass:"min-w-full min-h-full",attrs:{src:i.url},on:{click:function(e){return t.videoPlay(i.url)}}},[t._v(" 您的浏览器不支持视频播放 ")])]):t._e()]}}]),model:{value:t.fileList,callback:function(e){t.fileList=e},expression:"fileList"}})]},proxy:!0}])}),t.videoShow?e("van-overlay",{staticClass:"flex justify-center items-center",attrs:{show:t.videoShow,"z-index":"1000"}},[e("video",{staticClass:"max-w-full max-h-full",attrs:{src:t.videoUrl,controls:""}},[t._v(" 您的浏览器不支持视频播放 ")]),e("i",{staticClass:"van-icon van-icon-clear van-image-preview__close-icon van-image-preview__close-icon--top-right",attrs:{role:"button"},on:{click:function(e){t.videoShow=!1}}})]):t._e()],1)},s=[],o=(i("9a83"),i("f564")),a=i("ade3"),r=(i("68ef"),i("a71a"),i("6e47")),h=(i("e930"),i("8f80")),c=(i("4de4"),i("4160"),i("d81d"),i("b64b"),i("d3b7"),i("159b"),i("7870")),l={name:"UploadList",components:Object(a["a"])(Object(a["a"])({},h["a"].name,h["a"]),r["a"].name,r["a"]),props:{value:{type:Array,default:function(){return[]}},label:{type:String,default:""},placeholder:{type:String,default:""},accept:{type:String,default:"image/*"},disabled:{type:Boolean,default:!1},border:{type:Boolean,default:!1},edit:{type:Boolean,default:!0}},watch:{value:{deep:!0,imediate:!0,handler:function(t){this.fileList=t.map((function(t){return{url:t}}))}}},data:function(){return{dataObj:{},fileList:[],videoShow:!1,videoUrl:""}},created:function(){this.fileList=this.value.map((function(t){return{url:t}}))},methods:{videoPlay:function(t){this.videoUrl=t,this.videoShow=!0},beforeUpload:function(t){if("video/mp4"===t.type){if(t.size/1024/1024>30)return Object(o["a"])({type:"danger",message:"上传视频大小不能超过 30MB!"}),!1}else if(t.size/1024/1024>30)return Object(o["a"])({type:"danger",message:"上传图片大小不能超过 30MB!"}),!1;var e="";if(console.log(t.type),"image/png"===t.type)e="png";else if("image/jpeg"===t.type)e="jpg";else{if("video/mp4"!==t.type)return Object(o["a"])({type:"danger",message:"上传格式有误!"}),!1;e="mp4"}var i=this;return new Promise((function(n,s){Object(c["b"])({file_type:e}).then((function(e){var s=e.data.key,o=e.data.token;i._data.dataObj.token=o,i._data.dataObj.key=s,n(t)})).catch((function(t){console.log(t),s()}))}))},afterRead:function(t){var e=this;console.log(t),t.status="uploading",t.message="上传中...";var i=new FormData;i.append("file",t.file),Object.keys(this.dataObj).forEach((function(t){i.append(t,e.dataObj[t])})),this.$axios({method:"post",url:"https://upload.qiniup.com",data:i}).then((function(i){console.log(i),t.url=e.$store.getters.setting.img_host+i.data.key,t.status="done",t.message="上传成功",e.update()})).catch((function(){t.status="failed",t.message="上传失败",e.update()}))},update:function(){var t=this.fileList.filter((function(t){return!t.status||"done"==t.status})).map((function(t){return t.url}));this.$emit("input",t),console.log(t)}}},d=l,u=(i("c027"),i("2877")),p=Object(u["a"])(d,n,s,!1,null,"5b2bdc2e",null);e["a"]=p.exports},c027:function(t,e,i){"use strict";i("dfb4")},d81d:function(t,e,i){"use strict";var n=i("23e7"),s=i("b727").map,o=i("1dde"),a=o("map");n({target:"Array",proto:!0,forced:!a},{map:function(t){return s(this,t,arguments.length>1?arguments[1]:void 0)}})},dfb4:function(t,e,i){},f4b3:function(t,e,i){"use strict";var n=i("23e7"),s=i("d039"),o=i("7b0b"),a=i("c04e"),r=s((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}));n({target:"Date",proto:!0,arity:1,forced:r},{toJSON:function(t){var e=o(this),i=a(e,"number");return"number"!=typeof i||isFinite(i)?e.toISOString():null}})}}]);
|