1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-lottery-rotarytable"],{"07b9":function(t,e,i){"use strict";i.r(e);var n=i("ae8e"),a=i.n(n);for(var r in n)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(r);e["default"]=a.a},"13dd":function(t,e,i){"use strict";var n=i("d017"),a=i.n(n);a.a},"1c32":function(t,e,i){"use strict";i.r(e);var n=i("6158"),a=i.n(n);for(var r in n)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(r);e["default"]=a.a},2909:function(t,e,i){"use strict";i("7a82"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return(0,n.default)(t)||(0,a.default)(t)||(0,r.default)(t)||(0,o.default)()};var n=s(i("6005")),a=s(i("db90")),r=s(i("06c5")),o=s(i("3427"));function s(t){return t&&t.__esModule?t:{default:t}}},3427:function(t,e,i){"use strict";i("7a82"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},i("d9e2"),i("d401")},4429:function(t,e,i){"use strict";i.r(e);var n=i("f02c"),a=i("07b9");for(var r in a)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(r);i("9b70");var o=i("f0c5"),s=Object(o["a"])(a["default"],n["b"],n["c"],!1,null,"42b3bc7e",null,!1,n["a"],void 0);e["default"]=s.exports},6005:function(t,e,i){"use strict";i("7a82"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if(Array.isArray(t))return(0,n.default)(t)};var n=function(t){return t&&t.__esModule?t:{default:t}}(i("6b75"))},6158:function(t,e,i){"use strict";i("7a82");var n=i("4ea4").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n(i("c7eb")),r=n(i("1da1"));i("a9e3"),i("cb29"),i("14d9"),i("ac1f"),i("00b4"),i("c975"),i("d3b7"),i("fb6a"),i("e9c4");var o=i("e555"),s={name:"AlmostLottery",props:{pixelRatio:{type:Number,default:2},canvasId:{type:String,default:"almostLottery"},lotterySize:{type:Number,default:600},actionSize:{type:Number,default:200},canvasMarginOutside:{type:Number,default:90},prizeList:{type:Array,required:!0,validator:function(t){return t.length>1}},prizeIndex:{type:Number,required:!0},colors:{type:Array,default:function(){return["#FFFFFF","#FFBF05"]}},lotteryBg:{type:String,default:"/uni_modules/almost-lottery/static/almost-lottery/almost-lottery__bg2x.png"},actionBg:{type:String,default:"/uni_modules/almost-lottery/static/almost-lottery/almost-lottery__action2x.png"},prizeNameDrawed:{type:Boolean,default:!0},stroked:{type:Boolean,default:!1},strokeColor:{type:String,default:"#FFBF05"},rotateType:{type:String,default:"roulette"},duration:{type:Number,default:8},ringCount:{type:Number,default:8},pointerPosition:{type:String,default:"edge",validator:function(t){return"edge"===t||"middle"===t}},strDirection:{type:String,default:"horizontal",validator:function(t){return"horizontal"===t||"vertical"===t}},strFontColors:{type:Array,default:function(){return["#FFBF05","#FFFFFF"]}},strFontSize:{type:Number,default:24},strMarginOutside:{type:Number,default:0},imgMarginStr:{type:Number,default:60},strLineHeight:{type:Number,default:1.2},strMaxLen:{type:Number,default:12},strLineLen:{type:Number,default:6},imgWidth:{type:Number,default:50},imgHeight:{type:Number,default:50},imgDrawed:{type:Boolean,default:!0},imgCircled:{type:Boolean,default:!1},successMsg:{type:String,default:"奖品准备就绪,快来参与抽奖吧"},failMsg:{type:String,default:"奖品仍在准备中,请稍后再来..."},canvasCached:{type:Boolean,default:!1}},data:function(){return{className:"almost-lottery__canvas",systemPixelRatio:2,lotteryPxSize:0,canvasImgPxSize:0,actionPxSize:0,strMarginPxOutside:0,imgMarginPxStr:0,imgPxWidth:0,imgPxHeight:0,lotteryImg:"",targetAngle:0,targetActionAngle:0,transitionDuration:0,isRotate:!1,stayIndex:0,targetIndex:0,isCacheImg:!1,oldLotteryImg:"",measureText:""}},computed:{higtCanvasSize:function(){return this.canvasImgPxSize*this.systemPixelRatio},higtFontSize:function(){return Math.round(this.strFontSize/this.pixelRatio)*this.systemPixelRatio},higtHeightMultiple:function(){return Math.round(this.strFontSize/this.pixelRatio)*this.strLineHeight*this.systemPixelRatio},canvasImgToLeftPx:function(){return(this.lotteryPxSize-this.canvasImgPxSize)/2},actionBgToLeftPx:function(){return(this.lotteryPxSize-this.actionPxSize)/2},canvasAngle:function(){var t=0,e=this.prizeList.length,i=360/e,n=90/i;return t="edge"===this.pointerPosition||"pointer"===this.rotateType?-i*n:-(i*n+i/2),t},actionAngle:function(){return 0},outsideRadius:function(){return this.higtCanvasSize/2},insideRadius:function(){return 20*this.systemPixelRatio},textRadius:function(){return this.strMarginPxOutside*this.systemPixelRatio||this.higtFontSize/2},textDistance:function(){var t=Math.round(this.outsideRadius-this.insideRadius/2);return t-this.textRadius}},watch:{prizeIndex:function(t,e){t>-1?(this.targetIndex=t,this.onRotateStart()):console.info("旋转结束,prizeIndex 已重置")}},methods:{onRotateStart:function(){var t=this;if(!this.isRotate){this.isRotate=!0;var e=this.prizeList.length,i=360/e,n=0;"pointer"===this.rotateType?(n=0===this.targetActionAngle?(this.targetIndex-this.stayIndex)*i+i/2-this.actionAngle:(this.targetIndex-this.stayIndex)*i,this.stayIndex=this.targetIndex,this.targetActionAngle+=n+360*this.ringCount,console.log("targetActionAngle",this.targetActionAngle)):(n=0===this.targetAngle?270-(this.targetIndex-this.stayIndex)*i-i/2-this.canvasAngle:-(this.targetIndex-this.stayIndex)*i,this.stayIndex=this.targetIndex,this.targetAngle+=n+360*this.ringCount);var a=1e3*this.transitionDuration+100,r=setTimeout((function(){clearTimeout(r),r=null,t.isRotate=!1,t.$emit("draw-end")}),a),o=setTimeout((function(){clearTimeout(o),o=null,t.$emit("reset-index")}),a+50)}},handleActionStart:function(){this.lotteryImg&&(this.isRotate||this.$emit("draw-start"))},onCreateCanvas:function(){var t=this;return(0,r.default)((0,a.default)().mark((function e(){var i,n,r,s,l,c,u,d,f,g,h,m,v,p,x,y,b,w,z,_,S,I,P,C,L,F,T,k,M,R,A,D,O,B,N,j,E,H,$,U;return(0,a.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:i=t.canvasId,n=uni.createCanvasContext(i,t),r=t.higtCanvasSize,s=t.higtCanvasSize,l=t.prizeList.length,c=2*Math.PI/l,n.setFontSize(t.higtFontSize),u=0;case 8:if(!(u<l)){e.next=125;break}if(d=t.prizeList[u],f=u*c,n.save(),n.beginPath(),n.arc(.5*r,.5*s,t.outsideRadius,f,f+c,!1),n.arc(.5*r,.5*s,t.insideRadius,f+c,f,!0),2===t.colors.length?n.setFillStyle(t.colors[u%2]):n.setFillStyle(t.colors[u]),n.fill(),t.stroked&&(n.setStrokeStyle("".concat(t.strokeColor)),n.stroke()),g=.5*r+Math.cos(f+c/2)*t.textDistance,h=.5*s+Math.sin(f+c/2)*t.textDistance,n.translate(g,h),m=t.strLimit(d.prizeName),1===t.strFontColors.length?n.setFillStyle(t.strFontColors[0]):2===t.strFontColors.length?n.setFillStyle(t.strFontColors[u%2]):n.setFillStyle(t.strFontColors[u]),n.rotate(f+c/2+Math.PI/2),"horizontal"!==t.strDirection){e.next=70;break}if(!m||!t.prizeNameDrawed){e.next=68;break}if(v=(0,o.clacTextLen)(m).realLen,p=v>t.strLineLen,!p){e.next=54;break}for(x=0,y="",b=[],w=0;w<m.length;w++)x+=(0,o.clacTextLen)(m[w]).byteLen,y+=m[w],(x===2*t.strLineLen||m.length-1===w)&&(b.push(y),x=0,y="");z=0;case 34:if(!(z<b.length)){e.next=52;break}if(!(n.measureText&&n.measureText(b[z]).width>0)){e.next=41;break}_=n.measureText(b[z]),S=-(_.width/2).toFixed(2),n.fillText(b[z],S,z*t.higtHeightMultiple),e.next=49;break;case 41:return t.measureText=b[z],e.next=44,t.$nextTick();case 44:return e.next=46,t.getTextWidth();case 46:I=e.sent,P=-(I/2).toFixed(2),n.fillText(b[z],P,z*t.higtHeightMultiple);case 49:z++,e.next=34;break;case 52:e.next=68;break;case 54:if(!(n.measureText&&n.measureText(m).width>0)){e.next=60;break}C=n.measureText(m),L=-(C.width/2).toFixed(2),n.fillText(m,L,0),e.next=68;break;case 60:return t.measureText=m,e.next=63,t.$nextTick();case 63:return e.next=65,t.getTextWidth();case 65:F=e.sent,T=-(F/2).toFixed(2),n.fillText(m,T,0);case 68:e.next=90;break;case 70:k=m.split(""),M=0;case 72:if(!(M<k.length)){e.next=90;break}if(!(n.measureText&&n.measureText(k[M]).width>0)){e.next=79;break}R=n.measureText(k[M]),A=-(R.width/2).toFixed(2),n.fillText(k[M],A,M*t.higtHeightMultiple),e.next=87;break;case 79:return t.measureText=k[M],e.next=82,t.$nextTick();case 82:return e.next=84,t.getTextWidth();case 84:D=e.sent,O=-(D/2).toFixed(2),n.fillText(k[M],O,M*t.higtHeightMultiple);case 87:M++,e.next=72;break;case 90:if(!t.imgDrawed||!d.prizeImage||"vertical"===t.strDirection){e.next=121;break}if(B=/^(https|http)/g,!B.test(d.prizeImage)){e.next=110;break}return"","需要处理好跨域问题,",console.warn("###当前数据列表中的奖品图片为网络图片,".concat("需要处理好跨域问题,","开始尝试下载图片...###")),e.next=98,(0,o.downloadFile)(d.prizeImage);case 98:if(N=e.sent,console.log("处理远程图片",N),!N.ok){e.next=107;break}return j=N.tempFilePath,e.next=104,(0,o.pathToBase64)(j);case 104:d.prizeImage=e.sent,e.next=108;break;case 107:t.handlePrizeImgSuc({ok:!1,data:N.data,msg:N.msg});case 108:e.next=116;break;case 110:if(-1!==d.prizeImage.indexOf(";base64,")){e.next=116;break}return console.log("开始处理本地图片",d.prizeImage),e.next=114,(0,o.pathToBase64)(d.prizeImage);case 114:d.prizeImage=e.sent,console.log("处理本地图片结束",d.prizeImage);case 116:E=-t.imgPxWidth*t.systemPixelRatio/2,H=t.imgMarginPxStr*t.systemPixelRatio,$=t.imgPxWidth*t.systemPixelRatio,U=t.imgPxHeight*t.systemPixelRatio,t.imgCircled?(2===t.colors.length?n.setFillStyle(t.colors[u%2]):n.setFillStyle(t.colors[u]),(0,o.circleImg)(n,d.prizeImage,E,H,$,U)):n.drawImage(d.prizeImage,E,H,$,U);case 121:n.restore();case 122:u++,e.next=8;break;case 125:n.draw(!0,(function(){var e=setTimeout((function(){clearTimeout(e),e=null,uni.canvasToTempFilePath({canvasId:t.canvasId,destWidth:t.higtCanvasSize,destHeight:t.higtCanvasSize,success:function(e){t.handlePrizeImg({ok:!0,data:e.tempFilePath,msg:"画布导出生成图片成功"})},fail:function(e){t.handlePrizeImg({ok:!1,data:e,msg:"画布导出生成图片失败"})}},t)}),500)}));case 126:case"end":return e.stop()}}),e)})))()},handlePrizeImg:function(t){if(t.ok){var e=t.data;if(!this.canvasCached)return this.lotteryImg=e,void this.handlePrizeImgSuc(t);(0,o.setStore)("".concat(this.canvasId,"LotteryImg"),e),this.lotteryImg=e,this.handlePrizeImgSuc(t);var i=this.isCacheImg?"缓存":"导出";console.info("当前为 H5 端,使用".concat(i,"中的 base64 图"))}else console.error(t.msg,t),console.error("###当前为 H5 端,下载网络图片需要后端配置允许跨域###")},handlePrizeImgSuc:function(t){this.$emit("finish",{ok:t.ok,data:t.data,msg:t.ok?this.successMsg:this.failMsg})},getTextWidth:function(){console.warn("正在采用兼容方式获取文本的 size 信息");var t=uni.createSelectorQuery().in(this),e=t.select(".almost-lottery__measureText");return new Promise((function(t,i){e.fields({size:!0},(function(e){t(e.width)})).exec()}))},strLimit:function(t){var e=this.strMaxLen;return t&&e&&(0,o.clacTextLen)(t).realLen>e?t.slice(0,e-1)+"..":t},checkCacheImg:function(){console.log("检查本地缓存中是否存在转盘图"),this.oldLotteryImg=(0,o.getStore)("".concat(this.canvasId,"LotteryImg"));var t=(0,o.getStore)("".concat(this.canvasId,"PrizeList")),e=JSON.stringify(this.prizeList);if(this.oldLotteryImg&&t===e)return console.log("经查,本地缓存中存在转盘图 => ".concat(this.oldLotteryImg)),this.isCacheImg=!0,console.log("需要继续判断这张缓存图是否可用"),void this.handlePrizeImg({ok:!0,data:this.oldLotteryImg,msg:"画布导出生成图片成功"});console.log("经查,本地缓存中不存在转盘图"),this.initCanvasDraw()},initCanvasDraw:function(){console.log("开始初始化转盘绘制"),this.isCacheImg=!1,this.lotteryImg="",(0,o.clearStore)("".concat(this.canvasId,"LotteryImg")),(0,o.setStore)("".concat(this.canvasId,"PrizeList"),this.prizeList),this.onCreateCanvas()},beforeInit:function(){var t=this;return(0,r.default)((0,a.default)().mark((function e(){var i,n,r,o,s,l,c;return(0,a.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i=uni.createSelectorQuery().in(t),e.next=3,new Promise((function(t){i.select(".almost-lottery__wrap").boundingClientRect((function(e){t(e)})).exec()}));case 3:return n=e.sent,e.next=6,new Promise((function(t){i.select(".lottery-action").boundingClientRect((function(e){t(e)})).exec()}));case 6:return r=e.sent,e.next=9,new Promise((function(t){i.select(".str-margin-outside").boundingClientRect((function(e){t(e)})).exec()}));case 9:return o=e.sent,e.next=12,new Promise((function(t){i.select(".img-margin-str").boundingClientRect((function(e){t(e)})).exec()}));case 12:return s=e.sent,e.next=15,new Promise((function(t){i.select(".img-size").boundingClientRect((function(e){t(e)})).exec()}));case 15:l=e.sent,t.lotteryPxSize=Math.floor(n.width),t.canvasImgPxSize=t.lotteryPxSize-Math.floor(r.left)+Math.floor(n.left),t.actionPxSize=Math.floor(r.width),t.strMarginPxOutside=Math.floor(o.left)-Math.floor(n.left),t.imgMarginPxStr=Math.floor(s.left)-Math.floor(n.left),t.imgPxWidth=Math.floor(l.width),t.imgPxHeight=Math.floor(l.height),c=setTimeout((function(){clearTimeout(c),c=null,t.canvasCached?t.checkCacheImg():t.initCanvasDraw(),t.transitionDuration=t.duration}),50);case 24:case"end":return e.stop()}}),e)})))()}},mounted:function(){var t=this;this.$nextTick((function(){var e=setTimeout((function(){clearTimeout(e),e=null,t.beforeInit()}),50)}))}};e.default=s},"6ce0":function(t,e,i){var n=i("c286");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var a=i("4f06").default;a("3c45c7e8",n,!0,{sourceMap:!1,shadowMode:!1})},"97a9":function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"c",(function(){return a})),i.d(e,"a",(function(){}));var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",{staticClass:"almost-lottery"},[i("v-uni-view",{staticClass:"almost-lottery__wrap",style:{width:t.lotterySize+"rpx",height:t.lotterySize+"rpx"}},[i("v-uni-view",{staticClass:"lottery-action",style:{width:t.actionSize+"rpx",height:t.actionSize+"rpx",left:t.canvasMarginOutside+"rpx"}}),i("v-uni-view",{staticClass:"str-margin-outside",style:{left:t.strMarginOutside+"rpx"}}),i("v-uni-view",{staticClass:"img-margin-str",style:{left:t.imgMarginStr+"rpx"}}),i("v-uni-view",{staticClass:"img-size",style:{width:t.imgWidth+"rpx",height:t.imgHeight+"rpx"}}),t.lotteryImg?[i("v-uni-image",{staticClass:"almost-lottery__bg",style:{width:t.lotteryPxSize+"px",height:t.lotteryPxSize+"px"},attrs:{mode:"widthFix",src:t.lotteryBg}}),i("v-uni-image",{staticClass:"almost-lottery__canvas-img",style:{width:t.canvasImgPxSize+"px",height:t.canvasImgPxSize+"px",left:t.canvasImgToLeftPx+"px",top:t.canvasImgToLeftPx+"px",transform:"rotate("+(t.canvasAngle+t.targetAngle)+"deg)",transitionDuration:t.transitionDuration+"s"},attrs:{mode:"widthFix",src:t.lotteryImg}}),i("v-uni-image",{staticClass:"almost-lottery__action-bg",style:{width:t.actionPxSize+"px",height:t.actionPxSize+"px",left:t.actionBgToLeftPx+"px",top:t.actionBgToLeftPx+"px",transform:"rotate("+(t.actionAngle+t.targetActionAngle)+"deg)",transitionDuration:t.transitionDuration+"s"},attrs:{mode:"widthFix",src:t.actionBg},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.handleActionStart.apply(void 0,arguments)}}})]:t._e()],2),i("v-uni-text",{staticClass:"almost-lottery__measureText",style:{fontSize:t.higtFontSize+"px"}},[t._v(t._s(t.measureText))]),i("v-uni-canvas",{class:t.className,style:{width:t.higtCanvasSize+"px",height:t.higtCanvasSize+"px"},attrs:{"canvas-id":t.canvasId,width:t.higtCanvasSize,height:t.higtCanvasSize}})],1)},a=[]},"9b70":function(t,e,i){"use strict";var n=i("6ce0"),a=i.n(n);a.a},ae8e:function(t,e,i){"use strict";i("7a82");var n=i("4ea4").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,i("d3b7");var a=n(i("2909")),r=n(i("c7eb")),o=n(i("1da1")),s=n(i("b131")),l=(i("e555"),{name:"Home",components:{AlmostLottery:s.default},data:function(){return{isDev:!0,lotteryConfig:{lotterySize:600,actionSize:200},config:[],prizeList:[],prizeIndex:-1,prizeing:!1}},computed:{isApple:function(){return"ios"===uni.getSystemInfoSync().platform}},methods:{getPrizeList:function(){var t=this;return(0,o.default)((0,r.default)().mark((function e(){var i,n;return(0,r.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return uni.showLoading({title:"奖品准备中..."}),e.next=3,t.requestApiGetPrizeList();case 3:i=e.sent,console.log("获取奖品列表",i),i.ok?(n=i.data,n.length&&(t.config=i.config,t.prizeList=n,console.log("已获取到奖品列表数据,开始绘制抽奖转盘"),console.time&&console.time("绘制转盘用时"))):(uni.hideLoading(),uni.showToast({title:"获取奖品失败",mask:!0,icon:"none"}));case 6:case"end":return e.stop()}}),e)})))()},requestApiGetPrizeList:function(){var t=this;return new Promise((function(e,i){var n=setTimeout((function(){clearTimeout(n),n=null;var i=t;i.$request.get("Rotarytableprize.index",{samkey:(new Date).valueOf()}).then((function(t){0==t.errno&&e({ok:!0,config:t.data.config,data:t.data.prizelist})}))}),200)}))},handleDrawStart:function(){var t=this;if(console.log("触发抽奖按钮"),!this.prizeing){this.prizeing=!0;this.$request.get("Rotarytableprize.drawstart",{samkey:(new Date).valueOf()}).then((function(e){0==e.errno?t.tryLotteryDraw():t.prizeing=!1}))}},tryLotteryDraw:function(){console.log("旋转开始,获取中奖下标......"),this.remoteGetPrizeIndex()},remoteGetPrizeIndex:function(){var t=this;console.warn("###当前处于模拟的请求接口,并返回了中奖信息###");setTimeout((function(){null;var e=(0,a.default)(t.prizeList),i=t;i.$request.get("Rotarytableprize.getprizeid",{samkey:(new Date).valueOf()}).then((function(i){if(0==i.errno){for(var n=i.data.prizeId,a=0;a<e.length;a++){var r=e[a];if(r.prizeId===n){t.prizeIndex=a;break}}console.log("本次抽中奖品 =>",t.prizeList[t.prizeIndex].prizeName)}}))}),200)},handleDrawEnd:function(){var t=this;console.log("旋转结束,执行拿到结果后到逻辑");var e=this.prizeList[this.prizeIndex].prizeName,i="";i="谢谢参与"===e?"很遗憾,没有中奖,请再接再厉!":"恭喜您,获得 ".concat(e," !"),uni.showModal({content:i,showCancel:!1,complete:function(){t.prizeing=!1}})},handleDrawFinish:function(t){console.log("抽奖转盘绘制完成",t),t.ok&&console.timeEnd&&console.timeEnd("绘制转盘用时");setTimeout((function(){null,uni.hideLoading(),uni.showToast({title:t.msg,mask:!0,icon:"none"})}),50)}},onLoad:function(){this.prizeList=[],this.getPrizeList()},onPullDownRefresh:function(){setTimeout((function(){uni.stopPullDownRefresh()}),200)},onUnload:function(){uni.hideLoading()}});e.default=l},b131:function(t,e,i){"use strict";i.r(e);var n=i("97a9"),a=i("1c32");for(var r in a)["default"].indexOf(r)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(r);i("13dd");var o=i("f0c5"),s=Object(o["a"])(a["default"],n["b"],n["c"],!1,null,"0d5b4b66",null,!1,n["a"],void 0);e["default"]=s.exports},c286:function(t,e,i){var n=i("24fb");e=n(!1),e.push([t.i,'@charset "UTF-8";\r\n/**\r\n * scss预处理 内置的常用样式变量\r\n * 后期项目会考虑使用scss\r\n*/\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 文字基本颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */.almost-lottery[data-v-42b3bc7e]{flex:1;background-color:#ff893f;padding-top:%?100?%;padding-bottom:%?380?%}.almost-lottery__wheel[data-v-42b3bc7e]{text-align:center}.almost-lottery__wheel .almost-lottery__count[data-v-42b3bc7e]{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:%?40?% 0}.almost-lottery__wheel .text[data-v-42b3bc7e]{color:#fff;font-size:%?24?%}.almost-lottery__rule[data-v-42b3bc7e]{padding:0 %?28?%;color:#fff8cb}.almost-lottery__rule .rule-head[data-v-42b3bc7e]{display:flex;justify-content:space-around;align-items:center;margin:%?40?% 0}.almost-lottery__rule .rule-head .line[data-v-42b3bc7e]{flex:1;height:1px;background-color:#fff3a5}.almost-lottery__rule .rule-head .title[data-v-42b3bc7e]{width:%?280?%;color:#f63857;line-height:%?70?%;text-align:center;margin:0 %?20?%;border-radius:%?8?%;background-image:linear-gradient(0deg,#fff29e,#fff4a8)}.almost-lottery__rule .rule-body[data-v-42b3bc7e]{color:#fff8cb;font-size:%?24?%;padding:%?10?% 0 %?40?%}.almost-lottery__rule .rule-body .item[data-v-42b3bc7e]{display:flex;margin-bottom:%?10?%}.almost-lottery__rule .rule-body .number[data-v-42b3bc7e]{position:relative;top:%?4?%;width:%?28?%;height:%?28?%;line-height:%?28?%;text-align:center;color:#f63857;background:#fff8cb;border-radius:50%;margin-right:%?10?%}.almost-lottery__rule .rule-body .text[data-v-42b3bc7e]{flex:1}.almost-lottery__rule .rule-body .item-rule .text[data-v-42b3bc7e]{display:flex;flex-direction:column}.almost-lottery__action-dev[data-v-42b3bc7e]{display:flex;flex-direction:row;justify-content:center;align-items:center;width:%?400?%;height:%?80?%;border-radius:%?10?%;text-align:center;background-color:red;margin:0 auto %?40?%}.almost-lottery__action-dev .text[data-v-42b3bc7e]{color:#fff;font-size:%?28?%}',""]),t.exports=e},cb29:function(t,e,i){var n=i("23e7"),a=i("81d5"),r=i("44d2");n({target:"Array",proto:!0},{fill:a}),r("fill")},d017:function(t,e,i){var n=i("fe45");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var a=i("4f06").default;a("4ba03d38",n,!0,{sourceMap:!1,shadowMode:!1})},db90:function(t,e,i){"use strict";i("7a82"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},i("a4d3"),i("e01a"),i("d3b7"),i("d28b"),i("3ca3"),i("ddb0"),i("a630")},e555:function(t,e,i){"use strict";i("7a82");var n=i("4ea4").default;Object.defineProperty(e,"__esModule",{value:!0}),e.setStore=e.pathToBase64=e.getStore=e.downloadFile=e.clearStore=e.clearCacheFile=e.clacTextLen=e.circleImg=e.base64ToPath=void 0;var a=n(i("53ca"));i("e9c4"),i("cb29"),i("d3b7"),i("c975"),i("d9e2"),i("d401"),i("ac1f"),i("466d"),i("81b2"),i("0eb6"),i("b7ef"),i("8bd4"),i("ace4"),i("5cc6"),i("907a"),i("9a8c"),i("a975"),i("735e"),i("c1ac"),i("d139"),i("3a7b"),i("986a"),i("1d02"),i("d5d6"),i("82f8"),i("e91f"),i("60bd"),i("5f96"),i("3280"),i("3fcc"),i("ca91"),i("25a1"),i("cd26"),i("3c5d"),i("2954"),i("649e"),i("219c"),i("b39a"),i("72f7"),i("3ca3"),i("ddb0"),i("2b3d"),i("9861"),i("5319");e.setStore=function(t,e){t&&("string"!==typeof e&&(e=JSON.stringify(e)),uni.setStorageSync(t,e))};e.getStore=function(t){if(t)return uni.getStorageSync(t)};e.clearStore=function(t){t?uni.removeStorageSync(t):(console.log("清理本地全部缓存"),uni.clearStorageSync())};e.circleImg=function(t,e,i,n,a,r){var o=Math.floor(a/2),s=i+o,l=n+o;t.save(),t.beginPath(),t.arc(s,l,o,0,2*Math.PI),t.fill(),t.clip(),t.drawImage(e,i,n,a,r),t.restore()};e.clacTextLen=function(t){if(!t)return{byteLen:0,realLen:0};t+="";for(var e=0,i=0;i<t.length;i++)t.charCodeAt(i)<0||t.charCodeAt(i)>255?e+=2:e+=1;return{byteLen:e,realLen:e/2}};e.downloadFile=function(t){return new Promise((function(e){uni.downloadFile({url:t,success:function(t){e({ok:!0,data:t.errMsg,tempFilePath:t.tempFilePath})},fail:function(t){e({ok:!1,data:t.errMsg,msg:"图片下载失败"})}})}))};e.clearCacheFile=function(){};e.pathToBase64=function(t){return new Promise((function(e,i){if("object"===("undefined"===typeof window?"undefined":(0,a.default)(window))&&"document"in window){if("function"===typeof FileReader){var n=new XMLHttpRequest;return n.open("GET",t,!0),n.responseType="blob",n.onload=function(){if(200===this.status){var t=new FileReader;t.onload=function(t){e(t.target.result)},t.onerror=i,t.readAsDataURL(this.response)}},n.onerror=i,void n.send()}var r=document.createElement("canvas"),o=r.getContext("2d"),s=new Image;return s.onload=function(){r.width=s.width,r.height=s.height,o.drawImage(s,0,0),e(r.toDataURL()),r.height=r.width=0},s.onerror=i,void(s.src=t)}if("object"!==("undefined"===typeof plus?"undefined":(0,a.default)(plus)))"object"===("undefined"===typeof wx?"undefined":(0,a.default)(wx))&&wx.canIUse("getFileSystemManager")?wx.getFileSystemManager().readFile({filePath:t,encoding:"base64",success:function(t){e("data:image/png;base64,"+t.data)},fail:function(t){i(t)}}):i(new Error("not support"));else{var l=function(t){if(0===t.indexOf("_www")||0===t.indexOf("_doc")||0===t.indexOf("_documents")||0===t.indexOf("_downloads"))return t;if(0===t.indexOf("/storage/emulated/0/"))return t;if(0===t.indexOf("/storage/sdcard0/"))return t;if(0===t.indexOf("/var/mobile/"))return t;if(0===t.indexOf("file://"))return t;if(0===t.indexOf("/")){var e="iOS"===plus.os.name?t:plus.io.convertLocalFileSystemURL(t);if(e!==t)return e;t=t.substring(1)}return"_www/"+t}(t);plus.io.resolveLocalFileSystemURL(l,(function(t){t.file((function(t){var n=new plus.io.FileReader;n.onload=function(t){e(t.target.result)},n.onerror=function(t){console.log(t),i(t)},n.readAsDataURL(t)}),(function(t){i(t)}))}),(function(t){i(t)}))}}))};e.base64ToPath=function(t){return new Promise((function(e,i){if("object"===("undefined"===typeof window?"undefined":(0,a.default)(window))&&"document"in window){t=t.split(",");var n=t[0].match(/:(.*?);/)[1],r=atob(t[1]),o=r.length,s=new Uint8Array(o);while(o--)s[o]=r.charCodeAt(o);return e((window.URL||window.webkitURL).createObjectURL(new Blob([s],{type:n})))}var l=t.match(/data\:\S+\/(\S+);/);l?l=l[1]:i(new Error("base64 error"));var c=Date.now()+"."+l;if("object"!==("undefined"===typeof plus?"undefined":(0,a.default)(plus)))if("object"===("undefined"===typeof wx?"undefined":(0,a.default)(wx))&&wx.canIUse("getFileSystemManager")){var u=wx.env.USER_DATA_PATH+"/"+c;wx.getFileSystemManager().writeFile({filePath:u,data:t.replace(/^data:\S+\/\S+;base64,/,""),encoding:"base64",success:function(){e(u)},fail:function(t){i(t)}})}else i(new Error("not support"));else{var d=new plus.nativeObj.Bitmap("bitmap"+Date.now());d.loadBase64Data(t,(function(){var t="_doc/uniapp_temp/"+c;d.save(t,{},(function(){d.clear(),e(t)}),(function(t){d.clear(),i(t)}))}),(function(t){d.clear(),i(t)}))}}))}},f02c:function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return r})),i.d(e,"a",(function(){return n}));var n={almostLottery:i("b131").default},a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",{staticClass:"almost-lottery"},[i("v-uni-view",{staticClass:"almost-lottery__wheel"},[t.prizeList.length?i("almost-lottery",{attrs:{"lottery-size":t.lotteryConfig.lotterySize,"action-size":t.lotteryConfig.actionSize,"ring-count":10,duration:3,"img-circled":!0,canvasCached:!0,"prize-list":t.prizeList,"prize-index":t.prizeIndex},on:{"reset-index":function(e){arguments[0]=e=t.$handleEvent(e),t.prizeIndex=-1},"draw-start":function(e){arguments[0]=e=t.$handleEvent(e),t.handleDrawStart.apply(void 0,arguments)},"draw-end":function(e){arguments[0]=e=t.$handleEvent(e),t.handleDrawEnd.apply(void 0,arguments)},finish:function(e){arguments[0]=e=t.$handleEvent(e),t.handleDrawFinish.apply(void 0,arguments)}}}):t._e(),i("v-uni-view",{staticClass:"almost-lottery__count"})],1),i("v-uni-view",{staticClass:"almost-lottery__rule"},[i("v-uni-view",{staticClass:"rule-head"},[i("v-uni-view",{staticClass:"line"}),i("v-uni-text",{staticClass:"title"},[t._v("活动规则")]),i("v-uni-view",{staticClass:"line"})],1),i("v-uni-view",{staticClass:"rule-body"},[i("v-uni-view",{staticClass:"item"},[i("v-uni-view",{staticClass:"text"},[i("v-uni-text",[t._v(t._s(t.config.content))])],1)],1),t.isApple?[i("v-uni-view",{staticClass:"item"},[i("v-uni-view",{staticClass:"number"},[t._v("1")]),i("v-uni-view",{staticClass:"text"},[t._v("本次活动由发起,与Apple.Inc无关。")])],1),i("v-uni-view",{staticClass:"item"},[i("v-uni-view",{staticClass:"number"},[t._v("2")]),i("v-uni-view",{staticClass:"text"},[t._v("苹果公司不是本活动的赞助商且没有以任何形式参与活动。")])],1),i("v-uni-view",{staticClass:"item"},[i("v-uni-view",{staticClass:"number"},[t._v("3")]),i("v-uni-view",{staticClass:"text"},[t._v("本活动仅限17岁以上用户参加。")])],1)]:[i("v-uni-view",{staticClass:"item"},[i("v-uni-view",{staticClass:"text"},[t._v("本活动仅限17岁以上用户参加。")])],1)]],2)],1)],1)},r=[]},fe45:function(t,e,i){var n=i("24fb");e=n(!1),e.push([t.i,'@charset "UTF-8";\r\n/**\r\n * scss预处理 内置的常用样式变量\r\n * 后期项目会考虑使用scss\r\n*/\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 文字基本颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */.almost-lottery[data-v-0d5b4b66]{display:flex;flex-direction:column;justify-content:center;align-items:center}.almost-lottery__canvas[data-v-0d5b4b66]{position:absolute;left:-9999px;opacity:0;display:flex;justify-content:center;align-items:center}.lottery-action[data-v-0d5b4b66],\r\n.str-margin-outside[data-v-0d5b4b66],\r\n.img-margin-str[data-v-0d5b4b66],\r\n.img-size[data-v-0d5b4b66]{position:absolute;left:0;top:0;z-index:-1}.almost-lottery__measureText[data-v-0d5b4b66]{position:absolute;left:0;top:0;white-space:nowrap;font-size:12px;opacity:0}.almost-lottery__wrap[data-v-0d5b4b66]{position:relative}.almost-lottery__bg[data-v-0d5b4b66],\r\n.almost-lottery__canvas-img[data-v-0d5b4b66],\r\n.almost-lottery__action-bg[data-v-0d5b4b66]{position:absolute;left:0;top:0}.almost-lottery__canvas-img[data-v-0d5b4b66]{transition:-webkit-transform cubic-bezier(.34,.12,.05,.95);transition:transform cubic-bezier(.34,.12,.05,.95);transition:transform cubic-bezier(.34,.12,.05,.95),-webkit-transform cubic-bezier(.34,.12,.05,.95)}',""]),t.exports=e}}]);
|