=.001?function(t,e,i,s){for(var a=0;a0?r=h:e=h}while(Math.abs(o)>i&&++l-.001&&n<.001}var e=function(t,e,r,i){var s,a,n,o,h,l,p=defaultCurveSegments,f=0,m=[],c=[],d=bezier_length_pool.newElement();for(n=r.length,s=0;sn?-1:1,l=!0;l;)if(i[a]<=n&&i[a+1]>n?(o=(n-i[a])/(i[a+1]-i[a]),l=!1):a+=h,a<0||a>=s-1){if(a===s-1)return r[a];l=!1}return r[a]+(r[a+1]-r[a])*o}var o=createTypedArray("float32",8);return{getSegmentsLength:function(t){var r,i=segments_length_pool.newElement(),s=t.c,a=t.v,n=t.o,o=t.i,h=t._length,l=i.lengths,p=0;for(r=0;r1?1:s,h),f=n(a=a>1?1:a,h),m=t.length,c=1-p,d=1-f,u=c*c*c,y=p*c*c*3,g=p*p*c*3,v=p*p*p,b=c*c*d,P=p*c*d+c*p*d+c*c*f,_=p*p*d+c*p*f+p*c*f,x=p*p*f,S=c*d*d,T=p*d*d+c*f*d+c*d*f,E=p*f*d+c*f*f+p*d*f,C=p*f*f,A=d*d*d,k=f*d*d+d*f*d+d*d*f,D=f*f*d+d*f*f+f*d*f,M=f*f*f;for(l=0;lm?f>c?f-m-c:c-m-f:c>m?c-m-f:m-f-c)>-1e-4&&p<1e-4}}}!function(){for(var t=0,e=["ms","moz","webkit","o"],r=0;r=0;i-=1)if("sh"==t[i].ty){if(t[i].ks.k.i)r(t[i].ks.k);else for(a=t[i].ks.k.length,s=0;sr[0]||!(r[0]>t[0])&&(t[1]>r[1]||!(r[1]>t[1])&&(t[2]>r[2]||!(r[2]>t[2])&&void 0))}var s,a=function(){var t=[4,4,14];function e(t){var e,r,i,s=t.length;for(e=0;e=0;r-=1)if("sh"==t[r].ty){if(t[r].ks.k.i)t[r].ks.k.c=t[r].closed;else for(s=t[r].ks.k.length,i=0;i0&&(p=!1),p){var f=createTag("style");f.setAttribute("f-forigin",a[r].fOrigin),f.setAttribute("f-origin",a[r].origin),f.setAttribute("f-family",a[r].fFamily),f.type="text/css",f.innerHTML="@font-face {font-family: "+a[r].fFamily+"; font-style: normal; src: url('"+a[r].fPath+"');}",e.appendChild(f)}}else if("g"===a[r].fOrigin||1===a[r].origin){for(h=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),l=0;l=n.t-s){a.h&&(a=n),c=0;break}if(n.t-s>t){c=d;break}d=v||t=v?P.points.length-1:0;for(h=P.points[_].point.length,o=0;o=T&&S=v)r[0]=g[0],r[1]=g[1],r[2]=g[2];else if(t<=b)r[0]=a.s[0],r[1]=a.s[1],r[2]=a.s[2];else{!function(t,e){var r=e[0],i=e[1],s=e[2],a=e[3],n=Math.atan2(2*i*a-2*r*s,1-2*i*i-2*s*s),o=Math.asin(2*r*i+2*s*a),h=Math.atan2(2*r*a-2*i*s,1-2*r*r-2*s*s);t[0]=n/degToRads,t[1]=o/degToRads,t[2]=h/degToRads}(r,function(t,e,r){var i,s,a,n,o,h=[],l=t[0],p=t[1],f=t[2],m=t[3],c=e[0],d=e[1],u=e[2],y=e[3];(s=l*c+p*d+f*u+m*y)<0&&(s=-s,c=-c,d=-d,u=-u,y=-y);1-s>1e-6?(i=Math.acos(s),a=Math.sin(i),n=Math.sin((1-r)*i)/a,o=Math.sin(r*i)/a):(n=1-r,o=r);return h[0]=n*l+o*c,h[1]=n*p+o*d,h[2]=n*f+o*u,h[3]=n*m+o*y,h}(i(a.s),i(g),(t-b)/(v-b)))}else for(d=0;d=v?l=1:t=i&&e>=i||this._caching.lastFrame=e&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var s=this.interpolateValue(e,this._caching);this.pv=s}return this._caching.lastFrame=e,this.pv}function a(t){var r;if("unidimensional"===this.propType)r=t*this.mult,e(this.v-r)>1e-5&&(this.v=r,this._mdf=!0);else for(var i=0,s=this.v.length;i1e-5&&(this.v[i]=r,this._mdf=!0),i+=1}function n(){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length)if(this.lock)this.setVValue(this.pv);else{this.lock=!0,this._mdf=this._isFirstFrame;var t,e=this.effectsSequence.length,r=this.kf?this.pv:this.data.k;for(t=0;t=this.p.keyframes[this.p.keyframes.length-1].t?(e=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/i,0),r=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.01)/i,0)):(e=this.p.pv,r=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/i,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){e=[],r=[];var s=this.px,a=this.py;s._caching.lastFrame+s.offsetTime<=s.keyframes[0].t?(e[0]=s.getValueAtTime((s.keyframes[0].t+.01)/i,0),e[1]=a.getValueAtTime((a.keyframes[0].t+.01)/i,0),r[0]=s.getValueAtTime(s.keyframes[0].t/i,0),r[1]=a.getValueAtTime(a.keyframes[0].t/i,0)):s._caching.lastFrame+s.offsetTime>=s.keyframes[s.keyframes.length-1].t?(e[0]=s.getValueAtTime(s.keyframes[s.keyframes.length-1].t/i,0),e[1]=a.getValueAtTime(a.keyframes[a.keyframes.length-1].t/i,0),r[0]=s.getValueAtTime((s.keyframes[s.keyframes.length-1].t-.01)/i,0),r[1]=a.getValueAtTime((a.keyframes[a.keyframes.length-1].t-.01)/i,0)):(e=[s.pv,a.pv],r[0]=s.getValueAtTime((s._caching.lastFrame+s.offsetTime-.01)/i,s.offsetTime),r[1]=a.getValueAtTime((a._caching.lastFrame+a.offsetTime-.01)/i,a.offsetTime))}this.v.rotate(-Math.atan2(e[1]-r[1],e[0]-r[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}},precalculateMatrix:function(){if(!this.a.k&&(this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1,!this.s.effectsSequence.length)){if(this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2,this.sk){if(this.sk.effectsSequence.length||this.sa.effectsSequence.length)return;this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3}if(this.r){if(this.r.effectsSequence.length)return;this.pre.rotate(-this.r.v),this.appliedTransformations=4}else this.rz.effectsSequence.length||this.ry.effectsSequence.length||this.rx.effectsSequence.length||this.or.effectsSequence.length||(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}},autoOrient:function(){}},extendPrototype([DynamicPropertyContainer],t),t.prototype.addDynamicProperty=function(t){this._addDynamicProperty(t),this.elem.addDynamicProperty(t),this._isDirty=!0},t.prototype._addDynamicProperty=DynamicPropertyContainer.prototype.addDynamicProperty,{getTransformProperty:function(e,r,i){return new t(e,r,i)}}}();function ShapePath(){this.c=!1,this._length=0,this._maxLength=8,this.v=createSizedArray(this._maxLength),this.o=createSizedArray(this._maxLength),this.i=createSizedArray(this._maxLength)}ShapePath.prototype.setPathData=function(t,e){this.c=t,this.setLength(e);for(var r=0;r=this._maxLength&&this.doubleArrayLength(),r){case"v":a=this.v;break;case"i":a=this.i;break;case"o":a=this.o}(!a[i]||a[i]&&!s)&&(a[i]=point_pool.newElement()),a[i][0]=t,a[i][1]=e},ShapePath.prototype.setTripleAt=function(t,e,r,i,s,a,n,o){this.setXYAt(t,e,"v",n,o),this.setXYAt(r,i,"o",n,o),this.setXYAt(s,a,"i",n,o)},ShapePath.prototype.reverse=function(){var t=new ShapePath;t.setPathData(this.c,this._length);var e=this.v,r=this.o,i=this.i,s=0;this.c&&(t.setTripleAt(e[0][0],e[0][1],i[0][0],i[0][1],r[0][0],r[0][1],0,!1),s=1);var a,n=this._length-1,o=this._length;for(a=s;a=c[c.length-1].t-this.offsetTime)i=c[c.length-1].s?c[c.length-1].s[0]:c[c.length-2].e[0],a=!0;else{for(var d,u,y=m,g=c.length-1,v=!0;v&&(d=c[y],!((u=c[y+1]).t-this.offsetTime>t));)y=u.t-this.offsetTime)p=1;else if(ti&&e>i)||(this._caching.lastIndex=s=1?a.push({s:t-1,e:e-1}):(a.push({s:t,e:1}),a.push({s:0,e:e-1}));var n,o,h=[],l=a.length;for(n=0;ni+r);else p=o.s*s<=i?0:(o.s*s-i)/r,f=o.e*s>=i+r?1:(o.e*s-i)/r,h.push([p,f])}return h.length||h.push([0,0]),h},TrimModifier.prototype.releasePathsData=function(t){var e,r=t.length;for(e=0;e1?1:this.s.v<0?0:this.s.v)+s)>(r=(this.e.v>1?1:this.e.v<0?0:this.e.v)+s)){var a=e;e=r,r=a}e=1e-4*Math.round(1e4*e),r=1e-4*Math.round(1e4*r),this.sValue=e,this.eValue=r}else e=this.sValue,r=this.eValue;var n,o,h,l,p,f,m=this.shapes.length,c=0;if(r===e)for(n=0;n=0;n-=1)if((d=this.shapes[n]).shape._mdf){for((u=d.localShapeCollection).releaseShapes(),2===this.m&&m>1?(g=this.calculateShapeEdges(e,r,d.totalShapeLength,P,c),P+=d.totalShapeLength):g=[[v,b]],h=g.length,o=0;o=1?y.push({s:d.totalShapeLength*(v-1),e:d.totalShapeLength*(b-1)}):(y.push({s:d.totalShapeLength*v,e:d.totalShapeLength}),y.push({s:0,e:d.totalShapeLength*(b-1)}));var _=this.addShapes(d,y[0]);if(y[0].s!==y[0].e){if(y.length>1)if(d.shape.paths.shapes[d.shape.paths._length-1].c){var x=_.pop();this.addPaths(_,u),_=this.addShapes(d,y[1],x)}else this.addPaths(_,u),_=this.addShapes(d,y[1]);this.addPaths(_,u)}}d.shape.paths=u}}},TrimModifier.prototype.addPaths=function(t,e){var r,i=t.length;for(r=0;re.e){r.c=!1;break}e.s<=d&&e.e>=d+n.addedLength?(this.addSegment(m[i].v[s-1],m[i].o[s-1],m[i].i[s],m[i].v[s],r,o,y),y=!1):(l=bez.getNewSegment(m[i].v[s-1],m[i].v[s],m[i].o[s-1],m[i].i[s],(e.s-d)/n.addedLength,(e.e-d)/n.addedLength,h[s-1]),this.addSegmentFromArray(l,r,o,y),y=!1,r.c=!1),d+=n.addedLength,o+=1}if(m[i].c&&h.length){if(n=h[s-1],d<=e.e){var g=h[s-1].addedLength;e.s<=d&&e.e>=d+g?(this.addSegment(m[i].v[s-1],m[i].o[s-1],m[i].i[0],m[i].v[0],r,o,y),y=!1):(l=bez.getNewSegment(m[i].v[s-1],m[i].v[0],m[i].o[s-1],m[i].i[0],(e.s-d)/g,(e.e-d)/g,h[s-1]),this.addSegmentFromArray(l,r,o,y),y=!1,r.c=!1)}else r.c=!1;d+=n.addedLength,o+=1}if(r._length&&(r.setXYAt(r.v[p][0],r.v[p][1],"i",p),r.setXYAt(r.v[r._length-1][0],r.v[r._length-1][1],"o",r._length-1)),d>e.e)break;i0;)r-=1,this._elements.unshift(e[r]),1;this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,r=t.length;for(e=0;e0?Math.floor(l):Math.ceil(l),m=(this.tr.v.props,this.pMatrix.props),c=this.rMatrix.props,d=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var u,y,g=0;if(l>0){for(;gf;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),g-=1;p&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-p,!0),g-=p)}for(i=1===this.data.m?0:this._currentCopies-1,s=1===this.data.m?1:-1,a=this._currentCopies;a;){if(y=(r=(e=this.elemsData[i].it)[e.length-1].transform.mProps.v.props).length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this.so.v+(this.eo.v-this.so.v)*(i/(this._currentCopies-1)),0!==g){for((0!==i&&1===s||i!==this._currentCopies-1&&-1===s)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]),this.matrix.transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15]),this.matrix.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),u=0;u.01)return!1;r+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!=this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t=o+ot||!d?(v=(o+ot-l)/h.partialLength,z=c.point[0]+(h.point[0]-c.point[0])*v,B=c.point[1]+(h.point[1]-c.point[1])*v,T.translate(-_[0]*A[s].an/200,-_[1]*V/100),p=!1):d&&(l+=h.partialLength,(f+=1)>=d.length&&(f=0,u[m+=1]?d=u[m].points:P.v.c?(f=0,d=u[m=0].points):(l-=h.partialLength,d=null)),d&&(c=h,y=(h=d[f]).partialLength));O=A[s].an/2-A[s].add,T.translate(-O,0,0)}else O=A[s].an/2-A[s].add,T.translate(-O,0,0),T.translate(-_[0]*A[s].an/200,-_[1]*V/100,0);for(A[s].l/2,I=0;I1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(this.elem.globalData.frameId!==this.frameId&&this.effectsSequence.length||t){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,r=this.keysIndex;if(this.lock)this.setCurrentData(this.currentData);else{this.lock=!0,this._mdf=!1;var i,s=this.effectsSequence.length,a=t||this.data.d.k[this.keysIndex].s;for(i=0;ie));)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e,r=FontManager.getCombinedCharacterCodes(),i=[],s=0,a=t.length;s=55296&&e<=56319&&(e=t.charCodeAt(s+1))>=56320&&e<=57343?(i.push(t.substr(s,2)),++s):i.push(t.charAt(s)),s+=1;return i},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e,r,i,s,a,n,o,h=this.elem.globalData.fontManager,l=this.data,p=[],f=0,m=l.m.g,c=0,d=0,u=0,y=[],g=0,v=0,b=h.getFontByName(t.f),P=0,_=b.fStyle?b.fStyle.split(" "):[],x="normal",S="normal";for(r=_.length,e=0;eD&&" "!==A[e]?(-1===I?r+=1:e=I,C+=t.finalLineHeight||1.2*t.finalSize,A.splice(e,I===e?1:0,"\r"),I=-1,g=0):(g+=P,g+=E);C+=b.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&Mv?g:v,g=-2*E,s="",i=!0,u+=1):s=t.finalText[e],h.chars?(o=h.getCharData(w,b.fStyle,h.getFontByName(t.f).fFamily),P=i?0:o.w*t.finalSize/100):P=h.measureText(s,t.f,t.finalSize)," "===w?F+=P+E:(g+=P+E+F,F=0),p.push({l:P,an:P,add:c,n:i,anIndexes:[],val:s,line:u,animatorJustifyOffset:0}),2==m){if(c+=P,""===s||" "===s||e===r-1){for(""!==s&&" "!==s||(c-=P);d<=e;)p[d].an=c,p[d].ind=f,p[d].extra=P,d+=1;f+=1,c=0}}else if(3==m){if(c+=P,""===s||e===r-1){for(""===s&&(c-=P);d<=e;)p[d].an=c,p[d].ind=f,p[d].extra=P,d+=1;c=0,f+=1}}else p[f].ind=f,p[f].extra=0,f+=1;if(t.l=p,v=g>v?g:v,y.push(g),t.sz)t.boxWidth=t.sz[0],t.justifyOffset=0;else switch(t.boxWidth=v,t.j){case 1:t.justifyOffset=-t.boxWidth;break;case 2:t.justifyOffset=-t.boxWidth/2;break;default:t.justifyOffset=0}t.lineWidths=y;var V,R,L=l.a;n=L.length;var O,z,B=[];for(a=0;a=o?1:0:t(0,e(.5/(o-n)+(i-n)/(o-n),1)));else if(3==h)a=s(a=o===n?i>=o?0:1:1-t(0,e(.5/(o-n)+(i-n)/(o-n),1)));else if(4==h)o===n?a=0:(a=t(0,e(.5/(o-n)+(i-n)/(o-n),1)))<.5?a*=2:a=1-2*(a-.5),a=s(a);else if(5==h){if(o===n)a=0;else{var l=o-n,p=-l/2+(i=e(t(0,i+.5-n),o-n)),f=l/2;a=Math.sqrt(1-p*p/(f*f))}a=s(a)}else 6==h?(o===n?a=0:(i=e(t(0,i+.5-n),o-n),a=(1+Math.cos(Math.PI+2*Math.PI*i/(o-n)))/2),a=s(a)):(i>=r(n)&&(a=i-n<0?1-(n-i):t(0,e(o-i,1))),a=s(a));return a*this.a.v},getValue:function(t){this.iterateDynamicProperties(),this._mdf=t||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,t&&2===this.data.r&&(this.e.v=this._currentTextLength);var e=2===this.data.r?1:100/this.data.totalChars,r=this.o.v/e,i=this.s.v/e+r,s=this.e.v/e+r;if(i>s){var a=i;i=s,s=a}this.finalS=i,this.finalE=s}},extendPrototype([DynamicPropertyContainer],i),{getTextSelectorProp:function(t,e,r){return new i(t,e,r)}}}(),pool_factory=function(t,e,r,i){var s=0,a=t,n=createSizedArray(a);function o(){return s?n[s-=1]:e()}return{newElement:o,release:function(t){s===a&&(n=pooling.double(n),a*=2),r&&r(t),n[s]=t,s+=1}}},pooling={double:function(t){return t.concat(createSizedArray(t.length))}},point_pool=pool_factory(8,function(){return createTypedArray("float32",2)}),shape_pool=(factory=pool_factory(4,function(){return new ShapePath},function(t){var e,r=t._length;for(e=0;e0&&(this.maskElement.setAttribute("id",y),this.element.maskedElement.setAttribute(v,"url("+locationHref+"#"+y+")"),s.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}function HierarchyElement(){}function FrameElement(){}function TransformElement(){}function RenderableElement(){}function RenderableDOMElement(){}function ProcessedElement(t,e){this.elem=t,this.pos=e}function SVGShapeData(t,e,r){this.caches=[],this.styles=[],this.transformers=t,this.lStr="",this.sh=r,this.lvl=e,this._isAnimated=!!r.k;for(var i=0,s=t.length;i=0;e--)this.elements[e]||(r=this.layers[e]).ip-r.st<=t-this.layers[e].st&&r.op-r.st>t-this.layers[e].st&&this.buildItem(e),this.completeLayers=!!this.elements[e]&&this.completeLayers;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 3:return this.createNull(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 13:return this.createCamera(t)}return this.createNull(t)},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;t=0;e--)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(t-this.layers[e].st);if(this.globalData._mdf)for(e=0;er&&"meet"===a||ir&&"slice"===a)?(t-this.transformCanvas.w*(e/this.transformCanvas.h))/2*this.renderConfig.dpr:"xMax"===o&&(ir&&"slice"===a)?(t-this.transformCanvas.w*(e/this.transformCanvas.h))*this.renderConfig.dpr:0,this.transformCanvas.ty="YMid"===h&&(i>r&&"meet"===a||ir&&"meet"===a||i=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRenderer.prototype.renderFrame=function(t,e){if((this.renderedFrame!==t||!0!==this.renderConfig.clearCanvas||e)&&!this.destroyed&&-1!==t){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(t),r=0;r=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame();!0!==this.renderConfig.clearCanvas&&this.restore()}}},CanvasRenderer.prototype.buildItem=function(t){var e=this.elements;if(!e[t]&&99!=this.layers[t].ty){var r=this.createItem(this.layers[t],this,this.globalData);e[t]=r,r.initExpressions()}},CanvasRenderer.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){this.pendingElements.pop().checkParenting()}},CanvasRenderer.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRenderer.prototype.show=function(){this.animationItem.container.style.display="block"},MaskElement.prototype.getMaskProperty=function(t){return this.viewData[t].prop},MaskElement.prototype.renderFrame=function(t){var e,r=this.element.finalTransform.mat,i=this.masksProperties.length;for(e=0;e1&&(a+=" C"+e.o[i-1][0]+","+e.o[i-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),r.lastPath!==a){var n="";r.elem&&(e.c&&(n=t.inv?this.solidPath+a:a),r.elem.setAttribute("d",n)),r.lastPath=a}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null},HierarchyElement.prototype={initHierarchy:function(){this.hierarchy=[],this._isParent=!1,this.checkParenting()},setHierarchy:function(t){this.hierarchy=t},setAsParent:function(){this._isParent=!0},checkParenting:function(){void 0!==this.data.parent&&this.comp.buildElementParenting(this,this.data.parent,[])}},FrameElement.prototype={initFrame:function(){this._isFirstFrame=!1,this.dynamicProperties=[],this._mdf=!1},prepareProperties:function(t,e){var r,i=this.dynamicProperties.length;for(r=0;rt?!0!==this.isInRange&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):!1!==this.isInRange&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var t,e=this.renderableComponents.length;for(t=0;t=0;i-=1)r=t.transforms[i].transform.mProps.v.props,t.finalTransform.transform(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15]);t._mdf=a},processSequences:function(t){var e,r=this.sequenceList.length;for(e=0;e=0;t-=1)this.shapeModifiers[t].processShapes(this._isFirstFrame)}},lcEnum:{1:"butt",2:"round",3:"square"},ljEnum:{1:"miter",2:"round",3:"bevel"},searchProcessedElement:function(t){for(var e=this.processedElements,r=0,i=e.length;r=0;r-=1)(this.completeLayers||this.elements[r])&&(this.elements[r].prepareFrame(this.renderedFrame-this.layers[r].st),this.elements[r]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var t,e=this.layers.length;for(t=0;t1&&o&&this.setShapesAsAnimated(n)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;e=0;o-=1){if((m=this.searchProcessedElement(t[o]))?e[o]=r[m-1]:t[o]._render=n,"fl"==t[o].ty||"st"==t[o].ty||"gf"==t[o].ty||"gs"==t[o].ty)m?e[o].style.closed=!1:e[o]=this.createStyleElement(t[o],s),t[o]._render&&i.appendChild(e[o].style.pElem),u.push(e[o].style);else if("gr"==t[o].ty){if(m)for(l=e[o].it.length,h=0;ho&&"xMidYMid slice"===h||n=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},CVCompElement.prototype.destroy=function(){var t;for(t=this.layers.length-1;t>=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.layers=null,this.elements=null},CVMaskElement.prototype.renderFrame=function(){if(this.hasMasks){var t,e,r,i,s=this.element.finalTransform.mat,a=this.element.canvasContext,n=this.masksProperties.length;for(a.beginPath(),t=0;t=0;a-=1){if((h=this.searchProcessedElement(t[a]))?e[a]=r[h-1]:t[a]._shouldRender=i,"fl"==t[a].ty||"st"==t[a].ty||"gf"==t[a].ty||"gs"==t[a].ty)h?e[a].style.closed=!1:e[a]=this.createStyleElement(t[a],d),m.push(e[a].style);else if("gr"==t[a].ty){if(h)for(o=e[a].it.length,n=0;n=0;s-=1)"tr"==e[s].ty?(a=r[s].transform,this.renderShapeTransform(t,a)):"sh"==e[s].ty||"el"==e[s].ty||"rc"==e[s].ty||"sr"==e[s].ty?this.renderPath(e[s],r[s]):"fl"==e[s].ty?this.renderFill(e[s],r[s],a):"st"==e[s].ty?this.renderStroke(e[s],r[s],a):"gf"==e[s].ty||"gs"==e[s].ty?this.renderGradientFill(e[s],r[s],a):"gr"==e[s].ty?this.renderShape(a,e[s].it,r[s].it):e[s].ty;i&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(t,e){if(this._isFirstFrame||e._mdf||t.transforms._mdf){var r,i,s,a=t.trNodes,n=e.paths,o=n._length;a.length=0;var h=t.transforms.finalTransform;for(s=0;s=1?.99:e.h.v<=-1?-.99:e.h.v),p=Math.cos(h+e.a.v)*l+a[0],f=Math.sin(h+e.a.v)*l+a[1],m=s.createRadialGradient(p,f,0,a[0],a[1],o);var c,d=t.g.p,u=e.g.c,y=1;for(c=0;c=0;r-=1)e[r].animation.destroy(t)},t.freeze=function(){n=!0},t.unfreeze=function(){n=!1,d()},t.getRegisteredAnimations=function(){var t,r=e.length,i=[];for(t=0;tthis.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e,r,i=this.animationData.layers,s=i.length,a=t.layers,n=a.length;for(r=0;rthis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame()},AnimationItem.prototype.renderFrame=function(){!1!==this.isLoaded&&this.renderer.renderFrame(this.currentFrame+this.firstFrame)},AnimationItem.prototype.play=function(t){t&&this.name!=t||!0===this.isPaused&&(this.isPaused=!1,this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(t){t&&this.name!=t||!1===this.isPaused&&(this.isPaused=!0,this._idle=!0,this.trigger("_idle"))},AnimationItem.prototype.togglePause=function(t){t&&this.name!=t||(!0===this.isPaused?this.play():this.pause())},AnimationItem.prototype.stop=function(t){t&&this.name!=t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.goToAndStop=function(t,e,r){r&&this.name!=r||(e?this.setCurrentRawFrameValue(t):this.setCurrentRawFrameValue(t*this.frameModifier),this.pause())},AnimationItem.prototype.goToAndPlay=function(t,e,r){this.goToAndStop(t,e,r),this.play()},AnimationItem.prototype.advanceTime=function(t){if(!0!==this.isPaused&&!1!==this.isLoaded){var e=this.currentRawFrame+t*this.frameModifier,r=!1;e>=this.totalFrames-1&&this.frameModifier>0?this.loop&&this.playCount!==this.loop?e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(r=!0,e=this.totalFrames-1):e<0?this.checkSegments(e%this.totalFrames)||(!this.loop||this.playCount--<=0&&!0!==this.loop?(r=!0,e=0):(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0)):this.setCurrentRawFrameValue(e),r&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.timeCompleted=this.totalFrames=t[0]-t[1],this.firstFrame=t[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):t[1]>t[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.timeCompleted=this.totalFrames=t[1]-t[0],this.firstFrame=t[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(t,e){var r=-1;this.isPaused&&(this.currentRawFrame+this.firstFramee&&(r=e-t)),this.firstFrame=t,this.timeCompleted=this.totalFrames=e-t,-1!==r&&this.goToAndStop(r,!0)},AnimationItem.prototype.playSegments=function(t,e){if(e&&(this.segments.length=0),"object"===_typeof(t[0])){var r,i=t.length;for(r=0;rr){var i=r;r=e,e=i}return Math.min(Math.max(t,e),r)}function radiansToDegrees(t){return t/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(t){return t*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(t,e){if("number"==typeof t||t instanceof Number)return e=e||0,Math.abs(t-e);e||(e=helperLengthArray);var r,i=Math.min(t.length,e.length),s=0;for(r=0;r.5?l/(2-n-o):l/(n+o),n){case i:e=(s-a)/l+(s1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function hslToRgb(t){var e,r,i,s=t[0],a=t[1],n=t[2];if(0===a)e=r=i=n;else{var o=n<.5?n*(1+a):n+a-n*a,h=2*n-o;e=hue2rgb(h,o,s+1/3),r=hue2rgb(h,o,s),i=hue2rgb(h,o,s-1/3)}return[e,r,i,t[3]]}function linear(t,e,r,i,s){if(void 0!==i&&void 0!==s||(i=e,s=r,e=0,r=1),r=r)return s;var n=r===e?0:(t-e)/(r-e);if(!i.length)return i+(s-i)*n;var o,h=i.length,l=createTypedArray("float32",h);for(o=0;o1){for(i=0;i1?1:e<0?0:e);if($bm_isInstanceOfArray(s)){var o,h=s.length,l=createTypedArray("float32",h);for(o=0;odata.k[e].t&&tdata.k[e+1].t-t?(r=e+2,i=data.k[e+1].t):(r=e+1,i=data.k[e].t);break}}-1===r&&(r=e+1,i=data.k[e].t)}else r=0,i=0;var a={};return a.index=r,a.time=i/elem.comp.globalData.frameRate,a}function key(t){var e,r,i;if(!data.k.length||"number"==typeof data.k[0])throw new Error("The property has no keyframe at index "+t);t-=1,e={time:data.k[t].t/elem.comp.globalData.frameRate,value:[]};var s=data.k[t].hasOwnProperty("s")?data.k[t].s:data.k[t-1].e;for(i=s.length,r=0;rl.length-1)&&(e=l.length-1),i=p-(s=l[l.length-1-e].t)),"pingpong"===t){if(Math.floor((h-s)/i)%2!=0)return this.getValueAtTime((i-(h-s)%i+s)/this.comp.globalData.frameRate,0)}else{if("offset"===t){var f=this.getValueAtTime(s/this.comp.globalData.frameRate,0),m=this.getValueAtTime(p/this.comp.globalData.frameRate,0),c=this.getValueAtTime(((h-s)%i+s)/this.comp.globalData.frameRate,0),d=Math.floor((h-s)/i);if(this.pv.length){for(n=(o=new Array(f.length)).length,a=0;a=p)return this.pv;if(r?s=p+(i=e?Math.abs(elem.comp.globalData.frameRate*e):Math.max(0,this.elem.data.op-p)):((!e||e>l.length-1)&&(e=l.length-1),i=(s=l[e].t)-p),"pingpong"===t){if(Math.floor((p-h)/i)%2==0)return this.getValueAtTime(((p-h)%i+p)/this.comp.globalData.frameRate,0)}else{if("offset"===t){var f=this.getValueAtTime(p/this.comp.globalData.frameRate,0),m=this.getValueAtTime(s/this.comp.globalData.frameRate,0),c=this.getValueAtTime((i-(p-h)%i+p)/this.comp.globalData.frameRate,0),d=Math.floor((p-h)/i)+1;if(this.pv.length){for(n=(o=new Array(f.length)).length,a=0;a1?(s+t-a)/(e-1):1,o=0,h=0;for(r=this.pv.length?createTypedArray("float32",this.pv.length):0;on){var p=o,f=r.c&&o===h-1?0:o+1,m=(n-l)/a[o].addedLength;i=bez.getPointInSegment(r.v[p],r.v[f],r.o[p],r.i[f],m,a[o]);break}l+=a[o].addedLength,o+=1}return i||(i=r.c?[r.v[0][0],r.v[0][1]]:[r.v[r._length-1][0],r.v[r._length-1][1]]),i},vectorOnPath:function(t,e,r){t=1==t?this.v.c?0:.999:t;var i=this.pointOnPath(t,e),s=this.pointOnPath(t+.001,e),a=s[0]-i[0],n=s[1]-i[1],o=Math.sqrt(Math.pow(a,2)+Math.pow(n,2));return 0===o?[0,0]:"tangent"===r?[a/o,n/o]:[-n/o,a/o]},tangentOnPath:function(t,e){return this.vectorOnPath(t,e,"tangent")},normalOnPath:function(t,e){return this.vectorOnPath(t,e,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([o],a),extendPrototype([o],n),n.prototype.getValueAtTime=function(t){return this._cachingAtTime||(this._cachingAtTime={shapeValue:shape_pool.clone(this.pv),lastIndex:0,lastTime:initialDefaultFrame}),t*=this.elem.globalData.frameRate,(t-=this.offsetTime)!==this._cachingAtTime.lastTime&&(this._cachingAtTime.lastIndex=this._cachingAtTime.lastTime1&&(defaultCurveSegments=t);roundValues(!(defaultCurveSegments>=50))}function inBrowser(){return void 0!==navigator}function installPlugin(t,e){"expressions"===t&&(expressionsPlugin=e)}function getFactory(t){switch(t){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix}}function checkReady(){"complete"===document.readyState&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(t){for(var e=queryString.split("&"),r=0;r
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-message/fui-message.vue b/components/firstui/fui-message/fui-message.vue
new file mode 100644
index 0000000..a42d505
--- /dev/null
+++ b/components/firstui/fui-message/fui-message.vue
@@ -0,0 +1,220 @@
+
+
+
+
+ {{text}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-modal/fui-modal.vue b/components/firstui/fui-modal/fui-modal.vue
new file mode 100644
index 0000000..cf9e9db
--- /dev/null
+++ b/components/firstui/fui-modal/fui-modal.vue
@@ -0,0 +1,408 @@
+
+
+
+
+ {{title}}
+ {{descr}}
+
+
+
+ {{entity.text}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-movable-view/bindingx.js b/components/firstui/fui-movable-view/bindingx.js
new file mode 100644
index 0000000..1dfa9ea
--- /dev/null
+++ b/components/firstui/fui-movable-view/bindingx.js
@@ -0,0 +1,103 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+const animation = uni.requireNativePlugin('animation');
+export default {
+ data() {
+ return {
+ startX: 0,
+ startY: 0,
+ lastLeft: 0,
+ lastTop: 0
+ }
+ },
+ created() {
+ this.refFab = null;
+ this.loop = null
+ },
+ mounted() {
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.refFab = this.getEl(this.$refs['fui-movable__view'])
+ }, 50)
+ })
+ },
+ methods: {
+ getEl(el) {
+ return el.ref || el[0].ref;
+ },
+ _aniMove(x, y) {
+ if (!this.refFab || this.direction === 'none') return
+ animation.transition(this.refFab, {
+ styles: {
+ transform: `translate(${x}px,${y}px)`
+ },
+ duration: 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ }, () => {
+ this.change({
+ left: x,
+ top: y
+ })
+ });
+ },
+ touchstart(e) {
+ if (this.direction === 'none') return;
+ var touch = e.touches || e.changedTouches
+ if (this.direction === 'all') {
+ this.startX = touch[0].screenX
+ this.startY = touch[0].screenY
+ } else if (this.direction === 'vertical') {
+ this.startY = touch[0].screenY
+ } else {
+ this.startX = touch[0].screenX
+ }
+ },
+ getLeft(pageX) {
+ var left = pageX - this.startX + this.lastLeft;
+ left = left < -this.eLeft ? -this.eLeft : left;
+ left = left > this.maxWidth ? this.maxWidth : left;
+
+ return left
+ },
+ getTop(pageY) {
+ var top = pageY - this.startY + this.lastTop;
+ top = top < -this.eTop ? -this.eTop : top;
+ top = top > this.maxHeight ? this.maxHeight : top;
+
+ return top
+ },
+ touchmove(e) {
+ if (this.direction === 'none') return;
+ var touch = e.touches || e.changedTouches
+ let pageX = touch[0].screenX,
+ pageY = touch[0].screenY;
+
+ let left = 0,
+ top = 0;
+ if (this.direction === 'all') {
+ left = this.getLeft(pageX)
+ this.startX = pageX
+ top = this.getTop(pageY)
+ this.startY = pageY
+ } else if (this.direction === 'vertical') {
+ top = this.getTop(pageY)
+ this.startY = pageY
+ } else {
+ left = this.getLeft(pageX)
+ this.startX = pageX
+ }
+
+ this.lastLeft = left
+ this.lastTop = top
+ this._aniMove(left, top)
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-movable-view/fui-movable-view.vue b/components/firstui/fui-movable-view/fui-movable-view.vue
new file mode 100644
index 0000000..94b3708
--- /dev/null
+++ b/components/firstui/fui-movable-view/fui-movable-view.vue
@@ -0,0 +1,192 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-movable-view/index.wxs b/components/firstui/fui-movable-view/index.wxs
new file mode 100644
index 0000000..d66f795
--- /dev/null
+++ b/components/firstui/fui-movable-view/index.wxs
@@ -0,0 +1,139 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186140 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var movable = {
+ width: 100,
+ height: 100,
+ direction: '',
+ left: 0,
+ top: 0
+}
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function setInitValue(dataset, isChange) {
+ movable.width = +dataset.width
+ movable.height = +dataset.height
+ movable.top = +dataset.top
+ movable.left = +dataset.left
+ movable.direction = dataset.direction
+}
+
+function touchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0];
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ if (dataset.direction == 'all') {
+ state.startX = touch.clientX
+ state.startY = touch.clientY
+ } else if (dataset.direction == 'vertical') {
+ state.startY = touch.clientY
+ } else {
+ state.startX = touch.clientX
+ }
+ setInitValue(dataset)
+}
+
+function styleChange(left, top, ins) {
+ if (!ins) return;
+ var mview = ins.selectComponent('.fui-movable__view');
+ if (!mview) return;
+ mview.setStyle({
+ transform: 'translate3d(' + left + 'px,' + top + 'px,0)'
+ })
+ ins.callMethod('change', {
+ left: left,
+ top: top
+ })
+}
+
+function getLeft(pageX, state) {
+ var left = pageX - state.startX + (state.lastLeft || 0);
+ left = left < -movable.left ? -movable.left : left;
+ left = left > movable.width ? movable.width : left;
+
+ return left
+}
+
+function getTop(pageY, state) {
+ var top = pageY - state.startY + (state.lastTop || 0);
+ top = top < -movable.top ? -movable.top : top;
+ top = top > movable.height ? movable.height : top;
+
+ return top
+}
+
+function touchmove(e, ins, event) {
+ if (movable.direction == 'none') return;
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ touch = e.touches[0] || e.changedTouches[0]
+ state = e.instance.getState()
+ }
+ var pageX = touch.clientX;
+ var pageY = touch.clientY;
+ var left = 0,
+ top = 0;
+ if (movable.direction == 'all') {
+ left = getLeft(pageX, state)
+ state.startX = pageX
+ top = getTop(pageY, state)
+ state.startY = pageY
+ } else if (movable.direction == 'vertical') {
+ top = getTop(pageY, state)
+ state.startY = pageY
+ } else {
+ left = getLeft(pageX, state)
+ state.startX = pageX
+ }
+
+ state.lastLeft = left
+ state.lastTop = top
+ styleChange(left, top, ins)
+}
+
+var _movable = false;
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ _movable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !_movable) return
+ touchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC() || !_movable) return
+ _movable = false
+ }
+}
+
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ mousedown: mousedown
+}
\ No newline at end of file
diff --git a/components/firstui/fui-movable-view/mpjs.js b/components/firstui/fui-movable-view/mpjs.js
new file mode 100644
index 0000000..bfa0489
--- /dev/null
+++ b/components/firstui/fui-movable-view/mpjs.js
@@ -0,0 +1,76 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 4 0 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS || MP-WEIXIN || H5
+export default {
+ data() {
+ return {
+ startX: 0,
+ startY: 0,
+ lastLeft: 0,
+ lastTop: 0,
+ transform: ''
+ }
+ },
+ methods: {
+ touchstart(e) {
+ if (this.direction === 'none') return;
+ const touch = e.touches || e.changedTouches
+ if (this.direction === 'all') {
+ this.startX = touch[0].clientX
+ this.startY = touch[0].clientY
+ } else if (this.direction === 'vertical') {
+ this.startY = touch[0].clientY
+ } else {
+ this.startX = touch[0].clientX
+ }
+
+ },
+ getLeft(pageX) {
+ var left = pageX - this.startX + this.lastLeft;
+ left = left < -this.eLeft ? -this.eLeft : left;
+ left = left > this.maxWidth ? this.maxWidth : left;
+
+ return left
+ },
+ getTop(pageY, state) {
+ var top = pageY - this.startY + this.lastTop;
+ top = top < -this.eTop ? -this.eTop : top;
+ top = top > this.maxHeight ? this.maxHeight : top;
+
+ return top
+ },
+ touchmove(e) {
+ if (this.direction == 'none') return;
+ const touch = e.touches || e.changedTouches
+ let pageX = touch[0].clientX,
+ pageY = touch[0].clientY;
+
+ let left = 0,
+ top = 0;
+ if (this.direction === 'all') {
+ left = this.getLeft(pageX)
+ this.startX = pageX
+ top = this.getTop(pageY)
+ this.startY = pageY
+ } else if (this.direction === 'vertical') {
+ top = this.getTop(pageY)
+ this.startY = pageY
+ } else {
+ left = this.getLeft(pageX)
+ this.startX = pageX
+ }
+ this.lastLeft = left
+ this.lastTop = top
+ this.transform = `translate3d(${left}px,${top}px,0)`
+ this.change({
+ left,
+ top
+ })
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-nav-bar/fui-nav-bar.vue b/components/firstui/fui-nav-bar/fui-nav-bar.vue
new file mode 100644
index 0000000..fbbaf0d
--- /dev/null
+++ b/components/firstui/fui-nav-bar/fui-nav-bar.vue
@@ -0,0 +1,291 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-notice-bar/fui-notice-bar.vue b/components/firstui/fui-notice-bar/fui-notice-bar.vue
new file mode 100644
index 0000000..848e9be
--- /dev/null
+++ b/components/firstui/fui-notice-bar/fui-notice-bar.vue
@@ -0,0 +1,405 @@
+
+
+
+
+
+
+
+
+ {{content}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-overflow-hidden/fui-overflow-hidden.vue b/components/firstui/fui-overflow-hidden/fui-overflow-hidden.vue
new file mode 100644
index 0000000..002c632
--- /dev/null
+++ b/components/firstui/fui-overflow-hidden/fui-overflow-hidden.vue
@@ -0,0 +1,157 @@
+
+
+
+
+ {{text}}
+
+
+ {{text}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-pagination/fui-pagination.vue b/components/firstui/fui-pagination/fui-pagination.vue
new file mode 100644
index 0000000..816ff44
--- /dev/null
+++ b/components/firstui/fui-pagination/fui-pagination.vue
@@ -0,0 +1,416 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-panel/fui-panel.vue b/components/firstui/fui-panel/fui-panel.vue
new file mode 100644
index 0000000..ef5b113
--- /dev/null
+++ b/components/firstui/fui-panel/fui-panel.vue
@@ -0,0 +1,537 @@
+
+
+
+
+ {{panelData[head] || ''}}
+
+
+
+
+
+
+
+ {{item[title] || ''}}
+ {{item[desc] || ''}}
+
+ {{item[source] || ''}}
+ {{item[time] || ''}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-picker/fui-picker.vue b/components/firstui/fui-picker/fui-picker.vue
new file mode 100644
index 0000000..c62ec44
--- /dev/null
+++ b/components/firstui/fui-picker/fui-picker.vue
@@ -0,0 +1,1059 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item}}
+
+
+
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+
+
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+
+
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+
+
+
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/fui-poster-weex.vue b/components/firstui/fui-poster-weex/fui-poster-weex.vue
new file mode 100644
index 0000000..e02b976
--- /dev/null
+++ b/components/firstui/fui-poster-weex/fui-poster-weex.vue
@@ -0,0 +1,648 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/bridge/bridge-weex.js b/components/firstui/fui-poster-weex/gcanvas/bridge/bridge-weex.js
new file mode 100644
index 0000000..fbf773c
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/bridge/bridge-weex.js
@@ -0,0 +1,242 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8614 07 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+const isWeex = typeof WXEnvironment !== 'undefined';
+const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform);
+const isWeexAndroid = isWeex && !isWeexIOS;
+
+import GLmethod from '../context-webgl/GLmethod';
+
+const GCanvasModule =
+ (typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) :
+ (typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {};
+
+let isDebugging = false;
+
+let isComboDisabled = false;
+
+const logCommand = (function () {
+ const methodQuery = [];
+ Object.keys(GLmethod).forEach(key => {
+ methodQuery[GLmethod[key]] = key;
+ })
+ const queryMethod = (id) => {
+ return methodQuery[parseInt(id)] || 'NotFoundMethod';
+ }
+ const logCommand = (id, cmds) => {
+ const mId = cmds.split(',')[0];
+ const mName = queryMethod(mId);
+ console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`);
+ }
+ return logCommand;
+})();
+
+function joinArray(arr, sep) {
+ let res = '';
+ for (let i = 0; i < arr.length; i++) {
+ if (i !== 0) {
+ res += sep;
+ }
+ res += arr[i];
+ }
+ return res;
+}
+
+const commandsCache = {}
+
+const GBridge = {
+
+ callEnable: (ref, configArray) => {
+
+ commandsCache[ref] = [];
+
+ return GCanvasModule.enable({
+ componentId: ref,
+ config: configArray
+ });
+ },
+
+ callEnableDebug: () => {
+ isDebugging = true;
+ },
+
+ callEnableDisableCombo: () => {
+ isComboDisabled = true;
+ },
+
+ callSetContextType: function (componentId, context_type) {
+ GCanvasModule.setContextType(context_type, componentId);
+ },
+
+ callReset: function(id){
+ GCanvasModule.resetComponent && canvasModule.resetComponent(componentId);
+ },
+
+ render: isWeexIOS ? function (componentId) {
+ return GCanvasModule.extendCallNative({
+ contextId: componentId,
+ type: 0x60000001
+ });
+ } : function (componentId) {
+ return callGCanvasLinkNative(componentId, 0x60000001, 'render');
+ },
+
+ render2d: isWeexIOS ? function (componentId, commands, callback) {
+
+ if (isDebugging) {
+ console.log('>>> >>> render2d ===');
+ console.log('>>> commands: ' + commands);
+ }
+
+ GCanvasModule.render([commands, callback?true:false], componentId, callback);
+
+ } : function (componentId, commands,callback) {
+
+ if (isDebugging) {
+ console.log('>>> >>> render2d ===');
+ console.log('>>> commands: ' + commands);
+ }
+
+ callGCanvasLinkNative(componentId, 0x20000001, commands);
+ if(callback){
+ callback();
+ }
+ },
+
+ callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) {
+
+ throw 'should not be here anymore ' + cmdArgs;
+
+ } : function (componentId, cmdArgs) {
+
+ throw 'should not be here anymore ' + cmdArgs;
+
+ },
+
+
+ flushNative: isWeexIOS ? function (componentId) {
+
+ const cmdArgs = joinArray(commandsCache[componentId], ';');
+ commandsCache[componentId] = [];
+
+ if (isDebugging) {
+ console.log('>>> >>> flush native ===');
+ console.log('>>> commands: ' + cmdArgs);
+ }
+
+ const result = GCanvasModule.extendCallNative({
+ "contextId": componentId,
+ "type": 0x60000000,
+ "args": cmdArgs
+ });
+
+ const res = result && result.result;
+
+ if (isDebugging) {
+ console.log('>>> result: ' + res);
+ }
+
+ return res;
+
+ } : function (componentId) {
+
+ const cmdArgs = joinArray(commandsCache[componentId], ';');
+ commandsCache[componentId] = [];
+
+ if (isDebugging) {
+ console.log('>>> >>> flush native ===');
+ console.log('>>> commands: ' + cmdArgs);
+ }
+
+ const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs);
+
+ if (isDebugging) {
+ console.log('>>> result: ' + result);
+ }
+
+ return result;
+ },
+
+ callNative: function (componentId, cmdArgs, cache) {
+
+ if (isDebugging) {
+ logCommand(componentId, cmdArgs);
+ }
+
+ commandsCache[componentId].push(cmdArgs);
+
+ if (!cache || isComboDisabled) {
+ return GBridge.flushNative(componentId);
+ } else {
+ return undefined;
+ }
+ },
+
+ texImage2D(componentId, ...args) {
+ if (isWeexIOS) {
+ if (args.length === 6) {
+ const [target, level, internalformat, format, type, image] = args;
+ GBridge.callNative(
+ componentId,
+ GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src
+ )
+ } else if (args.length === 9) {
+ const [target, level, internalformat, width, height, border, format, type, image] = args;
+ GBridge.callNative(
+ componentId,
+ GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' +
+ + format + ',' + type + ',' + (image ? image.src : 0)
+ )
+ }
+ } else if (isWeexAndroid) {
+ if (args.length === 6) {
+ const [target, level, internalformat, format, type, image] = args;
+ GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src);
+ } else if (args.length === 9) {
+ const [target, level, internalformat, width, height, border, format, type, image] = args;
+ GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0));
+ }
+ }
+ },
+
+ texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) {
+ if (isWeexIOS) {
+ if (arguments.length === 8) {
+ GBridge.callNative(
+ componentId,
+ GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src
+ )
+ }
+ } else if (isWeexAndroid) {
+ GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src);
+ }
+ },
+
+ bindImageTexture(componentId, src, imageId) {
+ GCanvasModule.bindImageTexture([src, imageId], componentId);
+ },
+
+ perloadImage([url, id], callback) {
+ GCanvasModule.preLoadImage([url, id], function (image) {
+ image.url = url;
+ image.id = id;
+ callback(image);
+ });
+ },
+
+ measureText(text, fontStyle, componentId) {
+ return GCanvasModule.measureText([text, fontStyle], componentId);
+ },
+
+ getImageData (componentId, x, y, w, h, callback) {
+ GCanvasModule.getImageData([x, y,w,h],componentId,callback);
+ },
+
+ putImageData (componentId, data, x, y, w, h, callback) {
+ GCanvasModule.putImageData([x, y,w,h,data],componentId,callback);
+ },
+
+ toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){
+ GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback);
+ }
+}
+
+export default GBridge;
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleLinearGradient.js b/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleLinearGradient.js
new file mode 100644
index 0000000..c0a3078
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleLinearGradient.js
@@ -0,0 +1,19 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 40725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class FillStyleLinearGradient {
+
+ constructor(x0, y0, x1, y1) {
+ this._start_pos = { _x: x0, _y: y0 };
+ this._end_pos = { _x: x1, _y: y1 };
+ this._stop_count = 0;
+ this._stops = [0, 0, 0, 0, 0];
+ }
+
+ addColorStop = function (pos, color) {
+ if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
+ this._stops[this._stop_count] = { _pos: pos, _color: color };
+ this._stop_count++;
+ }
+ }
+}
+
+export default FillStyleLinearGradient;
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStylePattern.js b/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStylePattern.js
new file mode 100644
index 0000000..e4b042e
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStylePattern.js
@@ -0,0 +1,9 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61 4 0 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class FillStylePattern {
+ constructor(img, pattern) {
+ this._style = pattern;
+ this._img = img;
+ }
+}
+
+export default FillStylePattern;
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleRadialGradient.js b/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleRadialGradient.js
new file mode 100644
index 0000000..7e9c980
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleRadialGradient.js
@@ -0,0 +1,18 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 4072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class FillStyleRadialGradient {
+ constructor(x0, y0, r0, x1, y1, r1) {
+ this._start_pos = { _x: x0, _y: y0, _r: r0 };
+ this._end_pos = { _x: x1, _y: y1, _r: r1 };
+ this._stop_count = 0;
+ this._stops = [0, 0, 0, 0, 0];
+ }
+
+ addColorStop(pos, color) {
+ if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
+ this._stops[this._stop_count] = { _pos: pos, _color: color };
+ this._stop_count++;
+ }
+ }
+}
+
+export default FillStyleRadialGradient;
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-2d/RenderingContext.js b/components/firstui/fui-poster-weex/gcanvas/context-2d/RenderingContext.js
new file mode 100644
index 0000000..02fd83a
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-2d/RenderingContext.js
@@ -0,0 +1,667 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 14 07 25 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import FillStylePattern from './FillStylePattern';
+import FillStyleLinearGradient from './FillStyleLinearGradient';
+import FillStyleRadialGradient from './FillStyleRadialGradient';
+import GImage from '../env/image.js';
+import {
+ ArrayBufferToBase64,
+ Base64ToUint8ClampedArray
+} from '../env/tool.js';
+
+export default class CanvasRenderingContext2D {
+
+ _drawCommands = '';
+
+ _globalAlpha = 1.0;
+
+ _fillStyle = 'rgb(0,0,0)';
+ _strokeStyle = 'rgb(0,0,0)';
+
+ _lineWidth = 1;
+ _lineCap = 'butt';
+ _lineJoin = 'miter';
+
+ _miterLimit = 10;
+
+ _globalCompositeOperation = 'source-over';
+
+ _textAlign = 'start';
+ _textBaseline = 'alphabetic';
+
+ _font = '10px sans-serif';
+
+ _savedGlobalAlpha = [];
+
+ timer = null;
+ componentId = null;
+
+ _notCommitDrawImageCache = [];
+ _needRedrawImageCache = [];
+ _redrawCommands = '';
+ _autoSaveContext = true;
+ // _imageMap = new GHashMap();
+ // _textureMap = new GHashMap();
+
+ constructor() {
+ this.className = 'CanvasRenderingContext2D';
+ //this.save()
+ }
+
+ setFillStyle(value) {
+ this.fillStyle = value;
+ }
+
+ set fillStyle(value) {
+ this._fillStyle = value;
+
+ if (typeof(value) == 'string') {
+ this._drawCommands = this._drawCommands.concat("F" + value + ";");
+ } else if (value instanceof FillStylePattern) {
+ const image = value._img;
+ if (!image.complete) {
+ image.onload = () => {
+ var index = this._needRedrawImageCache.indexOf(image);
+ if (index > -1) {
+ this._needRedrawImageCache.splice(index, 1);
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._redrawflush(true);
+ }
+ }
+ this._notCommitDrawImageCache.push(image);
+ } else {
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ }
+
+ //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
+ } else if (value instanceof FillStyleLinearGradient) {
+ var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
+ value._stop_count;
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ } else if (value instanceof FillStyleRadialGradient) {
+ var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
+ .toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," +
+ value._stop_count;
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ }
+ }
+
+ get fillStyle() {
+ return this._fillStyle;
+ }
+
+ get globalAlpha() {
+ return this._globalAlpha;
+ }
+
+ setGlobalAlpha(value) {
+ this.globalAlpha = value;
+ }
+
+ set globalAlpha(value) {
+ this._globalAlpha = value;
+ this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";");
+ }
+
+
+ get strokeStyle() {
+ return this._strokeStyle;
+ }
+
+ setStrokeStyle(value) {
+ this.strokeStyle = value;
+ }
+
+ set strokeStyle(value) {
+
+ this._strokeStyle = value;
+
+ if (typeof(value) == 'string') {
+ this._drawCommands = this._drawCommands.concat("S" + value + ";");
+ } else if (value instanceof FillStylePattern) {
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
+ } else if (value instanceof FillStyleLinearGradient) {
+ var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
+ value._stop_count;
+
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ } else if (value instanceof FillStyleRadialGradient) {
+ var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
+ .toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," +
+ value._stop_count;
+
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ }
+ }
+
+ get lineWidth() {
+ return this._lineWidth;
+ }
+
+ setLineWidth(value) {
+ this.lineWidth = value;
+ }
+
+ set lineWidth(value) {
+ this._lineWidth = value;
+ this._drawCommands = this._drawCommands.concat("W" + value + ";");
+ }
+
+ get lineCap() {
+ return this._lineCap;
+ }
+
+ setLineCap(value) {
+ this.lineCap = value;
+ }
+
+ set lineCap(value) {
+ this._lineCap = value;
+ this._drawCommands = this._drawCommands.concat("C" + value + ";");
+ }
+
+ get lineJoin() {
+ return this._lineJoin;
+ }
+
+ setLineJoin(value) {
+ this.lineJoin = value
+ }
+
+ set lineJoin(value) {
+ this._lineJoin = value;
+ this._drawCommands = this._drawCommands.concat("J" + value + ";");
+ }
+
+ get miterLimit() {
+ return this._miterLimit;
+ }
+
+ setMiterLimit(value) {
+ this.miterLimit = value
+ }
+
+ set miterLimit(value) {
+ this._miterLimit = value;
+ this._drawCommands = this._drawCommands.concat("M" + value + ";");
+ }
+
+ get globalCompositeOperation() {
+ return this._globalCompositeOperation;
+ }
+
+ set globalCompositeOperation(value) {
+
+ this._globalCompositeOperation = value;
+ let mode = 0;
+ switch (value) {
+ case "source-over":
+ mode = 0;
+ break;
+ case "source-atop":
+ mode = 5;
+ break;
+ case "source-in":
+ mode = 0;
+ break;
+ case "source-out":
+ mode = 2;
+ break;
+ case "destination-over":
+ mode = 4;
+ break;
+ case "destination-atop":
+ mode = 4;
+ break;
+ case "destination-in":
+ mode = 4;
+ break;
+ case "destination-out":
+ mode = 3;
+ break;
+ case "lighter":
+ mode = 1;
+ break;
+ case "copy":
+ mode = 2;
+ break;
+ case "xor":
+ mode = 6;
+ break;
+ default:
+ mode = 0;
+ }
+
+ this._drawCommands = this._drawCommands.concat("B" + mode + ";");
+ }
+
+ get textAlign() {
+ return this._textAlign;
+ }
+
+ setTextAlign(value) {
+ this.textAlign = value
+ }
+
+ set textAlign(value) {
+
+ this._textAlign = value;
+ let Align = 0;
+ switch (value) {
+ case "start":
+ Align = 0;
+ break;
+ case "end":
+ Align = 1;
+ break;
+ case "left":
+ Align = 2;
+ break;
+ case "center":
+ Align = 3;
+ break;
+ case "right":
+ Align = 4;
+ break;
+ default:
+ Align = 0;
+ }
+
+ this._drawCommands = this._drawCommands.concat("A" + Align + ";");
+ }
+
+ get textBaseline() {
+ return this._textBaseline;
+ }
+
+ setTextBaseline(value) {
+ this.textBaseline = value
+ }
+
+ set textBaseline(value) {
+ this._textBaseline = value;
+ let baseline = 0;
+ switch (value) {
+ case "alphabetic":
+ baseline = 0;
+ break;
+ case "middle":
+ baseline = 1;
+ break;
+ case "top":
+ baseline = 2;
+ break;
+ case "hanging":
+ baseline = 3;
+ break;
+ case "bottom":
+ baseline = 4;
+ break;
+ case "ideographic":
+ baseline = 5;
+ break;
+ default:
+ baseline = 0;
+ break;
+ }
+
+ this._drawCommands = this._drawCommands.concat("E" + baseline + ";");
+ }
+
+ get font() {
+ return this._font;
+ }
+
+ setFontSize(size) {
+ var str = this._font;
+ var strs = str.trim().split(/\s+/);
+ for (var i = 0; i < strs.length; i++) {
+ var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold",
+ "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900",
+ "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
+ "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
+ ];
+
+ if (-1 == values.indexOf(strs[i].trim())) {
+ if (typeof size === 'string') {
+ strs[i] = size;
+ } else if (typeof size === 'number') {
+ strs[i] = String(size) + 'px';
+ }
+ break;
+ }
+ }
+ this.font = strs.join(" ");
+ }
+
+ set font(value) {
+ this._font = value;
+ this._drawCommands = this._drawCommands.concat("j" + value + ";");
+ }
+
+ setTransform(a, b, c, d, tx, ty) {
+ this._drawCommands = this._drawCommands.concat("t" +
+ (a === 1 ? "1" : a.toFixed(2)) + "," +
+ (b === 0 ? "0" : b.toFixed(2)) + "," +
+ (c === 0 ? "0" : c.toFixed(2)) + "," +
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
+ }
+
+ transform(a, b, c, d, tx, ty) {
+ this._drawCommands = this._drawCommands.concat("f" +
+ (a === 1 ? "1" : a.toFixed(2)) + "," +
+ (b === 0 ? "0" : b.toFixed(2)) + "," +
+ (c === 0 ? "0" : c.toFixed(2)) + "," +
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";");
+ }
+
+ resetTransform() {
+ this._drawCommands = this._drawCommands.concat("m;");
+ }
+
+ scale(a, d) {
+ this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," +
+ d.toFixed(2) + ";");
+ }
+
+ rotate(angle) {
+ this._drawCommands = this._drawCommands
+ .concat("r" + angle.toFixed(6) + ";");
+ }
+
+ translate(tx, ty) {
+ this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
+ }
+
+ save() {
+ this._savedGlobalAlpha.push(this._globalAlpha);
+ this._drawCommands = this._drawCommands.concat("v;");
+ }
+
+ restore() {
+ this._drawCommands = this._drawCommands.concat("e;");
+ this._globalAlpha = this._savedGlobalAlpha.pop();
+ }
+
+ createPattern(img, pattern) {
+ if (typeof img === 'string') {
+ var imgObj = new GImage();
+ imgObj.src = img;
+ img = imgObj;
+ }
+ return new FillStylePattern(img, pattern);
+ }
+
+ createLinearGradient(x0, y0, x1, y1) {
+ return new FillStyleLinearGradient(x0, y0, x1, y1);
+ }
+
+ createRadialGradient = function(x0, y0, r0, x1, y1, r1) {
+ return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1);
+ };
+
+ createCircularGradient = function(x0, y0, r0) {
+ return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0);
+ };
+
+ strokeRect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";");
+ }
+
+
+ clearRect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w +
+ "," + h + ";");
+ }
+
+ clip() {
+ this._drawCommands = this._drawCommands.concat("p;");
+ }
+
+ resetClip() {
+ this._drawCommands = this._drawCommands.concat("q;");
+ }
+
+ closePath() {
+ this._drawCommands = this._drawCommands.concat("o;");
+ }
+
+ moveTo(x, y) {
+ this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";");
+ }
+
+ lineTo(x, y) {
+ this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";");
+ }
+
+ quadraticCurveTo = function(cpx, cpy, x, y) {
+ this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";");
+ }
+
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) {
+ this._drawCommands = this._drawCommands.concat(
+ "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," +
+ x.toFixed(2) + "," + y.toFixed(2) + ";");
+ }
+
+ arcTo(x1, y1, x2, y2, radius) {
+ this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";");
+ }
+
+ beginPath() {
+ this._drawCommands = this._drawCommands.concat("b;");
+ }
+
+
+ fillRect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w +
+ "," + h + ";");
+ }
+
+ rect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";");
+ }
+
+ fill() {
+ this._drawCommands = this._drawCommands.concat("L;");
+ }
+
+ stroke(path) {
+ this._drawCommands = this._drawCommands.concat("x;");
+ }
+
+ arc(x, y, radius, startAngle, endAngle, anticlockwise) {
+
+ let ianticlockwise = 0;
+ if (anticlockwise) {
+ ianticlockwise = 1;
+ }
+
+ this._drawCommands = this._drawCommands.concat(
+ "y" + x.toFixed(2) + "," + y.toFixed(2) + "," +
+ radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise +
+ ";"
+ );
+ }
+
+ fillText(text, x, y) {
+ let tmptext = text.replace(/!/g, "!!");
+ tmptext = tmptext.replace(/,/g, "!,");
+ tmptext = tmptext.replace(/;/g, "!;");
+ this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;");
+ }
+
+ strokeText = function(text, x, y) {
+ let tmptext = text.replace(/!/g, "!!");
+ tmptext = tmptext.replace(/,/g, "!,");
+ tmptext = tmptext.replace(/;/g, "!;");
+ this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;");
+ }
+
+ measureText(text) {
+ return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId);
+ }
+
+ isPointInPath = function(x, y) {
+ throw new Error('GCanvas not supported yet');
+ }
+
+ drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
+ if (typeof image === 'string') {
+ var imgObj = new GImage();
+ imgObj.src = image;
+ image = imgObj;
+ }
+ if (image instanceof GImage) {
+ if (!image.complete) {
+ imgObj.onload = () => {
+ var index = this._needRedrawImageCache.indexOf(image);
+ if (index > -1) {
+ this._needRedrawImageCache.splice(index, 1);
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._redrawflush(true);
+ }
+ }
+ this._notCommitDrawImageCache.push(image);
+ } else {
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ }
+ var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh];
+ var args = [];
+ for (var arg in srcArgs) {
+ if (typeof(srcArgs[arg]) != 'undefined') {
+ args.push(srcArgs[arg]);
+ }
+ }
+ this.__drawImage.apply(this, args);
+ //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh);
+ }
+ }
+
+ __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
+ const numArgs = arguments.length;
+
+ function drawImageCommands() {
+
+ if (numArgs === 3) {
+ const x = parseFloat(sx) || 0.0;
+ const y = parseFloat(sy) || 0.0;
+
+ return ("d" + image._id + ",0,0," +
+ image.width + "," + image.height + "," +
+ x + "," + y + "," + image.width + "," + image.height + ";");
+ } else if (numArgs === 5) {
+ const x = parseFloat(sx) || 0.0;
+ const y = parseFloat(sy) || 0.0;
+ const width = parseInt(sw) || image.width;
+ const height = parseInt(sh) || image.height;
+
+ return ("d" + image._id + ",0,0," +
+ image.width + "," + image.height + "," +
+ x + "," + y + "," + width + "," + height + ";");
+ } else if (numArgs === 9) {
+ sx = parseFloat(sx) || 0.0;
+ sy = parseFloat(sy) || 0.0;
+ sw = parseInt(sw) || image.width;
+ sh = parseInt(sh) || image.height;
+ dx = parseFloat(dx) || 0.0;
+ dy = parseFloat(dy) || 0.0;
+ dw = parseInt(dw) || image.width;
+ dh = parseInt(dh) || image.height;
+
+ return ("d" + image._id + "," +
+ sx + "," + sy + "," + sw + "," + sh + "," +
+ dx + "," + dy + "," + dw + "," + dh + ";");
+ }
+ }
+ this._drawCommands += drawImageCommands();
+ }
+
+ _flush(reserve, callback) {
+ const commands = this._drawCommands;
+ this._drawCommands = '';
+ CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
+ this._needRender = false;
+ }
+
+ _redrawflush(reserve, callback) {
+ const commands = this._redrawCommands;
+ CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
+ if (this._needRedrawImageCache.length == 0) {
+ this._redrawCommands = '';
+ }
+ }
+
+ draw(reserve, callback) {
+ if (!reserve) {
+ this._globalAlpha = this._savedGlobalAlpha.pop();
+ this._savedGlobalAlpha.push(this._globalAlpha);
+ this._redrawCommands = this._drawCommands;
+ this._needRedrawImageCache = this._notCommitDrawImageCache;
+ if (this._autoSaveContext) {
+ this._drawCommands = ("v;" + this._drawCommands);
+ this._autoSaveContext = false;
+ } else {
+ this._drawCommands = ("e;X;v;" + this._drawCommands);
+ }
+ } else {
+ this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache);
+ this._redrawCommands += this._drawCommands;
+ if (this._autoSaveContext) {
+ this._drawCommands = ("v;" + this._drawCommands);
+ this._autoSaveContext = false;
+ }
+ }
+ this._notCommitDrawImageCache = [];
+ if (this._flush) {
+ this._flush(reserve, callback);
+ }
+ }
+
+ getImageData(x, y, w, h, callback) {
+ CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) {
+ res.data = Base64ToUint8ClampedArray(res.data);
+ if (typeof(callback) == 'function') {
+ callback(res);
+ }
+ });
+ }
+
+ putImageData(data, x, y, w, h, callback) {
+ if (data instanceof Uint8ClampedArray) {
+ data = ArrayBufferToBase64(data);
+ CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) {
+ if (typeof(callback) == 'function') {
+ callback(res);
+ }
+ });
+ }
+ }
+
+ toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) {
+ CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight,
+ fileType, quality,
+ function(res) {
+ if (typeof(callback) == 'function') {
+ callback(res);
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/ActiveInfo.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/ActiveInfo.js
new file mode 100644
index 0000000..6ce9dbe
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/ActiveInfo.js
@@ -0,0 +1,12 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 6 1 4 072 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default class WebGLActiveInfo {
+ className = 'WebGLActiveInfo';
+
+ constructor({
+ type, name, size
+ }) {
+ this.type = type;
+ this.name = name;
+ this.size = size;
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/Buffer.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Buffer.js
new file mode 100644
index 0000000..735caa5
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Buffer.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 614072 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLBuffer';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLBuffer {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/Framebuffer.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Framebuffer.js
new file mode 100644
index 0000000..8dfd01e
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Framebuffer.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1861 407 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLFrameBuffer';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLFramebuffer {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLenum.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLenum.js
new file mode 100644
index 0000000..97a658b
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLenum.js
@@ -0,0 +1,299 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61407 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default {
+ "DEPTH_BUFFER_BIT": 256,
+ "STENCIL_BUFFER_BIT": 1024,
+ "COLOR_BUFFER_BIT": 16384,
+ "POINTS": 0,
+ "LINES": 1,
+ "LINE_LOOP": 2,
+ "LINE_STRIP": 3,
+ "TRIANGLES": 4,
+ "TRIANGLE_STRIP": 5,
+ "TRIANGLE_FAN": 6,
+ "ZERO": 0,
+ "ONE": 1,
+ "SRC_COLOR": 768,
+ "ONE_MINUS_SRC_COLOR": 769,
+ "SRC_ALPHA": 770,
+ "ONE_MINUS_SRC_ALPHA": 771,
+ "DST_ALPHA": 772,
+ "ONE_MINUS_DST_ALPHA": 773,
+ "DST_COLOR": 774,
+ "ONE_MINUS_DST_COLOR": 775,
+ "SRC_ALPHA_SATURATE": 776,
+ "FUNC_ADD": 32774,
+ "BLEND_EQUATION": 32777,
+ "BLEND_EQUATION_RGB": 32777,
+ "BLEND_EQUATION_ALPHA": 34877,
+ "FUNC_SUBTRACT": 32778,
+ "FUNC_REVERSE_SUBTRACT": 32779,
+ "BLEND_DST_RGB": 32968,
+ "BLEND_SRC_RGB": 32969,
+ "BLEND_DST_ALPHA": 32970,
+ "BLEND_SRC_ALPHA": 32971,
+ "CONSTANT_COLOR": 32769,
+ "ONE_MINUS_CONSTANT_COLOR": 32770,
+ "CONSTANT_ALPHA": 32771,
+ "ONE_MINUS_CONSTANT_ALPHA": 32772,
+ "BLEND_COLOR": 32773,
+ "ARRAY_BUFFER": 34962,
+ "ELEMENT_ARRAY_BUFFER": 34963,
+ "ARRAY_BUFFER_BINDING": 34964,
+ "ELEMENT_ARRAY_BUFFER_BINDING": 34965,
+ "STREAM_DRAW": 35040,
+ "STATIC_DRAW": 35044,
+ "DYNAMIC_DRAW": 35048,
+ "BUFFER_SIZE": 34660,
+ "BUFFER_USAGE": 34661,
+ "CURRENT_VERTEX_ATTRIB": 34342,
+ "FRONT": 1028,
+ "BACK": 1029,
+ "FRONT_AND_BACK": 1032,
+ "TEXTURE_2D": 3553,
+ "CULL_FACE": 2884,
+ "BLEND": 3042,
+ "DITHER": 3024,
+ "STENCIL_TEST": 2960,
+ "DEPTH_TEST": 2929,
+ "SCISSOR_TEST": 3089,
+ "POLYGON_OFFSET_FILL": 32823,
+ "SAMPLE_ALPHA_TO_COVERAGE": 32926,
+ "SAMPLE_COVERAGE": 32928,
+ "NO_ERROR": 0,
+ "INVALID_ENUM": 1280,
+ "INVALID_VALUE": 1281,
+ "INVALID_OPERATION": 1282,
+ "OUT_OF_MEMORY": 1285,
+ "CW": 2304,
+ "CCW": 2305,
+ "LINE_WIDTH": 2849,
+ "ALIASED_POINT_SIZE_RANGE": 33901,
+ "ALIASED_LINE_WIDTH_RANGE": 33902,
+ "CULL_FACE_MODE": 2885,
+ "FRONT_FACE": 2886,
+ "DEPTH_RANGE": 2928,
+ "DEPTH_WRITEMASK": 2930,
+ "DEPTH_CLEAR_VALUE": 2931,
+ "DEPTH_FUNC": 2932,
+ "STENCIL_CLEAR_VALUE": 2961,
+ "STENCIL_FUNC": 2962,
+ "STENCIL_FAIL": 2964,
+ "STENCIL_PASS_DEPTH_FAIL": 2965,
+ "STENCIL_PASS_DEPTH_PASS": 2966,
+ "STENCIL_REF": 2967,
+ "STENCIL_VALUE_MASK": 2963,
+ "STENCIL_WRITEMASK": 2968,
+ "STENCIL_BACK_FUNC": 34816,
+ "STENCIL_BACK_FAIL": 34817,
+ "STENCIL_BACK_PASS_DEPTH_FAIL": 34818,
+ "STENCIL_BACK_PASS_DEPTH_PASS": 34819,
+ "STENCIL_BACK_REF": 36003,
+ "STENCIL_BACK_VALUE_MASK": 36004,
+ "STENCIL_BACK_WRITEMASK": 36005,
+ "VIEWPORT": 2978,
+ "SCISSOR_BOX": 3088,
+ "COLOR_CLEAR_VALUE": 3106,
+ "COLOR_WRITEMASK": 3107,
+ "UNPACK_ALIGNMENT": 3317,
+ "PACK_ALIGNMENT": 3333,
+ "MAX_TEXTURE_SIZE": 3379,
+ "MAX_VIEWPORT_DIMS": 3386,
+ "SUBPIXEL_BITS": 3408,
+ "RED_BITS": 3410,
+ "GREEN_BITS": 3411,
+ "BLUE_BITS": 3412,
+ "ALPHA_BITS": 3413,
+ "DEPTH_BITS": 3414,
+ "STENCIL_BITS": 3415,
+ "POLYGON_OFFSET_UNITS": 10752,
+ "POLYGON_OFFSET_FACTOR": 32824,
+ "TEXTURE_BINDING_2D": 32873,
+ "SAMPLE_BUFFERS": 32936,
+ "SAMPLES": 32937,
+ "SAMPLE_COVERAGE_VALUE": 32938,
+ "SAMPLE_COVERAGE_INVERT": 32939,
+ "COMPRESSED_TEXTURE_FORMATS": 34467,
+ "DONT_CARE": 4352,
+ "FASTEST": 4353,
+ "NICEST": 4354,
+ "GENERATE_MIPMAP_HINT": 33170,
+ "BYTE": 5120,
+ "UNSIGNED_BYTE": 5121,
+ "SHORT": 5122,
+ "UNSIGNED_SHORT": 5123,
+ "INT": 5124,
+ "UNSIGNED_INT": 5125,
+ "FLOAT": 5126,
+ "DEPTH_COMPONENT": 6402,
+ "ALPHA": 6406,
+ "RGB": 6407,
+ "RGBA": 6408,
+ "LUMINANCE": 6409,
+ "LUMINANCE_ALPHA": 6410,
+ "UNSIGNED_SHORT_4_4_4_4": 32819,
+ "UNSIGNED_SHORT_5_5_5_1": 32820,
+ "UNSIGNED_SHORT_5_6_5": 33635,
+ "FRAGMENT_SHADER": 35632,
+ "VERTEX_SHADER": 35633,
+ "MAX_VERTEX_ATTRIBS": 34921,
+ "MAX_VERTEX_UNIFORM_VECTORS": 36347,
+ "MAX_VARYING_VECTORS": 36348,
+ "MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661,
+ "MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660,
+ "MAX_TEXTURE_IMAGE_UNITS": 34930,
+ "MAX_FRAGMENT_UNIFORM_VECTORS": 36349,
+ "SHADER_TYPE": 35663,
+ "DELETE_STATUS": 35712,
+ "LINK_STATUS": 35714,
+ "VALIDATE_STATUS": 35715,
+ "ATTACHED_SHADERS": 35717,
+ "ACTIVE_UNIFORMS": 35718,
+ "ACTIVE_ATTRIBUTES": 35721,
+ "SHADING_LANGUAGE_VERSION": 35724,
+ "CURRENT_PROGRAM": 35725,
+ "NEVER": 512,
+ "LESS": 513,
+ "EQUAL": 514,
+ "LEQUAL": 515,
+ "GREATER": 516,
+ "NOTEQUAL": 517,
+ "GEQUAL": 518,
+ "ALWAYS": 519,
+ "KEEP": 7680,
+ "REPLACE": 7681,
+ "INCR": 7682,
+ "DECR": 7683,
+ "INVERT": 5386,
+ "INCR_WRAP": 34055,
+ "DECR_WRAP": 34056,
+ "VENDOR": 7936,
+ "RENDERER": 7937,
+ "VERSION": 7938,
+ "NEAREST": 9728,
+ "LINEAR": 9729,
+ "NEAREST_MIPMAP_NEAREST": 9984,
+ "LINEAR_MIPMAP_NEAREST": 9985,
+ "NEAREST_MIPMAP_LINEAR": 9986,
+ "LINEAR_MIPMAP_LINEAR": 9987,
+ "TEXTURE_MAG_FILTER": 10240,
+ "TEXTURE_MIN_FILTER": 10241,
+ "TEXTURE_WRAP_S": 10242,
+ "TEXTURE_WRAP_T": 10243,
+ "TEXTURE": 5890,
+ "TEXTURE_CUBE_MAP": 34067,
+ "TEXTURE_BINDING_CUBE_MAP": 34068,
+ "TEXTURE_CUBE_MAP_POSITIVE_X": 34069,
+ "TEXTURE_CUBE_MAP_NEGATIVE_X": 34070,
+ "TEXTURE_CUBE_MAP_POSITIVE_Y": 34071,
+ "TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072,
+ "TEXTURE_CUBE_MAP_POSITIVE_Z": 34073,
+ "TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074,
+ "MAX_CUBE_MAP_TEXTURE_SIZE": 34076,
+ "TEXTURE0": 33984,
+ "TEXTURE1": 33985,
+ "TEXTURE2": 33986,
+ "TEXTURE3": 33987,
+ "TEXTURE4": 33988,
+ "TEXTURE5": 33989,
+ "TEXTURE6": 33990,
+ "TEXTURE7": 33991,
+ "TEXTURE8": 33992,
+ "TEXTURE9": 33993,
+ "TEXTURE10": 33994,
+ "TEXTURE11": 33995,
+ "TEXTURE12": 33996,
+ "TEXTURE13": 33997,
+ "TEXTURE14": 33998,
+ "TEXTURE15": 33999,
+ "TEXTURE16": 34000,
+ "TEXTURE17": 34001,
+ "TEXTURE18": 34002,
+ "TEXTURE19": 34003,
+ "TEXTURE20": 34004,
+ "TEXTURE21": 34005,
+ "TEXTURE22": 34006,
+ "TEXTURE23": 34007,
+ "TEXTURE24": 34008,
+ "TEXTURE25": 34009,
+ "TEXTURE26": 34010,
+ "TEXTURE27": 34011,
+ "TEXTURE28": 34012,
+ "TEXTURE29": 34013,
+ "TEXTURE30": 34014,
+ "TEXTURE31": 34015,
+ "ACTIVE_TEXTURE": 34016,
+ "REPEAT": 10497,
+ "CLAMP_TO_EDGE": 33071,
+ "MIRRORED_REPEAT": 33648,
+ "FLOAT_VEC2": 35664,
+ "FLOAT_VEC3": 35665,
+ "FLOAT_VEC4": 35666,
+ "INT_VEC2": 35667,
+ "INT_VEC3": 35668,
+ "INT_VEC4": 35669,
+ "BOOL": 35670,
+ "BOOL_VEC2": 35671,
+ "BOOL_VEC3": 35672,
+ "BOOL_VEC4": 35673,
+ "FLOAT_MAT2": 35674,
+ "FLOAT_MAT3": 35675,
+ "FLOAT_MAT4": 35676,
+ "SAMPLER_2D": 35678,
+ "SAMPLER_CUBE": 35680,
+ "VERTEX_ATTRIB_ARRAY_ENABLED": 34338,
+ "VERTEX_ATTRIB_ARRAY_SIZE": 34339,
+ "VERTEX_ATTRIB_ARRAY_STRIDE": 34340,
+ "VERTEX_ATTRIB_ARRAY_TYPE": 34341,
+ "VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922,
+ "VERTEX_ATTRIB_ARRAY_POINTER": 34373,
+ "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975,
+ "IMPLEMENTATION_COLOR_READ_TYPE": 35738,
+ "IMPLEMENTATION_COLOR_READ_FORMAT": 35739,
+ "COMPILE_STATUS": 35713,
+ "LOW_FLOAT": 36336,
+ "MEDIUM_FLOAT": 36337,
+ "HIGH_FLOAT": 36338,
+ "LOW_INT": 36339,
+ "MEDIUM_INT": 36340,
+ "HIGH_INT": 36341,
+ "FRAMEBUFFER": 36160,
+ "RENDERBUFFER": 36161,
+ "RGBA4": 32854,
+ "RGB5_A1": 32855,
+ "RGB565": 36194,
+ "DEPTH_COMPONENT16": 33189,
+ "STENCIL_INDEX8": 36168,
+ "DEPTH_STENCIL": 34041,
+ "RENDERBUFFER_WIDTH": 36162,
+ "RENDERBUFFER_HEIGHT": 36163,
+ "RENDERBUFFER_INTERNAL_FORMAT": 36164,
+ "RENDERBUFFER_RED_SIZE": 36176,
+ "RENDERBUFFER_GREEN_SIZE": 36177,
+ "RENDERBUFFER_BLUE_SIZE": 36178,
+ "RENDERBUFFER_ALPHA_SIZE": 36179,
+ "RENDERBUFFER_DEPTH_SIZE": 36180,
+ "RENDERBUFFER_STENCIL_SIZE": 36181,
+ "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048,
+ "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049,
+ "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050,
+ "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051,
+ "COLOR_ATTACHMENT0": 36064,
+ "DEPTH_ATTACHMENT": 36096,
+ "STENCIL_ATTACHMENT": 36128,
+ "DEPTH_STENCIL_ATTACHMENT": 33306,
+ "NONE": 0,
+ "FRAMEBUFFER_COMPLETE": 36053,
+ "FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054,
+ "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055,
+ "FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057,
+ "FRAMEBUFFER_UNSUPPORTED": 36061,
+ "FRAMEBUFFER_BINDING": 36006,
+ "RENDERBUFFER_BINDING": 36007,
+ "MAX_RENDERBUFFER_SIZE": 34024,
+ "INVALID_FRAMEBUFFER_OPERATION": 1286,
+ "UNPACK_FLIP_Y_WEBGL": 37440,
+ "UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441,
+ "CONTEXT_LOST_WEBGL": 37442,
+ "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443,
+ "BROWSER_DEFAULT_WEBGL": 37444
+};
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLmethod.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLmethod.js
new file mode 100644
index 0000000..0e8d462
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLmethod.js
@@ -0,0 +1,143 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 4072549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+let i = 1;
+
+const GLmethod = {};
+
+GLmethod.activeTexture = i++; //1
+GLmethod.attachShader = i++;
+GLmethod.bindAttribLocation = i++;
+GLmethod.bindBuffer = i++;
+GLmethod.bindFramebuffer = i++;
+GLmethod.bindRenderbuffer = i++;
+GLmethod.bindTexture = i++;
+GLmethod.blendColor = i++;
+GLmethod.blendEquation = i++;
+GLmethod.blendEquationSeparate = i++; //10
+GLmethod.blendFunc = i++;
+GLmethod.blendFuncSeparate = i++;
+GLmethod.bufferData = i++;
+GLmethod.bufferSubData = i++;
+GLmethod.checkFramebufferStatus = i++;
+GLmethod.clear = i++;
+GLmethod.clearColor = i++;
+GLmethod.clearDepth = i++;
+GLmethod.clearStencil = i++;
+GLmethod.colorMask = i++; //20
+GLmethod.compileShader = i++;
+GLmethod.compressedTexImage2D = i++;
+GLmethod.compressedTexSubImage2D = i++;
+GLmethod.copyTexImage2D = i++;
+GLmethod.copyTexSubImage2D = i++;
+GLmethod.createBuffer = i++;
+GLmethod.createFramebuffer = i++;
+GLmethod.createProgram = i++;
+GLmethod.createRenderbuffer = i++;
+GLmethod.createShader = i++; //30
+GLmethod.createTexture = i++;
+GLmethod.cullFace = i++;
+GLmethod.deleteBuffer = i++;
+GLmethod.deleteFramebuffer = i++;
+GLmethod.deleteProgram = i++;
+GLmethod.deleteRenderbuffer = i++;
+GLmethod.deleteShader = i++;
+GLmethod.deleteTexture = i++;
+GLmethod.depthFunc = i++;
+GLmethod.depthMask = i++; //40
+GLmethod.depthRange = i++;
+GLmethod.detachShader = i++;
+GLmethod.disable = i++;
+GLmethod.disableVertexAttribArray = i++;
+GLmethod.drawArrays = i++;
+GLmethod.drawArraysInstancedANGLE = i++;
+GLmethod.drawElements = i++;
+GLmethod.drawElementsInstancedANGLE = i++;
+GLmethod.enable = i++;
+GLmethod.enableVertexAttribArray = i++; //50
+GLmethod.flush = i++;
+GLmethod.framebufferRenderbuffer = i++;
+GLmethod.framebufferTexture2D = i++;
+GLmethod.frontFace = i++;
+GLmethod.generateMipmap = i++;
+GLmethod.getActiveAttrib = i++;
+GLmethod.getActiveUniform = i++;
+GLmethod.getAttachedShaders = i++;
+GLmethod.getAttribLocation = i++;
+GLmethod.getBufferParameter = i++; //60
+GLmethod.getContextAttributes = i++;
+GLmethod.getError = i++;
+GLmethod.getExtension = i++;
+GLmethod.getFramebufferAttachmentParameter = i++;
+GLmethod.getParameter = i++;
+GLmethod.getProgramInfoLog = i++;
+GLmethod.getProgramParameter = i++;
+GLmethod.getRenderbufferParameter = i++;
+GLmethod.getShaderInfoLog = i++;
+GLmethod.getShaderParameter = i++; //70
+GLmethod.getShaderPrecisionFormat = i++;
+GLmethod.getShaderSource = i++;
+GLmethod.getSupportedExtensions = i++;
+GLmethod.getTexParameter = i++;
+GLmethod.getUniform = i++;
+GLmethod.getUniformLocation = i++;
+GLmethod.getVertexAttrib = i++;
+GLmethod.getVertexAttribOffset = i++;
+GLmethod.isBuffer = i++;
+GLmethod.isContextLost = i++; //80
+GLmethod.isEnabled = i++;
+GLmethod.isFramebuffer = i++;
+GLmethod.isProgram = i++;
+GLmethod.isRenderbuffer = i++;
+GLmethod.isShader = i++;
+GLmethod.isTexture = i++;
+GLmethod.lineWidth = i++;
+GLmethod.linkProgram = i++;
+GLmethod.pixelStorei = i++;
+GLmethod.polygonOffset = i++; //90
+GLmethod.readPixels = i++;
+GLmethod.renderbufferStorage = i++;
+GLmethod.sampleCoverage = i++;
+GLmethod.scissor = i++;
+GLmethod.shaderSource = i++;
+GLmethod.stencilFunc = i++;
+GLmethod.stencilFuncSeparate = i++;
+GLmethod.stencilMask = i++;
+GLmethod.stencilMaskSeparate = i++;
+GLmethod.stencilOp = i++; //100
+GLmethod.stencilOpSeparate = i++;
+GLmethod.texImage2D = i++;
+GLmethod.texParameterf = i++;
+GLmethod.texParameteri = i++;
+GLmethod.texSubImage2D = i++;
+GLmethod.uniform1f = i++;
+GLmethod.uniform1fv = i++;
+GLmethod.uniform1i = i++;
+GLmethod.uniform1iv = i++;
+GLmethod.uniform2f = i++; //110
+GLmethod.uniform2fv = i++;
+GLmethod.uniform2i = i++;
+GLmethod.uniform2iv = i++;
+GLmethod.uniform3f = i++;
+GLmethod.uniform3fv = i++;
+GLmethod.uniform3i = i++;
+GLmethod.uniform3iv = i++;
+GLmethod.uniform4f = i++;
+GLmethod.uniform4fv = i++;
+GLmethod.uniform4i = i++; //120
+GLmethod.uniform4iv = i++;
+GLmethod.uniformMatrix2fv = i++;
+GLmethod.uniformMatrix3fv = i++;
+GLmethod.uniformMatrix4fv = i++;
+GLmethod.useProgram = i++;
+GLmethod.validateProgram = i++;
+GLmethod.vertexAttrib1f = i++; //new
+GLmethod.vertexAttrib2f = i++; //new
+GLmethod.vertexAttrib3f = i++; //new
+GLmethod.vertexAttrib4f = i++; //new //130
+GLmethod.vertexAttrib1fv = i++; //new
+GLmethod.vertexAttrib2fv = i++; //new
+GLmethod.vertexAttrib3fv = i++; //new
+GLmethod.vertexAttrib4fv = i++; //new
+GLmethod.vertexAttribPointer = i++;
+GLmethod.viewport = i++;
+
+export default GLmethod;
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLtype.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLtype.js
new file mode 100644
index 0000000..c08d70d
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/GLtype.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8614 0 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+const GLtype = {};
+
+[
+ "GLbitfield",
+ "GLboolean",
+ "GLbyte",
+ "GLclampf",
+ "GLenum",
+ "GLfloat",
+ "GLint",
+ "GLintptr",
+ "GLsizei",
+ "GLsizeiptr",
+ "GLshort",
+ "GLubyte",
+ "GLuint",
+ "GLushort"
+].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1));
+
+export default GLtype;
+
+
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/Program.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Program.js
new file mode 100644
index 0000000..4c4c62e
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Program.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8614 0 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLProgram';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLProgram {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/Renderbuffer.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Renderbuffer.js
new file mode 100644
index 0000000..44a5340
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Renderbuffer.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6 14 0 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLRenderBuffer';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLRenderbuffer {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/RenderingContext.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/RenderingContext.js
new file mode 100644
index 0000000..5e02f54
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/RenderingContext.js
@@ -0,0 +1,1192 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 4 07 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import GLenum from './GLenum';
+import ActiveInfo from './ActiveInfo';
+import Buffer from './Buffer';
+import Framebuffer from './Framebuffer';
+import Renderbuffer from './Renderbuffer';
+import Texture from './Texture';
+import Program from './Program';
+import Shader from './Shader';
+import ShaderPrecisionFormat from './ShaderPrecisionFormat';
+import UniformLocation from './UniformLocation';
+import GLmethod from './GLmethod';
+
+const processArray = (array, checkArrayType = false) => {
+
+ function joinArray(arr, sep) {
+ let res = '';
+ for (let i = 0; i < arr.length; i++) {
+ if (i !== 0) {
+ res += sep;
+ }
+ res += arr[i];
+ }
+ return res;
+ }
+
+ let type = 'Float32Array';
+ if (checkArrayType) {
+ if (array instanceof Uint8Array) {
+ type = 'Uint8Array'
+ } else if (array instanceof Uint16Array) {
+ type = 'Uint16Array';
+ } else if (array instanceof Uint32Array) {
+ type = 'Uint32Array';
+ } else if (array instanceof Float32Array) {
+ type = 'Float32Array';
+ } else {
+ throw new Error('Check array type failed. Array type is ' + typeof array);
+ }
+ }
+
+ const ArrayTypes = {
+ Uint8Array: 1,
+ Uint16Array: 2,
+ Uint32Array: 4,
+ Float32Array: 14
+ };
+ return ArrayTypes[type] + ',' + btoa(joinArray(array, ','))
+}
+
+export default class WebGLRenderingContext {
+
+ // static GBridge = null;
+
+ className = 'WebGLRenderingContext';
+
+ constructor(canvas, type, attrs) {
+ this._canvas = canvas;
+ this._type = type;
+ this._version = 'WebGL 1.0';
+ this._attrs = attrs;
+ this._map = new Map();
+
+ Object.keys(GLenum)
+ .forEach(name => Object.defineProperty(this, name, {
+ value: GLenum[name]
+ }));
+ }
+
+ get canvas() {
+ return this._canvas;
+ }
+
+ activeTexture = function (textureUnit) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.activeTexture + ',' + textureUnit,
+ true
+ );
+ }
+
+ attachShader = function (progarm, shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.attachShader + ',' + progarm.id + ',' + shader.id,
+ true
+ );
+ }
+
+ bindAttribLocation = function (program, index, name) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindAttribLocation + ',' + program.id + ',' + index + ',' + name,
+ true
+ )
+ }
+
+ bindBuffer = function (target, buffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindBuffer + ',' + target + ',' + (buffer ? buffer.id : 0),
+ true
+ );
+ }
+
+ bindFramebuffer = function (target, framebuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindFramebuffer + ',' + target + ',' + (framebuffer ? framebuffer.id : 0),
+ true
+ )
+ }
+
+ bindRenderbuffer = function (target, renderBuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindRenderbuffer + ',' + target + ',' + (renderBuffer ? renderBuffer.id : 0),
+ true
+ )
+ }
+
+ bindTexture = function (target, texture) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindTexture + ',' + target + ',' + (texture ? texture.id : 0),
+ true
+ )
+ }
+
+ blendColor = function (r, g, b, a) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendColor + ',' + target + ',' + r + ',' + g + ',' + b + ',' + a,
+ true
+ )
+ }
+
+ blendEquation = function (mode) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendEquation + ',' + mode,
+ true
+ )
+ }
+
+ blendEquationSeparate = function (modeRGB, modeAlpha) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendEquationSeparate + ',' + modeRGB + ',' + modeAlpha,
+ true
+ )
+ }
+
+
+ blendFunc = function (sfactor, dfactor) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendFunc + ',' + sfactor + ',' + dfactor,
+ true
+ );
+ }
+
+ blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendFuncSeparate + ',' + srcRGB + ',' + dstRGB + ',' + srcAlpha + ',' + dstAlpha,
+ true
+ );
+ }
+
+ bufferData = function (target, data, usage) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bufferData + ',' + target + ',' + processArray(data, true) + ',' + usage,
+ true
+ )
+ }
+
+ bufferSubData = function (target, offset, data) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bufferSubData + ',' + target + ',' + offset + ',' + processArray(data, true),
+ true
+ )
+ }
+
+ checkFramebufferStatus = function (target) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.checkFramebufferStatus + ',' + target
+ );
+ return Number(result);
+ }
+
+ clear = function (mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clear + ',' + mask
+ );
+ this._canvas._needRender = true;
+ }
+
+ clearColor = function (r, g, b, a) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clearColor + ',' + r + ',' + g + ',' + b,
+ true
+ )
+ }
+
+ clearDepth = function (depth) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clearDepth + ',' + depth,
+ true
+ )
+ }
+
+ clearStencil = function (s) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clearStencil + ',' + s
+ );
+ }
+
+ colorMask = function (r, g, b, a) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.colorMask + ',' + r + ',' + g + ',' + b + ',' + a
+ )
+ }
+
+ compileShader = function (shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.compileShader + ',' + shader.id,
+ true
+ )
+ }
+
+ compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.compressedTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' +
+ width + ',' + height + ',' + border + ',' + processArray(pixels),
+ true
+ )
+ }
+
+ compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.compressedTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' +
+ width + ',' + height + ',' + format + ',' + processArray(pixels),
+ true
+ )
+ }
+
+
+ copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.copyTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + x + ',' + y + ',' +
+ width + ',' + height + ',' + border,
+ true
+ );
+ }
+
+ copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.copyTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + x + ',' + y + ',' +
+ width + ',' + height
+ );
+ }
+
+ createBuffer = function () {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createBuffer + ''
+ );
+ const buffer = new Buffer(result);
+ this._map.set(buffer.uuid(), buffer);
+ return buffer;
+ }
+
+ createFramebuffer = function () {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createFramebuffer + ''
+ );
+ const framebuffer = new Framebuffer(result);
+ this._map.set(framebuffer.uuid(), framebuffer);
+ return framebuffer;
+ }
+
+
+ createProgram = function () {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createProgram + ''
+ );
+ const program = new Program(id);
+ this._map.set(program.uuid(), program);
+ return program;
+ }
+
+ createRenderbuffer = function () {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createRenderbuffer + ''
+ )
+ const renderBuffer = new Renderbuffer(id);
+ this._map.set(renderBuffer.uuid(), renderBuffer);
+ return renderBuffer;
+ }
+
+ createShader = function (type) {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createShader + ',' + type
+ )
+ const shader = new Shader(id, type);
+ this._map.set(shader.uuid(), shader);
+ return shader;
+ }
+
+ createTexture = function () {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createTexture + ''
+ );
+ const texture = new Texture(id);
+ this._map.set(texture.uuid(), texture);
+ return texture;
+ }
+
+ cullFace = function (mode) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.cullFace + ',' + mode,
+ true
+ )
+ }
+
+
+ deleteBuffer = function (buffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteBuffer + ',' + buffer.id,
+ true
+ )
+ }
+
+ deleteFramebuffer = function (framebuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteFramebuffer + ',' + framebuffer.id,
+ true
+ )
+ }
+
+ deleteProgram = function (program) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteProgram + ',' + program.id,
+ true
+ )
+ }
+
+ deleteRenderbuffer = function (renderbuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteRenderbuffer + ',' + renderbuffer.id,
+ true
+ )
+ }
+
+ deleteShader = function (shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteShader + ',' + shader.id,
+ true
+ )
+ }
+
+ deleteTexture = function (texture) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteTexture + ',' + texture.id,
+ true
+ )
+ }
+
+ depthFunc = function (func) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.depthFunc + ',' + func
+ )
+ }
+
+ depthMask = function (flag) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.depthMask + ',' + Number(flag),
+ true
+ )
+ }
+
+ depthRange = function (zNear, zFar) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.depthRange + ',' + zNear + ',' + zFar,
+ true
+ )
+ }
+
+ detachShader = function (program, shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.detachShader + ',' + program.id + ',' + shader.id,
+ true
+ )
+ }
+
+ disable = function (cap) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.disable + ',' + cap,
+ true
+ )
+ }
+
+ disableVertexAttribArray = function (index) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.disableVertexAttribArray + ',' + index,
+ true
+ );
+ }
+
+ drawArrays = function (mode, first, count) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.drawArrays + ',' + mode + ',' + first + ',' + count
+ )
+ this._canvas._needRender = true;
+ }
+
+ drawElements = function (mode, count, type, offset) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.drawElements + ',' + mode + ',' + count + ',' + type + ',' + offset + ';'
+ );
+ this._canvas._needRender = true;
+ }
+
+ enable = function (cap) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.enable + ',' + cap,
+ true
+ );
+ }
+
+ enableVertexAttribArray = function (index) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.enableVertexAttribArray + ',' + index,
+ true
+ )
+ }
+
+
+ flush = function () {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.flush + ''
+ )
+ }
+
+ framebufferRenderbuffer = function (target, attachment, textarget, texture, level) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.framebufferRenderbuffer + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level,
+ true
+ )
+ }
+
+ framebufferTexture2D = function (target, attachment, textarget, texture, level) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.framebufferTexture2D + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level,
+ true
+ )
+ }
+
+ frontFace = function (mode) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.frontFace + ',' + mode,
+ true
+ )
+ }
+
+ generateMipmap = function (target) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.generateMipmap + ',' + target,
+ true
+ )
+ }
+
+ getActiveAttrib = function (progarm, index) {
+ const resultString = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getActiveAttrib + ',' + progarm.id + ',' + index
+ )
+ const [type, size, name] = resultString.split(',');
+ return new ActiveInfo({
+ type: Number(type),
+ size: Number(size),
+ name
+ });
+ }
+
+ getActiveUniform = function (progarm, index) {
+ const resultString = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getActiveUniform + ',' + progarm.id + ',' + index
+ );
+ const [type, size, name] = resultString.split(',');
+ return new ActiveInfo({
+ type: Number(type),
+ size: Number(size),
+ name
+ })
+ }
+
+ getAttachedShaders = function (progarm) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getAttachedShaders + ',' + progarm.id
+ );
+ const [type, ...ids] = result;
+ return ids.map(id => this._map.get(Shader.uuid(id)));
+ }
+
+ getAttribLocation = function (progarm, name) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getAttribLocation + ',' + progarm.id + ',' + name
+ )
+ }
+
+ getBufferParameter = function (target, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getBufferParameter + ',' + target + ',' + pname
+ );
+ const [type, res] = getBufferParameter;
+ return res;
+ }
+
+ getError = function () {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getError + ''
+ )
+ return result;
+ }
+
+ getExtension = function (name) {
+ return null;
+ }
+
+ getFramebufferAttachmentParameter = function (target, attachment, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getFramebufferAttachmentParameter + ',' + target + ',' + attachment + ',' + pname
+ )
+ switch (pname) {
+ case GLenum.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ return this._map.get(Renderbuffer.uuid(result)) || this._map.get(Texture.uuid(result)) || null;
+ default:
+ return result;
+ }
+ }
+
+ getParameter = function (pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getParameter + ',' + pname
+ )
+ switch (pname) {
+ case GLenum.VERSION:
+ return this._version;
+ case GLenum.ARRAY_BUFFER_BINDING: // buffer
+ case GLenum.ELEMENT_ARRAY_BUFFER_BINDING: // buffer
+ return this._map.get(Buffer.uuid(result)) || null;
+ case GLenum.CURRENT_PROGRAM: // program
+ return this._map.get(Program.uuid(result)) || null;
+ case GLenum.FRAMEBUFFER_BINDING: // framebuffer
+ return this._map.get(Framebuffer.uuid(result)) || null;
+ case GLenum.RENDERBUFFER_BINDING: // renderbuffer
+ return this._map.get(Renderbuffer.uuid(result)) || null;
+ case GLenum.TEXTURE_BINDING_2D: // texture
+ case GLenum.TEXTURE_BINDING_CUBE_MAP: // texture
+ return this._map.get(Texture.uuid(result)) || null;
+ case GLenum.ALIASED_LINE_WIDTH_RANGE: // Float32Array
+ case GLenum.ALIASED_POINT_SIZE_RANGE: // Float32Array
+ case GLenum.BLEND_COLOR: // Float32Array
+ case GLenum.COLOR_CLEAR_VALUE: // Float32Array
+ case GLenum.DEPTH_RANGE: // Float32Array
+ case GLenum.MAX_VIEWPORT_DIMS: // Int32Array
+ case GLenum.SCISSOR_BOX: // Int32Array
+ case GLenum.VIEWPORT: // Int32Array
+ case GLenum.COMPRESSED_TEXTURE_FORMATS: // Uint32Array
+ default:
+ const [type, ...res] = result.split(',');
+ if (res.length === 1) {
+ return Number(res[0]);
+ } else {
+ return res.map(Number);
+ }
+ }
+ }
+
+ getProgramInfoLog = function (progarm) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getProgramInfoLog + ',' + progarm.id
+ )
+ }
+
+ getProgramParameter = function (program, pname) {
+ const res = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getProgramParameter + ',' + program.id + ',' + pname
+ );
+
+ const [type, result] = res.split(',').map(i => parseInt(i));
+
+ if (type === 1) {
+ return Boolean(result);
+ } else if (type === 2) {
+ return result;
+ } else {
+ throw new Error('Unrecongized program paramater ' + res + ', type: ' + typeof res);
+ }
+ }
+
+
+ getRenderbufferParameter = function (target, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getRenderbufferParameter + ',' + target + ',' + pname
+ )
+ return result;
+ }
+
+
+ getShaderInfoLog = function (shader) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderInfoLog + ',' + shader.id
+ );
+ }
+
+ getShaderParameter = function (shader, pname) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderParameter + ',' + shader.id + ',' + pname
+ )
+ }
+
+ getShaderPrecisionFormat = function (shaderType, precisionType) {
+ const [rangeMin, rangeMax, precision] = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderPrecisionFormat + ',' + shaderType + ',' + precisionType
+ );
+ const shaderPrecisionFormat = new ShaderPrecisionFormat({
+ rangeMin: Number(rangeMin),
+ rangeMax: Number(rangeMax),
+ precision: Number(precision)
+ });
+ return shaderPrecisionFormat;
+ }
+
+ getShaderSource = function (shader) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderSource + ',' + shader.id
+ );
+ return result;
+ }
+
+ getSupportedExtensions = function () {
+ return Object.keys({});
+ }
+
+ getTexParameter = function (target, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getTexParameter + ',' + target + ',' + pname
+ )
+ return result;
+ }
+
+ getUniformLocation = function (program, name) {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getUniformLocation + ',' + program.id + ',' + name
+ );
+ if (id === -1) {
+ return null;
+ } else {
+ return new UniformLocation(Number(id));
+ }
+ }
+
+ getVertexAttrib = function (index, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getVertexAttrib + ',' + index + ',' + pname
+ );
+ switch (pname) {
+ case GLenum.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ return this._map.get(Buffer.uuid(result)) || null;
+ case GLenum.CURRENT_VERTEX_ATTRIB: // Float32Array
+ default:
+ return result;
+ }
+ }
+
+ getVertexAttribOffset = function (index, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getVertexAttribOffset + ',' + index + ',' + pname
+ )
+ return Number(result);
+ }
+
+ isBuffer = function (buffer) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isBuffer + ',' + buffer.id
+ )
+ return Boolean(result);
+ }
+
+ isContextLost = function () {
+ return false;
+ }
+
+ isEnabled = function (cap) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isEnabled + ',' + cap
+ )
+ return Boolean(result);
+ }
+
+ isFramebuffer = function (framebuffer) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isFramebuffer + ',' + framebuffer.id
+ )
+ return Boolean(result);
+ }
+
+ isProgram = function (program) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isProgram + ',' + program.id
+ )
+ return Boolean(result);
+ }
+
+ isRenderbuffer = function (renderBuffer) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isRenderbuffer + ',' + renderbuffer.id
+ )
+ return Boolean(result);
+ }
+
+ isShader = function (shader) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isShader + ',' + shader.id
+ )
+ return Boolean(result);
+ }
+
+ isTexture = function (texture) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isTexture + ',' + texture.id
+ );
+ return Boolean(result);
+ }
+
+ lineWidth = function (width) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.lineWidth + ',' + width,
+ true
+ )
+ }
+
+ linkProgram = function (program) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.linkProgram + ',' + program.id,
+ true
+ );
+ }
+
+
+ pixelStorei = function (pname, param) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.pixelStorei + ',' + pname + ',' + Number(param)
+ )
+ }
+
+ polygonOffset = function (factor, units) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.polygonOffset + ',' + factor + ',' + units
+ )
+ }
+
+ readPixels = function (x, y, width, height, format, type, pixels) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.readPixels + ',' + x + ',' + y + ',' + width + ',' + height + ',' + format + ',' + type
+ )
+ return result;
+ }
+
+ renderbufferStorage = function (target, internalFormat, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.renderbufferStorage + ',' + target + ',' + internalFormat + ',' + width + ',' + height,
+ true
+ )
+ }
+
+ sampleCoverage = function (value, invert) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.sampleCoverage + ',' + value + ',' + Number(invert),
+ true
+ )
+ }
+
+ scissor = function (x, y, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.scissor + ',' + x + ',' + y + ',' + width + ',' + height,
+ true
+ )
+ }
+
+ shaderSource = function (shader, source) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.shaderSource + ',' + shader.id + ',' + source
+ )
+ }
+
+ stencilFunc = function (func, ref, mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilFunc + ',' + func + ',' + ref + ',' + mask,
+ true
+ )
+ }
+
+ stencilFuncSeparate = function (face, func, ref, mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilFuncSeparate + ',' + face + ',' + func + ',' + ref + ',' + mask,
+ true
+ )
+ }
+
+ stencilMask = function (mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilMask + ',' + mask,
+ true
+ )
+ }
+
+ stencilMaskSeparate = function (face, mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilMaskSeparate + ',' + face + ',' + mask,
+ true
+ )
+ }
+
+ stencilOp = function (fail, zfail, zpass) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilOp + ',' + fail + ',' + zfail + ',' + zpass
+ )
+ }
+
+ stencilOpSeparate = function (face, fail, zfail, zpass) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilOp + ',' + face + ',' + fail + ',' + zfail + ',' + zpass,
+ true
+ )
+ }
+
+ texImage2D = function (...args) {
+ WebGLRenderingContext.GBridge.texImage2D(this._canvas.id, ...args);
+ }
+
+
+ texParameterf = function (target, pname, param) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.texParameterf + ',' + target + ',' + pname + ',' + param,
+ true
+ )
+ }
+
+ texParameteri = function (target, pname, param) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.texParameteri + ',' + target + ',' + pname + ',' + param
+ )
+ }
+
+ texSubImage2D = function (...args) {
+ WebGLRenderingContext.GBridge.texSubImage2D(this._canvas.id, ...args);
+ }
+
+ uniform1f = function (location, v0) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1f + ',' + location.id + ',' + v0
+ )
+ }
+
+ uniform1fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform1i = function (location, v0) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1i + ',' + location.id + ',' + v0,
+ // true
+ )
+ }
+
+ uniform1iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1iv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform2f = function (location, v0, v1) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2f + ',' + location.id + ',' + v0 + ',' + v1,
+ true
+ )
+ }
+
+ uniform2fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform2i = function (location, v0, v1) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2i + ',' + location.id + ',' + v0 + ',' + v1,
+ true
+ )
+ }
+
+ uniform2iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2iv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform3f = function (location, v0, v1, v2) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2,
+ true
+ )
+ }
+
+ uniform3fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform3i = function (location, v0, v1, v2) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2,
+ true
+ )
+ }
+
+ uniform3iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3iv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform4f = function (location, v0, v1, v2, v3) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3,
+ true
+ )
+ }
+
+ uniform4fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform4i = function (location, v0, v1, v2, v3) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3,
+ true
+ )
+ }
+
+ uniform4iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4iv + ',' + location.id + ',' + processArray(value, true),
+ true
+ )
+ }
+
+ uniformMatrix2fv = function (location, transpose, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniformMatrix2fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniformMatrix3fv = function (location, transpose, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniformMatrix3fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniformMatrix4fv = function (location, transpose, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniformMatrix4fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value),
+ true
+ );
+ }
+
+ useProgram = function (progarm) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.useProgram + ',' + progarm.id + '',
+ true
+ )
+ }
+
+
+ validateProgram = function (program) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.validateProgram + ',' + program.id,
+ true
+ )
+ }
+
+ vertexAttrib1f = function (index, v0) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib1f + ',' + index + ',' + v0,
+ true
+ )
+ }
+
+ vertexAttrib2f = function (index, v0, v1) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib2f + ',' + index + ',' + v0 + ',' + v1,
+ true
+ )
+ }
+
+ vertexAttrib3f = function (index, v0, v1, v2) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib3f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2,
+ true
+ )
+ }
+
+ vertexAttrib4f = function (index, v0, v1, v2, v3) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib4f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3,
+ true
+ )
+ }
+
+ vertexAttrib1fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib1fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttrib2fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib2fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttrib3fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib3fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttrib4fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib4fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttribPointer = function (index, size, type, normalized, stride, offset) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttribPointer + ',' + index + ',' + size + ',' + type + ',' + Number(normalized) + ',' + stride + ',' + offset,
+ true
+ )
+ }
+
+ viewport = function (x, y, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.viewport + ',' + x + ',' + y + ',' + width + ',' + height,
+ true
+ )
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/Shader.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Shader.js
new file mode 100644
index 0000000..a331603
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Shader.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 61 40 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLShader';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLShader {
+ className = name;
+
+ constructor(id, type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/ShaderPrecisionFormat.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/ShaderPrecisionFormat.js
new file mode 100644
index 0000000..6e61dab
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/ShaderPrecisionFormat.js
@@ -0,0 +1,12 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 4 0 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default class WebGLShaderPrecisionFormat {
+ className = 'WebGLShaderPrecisionFormat';
+
+ constructor({
+ rangeMin, rangeMax, precision
+ }) {
+ this.rangeMin = rangeMin;
+ this.rangeMax = rangeMax;
+ this.precision = precision;
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/Texture.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Texture.js
new file mode 100644
index 0000000..812c4e3
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/Texture.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 140 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLTexture';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLTexture {
+ className = name;
+
+ constructor(id, type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/UniformLocation.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/UniformLocation.js
new file mode 100644
index 0000000..8a29c65
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/UniformLocation.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18614072 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLUniformLocation';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLUniformLocation {
+ className = name;
+
+ constructor(id, type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/context-webgl/classUtils.js b/components/firstui/fui-poster-weex/gcanvas/context-webgl/classUtils.js
new file mode 100644
index 0000000..0b3f61c
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/context-webgl/classUtils.js
@@ -0,0 +1,4 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 1 40 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export function getTransferedObjectUUID(name, id) {
+ return `${name.toLowerCase()}-${id}`;
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/env/canvas.js b/components/firstui/fui-poster-weex/gcanvas/env/canvas.js
new file mode 100644
index 0000000..c873854
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/env/canvas.js
@@ -0,0 +1,75 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 40 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import GContext2D from '../context-2d/RenderingContext';
+import GContextWebGL from '../context-webgl/RenderingContext';
+
+export default class GCanvas {
+
+ // static GBridge = null;
+
+ id = null;
+
+ _needRender = true;
+
+ constructor(id, { disableAutoSwap }) {
+ this.id = id;
+
+ this._disableAutoSwap = disableAutoSwap;
+ if (disableAutoSwap) {
+ this._swapBuffers = () => {
+ GCanvas.GBridge.render(this.id);
+ }
+ }
+ }
+
+ getContext(type) {
+
+ let context = null;
+
+ if (type.match(/webgl/i)) {
+ context = new GContextWebGL(this);
+
+ context.componentId = this.id;
+
+ if (!this._disableAutoSwap) {
+ const render = () => {
+ if (this._needRender) {
+ GCanvas.GBridge.render(this.id);
+ this._needRender = false;
+ }
+ }
+ setInterval(render, 16);
+ }
+
+ GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl
+ } else if (type.match(/2d/i)) {
+ context = new GContext2D(this);
+
+ context.componentId = this.id;
+
+// const render = ( callback ) => {
+//
+// const commands = context._drawCommands;
+// context._drawCommands = '';
+//
+// GCanvas.GBridge.render2d(this.id, commands, callback);
+// this._needRender = false;
+// }
+// //draw方法触发
+// context._flush = render;
+// //setInterval(render, 16);
+
+ GCanvas.GBridge.callSetContextType(this.id, 0);
+ } else {
+ throw new Error('not supported context ' + type);
+ }
+
+ return context;
+
+ }
+
+ reset() {
+ GCanvas.GBridge.callReset(this.id);
+ }
+
+
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/env/image.js b/components/firstui/fui-poster-weex/gcanvas/env/image.js
new file mode 100644
index 0000000..b009ea1
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/env/image.js
@@ -0,0 +1,97 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 1 4 0 725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+let incId = 1;
+
+const noop = function () { };
+
+class GImage {
+
+ static GBridge = null;
+
+ constructor() {
+ this._id = incId++;
+ this._width = 0;
+ this._height = 0;
+ this._src = undefined;
+ this._onload = noop;
+ this._onerror = noop;
+ this.complete = false;
+ }
+
+ get width() {
+ return this._width;
+ }
+ set width(v) {
+ this._width = v;
+ }
+
+ get height() {
+ return this._height;
+ }
+
+ set height(v) {
+ this._height = v;
+ }
+
+ get src() {
+ return this._src;
+ }
+
+ set src(v) {
+
+ if (v.startsWith('//')) {
+ v = 'http:' + v;
+ }
+
+ this._src = v;
+
+ GImage.GBridge.perloadImage([this._src, this._id], (data) => {
+ if (typeof data === 'string') {
+ data = JSON.parse(data);
+ }
+ if (data.error) {
+ var evt = { type: 'error', target: this };
+ this.onerror(evt);
+ } else {
+ this.complete = true;
+ this.width = typeof data.width === 'number' ? data.width : 0;
+ this.height = typeof data.height === 'number' ? data.height : 0;
+ var evt = { type: 'load', target: this };
+ this.onload(evt);
+ }
+ });
+ }
+
+ addEventListener(name, listener) {
+ if (name === 'load') {
+ this.onload = listener;
+ } else if (name === 'error') {
+ this.onerror = listener;
+ }
+ }
+
+ removeEventListener(name, listener) {
+ if (name === 'load') {
+ this.onload = noop;
+ } else if (name === 'error') {
+ this.onerror = noop;
+ }
+ }
+
+ get onload() {
+ return this._onload;
+ }
+
+ set onload(v) {
+ this._onload = v;
+ }
+
+ get onerror() {
+ return this._onerror;
+ }
+
+ set onerror(v) {
+ this._onerror = v;
+ }
+}
+
+export default GImage;
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/env/tool.js b/components/firstui/fui-poster-weex/gcanvas/env/tool.js
new file mode 100644
index 0000000..2d5e272
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/env/tool.js
@@ -0,0 +1,25 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8614 0 7 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+
+export function ArrayBufferToBase64 (buffer) {
+ var binary = '';
+ var bytes = new Uint8ClampedArray(buffer);
+ for (var len = bytes.byteLength, i = 0; i < len; i++) {
+ binary += String.fromCharCode(bytes[i]);
+ }
+ return btoa(binary);
+}
+
+export function Base64ToUint8ClampedArray(base64String) {
+ const padding = '='.repeat((4 - base64String.length % 4) % 4);
+ const base64 = (base64String + padding)
+ .replace(/\-/g, '+')
+ .replace(/_/g, '/');
+
+ const rawData = atob(base64);
+ const outputArray = new Uint8ClampedArray(rawData.length);
+
+ for (let i = 0; i < rawData.length; ++i) {
+ outputArray[i] = rawData.charCodeAt(i);
+ }
+ return outputArray;
+}
\ No newline at end of file
diff --git a/components/firstui/fui-poster-weex/gcanvas/index.js b/components/firstui/fui-poster-weex/gcanvas/index.js
new file mode 100644
index 0000000..5d7ec55
--- /dev/null
+++ b/components/firstui/fui-poster-weex/gcanvas/index.js
@@ -0,0 +1,48 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6 14 07 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import GCanvas from './env/canvas';
+import GImage from './env/image';
+
+import GWebGLRenderingContext from './context-webgl/RenderingContext';
+import GContext2D from './context-2d/RenderingContext';
+
+import GBridgeWeex from './bridge/bridge-weex';
+
+export let Image = GImage;
+
+export let WeexBridge = GBridgeWeex;
+
+export function enable(el, {
+ bridge,
+ debug,
+ disableAutoSwap,
+ disableComboCommands
+} = {}) {
+
+ const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge;
+
+ GBridge.callEnable(el.ref, [
+ 0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY
+ -1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE
+ false, // supportScroll
+ false, // newCanvasMode
+ 1, // compatible
+ 'white', // clearColor
+ false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level
+ ]);
+
+ if (debug === true) {
+ GBridge.callEnableDebug();
+ }
+ if (disableComboCommands) {
+ GBridge.callEnableDisableCombo();
+ }
+
+ var canvas = new GCanvas(el.ref, {
+ disableAutoSwap
+ });
+ let pixelRatio = uni.getSystemInfoSync().pixelRatio;
+ canvas.width = el.style.width * pixelRatio;
+ canvas.height = el.style.height * pixelRatio;
+
+ return canvas;
+};
\ No newline at end of file
diff --git a/components/firstui/fui-poster/fui-poster.vue b/components/firstui/fui-poster/fui-poster.vue
new file mode 100644
index 0000000..e536094
--- /dev/null
+++ b/components/firstui/fui-poster/fui-poster.vue
@@ -0,0 +1,206 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-poster/index.js b/components/firstui/fui-poster/index.js
new file mode 100644
index 0000000..43c44a1
--- /dev/null
+++ b/components/firstui/fui-poster/index.js
@@ -0,0 +1,644 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6 1 40 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+/*!
+ * 生成海报
+ * poster - v1.8.0 (2023/02/02, 16:52:14 PM)
+ *
+ *
+ * 官网地址:https://firstui.cn/
+ * 文档地址:https://doc.firstui.cn/
+ */
+const poster = {
+ _pixelRatio: 2,
+ _ctx: null,
+ _canvasId: null,
+ _this: null,
+ create(pixelRatio, canvasId, _this) {
+ poster._pixelRatio = pixelRatio;
+ poster._canvasId = canvasId;
+ poster._this = _this;
+ poster._ctx = uni.createCanvasContext(canvasId, _this)
+ },
+ _toPx(rpx) {
+ return uni.upx2px(rpx * poster._pixelRatio)
+ },
+ _getTextWidth(context, text, fontSize) {
+ let width = 0;
+ // #ifndef MP-ALIPAY || MP-BAIDU
+ width = context.measureText(text).width
+ // #endif
+
+ //支付宝小程序ios真机测试measureText获取长度有bug
+ //百度小程序有frontText时误差较大,影响绘制效果
+ // #ifdef MP-ALIPAY || MP-BAIDU
+ let sum = 0;
+ for (let i = 0, len = text.length; i < len; i++) {
+ if (text.charCodeAt(i) >= 0 && text.charCodeAt(i) <= 255)
+ sum = sum + 1;
+ else
+ sum = sum + 2;
+ }
+ width = sum / 2 * poster._toPx(fontSize)
+ // #endif
+
+ return width;
+ },
+ //canvas文字换行,rows=-1则不限制行数
+ _wrapText(text, fontSize, textWidth, width, context, rows = 2) {
+ let textArr = [];
+ if (textWidth > width) {
+ let fillText = '';
+ let lines = 1;
+ let arr = text.split('')
+ for (let i = 0, len = arr.length; i < len; i++) {
+ fillText = fillText + arr[i];
+ if (poster._getTextWidth(context, fillText, fontSize) >= width) {
+ if (lines === rows && rows !== -1) {
+ if (i !== arr.length - 1) {
+ fillText = fillText.substring(0, fillText.length - 1) + '...';
+ }
+ textArr.push(fillText);
+ break;
+ }
+ textArr.push(fillText);
+ fillText = '';
+ lines++;
+ } else if (i === arr.length - 1) {
+ textArr.push(fillText);
+ }
+ }
+ } else {
+ textArr.push(text)
+ }
+ return textArr;
+ },
+ _drawText(context, params) {
+ let {
+ x,
+ y,
+ fontSize,
+ color,
+ baseLine = 'normal',
+ textAlign = 'left',
+ frontText,
+ frontSize,
+ spacing, //单位rpx
+ text,
+ opacity = 1,
+ lineThrough = false,
+ width = 500, //单位rpx
+ rows = 1,
+ lineHeight = 0,
+ fontWeight = 'normal',
+ fontStyle = 'normal',
+ fontFamily = "sans-serif"
+ } = params;
+ context.save();
+ context.beginPath();
+ context.font = fontStyle + " " + fontWeight + " " + poster._toPx(fontSize) + "px " + fontFamily
+ context.setGlobalAlpha(opacity);
+ // #ifdef MP-TOUTIAO
+ context.setFontSize(poster._toPx(fontSize));
+ // #endif
+ context.setFillStyle(color);
+ context.setTextBaseline(baseLine);
+ context.setTextAlign(textAlign);
+ let textWidth = poster._getTextWidth(context, text, fontSize);
+ width = poster._toPx(width);
+ let textArr = poster._wrapText(text, fontSize, textWidth, width, context, rows)
+ //如果文本前面有其他文本内容
+ if (frontText) {
+ context.setFontSize(poster._toPx(frontSize));
+ x = poster._getTextWidth(context, frontText, frontSize) + poster._toPx(x + spacing);
+ context.setFontSize(poster._toPx(fontSize));
+ } else {
+ x = poster._toPx(x)
+ }
+ textArr.forEach((item, index) => {
+ context.fillText(item, x, poster._toPx(y + (lineHeight || fontSize) * index))
+ })
+ context.restore();
+ if (lineThrough) {
+ let lineY = y;
+ // 根据baseLine的不同对贯穿线的Y坐标做相应调整
+ switch (baseLine) {
+ case 'top':
+ lineY += fontSize / 2 + 4;
+ break;
+ case 'middle':
+ break;
+ case 'bottom':
+ lineY -= fontSize / 2 + 4;
+ break;
+ default:
+ // #ifdef MP-WEIXIN
+ lineY -= fontSize / 2 - 3;
+ // #endif
+ // #ifndef MP-WEIXIN
+ lineY -= fontSize / 2 - 4;
+ // #endif
+ break;
+ }
+ context.save();
+ context.moveTo(x, poster._toPx(lineY));
+ context.lineTo(x + textWidth + 2, poster._toPx(lineY));
+ context.setStrokeStyle(color);
+ context.stroke();
+ context.restore();
+ }
+ },
+ _drawRadiusRect(context, params) {
+ let {
+ x,
+ y,
+ width,
+ height,
+ borderRadius
+ } = params;
+ let r = poster._toPx(borderRadius / 2);
+
+ x = poster._toPx(x)
+ y = poster._toPx(y)
+ width = poster._toPx(width)
+ height = poster._toPx(height)
+
+ context.beginPath();
+ context.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5);
+ context.moveTo(x + r, y);
+ context.lineTo(x + width - r, y);
+ context.lineTo(x + width, y + r);
+
+ context.arc(x + width - r, y + r, r, Math.PI * 1.5, Math.PI * 2);
+ context.lineTo(x + width, y + height - r);
+ context.lineTo(x + width - r, y + height);
+
+ context.arc(x + width - r, y + height - r, r, 0, Math.PI * 0.5);
+ context.lineTo(x + r, y + height);
+ context.lineTo(x, y + height - r);
+
+ context.arc(x + r, y + height - r, r, Math.PI * 0.5, Math.PI);
+ context.lineTo(x, y + r);
+ context.lineTo(x + r, y);
+ },
+ _drawImage(context, params) {
+ let {
+ imgResource,
+ x,
+ y,
+ width,
+ height,
+ sx,
+ sy,
+ sw,
+ sh,
+ borderRadius = 0,
+ borderWidth = 0,
+ borderColor
+ } = params;
+ context.save();
+ if (borderRadius > 0) {
+ this._drawRadiusRect(context, params);
+ context.strokeStyle = 'rgba(255,255,255,0)'
+ //处理百度/头条小程序黑边问题
+ // #ifndef MP-BAIDU || MP-TOUTIAO
+ context.stroke();
+ // #endif
+ context.clip();
+ }
+ if (sw && sh) {
+ //根据画布的宽高计算出图片绘制的大小,可保证图片绘制不变形
+ //暂时未使用此api,后期如果有需要再进行优化
+ context.drawImage(imgResource, poster._toPx(sx), poster._toPx(sy), poster._toPx(sw), poster._toPx(sh),
+ poster
+ ._toPx(x), poster._toPx(y), poster._toPx(width), poster._toPx(height));
+ } else {
+ context.drawImage(imgResource, poster._toPx(x), poster._toPx(y), poster._toPx(width), poster._toPx(
+ height))
+ }
+ if (borderWidth && borderWidth > 0) {
+ context.setStrokeStyle(borderColor);
+ context.setLineWidth(poster._toPx(borderWidth));
+ context.stroke();
+ }
+ context.restore();
+ },
+ _drawBlock(context, params) {
+ let {
+ width,
+ height,
+ x,
+ y,
+ borderWidth,
+ backgroundColor,
+ gradientColor,
+ gradientType = 1,
+ borderColor,
+ borderRadius = 0,
+ opacity = 1,
+ shadow
+ } = params;
+ if (backgroundColor) {
+ context.save();
+ context.setGlobalAlpha(opacity);
+ if (gradientColor) {
+ // #ifndef MP-KUAISHOU
+ let grd = null;
+ if (gradientType == 1) {
+ //从上到下
+ grd = context.createLinearGradient(0, 0, poster._toPx(width), poster._toPx(height))
+ } else {
+ //从左到右
+ grd = context.createLinearGradient(0, poster._toPx(width), poster._toPx(height), 0)
+ }
+ grd.addColorStop(0, backgroundColor)
+ grd.addColorStop(1, gradientColor)
+ // Fill with gradient
+ context.setFillStyle(grd);
+ // #endif
+
+ // #ifdef MP-KUAISHOU
+ context.setFillStyle(backgroundColor);
+ // #endif
+ } else {
+ context.setFillStyle(backgroundColor);
+ }
+
+ if (shadow) {
+ const {
+ offsetX,
+ offsetY,
+ blur,
+ color
+ } = shadow;
+ context.shadowOffsetX = poster._toPx(offsetX)
+ context.shadowOffsetY = poster._toPx(offsetY)
+ context.shadowBlur = blur
+ context.shadowColor = color
+ // context.setShadow(poster._toPx(offsetX), poster._toPx(offsetY), blur, color);
+ }
+
+ if (borderRadius > 0) {
+ // 画圆角矩形
+ poster._drawRadiusRect(context, params);
+ context.fill();
+ } else {
+ context.fillRect(poster._toPx(x), poster._toPx(y), poster._toPx(width), poster._toPx(height));
+ }
+ context.restore();
+ }
+ if (borderWidth) {
+ // 画线
+ context.save();
+ context.setGlobalAlpha(opacity);
+ context.setStrokeStyle(borderColor);
+ context.setLineWidth(poster._toPx(borderWidth));
+ if (borderRadius > 0) {
+ // 画圆角矩形边框
+ poster._drawRadiusRect(context, params);
+ context.stroke();
+ } else {
+ context.strokeRect(poster._toPx(x), poster._toPx(y), poster._toPx(width), poster._toPx(height));
+ }
+ context.restore();
+ }
+
+ },
+ _drawLine(context, params) {
+ let {
+ x,
+ y,
+ endX,
+ endY,
+ color,
+ width = 1
+ } = params;
+ context.save();
+ context.beginPath();
+ context.setStrokeStyle(color);
+ context.setLineWidth(poster._toPx(width));
+ context.moveTo(poster._toPx(x), poster._toPx(y));
+ context.lineTo(poster._toPx(endX), poster._toPx(endY));
+ context.stroke();
+ context.closePath();
+ context.restore();
+ },
+ //ios用户拒绝相册访问 ,引导用户到设置页面,开启相册访问权限
+ //-1=未请求 1 = 已允许,0 = 拒绝|受限
+ _judgeIosPermissionPhotoLibrary() {
+ // #ifdef APP-PLUS
+ var result = 0;
+ var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
+ var authStatus = PHPhotoLibrary.authorizationStatus();
+ if (authStatus === 0) {
+ result = -1;
+ } else if (authStatus == 3) {
+ result = 1;
+ console.log("相册权限已经开启");
+ } else {
+ result = 0;
+ console.log("相册权限没有开启");
+ }
+ plus.ios.deleteObject(PHPhotoLibrary);
+ return result;
+ // #endif
+ },
+ // Android权限查询
+ _requestAndroidPermission(permissionID) {
+ // #ifdef APP-PLUS
+ return new Promise((resolve, reject) => {
+ plus.android.requestPermissions(
+ // 理论上支持多个权限同时查询,本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
+ [permissionID],
+ function(resultObj) {
+ var result = 0;
+ for (var i = 0; i < resultObj.granted.length; i++) {
+ var grantedPermission = resultObj.granted[i];
+ console.log('已获取的权限:' + grantedPermission);
+ result = 1
+ }
+ for (var i = 0; i < resultObj.deniedPresent.length; i++) {
+ var deniedPresentPermission = resultObj.deniedPresent[i];
+ console.log('拒绝本次申请的权限:' + deniedPresentPermission);
+ result = 0
+ }
+ for (var i = 0; i < resultObj.deniedAlways.length; i++) {
+ var deniedAlwaysPermission = resultObj.deniedAlways[i];
+ console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
+ result = -1
+ }
+ resolve(result);
+ // 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
+ },
+ function(error) {
+ console.log('申请权限错误:' + error.code + " = " + error.message);
+ resolve({
+ code: error.code,
+ message: error.message
+ });
+ }
+ );
+ });
+ // #endif
+ },
+ // 跳转到**应用**的权限页面
+ _gotoAppPermissionSetting(isAndroid) {
+ // #ifdef APP-PLUS
+ if (!isAndroid) {
+ var UIApplication = plus.ios.import("UIApplication");
+ var application2 = UIApplication.sharedApplication();
+ var NSURL2 = plus.ios.import("NSURL");
+ // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
+ var setting2 = NSURL2.URLWithString("app-settings:");
+ application2.openURL(setting2);
+
+ plus.ios.deleteObject(setting2);
+ plus.ios.deleteObject(NSURL2);
+ plus.ios.deleteObject(application2);
+ } else {
+ // console.log(plus.device.vendor);
+ var Intent = plus.android.importClass("android.content.Intent");
+ var Settings = plus.android.importClass("android.provider.Settings");
+ var Uri = plus.android.importClass("android.net.Uri");
+ var mainActivity = plus.android.runtimeMainActivity();
+ var intent = new Intent();
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
+ intent.setData(uri);
+ mainActivity.startActivity(intent);
+ }
+ // #endif
+ },
+ _modal: function(callback, confirmColor, confirmText) {
+ uni.showModal({
+ title: '提示',
+ content: '您还没有开启相册权限,是否立即设置?',
+ showCancel: true,
+ cancelColor: '#B2B2B2',
+ confirmColor: confirmColor || "#181818",
+ confirmText: confirmText || "确定",
+ success(res) {
+ if (res.confirm) {
+ callback && callback(true)
+ } else {
+ callback && callback(false)
+ }
+ }
+ })
+ },
+ //相册权限查询,如果没有权限则提示打开设置页面
+ _judgePermissionPhotoLibrary: async function(callback) {
+ // #ifdef H5 || MP-ALIPAY|| MP-360
+ //H5端不支持调用api保存到相册
+ callback && callback(true)
+ // #endif
+
+ // #ifdef APP-PLUS
+ const res = uni.getSystemInfoSync();
+ let result;
+ let isAndroid = res.platform.toLocaleLowerCase() == "android";
+ if (isAndroid) {
+ result = await poster._requestAndroidPermission('android.permission.WRITE_EXTERNAL_STORAGE')
+ } else {
+ result = poster._judgeIosPermissionPhotoLibrary()
+ }
+ if (result == 1) {
+ callback && callback(true)
+ } else {
+ if (!(!isAndroid && result == -1)) {
+ poster._modal((res) => {
+ if (res) {
+ poster._gotoAppPermissionSetting(isAndroid)
+ }
+ })
+ } else {
+ callback && callback(true)
+ }
+ }
+ // #endif
+
+ // #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO
+ uni.authorize({
+ scope: 'scope.writePhotosAlbum',
+ success() {
+ callback && callback(true)
+ },
+ fail() {
+ poster._modal((res) => {
+ if (res) {
+ uni.openSetting({
+ success(res) {
+ console.log(res.authSetting)
+ }
+ });
+ }
+ })
+ }
+ })
+ // #endif
+ },
+ //图片转成本地文件
+ getImage(url) {
+ return new Promise((resolve, reject) => {
+ uni.downloadFile({
+ url: url,
+ success: res => {
+ resolve(res.tempFilePath);
+ },
+ fail: res => {
+ reject(false)
+ }
+ })
+ })
+ },
+ //当服务器端返回图片base64时,转成本地文件
+ //微信小程序不支持直接绘制base64,其他平台可根据支持情况进行处理
+ getImagebyBase64(base64) {
+ //使用前先查看支持平台
+ const uniqueId = `fui_${Math.ceil(Math.random() * 10e5).toString(36)}`
+ return new Promise((resolve, reject) => {
+ // #ifdef MP-WEIXIN
+ const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || [];
+ let arrayBuffer = wx.base64ToArrayBuffer(bodyData)
+ //uniqueId:注意这里名称需要动态生成(名称相同部分机型会出现写入失败,显示的是上次生成的图片)
+ const filePath = `${wx.env.USER_DATA_PATH}/${uniqueId}.${format}`;
+ //此处可能会出现存储空间不足的情况,可清理缓存解决
+ //fail the maximum size of the file storage limit is exceeded
+ wx.getFileSystemManager().writeFile({
+ filePath,
+ data: arrayBuffer,
+ encoding: 'binary',
+ success() {
+ resolve(filePath);
+ },
+ fail() {
+ reject(false)
+ }
+ })
+ // #endif
+ // #ifdef APP-PLUS
+ let bitmap = new plus.nativeObj.Bitmap(uniqueId);
+ bitmap.loadBase64Data(base64, function() {
+ //console.log("加载Base64图片数据成功");
+ bitmap.save(`_doc/${uniqueId}.png`, {}, function(e) {
+ //console.log('保存图片成功:' + JSON.stringify(i));
+ // let width = e.width; // 保存后图片的实际宽度,单位为px
+ // let height = e.height; // 保存后图片的实际高度,单位为px
+ let target = e.target; // 保存后的图片url路径,以"file://"开头
+ resolve(target);
+
+ }, function(e) {
+ console.log('保存图片失败:' + JSON.stringify(e));
+ reject(false)
+ });
+ }, function() {
+ console.log('加载Base64图片数据失败:' + JSON.stringify(e));
+ reject(false)
+ });
+ // #endif
+
+ // #ifdef H5
+ // let img = new Image();
+ // img.src = base64;
+ resolve(base64);
+ // #endif
+
+ //后面查看文档说明再进行转换
+ // #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-360
+ reject(false)
+ // #endif
+ })
+ },
+ generatePoster(cw, ch, queue, callback) {
+ const context = poster._ctx;
+ if (context) {
+ context.clearRect(0, 0, poster._toPx(cw), poster._toPx(ch))
+ queue.forEach((params) => {
+ if (params.type === 'image') {
+ poster._drawImage(context, params)
+ } else if (params.type === 'text') {
+ poster._drawText(context, params)
+ } else if (params.type === 'block') {
+ poster._drawBlock(context, params)
+ } else if (params.type === 'line') {
+ poster._drawLine(context, params)
+ }
+ });
+ const platform = uni.getSystemInfoSync().platform;
+ let time = 50;
+ if (platform === 'android') {
+ time = 300;
+ }
+ setTimeout(() => {
+ context.draw(false, () => {
+ setTimeout(() => {
+ // #ifdef MP-ALIPAY
+ context.toTempFilePath({
+ success: res => {
+ callback && callback(res.apFilePath)
+ },
+ fail: err => {
+ callback && callback(false)
+ }
+ });
+ // #endif
+ // #ifndef MP-ALIPAY
+ uni.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ canvasId: poster._canvasId,
+ fileType: 'png',
+ quality: 1,
+ success: function(res) {
+ callback && callback(res.tempFilePath)
+ },
+ fail() {
+ callback && callback(false)
+ }
+ }, poster._this)
+ // #endif
+ }, time)
+ })
+ }, 50)
+ } else {
+ callback && callback(false)
+ }
+ },
+ // 将海报图片保存到本地,H5只可预览然后长按保存
+ saveImage(file) {
+ // #ifndef H5
+ //检查是否授权相册权限
+ poster._judgePermissionPhotoLibrary((res) => {
+ //保存图片
+ if (res) {
+ uni.saveImageToPhotosAlbum({
+ filePath: file,
+ success(res) {
+ uni.showToast({
+ title: '图片保存成功',
+ icon: 'none'
+ })
+ },
+ fail(res) {
+ uni.showToast({
+ title: '图片保存失败',
+ icon: 'none'
+ })
+ }
+ })
+ }
+ })
+ // #endif
+ // #ifdef H5
+ uni.previewImage({
+ urls: [file]
+ });
+ // #endif
+ }
+}
+
+export default {
+ create: poster.create,
+ generatePoster: poster.generatePoster,
+ getImage: poster.getImage,
+ getImagebyBase64: poster.getImagebyBase64,
+ saveImage: poster.saveImage
+};
\ No newline at end of file
diff --git a/components/firstui/fui-preview/fui-preview.vue b/components/firstui/fui-preview/fui-preview.vue
new file mode 100644
index 0000000..75c0ef9
--- /dev/null
+++ b/components/firstui/fui-preview/fui-preview.vue
@@ -0,0 +1,552 @@
+
+
+
+
+
+ {{pvd[label] || ''}}
+ {{pvd[value] || ''}}
+
+
+
+
+
+ {{item[label]}}
+
+ {{item[value]}}
+
+
+
+ {{item[value]}}
+
+
+
+
+
+
+
+ {{btn[text]}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-progress/fui-progress.vue b/components/firstui/fui-progress/fui-progress.vue
new file mode 100644
index 0000000..8bcd2b1
--- /dev/null
+++ b/components/firstui/fui-progress/fui-progress.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ percentage }}%
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-puzzle-verify/fui-puzzle-verify.vue b/components/firstui/fui-puzzle-verify/fui-puzzle-verify.vue
new file mode 100644
index 0000000..dc38b7f
--- /dev/null
+++ b/components/firstui/fui-puzzle-verify/fui-puzzle-verify.vue
@@ -0,0 +1,426 @@
+
+
+
+
+ {{ title }}
+ 拖动下方滑块完成拼图
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-puzzle-verify/index.wxs b/components/firstui/fui-puzzle-verify/index.wxs
new file mode 100644
index 0000000..40c6ee5
--- /dev/null
+++ b/components/firstui/fui-puzzle-verify/index.wxs
@@ -0,0 +1,147 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 40 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var twidth = 300
+var swidth = 32
+var start = 0
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function bool(str) {
+ return str === 'true' || str == true ? true : false
+}
+
+function getSlipDistance(left) {
+ var width = twidth - start - 44
+ var distance = left / (twidth - swidth) * width
+ return distance > width ? width : distance
+}
+
+function styleChange(left, ins) {
+ if (!ins || !ins.selectComponent('.fui-sc__slot-box')) return;
+ var slotLeft = getSlipDistance(left)
+ var slider = ins.selectComponent('.fui-sc__slider')
+ var slot = ins.selectComponent('.fui-sc__slot-box')
+ if (!slider || !slot) return;
+
+ if (left == 0) {
+ slider.removeClass('fui-pv__un-ani')
+ slot.removeClass('fui-pv__un-ani')
+ slider.addClass('fui-sc__reset-ani')
+ slot.addClass('fui-sc__reset-ani')
+ } else {
+ slider.removeClass('fui-sc__reset-ani')
+ slot.removeClass('fui-sc__reset-ani')
+ slider.addClass('fui-pv__un-ani')
+ slot.addClass('fui-pv__un-ani')
+ }
+ slider.setStyle({
+ transform: 'translate3d(' + left + 'px,0,0)'
+ })
+ slot.setStyle({
+ transform: 'translate3d(' + slotLeft + 'px,0,0)'
+ })
+}
+
+function touchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0]
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ state.startX = touch.pageX
+ start = +dataset.start
+ swidth = +dataset.swidth
+ twidth = +dataset.width
+ //H5获取bool值为undefined
+ state.disabled = (+dataset.disabled) == 1 ? true : false
+}
+
+function touchmove(e, ins, event) {
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ touch = e.touches[0] || e.changedTouches[0]
+ }
+ if (state.disabled) return;
+ var pageX = touch.pageX;
+ var left = pageX - state.startX + (state.lastLeft || 0);
+ left = left < 0 ? 0 : left;
+ var width = twidth - swidth;
+ left = left >= width ? width : left;
+ state.startX = pageX
+ state.lastLeft = left
+ styleChange(left, ins)
+}
+
+function touchend(e, ins, event) {
+ var state = {}
+ if (isH5 && isPC()) {
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ }
+ if (state.disabled) return;
+ var slotLeft = getSlipDistance(state.lastLeft)
+ //后端验证
+ ins.callMethod('verify', {
+ slip: slotLeft
+ })
+}
+
+function slidereset(reset, oldreset, owner, ins) {
+ var state = ins.getState()
+ if (reset > 0) {
+ state.startX = 0;
+ state.lastLeft = 0;
+ state.disabled = false;
+ styleChange(0, owner)
+ }
+}
+
+var movable = false;
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ movable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchend(event, ins, e)
+ movable = false
+ }
+}
+
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ touchend: touchend,
+ mousedown: mousedown,
+ slidereset: slidereset
+}
\ No newline at end of file
diff --git a/components/firstui/fui-puzzle-verify/mpjs.js b/components/firstui/fui-puzzle-verify/mpjs.js
new file mode 100644
index 0000000..259959a
--- /dev/null
+++ b/components/firstui/fui-puzzle-verify/mpjs.js
@@ -0,0 +1,68 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 4 0 72 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS || MP-WEIXIN || H5
+export default {
+ data() {
+ return {
+ transform: '',
+ transformSlot: '',
+ startX: 0,
+ lastLeft: 0,
+ resetAni: false
+ }
+ },
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(0)
+ }
+ },
+ methods: {
+ getSlipDistance(left) {
+ let width = this.width - this.x - 44
+ let distance = left / (this.width - (this.sliderH * 2)) * width
+ return distance > width ? width : distance
+ },
+ styleChange(left) {
+ if (left == 0) {
+ this.resetAni = true
+ } else {
+ this.resetAni = false
+ }
+ let slotLeft = this.getSlipDistance(left)
+ this.transformSlot = 'translate3d(' + slotLeft + 'px,0,0)'
+ this.transform = 'translate3d(' + left + 'px,0,0)'
+ },
+ touchstart(e) {
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.clientX
+ },
+ touchmove(e) {
+ if (this.isPass || this.disabled || !this.cutSrc || !this.isShow) return;
+ let touch = e.touches[0] || e.changedTouches[0]
+ let pageX = touch.clientX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.width - (this.sliderH * 2);
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ this.styleChange(left)
+ },
+ touchend(e) {
+ if (this.isPass || this.disabled || !this.cutSrc || !this.isShow) return;
+ //前端验证
+ let slotLeft = this.getSlipDistance(this.lastLeft)
+ //后端验证
+ this.verify({
+ slip: slotLeft
+ })
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-puzzle-verify/weex.js b/components/firstui/fui-puzzle-verify/weex.js
new file mode 100644
index 0000000..eb6dd80
--- /dev/null
+++ b/components/firstui/fui-puzzle-verify/weex.js
@@ -0,0 +1,115 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 14 0 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+const animation = uni.requireNativePlugin('animation');
+export default {
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this._animation(0)
+ }
+ },
+ created() {
+ this.startX = 0
+ this.lastLeft = 0
+ this.imgRef = null
+ this.sliderRef = null
+ },
+ methods: {
+ openAni() {
+ this.isShow = true;
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.getEl()
+ this._ani(true);
+ }, 50);
+ });
+ },
+ closeAni(type) {
+ this._ani(false);
+ },
+ _ani(type) {
+ let styles = {
+ opacity: type ? 1 : 0
+ };
+ if (!this.$refs['fui_sc_ani']) return;
+ animation.transition(
+ this.$refs['fui_sc_ani'].ref, {
+ styles,
+ duration: 200, //ms
+ timingFunction: 'ease-in',
+ needLayout: false,
+ delay: 0 //ms
+ },
+ () => {
+ if (!type) {
+ this.isShow = false;
+ }
+ }
+ );
+ },
+ getEl() {
+ this.imgRef = this.$refs['imgRef'].ref
+ this.sliderRef = this.$refs['sliderRef'].ref;
+ },
+ getSlipDistance(left) {
+ let width = this.width - this.x - 44
+ let distance = left / (this.width - (this.sliderH * 2)) * width
+ return distance > width ? width : distance
+ },
+ _animation(left) {
+ let slotLeft = this.getSlipDistance(left).toFixed(2)
+ left = left.toFixed(2)
+ if (!this.imgRef || !this.sliderRef) return;
+ animation.transition(this.imgRef, {
+ styles: {
+ transform: 'translate(' + slotLeft + 'px,0)'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ animation.transition(this.sliderRef, {
+ styles: {
+ transform: 'translate(' + left + 'px,0)'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ },
+ touchstart(e) {
+ if (this.isPass || this.disabled || !this.cutSrc || !this.isShow) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.screenX
+ },
+ touchmove(e) {
+ if (this.isPass || this.disabled || !this.cutSrc || !this.isShow) return;
+ let touch = e.changedTouches[0];
+ let pageX = touch.screenX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.width - (this.sliderH * 2);
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ this._animation(left)
+ },
+ touchend(e) {
+ if (this.isPass || this.disabled || !this.cutSrc || !this.isShow) return;
+ let slotLeft = this.getSlipDistance(this.lastLeft)
+ //后端验证
+ this.verify({
+ slip: slotLeft
+ })
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qr/index.js b/components/firstui/fui-qrcode/fui-qr/index.js
new file mode 100644
index 0000000..fda44d5
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/index.js
@@ -0,0 +1,17 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 1407 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import QRCode from './lib/QRCode.js'
+import ErrorCorrectLevel from './lib/ErrorCorrectLevel.js'
+
+var qrcode = function(data, opt) {
+ opt = opt || {};
+ var qr = new QRCode(opt.typeNumber || -1,
+ opt.errorCorrectLevel || ErrorCorrectLevel.H);
+ qr.addData(data);
+ qr.make();
+
+ return qr;
+};
+
+qrcode.ErrorCorrectLevel = ErrorCorrectLevel;
+
+export default qrcode;
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/8BitByte.js b/components/firstui/fui-qrcode/fui-qr/lib/8BitByte.js
new file mode 100644
index 0000000..afc05c9
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/8BitByte.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 1 4 0725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import mode from './mode.js'
+
+function QR8bitByte(data) {
+ this.mode = mode.MODE_8BIT_BYTE;
+ this.data = data;
+}
+
+QR8bitByte.prototype = {
+
+ getLength : function(buffer) {
+ return this.data.length;
+ },
+
+ write : function(buffer) {
+ for (var i = 0; i < this.data.length; i++) {
+ // not JIS ...
+ buffer.put(this.data.charCodeAt(i), 8);
+ }
+ }
+};
+
+export default QR8bitByte;
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/BitBuffer.js b/components/firstui/fui-qrcode/fui-qr/lib/BitBuffer.js
new file mode 100644
index 0000000..c07eb29
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/BitBuffer.js
@@ -0,0 +1,39 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 1 40 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+function QRBitBuffer() {
+ this.buffer = new Array();
+ this.length = 0;
+}
+
+QRBitBuffer.prototype = {
+
+ get : function(index) {
+ var bufIndex = Math.floor(index / 8);
+ return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
+ },
+
+ put : function(num, length) {
+ for (var i = 0; i < length; i++) {
+ this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
+ }
+ },
+
+ getLengthInBits : function() {
+ return this.length;
+ },
+
+ putBit : function(bit) {
+
+ var bufIndex = Math.floor(this.length / 8);
+ if (this.buffer.length <= bufIndex) {
+ this.buffer.push(0);
+ }
+
+ if (bit) {
+ this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) );
+ }
+
+ this.length++;
+ }
+};
+
+export default QRBitBuffer;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/ErrorCorrectLevel.js b/components/firstui/fui-qrcode/fui-qr/lib/ErrorCorrectLevel.js
new file mode 100644
index 0000000..7084369
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/ErrorCorrectLevel.js
@@ -0,0 +1,7 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 614072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default {
+ L : 1,
+ M : 0,
+ Q : 3,
+ H : 2
+};
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/LICENSE-qrcode b/components/firstui/fui-qrcode/fui-qr/lib/LICENSE-qrcode
new file mode 100644
index 0000000..aedcf72
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/LICENSE-qrcode
@@ -0,0 +1,7 @@
+Copyright (c) 2009 Kazuhiko Arase
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/Polynomial.js b/components/firstui/fui-qrcode/fui-qr/lib/Polynomial.js
new file mode 100644
index 0000000..e692502
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/Polynomial.js
@@ -0,0 +1,68 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 14 0 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import math from './math.js'
+
+function QRPolynomial(num, shift) {
+
+ if (num.length == undefined) {
+ throw new Error(num.length + "/" + shift);
+ }
+
+ var offset = 0;
+
+ while (offset < num.length && num[offset] == 0) {
+ offset++;
+ }
+
+ this.num = new Array(num.length - offset + shift);
+ for (var i = 0; i < num.length - offset; i++) {
+ this.num[i] = num[i + offset];
+ }
+}
+
+QRPolynomial.prototype = {
+
+ get : function(index) {
+ return this.num[index];
+ },
+
+ getLength : function() {
+ return this.num.length;
+ },
+
+ multiply : function(e) {
+
+ var num = new Array(this.getLength() + e.getLength() - 1);
+
+ for (var i = 0; i < this.getLength(); i++) {
+ for (var j = 0; j < e.getLength(); j++) {
+ num[i + j] ^= math.gexp(math.glog(this.get(i) ) + math.glog(e.get(j) ) );
+ }
+ }
+
+ return new QRPolynomial(num, 0);
+ },
+
+ mod : function(e) {
+
+ if (this.getLength() - e.getLength() < 0) {
+ return this;
+ }
+
+ var ratio = math.glog(this.get(0) ) - math.glog(e.get(0) );
+
+ var num = new Array(this.getLength() );
+
+ for (var i = 0; i < this.getLength(); i++) {
+ num[i] = this.get(i);
+ }
+
+ for (var i = 0; i < e.getLength(); i++) {
+ num[i] ^= math.gexp(math.glog(e.get(i) ) + ratio);
+ }
+
+ // recursive call
+ return new QRPolynomial(num, 0).mod(e);
+ }
+};
+
+export default QRPolynomial;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/QRCode.js b/components/firstui/fui-qrcode/fui-qr/lib/QRCode.js
new file mode 100644
index 0000000..1b8bcc9
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/QRCode.js
@@ -0,0 +1,438 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 6 14 07 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import BitByte from './8BitByte.js'
+import RSBlock from './RSBlock.js'
+import BitBuffer from './BitBuffer.js'
+import util from './util.js'
+import Polynomial from './Polynomial.js'
+
+function QRCode(typeNumber, errorCorrectLevel) {
+ this.typeNumber = typeNumber;
+ this.errorCorrectLevel = errorCorrectLevel;
+ this.modules = null;
+ this.moduleCount = 0;
+ this.dataCache = null;
+ this.dataList = [];
+}
+
+// for client side minification
+var proto = QRCode.prototype;
+
+proto.addData = function(data) {
+ var newData = new BitByte(data);
+ this.dataList.push(newData);
+ this.dataCache = null;
+};
+
+proto.isDark = function(row, col) {
+ if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
+ throw new Error(row + "," + col);
+ }
+ return this.modules[row][col];
+};
+
+proto.getModuleCount = function() {
+ return this.moduleCount;
+};
+
+proto.make = function() {
+ // Calculate automatically typeNumber if provided is < 1
+ if (this.typeNumber < 1 ){
+ var typeNumber = 1;
+ for (typeNumber = 1; typeNumber < 40; typeNumber++) {
+ var rsBlocks = RSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
+
+ var buffer = new BitBuffer();
+ var totalDataCount = 0;
+ for (var i = 0; i < rsBlocks.length; i++) {
+ totalDataCount += rsBlocks[i].dataCount;
+ }
+
+ for (var i = 0; i < this.dataList.length; i++) {
+ var data = this.dataList[i];
+ buffer.put(data.mode, 4);
+ buffer.put(data.getLength(), util.getLengthInBits(data.mode, typeNumber) );
+ data.write(buffer);
+ }
+ if (buffer.getLengthInBits() <= totalDataCount * 8)
+ break;
+ }
+ this.typeNumber = typeNumber;
+ }
+ this.makeImpl(false, this.getBestMaskPattern() );
+};
+
+proto.makeImpl = function(test, maskPattern) {
+
+ this.moduleCount = this.typeNumber * 4 + 17;
+ this.modules = new Array(this.moduleCount);
+
+ for (var row = 0; row < this.moduleCount; row++) {
+
+ this.modules[row] = new Array(this.moduleCount);
+
+ for (var col = 0; col < this.moduleCount; col++) {
+ this.modules[row][col] = null;//(col + row) % 3;
+ }
+ }
+
+ this.setupPositionProbePattern(0, 0);
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
+ this.setupPositionAdjustPattern();
+ this.setupTimingPattern();
+ this.setupTypeInfo(test, maskPattern);
+
+ if (this.typeNumber >= 7) {
+ this.setupTypeNumber(test);
+ }
+
+ if (this.dataCache == null) {
+ this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
+ }
+
+ this.mapData(this.dataCache, maskPattern);
+};
+
+proto.setupPositionProbePattern = function(row, col) {
+
+ for (var r = -1; r <= 7; r++) {
+
+ if (row + r <= -1 || this.moduleCount <= row + r) continue;
+
+ for (var c = -1; c <= 7; c++) {
+
+ if (col + c <= -1 || this.moduleCount <= col + c) continue;
+
+ if ( (0 <= r && r <= 6 && (c == 0 || c == 6) )
+ || (0 <= c && c <= 6 && (r == 0 || r == 6) )
+ || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
+ this.modules[row + r][col + c] = true;
+ } else {
+ this.modules[row + r][col + c] = false;
+ }
+ }
+ }
+};
+
+proto.getBestMaskPattern = function() {
+
+ var minLostPoint = 0;
+ var pattern = 0;
+
+ for (var i = 0; i < 8; i++) {
+
+ this.makeImpl(true, i);
+
+ var lostPoint = util.getLostPoint(this);
+
+ if (i == 0 || minLostPoint > lostPoint) {
+ minLostPoint = lostPoint;
+ pattern = i;
+ }
+ }
+
+ return pattern;
+};
+
+proto.createMovieClip = function(target_mc, instance_name, depth) {
+
+ var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
+ var cs = 1;
+
+ this.make();
+
+ for (var row = 0; row < this.modules.length; row++) {
+
+ var y = row * cs;
+
+ for (var col = 0; col < this.modules[row].length; col++) {
+
+ var x = col * cs;
+ var dark = this.modules[row][col];
+
+ if (dark) {
+ qr_mc.beginFill(0, 100);
+ qr_mc.moveTo(x, y);
+ qr_mc.lineTo(x + cs, y);
+ qr_mc.lineTo(x + cs, y + cs);
+ qr_mc.lineTo(x, y + cs);
+ qr_mc.endFill();
+ }
+ }
+ }
+
+ return qr_mc;
+};
+
+proto.setupTimingPattern = function() {
+
+ for (var r = 8; r < this.moduleCount - 8; r++) {
+ if (this.modules[r][6] != null) {
+ continue;
+ }
+ this.modules[r][6] = (r % 2 == 0);
+ }
+
+ for (var c = 8; c < this.moduleCount - 8; c++) {
+ if (this.modules[6][c] != null) {
+ continue;
+ }
+ this.modules[6][c] = (c % 2 == 0);
+ }
+};
+
+proto.setupPositionAdjustPattern = function() {
+
+ var pos = util.getPatternPosition(this.typeNumber);
+
+ for (var i = 0; i < pos.length; i++) {
+
+ for (var j = 0; j < pos.length; j++) {
+
+ var row = pos[i];
+ var col = pos[j];
+
+ if (this.modules[row][col] != null) {
+ continue;
+ }
+
+ for (var r = -2; r <= 2; r++) {
+
+ for (var c = -2; c <= 2; c++) {
+
+ if (r == -2 || r == 2 || c == -2 || c == 2
+ || (r == 0 && c == 0) ) {
+ this.modules[row + r][col + c] = true;
+ } else {
+ this.modules[row + r][col + c] = false;
+ }
+ }
+ }
+ }
+ }
+};
+
+proto.setupTypeNumber = function(test) {
+
+ var bits = util.getBCHTypeNumber(this.typeNumber);
+
+ for (var i = 0; i < 18; i++) {
+ var mod = (!test && ( (bits >> i) & 1) == 1);
+ this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
+ }
+
+ for (var i = 0; i < 18; i++) {
+ var mod = (!test && ( (bits >> i) & 1) == 1);
+ this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
+ }
+};
+
+proto.setupTypeInfo = function(test, maskPattern) {
+
+ var data = (this.errorCorrectLevel << 3) | maskPattern;
+ var bits = util.getBCHTypeInfo(data);
+
+ // vertical
+ for (var i = 0; i < 15; i++) {
+
+ var mod = (!test && ( (bits >> i) & 1) == 1);
+
+ if (i < 6) {
+ this.modules[i][8] = mod;
+ } else if (i < 8) {
+ this.modules[i + 1][8] = mod;
+ } else {
+ this.modules[this.moduleCount - 15 + i][8] = mod;
+ }
+ }
+
+ // horizontal
+ for (var i = 0; i < 15; i++) {
+
+ var mod = (!test && ( (bits >> i) & 1) == 1);
+
+ if (i < 8) {
+ this.modules[8][this.moduleCount - i - 1] = mod;
+ } else if (i < 9) {
+ this.modules[8][15 - i - 1 + 1] = mod;
+ } else {
+ this.modules[8][15 - i - 1] = mod;
+ }
+ }
+
+ // fixed module
+ this.modules[this.moduleCount - 8][8] = (!test);
+};
+
+proto.mapData = function(data, maskPattern) {
+
+ var inc = -1;
+ var row = this.moduleCount - 1;
+ var bitIndex = 7;
+ var byteIndex = 0;
+
+ for (var col = this.moduleCount - 1; col > 0; col -= 2) {
+
+ if (col == 6) col--;
+
+ while (true) {
+
+ for (var c = 0; c < 2; c++) {
+
+ if (this.modules[row][col - c] == null) {
+
+ var dark = false;
+
+ if (byteIndex < data.length) {
+ dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
+ }
+
+ var mask = util.getMask(maskPattern, row, col - c);
+
+ if (mask) {
+ dark = !dark;
+ }
+
+ this.modules[row][col - c] = dark;
+ bitIndex--;
+
+ if (bitIndex == -1) {
+ byteIndex++;
+ bitIndex = 7;
+ }
+ }
+ }
+
+ row += inc;
+
+ if (row < 0 || this.moduleCount <= row) {
+ row -= inc;
+ inc = -inc;
+ break;
+ }
+ }
+ }
+};
+
+QRCode.PAD0 = 0xEC;
+QRCode.PAD1 = 0x11;
+
+QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
+
+ var rsBlocks = RSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
+
+ var buffer = new BitBuffer();
+
+ for (var i = 0; i < dataList.length; i++) {
+ var data = dataList[i];
+ buffer.put(data.mode, 4);
+ buffer.put(data.getLength(), util.getLengthInBits(data.mode, typeNumber) );
+ data.write(buffer);
+ }
+
+ // calc num max data.
+ var totalDataCount = 0;
+ for (var i = 0; i < rsBlocks.length; i++) {
+ totalDataCount += rsBlocks[i].dataCount;
+ }
+
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
+ throw new Error("code length overflow. ("
+ + buffer.getLengthInBits()
+ + ">"
+ + totalDataCount * 8
+ + ")");
+ }
+
+ // end code
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
+ buffer.put(0, 4);
+ }
+
+ // padding
+ while (buffer.getLengthInBits() % 8 != 0) {
+ buffer.putBit(false);
+ }
+
+ // padding
+ while (true) {
+
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
+ break;
+ }
+ buffer.put(QRCode.PAD0, 8);
+
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
+ break;
+ }
+ buffer.put(QRCode.PAD1, 8);
+ }
+
+ return QRCode.createBytes(buffer, rsBlocks);
+};
+
+QRCode.createBytes = function(buffer, rsBlocks) {
+
+ var offset = 0;
+
+ var maxDcCount = 0;
+ var maxEcCount = 0;
+
+ var dcdata = new Array(rsBlocks.length);
+ var ecdata = new Array(rsBlocks.length);
+
+ for (var r = 0; r < rsBlocks.length; r++) {
+
+ var dcCount = rsBlocks[r].dataCount;
+ var ecCount = rsBlocks[r].totalCount - dcCount;
+
+ maxDcCount = Math.max(maxDcCount, dcCount);
+ maxEcCount = Math.max(maxEcCount, ecCount);
+
+ dcdata[r] = new Array(dcCount);
+
+ for (var i = 0; i < dcdata[r].length; i++) {
+ dcdata[r][i] = 0xff & buffer.buffer[i + offset];
+ }
+ offset += dcCount;
+
+ var rsPoly = util.getErrorCorrectPolynomial(ecCount);
+ var rawPoly = new Polynomial(dcdata[r], rsPoly.getLength() - 1);
+
+ var modPoly = rawPoly.mod(rsPoly);
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
+ for (var i = 0; i < ecdata[r].length; i++) {
+ var modIndex = i + modPoly.getLength() - ecdata[r].length;
+ ecdata[r][i] = (modIndex >= 0)? modPoly.get(modIndex) : 0;
+ }
+
+ }
+
+ var totalCodeCount = 0;
+ for (var i = 0; i < rsBlocks.length; i++) {
+ totalCodeCount += rsBlocks[i].totalCount;
+ }
+
+ var data = new Array(totalCodeCount);
+ var index = 0;
+
+ for (var i = 0; i < maxDcCount; i++) {
+ for (var r = 0; r < rsBlocks.length; r++) {
+ if (i < dcdata[r].length) {
+ data[index++] = dcdata[r][i];
+ }
+ }
+ }
+
+ for (var i = 0; i < maxEcCount; i++) {
+ for (var r = 0; r < rsBlocks.length; r++) {
+ if (i < ecdata[r].length) {
+ data[index++] = ecdata[r][i];
+ }
+ }
+ }
+
+ return data;
+};
+
+export default QRCode;
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/RSBlock.js b/components/firstui/fui-qrcode/fui-qr/lib/RSBlock.js
new file mode 100644
index 0000000..00b4be3
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/RSBlock.js
@@ -0,0 +1,300 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8614 0 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// ErrorCorrectLevel
+import ECL from './ErrorCorrectLevel.js'
+
+function QRRSBlock(totalCount, dataCount) {
+ this.totalCount = totalCount;
+ this.dataCount = dataCount;
+}
+
+QRRSBlock.RS_BLOCK_TABLE = [
+
+ // L
+ // M
+ // Q
+ // H
+
+ // 1
+ [1, 26, 19],
+ [1, 26, 16],
+ [1, 26, 13],
+ [1, 26, 9],
+
+ // 2
+ [1, 44, 34],
+ [1, 44, 28],
+ [1, 44, 22],
+ [1, 44, 16],
+
+ // 3
+ [1, 70, 55],
+ [1, 70, 44],
+ [2, 35, 17],
+ [2, 35, 13],
+
+ // 4
+ [1, 100, 80],
+ [2, 50, 32],
+ [2, 50, 24],
+ [4, 25, 9],
+
+ // 5
+ [1, 134, 108],
+ [2, 67, 43],
+ [2, 33, 15, 2, 34, 16],
+ [2, 33, 11, 2, 34, 12],
+
+ // 6
+ [2, 86, 68],
+ [4, 43, 27],
+ [4, 43, 19],
+ [4, 43, 15],
+
+ // 7
+ [2, 98, 78],
+ [4, 49, 31],
+ [2, 32, 14, 4, 33, 15],
+ [4, 39, 13, 1, 40, 14],
+
+ // 8
+ [2, 121, 97],
+ [2, 60, 38, 2, 61, 39],
+ [4, 40, 18, 2, 41, 19],
+ [4, 40, 14, 2, 41, 15],
+
+ // 9
+ [2, 146, 116],
+ [3, 58, 36, 2, 59, 37],
+ [4, 36, 16, 4, 37, 17],
+ [4, 36, 12, 4, 37, 13],
+
+ // 10
+ [2, 86, 68, 2, 87, 69],
+ [4, 69, 43, 1, 70, 44],
+ [6, 43, 19, 2, 44, 20],
+ [6, 43, 15, 2, 44, 16],
+
+ // 11
+ [4, 101, 81],
+ [1, 80, 50, 4, 81, 51],
+ [4, 50, 22, 4, 51, 23],
+ [3, 36, 12, 8, 37, 13],
+
+ // 12
+ [2, 116, 92, 2, 117, 93],
+ [6, 58, 36, 2, 59, 37],
+ [4, 46, 20, 6, 47, 21],
+ [7, 42, 14, 4, 43, 15],
+
+ // 13
+ [4, 133, 107],
+ [8, 59, 37, 1, 60, 38],
+ [8, 44, 20, 4, 45, 21],
+ [12, 33, 11, 4, 34, 12],
+
+ // 14
+ [3, 145, 115, 1, 146, 116],
+ [4, 64, 40, 5, 65, 41],
+ [11, 36, 16, 5, 37, 17],
+ [11, 36, 12, 5, 37, 13],
+
+ // 15
+ [5, 109, 87, 1, 110, 88],
+ [5, 65, 41, 5, 66, 42],
+ [5, 54, 24, 7, 55, 25],
+ [11, 36, 12],
+
+ // 16
+ [5, 122, 98, 1, 123, 99],
+ [7, 73, 45, 3, 74, 46],
+ [15, 43, 19, 2, 44, 20],
+ [3, 45, 15, 13, 46, 16],
+
+ // 17
+ [1, 135, 107, 5, 136, 108],
+ [10, 74, 46, 1, 75, 47],
+ [1, 50, 22, 15, 51, 23],
+ [2, 42, 14, 17, 43, 15],
+
+ // 18
+ [5, 150, 120, 1, 151, 121],
+ [9, 69, 43, 4, 70, 44],
+ [17, 50, 22, 1, 51, 23],
+ [2, 42, 14, 19, 43, 15],
+
+ // 19
+ [3, 141, 113, 4, 142, 114],
+ [3, 70, 44, 11, 71, 45],
+ [17, 47, 21, 4, 48, 22],
+ [9, 39, 13, 16, 40, 14],
+
+ // 20
+ [3, 135, 107, 5, 136, 108],
+ [3, 67, 41, 13, 68, 42],
+ [15, 54, 24, 5, 55, 25],
+ [15, 43, 15, 10, 44, 16],
+
+ // 21
+ [4, 144, 116, 4, 145, 117],
+ [17, 68, 42],
+ [17, 50, 22, 6, 51, 23],
+ [19, 46, 16, 6, 47, 17],
+
+ // 22
+ [2, 139, 111, 7, 140, 112],
+ [17, 74, 46],
+ [7, 54, 24, 16, 55, 25],
+ [34, 37, 13],
+
+ // 23
+ [4, 151, 121, 5, 152, 122],
+ [4, 75, 47, 14, 76, 48],
+ [11, 54, 24, 14, 55, 25],
+ [16, 45, 15, 14, 46, 16],
+
+ // 24
+ [6, 147, 117, 4, 148, 118],
+ [6, 73, 45, 14, 74, 46],
+ [11, 54, 24, 16, 55, 25],
+ [30, 46, 16, 2, 47, 17],
+
+ // 25
+ [8, 132, 106, 4, 133, 107],
+ [8, 75, 47, 13, 76, 48],
+ [7, 54, 24, 22, 55, 25],
+ [22, 45, 15, 13, 46, 16],
+
+ // 26
+ [10, 142, 114, 2, 143, 115],
+ [19, 74, 46, 4, 75, 47],
+ [28, 50, 22, 6, 51, 23],
+ [33, 46, 16, 4, 47, 17],
+
+ // 27
+ [8, 152, 122, 4, 153, 123],
+ [22, 73, 45, 3, 74, 46],
+ [8, 53, 23, 26, 54, 24],
+ [12, 45, 15, 28, 46, 16],
+
+ // 28
+ [3, 147, 117, 10, 148, 118],
+ [3, 73, 45, 23, 74, 46],
+ [4, 54, 24, 31, 55, 25],
+ [11, 45, 15, 31, 46, 16],
+
+ // 29
+ [7, 146, 116, 7, 147, 117],
+ [21, 73, 45, 7, 74, 46],
+ [1, 53, 23, 37, 54, 24],
+ [19, 45, 15, 26, 46, 16],
+
+ // 30
+ [5, 145, 115, 10, 146, 116],
+ [19, 75, 47, 10, 76, 48],
+ [15, 54, 24, 25, 55, 25],
+ [23, 45, 15, 25, 46, 16],
+
+ // 31
+ [13, 145, 115, 3, 146, 116],
+ [2, 74, 46, 29, 75, 47],
+ [42, 54, 24, 1, 55, 25],
+ [23, 45, 15, 28, 46, 16],
+
+ // 32
+ [17, 145, 115],
+ [10, 74, 46, 23, 75, 47],
+ [10, 54, 24, 35, 55, 25],
+ [19, 45, 15, 35, 46, 16],
+
+ // 33
+ [17, 145, 115, 1, 146, 116],
+ [14, 74, 46, 21, 75, 47],
+ [29, 54, 24, 19, 55, 25],
+ [11, 45, 15, 46, 46, 16],
+
+ // 34
+ [13, 145, 115, 6, 146, 116],
+ [14, 74, 46, 23, 75, 47],
+ [44, 54, 24, 7, 55, 25],
+ [59, 46, 16, 1, 47, 17],
+
+ // 35
+ [12, 151, 121, 7, 152, 122],
+ [12, 75, 47, 26, 76, 48],
+ [39, 54, 24, 14, 55, 25],
+ [22, 45, 15, 41, 46, 16],
+
+ // 36
+ [6, 151, 121, 14, 152, 122],
+ [6, 75, 47, 34, 76, 48],
+ [46, 54, 24, 10, 55, 25],
+ [2, 45, 15, 64, 46, 16],
+
+ // 37
+ [17, 152, 122, 4, 153, 123],
+ [29, 74, 46, 14, 75, 47],
+ [49, 54, 24, 10, 55, 25],
+ [24, 45, 15, 46, 46, 16],
+
+ // 38
+ [4, 152, 122, 18, 153, 123],
+ [13, 74, 46, 32, 75, 47],
+ [48, 54, 24, 14, 55, 25],
+ [42, 45, 15, 32, 46, 16],
+
+ // 39
+ [20, 147, 117, 4, 148, 118],
+ [40, 75, 47, 7, 76, 48],
+ [43, 54, 24, 22, 55, 25],
+ [10, 45, 15, 67, 46, 16],
+
+ // 40
+ [19, 148, 118, 6, 149, 119],
+ [18, 75, 47, 31, 76, 48],
+ [34, 54, 24, 34, 55, 25],
+ [20, 45, 15, 61, 46, 16]
+];
+
+QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
+
+ var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
+
+ if (rsBlock == undefined) {
+ throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
+ }
+
+ var length = rsBlock.length / 3;
+
+ var list = new Array();
+
+ for (var i = 0; i < length; i++) {
+
+ var count = rsBlock[i * 3 + 0];
+ var totalCount = rsBlock[i * 3 + 1];
+ var dataCount = rsBlock[i * 3 + 2];
+
+ for (var j = 0; j < count; j++) {
+ list.push(new QRRSBlock(totalCount, dataCount) );
+ }
+ }
+
+ return list;
+}
+
+QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
+
+ switch(errorCorrectLevel) {
+ case ECL.L :
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
+ case ECL.M :
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
+ case ECL.Q :
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
+ case ECL.H :
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
+ default :
+ return undefined;
+ }
+}
+
+export default QRRSBlock;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/math.js b/components/firstui/fui-qrcode/fui-qr/lib/math.js
new file mode 100644
index 0000000..8a73ca8
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/math.js
@@ -0,0 +1,45 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 14072 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var QRMath = {
+
+ glog : function(n) {
+
+ if (n < 1) {
+ throw new Error("glog(" + n + ")");
+ }
+
+ return QRMath.LOG_TABLE[n];
+ },
+
+ gexp : function(n) {
+
+ while (n < 0) {
+ n += 255;
+ }
+
+ while (n >= 256) {
+ n -= 255;
+ }
+
+ return QRMath.EXP_TABLE[n];
+ },
+
+ EXP_TABLE : new Array(256),
+
+ LOG_TABLE : new Array(256)
+
+};
+
+for (var i = 0; i < 8; i++) {
+ QRMath.EXP_TABLE[i] = 1 << i;
+}
+for (var i = 8; i < 256; i++) {
+ QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4]
+ ^ QRMath.EXP_TABLE[i - 5]
+ ^ QRMath.EXP_TABLE[i - 6]
+ ^ QRMath.EXP_TABLE[i - 8];
+}
+for (var i = 0; i < 255; i++) {
+ QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i;
+}
+
+export default QRMath;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/mode.js b/components/firstui/fui-qrcode/fui-qr/lib/mode.js
new file mode 100644
index 0000000..4907573
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/mode.js
@@ -0,0 +1,7 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 4 0725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default {
+ MODE_NUMBER : 1 << 0,
+ MODE_ALPHA_NUM : 1 << 1,
+ MODE_8BIT_BYTE : 1 << 2,
+ MODE_KANJI : 1 << 3
+};
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qr/lib/util.js b/components/firstui/fui-qrcode/fui-qr/lib/util.js
new file mode 100644
index 0000000..f64e8a4
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qr/lib/util.js
@@ -0,0 +1,280 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 1 40725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import Mode from './mode.js'
+import Polynomial from './Polynomial.js'
+import math from './math.js'
+
+var QRMaskPattern = {
+ PATTERN000 : 0,
+ PATTERN001 : 1,
+ PATTERN010 : 2,
+ PATTERN011 : 3,
+ PATTERN100 : 4,
+ PATTERN101 : 5,
+ PATTERN110 : 6,
+ PATTERN111 : 7
+};
+
+var QRUtil = {
+
+ PATTERN_POSITION_TABLE : [
+ [],
+ [6, 18],
+ [6, 22],
+ [6, 26],
+ [6, 30],
+ [6, 34],
+ [6, 22, 38],
+ [6, 24, 42],
+ [6, 26, 46],
+ [6, 28, 50],
+ [6, 30, 54],
+ [6, 32, 58],
+ [6, 34, 62],
+ [6, 26, 46, 66],
+ [6, 26, 48, 70],
+ [6, 26, 50, 74],
+ [6, 30, 54, 78],
+ [6, 30, 56, 82],
+ [6, 30, 58, 86],
+ [6, 34, 62, 90],
+ [6, 28, 50, 72, 94],
+ [6, 26, 50, 74, 98],
+ [6, 30, 54, 78, 102],
+ [6, 28, 54, 80, 106],
+ [6, 32, 58, 84, 110],
+ [6, 30, 58, 86, 114],
+ [6, 34, 62, 90, 118],
+ [6, 26, 50, 74, 98, 122],
+ [6, 30, 54, 78, 102, 126],
+ [6, 26, 52, 78, 104, 130],
+ [6, 30, 56, 82, 108, 134],
+ [6, 34, 60, 86, 112, 138],
+ [6, 30, 58, 86, 114, 142],
+ [6, 34, 62, 90, 118, 146],
+ [6, 30, 54, 78, 102, 126, 150],
+ [6, 24, 50, 76, 102, 128, 154],
+ [6, 28, 54, 80, 106, 132, 158],
+ [6, 32, 58, 84, 110, 136, 162],
+ [6, 26, 54, 82, 110, 138, 166],
+ [6, 30, 58, 86, 114, 142, 170]
+ ],
+
+ G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
+ G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
+ G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
+
+ getBCHTypeInfo : function(data) {
+ var d = data << 10;
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
+ d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) );
+ }
+ return ( (data << 10) | d) ^ QRUtil.G15_MASK;
+ },
+
+ getBCHTypeNumber : function(data) {
+ var d = data << 12;
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
+ d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) );
+ }
+ return (data << 12) | d;
+ },
+
+ getBCHDigit : function(data) {
+
+ var digit = 0;
+
+ while (data != 0) {
+ digit++;
+ data >>>= 1;
+ }
+
+ return digit;
+ },
+
+ getPatternPosition : function(typeNumber) {
+ return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
+ },
+
+ getMask : function(maskPattern, i, j) {
+
+ switch (maskPattern) {
+
+ case QRMaskPattern.PATTERN000 : return (i + j) % 2 == 0;
+ case QRMaskPattern.PATTERN001 : return i % 2 == 0;
+ case QRMaskPattern.PATTERN010 : return j % 3 == 0;
+ case QRMaskPattern.PATTERN011 : return (i + j) % 3 == 0;
+ case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0;
+ case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 == 0;
+ case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 == 0;
+ case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 == 0;
+
+ default :
+ throw new Error("bad maskPattern:" + maskPattern);
+ }
+ },
+
+ getErrorCorrectPolynomial : function(errorCorrectLength) {
+
+ var a = new Polynomial([1], 0);
+
+ for (var i = 0; i < errorCorrectLength; i++) {
+ a = a.multiply(new Polynomial([1, math.gexp(i)], 0) );
+ }
+
+ return a;
+ },
+
+ getLengthInBits : function(mode, type) {
+
+ if (1 <= type && type < 10) {
+
+ // 1 - 9
+
+ switch(mode) {
+ case Mode.MODE_NUMBER : return 10;
+ case Mode.MODE_ALPHA_NUM : return 9;
+ case Mode.MODE_8BIT_BYTE : return 8;
+ case Mode.MODE_KANJI : return 8;
+ default :
+ throw new Error("mode:" + mode);
+ }
+
+ } else if (type < 27) {
+
+ // 10 - 26
+
+ switch(mode) {
+ case Mode.MODE_NUMBER : return 12;
+ case Mode.MODE_ALPHA_NUM : return 11;
+ case Mode.MODE_8BIT_BYTE : return 16;
+ case Mode.MODE_KANJI : return 10;
+ default :
+ throw new Error("mode:" + mode);
+ }
+
+ } else if (type < 41) {
+
+ // 27 - 40
+
+ switch(mode) {
+ case Mode.MODE_NUMBER : return 14;
+ case Mode.MODE_ALPHA_NUM : return 13;
+ case Mode.MODE_8BIT_BYTE : return 16;
+ case Mode.MODE_KANJI : return 12;
+ default :
+ throw new Error("mode:" + mode);
+ }
+
+ } else {
+ throw new Error("type:" + type);
+ }
+ },
+
+ getLostPoint : function(qrCode) {
+
+ var moduleCount = qrCode.getModuleCount();
+
+ var lostPoint = 0;
+
+ // LEVEL1
+
+ for (var row = 0; row < moduleCount; row++) {
+
+ for (var col = 0; col < moduleCount; col++) {
+
+ var sameCount = 0;
+ var dark = qrCode.isDark(row, col);
+
+ for (var r = -1; r <= 1; r++) {
+
+ if (row + r < 0 || moduleCount <= row + r) {
+ continue;
+ }
+
+ for (var c = -1; c <= 1; c++) {
+
+ if (col + c < 0 || moduleCount <= col + c) {
+ continue;
+ }
+
+ if (r == 0 && c == 0) {
+ continue;
+ }
+
+ if (dark == qrCode.isDark(row + r, col + c) ) {
+ sameCount++;
+ }
+ }
+ }
+
+ if (sameCount > 5) {
+ lostPoint += (3 + sameCount - 5);
+ }
+ }
+ }
+
+ // LEVEL2
+
+ for (var row = 0; row < moduleCount - 1; row++) {
+ for (var col = 0; col < moduleCount - 1; col++) {
+ var count = 0;
+ if (qrCode.isDark(row, col ) ) count++;
+ if (qrCode.isDark(row + 1, col ) ) count++;
+ if (qrCode.isDark(row, col + 1) ) count++;
+ if (qrCode.isDark(row + 1, col + 1) ) count++;
+ if (count == 0 || count == 4) {
+ lostPoint += 3;
+ }
+ }
+ }
+
+ // LEVEL3
+
+ for (var row = 0; row < moduleCount; row++) {
+ for (var col = 0; col < moduleCount - 6; col++) {
+ if (qrCode.isDark(row, col)
+ && !qrCode.isDark(row, col + 1)
+ && qrCode.isDark(row, col + 2)
+ && qrCode.isDark(row, col + 3)
+ && qrCode.isDark(row, col + 4)
+ && !qrCode.isDark(row, col + 5)
+ && qrCode.isDark(row, col + 6) ) {
+ lostPoint += 40;
+ }
+ }
+ }
+
+ for (var col = 0; col < moduleCount; col++) {
+ for (var row = 0; row < moduleCount - 6; row++) {
+ if (qrCode.isDark(row, col)
+ && !qrCode.isDark(row + 1, col)
+ && qrCode.isDark(row + 2, col)
+ && qrCode.isDark(row + 3, col)
+ && qrCode.isDark(row + 4, col)
+ && !qrCode.isDark(row + 5, col)
+ && qrCode.isDark(row + 6, col) ) {
+ lostPoint += 40;
+ }
+ }
+ }
+
+ // LEVEL4
+
+ var darkCount = 0;
+
+ for (var col = 0; col < moduleCount; col++) {
+ for (var row = 0; row < moduleCount; row++) {
+ if (qrCode.isDark(row, col) ) {
+ darkCount++;
+ }
+ }
+ }
+
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
+ lostPoint += ratio * 10;
+
+ return lostPoint;
+ }
+};
+
+export default QRUtil;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/fui-qrcode.vue b/components/firstui/fui-qrcode/fui-qrcode.vue
new file mode 100644
index 0000000..998a37e
--- /dev/null
+++ b/components/firstui/fui-qrcode/fui-qrcode.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/bridge/bridge-weex.js b/components/firstui/fui-qrcode/gcanvas/bridge/bridge-weex.js
new file mode 100644
index 0000000..ddd6adc
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/bridge/bridge-weex.js
@@ -0,0 +1,242 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 140 725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+const isWeex = typeof WXEnvironment !== 'undefined';
+const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform);
+const isWeexAndroid = isWeex && !isWeexIOS;
+
+import GLmethod from '../context-webgl/GLmethod';
+
+const GCanvasModule =
+ (typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) :
+ (typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {};
+
+let isDebugging = false;
+
+let isComboDisabled = false;
+
+const logCommand = (function () {
+ const methodQuery = [];
+ Object.keys(GLmethod).forEach(key => {
+ methodQuery[GLmethod[key]] = key;
+ })
+ const queryMethod = (id) => {
+ return methodQuery[parseInt(id)] || 'NotFoundMethod';
+ }
+ const logCommand = (id, cmds) => {
+ const mId = cmds.split(',')[0];
+ const mName = queryMethod(mId);
+ console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`);
+ }
+ return logCommand;
+})();
+
+function joinArray(arr, sep) {
+ let res = '';
+ for (let i = 0; i < arr.length; i++) {
+ if (i !== 0) {
+ res += sep;
+ }
+ res += arr[i];
+ }
+ return res;
+}
+
+const commandsCache = {}
+
+const GBridge = {
+
+ callEnable: (ref, configArray) => {
+
+ commandsCache[ref] = [];
+
+ return GCanvasModule.enable({
+ componentId: ref,
+ config: configArray
+ });
+ },
+
+ callEnableDebug: () => {
+ isDebugging = true;
+ },
+
+ callEnableDisableCombo: () => {
+ isComboDisabled = true;
+ },
+
+ callSetContextType: function (componentId, context_type) {
+ GCanvasModule.setContextType(context_type, componentId);
+ },
+
+ callReset: function(id){
+ GCanvasModule.resetComponent && canvasModule.resetComponent(componentId);
+ },
+
+ render: isWeexIOS ? function (componentId) {
+ return GCanvasModule.extendCallNative({
+ contextId: componentId,
+ type: 0x60000001
+ });
+ } : function (componentId) {
+ return callGCanvasLinkNative(componentId, 0x60000001, 'render');
+ },
+
+ render2d: isWeexIOS ? function (componentId, commands, callback) {
+
+ if (isDebugging) {
+ console.log('>>> >>> render2d ===');
+ console.log('>>> commands: ' + commands);
+ }
+
+ GCanvasModule.render([commands, callback?true:false], componentId, callback);
+
+ } : function (componentId, commands,callback) {
+
+ if (isDebugging) {
+ console.log('>>> >>> render2d ===');
+ console.log('>>> commands: ' + commands);
+ }
+
+ callGCanvasLinkNative(componentId, 0x20000001, commands);
+ if(callback){
+ callback();
+ }
+ },
+
+ callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) {
+
+ throw 'should not be here anymore ' + cmdArgs;
+
+ } : function (componentId, cmdArgs) {
+
+ throw 'should not be here anymore ' + cmdArgs;
+
+ },
+
+
+ flushNative: isWeexIOS ? function (componentId) {
+
+ const cmdArgs = joinArray(commandsCache[componentId], ';');
+ commandsCache[componentId] = [];
+
+ if (isDebugging) {
+ console.log('>>> >>> flush native ===');
+ console.log('>>> commands: ' + cmdArgs);
+ }
+
+ const result = GCanvasModule.extendCallNative({
+ "contextId": componentId,
+ "type": 0x60000000,
+ "args": cmdArgs
+ });
+
+ const res = result && result.result;
+
+ if (isDebugging) {
+ console.log('>>> result: ' + res);
+ }
+
+ return res;
+
+ } : function (componentId) {
+
+ const cmdArgs = joinArray(commandsCache[componentId], ';');
+ commandsCache[componentId] = [];
+
+ if (isDebugging) {
+ console.log('>>> >>> flush native ===');
+ console.log('>>> commands: ' + cmdArgs);
+ }
+
+ const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs);
+
+ if (isDebugging) {
+ console.log('>>> result: ' + result);
+ }
+
+ return result;
+ },
+
+ callNative: function (componentId, cmdArgs, cache) {
+
+ if (isDebugging) {
+ logCommand(componentId, cmdArgs);
+ }
+
+ commandsCache[componentId].push(cmdArgs);
+
+ if (!cache || isComboDisabled) {
+ return GBridge.flushNative(componentId);
+ } else {
+ return undefined;
+ }
+ },
+
+ texImage2D(componentId, ...args) {
+ if (isWeexIOS) {
+ if (args.length === 6) {
+ const [target, level, internalformat, format, type, image] = args;
+ GBridge.callNative(
+ componentId,
+ GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src
+ )
+ } else if (args.length === 9) {
+ const [target, level, internalformat, width, height, border, format, type, image] = args;
+ GBridge.callNative(
+ componentId,
+ GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' +
+ + format + ',' + type + ',' + (image ? image.src : 0)
+ )
+ }
+ } else if (isWeexAndroid) {
+ if (args.length === 6) {
+ const [target, level, internalformat, format, type, image] = args;
+ GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src);
+ } else if (args.length === 9) {
+ const [target, level, internalformat, width, height, border, format, type, image] = args;
+ GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0));
+ }
+ }
+ },
+
+ texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) {
+ if (isWeexIOS) {
+ if (arguments.length === 8) {
+ GBridge.callNative(
+ componentId,
+ GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src
+ )
+ }
+ } else if (isWeexAndroid) {
+ GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src);
+ }
+ },
+
+ bindImageTexture(componentId, src, imageId) {
+ GCanvasModule.bindImageTexture([src, imageId], componentId);
+ },
+
+ perloadImage([url, id], callback) {
+ GCanvasModule.preLoadImage([url, id], function (image) {
+ image.url = url;
+ image.id = id;
+ callback(image);
+ });
+ },
+
+ measureText(text, fontStyle, componentId) {
+ return GCanvasModule.measureText([text, fontStyle], componentId);
+ },
+
+ getImageData (componentId, x, y, w, h, callback) {
+ GCanvasModule.getImageData([x, y,w,h],componentId,callback);
+ },
+
+ putImageData (componentId, data, x, y, w, h, callback) {
+ GCanvasModule.putImageData([x, y,w,h,data],componentId,callback);
+ },
+
+ toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){
+ GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback);
+ }
+}
+
+export default GBridge;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js b/components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js
new file mode 100644
index 0000000..0da05e9
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js
@@ -0,0 +1,19 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 4 072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class FillStyleLinearGradient {
+
+ constructor(x0, y0, x1, y1) {
+ this._start_pos = { _x: x0, _y: y0 };
+ this._end_pos = { _x: x1, _y: y1 };
+ this._stop_count = 0;
+ this._stops = [0, 0, 0, 0, 0];
+ }
+
+ addColorStop = function (pos, color) {
+ if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
+ this._stops[this._stop_count] = { _pos: pos, _color: color };
+ this._stop_count++;
+ }
+ }
+}
+
+export default FillStyleLinearGradient;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-2d/FillStylePattern.js b/components/firstui/fui-qrcode/gcanvas/context-2d/FillStylePattern.js
new file mode 100644
index 0000000..a5623ab
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-2d/FillStylePattern.js
@@ -0,0 +1,9 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8614 072549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class FillStylePattern {
+ constructor(img, pattern) {
+ this._style = pattern;
+ this._img = img;
+ }
+}
+
+export default FillStylePattern;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js b/components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js
new file mode 100644
index 0000000..4f6b47c
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js
@@ -0,0 +1,18 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 4 0 72549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class FillStyleRadialGradient {
+ constructor(x0, y0, r0, x1, y1, r1) {
+ this._start_pos = { _x: x0, _y: y0, _r: r0 };
+ this._end_pos = { _x: x1, _y: y1, _r: r1 };
+ this._stop_count = 0;
+ this._stops = [0, 0, 0, 0, 0];
+ }
+
+ addColorStop(pos, color) {
+ if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
+ this._stops[this._stop_count] = { _pos: pos, _color: color };
+ this._stop_count++;
+ }
+ }
+}
+
+export default FillStyleRadialGradient;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-2d/RenderingContext.js b/components/firstui/fui-qrcode/gcanvas/context-2d/RenderingContext.js
new file mode 100644
index 0000000..1382716
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-2d/RenderingContext.js
@@ -0,0 +1,667 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 861 40 7 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import FillStylePattern from './FillStylePattern';
+import FillStyleLinearGradient from './FillStyleLinearGradient';
+import FillStyleRadialGradient from './FillStyleRadialGradient';
+import GImage from '../env/image.js';
+import {
+ ArrayBufferToBase64,
+ Base64ToUint8ClampedArray
+} from '../env/tool.js';
+
+export default class CanvasRenderingContext2D {
+
+ _drawCommands = '';
+
+ _globalAlpha = 1.0;
+
+ _fillStyle = 'rgb(0,0,0)';
+ _strokeStyle = 'rgb(0,0,0)';
+
+ _lineWidth = 1;
+ _lineCap = 'butt';
+ _lineJoin = 'miter';
+
+ _miterLimit = 10;
+
+ _globalCompositeOperation = 'source-over';
+
+ _textAlign = 'start';
+ _textBaseline = 'alphabetic';
+
+ _font = '10px sans-serif';
+
+ _savedGlobalAlpha = [];
+
+ timer = null;
+ componentId = null;
+
+ _notCommitDrawImageCache = [];
+ _needRedrawImageCache = [];
+ _redrawCommands = '';
+ _autoSaveContext = true;
+ // _imageMap = new GHashMap();
+ // _textureMap = new GHashMap();
+
+ constructor() {
+ this.className = 'CanvasRenderingContext2D';
+ //this.save()
+ }
+
+ setFillStyle(value) {
+ this.fillStyle = value;
+ }
+
+ set fillStyle(value) {
+ this._fillStyle = value;
+
+ if (typeof(value) == 'string') {
+ this._drawCommands = this._drawCommands.concat("F" + value + ";");
+ } else if (value instanceof FillStylePattern) {
+ const image = value._img;
+ if (!image.complete) {
+ image.onload = () => {
+ var index = this._needRedrawImageCache.indexOf(image);
+ if (index > -1) {
+ this._needRedrawImageCache.splice(index, 1);
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._redrawflush(true);
+ }
+ }
+ this._notCommitDrawImageCache.push(image);
+ } else {
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ }
+
+ //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
+ } else if (value instanceof FillStyleLinearGradient) {
+ var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
+ value._stop_count;
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ } else if (value instanceof FillStyleRadialGradient) {
+ var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
+ .toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," +
+ value._stop_count;
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ }
+ }
+
+ get fillStyle() {
+ return this._fillStyle;
+ }
+
+ get globalAlpha() {
+ return this._globalAlpha;
+ }
+
+ setGlobalAlpha(value) {
+ this.globalAlpha = value;
+ }
+
+ set globalAlpha(value) {
+ this._globalAlpha = value;
+ this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";");
+ }
+
+
+ get strokeStyle() {
+ return this._strokeStyle;
+ }
+
+ setStrokeStyle(value) {
+ this.strokeStyle = value;
+ }
+
+ set strokeStyle(value) {
+
+ this._strokeStyle = value;
+
+ if (typeof(value) == 'string') {
+ this._drawCommands = this._drawCommands.concat("S" + value + ";");
+ } else if (value instanceof FillStylePattern) {
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
+ } else if (value instanceof FillStyleLinearGradient) {
+ var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
+ value._stop_count;
+
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ } else if (value instanceof FillStyleRadialGradient) {
+ var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
+ .toFixed(2) + "," +
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," +
+ value._stop_count;
+
+ for (var i = 0; i < value._stop_count; ++i) {
+ command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
+ }
+ this._drawCommands = this._drawCommands.concat(command + ";");
+ }
+ }
+
+ get lineWidth() {
+ return this._lineWidth;
+ }
+
+ setLineWidth(value) {
+ this.lineWidth = value;
+ }
+
+ set lineWidth(value) {
+ this._lineWidth = value;
+ this._drawCommands = this._drawCommands.concat("W" + value + ";");
+ }
+
+ get lineCap() {
+ return this._lineCap;
+ }
+
+ setLineCap(value) {
+ this.lineCap = value;
+ }
+
+ set lineCap(value) {
+ this._lineCap = value;
+ this._drawCommands = this._drawCommands.concat("C" + value + ";");
+ }
+
+ get lineJoin() {
+ return this._lineJoin;
+ }
+
+ setLineJoin(value) {
+ this.lineJoin = value
+ }
+
+ set lineJoin(value) {
+ this._lineJoin = value;
+ this._drawCommands = this._drawCommands.concat("J" + value + ";");
+ }
+
+ get miterLimit() {
+ return this._miterLimit;
+ }
+
+ setMiterLimit(value) {
+ this.miterLimit = value
+ }
+
+ set miterLimit(value) {
+ this._miterLimit = value;
+ this._drawCommands = this._drawCommands.concat("M" + value + ";");
+ }
+
+ get globalCompositeOperation() {
+ return this._globalCompositeOperation;
+ }
+
+ set globalCompositeOperation(value) {
+
+ this._globalCompositeOperation = value;
+ let mode = 0;
+ switch (value) {
+ case "source-over":
+ mode = 0;
+ break;
+ case "source-atop":
+ mode = 5;
+ break;
+ case "source-in":
+ mode = 0;
+ break;
+ case "source-out":
+ mode = 2;
+ break;
+ case "destination-over":
+ mode = 4;
+ break;
+ case "destination-atop":
+ mode = 4;
+ break;
+ case "destination-in":
+ mode = 4;
+ break;
+ case "destination-out":
+ mode = 3;
+ break;
+ case "lighter":
+ mode = 1;
+ break;
+ case "copy":
+ mode = 2;
+ break;
+ case "xor":
+ mode = 6;
+ break;
+ default:
+ mode = 0;
+ }
+
+ this._drawCommands = this._drawCommands.concat("B" + mode + ";");
+ }
+
+ get textAlign() {
+ return this._textAlign;
+ }
+
+ setTextAlign(value) {
+ this.textAlign = value
+ }
+
+ set textAlign(value) {
+
+ this._textAlign = value;
+ let Align = 0;
+ switch (value) {
+ case "start":
+ Align = 0;
+ break;
+ case "end":
+ Align = 1;
+ break;
+ case "left":
+ Align = 2;
+ break;
+ case "center":
+ Align = 3;
+ break;
+ case "right":
+ Align = 4;
+ break;
+ default:
+ Align = 0;
+ }
+
+ this._drawCommands = this._drawCommands.concat("A" + Align + ";");
+ }
+
+ get textBaseline() {
+ return this._textBaseline;
+ }
+
+ setTextBaseline(value) {
+ this.textBaseline = value
+ }
+
+ set textBaseline(value) {
+ this._textBaseline = value;
+ let baseline = 0;
+ switch (value) {
+ case "alphabetic":
+ baseline = 0;
+ break;
+ case "middle":
+ baseline = 1;
+ break;
+ case "top":
+ baseline = 2;
+ break;
+ case "hanging":
+ baseline = 3;
+ break;
+ case "bottom":
+ baseline = 4;
+ break;
+ case "ideographic":
+ baseline = 5;
+ break;
+ default:
+ baseline = 0;
+ break;
+ }
+
+ this._drawCommands = this._drawCommands.concat("E" + baseline + ";");
+ }
+
+ get font() {
+ return this._font;
+ }
+
+ setFontSize(size) {
+ var str = this._font;
+ var strs = str.trim().split(/\s+/);
+ for (var i = 0; i < strs.length; i++) {
+ var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold",
+ "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900",
+ "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
+ "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
+ ];
+
+ if (-1 == values.indexOf(strs[i].trim())) {
+ if (typeof size === 'string') {
+ strs[i] = size;
+ } else if (typeof size === 'number') {
+ strs[i] = String(size) + 'px';
+ }
+ break;
+ }
+ }
+ this.font = strs.join(" ");
+ }
+
+ set font(value) {
+ this._font = value;
+ this._drawCommands = this._drawCommands.concat("j" + value + ";");
+ }
+
+ setTransform(a, b, c, d, tx, ty) {
+ this._drawCommands = this._drawCommands.concat("t" +
+ (a === 1 ? "1" : a.toFixed(2)) + "," +
+ (b === 0 ? "0" : b.toFixed(2)) + "," +
+ (c === 0 ? "0" : c.toFixed(2)) + "," +
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
+ }
+
+ transform(a, b, c, d, tx, ty) {
+ this._drawCommands = this._drawCommands.concat("f" +
+ (a === 1 ? "1" : a.toFixed(2)) + "," +
+ (b === 0 ? "0" : b.toFixed(2)) + "," +
+ (c === 0 ? "0" : c.toFixed(2)) + "," +
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";");
+ }
+
+ resetTransform() {
+ this._drawCommands = this._drawCommands.concat("m;");
+ }
+
+ scale(a, d) {
+ this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," +
+ d.toFixed(2) + ";");
+ }
+
+ rotate(angle) {
+ this._drawCommands = this._drawCommands
+ .concat("r" + angle.toFixed(6) + ";");
+ }
+
+ translate(tx, ty) {
+ this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
+ }
+
+ save() {
+ this._savedGlobalAlpha.push(this._globalAlpha);
+ this._drawCommands = this._drawCommands.concat("v;");
+ }
+
+ restore() {
+ this._drawCommands = this._drawCommands.concat("e;");
+ this._globalAlpha = this._savedGlobalAlpha.pop();
+ }
+
+ createPattern(img, pattern) {
+ if (typeof img === 'string') {
+ var imgObj = new GImage();
+ imgObj.src = img;
+ img = imgObj;
+ }
+ return new FillStylePattern(img, pattern);
+ }
+
+ createLinearGradient(x0, y0, x1, y1) {
+ return new FillStyleLinearGradient(x0, y0, x1, y1);
+ }
+
+ createRadialGradient = function(x0, y0, r0, x1, y1, r1) {
+ return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1);
+ };
+
+ createCircularGradient = function(x0, y0, r0) {
+ return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0);
+ };
+
+ strokeRect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";");
+ }
+
+
+ clearRect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w +
+ "," + h + ";");
+ }
+
+ clip() {
+ this._drawCommands = this._drawCommands.concat("p;");
+ }
+
+ resetClip() {
+ this._drawCommands = this._drawCommands.concat("q;");
+ }
+
+ closePath() {
+ this._drawCommands = this._drawCommands.concat("o;");
+ }
+
+ moveTo(x, y) {
+ this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";");
+ }
+
+ lineTo(x, y) {
+ this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";");
+ }
+
+ quadraticCurveTo = function(cpx, cpy, x, y) {
+ this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";");
+ }
+
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) {
+ this._drawCommands = this._drawCommands.concat(
+ "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," +
+ x.toFixed(2) + "," + y.toFixed(2) + ";");
+ }
+
+ arcTo(x1, y1, x2, y2, radius) {
+ this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";");
+ }
+
+ beginPath() {
+ this._drawCommands = this._drawCommands.concat("b;");
+ }
+
+
+ fillRect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w +
+ "," + h + ";");
+ }
+
+ rect(x, y, w, h) {
+ this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";");
+ }
+
+ fill() {
+ this._drawCommands = this._drawCommands.concat("L;");
+ }
+
+ stroke(path) {
+ this._drawCommands = this._drawCommands.concat("x;");
+ }
+
+ arc(x, y, radius, startAngle, endAngle, anticlockwise) {
+
+ let ianticlockwise = 0;
+ if (anticlockwise) {
+ ianticlockwise = 1;
+ }
+
+ this._drawCommands = this._drawCommands.concat(
+ "y" + x.toFixed(2) + "," + y.toFixed(2) + "," +
+ radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise +
+ ";"
+ );
+ }
+
+ fillText(text, x, y) {
+ let tmptext = text.replace(/!/g, "!!");
+ tmptext = tmptext.replace(/,/g, "!,");
+ tmptext = tmptext.replace(/;/g, "!;");
+ this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;");
+ }
+
+ strokeText = function(text, x, y) {
+ let tmptext = text.replace(/!/g, "!!");
+ tmptext = tmptext.replace(/,/g, "!,");
+ tmptext = tmptext.replace(/;/g, "!;");
+ this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;");
+ }
+
+ measureText(text) {
+ return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId);
+ }
+
+ isPointInPath = function(x, y) {
+ throw new Error('GCanvas not supported yet');
+ }
+
+ drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
+ if (typeof image === 'string') {
+ var imgObj = new GImage();
+ imgObj.src = image;
+ image = imgObj;
+ }
+ if (image instanceof GImage) {
+ if (!image.complete) {
+ imgObj.onload = () => {
+ var index = this._needRedrawImageCache.indexOf(image);
+ if (index > -1) {
+ this._needRedrawImageCache.splice(index, 1);
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ this._redrawflush(true);
+ }
+ }
+ this._notCommitDrawImageCache.push(image);
+ } else {
+ CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
+ }
+ var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh];
+ var args = [];
+ for (var arg in srcArgs) {
+ if (typeof(srcArgs[arg]) != 'undefined') {
+ args.push(srcArgs[arg]);
+ }
+ }
+ this.__drawImage.apply(this, args);
+ //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh);
+ }
+ }
+
+ __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
+ const numArgs = arguments.length;
+
+ function drawImageCommands() {
+
+ if (numArgs === 3) {
+ const x = parseFloat(sx) || 0.0;
+ const y = parseFloat(sy) || 0.0;
+
+ return ("d" + image._id + ",0,0," +
+ image.width + "," + image.height + "," +
+ x + "," + y + "," + image.width + "," + image.height + ";");
+ } else if (numArgs === 5) {
+ const x = parseFloat(sx) || 0.0;
+ const y = parseFloat(sy) || 0.0;
+ const width = parseInt(sw) || image.width;
+ const height = parseInt(sh) || image.height;
+
+ return ("d" + image._id + ",0,0," +
+ image.width + "," + image.height + "," +
+ x + "," + y + "," + width + "," + height + ";");
+ } else if (numArgs === 9) {
+ sx = parseFloat(sx) || 0.0;
+ sy = parseFloat(sy) || 0.0;
+ sw = parseInt(sw) || image.width;
+ sh = parseInt(sh) || image.height;
+ dx = parseFloat(dx) || 0.0;
+ dy = parseFloat(dy) || 0.0;
+ dw = parseInt(dw) || image.width;
+ dh = parseInt(dh) || image.height;
+
+ return ("d" + image._id + "," +
+ sx + "," + sy + "," + sw + "," + sh + "," +
+ dx + "," + dy + "," + dw + "," + dh + ";");
+ }
+ }
+ this._drawCommands += drawImageCommands();
+ }
+
+ _flush(reserve, callback) {
+ const commands = this._drawCommands;
+ this._drawCommands = '';
+ CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
+ this._needRender = false;
+ }
+
+ _redrawflush(reserve, callback) {
+ const commands = this._redrawCommands;
+ CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
+ if (this._needRedrawImageCache.length == 0) {
+ this._redrawCommands = '';
+ }
+ }
+
+ draw(reserve, callback) {
+ if (!reserve) {
+ this._globalAlpha = this._savedGlobalAlpha.pop();
+ this._savedGlobalAlpha.push(this._globalAlpha);
+ this._redrawCommands = this._drawCommands;
+ this._needRedrawImageCache = this._notCommitDrawImageCache;
+ if (this._autoSaveContext) {
+ this._drawCommands = ("v;" + this._drawCommands);
+ this._autoSaveContext = false;
+ } else {
+ this._drawCommands = ("e;X;v;" + this._drawCommands);
+ }
+ } else {
+ this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache);
+ this._redrawCommands += this._drawCommands;
+ if (this._autoSaveContext) {
+ this._drawCommands = ("v;" + this._drawCommands);
+ this._autoSaveContext = false;
+ }
+ }
+ this._notCommitDrawImageCache = [];
+ if (this._flush) {
+ this._flush(reserve, callback);
+ }
+ }
+
+ getImageData(x, y, w, h, callback) {
+ CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) {
+ res.data = Base64ToUint8ClampedArray(res.data);
+ if (typeof(callback) == 'function') {
+ callback(res);
+ }
+ });
+ }
+
+ putImageData(data, x, y, w, h, callback) {
+ if (data instanceof Uint8ClampedArray) {
+ data = ArrayBufferToBase64(data);
+ CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) {
+ if (typeof(callback) == 'function') {
+ callback(res);
+ }
+ });
+ }
+ }
+
+ toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) {
+ CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight,
+ fileType, quality,
+ function(res) {
+ if (typeof(callback) == 'function') {
+ callback(res);
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/ActiveInfo.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/ActiveInfo.js
new file mode 100644
index 0000000..350c6e6
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/ActiveInfo.js
@@ -0,0 +1,12 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61407 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default class WebGLActiveInfo {
+ className = 'WebGLActiveInfo';
+
+ constructor({
+ type, name, size
+ }) {
+ this.type = type;
+ this.name = name;
+ this.size = size;
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/Buffer.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/Buffer.js
new file mode 100644
index 0000000..dc290c9
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/Buffer.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 40 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLBuffer';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLBuffer {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/Framebuffer.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/Framebuffer.js
new file mode 100644
index 0000000..aa70d10
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/Framebuffer.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1407 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLFrameBuffer';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLFramebuffer {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/GLenum.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/GLenum.js
new file mode 100644
index 0000000..aab9e47
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/GLenum.js
@@ -0,0 +1,299 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61 40725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default {
+ "DEPTH_BUFFER_BIT": 256,
+ "STENCIL_BUFFER_BIT": 1024,
+ "COLOR_BUFFER_BIT": 16384,
+ "POINTS": 0,
+ "LINES": 1,
+ "LINE_LOOP": 2,
+ "LINE_STRIP": 3,
+ "TRIANGLES": 4,
+ "TRIANGLE_STRIP": 5,
+ "TRIANGLE_FAN": 6,
+ "ZERO": 0,
+ "ONE": 1,
+ "SRC_COLOR": 768,
+ "ONE_MINUS_SRC_COLOR": 769,
+ "SRC_ALPHA": 770,
+ "ONE_MINUS_SRC_ALPHA": 771,
+ "DST_ALPHA": 772,
+ "ONE_MINUS_DST_ALPHA": 773,
+ "DST_COLOR": 774,
+ "ONE_MINUS_DST_COLOR": 775,
+ "SRC_ALPHA_SATURATE": 776,
+ "FUNC_ADD": 32774,
+ "BLEND_EQUATION": 32777,
+ "BLEND_EQUATION_RGB": 32777,
+ "BLEND_EQUATION_ALPHA": 34877,
+ "FUNC_SUBTRACT": 32778,
+ "FUNC_REVERSE_SUBTRACT": 32779,
+ "BLEND_DST_RGB": 32968,
+ "BLEND_SRC_RGB": 32969,
+ "BLEND_DST_ALPHA": 32970,
+ "BLEND_SRC_ALPHA": 32971,
+ "CONSTANT_COLOR": 32769,
+ "ONE_MINUS_CONSTANT_COLOR": 32770,
+ "CONSTANT_ALPHA": 32771,
+ "ONE_MINUS_CONSTANT_ALPHA": 32772,
+ "BLEND_COLOR": 32773,
+ "ARRAY_BUFFER": 34962,
+ "ELEMENT_ARRAY_BUFFER": 34963,
+ "ARRAY_BUFFER_BINDING": 34964,
+ "ELEMENT_ARRAY_BUFFER_BINDING": 34965,
+ "STREAM_DRAW": 35040,
+ "STATIC_DRAW": 35044,
+ "DYNAMIC_DRAW": 35048,
+ "BUFFER_SIZE": 34660,
+ "BUFFER_USAGE": 34661,
+ "CURRENT_VERTEX_ATTRIB": 34342,
+ "FRONT": 1028,
+ "BACK": 1029,
+ "FRONT_AND_BACK": 1032,
+ "TEXTURE_2D": 3553,
+ "CULL_FACE": 2884,
+ "BLEND": 3042,
+ "DITHER": 3024,
+ "STENCIL_TEST": 2960,
+ "DEPTH_TEST": 2929,
+ "SCISSOR_TEST": 3089,
+ "POLYGON_OFFSET_FILL": 32823,
+ "SAMPLE_ALPHA_TO_COVERAGE": 32926,
+ "SAMPLE_COVERAGE": 32928,
+ "NO_ERROR": 0,
+ "INVALID_ENUM": 1280,
+ "INVALID_VALUE": 1281,
+ "INVALID_OPERATION": 1282,
+ "OUT_OF_MEMORY": 1285,
+ "CW": 2304,
+ "CCW": 2305,
+ "LINE_WIDTH": 2849,
+ "ALIASED_POINT_SIZE_RANGE": 33901,
+ "ALIASED_LINE_WIDTH_RANGE": 33902,
+ "CULL_FACE_MODE": 2885,
+ "FRONT_FACE": 2886,
+ "DEPTH_RANGE": 2928,
+ "DEPTH_WRITEMASK": 2930,
+ "DEPTH_CLEAR_VALUE": 2931,
+ "DEPTH_FUNC": 2932,
+ "STENCIL_CLEAR_VALUE": 2961,
+ "STENCIL_FUNC": 2962,
+ "STENCIL_FAIL": 2964,
+ "STENCIL_PASS_DEPTH_FAIL": 2965,
+ "STENCIL_PASS_DEPTH_PASS": 2966,
+ "STENCIL_REF": 2967,
+ "STENCIL_VALUE_MASK": 2963,
+ "STENCIL_WRITEMASK": 2968,
+ "STENCIL_BACK_FUNC": 34816,
+ "STENCIL_BACK_FAIL": 34817,
+ "STENCIL_BACK_PASS_DEPTH_FAIL": 34818,
+ "STENCIL_BACK_PASS_DEPTH_PASS": 34819,
+ "STENCIL_BACK_REF": 36003,
+ "STENCIL_BACK_VALUE_MASK": 36004,
+ "STENCIL_BACK_WRITEMASK": 36005,
+ "VIEWPORT": 2978,
+ "SCISSOR_BOX": 3088,
+ "COLOR_CLEAR_VALUE": 3106,
+ "COLOR_WRITEMASK": 3107,
+ "UNPACK_ALIGNMENT": 3317,
+ "PACK_ALIGNMENT": 3333,
+ "MAX_TEXTURE_SIZE": 3379,
+ "MAX_VIEWPORT_DIMS": 3386,
+ "SUBPIXEL_BITS": 3408,
+ "RED_BITS": 3410,
+ "GREEN_BITS": 3411,
+ "BLUE_BITS": 3412,
+ "ALPHA_BITS": 3413,
+ "DEPTH_BITS": 3414,
+ "STENCIL_BITS": 3415,
+ "POLYGON_OFFSET_UNITS": 10752,
+ "POLYGON_OFFSET_FACTOR": 32824,
+ "TEXTURE_BINDING_2D": 32873,
+ "SAMPLE_BUFFERS": 32936,
+ "SAMPLES": 32937,
+ "SAMPLE_COVERAGE_VALUE": 32938,
+ "SAMPLE_COVERAGE_INVERT": 32939,
+ "COMPRESSED_TEXTURE_FORMATS": 34467,
+ "DONT_CARE": 4352,
+ "FASTEST": 4353,
+ "NICEST": 4354,
+ "GENERATE_MIPMAP_HINT": 33170,
+ "BYTE": 5120,
+ "UNSIGNED_BYTE": 5121,
+ "SHORT": 5122,
+ "UNSIGNED_SHORT": 5123,
+ "INT": 5124,
+ "UNSIGNED_INT": 5125,
+ "FLOAT": 5126,
+ "DEPTH_COMPONENT": 6402,
+ "ALPHA": 6406,
+ "RGB": 6407,
+ "RGBA": 6408,
+ "LUMINANCE": 6409,
+ "LUMINANCE_ALPHA": 6410,
+ "UNSIGNED_SHORT_4_4_4_4": 32819,
+ "UNSIGNED_SHORT_5_5_5_1": 32820,
+ "UNSIGNED_SHORT_5_6_5": 33635,
+ "FRAGMENT_SHADER": 35632,
+ "VERTEX_SHADER": 35633,
+ "MAX_VERTEX_ATTRIBS": 34921,
+ "MAX_VERTEX_UNIFORM_VECTORS": 36347,
+ "MAX_VARYING_VECTORS": 36348,
+ "MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661,
+ "MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660,
+ "MAX_TEXTURE_IMAGE_UNITS": 34930,
+ "MAX_FRAGMENT_UNIFORM_VECTORS": 36349,
+ "SHADER_TYPE": 35663,
+ "DELETE_STATUS": 35712,
+ "LINK_STATUS": 35714,
+ "VALIDATE_STATUS": 35715,
+ "ATTACHED_SHADERS": 35717,
+ "ACTIVE_UNIFORMS": 35718,
+ "ACTIVE_ATTRIBUTES": 35721,
+ "SHADING_LANGUAGE_VERSION": 35724,
+ "CURRENT_PROGRAM": 35725,
+ "NEVER": 512,
+ "LESS": 513,
+ "EQUAL": 514,
+ "LEQUAL": 515,
+ "GREATER": 516,
+ "NOTEQUAL": 517,
+ "GEQUAL": 518,
+ "ALWAYS": 519,
+ "KEEP": 7680,
+ "REPLACE": 7681,
+ "INCR": 7682,
+ "DECR": 7683,
+ "INVERT": 5386,
+ "INCR_WRAP": 34055,
+ "DECR_WRAP": 34056,
+ "VENDOR": 7936,
+ "RENDERER": 7937,
+ "VERSION": 7938,
+ "NEAREST": 9728,
+ "LINEAR": 9729,
+ "NEAREST_MIPMAP_NEAREST": 9984,
+ "LINEAR_MIPMAP_NEAREST": 9985,
+ "NEAREST_MIPMAP_LINEAR": 9986,
+ "LINEAR_MIPMAP_LINEAR": 9987,
+ "TEXTURE_MAG_FILTER": 10240,
+ "TEXTURE_MIN_FILTER": 10241,
+ "TEXTURE_WRAP_S": 10242,
+ "TEXTURE_WRAP_T": 10243,
+ "TEXTURE": 5890,
+ "TEXTURE_CUBE_MAP": 34067,
+ "TEXTURE_BINDING_CUBE_MAP": 34068,
+ "TEXTURE_CUBE_MAP_POSITIVE_X": 34069,
+ "TEXTURE_CUBE_MAP_NEGATIVE_X": 34070,
+ "TEXTURE_CUBE_MAP_POSITIVE_Y": 34071,
+ "TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072,
+ "TEXTURE_CUBE_MAP_POSITIVE_Z": 34073,
+ "TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074,
+ "MAX_CUBE_MAP_TEXTURE_SIZE": 34076,
+ "TEXTURE0": 33984,
+ "TEXTURE1": 33985,
+ "TEXTURE2": 33986,
+ "TEXTURE3": 33987,
+ "TEXTURE4": 33988,
+ "TEXTURE5": 33989,
+ "TEXTURE6": 33990,
+ "TEXTURE7": 33991,
+ "TEXTURE8": 33992,
+ "TEXTURE9": 33993,
+ "TEXTURE10": 33994,
+ "TEXTURE11": 33995,
+ "TEXTURE12": 33996,
+ "TEXTURE13": 33997,
+ "TEXTURE14": 33998,
+ "TEXTURE15": 33999,
+ "TEXTURE16": 34000,
+ "TEXTURE17": 34001,
+ "TEXTURE18": 34002,
+ "TEXTURE19": 34003,
+ "TEXTURE20": 34004,
+ "TEXTURE21": 34005,
+ "TEXTURE22": 34006,
+ "TEXTURE23": 34007,
+ "TEXTURE24": 34008,
+ "TEXTURE25": 34009,
+ "TEXTURE26": 34010,
+ "TEXTURE27": 34011,
+ "TEXTURE28": 34012,
+ "TEXTURE29": 34013,
+ "TEXTURE30": 34014,
+ "TEXTURE31": 34015,
+ "ACTIVE_TEXTURE": 34016,
+ "REPEAT": 10497,
+ "CLAMP_TO_EDGE": 33071,
+ "MIRRORED_REPEAT": 33648,
+ "FLOAT_VEC2": 35664,
+ "FLOAT_VEC3": 35665,
+ "FLOAT_VEC4": 35666,
+ "INT_VEC2": 35667,
+ "INT_VEC3": 35668,
+ "INT_VEC4": 35669,
+ "BOOL": 35670,
+ "BOOL_VEC2": 35671,
+ "BOOL_VEC3": 35672,
+ "BOOL_VEC4": 35673,
+ "FLOAT_MAT2": 35674,
+ "FLOAT_MAT3": 35675,
+ "FLOAT_MAT4": 35676,
+ "SAMPLER_2D": 35678,
+ "SAMPLER_CUBE": 35680,
+ "VERTEX_ATTRIB_ARRAY_ENABLED": 34338,
+ "VERTEX_ATTRIB_ARRAY_SIZE": 34339,
+ "VERTEX_ATTRIB_ARRAY_STRIDE": 34340,
+ "VERTEX_ATTRIB_ARRAY_TYPE": 34341,
+ "VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922,
+ "VERTEX_ATTRIB_ARRAY_POINTER": 34373,
+ "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975,
+ "IMPLEMENTATION_COLOR_READ_TYPE": 35738,
+ "IMPLEMENTATION_COLOR_READ_FORMAT": 35739,
+ "COMPILE_STATUS": 35713,
+ "LOW_FLOAT": 36336,
+ "MEDIUM_FLOAT": 36337,
+ "HIGH_FLOAT": 36338,
+ "LOW_INT": 36339,
+ "MEDIUM_INT": 36340,
+ "HIGH_INT": 36341,
+ "FRAMEBUFFER": 36160,
+ "RENDERBUFFER": 36161,
+ "RGBA4": 32854,
+ "RGB5_A1": 32855,
+ "RGB565": 36194,
+ "DEPTH_COMPONENT16": 33189,
+ "STENCIL_INDEX8": 36168,
+ "DEPTH_STENCIL": 34041,
+ "RENDERBUFFER_WIDTH": 36162,
+ "RENDERBUFFER_HEIGHT": 36163,
+ "RENDERBUFFER_INTERNAL_FORMAT": 36164,
+ "RENDERBUFFER_RED_SIZE": 36176,
+ "RENDERBUFFER_GREEN_SIZE": 36177,
+ "RENDERBUFFER_BLUE_SIZE": 36178,
+ "RENDERBUFFER_ALPHA_SIZE": 36179,
+ "RENDERBUFFER_DEPTH_SIZE": 36180,
+ "RENDERBUFFER_STENCIL_SIZE": 36181,
+ "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048,
+ "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049,
+ "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050,
+ "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051,
+ "COLOR_ATTACHMENT0": 36064,
+ "DEPTH_ATTACHMENT": 36096,
+ "STENCIL_ATTACHMENT": 36128,
+ "DEPTH_STENCIL_ATTACHMENT": 33306,
+ "NONE": 0,
+ "FRAMEBUFFER_COMPLETE": 36053,
+ "FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054,
+ "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055,
+ "FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057,
+ "FRAMEBUFFER_UNSUPPORTED": 36061,
+ "FRAMEBUFFER_BINDING": 36006,
+ "RENDERBUFFER_BINDING": 36007,
+ "MAX_RENDERBUFFER_SIZE": 34024,
+ "INVALID_FRAMEBUFFER_OPERATION": 1286,
+ "UNPACK_FLIP_Y_WEBGL": 37440,
+ "UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441,
+ "CONTEXT_LOST_WEBGL": 37442,
+ "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443,
+ "BROWSER_DEFAULT_WEBGL": 37444
+};
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/GLmethod.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/GLmethod.js
new file mode 100644
index 0000000..35b52cf
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/GLmethod.js
@@ -0,0 +1,143 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 1407 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+let i = 1;
+
+const GLmethod = {};
+
+GLmethod.activeTexture = i++; //1
+GLmethod.attachShader = i++;
+GLmethod.bindAttribLocation = i++;
+GLmethod.bindBuffer = i++;
+GLmethod.bindFramebuffer = i++;
+GLmethod.bindRenderbuffer = i++;
+GLmethod.bindTexture = i++;
+GLmethod.blendColor = i++;
+GLmethod.blendEquation = i++;
+GLmethod.blendEquationSeparate = i++; //10
+GLmethod.blendFunc = i++;
+GLmethod.blendFuncSeparate = i++;
+GLmethod.bufferData = i++;
+GLmethod.bufferSubData = i++;
+GLmethod.checkFramebufferStatus = i++;
+GLmethod.clear = i++;
+GLmethod.clearColor = i++;
+GLmethod.clearDepth = i++;
+GLmethod.clearStencil = i++;
+GLmethod.colorMask = i++; //20
+GLmethod.compileShader = i++;
+GLmethod.compressedTexImage2D = i++;
+GLmethod.compressedTexSubImage2D = i++;
+GLmethod.copyTexImage2D = i++;
+GLmethod.copyTexSubImage2D = i++;
+GLmethod.createBuffer = i++;
+GLmethod.createFramebuffer = i++;
+GLmethod.createProgram = i++;
+GLmethod.createRenderbuffer = i++;
+GLmethod.createShader = i++; //30
+GLmethod.createTexture = i++;
+GLmethod.cullFace = i++;
+GLmethod.deleteBuffer = i++;
+GLmethod.deleteFramebuffer = i++;
+GLmethod.deleteProgram = i++;
+GLmethod.deleteRenderbuffer = i++;
+GLmethod.deleteShader = i++;
+GLmethod.deleteTexture = i++;
+GLmethod.depthFunc = i++;
+GLmethod.depthMask = i++; //40
+GLmethod.depthRange = i++;
+GLmethod.detachShader = i++;
+GLmethod.disable = i++;
+GLmethod.disableVertexAttribArray = i++;
+GLmethod.drawArrays = i++;
+GLmethod.drawArraysInstancedANGLE = i++;
+GLmethod.drawElements = i++;
+GLmethod.drawElementsInstancedANGLE = i++;
+GLmethod.enable = i++;
+GLmethod.enableVertexAttribArray = i++; //50
+GLmethod.flush = i++;
+GLmethod.framebufferRenderbuffer = i++;
+GLmethod.framebufferTexture2D = i++;
+GLmethod.frontFace = i++;
+GLmethod.generateMipmap = i++;
+GLmethod.getActiveAttrib = i++;
+GLmethod.getActiveUniform = i++;
+GLmethod.getAttachedShaders = i++;
+GLmethod.getAttribLocation = i++;
+GLmethod.getBufferParameter = i++; //60
+GLmethod.getContextAttributes = i++;
+GLmethod.getError = i++;
+GLmethod.getExtension = i++;
+GLmethod.getFramebufferAttachmentParameter = i++;
+GLmethod.getParameter = i++;
+GLmethod.getProgramInfoLog = i++;
+GLmethod.getProgramParameter = i++;
+GLmethod.getRenderbufferParameter = i++;
+GLmethod.getShaderInfoLog = i++;
+GLmethod.getShaderParameter = i++; //70
+GLmethod.getShaderPrecisionFormat = i++;
+GLmethod.getShaderSource = i++;
+GLmethod.getSupportedExtensions = i++;
+GLmethod.getTexParameter = i++;
+GLmethod.getUniform = i++;
+GLmethod.getUniformLocation = i++;
+GLmethod.getVertexAttrib = i++;
+GLmethod.getVertexAttribOffset = i++;
+GLmethod.isBuffer = i++;
+GLmethod.isContextLost = i++; //80
+GLmethod.isEnabled = i++;
+GLmethod.isFramebuffer = i++;
+GLmethod.isProgram = i++;
+GLmethod.isRenderbuffer = i++;
+GLmethod.isShader = i++;
+GLmethod.isTexture = i++;
+GLmethod.lineWidth = i++;
+GLmethod.linkProgram = i++;
+GLmethod.pixelStorei = i++;
+GLmethod.polygonOffset = i++; //90
+GLmethod.readPixels = i++;
+GLmethod.renderbufferStorage = i++;
+GLmethod.sampleCoverage = i++;
+GLmethod.scissor = i++;
+GLmethod.shaderSource = i++;
+GLmethod.stencilFunc = i++;
+GLmethod.stencilFuncSeparate = i++;
+GLmethod.stencilMask = i++;
+GLmethod.stencilMaskSeparate = i++;
+GLmethod.stencilOp = i++; //100
+GLmethod.stencilOpSeparate = i++;
+GLmethod.texImage2D = i++;
+GLmethod.texParameterf = i++;
+GLmethod.texParameteri = i++;
+GLmethod.texSubImage2D = i++;
+GLmethod.uniform1f = i++;
+GLmethod.uniform1fv = i++;
+GLmethod.uniform1i = i++;
+GLmethod.uniform1iv = i++;
+GLmethod.uniform2f = i++; //110
+GLmethod.uniform2fv = i++;
+GLmethod.uniform2i = i++;
+GLmethod.uniform2iv = i++;
+GLmethod.uniform3f = i++;
+GLmethod.uniform3fv = i++;
+GLmethod.uniform3i = i++;
+GLmethod.uniform3iv = i++;
+GLmethod.uniform4f = i++;
+GLmethod.uniform4fv = i++;
+GLmethod.uniform4i = i++; //120
+GLmethod.uniform4iv = i++;
+GLmethod.uniformMatrix2fv = i++;
+GLmethod.uniformMatrix3fv = i++;
+GLmethod.uniformMatrix4fv = i++;
+GLmethod.useProgram = i++;
+GLmethod.validateProgram = i++;
+GLmethod.vertexAttrib1f = i++; //new
+GLmethod.vertexAttrib2f = i++; //new
+GLmethod.vertexAttrib3f = i++; //new
+GLmethod.vertexAttrib4f = i++; //new //130
+GLmethod.vertexAttrib1fv = i++; //new
+GLmethod.vertexAttrib2fv = i++; //new
+GLmethod.vertexAttrib3fv = i++; //new
+GLmethod.vertexAttrib4fv = i++; //new
+GLmethod.vertexAttribPointer = i++;
+GLmethod.viewport = i++;
+
+export default GLmethod;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/GLtype.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/GLtype.js
new file mode 100644
index 0000000..2526996
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/GLtype.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 1 40 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+const GLtype = {};
+
+[
+ "GLbitfield",
+ "GLboolean",
+ "GLbyte",
+ "GLclampf",
+ "GLenum",
+ "GLfloat",
+ "GLint",
+ "GLintptr",
+ "GLsizei",
+ "GLsizeiptr",
+ "GLshort",
+ "GLubyte",
+ "GLuint",
+ "GLushort"
+].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1));
+
+export default GLtype;
+
+
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/Program.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/Program.js
new file mode 100644
index 0000000..8423410
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/Program.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 14 07 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLProgram';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLProgram {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/Renderbuffer.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/Renderbuffer.js
new file mode 100644
index 0000000..eb0591b
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/Renderbuffer.js
@@ -0,0 +1,22 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1407 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLRenderBuffer';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLRenderbuffer {
+ className = name;
+
+ constructor(id) {
+ this.id = id;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/RenderingContext.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/RenderingContext.js
new file mode 100644
index 0000000..cb755a5
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/RenderingContext.js
@@ -0,0 +1,1192 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61407 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import GLenum from './GLenum';
+import ActiveInfo from './ActiveInfo';
+import Buffer from './Buffer';
+import Framebuffer from './Framebuffer';
+import Renderbuffer from './Renderbuffer';
+import Texture from './Texture';
+import Program from './Program';
+import Shader from './Shader';
+import ShaderPrecisionFormat from './ShaderPrecisionFormat';
+import UniformLocation from './UniformLocation';
+import GLmethod from './GLmethod';
+
+const processArray = (array, checkArrayType = false) => {
+
+ function joinArray(arr, sep) {
+ let res = '';
+ for (let i = 0; i < arr.length; i++) {
+ if (i !== 0) {
+ res += sep;
+ }
+ res += arr[i];
+ }
+ return res;
+ }
+
+ let type = 'Float32Array';
+ if (checkArrayType) {
+ if (array instanceof Uint8Array) {
+ type = 'Uint8Array'
+ } else if (array instanceof Uint16Array) {
+ type = 'Uint16Array';
+ } else if (array instanceof Uint32Array) {
+ type = 'Uint32Array';
+ } else if (array instanceof Float32Array) {
+ type = 'Float32Array';
+ } else {
+ throw new Error('Check array type failed. Array type is ' + typeof array);
+ }
+ }
+
+ const ArrayTypes = {
+ Uint8Array: 1,
+ Uint16Array: 2,
+ Uint32Array: 4,
+ Float32Array: 14
+ };
+ return ArrayTypes[type] + ',' + btoa(joinArray(array, ','))
+}
+
+export default class WebGLRenderingContext {
+
+ // static GBridge = null;
+
+ className = 'WebGLRenderingContext';
+
+ constructor(canvas, type, attrs) {
+ this._canvas = canvas;
+ this._type = type;
+ this._version = 'WebGL 1.0';
+ this._attrs = attrs;
+ this._map = new Map();
+
+ Object.keys(GLenum)
+ .forEach(name => Object.defineProperty(this, name, {
+ value: GLenum[name]
+ }));
+ }
+
+ get canvas() {
+ return this._canvas;
+ }
+
+ activeTexture = function (textureUnit) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.activeTexture + ',' + textureUnit,
+ true
+ );
+ }
+
+ attachShader = function (progarm, shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.attachShader + ',' + progarm.id + ',' + shader.id,
+ true
+ );
+ }
+
+ bindAttribLocation = function (program, index, name) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindAttribLocation + ',' + program.id + ',' + index + ',' + name,
+ true
+ )
+ }
+
+ bindBuffer = function (target, buffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindBuffer + ',' + target + ',' + (buffer ? buffer.id : 0),
+ true
+ );
+ }
+
+ bindFramebuffer = function (target, framebuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindFramebuffer + ',' + target + ',' + (framebuffer ? framebuffer.id : 0),
+ true
+ )
+ }
+
+ bindRenderbuffer = function (target, renderBuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindRenderbuffer + ',' + target + ',' + (renderBuffer ? renderBuffer.id : 0),
+ true
+ )
+ }
+
+ bindTexture = function (target, texture) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bindTexture + ',' + target + ',' + (texture ? texture.id : 0),
+ true
+ )
+ }
+
+ blendColor = function (r, g, b, a) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendColor + ',' + target + ',' + r + ',' + g + ',' + b + ',' + a,
+ true
+ )
+ }
+
+ blendEquation = function (mode) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendEquation + ',' + mode,
+ true
+ )
+ }
+
+ blendEquationSeparate = function (modeRGB, modeAlpha) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendEquationSeparate + ',' + modeRGB + ',' + modeAlpha,
+ true
+ )
+ }
+
+
+ blendFunc = function (sfactor, dfactor) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendFunc + ',' + sfactor + ',' + dfactor,
+ true
+ );
+ }
+
+ blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.blendFuncSeparate + ',' + srcRGB + ',' + dstRGB + ',' + srcAlpha + ',' + dstAlpha,
+ true
+ );
+ }
+
+ bufferData = function (target, data, usage) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bufferData + ',' + target + ',' + processArray(data, true) + ',' + usage,
+ true
+ )
+ }
+
+ bufferSubData = function (target, offset, data) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.bufferSubData + ',' + target + ',' + offset + ',' + processArray(data, true),
+ true
+ )
+ }
+
+ checkFramebufferStatus = function (target) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.checkFramebufferStatus + ',' + target
+ );
+ return Number(result);
+ }
+
+ clear = function (mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clear + ',' + mask
+ );
+ this._canvas._needRender = true;
+ }
+
+ clearColor = function (r, g, b, a) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clearColor + ',' + r + ',' + g + ',' + b,
+ true
+ )
+ }
+
+ clearDepth = function (depth) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clearDepth + ',' + depth,
+ true
+ )
+ }
+
+ clearStencil = function (s) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.clearStencil + ',' + s
+ );
+ }
+
+ colorMask = function (r, g, b, a) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.colorMask + ',' + r + ',' + g + ',' + b + ',' + a
+ )
+ }
+
+ compileShader = function (shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.compileShader + ',' + shader.id,
+ true
+ )
+ }
+
+ compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.compressedTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' +
+ width + ',' + height + ',' + border + ',' + processArray(pixels),
+ true
+ )
+ }
+
+ compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.compressedTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' +
+ width + ',' + height + ',' + format + ',' + processArray(pixels),
+ true
+ )
+ }
+
+
+ copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.copyTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + x + ',' + y + ',' +
+ width + ',' + height + ',' + border,
+ true
+ );
+ }
+
+ copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.copyTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + x + ',' + y + ',' +
+ width + ',' + height
+ );
+ }
+
+ createBuffer = function () {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createBuffer + ''
+ );
+ const buffer = new Buffer(result);
+ this._map.set(buffer.uuid(), buffer);
+ return buffer;
+ }
+
+ createFramebuffer = function () {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createFramebuffer + ''
+ );
+ const framebuffer = new Framebuffer(result);
+ this._map.set(framebuffer.uuid(), framebuffer);
+ return framebuffer;
+ }
+
+
+ createProgram = function () {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createProgram + ''
+ );
+ const program = new Program(id);
+ this._map.set(program.uuid(), program);
+ return program;
+ }
+
+ createRenderbuffer = function () {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createRenderbuffer + ''
+ )
+ const renderBuffer = new Renderbuffer(id);
+ this._map.set(renderBuffer.uuid(), renderBuffer);
+ return renderBuffer;
+ }
+
+ createShader = function (type) {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createShader + ',' + type
+ )
+ const shader = new Shader(id, type);
+ this._map.set(shader.uuid(), shader);
+ return shader;
+ }
+
+ createTexture = function () {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.createTexture + ''
+ );
+ const texture = new Texture(id);
+ this._map.set(texture.uuid(), texture);
+ return texture;
+ }
+
+ cullFace = function (mode) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.cullFace + ',' + mode,
+ true
+ )
+ }
+
+
+ deleteBuffer = function (buffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteBuffer + ',' + buffer.id,
+ true
+ )
+ }
+
+ deleteFramebuffer = function (framebuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteFramebuffer + ',' + framebuffer.id,
+ true
+ )
+ }
+
+ deleteProgram = function (program) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteProgram + ',' + program.id,
+ true
+ )
+ }
+
+ deleteRenderbuffer = function (renderbuffer) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteRenderbuffer + ',' + renderbuffer.id,
+ true
+ )
+ }
+
+ deleteShader = function (shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteShader + ',' + shader.id,
+ true
+ )
+ }
+
+ deleteTexture = function (texture) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.deleteTexture + ',' + texture.id,
+ true
+ )
+ }
+
+ depthFunc = function (func) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.depthFunc + ',' + func
+ )
+ }
+
+ depthMask = function (flag) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.depthMask + ',' + Number(flag),
+ true
+ )
+ }
+
+ depthRange = function (zNear, zFar) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.depthRange + ',' + zNear + ',' + zFar,
+ true
+ )
+ }
+
+ detachShader = function (program, shader) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.detachShader + ',' + program.id + ',' + shader.id,
+ true
+ )
+ }
+
+ disable = function (cap) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.disable + ',' + cap,
+ true
+ )
+ }
+
+ disableVertexAttribArray = function (index) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.disableVertexAttribArray + ',' + index,
+ true
+ );
+ }
+
+ drawArrays = function (mode, first, count) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.drawArrays + ',' + mode + ',' + first + ',' + count
+ )
+ this._canvas._needRender = true;
+ }
+
+ drawElements = function (mode, count, type, offset) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.drawElements + ',' + mode + ',' + count + ',' + type + ',' + offset + ';'
+ );
+ this._canvas._needRender = true;
+ }
+
+ enable = function (cap) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.enable + ',' + cap,
+ true
+ );
+ }
+
+ enableVertexAttribArray = function (index) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.enableVertexAttribArray + ',' + index,
+ true
+ )
+ }
+
+
+ flush = function () {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.flush + ''
+ )
+ }
+
+ framebufferRenderbuffer = function (target, attachment, textarget, texture, level) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.framebufferRenderbuffer + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level,
+ true
+ )
+ }
+
+ framebufferTexture2D = function (target, attachment, textarget, texture, level) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.framebufferTexture2D + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level,
+ true
+ )
+ }
+
+ frontFace = function (mode) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.frontFace + ',' + mode,
+ true
+ )
+ }
+
+ generateMipmap = function (target) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.generateMipmap + ',' + target,
+ true
+ )
+ }
+
+ getActiveAttrib = function (progarm, index) {
+ const resultString = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getActiveAttrib + ',' + progarm.id + ',' + index
+ )
+ const [type, size, name] = resultString.split(',');
+ return new ActiveInfo({
+ type: Number(type),
+ size: Number(size),
+ name
+ });
+ }
+
+ getActiveUniform = function (progarm, index) {
+ const resultString = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getActiveUniform + ',' + progarm.id + ',' + index
+ );
+ const [type, size, name] = resultString.split(',');
+ return new ActiveInfo({
+ type: Number(type),
+ size: Number(size),
+ name
+ })
+ }
+
+ getAttachedShaders = function (progarm) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getAttachedShaders + ',' + progarm.id
+ );
+ const [type, ...ids] = result;
+ return ids.map(id => this._map.get(Shader.uuid(id)));
+ }
+
+ getAttribLocation = function (progarm, name) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getAttribLocation + ',' + progarm.id + ',' + name
+ )
+ }
+
+ getBufferParameter = function (target, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getBufferParameter + ',' + target + ',' + pname
+ );
+ const [type, res] = getBufferParameter;
+ return res;
+ }
+
+ getError = function () {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getError + ''
+ )
+ return result;
+ }
+
+ getExtension = function (name) {
+ return null;
+ }
+
+ getFramebufferAttachmentParameter = function (target, attachment, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getFramebufferAttachmentParameter + ',' + target + ',' + attachment + ',' + pname
+ )
+ switch (pname) {
+ case GLenum.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ return this._map.get(Renderbuffer.uuid(result)) || this._map.get(Texture.uuid(result)) || null;
+ default:
+ return result;
+ }
+ }
+
+ getParameter = function (pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getParameter + ',' + pname
+ )
+ switch (pname) {
+ case GLenum.VERSION:
+ return this._version;
+ case GLenum.ARRAY_BUFFER_BINDING: // buffer
+ case GLenum.ELEMENT_ARRAY_BUFFER_BINDING: // buffer
+ return this._map.get(Buffer.uuid(result)) || null;
+ case GLenum.CURRENT_PROGRAM: // program
+ return this._map.get(Program.uuid(result)) || null;
+ case GLenum.FRAMEBUFFER_BINDING: // framebuffer
+ return this._map.get(Framebuffer.uuid(result)) || null;
+ case GLenum.RENDERBUFFER_BINDING: // renderbuffer
+ return this._map.get(Renderbuffer.uuid(result)) || null;
+ case GLenum.TEXTURE_BINDING_2D: // texture
+ case GLenum.TEXTURE_BINDING_CUBE_MAP: // texture
+ return this._map.get(Texture.uuid(result)) || null;
+ case GLenum.ALIASED_LINE_WIDTH_RANGE: // Float32Array
+ case GLenum.ALIASED_POINT_SIZE_RANGE: // Float32Array
+ case GLenum.BLEND_COLOR: // Float32Array
+ case GLenum.COLOR_CLEAR_VALUE: // Float32Array
+ case GLenum.DEPTH_RANGE: // Float32Array
+ case GLenum.MAX_VIEWPORT_DIMS: // Int32Array
+ case GLenum.SCISSOR_BOX: // Int32Array
+ case GLenum.VIEWPORT: // Int32Array
+ case GLenum.COMPRESSED_TEXTURE_FORMATS: // Uint32Array
+ default:
+ const [type, ...res] = result.split(',');
+ if (res.length === 1) {
+ return Number(res[0]);
+ } else {
+ return res.map(Number);
+ }
+ }
+ }
+
+ getProgramInfoLog = function (progarm) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getProgramInfoLog + ',' + progarm.id
+ )
+ }
+
+ getProgramParameter = function (program, pname) {
+ const res = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getProgramParameter + ',' + program.id + ',' + pname
+ );
+
+ const [type, result] = res.split(',').map(i => parseInt(i));
+
+ if (type === 1) {
+ return Boolean(result);
+ } else if (type === 2) {
+ return result;
+ } else {
+ throw new Error('Unrecongized program paramater ' + res + ', type: ' + typeof res);
+ }
+ }
+
+
+ getRenderbufferParameter = function (target, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getRenderbufferParameter + ',' + target + ',' + pname
+ )
+ return result;
+ }
+
+
+ getShaderInfoLog = function (shader) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderInfoLog + ',' + shader.id
+ );
+ }
+
+ getShaderParameter = function (shader, pname) {
+ return WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderParameter + ',' + shader.id + ',' + pname
+ )
+ }
+
+ getShaderPrecisionFormat = function (shaderType, precisionType) {
+ const [rangeMin, rangeMax, precision] = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderPrecisionFormat + ',' + shaderType + ',' + precisionType
+ );
+ const shaderPrecisionFormat = new ShaderPrecisionFormat({
+ rangeMin: Number(rangeMin),
+ rangeMax: Number(rangeMax),
+ precision: Number(precision)
+ });
+ return shaderPrecisionFormat;
+ }
+
+ getShaderSource = function (shader) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getShaderSource + ',' + shader.id
+ );
+ return result;
+ }
+
+ getSupportedExtensions = function () {
+ return Object.keys({});
+ }
+
+ getTexParameter = function (target, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getTexParameter + ',' + target + ',' + pname
+ )
+ return result;
+ }
+
+ getUniformLocation = function (program, name) {
+ const id = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getUniformLocation + ',' + program.id + ',' + name
+ );
+ if (id === -1) {
+ return null;
+ } else {
+ return new UniformLocation(Number(id));
+ }
+ }
+
+ getVertexAttrib = function (index, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getVertexAttrib + ',' + index + ',' + pname
+ );
+ switch (pname) {
+ case GLenum.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ return this._map.get(Buffer.uuid(result)) || null;
+ case GLenum.CURRENT_VERTEX_ATTRIB: // Float32Array
+ default:
+ return result;
+ }
+ }
+
+ getVertexAttribOffset = function (index, pname) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.getVertexAttribOffset + ',' + index + ',' + pname
+ )
+ return Number(result);
+ }
+
+ isBuffer = function (buffer) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isBuffer + ',' + buffer.id
+ )
+ return Boolean(result);
+ }
+
+ isContextLost = function () {
+ return false;
+ }
+
+ isEnabled = function (cap) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isEnabled + ',' + cap
+ )
+ return Boolean(result);
+ }
+
+ isFramebuffer = function (framebuffer) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isFramebuffer + ',' + framebuffer.id
+ )
+ return Boolean(result);
+ }
+
+ isProgram = function (program) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isProgram + ',' + program.id
+ )
+ return Boolean(result);
+ }
+
+ isRenderbuffer = function (renderBuffer) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isRenderbuffer + ',' + renderbuffer.id
+ )
+ return Boolean(result);
+ }
+
+ isShader = function (shader) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isShader + ',' + shader.id
+ )
+ return Boolean(result);
+ }
+
+ isTexture = function (texture) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.isTexture + ',' + texture.id
+ );
+ return Boolean(result);
+ }
+
+ lineWidth = function (width) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.lineWidth + ',' + width,
+ true
+ )
+ }
+
+ linkProgram = function (program) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.linkProgram + ',' + program.id,
+ true
+ );
+ }
+
+
+ pixelStorei = function (pname, param) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.pixelStorei + ',' + pname + ',' + Number(param)
+ )
+ }
+
+ polygonOffset = function (factor, units) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.polygonOffset + ',' + factor + ',' + units
+ )
+ }
+
+ readPixels = function (x, y, width, height, format, type, pixels) {
+ const result = WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.readPixels + ',' + x + ',' + y + ',' + width + ',' + height + ',' + format + ',' + type
+ )
+ return result;
+ }
+
+ renderbufferStorage = function (target, internalFormat, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.renderbufferStorage + ',' + target + ',' + internalFormat + ',' + width + ',' + height,
+ true
+ )
+ }
+
+ sampleCoverage = function (value, invert) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.sampleCoverage + ',' + value + ',' + Number(invert),
+ true
+ )
+ }
+
+ scissor = function (x, y, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.scissor + ',' + x + ',' + y + ',' + width + ',' + height,
+ true
+ )
+ }
+
+ shaderSource = function (shader, source) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.shaderSource + ',' + shader.id + ',' + source
+ )
+ }
+
+ stencilFunc = function (func, ref, mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilFunc + ',' + func + ',' + ref + ',' + mask,
+ true
+ )
+ }
+
+ stencilFuncSeparate = function (face, func, ref, mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilFuncSeparate + ',' + face + ',' + func + ',' + ref + ',' + mask,
+ true
+ )
+ }
+
+ stencilMask = function (mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilMask + ',' + mask,
+ true
+ )
+ }
+
+ stencilMaskSeparate = function (face, mask) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilMaskSeparate + ',' + face + ',' + mask,
+ true
+ )
+ }
+
+ stencilOp = function (fail, zfail, zpass) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilOp + ',' + fail + ',' + zfail + ',' + zpass
+ )
+ }
+
+ stencilOpSeparate = function (face, fail, zfail, zpass) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.stencilOp + ',' + face + ',' + fail + ',' + zfail + ',' + zpass,
+ true
+ )
+ }
+
+ texImage2D = function (...args) {
+ WebGLRenderingContext.GBridge.texImage2D(this._canvas.id, ...args);
+ }
+
+
+ texParameterf = function (target, pname, param) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.texParameterf + ',' + target + ',' + pname + ',' + param,
+ true
+ )
+ }
+
+ texParameteri = function (target, pname, param) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.texParameteri + ',' + target + ',' + pname + ',' + param
+ )
+ }
+
+ texSubImage2D = function (...args) {
+ WebGLRenderingContext.GBridge.texSubImage2D(this._canvas.id, ...args);
+ }
+
+ uniform1f = function (location, v0) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1f + ',' + location.id + ',' + v0
+ )
+ }
+
+ uniform1fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform1i = function (location, v0) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1i + ',' + location.id + ',' + v0,
+ // true
+ )
+ }
+
+ uniform1iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform1iv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform2f = function (location, v0, v1) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2f + ',' + location.id + ',' + v0 + ',' + v1,
+ true
+ )
+ }
+
+ uniform2fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform2i = function (location, v0, v1) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2i + ',' + location.id + ',' + v0 + ',' + v1,
+ true
+ )
+ }
+
+ uniform2iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform2iv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform3f = function (location, v0, v1, v2) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2,
+ true
+ )
+ }
+
+ uniform3fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform3i = function (location, v0, v1, v2) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2,
+ true
+ )
+ }
+
+ uniform3iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform3iv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform4f = function (location, v0, v1, v2, v3) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3,
+ true
+ )
+ }
+
+ uniform4fv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4fv + ',' + location.id + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniform4i = function (location, v0, v1, v2, v3) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3,
+ true
+ )
+ }
+
+ uniform4iv = function (location, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniform4iv + ',' + location.id + ',' + processArray(value, true),
+ true
+ )
+ }
+
+ uniformMatrix2fv = function (location, transpose, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniformMatrix2fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniformMatrix3fv = function (location, transpose, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniformMatrix3fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value),
+ true
+ )
+ }
+
+ uniformMatrix4fv = function (location, transpose, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.uniformMatrix4fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value),
+ true
+ );
+ }
+
+ useProgram = function (progarm) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.useProgram + ',' + progarm.id + '',
+ true
+ )
+ }
+
+
+ validateProgram = function (program) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.validateProgram + ',' + program.id,
+ true
+ )
+ }
+
+ vertexAttrib1f = function (index, v0) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib1f + ',' + index + ',' + v0,
+ true
+ )
+ }
+
+ vertexAttrib2f = function (index, v0, v1) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib2f + ',' + index + ',' + v0 + ',' + v1,
+ true
+ )
+ }
+
+ vertexAttrib3f = function (index, v0, v1, v2) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib3f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2,
+ true
+ )
+ }
+
+ vertexAttrib4f = function (index, v0, v1, v2, v3) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib4f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3,
+ true
+ )
+ }
+
+ vertexAttrib1fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib1fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttrib2fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib2fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttrib3fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib3fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttrib4fv = function (index, value) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttrib4fv + ',' + index + ',' + processArray(value),
+ true
+ )
+ }
+
+ vertexAttribPointer = function (index, size, type, normalized, stride, offset) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.vertexAttribPointer + ',' + index + ',' + size + ',' + type + ',' + Number(normalized) + ',' + stride + ',' + offset,
+ true
+ )
+ }
+
+ viewport = function (x, y, width, height) {
+ WebGLRenderingContext.GBridge.callNative(
+ this._canvas.id,
+ GLmethod.viewport + ',' + x + ',' + y + ',' + width + ',' + height,
+ true
+ )
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/Shader.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/Shader.js
new file mode 100644
index 0000000..a3735f7
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/Shader.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 14072 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLShader';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLShader {
+ className = name;
+
+ constructor(id, type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js
new file mode 100644
index 0000000..db17496
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js
@@ -0,0 +1,12 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 614 0 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export default class WebGLShaderPrecisionFormat {
+ className = 'WebGLShaderPrecisionFormat';
+
+ constructor({
+ rangeMin, rangeMax, precision
+ }) {
+ this.rangeMin = rangeMin;
+ this.rangeMax = rangeMax;
+ this.precision = precision;
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/Texture.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/Texture.js
new file mode 100644
index 0000000..a84692b
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/Texture.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 07 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLTexture';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLTexture {
+ className = name;
+
+ constructor(id, type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/UniformLocation.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/UniformLocation.js
new file mode 100644
index 0000000..2fbd943
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/UniformLocation.js
@@ -0,0 +1,23 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 14 0 7 25 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import {getTransferedObjectUUID} from './classUtils';
+
+const name = 'WebGLUniformLocation';
+
+function uuid(id) {
+ return getTransferedObjectUUID(name, id);
+}
+
+export default class WebGLUniformLocation {
+ className = name;
+
+ constructor(id, type) {
+ this.id = id;
+ this.type = type;
+ }
+
+ static uuid = uuid;
+
+ uuid() {
+ return uuid(this.id);
+ }
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/context-webgl/classUtils.js b/components/firstui/fui-qrcode/gcanvas/context-webgl/classUtils.js
new file mode 100644
index 0000000..57db395
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/context-webgl/classUtils.js
@@ -0,0 +1,4 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 61407 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+export function getTransferedObjectUUID(name, id) {
+ return `${name.toLowerCase()}-${id}`;
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/env/canvas.js b/components/firstui/fui-qrcode/gcanvas/env/canvas.js
new file mode 100644
index 0000000..e28b408
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/env/canvas.js
@@ -0,0 +1,75 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 4 0 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import GContext2D from '../context-2d/RenderingContext';
+import GContextWebGL from '../context-webgl/RenderingContext';
+
+export default class GCanvas {
+
+ // static GBridge = null;
+
+ id = null;
+
+ _needRender = true;
+
+ constructor(id, { disableAutoSwap }) {
+ this.id = id;
+
+ this._disableAutoSwap = disableAutoSwap;
+ if (disableAutoSwap) {
+ this._swapBuffers = () => {
+ GCanvas.GBridge.render(this.id);
+ }
+ }
+ }
+
+ getContext(type) {
+
+ let context = null;
+
+ if (type.match(/webgl/i)) {
+ context = new GContextWebGL(this);
+
+ context.componentId = this.id;
+
+ if (!this._disableAutoSwap) {
+ const render = () => {
+ if (this._needRender) {
+ GCanvas.GBridge.render(this.id);
+ this._needRender = false;
+ }
+ }
+ setInterval(render, 16);
+ }
+
+ GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl
+ } else if (type.match(/2d/i)) {
+ context = new GContext2D(this);
+
+ context.componentId = this.id;
+
+// const render = ( callback ) => {
+//
+// const commands = context._drawCommands;
+// context._drawCommands = '';
+//
+// GCanvas.GBridge.render2d(this.id, commands, callback);
+// this._needRender = false;
+// }
+// //draw方法触发
+// context._flush = render;
+// //setInterval(render, 16);
+
+ GCanvas.GBridge.callSetContextType(this.id, 0);
+ } else {
+ throw new Error('not supported context ' + type);
+ }
+
+ return context;
+
+ }
+
+ reset() {
+ GCanvas.GBridge.callReset(this.id);
+ }
+
+
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/env/image.js b/components/firstui/fui-qrcode/gcanvas/env/image.js
new file mode 100644
index 0000000..51d9f35
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/env/image.js
@@ -0,0 +1,97 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 86 140 72549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+let incId = 1;
+
+const noop = function () { };
+
+class GImage {
+
+ static GBridge = null;
+
+ constructor() {
+ this._id = incId++;
+ this._width = 0;
+ this._height = 0;
+ this._src = undefined;
+ this._onload = noop;
+ this._onerror = noop;
+ this.complete = false;
+ }
+
+ get width() {
+ return this._width;
+ }
+ set width(v) {
+ this._width = v;
+ }
+
+ get height() {
+ return this._height;
+ }
+
+ set height(v) {
+ this._height = v;
+ }
+
+ get src() {
+ return this._src;
+ }
+
+ set src(v) {
+
+ if (v.startsWith('//')) {
+ v = 'http:' + v;
+ }
+
+ this._src = v;
+
+ GImage.GBridge.perloadImage([this._src, this._id], (data) => {
+ if (typeof data === 'string') {
+ data = JSON.parse(data);
+ }
+ if (data.error) {
+ var evt = { type: 'error', target: this };
+ this.onerror(evt);
+ } else {
+ this.complete = true;
+ this.width = typeof data.width === 'number' ? data.width : 0;
+ this.height = typeof data.height === 'number' ? data.height : 0;
+ var evt = { type: 'load', target: this };
+ this.onload(evt);
+ }
+ });
+ }
+
+ addEventListener(name, listener) {
+ if (name === 'load') {
+ this.onload = listener;
+ } else if (name === 'error') {
+ this.onerror = listener;
+ }
+ }
+
+ removeEventListener(name, listener) {
+ if (name === 'load') {
+ this.onload = noop;
+ } else if (name === 'error') {
+ this.onerror = noop;
+ }
+ }
+
+ get onload() {
+ return this._onload;
+ }
+
+ set onload(v) {
+ this._onload = v;
+ }
+
+ get onerror() {
+ return this._onerror;
+ }
+
+ set onerror(v) {
+ this._onerror = v;
+ }
+}
+
+export default GImage;
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/env/tool.js b/components/firstui/fui-qrcode/gcanvas/env/tool.js
new file mode 100644
index 0000000..1cfc5ad
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/env/tool.js
@@ -0,0 +1,25 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 1 4 0725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+
+export function ArrayBufferToBase64 (buffer) {
+ var binary = '';
+ var bytes = new Uint8ClampedArray(buffer);
+ for (var len = bytes.byteLength, i = 0; i < len; i++) {
+ binary += String.fromCharCode(bytes[i]);
+ }
+ return btoa(binary);
+}
+
+export function Base64ToUint8ClampedArray(base64String) {
+ const padding = '='.repeat((4 - base64String.length % 4) % 4);
+ const base64 = (base64String + padding)
+ .replace(/\-/g, '+')
+ .replace(/_/g, '/');
+
+ const rawData = atob(base64);
+ const outputArray = new Uint8ClampedArray(rawData.length);
+
+ for (let i = 0; i < rawData.length; ++i) {
+ outputArray[i] = rawData.charCodeAt(i);
+ }
+ return outputArray;
+}
\ No newline at end of file
diff --git a/components/firstui/fui-qrcode/gcanvas/index.js b/components/firstui/fui-qrcode/gcanvas/index.js
new file mode 100644
index 0000000..6797b82
--- /dev/null
+++ b/components/firstui/fui-qrcode/gcanvas/index.js
@@ -0,0 +1,48 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8614 0725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+import GCanvas from './env/canvas';
+import GImage from './env/image';
+
+import GWebGLRenderingContext from './context-webgl/RenderingContext';
+import GContext2D from './context-2d/RenderingContext';
+
+import GBridgeWeex from './bridge/bridge-weex';
+
+export let Image = GImage;
+
+export let WeexBridge = GBridgeWeex;
+
+export function enable(el, {
+ bridge,
+ debug,
+ disableAutoSwap,
+ disableComboCommands
+} = {}) {
+
+ const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge;
+
+ GBridge.callEnable(el.ref, [
+ 0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY
+ -1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE
+ false, // supportScroll
+ false, // newCanvasMode
+ 1, // compatible
+ 'white', // clearColor
+ false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level
+ ]);
+
+ if (debug === true) {
+ GBridge.callEnableDebug();
+ }
+ if (disableComboCommands) {
+ GBridge.callEnableDisableCombo();
+ }
+
+ var canvas = new GCanvas(el.ref, {
+ disableAutoSwap
+ });
+ let pixelRatio = uni.getSystemInfoSync().pixelRatio;
+ canvas.width = el.style.width * pixelRatio;
+ canvas.height = el.style.height * pixelRatio;
+
+ return canvas;
+};
\ No newline at end of file
diff --git a/components/firstui/fui-radio-group/fui-radio-group.vue b/components/firstui/fui-radio-group/fui-radio-group.vue
new file mode 100644
index 0000000..e386026
--- /dev/null
+++ b/components/firstui/fui-radio-group/fui-radio-group.vue
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-radio/fui-radio.vue b/components/firstui/fui-radio/fui-radio.vue
new file mode 100644
index 0000000..2b9c13d
--- /dev/null
+++ b/components/firstui/fui-radio/fui-radio.vue
@@ -0,0 +1,235 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-rate/fui-rate.vue b/components/firstui/fui-rate/fui-rate.vue
new file mode 100644
index 0000000..993ddc6
--- /dev/null
+++ b/components/firstui/fui-rate/fui-rate.vue
@@ -0,0 +1,330 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-request/fui-common.js b/components/firstui/fui-request/fui-common.js
new file mode 100644
index 0000000..97c9f51
--- /dev/null
+++ b/components/firstui/fui-request/fui-common.js
@@ -0,0 +1,120 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6140 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+const base = {
+ //所有配置项,未设置则使用默认值
+ config() {
+ return {
+ //接口域名,如:https://firstui.cn(如果host为空,则直接使用传入的目标地址url)
+ host: '',
+ // 接口地址:/order/getList(如果host为空,直接传入:https://firstui.cn/order/getList)
+ url: '',
+ //参数
+ data: {},
+ //请求头
+ header: {
+ /*
+ * content-type:
+ * application/x-www-form-urlencoded
+ * application/json
+ */
+ 'content-type': 'application/json'
+ },
+ //必须大写
+ method: 'POST',
+ //大于0时才生效,否则使用全局配置或者默认值
+ timeout: 0,
+ dataType: 'json',
+ //是否阻止拦截重复的请求(重复:请求地址url + method + 参数data 一致)
+ prevent: false,
+ //Array 参数data中的key,prevent为true时有效,进行重复请求判断时移除keys中相关参数,如时间戳、随机数等.
+ keys: [],
+ //是否仅返回简要数据:true-仅返回接口数据data,false-返回包含header、statusCode、errMsg、data等数据
+ brief: false,
+ //String 请求标记,用于中断该请求,不同请求不可重复,只可包含数字、字母、下划线,如:firstui_001
+ cancelToken: '',
+ showLoading: true,
+ //加载中提示文本,showLoading为true时有效
+ loadingText: '',
+ errorMsg: '网络不给力,请检查网络设置!',
+ //跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+)
+ withCredentials: false,
+ //DNS解析时优先使用ipv4,仅 App-Android 支持 (HBuilderX 2.8.0+)
+ firstIpv4: false,
+ //get请求时参数值为数组时处理方式,可选值:comma-值逗号拼接,repeat-重复参数名,brackets-带中括号参数名,indices-数组下标参数名
+ arrayFormat: 'comma'
+ }
+ },
+ getOptions(config) {
+ let options = {
+ ...config
+ };
+ ['host', 'timeout', 'prevent', 'keys', 'brief', 'cancelToken', 'showLoading', 'loadingText', 'errorMsg',
+ 'arrayFormat'
+ ]
+ .forEach(item => {
+ delete options[item];
+ })
+ return options;
+ },
+ getParamsHandle(config, arrayFormat) {
+ const options = {
+ ...config
+ }
+ const idx = ['indices', 'repeat', 'brackets'].indexOf(arrayFormat)
+ if (options.data && Object.keys(options.data).length > 0 && idx !== -1) {
+ let params = []
+ Object.entries(options.data).forEach(([key, value]) => {
+ if (Array.isArray(value)) {
+ let _key = key;
+ if (arrayFormat === 'brackets') {
+ _key = `${key}[]`
+ }
+ value.forEach((item, index) => {
+ if (arrayFormat === 'indices') {
+ _key = `${key}[${index}]`
+ }
+ const val = Object.prototype.toString.call(item) === '[object Object]' ?
+ JSON.stringify(item) : item;
+ params.push(`${_key}=${val}`)
+ })
+ } else {
+ params.push(`${key}=${value}`)
+ }
+ })
+
+ options.url = `${options.url}?${params.join('&')}`
+ options.data = {}
+ }
+ return options;
+ },
+ merge(a, b) {
+ return Object.assign({}, a, b);
+ },
+ mergeConfig(defaultConfig, config, init) {
+ let header = base.merge(defaultConfig.header, config.header || {});
+ let params = base.merge(defaultConfig, config)
+ params.header = header;
+ if (!init) {
+ let url = base.combineURLs(params.host, params.url)
+ params.url = url;
+ }
+ return params;
+ },
+ //如果host为空,则直接使用传入的目标地址
+ combineURLs(host, target) {
+ return host ? host.replace(/\s+/g, '') + '/' + target.replace(/\s+/g, '').replace(/^\/+/, '') : target;
+ },
+ toast(text, duration, success) {
+ text && uni.showToast({
+ title: text,
+ icon: success ? 'success' : 'none',
+ duration: duration || 2000
+ })
+ },
+ showLoading(title, mask = true) {
+ uni.showLoading({
+ mask: mask,
+ title: title || '请稍候...'
+ })
+ }
+}
+export default base
\ No newline at end of file
diff --git a/components/firstui/fui-request/fui-taskStore.js b/components/firstui/fui-request/fui-taskStore.js
new file mode 100644
index 0000000..249e2fc
--- /dev/null
+++ b/components/firstui/fui-request/fui-taskStore.js
@@ -0,0 +1,57 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 6 14 07 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+class RequestTaskStore {
+ constructor(taskList = []) {
+ this.taskStore = taskList
+ }
+ setRequestTaskStore(taskArr, taskKey) {
+ taskKey && taskArr.push(taskKey)
+ this.taskStore = taskArr;
+ }
+ removeRequestTask(task) {
+ if (!task) return;
+ const taskKey = this.getRequestTask(task)
+ let taskArr = [...this.taskStore]
+ const index = taskArr.indexOf(taskKey)
+ if (~index) {
+ taskArr.splice(index, 1)
+ this.setRequestTaskStore(taskArr)
+ }
+ }
+ getRequestTask(task) {
+ let {
+ url,
+ method,
+ keys,
+ data
+ } = task;
+ keys = keys || []
+ data = typeof data === 'string' ? JSON.parse(data) : data;
+ let taskArr = [];
+ for (let key in data) {
+ if (data.hasOwnProperty(key) && !~keys.indexOf(key)) {
+ let value = data[key] === null ? '' : data[key];
+ taskArr.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
+ }
+ }
+ return url + method + taskArr.join('');
+ }
+ requestTaskStore(task) {
+ let result = false;
+ if (!task) return result;
+ const taskKey = this.getRequestTask(task)
+ let taskArr = [...this.taskStore]
+ if (taskArr.length > 0) {
+ if (~taskArr.indexOf(taskKey)) {
+ result = true;
+ } else {
+ this.setRequestTaskStore(taskArr, taskKey)
+ }
+ } else {
+ taskKey && this.setRequestTaskStore(taskArr, taskKey)
+ }
+ return result;
+ }
+}
+export default function createTaskStore(taskList = []) {
+ return new RequestTaskStore(taskList)
+}
\ No newline at end of file
diff --git a/components/firstui/fui-request/index.js b/components/firstui/fui-request/index.js
new file mode 100644
index 0000000..9a3b0b6
--- /dev/null
+++ b/components/firstui/fui-request/index.js
@@ -0,0 +1,179 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 140 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+/**
+ * 网络请求
+ * 文档地址:https://doc.firstui.cn/
+ **/
+
+import base from './fui-common.js'
+import createTaskStore from './fui-taskStore.js'
+
+const store = createTaskStore()
+
+class FIRSTUI_INNER {
+ constructor(initConfig = {}) {
+ this.initConfig = initConfig
+ this.request = []
+ this.response = []
+ this.cancelToken = {}
+ this.dispatchRequest = this.dispatchRequest.bind(this)
+ this.loading = false
+ }
+ dispatchRequest(config = {}) {
+ let params = base.mergeConfig(this.initConfig, config)
+ const task = {
+ url: params.url,
+ method: params.method,
+ keys: params.keys,
+ data: params.data
+ }
+ if (params.prevent && store.requestTaskStore(task)) {
+ return new Promise((resolve, reject) => {
+ reject({
+ statusCode: -9998,
+ errMsg: 'request:prevented'
+ })
+ });
+ }
+ const arrayFormat = params.arrayFormat;
+ let options = base.getOptions(params)
+ if (options.method.toLocaleLowerCase() === 'get' && arrayFormat !== 'comma') {
+ options = base.getParamsHandle(options, arrayFormat)
+ }
+ let promise = Promise.resolve(options);
+ promise = promise.then(config => {
+ if (params.showLoading && !this.loading) {
+ base.showLoading(params.loadingText)
+ this.loading = true
+ }
+ return new Promise((resolve, reject) => {
+ let requestTask = uni.request({
+ ...options,
+ success: (res) => {
+ if (params.showLoading && this.loading) {
+ uni.hideLoading()
+ this.loading = false
+ }
+ resolve(params.brief ? res.data : res)
+ },
+ fail: (err) => {
+ if (params.showLoading && this.loading) {
+ uni.hideLoading()
+ this.loading = false
+ }
+
+ if (params.errorMsg) {
+ base.toast(params.errorMsg)
+ }
+ reject(err)
+ },
+ complete: () => {
+ store.removeRequestTask(task)
+ if (params.cancelToken && this.cancelToken[params
+ .cancelToken]) {
+ delete this.cancelToken[params.cancelToken]
+ }
+ }
+ })
+ if (params.cancelToken) {
+ this.cancelToken[params.cancelToken] = requestTask;
+ }
+ if (params.timeout && typeof params.timeout === 'number' && params.timeout > 3000) {
+ setTimeout(() => {
+ try {
+ store.removeRequestTask(task)
+ if (params.cancelToken) {
+ delete this.cancelToken[params.cancelToken]
+ }
+ requestTask.abort();
+ } catch (e) {}
+ resolve({
+ statusCode: -9999,
+ errMsg: 'request:cancelled'
+ });
+ }, params.timeout)
+ }
+ });
+ })
+
+ return promise
+ }
+}
+
+
+const inner = new FIRSTUI_INNER(base.config())
+
+const http = {
+ interceptors: {
+ request: {
+ use: (fulfilled, rejected) => {
+ inner.request.push({
+ fulfilled,
+ rejected
+ })
+ },
+ eject: (name) => {
+ if (inner.request[name]) {
+ inner.request[name] = null;
+ }
+ }
+ },
+ response: {
+ use: (fulfilled, rejected) => {
+ inner.response.push({
+ fulfilled,
+ rejected
+ })
+ },
+ eject: (name) => {
+ if (inner.response[name]) {
+ inner.response[name] = null;
+ }
+ }
+ }
+ },
+ create(config) {
+ inner.initConfig = base.mergeConfig(base.config(), config, true);
+ },
+ get(url, config = {}) {
+ config.method = 'GET'
+ config.url = url || config.url || ''
+ return http.request(config)
+ },
+ post(url, config = {}) {
+ config.method = 'POST'
+ config.url = url || config.url || ''
+ return http.request(config)
+ },
+ all(requests) {
+ return Promise.all(requests)
+ },
+ request(config = {}) {
+ let chain = [inner.dispatchRequest, undefined];
+ let promise = Promise.resolve(config);
+
+ inner.request.forEach(interceptor => {
+ chain.unshift(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ inner.response.forEach(interceptor => {
+ chain.push(interceptor.fulfilled, interceptor.rejected);
+ });
+
+ while (chain.length) {
+ promise = promise.then(chain.shift(), chain.shift());
+ }
+
+ return promise;
+ },
+ abort(cancelToken) {
+ if (!cancelToken) return;
+ try {
+ if (inner.cancelToken[cancelToken]) {
+ inner.cancelToken[cancelToken].abort()
+ delete inner.cancelToken[cancelToken]
+ // console.log('request:cancelled')
+ }
+ } catch (e) {}
+ }
+}
+export default http
\ No newline at end of file
diff --git a/components/firstui/fui-result/fui-result.vue b/components/firstui/fui-result/fui-result.vue
new file mode 100644
index 0000000..3d060ac
--- /dev/null
+++ b/components/firstui/fui-result/fui-result.vue
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+
+
+
+
+ {{ title }}
+ {{ descr }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-rotate-verify/fui-rotate-verify.vue b/components/firstui/fui-rotate-verify/fui-rotate-verify.vue
new file mode 100644
index 0000000..6d87e0c
--- /dev/null
+++ b/components/firstui/fui-rotate-verify/fui-rotate-verify.vue
@@ -0,0 +1,411 @@
+
+
+
+
+
+
+
+ {{ title }}
+ 拖动滑块,使图片角度为正
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-rotate-verify/index.wxs b/components/firstui/fui-rotate-verify/index.wxs
new file mode 100644
index 0000000..3dd1311
--- /dev/null
+++ b/components/firstui/fui-rotate-verify/index.wxs
@@ -0,0 +1,137 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 40 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var twidth = 0
+var swidth = 0
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function bool(str) {
+ return str === 'true' || str == true ? true : false
+}
+
+function touchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0]
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ state.startX = touch.pageX
+ twidth = +dataset.width
+ swidth = +dataset.swidth
+ state.disabled = (+dataset.disabled) == 1 ? true : false
+}
+
+function styleChange(left, deg, ins) {
+ if (!ins) return;
+ var block = ins.selectComponent('.fui-rv__slider');
+ var image = ins.selectComponent('.fui-rv__image')
+ if (!image || !block) return;
+ if (left == 0 && deg == 0) {
+ block.removeClass('fui-rv__un-ani')
+ image.removeClass('fui-rv__un-ani')
+ block.addClass('fui-rv__rest-ani')
+ image.addClass('fui-rv__rest-ani')
+ } else {
+ block.removeClass('fui-rv__rest-ani')
+ image.removeClass('fui-rv__rest-ani')
+ block.addClass('fui-rv__un-ani')
+ image.addClass('fui-rv__un-ani')
+ }
+ block.setStyle({
+ transform: 'translate3d(' + left + 'px,0,0)'
+ })
+ image.setStyle({
+ transform: 'rotate(' + deg + 'deg)'
+ })
+}
+
+function touchmove(e, ins, event) {
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ touch = e.touches[0] || e.changedTouches[0]
+ }
+ if (state.disabled) return;
+ var pageX = touch.pageX;
+ var left = pageX - state.startX + (state.lastLeft || 0);
+ left = left < 0 ? 0 : left;
+ var width = twidth - swidth;
+ left = left >= width ? width : left;
+ state.startX = pageX
+ state.lastLeft = left
+ var deg = 360 / width * left
+ styleChange(left, deg, ins)
+}
+
+function touchend(e, ins, event) {
+ var state = {}
+ if (isH5 && isPC()) {
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ }
+ if (state.disabled) return;
+ var left = twidth - swidth
+ var deg = 360 / left * state.lastLeft
+ ins.callMethod('verify', {
+ angle: deg
+ })
+}
+
+function slidereset(reset, oldreset, owner, ins) {
+ var state = ins.getState()
+ if (reset > 0) {
+ state.startX = 0;
+ state.lastLeft = 0;
+ state.disabled = false;
+ styleChange(0, 0, owner)
+ }
+}
+
+var movable = false;
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ movable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchend(event, ins, e)
+ movable = false
+ }
+}
+
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ touchend: touchend,
+ mousedown: mousedown,
+ slidereset: slidereset
+}
\ No newline at end of file
diff --git a/components/firstui/fui-rotate-verify/mpjs.js b/components/firstui/fui-rotate-verify/mpjs.js
new file mode 100644
index 0000000..38292b0
--- /dev/null
+++ b/components/firstui/fui-rotate-verify/mpjs.js
@@ -0,0 +1,62 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18614 0 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS || MP-WEIXIN || H5
+export default {
+ data() {
+ return {
+ angle: 0,
+ transform: '',
+ startX: 0,
+ lastLeft: 0,
+ resetAni: false
+ }
+ },
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(0, 0)
+ }
+ },
+ methods: {
+ styleChange(left, deg) {
+ if (left == 0 && deg == 0) {
+ this.resetAni = true
+ } else {
+ this.resetAni = false
+ }
+ this.transform = 'translate3d(' + left + 'px,0,0)'
+ this.angle = deg
+ },
+ touchstart(e) {
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.clientX
+ },
+ touchmove(e) {
+ if (this.isPass || this.disabled || !this.isShow) return;
+ let touch = e.touches[0] || e.changedTouches[0]
+ let pageX = touch.clientX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.sliderWidth - this.sliderHeight;
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ let deg = 360 / width * left
+ this.styleChange(left, deg)
+ },
+ touchend(e) {
+ if (this.isPass || this.disabled || !this.isShow) return;
+ let left = this.sliderWidth - this.sliderHeight;
+ let deg = 360 / left * this.lastLeft
+ this.verify({
+ angle: deg
+ })
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-rotate-verify/weex.js b/components/firstui/fui-rotate-verify/weex.js
new file mode 100644
index 0000000..e1fc069
--- /dev/null
+++ b/components/firstui/fui-rotate-verify/weex.js
@@ -0,0 +1,111 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 614 07 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+const animation = uni.requireNativePlugin('animation');
+export default {
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this._animation(0, 0)
+ }
+ },
+ created() {
+ this.startX = 0
+ this.lastLeft = 0
+ this.imgRef = null
+ this.sliderRef = null
+ },
+ methods: {
+ openAni() {
+ this.isShow = true;
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.getEl()
+ this._ani(true);
+ }, 50);
+ });
+ },
+ closeAni(type) {
+ this._ani(false);
+ },
+ _ani(type) {
+ let styles = {
+ opacity: type ? 1 : 0
+ };
+ if (!this.$refs['fui_rv_ani']) return;
+ animation.transition(
+ this.$refs['fui_rv_ani'].ref, {
+ styles,
+ duration: 200, //ms
+ timingFunction: 'ease-in',
+ needLayout: false,
+ delay: 0 //ms
+ },
+ () => {
+ if (!type) {
+ this.isShow = false;
+ }
+ }
+ );
+ },
+ getEl() {
+ this.imgRef = this.$refs['imgRef'].ref
+ this.sliderRef = this.$refs['sliderRef'].ref;
+ },
+ _animation(left, deg) {
+ left = Number(left.toFixed(2))
+ deg = Number(deg.toFixed(2))
+ if (!this.imgRef || !this.sliderRef) return;
+ animation.transition(this.imgRef, {
+ styles: {
+ transform: 'rotate(' + deg + 'deg)'
+ },
+ duration: deg == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ animation.transition(this.sliderRef, {
+ styles: {
+ transform: 'translate(' + left + 'px,0)'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ },
+ touchstart(e) {
+ if (this.isPass || this.disabled || !this.isShow) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.screenX
+ },
+ touchmove(e) {
+ if (this.isPass || this.disabled || !this.isShow) return;
+ let touch = e.changedTouches[0];
+ let pageX = touch.screenX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.sliderWidth - this.sliderHeight;
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ let deg = 360 / width * left
+ this._animation(left, deg)
+ },
+ touchend(e) {
+ if (this.isPass || this.disabled || !this.isShow) return;
+ let left = this.sliderWidth - this.sliderHeight;
+ let deg = 360 / left * this.lastLeft
+ this.verify({
+ angle: deg
+ })
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-row/fui-row.vue b/components/firstui/fui-row/fui-row.vue
new file mode 100644
index 0000000..10b43a2
--- /dev/null
+++ b/components/firstui/fui-row/fui-row.vue
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-safe-area/fui-safe-area.vue b/components/firstui/fui-safe-area/fui-safe-area.vue
new file mode 100644
index 0000000..735651b
--- /dev/null
+++ b/components/firstui/fui-safe-area/fui-safe-area.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-search-bar/fui-search-bar.vue b/components/firstui/fui-search-bar/fui-search-bar.vue
new file mode 100644
index 0000000..63dfbf1
--- /dev/null
+++ b/components/firstui/fui-search-bar/fui-search-bar.vue
@@ -0,0 +1,562 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ placeholder }}
+
+
+ {{ cancelText }}
+ {{ searchText }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-section/fui-section.vue b/components/firstui/fui-section/fui-section.vue
new file mode 100644
index 0000000..6e77dc8
--- /dev/null
+++ b/components/firstui/fui-section/fui-section.vue
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+ {{title}}
+
+
+
+ {{descr}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-segmented-control/fui-segmented-control.vue b/components/firstui/fui-segmented-control/fui-segmented-control.vue
new file mode 100644
index 0000000..d25e0bd
--- /dev/null
+++ b/components/firstui/fui-segmented-control/fui-segmented-control.vue
@@ -0,0 +1,222 @@
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-select/fui-select.vue b/components/firstui/fui-select/fui-select.vue
new file mode 100644
index 0000000..eb77116
--- /dev/null
+++ b/components/firstui/fui-select/fui-select.vue
@@ -0,0 +1,783 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model[textKey]}}
+
+
+
+
+
+
+
+ {{btnText}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-share-sheet/fui-share-sheet.vue b/components/firstui/fui-share-sheet/fui-share-sheet.vue
new file mode 100644
index 0000000..23c47e5
--- /dev/null
+++ b/components/firstui/fui-share-sheet/fui-share-sheet.vue
@@ -0,0 +1,594 @@
+
+
+
+
+
+
+
+ {{!title || title==='true' || title===true?'':title}}
+
+
+
+
+
+
+
+
+
+ {{obj.text}}
+
+
+
+
+
+
+
+
+ {{btnText}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-single-input/fui-single-input.vue b/components/firstui/fui-single-input/fui-single-input.vue
new file mode 100644
index 0000000..277887f
--- /dev/null
+++ b/components/firstui/fui-single-input/fui-single-input.vue
@@ -0,0 +1,544 @@
+
+
+
+
+
+ {{password?(inputVal[index] ? '●':''):(inputVal[index] || '')}}
+ {{password?(inputVal[index] ? '●':''):(inputVal[index] || '')}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-skeleton/fui-skeleton.vue b/components/firstui/fui-skeleton/fui-skeleton.vue
new file mode 100644
index 0000000..429d29c
--- /dev/null
+++ b/components/firstui/fui-skeleton/fui-skeleton.vue
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-slide-verify/fui-slide-verify.vue b/components/firstui/fui-slide-verify/fui-slide-verify.vue
new file mode 100644
index 0000000..cb90b1e
--- /dev/null
+++ b/components/firstui/fui-slide-verify/fui-slide-verify.vue
@@ -0,0 +1,382 @@
+
+
+
+ 拖动滑块至虚线框内
+
+
+
+
+
+
+
+ 验证通过
+
+
+ 验证通过
+
+ 拖动滑块至虚线框内
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-slide-verify/index.wxs b/components/firstui/fui-slide-verify/index.wxs
new file mode 100644
index 0000000..1ae7139
--- /dev/null
+++ b/components/firstui/fui-slide-verify/index.wxs
@@ -0,0 +1,149 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 14 072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var twidth = 300
+var swidth = 32
+var range = 3
+var tleft = 300
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function bool(str) {
+ return str === 'true' || str == true ? true : false
+}
+
+function touchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0]
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ state.startX = touch.pageX
+ swidth = +dataset.swidth
+ range = +dataset.range
+ twidth = +dataset.width
+ tleft = +dataset.tleft
+ //H5获取bool值为undefined
+ state.pass = (+dataset.pass) == 1 ? true : false
+}
+
+function styleChange(left, ins) {
+ if (!ins) return;
+ var slider = ins.selectComponent('.fui-sv__slider')
+ var foreground = ins.selectComponent('.fui-sv__foreground')
+ if (!slider || !foreground) return;
+ if (left == 0) {
+ slider.removeClass('fui-sv__un-ani')
+ foreground.removeClass('fui-sv__un-ani')
+ slider.addClass('fui-sv__reset-ani')
+ foreground.addClass('fui-sv__reset-ani')
+ } else {
+
+ slider.removeClass('fui-sv__reset-ani')
+ foreground.removeClass('fui-sv__reset-ani')
+ slider.addClass('fui-sv__un-ani')
+ foreground.addClass('fui-sv__un-ani')
+ }
+ slider.setStyle({
+ transform: 'translate3d(' + left + 'px,0,0)'
+ })
+ foreground.setStyle({
+ width: left + 'px'
+ })
+}
+
+function touchmove(e, ins, event) {
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ touch = e.touches[0] || e.changedTouches[0]
+ }
+ if (state.pass) return;
+ var pageX = touch.pageX;
+ var left = pageX - state.startX + (state.lastLeft || 0);
+ left = left < 0 ? 0 : left;
+ var width = twidth - swidth;
+ left = left >= width ? width : left;
+ state.startX = pageX
+ state.lastLeft = left
+ styleChange(left, ins)
+}
+
+function touchend(e, ins, event) {
+ var state = {}
+ if (isH5 && isPC()) {
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ }
+ if (state.pass) return;
+ var left = tleft - swidth
+ if (Math.abs(left - state.lastLeft) <= range) {
+ // styleChange(left, ins)
+ state.pass = true
+ ins.callMethod('success')
+ } else {
+ state.startX = 0;
+ state.lastLeft = 0;
+ state.pass = false;
+ styleChange(0, ins)
+ ins.callMethod('fail')
+ }
+}
+
+function slidereset(reset, oldreset, owner, ins) {
+ var state = ins.getState()
+ if (reset > 0) {
+ state.startX = 0;
+ state.lastLeft = 0;
+ state.pass = false;
+ styleChange(0, owner)
+ }
+}
+
+var movable = false;
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ movable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchend(event, ins, e)
+ movable = false
+ }
+}
+
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ touchend: touchend,
+ mousedown: mousedown,
+ slidereset: slidereset
+}
\ No newline at end of file
diff --git a/components/firstui/fui-slide-verify/mpjs.js b/components/firstui/fui-slide-verify/mpjs.js
new file mode 100644
index 0000000..e014ec5
--- /dev/null
+++ b/components/firstui/fui-slide-verify/mpjs.js
@@ -0,0 +1,66 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 4 0725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS || MP-WEIXIN || H5
+export default {
+ data() {
+ return {
+ transform: '',
+ fwidth: 0,
+ startX: 0,
+ lastLeft: 0,
+ resetAni: false
+ }
+ },
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(0)
+ }
+ },
+ methods: {
+ styleChange(left) {
+ if (left == 0) {
+ this.resetAni = true
+ } else {
+ this.resetAni = false
+ }
+ this.fwidth = left
+ this.transform = 'translate3d(' + left + 'px,0,0)'
+ },
+ touchstart(e) {
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.clientX
+ },
+ touchmove(e) {
+ if (this.isPass) return;
+ let touch = e.touches[0] || e.changedTouches[0]
+ let pageX = touch.clientX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.totalWidth - this.sliderW;
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ this.styleChange(left)
+ },
+ touchend(e) {
+ if (this.isPass) return;
+ let left = this.targetWidth - this.sliderW
+ if (Math.abs(left - this.lastLeft) <= Number(this.range)) {
+ // this.styleChange(left)
+ this.success()
+ } else {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(0)
+ this.fail()
+ }
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-slide-verify/weex.js b/components/firstui/fui-slide-verify/weex.js
new file mode 100644
index 0000000..7379613
--- /dev/null
+++ b/components/firstui/fui-slide-verify/weex.js
@@ -0,0 +1,89 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 40 7 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+const animation = uni.requireNativePlugin('animation');
+export default {
+ data() {
+ return {
+ passWidth: 0
+ };
+ },
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this._animation(0)
+ }
+ },
+ created() {
+ this.startX = 0
+ this.lastLeft = 0
+ },
+ mounted() {
+ this.foreground = this.getEl(this.$refs['foreground'])
+ this.slider = this.getEl(this.$refs['slider']);
+ },
+ methods: {
+ getEl(el) {
+ return el.ref;
+ },
+ _animation(left) {
+ if (!this.foreground || !this.slider) return;
+ animation.transition(this.foreground, {
+ styles: {
+ width: left + 'px'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ animation.transition(this.slider, {
+ styles: {
+ transform: 'translate(' + left + 'px,0)'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ },
+ touchstart(e) {
+ if (this.isPass) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.screenX
+ },
+ touchmove(e) {
+ if (this.isPass) return;
+ let touch = e.changedTouches[0];
+ let pageX = touch.screenX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.totalWidth - this.sliderW;
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ this._animation(left)
+ },
+ touchend(e) {
+ if (this.isPass) return;
+ let left = this.targetWidth - this.sliderW
+ if (Math.abs(left - this.lastLeft) <= Number(this.range)) {
+ this.passWidth = this.lastLeft;
+ this.success()
+ } else {
+ setTimeout(() => {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this._animation(0)
+ this.fail()
+ }, 20)
+ }
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-slider-captcha/fui-slider-captcha.vue b/components/firstui/fui-slider-captcha/fui-slider-captcha.vue
new file mode 100644
index 0000000..e84a160
--- /dev/null
+++ b/components/firstui/fui-slider-captcha/fui-slider-captcha.vue
@@ -0,0 +1,724 @@
+
+
+
+
+
+
+
+
+ {{ title }}
+ 拖动下方滑块完成拼图
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-slider-captcha/index.wxs b/components/firstui/fui-slider-captcha/index.wxs
new file mode 100644
index 0000000..1c34dbf
--- /dev/null
+++ b/components/firstui/fui-slider-captcha/index.wxs
@@ -0,0 +1,168 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 86 1 4072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var twidth = 300
+var swidth = 32
+var range = 3
+var start = 0
+var end = 0
+var type = 1
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function bool(str) {
+ return str === 'true' || str == true ? true : false
+}
+
+function getSlipDistance(left) {
+ var width = twidth - start - 44
+ var distance = left / (twidth - swidth) * width
+ return distance > width ? width : distance
+}
+
+function styleChange(left, ins) {
+ if (!ins || !ins.selectComponent('.fui-sc__slot-box')) return;
+ var slotLeft = getSlipDistance(left)
+ var slider = ins.selectComponent('.fui-sc__slider')
+ var slot = ins.selectComponent('.fui-sc__slot-box')
+ if (!slider || !slot) return;
+
+ if (left == 0) {
+ slider.removeClass('fui-sc__un-ani')
+ slot.removeClass('fui-sc__un-ani')
+ slider.addClass('fui-sc__reset-ani')
+ slot.addClass('fui-sc__reset-ani')
+ } else {
+ slider.removeClass('fui-sc__reset-ani')
+ slot.removeClass('fui-sc__reset-ani')
+ slider.addClass('fui-sc__un-ani')
+ slot.addClass('fui-sc__un-ani')
+ }
+ slider.setStyle({
+ transform: 'translate3d(' + left + 'px,0,0)'
+ })
+ slot.setStyle({
+ transform: 'translate3d(' + slotLeft + 'px,0,0)'
+ })
+}
+
+function touchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0]
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ state.startX = touch.pageX
+ type = +dataset.type
+ start = +dataset.start
+ end = +dataset.end
+ swidth = +dataset.swidth
+ range = +dataset.range
+ twidth = +dataset.width
+ //H5获取bool值为undefined
+ state.disabled = (+dataset.disabled) == 1 ? true : false
+}
+
+function touchmove(e, ins, event) {
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ touch = e.touches[0] || e.changedTouches[0]
+ }
+ if (state.disabled) return;
+ var pageX = touch.pageX;
+ var left = pageX - state.startX + (state.lastLeft || 0);
+ left = left < 0 ? 0 : left;
+ var width = twidth - swidth;
+ left = left >= width ? width : left;
+ state.startX = pageX
+ state.lastLeft = left
+ styleChange(left, ins)
+}
+
+function touchend(e, ins, event) {
+ var state = {}
+ if (isH5 && isPC()) {
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ }
+ if (state.disabled) return;
+ //前端验证
+ var slotLeft = getSlipDistance(state.lastLeft)
+ if (type == 1) {
+ var width = end - start
+ if (Math.abs(slotLeft - width) <= range) {
+ state.disabled = true
+ ins.callMethod('success')
+ } else {
+ state.startX = 0;
+ state.lastLeft = 0;
+ state.disabled = false;
+ styleChange(0, ins)
+ ins.callMethod('fail')
+ }
+ } else {
+ //后端验证
+ ins.callMethod('verify', {
+ slip: slotLeft
+ })
+ }
+}
+
+function slidereset(reset, oldreset, owner, ins) {
+ var state = ins.getState()
+ if (reset > 0) {
+ state.startX = 0;
+ state.lastLeft = 0;
+ state.disabled = false;
+ styleChange(0, owner)
+ }
+}
+
+var movable = false;
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ movable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchend(event, ins, e)
+ movable = false
+ }
+}
+
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ touchend: touchend,
+ mousedown: mousedown,
+ slidereset: slidereset
+}
\ No newline at end of file
diff --git a/components/firstui/fui-slider-captcha/mpjs.js b/components/firstui/fui-slider-captcha/mpjs.js
new file mode 100644
index 0000000..b756f9b
--- /dev/null
+++ b/components/firstui/fui-slider-captcha/mpjs.js
@@ -0,0 +1,82 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6 1 4072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS || MP-WEIXIN || H5
+export default {
+ data() {
+ return {
+ transform: '',
+ transformSlot: '',
+ startX: 0,
+ lastLeft: 0,
+ resetAni: false
+ }
+ },
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(0)
+ }
+ },
+ methods: {
+ getSlipDistance(left) {
+ let width = this.w - this.x - 44
+ let distance = left / (this.w - (this.sliderH * 2)) * width
+ return distance > width ? width : distance
+ },
+ styleChange(left) {
+ if (left == 0) {
+ this.resetAni = true
+ } else {
+ this.resetAni = false
+ }
+ let slotLeft = this.getSlipDistance(left)
+ this.transformSlot = 'translate3d(' + slotLeft + 'px,0,0)'
+ this.transform = 'translate3d(' + left + 'px,0,0)'
+ },
+ touchstart(e) {
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.clientX
+ },
+ touchmove(e) {
+ if (this.isPass || this.disabled || !this.slotSrc || !this.isShow) return;
+ let touch = e.touches[0] || e.changedTouches[0]
+ let pageX = touch.clientX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.w - (this.sliderH * 2);
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ this.styleChange(left)
+ },
+ touchend(e) {
+ if (this.isPass || this.disabled || !this.slotSrc || !this.isShow) return;
+ //前端验证
+ let slotLeft = this.getSlipDistance(this.lastLeft)
+ if (this.type == 1) {
+ let width = this.x1 - this.x
+ if (Math.abs(slotLeft - width) <= this.range) {
+ this.disabled = true
+ this.success()
+ } else {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.disabled = false;
+ this.styleChange(0)
+ this.fail()
+ }
+ } else {
+ //后端验证
+ this.verify({
+ slip: slotLeft
+ })
+ }
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-slider-captcha/weex.js b/components/firstui/fui-slider-captcha/weex.js
new file mode 100644
index 0000000..17e32dd
--- /dev/null
+++ b/components/firstui/fui-slider-captcha/weex.js
@@ -0,0 +1,131 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 40 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+const animation = uni.requireNativePlugin('animation');
+export default {
+ watch: {
+ resetNum(val) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this._animation(0)
+ }
+ },
+ created() {
+ this.startX = 0
+ this.lastLeft = 0
+ this.imgRef = null
+ this.sliderRef = null
+ },
+ methods: {
+ openAni() {
+ this.isShow = true;
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.getEl()
+ this._ani(true);
+ }, 50);
+ });
+ },
+ closeAni(type) {
+ this._ani(false);
+ },
+ _ani(type) {
+ let styles = {
+ opacity: type ? 1 : 0
+ };
+ if (!this.$refs['fui_sc_ani']) return;
+ animation.transition(
+ this.$refs['fui_sc_ani'].ref, {
+ styles,
+ duration: 200, //ms
+ timingFunction: 'ease-in',
+ needLayout: false,
+ delay: 0 //ms
+ },
+ () => {
+ if (!type) {
+ this.isShow = false;
+ }
+ }
+ );
+ },
+ getEl() {
+ this.imgRef = this.$refs['imgRef'].ref
+ this.sliderRef = this.$refs['sliderRef'].ref;
+ },
+ getSlipDistance(left) {
+ let width = this.w - this.x - 44
+ let distance = left / (this.w - (this.sliderH * 2)) * width
+ return distance > width ? width : distance
+ },
+ _animation(left) {
+ let slotLeft = this.getSlipDistance(left).toFixed(2)
+ left = left.toFixed(2)
+ if (!this.imgRef || !this.sliderRef) return;
+ animation.transition(this.imgRef, {
+ styles: {
+ transform: 'translate(' + slotLeft + 'px,0)'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ animation.transition(this.sliderRef, {
+ styles: {
+ transform: 'translate(' + left + 'px,0)'
+ },
+ duration: left == 0 ? 200 : 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ },
+ touchstart(e) {
+ if (this.isPass || this.disabled || !this.slotSrc || !this.isShow) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.screenX
+ },
+ touchmove(e) {
+ if (this.isPass || this.disabled || !this.slotSrc || !this.isShow) return;
+ let touch = e.changedTouches[0];
+ let pageX = touch.screenX;
+ let left = pageX - this.startX + this.lastLeft;
+ left = left < 0 ? 0 : left;
+ let width = this.w - (this.sliderH * 2);
+ left = left >= width ? width : left;
+ this.startX = pageX
+ this.lastLeft = left
+ this._animation(left)
+ },
+ touchend(e) {
+ if (this.isPass || this.disabled || !this.slotSrc || !this.isShow) return;
+ let slotLeft = this.getSlipDistance(this.lastLeft)
+ if (this.type == 1) {
+ let width = this.x1 - this.x
+ if (Math.abs(slotLeft - width) <= this.range) {
+ this.disabled = true
+ this.success()
+ } else {
+ setTimeout(() => {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.disabled = false;
+ this._animation(0)
+ this.fail()
+ }, 20)
+ }
+ } else {
+ //后端验证
+ this.verify({
+ slip: slotLeft
+ })
+ }
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-slider/bindingx.js b/components/firstui/fui-slider/bindingx.js
new file mode 100644
index 0000000..21d504a
--- /dev/null
+++ b/components/firstui/fui-slider/bindingx.js
@@ -0,0 +1,212 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 4 072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+//BindingX实现滑动比较流畅(已实现),缺点不好实时更新数据,暂时废弃
+// const BindingX = uni.requireNativePlugin('bindingx');
+const animation = uni.requireNativePlugin('animation');
+export default {
+ data() {
+ return {
+ isRight: false,
+ isAndroid: false
+ }
+ },
+ watch: {
+ value(val) {
+ this.initData(val)
+ },
+ endValue(val) {
+ if (this.section) {
+ this.initEndData(val)
+ }
+ },
+ isRight(val) {
+ if (!val) {
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.handleRight = this.getEl(this.$refs['handleRight'])
+ }, 50)
+ })
+ }
+ }
+ },
+ created() {
+ const res = uni.getSystemInfoSync();
+ this.isAndroid = res.platform.toLocaleLowerCase() == "android"
+ this.startX = 0
+ this.endX = 0
+ this.lastLeft = 0
+ this.onceLeft = 0
+ this.lastRight = 0
+ this.onceRight = 0
+ },
+ mounted() {
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.handleLeft = this.getEl(this.$refs['handleLeft'])
+ this.poleLeft = this.getEl(this.$refs['poleLeft']);
+ this.handleRight = null;
+ this.poleRight = null;
+ this.initData(this.value)
+ if (this.section) {
+ this.handleRight = this.getEl(this.$refs['handleRight'])
+ this.poleRight = this.getEl(this.$refs['poleRight']);
+ this.initEndData(this.endValue)
+ }
+ }, 50)
+ })
+ },
+ methods: {
+ getEl(el) {
+ return el.ref;
+ },
+ initData(value) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(Number(value), true)
+ },
+ initEndData(value) {
+ this.endX = 0;
+ this.lastRight = 0;
+ value = Number(this.max) - Number(value) + Number(this.min)
+ this.styleSectionChange(value, true)
+ },
+ format(value) {
+ value = Number(value)
+ let step = Number(this.step)
+ return Math.round(Math.max(Number(this.min), Math.min(value, Number(this.max))) / step) * step;
+ },
+ _animation(move, trans, isRight) {
+ animation.transition(
+ isRight ? this.handleRight : this.handleLeft, {
+ styles: {
+ transform: move
+ },
+ duration: 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ animation.transition(
+ isRight ? this.poleRight : this.poleLeft, {
+ styles: {
+ transform: trans
+ },
+ duration: 0,
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0
+ });
+ },
+ touchstart(e) {
+ if (this.disabled) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.screenX
+ },
+ endTouchstart(e) {
+ if (this.disabled) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.endX = touch.screenX
+ },
+ changeValue(value, isStart, isEnd) {
+ var params = {
+ value: value,
+ isStart: isStart
+ }
+ if (isEnd) {
+ this.change(params)
+ } else {
+ this.changing(params)
+ }
+ },
+ styleChange(value, isEnd) {
+ value = this.format(value);
+ const min = Number(this.min)
+ const max = Number(this.max)
+ if (this.section) {
+ value = value > this.end ? this.end : value;
+ }
+ this.changeValue(value, true, isEnd)
+ var dvalue = max - min;
+ var maxWidth = Number(this.width) - Number(this.blockWidth);
+ var width = (value - min) / dvalue * maxWidth;
+ this.lastLeft = width
+ if (isEnd) {
+ this.onceLeft = width
+ }
+ this._animation(`translateX(${width}px)`, `translateX(-${Number(this.width)-width}px)`, false)
+ this.isRight = value === max
+ },
+ styleSectionChange(value, isEnd) {
+ value = this.format(value);
+ const min = Number(this.min)
+ const max = Number(this.max)
+ var total = max + min;
+ var val = total - value;
+ val = val < this.start ? this.start : val;
+ value = total - val;
+ this.changeValue(val, false, isEnd)
+ var dvalue = max - min;
+ var maxWidth = Number(this.width) - Number(this.blockWidth);
+ var width = (value - min) / dvalue * maxWidth;
+ this.lastRight = width
+ if (isEnd) {
+ this.onceRight = width
+ }
+ this._animation(`translateX(-${width}px)`, `translateX(${Number(this.width)-width}px)`, true)
+ },
+ touchmove(e) {
+ if (this.disabled) return;
+ let touch = e.changedTouches[0];
+ let pageX = touch.screenX;
+ this.drag = true
+ let left = pageX - this.startX + (this.onceLeft || 0);
+ left = left < 0 ? 0 : left;
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ left = left >= maxWidth ? maxWidth : left;
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (left / maxWidth) * dvalue + Number(this.min);
+ // this.startX = pageX
+ this.lastLeft = left
+ this.styleChange(value, false)
+ },
+ endTouchmove(e) {
+ if (this.disabled) return;
+ let touch = e.changedTouches[0];
+ let pageX = touch.screenX;
+ this.drag = true
+ let left = this.endX - pageX + (this.onceRight || 0);
+ left = left < 0 ? 0 : left;
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ left = left >= maxWidth ? maxWidth : left;
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (left / maxWidth) * dvalue + Number(this.min);
+ // this.endX = pageX
+ this.lastRight = left
+ this.styleSectionChange(value, false)
+ },
+ touchend(e) {
+ if (this.disabled) return;
+ if (this.drag) {
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (this.lastLeft / maxWidth) * dvalue + Number(this.min);
+ this.styleChange(value, true)
+ }
+ },
+ endTouchend(e) {
+ if (this.disabled) return;
+ if (this.drag) {
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (this.lastRight / maxWidth) * dvalue + Number(this.min);
+ this.styleSectionChange(value, true)
+ }
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-slider/fui-slider.vue b/components/firstui/fui-slider/fui-slider.vue
new file mode 100644
index 0000000..276da8f
--- /dev/null
+++ b/components/firstui/fui-slider/fui-slider.vue
@@ -0,0 +1,398 @@
+
+
+
+ {{start}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{section?end:start}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-slider/index.wxs b/components/firstui/fui-slider/index.wxs
new file mode 100644
index 0000000..c155b5f
--- /dev/null
+++ b/components/firstui/fui-slider/index.wxs
@@ -0,0 +1,290 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 86 14 07254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var slider = {
+ width: 240,
+ blockWidth: 24,
+ step: 1,
+ min: 0,
+ max: 100,
+ disabled: false,
+ section: false,
+ start: 0,
+ end: 0,
+ drag: false
+}
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function bool(str) {
+ return str === 'true' || str == true ? true : false
+}
+
+function format(value) {
+ return Math.round(Math.max(slider.min, Math.min(value, slider.max)) / slider.step) * slider.step;
+}
+
+function setInitValue(dataset, isChange) {
+ slider.drag = false
+ slider.width = +dataset.width
+ slider.blockWidth = +dataset.blockwidth
+ slider.step = +dataset.step
+ slider.min = +dataset.min
+ slider.max = +dataset.max
+ //H5获取bool值为undefined
+ slider.disabled = (+dataset.disabled) == 1 ? true : false
+ slider.section = (+dataset.section) == 1 ? true : false
+ slider.start = format(+dataset.value)
+ slider.end = format(+dataset.end)
+}
+
+function touchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0];
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ state.startX = touch.clientX
+ setInitValue(dataset)
+}
+
+function sectionTouchstart(e, ins) {
+ var state = e.instance.getState()
+ var touch = e.touches[0] || e.changedTouches[0];
+ if (isH5 && isPC()) {
+ touch = e;
+ }
+ var dataset = e.instance.getDataset()
+ state.sectionStartX = touch.clientX
+ setInitValue(dataset)
+}
+
+function changeValue(value, isStart, isEnd, ins) {
+ var params = {
+ value: value,
+ isStart: isStart
+ }
+ if (isEnd) {
+ ins.callMethod('change', params)
+ } else {
+ ins.callMethod('changing', params)
+ }
+}
+
+function styleChange(value, ins, isEnd, state) {
+ if (!ins) return;
+ value = format(value);
+ if (slider.section) {
+ value = value > slider.end ? slider.end : value;
+ }
+ changeValue(value, true, isEnd, ins)
+ var dvalue = slider.max - slider.min;
+ var maxWidth = slider.width - slider.blockWidth;
+ var width = (value - slider.min) / dvalue * maxWidth;
+ var block = ins.selectComponent('.fui-slider__handle-left');
+ var glided = ins.selectComponent('.fui-slider__pole-left');
+ if (!block || !glided) return;
+ if (state) {
+ state.lastLeft = width
+ }
+ block.setStyle({
+ transform: 'translate3d(' + width + 'px,0,0)',
+ 'z-index': value === slider.max ? 5 : 3
+ })
+ glided.setStyle({
+ width: width + 'px'
+ })
+}
+
+function styleSectionChange(value, ins, isEnd, state) {
+ if (!ins) return;
+ value = format(value);
+ var total = slider.max + slider.min;
+ var val = total - value;
+ val = val < slider.start ? slider.start : val;
+ value = total - val;
+ changeValue(val, false, isEnd, ins)
+ var dvalue = slider.max - slider.min;
+ var maxWidth = slider.width - slider.blockWidth;
+ var width = (value - slider.min) / dvalue * maxWidth;
+ var block = ins.selectComponent('.fui-slider__handle-right');
+ var glided = ins.selectComponent('.fui-slider__pole-right');
+ if (!block || !glided) return;
+ if (state) {
+ state.lastSectionLeft = width
+ }
+ block.setStyle({
+ transform: 'translate3d(-' + width + 'px,0,0)'
+ })
+ glided.setStyle({
+ width: width + 'px'
+ })
+}
+
+function touchmove(e, ins, event) {
+ if (slider.disabled) return;
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ touch = e.touches[0] || e.changedTouches[0]
+ state = e.instance.getState()
+ }
+ var pageX = touch.clientX;
+ slider.drag = true
+ var left = pageX - state.startX + (state.lastLeft || 0);
+ left = left < 0 ? 0 : left;
+ var maxWidth = slider.width - slider.blockWidth;
+ left = left >= maxWidth ? maxWidth : left;
+ var dvalue = slider.max - slider.min;
+ var value = (left / maxWidth) * dvalue + slider.min;
+ state.startX = pageX
+ state.lastLeft = left
+ styleChange(value, ins, false)
+}
+
+function sectionTouchmove(e, ins, event) {
+ if (slider.disabled) return;
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+ var state = {}
+ var touch = {}
+ if (isH5 && isPC()) {
+ touch = e;
+ state = event.instance.getState()
+ } else {
+ touch = e.touches[0] || e.changedTouches[0]
+ state = e.instance.getState()
+ }
+ var pageX = touch.clientX;
+ slider.drag = true
+ var left = state.sectionStartX - pageX + (state.lastSectionLeft || 0);
+ left = left < 0 ? 0 : left;
+ var maxWidth = slider.width - slider.blockWidth;
+ left = left >= maxWidth ? maxWidth : left;
+ var dvalue = slider.max - slider.min;
+ var value = (left / maxWidth) * dvalue + slider.min;
+ state.sectionStartX = pageX
+ state.lastSectionLeft = left
+ styleSectionChange(value, ins, false)
+}
+
+function touchend(e, ins, event) {
+ if (slider.disabled) return;
+ if (slider.drag) {
+ var state = {}
+ if (isH5 && isPC()) {
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ }
+ var maxWidth = slider.width - slider.blockWidth;
+ var dvalue = slider.max - slider.min;
+ var value = (state.lastLeft / maxWidth) * dvalue + slider.min;
+ styleChange(value, ins, true, state)
+ }
+}
+
+
+
+function sectionTouchend(e, ins, event) {
+ if (slider.disabled) return;
+ if (slider.drag) {
+ var state = {}
+ if (isH5 && isPC()) {
+ state = event.instance.getState()
+ } else {
+ state = e.instance.getState()
+ }
+ var maxWidth = slider.width - slider.blockWidth;
+ var dvalue = slider.max - slider.min;
+ var value = (state.lastSectionLeft / maxWidth) * dvalue + slider.min;
+ styleSectionChange(value, ins, true, state)
+ }
+}
+
+function slidevalue(value, oldValue, owner, ins) {
+ var state = ins.getState()
+ state.startX = 0;
+ state.lastLeft = 0;
+ var dataset = ins.getDataset()
+ setInitValue(dataset)
+ styleChange(value, owner, true, state)
+}
+
+function sectionSlidevalue(value, oldValue, owner, ins) {
+ var state = ins.getState()
+ state.sectionStartX = 0;
+ state.lastSectionLeft = 0;
+ var dataset = ins.getDataset()
+ setInitValue(dataset)
+ value = slider.max - value + slider.min
+ styleSectionChange(value, owner, true, state)
+}
+var movable = false;
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ movable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC() || !movable) return
+ touchend(event, ins, e)
+ movable = false
+ }
+}
+
+var endMovable = false;
+
+function endMousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ sectionTouchstart(e, ins)
+ endMovable = true
+ window.onmousemove = function(event) {
+ if (!isH5 || !isPC() || !endMovable) return
+ sectionTouchmove(event, ins, e)
+ }
+ window.onmouseup = function(event) {
+ if (!isH5 || !isPC()) return
+ sectionTouchend(event, ins, e)
+ endMovable = false
+ }
+}
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ touchend: touchend,
+ mousedown: mousedown,
+ slidevalue: slidevalue,
+ sectionTouchstart: sectionTouchstart,
+ sectionTouchmove: sectionTouchmove,
+ sectionTouchend: sectionTouchend,
+ endMousedown: endMousedown,
+ sectionSlidevalue: sectionSlidevalue
+}
\ No newline at end of file
diff --git a/components/firstui/fui-slider/mpjs.js b/components/firstui/fui-slider/mpjs.js
new file mode 100644
index 0000000..bc973cf
--- /dev/null
+++ b/components/firstui/fui-slider/mpjs.js
@@ -0,0 +1,170 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 407 25 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS || MP-WEIXIN || H5
+
+export default {
+ watch: {
+ value(val) {
+ this.initData(val)
+ },
+ endValue(val) {
+ if (this.section) {
+ this.initEndData(val)
+ }
+ }
+ },
+ data() {
+ return {
+ drag: false,
+ startX: 0,
+ endX: 0,
+ lastLeft: 0,
+ onceLeft: 0,
+ lastRight: 0,
+ onceRight: 0,
+ moveLeft: 'translate3d(0,0,0)',
+ transLeft: 'translate3d(-100%, 0, 0)',
+ moveRight: 'translate3d(0,0,0)',
+ transRight: 'translate3d(100%, 0, 0)',
+ isRight: false
+ }
+ },
+ mounted() {
+ this.$nextTick(()=>{
+ this.initData(this.value)
+ if (this.section) {
+ this.initEndData(this.endValue)
+ }
+ })
+ },
+ methods: {
+ initData(value) {
+ this.startX = 0;
+ this.lastLeft = 0;
+ this.styleChange(Number(value), true)
+ },
+ initEndData(value) {
+ this.endX = 0;
+ this.lastRight = 0;
+ value = Number(this.max) - Number(value) + Number(this.min)
+ this.styleSectionChange(value, true)
+ },
+ format(value) {
+ value = Number(value)
+ let step = Number(this.step)
+ return Math.round(Math.max(Number(this.min), Math.min(value, Number(this.max))) / step) * step;
+ },
+ touchstart(e) {
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.startX = touch.clientX
+ },
+ endTouchstart(e) {
+ let touch = e.touches[0] || e.changedTouches[0];
+ this.endX = touch.clientX
+ },
+ changeValue(value, isStart, isEnd) {
+ var params = {
+ value: value,
+ isStart: isStart
+ }
+ if (isEnd) {
+ this.change(params)
+ } else {
+ this.changing(params)
+ }
+ },
+ styleChange(value, isEnd) {
+ value = this.format(value);
+ if (this.section) {
+ value = value > this.end ? this.end : value;
+ }
+ this.changeValue(value, true, isEnd)
+ const min = Number(this.min)
+ const max = Number(this.max)
+ var dvalue = max - min;
+ var maxWidth = Number(this.width) - Number(this.blockWidth);
+ var width = (value - min) / dvalue * maxWidth;
+ this.lastLeft = width
+ if (isEnd) {
+ this.onceLeft = width
+ }
+ this.transLeft = `translate3d(-${Number(this.width)-width}px,0,0)`
+ this.moveLeft = `translate3d(${width}px,0,0)`
+ this.isRight = value === max
+ },
+ styleSectionChange(value, isEnd) {
+ value = this.format(value);
+ const min = Number(this.min)
+ const max = Number(this.max)
+ var total = max + min;
+ var val = total - value;
+ val = val < this.start ? this.start : val;
+ value = total - val;
+ this.changeValue(val, false, isEnd)
+ var dvalue = max - min;
+ var maxWidth = Number(this.width) - Number(this.blockWidth);
+ var width = (value - min) / dvalue * maxWidth;
+ this.lastRight = width
+ if (isEnd) {
+ this.onceRight = width
+ }
+ this.transRight = `translate3d(${Number(this.width)-width}px,0,0)`
+ this.moveRight = `translate3d(-${width}px,0,0)`
+ },
+ touchmove(e) {
+ if (this.disabled) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ let pageX = touch.clientX;
+ this.drag = true
+ let left = pageX - this.startX + (this.onceLeft || 0);
+ left = left < 0 ? 0 : left;
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ left = left >= maxWidth ? maxWidth : left;
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (left / maxWidth) * dvalue + Number(this.min);
+ // this.startX = pageX
+ this.lastLeft = left
+ this.styleChange(value, false)
+ },
+ endTouchmove(e) {
+ if (this.disabled) return;
+ let touch = e.touches[0] || e.changedTouches[0];
+ let pageX = touch.clientX;
+ this.drag = true
+ let left = this.endX - pageX + (this.onceRight || 0);
+ left = left < 0 ? 0 : left;
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ left = left >= maxWidth ? maxWidth : left;
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (left / maxWidth) * dvalue + Number(this.min);
+ // this.endX = pageX
+ this.lastRight = left
+ this.styleSectionChange(value, false)
+ },
+ touchend(e) {
+ if (this.disabled) return;
+ if (this.drag) {
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (this.lastLeft / maxWidth) * dvalue + Number(this.min);
+ this.styleChange(value, true)
+ this.drag = false
+ }
+ },
+ endTouchend(e) {
+ if (this.disabled) return;
+ if (this.drag) {
+ let maxWidth = Number(this.width) - Number(this.blockWidth);
+ let dvalue = Number(this.max) - Number(this.min);
+ let value = (this.lastRight / maxWidth) * dvalue + Number(this.min);
+ this.styleSectionChange(value, true)
+ this.drag = false
+ }
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-spin/fui-spin.vue b/components/firstui/fui-spin/fui-spin.vue
new file mode 100644
index 0000000..41a1e03
--- /dev/null
+++ b/components/firstui/fui-spin/fui-spin.vue
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-status-bar/fui-status-bar.vue b/components/firstui/fui-status-bar/fui-status-bar.vue
new file mode 100644
index 0000000..4b4d6b3
--- /dev/null
+++ b/components/firstui/fui-status-bar/fui-status-bar.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-steps/fui-steps.vue b/components/firstui/fui-steps/fui-steps.vue
new file mode 100644
index 0000000..b5d94a5
--- /dev/null
+++ b/components/firstui/fui-steps/fui-steps.vue
@@ -0,0 +1,484 @@
+
+
+
+
+
+
+
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+ {{item.descr}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-sticky/fui-sticky.vue b/components/firstui/fui-sticky/fui-sticky.vue
new file mode 100644
index 0000000..87217fd
--- /dev/null
+++ b/components/firstui/fui-sticky/fui-sticky.vue
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-swipe-action/bindingx.js b/components/firstui/fui-swipe-action/bindingx.js
new file mode 100644
index 0000000..1be182e
--- /dev/null
+++ b/components/firstui/fui-swipe-action/bindingx.js
@@ -0,0 +1,226 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 6140 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-NVUE
+const BindingX = uni.requireNativePlugin('bindingx');
+const dom = uni.requireNativePlugin('dom');
+const animation = uni.requireNativePlugin('animation');
+
+export default {
+ data() {
+ return {}
+ },
+ watch: {
+ show(newVal) {
+ // if (this.autoClose) return
+ if (this.stop) return
+ this.stop = true
+ if (newVal) {
+ this.open(newVal)
+ } else {
+ this.close()
+ }
+ },
+ buttons(newVal) {
+ this.init()
+ }
+ },
+ created() {
+ this.group = this.getParent()
+ if (this.group.children !== undefined) {
+ this.group.children.push(this)
+ }
+ },
+ mounted() {
+ this.$nextTick(()=>{
+ this.box = this.getEl(this.$refs['fui_swipea_wrap'])
+ this.selector = this.getEl(this.$refs['fui_swipea_content']);
+ this.rightButton = this.getEl(this.$refs['fui_swipea_buttons']);
+ })
+ this.init()
+ },
+ methods: {
+ init() {
+ this.$nextTick(() => {
+ this.x = 0
+ this.button = {
+ show: false
+ }
+ setTimeout(() => {
+ this.getSelectorQuery()
+ }, 200)
+ })
+ },
+ handleClick(e, index, item) {
+ e.stopPropagation();
+ this.$emit('click', {
+ item,
+ index,
+ param: this.param
+ })
+ },
+ touchstart(e) {
+ if (this.disabled) return
+ // 每次只触发一次,避免多次监听造成闪烁
+ if (this.stop) return
+ this.stop = true
+ if (this.autoClose) {
+ this.group && this.group.closeAuto(this)
+ }
+
+ const rightWidth = this.button.right.width || 0
+ let expression = this.range(this.x, -rightWidth, 0)
+ let rightExpression = this.range(this.x + rightWidth, 0, rightWidth)
+
+ this.eventpan = BindingX.bind({
+ anchor: this.box,
+ eventType: 'pan',
+ props: [{
+ element: this.selector,
+ property: 'transform.translateX',
+ expression
+ }, {
+ element: this.rightButton,
+ property: 'transform.translateX',
+ expression: rightExpression
+ }]
+ }, (e) => {
+ if (e.state === 'end') {
+ this.x = e.deltaX + this.x;
+ this.isclick = true
+ this.bindTiming(e.deltaX)
+ }
+ });
+ },
+ touchend(e) {
+ if (this.isopen && !this.isclick) {
+ this.open(false)
+ }
+ },
+ bindTiming(x) {
+ const left = this.x
+ const rightWidth = this.button.right.width || 0
+ const threshold = Number(this.threshold)
+ if (!this.isopen) {
+ if (left < -threshold) {
+ this.open(true)
+ } else {
+ this.open(false)
+ }
+ } else {
+ if ((x < threshold && x > 0) || (x < -threshold)) {
+ this.open(true)
+ } else {
+ this.open(false)
+ }
+ }
+ },
+ range(num, mix, max) {
+ return `min(max(x+${num}, ${mix}), ${max})`
+ },
+ open(type) {
+ this.animation(type)
+ },
+ close() {
+ this.animation(false)
+ },
+ animation(type) {
+ const time = 300
+ const rightWidth = this.button.right.width || 0
+ if (this.eventpan && this.eventpan.token) {
+ BindingX.unbind({
+ token: this.eventpan.token,
+ eventType: 'pan'
+ })
+ }
+
+ if (type) {
+ Promise.all([
+ this.move(this.selector, -rightWidth),
+ this.move(this.rightButton, 0)
+ ]).then(() => {
+ this.setEmit(-rightWidth, type)
+ })
+ } else {
+ Promise.all([
+ this.move(this.selector, 0),
+ this.move(this.rightButton, rightWidth)
+ ]).then(() => {
+ this.setEmit(0, type)
+ })
+ }
+ },
+ setEmit(x, type) {
+ const rightWidth = this.button.right.width
+ this.isopen = this.isopen || false
+ this.stop = false
+ this.isclick = false
+ if (this.isopen !== type && this.x !== x) {
+ if (type && rightWidth > 0) {
+ this.$emit('change', {
+ isOpen: true,
+ param: this.param
+ })
+ }
+ if (!type) {
+ this.$emit('change', {
+ isOpen: false,
+ param: this.param
+ })
+ }
+ }
+ this.x = x
+ this.isopen = type
+ },
+ move(ref, value) {
+ return new Promise((resolve, reject) => {
+ animation.transition(ref, {
+ styles: {
+ transform: `translateX(${value})`,
+ },
+ duration: 150, //ms
+ timingFunction: 'linear',
+ needLayout: false,
+ delay: 0 //ms
+ }, function(res) {
+ resolve(res)
+ })
+ })
+
+ },
+ getEl(el) {
+ return el.ref
+ },
+ getSelectorQuery() {
+ Promise.all([
+ this.getDom(),
+ ]).then((data) => {
+ // let show = false
+ // if (!this.autoClose) {
+ // show = this.show
+ // }
+ // if (show) {
+ // this.open(show)
+ // }
+ this.open(this.show)
+ })
+
+ },
+ getDom() {
+ return new Promise((resolve, reject) => {
+ dom.getComponentRect(this.$refs['fui_swipea_buttons'], (data) => {
+ if (data) {
+ this.button['right'] = data.size
+ resolve(data)
+ } else {
+ reject()
+ }
+ })
+ })
+ }
+ }
+}
+
+// #endif
+
+// #ifndef APP-NVUE
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-swipe-action/fui-swipe-action.vue b/components/firstui/fui-swipe-action/fui-swipe-action.vue
new file mode 100644
index 0000000..e1fc15e
--- /dev/null
+++ b/components/firstui/fui-swipe-action/fui-swipe-action.vue
@@ -0,0 +1,234 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-swipe-action/index.wxs b/components/firstui/fui-swipe-action/index.wxs
new file mode 100644
index 0000000..0e194bb
--- /dev/null
+++ b/components/firstui/fui-swipe-action/index.wxs
@@ -0,0 +1,244 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8614 07 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+var MIN_DISTANCE = 10
+
+function isPC() {
+ if (typeof navigator !== 'object') return false;
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (var v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+}
+var isH5 = false
+if (typeof window === 'object') isH5 = true
+
+function getDom(ins, ownerInstance) {
+ var state = ins.getState()
+ var rightDom = ownerInstance.selectComponent('.fui-swipe__action-right')
+ if (!rightDom) {
+ state.rightWidth = 0;
+ return;
+ }
+ if (isH5 || isPC()) {
+ if (rightDom['$el']) {
+ state.rightWidth = rightDom['$el'].offsetWidth || 0
+ } else {
+ state.rightWidth = 0
+ }
+ } else {
+ var rightStyles = rightDom.getBoundingClientRect()
+ state.rightWidth = rightStyles.width || 0
+ }
+}
+
+function getDirection(x, y) {
+ if (x > y && x > MIN_DISTANCE) {
+ return 'horizontal';
+ }
+ if (y > x && y > MIN_DISTANCE) {
+ return 'vertical';
+ }
+ return '';
+}
+
+function stopTouchMove(event) {
+ var instance = event.instance;
+ var state = instance.getState();
+ var touch = event.touches[0];
+ if (isH5 && isPC()) {
+ touch = event;
+ }
+ state.deltaX = touch.clientX - state.startX;
+ state.deltaY = touch.clientY - state.startY;
+ state.offsetY = Math.abs(state.deltaY);
+ state.offsetX = Math.abs(state.deltaX);
+ state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
+}
+
+function stopTouchStart(event) {
+ var instance = event.instance;
+ var state = instance.getState();
+ resetTouchStatus(instance);
+ var touch = event.touches[0];
+ if (isH5 && isPC()) {
+ touch = event;
+ }
+ state.startX = touch.clientX;
+ state.startY = touch.clientY;
+}
+
+function touchstart(e, ownerInstance) {
+ var ins = e.instance;
+ var state = ins.getState();
+ getDom(ins, ownerInstance)
+ if (state.disabled) return
+ // 开始触摸时移除动画类
+ ins.requestAnimationFrame(function() {
+ ins.removeClass('fui-swipe__action-ani');
+ ownerInstance.callMethod('closeSwipe');
+ })
+
+ // 记录上次的位置
+ state.x = state.left || 0
+ // 计算滑动开始位置
+ stopTouchStart(e, ownerInstance)
+}
+
+function move(value, ins, ownerInstance) {
+ value = value || 0
+ var state = ins.getState()
+ var rightWidth = state.rightWidth
+ // 获取可滑动范围
+ state.left = Math.min(Math.max(value, -rightWidth), 0);
+ ins.requestAnimationFrame(function() {
+ ins.setStyle({
+ transform: 'translateX(' + state.left + 'px)',
+ '-webkit-transform': 'translateX(' + state.left + 'px)'
+ })
+ })
+}
+
+function touchmove(e, ownerInstance) {
+ var ins = e.instance;
+ var state = ins.getState()
+ if (state.disabled) return;
+ // 是否可以滑动页面
+ stopTouchMove(e);
+ if (state.direction !== 'horizontal') return;
+
+ if (e.preventDefault) {
+ // 阻止页面滚动
+ e.preventDefault()
+ }
+
+ move(state.x + state.deltaX, ins, ownerInstance)
+}
+
+function openState(type, ins, ownerInstance) {
+ var state = ins.getState()
+ var leftWidth = state.leftWidth
+ var rightWidth = state.rightWidth
+ var left = ''
+ state.open = state.open ? state.open : 'none'
+ if (type === 'right' || type === true) {
+ left = -rightWidth
+ } else {
+ left = 0
+ }
+ if (state.open !== type) {
+ state.throttle = true
+ ownerInstance.callMethod('change', {
+ open: type
+ })
+ }
+
+ state.open = type
+ // 添加动画类
+ ins.requestAnimationFrame(function() {
+ ins.addClass('fui-swipe__action-ani');
+ move(left, ins, ownerInstance)
+ })
+}
+
+function moveDirection(left, ins, ownerInstance) {
+ var state = ins.getState()
+ var threshold = state.threshold || 30
+ var position = state.position
+ var open = state.open || 'none'
+ var rightWidth = state.rightWidth
+ if (state.deltaX === 0) {
+ openState('none', ins, ownerInstance)
+ return
+ }
+ if ((open === 'none' && rightWidth > 0 && -left > threshold) || (open !== 'none' && rightWidth > 0 &&
+ rightWidth +
+ left < threshold)) {
+ openState('right', ins, ownerInstance)
+ } else {
+ // default
+ openState('none', ins, ownerInstance)
+ }
+}
+
+function touchend(e, ownerInstance) {
+ var instance = e.instance;
+ var state = instance.getState()
+ if (state.disabled) return
+ moveDirection(state.left, instance, ownerInstance)
+}
+
+function resetTouchStatus(instance) {
+ var state = instance.getState();
+ state.direction = '';
+ state.deltaX = 0;
+ state.deltaY = 0;
+ state.offsetX = 0;
+ state.offsetY = 0;
+}
+
+function showChange(newVal, oldVal, ownerInstance, instance) {
+ var state = instance.getState()
+ getDom(instance, ownerInstance)
+ if (newVal && newVal !== 'none') {
+ openState(newVal || 'right', instance, ownerInstance)
+ return
+ }
+
+ if (state.left) {
+ openState('none', instance, ownerInstance)
+ }
+ resetTouchStatus(instance)
+}
+
+var movable = false
+
+function mousedown(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchstart(e, ins)
+ movable = true
+}
+
+function mousemove(e, ins) {
+ if (!isH5 || !isPC() || !movable) return
+ touchmove(e, ins)
+}
+
+function mouseup(e, ins) {
+ if (!isH5 || !isPC()) return
+ touchend(e, ins)
+ movable = false
+}
+
+function mouseleave(e, ins) {
+ if (!isH5 || !isPC()) return
+ movable = false
+}
+
+function disabledChange(newVal, oldVal, ownerInstance, ins) {
+ var st = ins.getState()
+ st.disabled = newVal
+}
+
+function thresholdChange(newVal, oldVal, ownerInstance, ins) {
+ var st = ins.getState()
+ st.threshold = newVal || 30
+}
+
+
+module.exports = {
+ touchstart: touchstart,
+ touchmove: touchmove,
+ touchend: touchend,
+ mousedown: mousedown,
+ mousemove: mousemove,
+ mouseup: mouseup,
+ mouseleave: mouseleave,
+ disabledChange: disabledChange,
+ thresholdChange: thresholdChange,
+ showChange: showChange
+}
\ No newline at end of file
diff --git a/components/firstui/fui-swipe-action/mpjs.js b/components/firstui/fui-swipe-action/mpjs.js
new file mode 100644
index 0000000..dfc18c4
--- /dev/null
+++ b/components/firstui/fui-swipe-action/mpjs.js
@@ -0,0 +1,195 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 861 4 0 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifndef APP-PLUS|| MP-WEIXIN || H5
+
+const MIN_DISTANCE = 10;
+export default {
+ data() {
+ const elClass = `fui_sa_${Math.ceil(Math.random() * 10e5).toString(36)}`
+ return {
+ left: 0,
+ isShow: false,
+ ani: false,
+ moveLeft: '',
+ elClass
+ }
+ },
+ watch: {
+ show(newVal) {
+ // if (this.autoClose) return
+ this.openState(newVal)
+ },
+ left() {
+ this.moveLeft = `translateX(${this.left}px)`
+ },
+ isShow(newVal) {
+ // if (this.autoClose) return
+ this.openState(newVal)
+ },
+ buttons() {
+ this.init()
+ }
+ },
+ mounted() {
+ this.$nextTick(()=>{
+ this.group = this.getParent()
+ if (this.group.children !== undefined) {
+ this.group.children.push(this)
+ }
+ this.init()
+ })
+ },
+ methods: {
+ init() {
+ clearTimeout(this.timer)
+ this.timer = setTimeout(() => {
+ this.getSelectorQuery()
+ }, 100)
+ this.left = 0
+ this.x = 0
+ },
+ closeSwipe(e) {
+ if (!this.autoClose) return
+ this.group && this.group.closeAuto(this)
+ },
+ //解决 ios 13 点击区域错位的问题
+ appTouchStart(e) {
+ const {
+ clientX
+ } = e.changedTouches[0]
+ this.clientX = clientX
+ this.timestamp = new Date().getTime()
+ },
+ appTouchEnd(e, index, item) {
+ const {
+ clientX
+ } = e.changedTouches[0]
+ let diff = Math.abs(this.clientX - clientX)
+ let time = (new Date().getTime()) - this.timestamp
+ if (diff < 40 && time < 300) {
+ this.$emit('click', {
+ item,
+ index,
+ param: this.param
+ })
+ }
+ },
+ touchstart(e) {
+ if (this.disabled) return
+ this.ani = false
+ this.x = this.left || 0
+ this.stopTouchStart(e)
+ this.autoClose && this.closeSwipe()
+ },
+ touchmove(e) {
+ if (this.disabled) return
+ // 是否可以滑动页面
+ this.stopTouchMove(e);
+ if (this.direction !== 'horizontal') {
+ return;
+ }
+ this.move(this.x + this.deltaX)
+ return false
+ },
+ touchend() {
+ if (this.disabled) return
+ this.moveDirection(this.left)
+ },
+ move(value) {
+ value = value || 0
+ const rightWidth = this.rightWidth
+ this.left = Math.min(Math.max(value, -rightWidth), 0);
+ },
+ moveDirection(left) {
+ const threshold = Number(this.threshold)
+ const open = this.open || false
+ const leftWidth = this.leftWidth
+ const rightWidth = this.rightWidth
+ if (this.deltaX === 0) {
+ this.openState(false)
+ return
+ }
+ if ((!open && rightWidth > 0 && -left > threshold) || (open && rightWidth > 0 && rightWidth + left <
+ threshold)) {
+ this.openState(true)
+ } else {
+ this.openState(false)
+ }
+ },
+ openState(type) {
+ const rightWidth = this.rightWidth
+ let left = ''
+ this.open = this.open ? this.open : false
+ if (type) {
+ left = -rightWidth
+ } else {
+ left = 0
+ }
+ if (this.open !== type) {
+ this.$emit('change', {
+ isOpen: type,
+ param: this.param
+ })
+ }
+
+ this.open = type
+ // 添加动画类
+ this.ani = true
+ this.$nextTick(() => {
+ this.move(left)
+ })
+ },
+ close() {
+ this.openState(false)
+ },
+ getDirection(x, y) {
+ if (x > y && x > MIN_DISTANCE) {
+ return 'horizontal';
+ }
+ if (y > x && y > MIN_DISTANCE) {
+ return 'vertical';
+ }
+ return '';
+ },
+ resetTouchStatus() {
+ this.direction = '';
+ this.deltaX = 0;
+ this.deltaY = 0;
+ this.offsetX = 0;
+ this.offsetY = 0;
+ },
+ stopTouchStart(event) {
+ this.resetTouchStatus();
+ const touch = event.touches[0];
+ this.startX = touch.clientX;
+ this.startY = touch.clientY;
+ },
+ stopTouchMove(event) {
+ const touch = event.touches[0];
+ this.deltaX = touch.clientX - this.startX;
+ this.deltaY = touch.clientY - this.startY;
+ this.offsetX = Math.abs(this.deltaX);
+ this.offsetY = Math.abs(this.deltaY);
+ this.direction = this.direction || this.getDirection(this.offsetX, this.offsetY);
+ },
+
+ getSelectorQuery() {
+ uni.createSelectorQuery()
+ // #ifndef MP-ALIPAY
+ .in(this)
+ // #endif
+ .select('.' + this.elClass)
+ .boundingClientRect(data => {
+ if (data.length === 0) return
+ this.rightWidth = data.width || 0
+ this.isShow = this.show
+ })
+ .exec()
+ }
+ }
+}
+
+// #endif
+
+// #ifdef APP-PLUS|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-swipe-action/mpwxs.js b/components/firstui/fui-swipe-action/mpwxs.js
new file mode 100644
index 0000000..29fc79c
--- /dev/null
+++ b/components/firstui/fui-swipe-action/mpwxs.js
@@ -0,0 +1,107 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61 40 725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef APP-VUE|| MP-WEIXIN || H5
+export default {
+ data() {
+ return {
+ isShow: false,
+ isDisabled: false,
+ thresholdVal: 30
+ }
+ },
+ watch: {
+ show(newVal) {
+ this.isShow = this.show
+ },
+ disabled(val) {
+ this.isDisabled = this.disabled
+ },
+ threshold(val) {
+ this.thresholdVal = Number(this.threshold)
+ }
+ },
+ created() {
+ this.group = this.getParent()
+ if (this.group.children !== undefined) {
+ this.group.children.push(this)
+ }
+ },
+ mounted() {
+ this.$nextTick(() => {
+ setTimeout(() => {
+ this.isShow = this.show
+ this.isDisabled = this.disabled
+ this.thresholdVal = Number(this.threshold)
+ }, 10)
+ })
+ },
+ methods: {
+ closeSwipe(e) {
+ if (!this.autoClose) return
+ this.group && this.group.closeAuto(this)
+ },
+ change(e) {
+ this.$emit('change', {
+ isOpen: e.open === 'right',
+ param: this.param
+ })
+ if (this.isShow !== e.open) {
+ this.isShow = e.open
+ }
+ },
+ isPC() {
+ var userAgentInfo = navigator.userAgent;
+ var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
+ var flag = true;
+ for (let v = 0; v < Agents.length - 1; v++) {
+ if (userAgentInfo.indexOf(Agents[v]) > 0) {
+ flag = false;
+ break;
+ }
+ }
+ return flag;
+ },
+ //解决 ios 13 点击区域错位的问题
+ appTouchStart(e) {
+ // #ifdef H5
+ if (this.isPC()) return
+ // #endif
+ const {
+ clientX
+ } = e.changedTouches[0]
+ this.clientX = clientX
+ this.timestamp = new Date().getTime()
+ },
+ appTouchEnd(e, index, item) {
+ // #ifdef H5
+ if (this.isPC()) return
+ // #endif
+ const {
+ clientX
+ } = e.changedTouches[0]
+ let diff = Math.abs(this.clientX - clientX)
+ let time = (new Date().getTime()) - this.timestamp
+ if (diff < 40 && time < 300) {
+ this.$emit('click', {
+ index,
+ item,
+ param: this.param
+ })
+ }
+ },
+ handleClick(index, item) {
+ // #ifdef H5
+ if (!this.isPC()) return
+ this.$emit('click', {
+ index,
+ item,
+ param: this.param
+ })
+ // #endif
+ }
+ }
+}
+
+// #endif
+// #ifndef APP-VUE|| MP-WEIXIN || H5
+export default {}
+// #endif
\ No newline at end of file
diff --git a/components/firstui/fui-swipeaction-group/fui-swipeaction-group.vue b/components/firstui/fui-swipeaction-group/fui-swipeaction-group.vue
new file mode 100644
index 0000000..409d001
--- /dev/null
+++ b/components/firstui/fui-swipeaction-group/fui-swipeaction-group.vue
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-swiper-dot/fui-swiper-dot.vue b/components/firstui/fui-swiper-dot/fui-swiper-dot.vue
new file mode 100644
index 0000000..7cbd646
--- /dev/null
+++ b/components/firstui/fui-swiper-dot/fui-swiper-dot.vue
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+ {{index+1}}
+
+
+ {{items[current][field]}}
+
+
+ {{current+1}}/{{items.length}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-switch/fui-switch.vue b/components/firstui/fui-switch/fui-switch.vue
new file mode 100644
index 0000000..ca1e299
--- /dev/null
+++ b/components/firstui/fui-switch/fui-switch.vue
@@ -0,0 +1,304 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-tabbar/fui-tabbar.vue b/components/firstui/fui-tabbar/fui-tabbar.vue
new file mode 100644
index 0000000..512bee8
--- /dev/null
+++ b/components/firstui/fui-tabbar/fui-tabbar.vue
@@ -0,0 +1,391 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{item.dot?'':item.badge}}
+
+ {{item.text}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-table/fui-table.vue b/components/firstui/fui-table/fui-table.vue
new file mode 100644
index 0000000..42679eb
--- /dev/null
+++ b/components/firstui/fui-table/fui-table.vue
@@ -0,0 +1,793 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.label || item.prop}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item[model.prop] || ''}}
+
+
+ {{btn.text}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-tabs/fui-tabs.vue b/components/firstui/fui-tabs/fui-tabs.vue
new file mode 100644
index 0000000..5176861
--- /dev/null
+++ b/components/firstui/fui-tabs/fui-tabs.vue
@@ -0,0 +1,542 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{tab.name}}
+ {{tab.name}}
+ {{isDot?'':tab.badge}}
+
+
+
+
+
+
+ {{tab.name}}{{isDot?'':tab.badge}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-tag/fui-tag.vue b/components/firstui/fui-tag/fui-tag.vue
new file mode 100644
index 0000000..766858f
--- /dev/null
+++ b/components/firstui/fui-tag/fui-tag.vue
@@ -0,0 +1,368 @@
+
+
+
+ {{text}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-text/fui-text.vue b/components/firstui/fui-text/fui-text.vue
new file mode 100644
index 0000000..d0adf9d
--- /dev/null
+++ b/components/firstui/fui-text/fui-text.vue
@@ -0,0 +1,286 @@
+
+
+
+
+
+ {{getText(text, textType, format)}}
+
+
+
+ {{getText(text, textType, format)}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-textarea/fui-textarea.vue b/components/firstui/fui-textarea/fui-textarea.vue
new file mode 100644
index 0000000..e401b1f
--- /dev/null
+++ b/components/firstui/fui-textarea/fui-textarea.vue
@@ -0,0 +1,634 @@
+
+
+
+
+
+
+
+
+
+
+ *
+
+ *
+
+
+ *
+
+
+ {{label}}
+
+
+
+
+
+ {{maxlength!=-1?`${count}/${maxlength}`:count}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-theme/fui-theme.css b/components/firstui/fui-theme/fui-theme.css
new file mode 100644
index 0000000..9fbfb2a
--- /dev/null
+++ b/components/firstui/fui-theme/fui-theme.css
@@ -0,0 +1,85 @@
+/*
+ FirstUI组件内置的基础变量
+ 1.如果你是组件使用者,你可以通过修改这些变量的值来定制自己的组件主题,实现自定义主题功能
+ 2.如果全局修改需要在项目根目录下App.vue文件中引入此css文件
+ 3.如果组件中有props属性是针对颜色设置(默认为空值),则优先级:props变量(如果有传值)> 全局主题色
+*/
+
+/* #ifndef APP-NVUE */
+page {
+ /* 行为相关颜色 */
+ --fui-color-primary: #465CFF;
+ --fui-color-success: #09BE4F;
+ --fui-color-warning: #FFB703;
+ --fui-color-danger: #FF2B2B;
+ --fui-color-purple: #6831FF;
+
+ /* 文字基本颜色、其他辅助色 */
+ /* 用于重量级文字信息、标题 */
+ --fui-color-title: #181818;
+ /* 用于普通级段落信息、引导词 */
+ --fui-color-section: #333333;
+ /* 用于次要标题内容 */
+ --fui-color-subtitle: #7F7F7F;
+ /* 用于底部标签、描述、次要文字信息 */
+ --fui-color-label: #B2B2B2;
+ /* 用于辅助、次要信息、禁用文字等。如:待输入状态描述文字,已点击按钮文字 */
+ --fui-color-minor: #CCCCCC;
+ --fui-color-white: #FFFFFF;
+ /* 链接颜色 */
+ --fui-color-link: #465CFF;
+
+
+ /* 背景颜色 */
+ --fui-bg-color: #ffffff;
+ /* 页面背景底色 */
+ --fui-bg-color-grey: #F1F4FA;
+ /* 内容模块底色 */
+ --fui-bg-color-content: #F8F8F8;
+ --fui-bg-color-red: rgba(255, 43, 43, .05);
+ --fui-bg-color-yellow: rgba(255, 183, 3, .1);
+ --fui-bg-color-purple: rgba(104, 49, 255, .05);
+ --fui-bg-color-green: rgba(9, 190, 79, .05);
+ /* 点击背景色 */
+ --fui-bg-color-hover: rgba(0, 0, 0, 0.2);
+ /* 遮罩颜色 */
+ --fui-bg-color-mask: rgba(0, 0, 0, 0.6);
+
+
+ /* 边框颜色 */
+ --fui-color-border: #EEEEEE;
+
+ /* 阴影颜色 */
+ --fui-color-shadow: rgba(2, 4, 38, 0.05);
+
+ /*禁用态的透明度 */
+ --fui-opacity-disabled: 0.5;
+
+ /* 图标尺寸 */
+ --fui-img-size-sm: 48rpx;
+ --fui-img-size-base: 56rpx;
+ --fui-img-size-middle: 64rpx;
+ --fui-img-size-lg: 96rpx;
+
+ /* 图片尺寸 */
+ --fui-img-sm: 60rpx;
+ --fui-img-base: 120rpx;
+ --fui-img-lg: 240rpx;
+
+ /* Border Radius */
+ --fui-border-radius-sm: 16rpx;
+ --fui-border-radius-base: 24rpx;
+ --fui-border-radius-lg: 48rpx;
+ --fui-border-radius-circle: 50%;
+
+ /* 水平间距 */
+ --fui-spacing-row-sm: 16rpx;
+ --fui-spacing-row-base: 24rpx;
+ --fui-spacing-row-lg: 32rpx;
+
+ /* 垂直间距 */
+ --fui-spacing-col-sm: 8rpx;
+ --fui-spacing-col-base: 16rpx;
+ --fui-spacing-col-lg: 24rpx;
+}
+/* #endif */
diff --git a/components/firstui/fui-timeaxis-node/fui-timeaxis-node.vue b/components/firstui/fui-timeaxis-node/fui-timeaxis-node.vue
new file mode 100644
index 0000000..041e940
--- /dev/null
+++ b/components/firstui/fui-timeaxis-node/fui-timeaxis-node.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-timeaxis/fui-timeaxis.vue b/components/firstui/fui-timeaxis/fui-timeaxis.vue
new file mode 100644
index 0000000..f3a26dc
--- /dev/null
+++ b/components/firstui/fui-timeaxis/fui-timeaxis.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-timer/fui-timer.vue b/components/firstui/fui-timer/fui-timer.vue
new file mode 100644
index 0000000..9221e6b
--- /dev/null
+++ b/components/firstui/fui-timer/fui-timer.vue
@@ -0,0 +1,375 @@
+
+
+
+ {{ d }}
+ 天
+ {{ h }}
+ {{ isColon ? ':' : '时' }}
+ {{ m }}
+ {{ isColon ? ':' : '分' }}
+ {{ s }}
+ {{ isColon ? '' : '秒' }}
+ .
+
+
+ {{ item }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-toast/fui-toast.vue b/components/firstui/fui-toast/fui-toast.vue
new file mode 100644
index 0000000..cec2bb1
--- /dev/null
+++ b/components/firstui/fui-toast/fui-toast.vue
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+ {{text}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-top-popup/fui-top-popup.vue b/components/firstui/fui-top-popup/fui-top-popup.vue
new file mode 100644
index 0000000..e4dbc85
--- /dev/null
+++ b/components/firstui/fui-top-popup/fui-top-popup.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-upload-video/fui-upload-video.vue b/components/firstui/fui-upload-video/fui-upload-video.vue
new file mode 100644
index 0000000..1778e73
--- /dev/null
+++ b/components/firstui/fui-upload-video/fui-upload-video.vue
@@ -0,0 +1,572 @@
+
+
+
+
+
+
+
+
+
+ {{getStatusText(progress[index])}}
+ {{progress[index]}}%
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-upload/fui-upload.vue b/components/firstui/fui-upload/fui-upload.vue
new file mode 100644
index 0000000..9a1c0f4
--- /dev/null
+++ b/components/firstui/fui-upload/fui-upload.vue
@@ -0,0 +1,603 @@
+
+
+
+
+
+
+
+ 重新上传
+
+
+ 请稍候...
+
+
+ 正在上传...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-utils/index.js b/components/firstui/fui-utils/index.js
new file mode 100644
index 0000000..0626909
--- /dev/null
+++ b/components/firstui/fui-utils/index.js
@@ -0,0 +1,374 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 140 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+/*!
+ * 工具类:常用数据处理工具
+ * Utils - v1.0.0 (2021/7/9, 11:07:14 AM)
+ * https://github.com/FirstUI/FirstUI | Released under Apache License 2.0
+ *
+ * 官网地址:https://firstui.cn/
+ * 文档地址:https://doc.firstui.cn/
+ */
+
+const utils = {
+ /**
+ * @desc 英文首字母大写:english=>English
+ * @param {String} value 需要处理的英文字符串
+ **/
+ titleCase(value) {
+ if (value == null || value.length === 0) return value;
+ return value.replace(/^[a-z]/, (matchStr) => {
+ return matchStr.toLocaleUpperCase();
+ });
+ },
+ /**
+ * 把连续出现多次的字母字符串进行压缩。aaabbbbcccccd=>3a4b5cd
+ * @param {String} value 需要压缩的字符串
+ * @param {Boolean} ignoreCase 是否忽略大小写
+ */
+ compressLetter(value, ignoreCase) {
+ let pattern = new RegExp("([a-zA-Z])\\1+", ignoreCase ? "ig" : "g");
+
+ return value.replace(pattern, (matchStr, group_1) => {
+ return matchStr.length + group_1;
+ });
+ },
+ /**
+ * @desc 等待多少毫秒再执行 ,同步阻塞
+ * @param {String} millisecond 毫秒
+ **/
+ sleep(millisecond) {
+ let now = new Date();
+ let exitTime = now.getTime() + millisecond;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime) return;
+ }
+ },
+ /**
+ * @desc 去左右空格
+ * @param {String} value 需要处理的字符串
+ **/
+ trim(value) {
+ return value.replace(/(^\s*)|(\s*$)/g, "");
+ },
+ /**
+ * @desc 去所有空格
+ * @param {String} value 需要处理的字符串
+ **/
+ trimAll(value) {
+ return value.replace(/\s+/g, "")
+ },
+ /**
+ * @desc 替换所有相同字符串
+ * @param {String} text 需要处理的字符串
+ * @param {String} repstr 被替换的字符
+ * @param {String} newstr 替换后的字符
+ **/
+ replaceAll(text, repstr, newstr) {
+ return text.replace(new RegExp(repstr, "gm"), newstr);
+ },
+ /**
+ * @desc 格式化手机号码
+ * @param {String} num 手机号码
+ **/
+ numberFormatter(num) {
+ return num.length === 11 ? num.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2') : num;
+ },
+ /**
+ * @desc 金额格式化,保留两位小数
+ * @param {String | Number} money 金额值
+ **/
+ moneyFormatter(money) {
+ return parseFloat(money).toFixed(2).toString().split('').reverse().join('').replace(/(\d{3})/g, '$1,')
+ .replace(
+ /\,$/, '').split('').reverse().join('');
+ },
+ /**
+ * @desc 日期时间格式化
+ * @param date 需要格式化的日期
+ * @param format 格式化字符串(y-m-d h:i:s)
+ * @param type date的格式类型:1-日期字符串(2017/12/04 12:12:12) 2-时间戳(1603676514690) 3-日期字符串,无连接符(20171204121212)
+ * 4-new Date()时间格式(Thu Oct 01 2020 00:00:00 GMT+0800 (中国标准时间))
+ * @param isMs 时间戳精度是否为毫秒,默认为true(当精度为秒时传false),type=2时有效
+ **/
+ dateFormatter(date, format, type = 1, isMs = true) {
+ let formatDate = ""
+ if (type === 3) {
+ formatDate = utils._formatTimeStr(date, format)
+ } else {
+ formatDate = utils._formatDate(format, date, type, isMs)
+ }
+ return formatDate;
+ },
+ _formatDate(formatStr, fdate, type = 1, isMs) {
+ if (!fdate) return '';
+ let fTime, fStr = 'ymdhis';
+ if (type === 4) {
+ fTime = fdate;
+ } else {
+ fdate = fdate.toString()
+ if (~fdate.indexOf('.')) {
+ fdate = fdate.substring(0, fdate.indexOf('.'));
+ }
+ fdate = fdate.replace('T', ' ').replace(/\-/g, '/');
+ if (!formatStr)
+ formatStr = "y-m-d h:i:s";
+ if (fdate) {
+ if (type === 2) {
+ fdate = isMs ? Number(fdate) : Number(fdate) * 1000
+ }
+ fTime = new Date(fdate);
+ } else {
+ fTime = new Date();
+ }
+ }
+ let month = fTime.getMonth() + 1;
+ let day = fTime.getDate();
+ let hours = fTime.getHours();
+ let minu = fTime.getMinutes();
+ let second = fTime.getSeconds();
+ month = month < 10 ? '0' + month : month;
+ day = day < 10 ? '0' + day : day;
+ hours = hours < 10 ? ('0' + hours) : hours;
+ minu = minu < 10 ? '0' + minu : minu;
+ second = second < 10 ? '0' + second : second;
+ let formatArr = [
+ fTime.getFullYear().toString(),
+ month.toString(),
+ day.toString(),
+ hours.toString(),
+ minu.toString(),
+ second.toString()
+ ]
+ for (let i = 0; i < formatArr.length; i++) {
+ formatStr = formatStr.replace(fStr.charAt(i), formatArr[i]);
+ }
+ return formatStr;
+ },
+ /**
+ * @desc 格式化时间
+ * @param timeStr 时间字符串 20191212162001
+ * @param formatStr 需要的格式 如 y-m-d h:i:s | y/m/d h:i:s | y/m/d | y年m月d日 等
+ **/
+ _formatTimeStr(timeStr, formatStr) {
+ if (!timeStr) return;
+ timeStr = timeStr.toString()
+ if (timeStr.length === 14) {
+ let timeArr = timeStr.split('')
+ let fStr = 'ymdhis'
+ if (!formatStr) {
+ formatStr = 'y-m-d h:i:s'
+ }
+ let formatArr = [
+ [...timeArr].splice(0, 4).join(''),
+ [...timeArr].splice(4, 2).join(''),
+ [...timeArr].splice(6, 2).join(''),
+ [...timeArr].splice(8, 2).join(''),
+ [...timeArr].splice(10, 2).join(''),
+ [...timeArr].splice(12, 2).join('')
+ ]
+ for (let i = 0; i < formatArr.length; i++) {
+ formatStr = formatStr.replace(fStr.charAt(i), formatArr[i])
+ }
+ return formatStr
+ }
+ return timeStr
+ },
+ /**
+ * @desc RGB颜色转十六进制颜色
+ * @param r
+ * @param g
+ * @param b
+ **/
+ rgbToHex(r, g, b) {
+ return "#" + utils._toHex(r) + utils._toHex(g) + utils._toHex(b)
+ },
+ _toHex(n) {
+ n = parseInt(n, 10);
+ if (isNaN(n)) return "00";
+ n = Math.max(0, Math.min(n, 255));
+ return "0123456789ABCDEF".charAt((n - n % 16) / 16) +
+ "0123456789ABCDEF".charAt(n % 16);
+ },
+ /**
+ * @desc 十六进制颜色转RGB颜色
+ * @param hex 颜色值 #333 或 #333333
+ **/
+ hexToRGB(hex) {
+ if (hex.length === 4) {
+ let text = hex.substring(1, 4);
+ hex = '#' + text + text;
+ }
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ return result ? {
+ r: parseInt(result[1], 16),
+ g: parseInt(result[2], 16),
+ b: parseInt(result[3], 16)
+ } : null;
+ },
+ /**
+ * @desc 唯一标识,随机数
+ * @param n 随机数位数
+ **/
+ unique(n) {
+ n = n || 6;
+ let rnd = '';
+ for (let i = 0; i < n; i++)
+ rnd += Math.floor(Math.random() * 10);
+ return 'firstui_' + new Date().getTime() + rnd;
+ },
+ /**
+ * @desc 获取uuid
+ */
+ getUUID() {
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
+ return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)
+ })
+ },
+ /**
+ * @desc 简单数组合并去重
+ * @param arr1 数组1
+ * @param arr2 数组2 可不传
+ **/
+ distinctArray(arr1, arr2) {
+ arr1 = arr1 || []
+ arr2 = arr2 || []
+ return [...new Set([...arr1, ...arr2])]
+ },
+
+ /**
+ * @desc 获取日期时间段
+ * @param type 1-今天 2-昨天 3-本周 4-本月 5-本年
+ **/
+ getDateTimeSlot(type) {
+ let now = new Date()
+ let start = now.toDateString()
+ let end = now.toDateString()
+ switch (type) {
+ case 1:
+ start = `${start} 00:00:00`
+ end = `${end} 23:59:59`
+ break
+ case 2:
+ now.setTime(now.getTime() - 3600 * 1000 * 24 * 1)
+ start = `${now.toDateString()} 00:00:00`
+ end = `${now.toDateString()} 23:59:59`
+ break
+ case 3:
+ // 获取星期几,getDay()返回值是 0(周日) 到 6(周六) 之间的一个整数。0||7为7,即weekday的值为1-7
+ let weekday = now.getDay() || 7
+ // 往前算(weekday-1)天,年份、月份会自动变化
+ now.setDate(now.getDate() - weekday + 1)
+ start = `${now.toDateString()} 00:00:00`
+ end = `${end} 23:59:59`
+ break
+ case 4:
+ start = `${now.getFullYear()}-${now.getMonth() + 1}-01 00:00:00`
+ end = `${end} 23:59:59`
+ break
+ case 5:
+ start = `${now.getFullYear()}-01-01 00:00:00`
+ end = `${end} 23:59:59`
+ break
+ default:
+ break
+ }
+
+ return {
+ start: new Date(start.replace(/\-/g, '/')),
+ end: new Date(end.replace(/\-/g, '/'))
+ }
+ },
+ /*
+ * @desc 获取Url参数,返回一个对象
+ * @param url url地址
+ * ?a=1&b=2 ==> {a: "1", b: "2"}
+ */
+ getUrlParam(url) {
+ let arrObj = url.split("?");
+ let params = {};
+ if (arrObj.length > 1) {
+ arrObj = arrObj[1].split("&");
+ arrObj.forEach(item => {
+ item = item.split("=");
+ params[item[0]] = item[1];
+ })
+ }
+ return params;
+ },
+ /**
+ * @method 函数防抖
+ * @desc 短时间内多次触发同一事件,只执行最后一次,或者只执行最开始的一次,中间的不执行。
+ * @param func 目标函数
+ * @param wait 延迟执行毫秒数
+ * @param immediate true - 立即执行, false - 延迟执行
+ */
+ debounce(func, wait = 1000, immediate = true) {
+ let timer;
+ return function() {
+ let context = this,
+ args = arguments;
+ if (timer) clearTimeout(timer);
+ if (immediate) {
+ let callNow = !timer;
+ timer = setTimeout(() => {
+ timer = null;
+ }, wait);
+ if (callNow) func.apply(context, args);
+ } else {
+ timer = setTimeout(() => {
+ func.apply(context, args);
+ }, wait)
+ }
+ }
+ },
+ /**
+ * @method 函数节流
+ * @desc 指连续触发事件,但是在 n 秒内只执行一次函数。即 2n 秒内执行 2 次... 。会稀释函数的执行频率。
+ * @param func 函数
+ * @param wait 延迟执行毫秒数
+ * @param type 1 在时间段开始的时候触发 2 在时间段结束的时候触发
+ */
+ throttle(func, wait = 1000, type = 1) {
+ let previous = 0;
+ let timeout;
+ return function() {
+ let context = this;
+ let args = arguments;
+ if (type === 1) {
+ let now = Date.now();
+ if (now - previous > wait) {
+ func.apply(context, args);
+ previous = now;
+ }
+ } else if (type === 2) {
+ if (!timeout) {
+ timeout = setTimeout(() => {
+ timeout = null;
+ func.apply(context, args)
+ }, wait)
+ }
+ }
+ }
+ }
+}
+
+export default {
+ titleCase: utils.titleCase,
+ compressLetter: utils.compressLetter,
+ sleep: utils.sleep,
+ trim: utils.trim,
+ trimAll: utils.trimAll,
+ replaceAll: utils.replaceAll,
+ numberFormatter: utils.numberFormatter,
+ moneyFormatter: utils.moneyFormatter,
+ dateFormatter: utils.dateFormatter,
+ rgbToHex: utils.rgbToHex,
+ hexToRGB: utils.hexToRGB,
+ unique: utils.unique,
+ distinctArray: utils.distinctArray,
+ getDateTimeSlot: utils.getDateTimeSlot,
+ getUrlParam: utils.getUrlParam,
+ getUUID: utils.getUUID,
+ debounce: utils.debounce,
+ throttle: utils.throttle
+}
\ No newline at end of file
diff --git a/components/firstui/fui-validator/fui-validator.js b/components/firstui/fui-validator/fui-validator.js
new file mode 100644
index 0000000..0575ba6
--- /dev/null
+++ b/components/firstui/fui-validator/fui-validator.js
@@ -0,0 +1,335 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6140 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+/**
+ * 表单验证
+ * https://doc.firstui.cn/
+ **/
+
+const form = {
+ /*
+ 非必填情况下,如果值为空则不进行校验
+ */
+ validator: function(formData, rules, checkAll = false) {
+ let result = {
+ isPassed: true,
+ errorMsg: checkAll ? [] : ''
+ };
+ for (let item of rules) {
+ const key = item.name;
+ const rule = item.rule || [];
+ const validator = item.validator || [];
+ const msgArr = item.msg || [];
+ const ruleLen = rule.length;
+ const validatorLen = validator.length;
+ if (!key || (ruleLen === 0 && validatorLen === 0) || (!~rule.indexOf("required") &&
+ formData[key].toString()
+ .length === 0)) {
+ continue;
+ }
+ if (ruleLen) {
+ for (let i = 0; i < ruleLen; i++) {
+ let ruleItem = rule[i];
+ let msg = msgArr[i] || `${key} error !`;
+ if (!ruleItem) continue;
+ //数据处理
+ let value = null;
+ if (~ruleItem.indexOf(":")) {
+ let temp = ruleItem.split(":");
+ ruleItem = temp[0];
+ value = temp[1];
+ }
+ let isError = false;
+ switch (ruleItem) {
+ case "required":
+ isError = form._isNullOrEmpty(formData[key]);
+ break;
+ case "isMobile":
+ isError = !form._isMobile(formData[key]);
+ break;
+ case "isEmail":
+ isError = !form._isEmail(formData[key]);
+ break;
+ case "isCarNo":
+ isError = !form._isCarNo(formData[key]);
+ break;
+ case "isIdCard":
+ isError = !form._isIdCard(formData[key]);
+ break;
+ case "isAmount":
+ isError = !form._isAmount(formData[key]);
+ break;
+ case "isNumber":
+ isError = !form._isNumber(formData[key]);
+ break;
+ case "isChinese":
+ isError = !form._isChinese(formData[key]);
+ break;
+ case "isNotChinese":
+ isError = !form._isNotChinese(formData[key]);
+ break;
+ case "isEnglish":
+ isError = !form._isEnglish(formData[key]);
+ break;
+ case "isEnAndNo":
+ isError = !form._isEnAndNo(formData[key]);
+ break;
+ case "isEnOrNo":
+ isError = !form._isEnOrNo(formData[key]);
+ break;
+ case "isSpecial":
+ isError = form._isSpecial(formData[key]);
+ break;
+ case "isEmoji":
+ isError = form._isEmoji(formData[key]);
+ break;
+ case "isDate":
+ isError = !form._isDate(formData[key]);
+ break;
+ case "isUrl":
+ isError = !form._isUrl(formData[key]);
+ break;
+ case "isSame":
+ isError = !form._isSame(formData[key], formData[value]);
+ break;
+ case "range":
+ let range = null;
+ try {
+ range = JSON.parse(value);
+ if (range.length <= 1) {
+ throw new Error("range值传入有误!")
+ }
+ } catch (e) {
+ return "range值传入有误!"
+ }
+ isError = !form._isRange(formData[key], range[0], range[1])
+ break;
+ case "minLength":
+ isError = !form._minLength(formData[key], value)
+ break;
+ case "maxLength":
+ isError = !form._maxLength(formData[key], value)
+ break;
+ case "isKeyword":
+ isError = !form._isKeyword(formData[key], value)
+ break;
+ default:
+ break;
+ }
+
+ if (isError) {
+ result.isPassed = false;
+ if (checkAll) {
+ result.errorMsg.push({
+ name: key,
+ msg: msg
+ })
+ break;
+ } else {
+ result.errorMsg = msg;
+ return result;
+ }
+ }
+ }
+ }
+
+ if (validatorLen) {
+ for (let model of validator) {
+ let func = model.method;
+ if (func && !func(formData[key])) {
+ result.isPassed = false;
+ if (checkAll) {
+ const index = result.errorMsg.findIndex(item => item.name === key)
+ if (index === -1) {
+ result.errorMsg.push({
+ name: key,
+ msg: model.msg || `${key} error !`
+ })
+ }
+ break;
+ } else {
+ result.errorMsg = model.msg || `${key} error !`;
+ return result;
+ }
+ }
+ }
+ }
+ }
+ return result;
+ },
+ //允许填写字符串null或者undefined
+ _isNullOrEmpty: function(value) {
+ return (value === null || value === '' || value === undefined) ? true : false;
+ },
+ _isMobile: function(value) {
+ return /^(?:13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{5}(\d{3}|\*{3})$/.test(value);
+ },
+ _isEmail: function(value) {
+ return /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(value);
+ },
+ _isCarNo: function(value) {
+ // 新能源车牌
+ const xreg =
+ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
+ // 旧车牌
+ const creg =
+ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
+ if (value.length === 7) {
+ return creg.test(value);
+ } else if (value.length === 8) {
+ return xreg.test(value);
+ } else {
+ return false;
+ }
+ },
+ _isIdCard: function(value) {
+ let idCard = value;
+ if (idCard.length == 15) {
+ return this.__isValidityBrithBy15IdCard;
+ } else if (idCard.length == 18) {
+ let arrIdCard = idCard.split("");
+ if (this.__isValidityBrithBy18IdCard(idCard) && this.__isTrueValidateCodeBy18IdCard(arrIdCard)) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ },
+ __isTrueValidateCodeBy18IdCard: function(arrIdCard) {
+ let sum = 0;
+ let Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
+ let ValideCode = [1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2];
+ if (arrIdCard[17].toLowerCase() == 'x') {
+ arrIdCard[17] = 10;
+ }
+ for (let i = 0; i < 17; i++) {
+ sum += Wi[i] * arrIdCard[i];
+ }
+ let valCodePosition = sum % 11;
+ if (arrIdCard[17] == ValideCode[valCodePosition]) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ __isValidityBrithBy18IdCard: function(idCard18) {
+ let year = idCard18.substring(6, 10);
+ let month = idCard18.substring(10, 12);
+ let day = idCard18.substring(12, 14);
+ let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
+ if (temp_date.getFullYear() != parseFloat(year) || temp_date.getMonth() != parseFloat(month) - 1 ||
+ temp_date.getDate() !=
+ parseFloat(day)) {
+ return false;
+ } else {
+ return true;
+ }
+ },
+ __isValidityBrithBy15IdCard: function(idCard15) {
+ let year = idCard15.substring(6, 8);
+ let month = idCard15.substring(8, 10);
+ let day = idCard15.substring(10, 12);
+ let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day));
+
+ if (temp_date.getYear() != parseFloat(year) || temp_date.getMonth() != parseFloat(month) - 1 ||
+ temp_date.getDate() !=
+ parseFloat(day)) {
+ return false;
+ } else {
+ return true;
+ }
+ },
+ _isAmount: function(value) {
+ //是否为金额,只允许保留两位小数
+ return /^([0-9]*[.]?[0-9])[0-9]{0,1}$/.test(value);
+ },
+ _isNumber: function(value) {
+ //是否全为数字
+ return /^[0-9]+$/.test(value);
+ },
+ //是否全部为中文
+ _isChinese: function(value) {
+ let reg = /^[\u4e00-\u9fa5]+$/;
+ return value !== "" && reg.test(value) && !form._isSpecial(value) && !form._isEmoji(value)
+ },
+ //是否不包含中文,可以有特殊字符
+ _isNotChinese: function(value) {
+ let reg = /.*[\u4e00-\u9fa5]+.*$/;
+ let result = true;
+ if (reg.test(value)) {
+ result = false
+ }
+ return result
+ },
+ _isEnglish: function(value) {
+ return /^[a-zA-Z]*$/.test(value)
+ },
+ _isEnAndNo: function(value) {
+ //4~30位数字和字母组合
+ return /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4,30}$/.test(value);
+ },
+ _isEnOrNo: function(value) {
+ let reg = /^[A-Za-z0-9]+$/;
+ return reg.test(value)
+ },
+ _isSpecial: function(value) {
+ //是否包含特殊字符
+ let regEn = /[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im,
+ regCn = /[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im;
+ if (regEn.test(value) || regCn.test(value)) {
+ return true;
+ }
+ return false;
+ },
+ _isEmoji: function(value) {
+ //是否包含表情
+ return /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g.test(value);
+ },
+ _isDate: function(value) {
+ //2019-10-12
+ const reg =
+ /^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/;
+ return reg.test(value);
+ },
+ _isUrl: function(value) {
+ return /^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:[0-9]{1,5})?((\/?)|(\/[\\\w_!~*\\'()\\\.;?:@&=+$,%#-]+)+\/?)$/
+ .test(value);
+ },
+ _isSame: function(value1, value2) {
+ return value1 === value2
+ },
+ _isRange: function(value, range1, range2) {
+ if ((!range1 && range1 != 0) && (!range2 && range2 != 0)) {
+ return true;
+ } else if (!range1 && range1 != 0) {
+ return value <= range2
+ } else if (!range2 && range2 != 0) {
+ return value >= range1
+ } else {
+ return value >= range1 && value <= range2
+ }
+ },
+ _minLength: function(value, min) {
+ return value.length >= Number(min)
+ },
+ _maxLength: function(value, max) {
+ return value.length <= Number(max)
+ },
+ _isKeyword: function(value, keywords) {
+ //是否包含关键词,敏感词,多个以英文逗号分隔,包含则为false,弹出提示语!
+ let result = true;
+ if (!keywords) return result;
+ let key = keywords.split(',');
+ for (let i = 0, len = key.length; i < len; i++) {
+ if (~value.indexOf(key[i])) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+};
+
+export default {
+ validator: form.validator
+}
\ No newline at end of file
diff --git a/components/firstui/fui-vtabs-content/fui-vtabs-content.vue b/components/firstui/fui-vtabs-content/fui-vtabs-content.vue
new file mode 100644
index 0000000..602864a
--- /dev/null
+++ b/components/firstui/fui-vtabs-content/fui-vtabs-content.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-vtabs/fui-vtabs.vue b/components/firstui/fui-vtabs/fui-vtabs.vue
new file mode 100644
index 0000000..f53d195
--- /dev/null
+++ b/components/firstui/fui-vtabs/fui-vtabs.vue
@@ -0,0 +1,526 @@
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}{{isDot?'':item.badge}}
+
+
+
+
+ {{item.name}}{{isDot?'':item.badge}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-waterfall-item/fui-waterfall-item.vue b/components/firstui/fui-waterfall-item/fui-waterfall-item.vue
new file mode 100644
index 0000000..43bb3be
--- /dev/null
+++ b/components/firstui/fui-waterfall-item/fui-waterfall-item.vue
@@ -0,0 +1,236 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/firstui/fui-waterfall/fui-waterfall.vue b/components/firstui/fui-waterfall/fui-waterfall.vue
new file mode 100644
index 0000000..ff16c02
--- /dev/null
+++ b/components/firstui/fui-waterfall/fui-waterfall.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..b61f63e
--- /dev/null
+++ b/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..3f91cff
--- /dev/null
+++ b/main.js
@@ -0,0 +1,70 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 614 0 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+
+import App from './App'
+import fui from './common/fui-app'
+import http from './components/firstui/fui-request'
+import store from './store'
+
+//初始化请求配置项
+http.create({
+ host: 'https://ffa.firstui.cn',
+ header: {
+ // 'content-type': 'application/x-www-form-urlencoded'
+ }
+})
+//请求拦截
+http.interceptors.request.use(config => {
+ //请求之前可在请求头中加入token等信息
+ let token = uni.getStorageSync('firstui_token') || 'testToken';
+ if (config.header) {
+ config.header['Authorization'] = token
+ } else {
+ config.header = {
+ 'Authorization': token
+ }
+ }
+ return config
+})
+//响应拦截
+http.interceptors.response.use(response => {
+ //TODO
+ return response
+})
+
+// #ifndef VUE3
+import Vue from 'vue'
+
+Vue.config.productionTip = false
+Vue.prototype.$store = store
+Vue.prototype.fui = fui
+Vue.prototype.http = http
+
+App.mpType = 'app'
+
+const app = new Vue({
+ store,
+ ...App
+})
+app.$mount()
+// #endif
+
+// #ifdef VUE3
+import {
+ createSSRApp
+} from 'vue';
+/*
+ 在 Vue3 中,如果 nvue 使用了 Vuex 的相关 API,
+ 需要在 main.js 的 createApp 的返回值中 return 一下 Vuex
+*/
+import Vuex from "vuex";
+export function createApp() {
+ const app = createSSRApp(App)
+ app.use(store)
+ app.config.globalProperties.fui = fui;
+ app.config.globalProperties.http = http;
+ return {
+ Vuex,
+ app
+ }
+}
+// #endif
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..0f8fb8a
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,72 @@
+{
+ "name" : "FirstUI-Hello",
+ "appid" : "__UNI__78E1C6D",
+ "description" : "",
+ "versionName" : "1.9.8",
+ "versionCode" : 198,
+ "transformPx" : false,
+ /* 5+App特有相关 */
+ "app-plus" : {
+ "usingComponents" : true,
+ "nvueStyleCompiler" : "uni-app",
+ "compilerVersion" : 3,
+ "splashscreen" : {
+ "alwaysShowBeforeRender" : true,
+ "waiting" : true,
+ "autoclose" : true,
+ "delay" : 0
+ },
+ /* 模块配置 */
+ "modules" : {},
+ /* 应用发布信息 */
+ "distribute" : {
+ /* android打包配置 */
+ "android" : {
+ "permissions" : [
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ ""
+ ]
+ },
+ /* ios打包配置 */
+ "ios" : {},
+ /* SDK配置 */
+ "sdkConfigs" : {}
+ }
+ },
+ /* 快应用特有相关 */
+ "quickapp" : {},
+ /* 小程序特有相关 */
+ "mp-weixin" : {
+ "appid" : "",
+ "setting" : {
+ "urlCheck" : false
+ },
+ "usingComponents" : true
+ },
+ "mp-alipay" : {
+ "usingComponents" : true
+ },
+ "mp-baidu" : {
+ "usingComponents" : true
+ },
+ "mp-toutiao" : {
+ "usingComponents" : true
+ },
+ "uniStatistics" : {
+ "enable" : false
+ },
+ "vueVersion" : "3"
+}
diff --git a/pages.json b/pages.json
new file mode 100644
index 0000000..0b1d347
--- /dev/null
+++ b/pages.json
@@ -0,0 +1,28 @@
+{
+ "pages": [
+ {
+ "path": "pages/index/index",
+ "style": {
+ // #ifdef H5
+ "titleNView": false,
+ // #endif
+ "navigationBarTitleText": "First UI"
+ }
+ }
+ ],
+ "easycom": {
+ "autoscan": true,
+ "custom": {
+ "fui-(.*)": "@/components/firstui/fui-$1/fui-$1.vue"
+ }
+ },
+ "globalStyle": {
+ "backgroundTextStyle": "dark",
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "First UI",
+ "navigationBarBackgroundColor": "#FFFFFF",
+ "backgroundColor": "#F1F4FA",
+ "backgroundColorTop": "#F1F4FA",
+ "backgroundColorBottom": "#F1F4FA"
+ }
+}
diff --git a/pages/index/index.vue b/pages/index/index.vue
new file mode 100644
index 0000000..e78dc85
--- /dev/null
+++ b/pages/index/index.vue
@@ -0,0 +1,78 @@
+
+
+
+
+ Hello FirstUI !
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/static/icon/fui-custom-icon.css b/static/icon/fui-custom-icon.css
new file mode 100644
index 0000000..01407d2
--- /dev/null
+++ b/static/icon/fui-custom-icon.css
@@ -0,0 +1,27 @@
+@font-face {
+ font-family: iconfont;
+ src: url('/static/icon/fui-custom-icon.ttf') format('truetype');
+}
+
+.fui-custom-icon {
+ font-family: "iconfont" !important;
+ font-size: 16px;
+ font-style: normal;
+ -webkit-font-smoothing: antialiased;
+}
+
+.icon-fabulous:before {
+ content: "\e704";
+}
+
+.icon-collection:before {
+ content: "\e705";
+}
+
+.icon-comment:before {
+ content: "\e706";
+}
+
+.icon-forward:before {
+ content: "\e707";
+}
diff --git a/static/icon/fui-custom-icon.ttf b/static/icon/fui-custom-icon.ttf
new file mode 100644
index 0000000..2603210
Binary files /dev/null and b/static/icon/fui-custom-icon.ttf differ
diff --git a/static/images/logo.png b/static/images/logo.png
new file mode 100644
index 0000000..b52a9b6
Binary files /dev/null and b/static/images/logo.png differ
diff --git a/store/index.js b/store/index.js
new file mode 100644
index 0000000..da48134
--- /dev/null
+++ b/store/index.js
@@ -0,0 +1,43 @@
+// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 140 7 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
+// #ifdef MP
+import http from '../common/fui-request'
+// #endif
+// #ifndef VUE3
+import Vue from 'vue'
+import Vuex from 'vuex'
+Vue.use(Vuex)
+const store = new Vuex.Store({
+ // #endif
+
+ // #ifdef VUE3
+ import {
+ createStore
+ } from 'vuex'
+ const store = createStore({
+ // #endif
+ state: {
+ //是否登录
+ isLogin: uni.getStorageSync("firstui_m_token") ? true : false
+ },
+ mutations: {
+ //登录
+ login(state, payload) {
+ if (payload) {
+ state.token = payload.token
+ uni.setStorageSync('firstui_m_token',payload.token)
+ }
+ state.isLogin = true
+ },
+ //退出登录
+ logout(state) {
+ state.token = ""
+ state.isLogin = false
+ uni.removeStorageSync('firstui_m_token')
+ }
+ },
+ actions: {
+
+ }
+ })
+
+ export default store
\ No newline at end of file
diff --git a/uni.scss b/uni.scss
new file mode 100644
index 0000000..845142d
--- /dev/null
+++ b/uni.scss
@@ -0,0 +1,76 @@
+/**
+ * 这里是uni-app内置的常用样式变量
+ *
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
+ *
+ */
+
+/**
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
+ *
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
+ */
+
+/* 颜色变量 */
+
+/* 行为相关颜色 */
+$uni-color-primary: #007aff;
+$uni-color-success: #4cd964;
+$uni-color-warning: #f0ad4e;
+$uni-color-error: #dd524d;
+
+/* 文字基本颜色 */
+$uni-text-color:#333;//基本色
+$uni-text-color-inverse:#fff;//反色
+$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
+$uni-text-color-placeholder: #808080;
+$uni-text-color-disable:#c0c0c0;
+
+/* 背景颜色 */
+$uni-bg-color:#ffffff;
+$uni-bg-color-grey:#f8f8f8;
+$uni-bg-color-hover:#f1f1f1;//点击状态颜色
+$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
+
+/* 边框颜色 */
+$uni-border-color:#c8c7cc;
+
+/* 尺寸变量 */
+
+/* 文字尺寸 */
+$uni-font-size-sm:24rpx;
+$uni-font-size-base:28rpx;
+$uni-font-size-lg:32rpx;
+
+/* 图片尺寸 */
+$uni-img-size-sm:40rpx;
+$uni-img-size-base:52rpx;
+$uni-img-size-lg:80rpx;
+
+/* Border Radius */
+$uni-border-radius-sm: 4rpx;
+$uni-border-radius-base: 6rpx;
+$uni-border-radius-lg: 12rpx;
+$uni-border-radius-circle: 50%;
+
+/* 水平间距 */
+$uni-spacing-row-sm: 10px;
+$uni-spacing-row-base: 20rpx;
+$uni-spacing-row-lg: 30rpx;
+
+/* 垂直间距 */
+$uni-spacing-col-sm: 8rpx;
+$uni-spacing-col-base: 16rpx;
+$uni-spacing-col-lg: 24rpx;
+
+/* 透明度 */
+$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
+
+/* 文章场景相关 */
+$uni-color-title: #2C405A; // 文章标题颜色
+$uni-font-size-title:40rpx;
+$uni-color-subtitle: #555555; // 二级标题颜色
+$uni-font-size-subtitle:36rpx;
+$uni-color-paragraph: #3F536E; // 文章段落颜色
+$uni-font-size-paragraph:30rpx;
\ No newline at end of file