{"dependencies":[{"ETag":"1F38941348061D1D6B31AE7B614619A8","name":"0.json","size":7899724,"type":"json","url":"https://gw.alipayobjects.com/os/mashi/e25e0c28-573b-4d20-8692-d1e99cee17db/herbox/0.json"}],"sourceCode":{"babel.config.js":" \nmodule.exports = {\n presets: [\n [\n '@babel/preset-env',\n {\n loose: true,\n modules: false,\n },\n ],\n '@babel/preset-typescript',\n ],\n plugins: ['@babel/plugin-syntax-dynamic-import'],\n};","client/app.acss":"page {\n background: #f7f7f7;\n}\n","client/app.js":"import init from './masServerless'; // 从库里获得\ninit({\n appId: '2021001107697003', // 小程序应用标识\n // 小程序云控制台中记得对比切换的空间是否正确哦~\n spaceId: 'f710ecb1-a1b9-4934-a4ce-9f8031af567f', // 服务空间标识\n clientSecret: '8Ex0XQrWLQGIRvDCC+D/eA==', // 服务空间 secret key\n endpoint: 'https://api.bspapp.com'\n});\n\nApp({\n async onLaunch(options) {\n // 第一次打开\n await my.serverless.user.authorize({\n authProvider: 'alipay_openapi',\n // authType: 'anonymous'\n });\n console.info('App onLaunch');\n },\n onShow(options) {\n // 从后台被 scheme 重新打开\n // options.query == {number:1}\n },\n});\n","client/app.json":"{\n \"pages\": [\n \"pages/index/index\"\n ],\n \"window\": {\n \"defaultTitle\": \"My App\"\n }\n}\n","client/masServerless.js":"import MPServerless from '@alicloud/mpserverless-sdk';\n\nexport default function(config) {\n if (!my.serverless) {\n const instance = new MPServerless({\n uploadFile: my.uploadFile,\n request: my.request,\n getAuthCode: my.getAuthCode,\n }, config);\n my.serverless = instance;\n }\n}","client/package-lock.json":"{\n \"version\": \"1.0.0\",\n \"lockfileVersion\": 1,\n \"requires\": true,\n \"dependencies\": {\n \"@alicloud/mpserverless-sdk\": {\n \"version\": \"2.2.5\",\n \"resolved\": \"https://registry.npm.taobao.org/@alicloud/mpserverless-sdk/download/@alicloud/mpserverless-sdk-2.2.5.tgz\",\n \"integrity\": \"sha1-f9uexTKQgp3upjkC+QG5yuxefws=\"\n },\n \"@antv/adjust\": {\n \"version\": \"0.1.1\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/adjust/download/@antv/adjust-0.1.1.tgz?cache=0&sync_timestamp=1582683441174&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40antv%2Fadjust%2Fdownload%2F%40antv%2Fadjust-0.1.1.tgz\",\n \"integrity\": \"sha1-4mOrDhoZQaZIhC/Ahs9lp+O3Xpg=\",\n \"requires\": {\n \"@antv/util\": \"~1.3.1\"\n },\n \"dependencies\": {\n \"@antv/util\": {\n \"version\": \"1.3.1\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/util/download/@antv/util-1.3.1.tgz?cache=0&sync_timestamp=1572438102677&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40antv%2Futil%2Fdownload%2F%40antv%2Futil-1.3.1.tgz\",\n \"integrity\": \"sha1-MKNLIB/5Em7A1YxyyBZqnD5kTM0=\",\n \"requires\": {\n \"@antv/gl-matrix\": \"^2.7.1\"\n }\n }\n }\n },\n \"@antv/attr\": {\n \"version\": \"0.1.2\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/attr/download/@antv/attr-0.1.2.tgz\",\n \"integrity\": \"sha1-LusSL8qvhRoth0mrx8YFGdP3fjc=\",\n \"requires\": {\n \"@antv/util\": \"~1.3.1\"\n },\n \"dependencies\": {\n \"@antv/util\": {\n \"version\": \"1.3.1\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/util/download/@antv/util-1.3.1.tgz?cache=0&sync_timestamp=1572438102677&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40antv%2Futil%2Fdownload%2F%40antv%2Futil-1.3.1.tgz\",\n \"integrity\": \"sha1-MKNLIB/5Em7A1YxyyBZqnD5kTM0=\",\n \"requires\": {\n \"@antv/gl-matrix\": \"^2.7.1\"\n }\n }\n }\n },\n \"@antv/f2\": {\n \"version\": \"3.3.9\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/f2/download/@antv/f2-3.3.9.tgz\",\n \"integrity\": \"sha1-N5PaGSWrolzz451whLaSkDMMEQc=\",\n \"requires\": {\n \"@antv/adjust\": \"~0.1.1\",\n \"@antv/attr\": \"~0.1.0\",\n \"@antv/scale\": \"~0.1.2\",\n \"@antv/util\": \"~1.2.5\",\n \"hammerjs\": \"^2.0.8\"\n }\n },\n \"@antv/gl-matrix\": {\n \"version\": \"2.7.1\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/gl-matrix/download/@antv/gl-matrix-2.7.1.tgz\",\n \"integrity\": \"sha1-rLjjf3qz3wE0WrpDcteUK+QuuhQ=\"\n },\n \"@antv/my-f2\": {\n \"version\": \"1.1.6\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/my-f2/download/@antv/my-f2-1.1.6.tgz\",\n \"integrity\": \"sha1-Qz+xwtTs5T5tf8KUlHv/gbau2l4=\",\n \"requires\": {\n \"@antv/f2\": \"~3.3.5\",\n \"wolfy87-eventemitter\": \"^5.2.4\"\n }\n },\n \"@antv/scale\": {\n \"version\": \"0.1.4\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/scale/download/@antv/scale-0.1.4.tgz\",\n \"integrity\": \"sha1-vP8hwg6Biqib9md+8S95wO5O+9w=\",\n \"requires\": {\n \"@antv/util\": \"~1.3.1\",\n \"fecha\": \"~2.3.3\"\n },\n \"dependencies\": {\n \"@antv/util\": {\n \"version\": \"1.3.1\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/util/download/@antv/util-1.3.1.tgz?cache=0&sync_timestamp=1572438102677&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40antv%2Futil%2Fdownload%2F%40antv%2Futil-1.3.1.tgz\",\n \"integrity\": \"sha1-MKNLIB/5Em7A1YxyyBZqnD5kTM0=\",\n \"requires\": {\n \"@antv/gl-matrix\": \"^2.7.1\"\n }\n }\n }\n },\n \"@antv/util\": {\n \"version\": \"1.2.5\",\n \"resolved\": \"https://registry.npm.taobao.org/@antv/util/download/@antv/util-1.2.5.tgz?cache=0&sync_timestamp=1572438102677&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40antv%2Futil%2Fdownload%2F%40antv%2Futil-1.2.5.tgz\",\n \"integrity\": \"sha1-iJbFBV7Cnko0S12ql7+CkF99QM0=\",\n \"requires\": {\n \"@antv/gl-matrix\": \"^2.7.1\"\n }\n },\n \"@babel/runtime\": {\n \"version\": \"7.8.4\",\n \"resolved\": \"https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.8.4.tgz\",\n \"integrity\": \"sha1-159aIED3yqJNU+VjqtScvAVYEwg=\",\n \"requires\": {\n \"regenerator-runtime\": \"^0.13.2\"\n }\n },\n \"alipay-cloud-sdk\": {\n \"version\": \"0.9.16\",\n \"resolved\": \"https://registry.npm.taobao.org/alipay-cloud-sdk/download/alipay-cloud-sdk-0.9.16.tgz\",\n \"integrity\": \"sha1-ccCoWUB7PMbmNxs/XvROYfRohf8=\",\n \"requires\": {\n \"alipay-mini-lib\": \"^0.11.7\",\n \"tslib\": \"^1.9.3\"\n }\n },\n \"alipay-mini-lib\": {\n \"version\": \"0.11.7\",\n \"resolved\": \"https://registry.npm.taobao.org/alipay-mini-lib/download/alipay-mini-lib-0.11.7.tgz\",\n \"integrity\": \"sha1-1VzH/FQwRrC50ID//+oPgr5/GzA=\",\n \"requires\": {\n \"@babel/runtime\": \"^7.7.2\"\n }\n },\n \"fecha\": {\n \"version\": \"2.3.3\",\n \"resolved\": \"https://registry.npm.taobao.org/fecha/download/fecha-2.3.3.tgz?cache=0&sync_timestamp=1581333310491&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffecha%2Fdownload%2Ffecha-2.3.3.tgz\",\n \"integrity\": \"sha1-lI50FX3xoy/RsSw6PDzctuydls0=\"\n },\n \"hammerjs\": {\n \"version\": \"2.0.8\",\n \"resolved\": \"https://registry.npm.taobao.org/hammerjs/download/hammerjs-2.0.8.tgz\",\n \"integrity\": \"sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=\"\n },\n \"mini-antui\": {\n \"version\": \"0.4.35\",\n \"resolved\": \"https://registry.npm.taobao.org/mini-antui/download/mini-antui-0.4.35.tgz\",\n \"integrity\": \"sha1-4y2N8cZKxVj4Rx2y5GBzsg3k3Sw=\"\n },\n \"regenerator-runtime\": {\n \"version\": \"0.13.3\",\n \"resolved\": \"https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.3.tgz?cache=0&sync_timestamp=1582478371027&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.3.tgz\",\n \"integrity\": \"sha1-fPanfY9cb2Drc8X8GVWyzrAea/U=\"\n },\n \"tslib\": {\n \"version\": \"1.11.0\",\n \"resolved\": \"https://registry.npm.taobao.org/tslib/download/tslib-1.11.0.tgz\",\n \"integrity\": \"sha1-8fNSgwFiGlMiDVg3OuUQ/3R6Zrw=\"\n },\n \"wolfy87-eventemitter\": {\n \"version\": \"5.2.9\",\n \"resolved\": \"https://registry.npm.taobao.org/wolfy87-eventemitter/download/wolfy87-eventemitter-5.2.9.tgz\",\n \"integrity\": \"sha1-6Hn3cLMPu2USqK+7Mww4hZEJnCo=\"\n }\n }\n}\n","client/package.json":"{\n \"name\": \"\",\n \"version\": \"1.0.0\",\n \"main\": \"\",\n \"license\": \"MIT\",\n \"dependencies\": {\n \"@alicloud/mpserverless-sdk\": \"^2.2.3\",\n \"@antv/my-f2\": \"~1.1.5\",\n \"alipay-cloud-sdk\": \"^0.9.14\",\n \"mini-antui\": \"^0.4.34\",\n \"regenerator-runtime\": \"^0.13.3\"\n }\n}\n","client/pages/index/chart.js":"import F2 from '@antv/my-f2';\n\nconst { Shape } = F2;\nconst { G } = F2;\nconst { Util } = F2;\nconst { Global } = F2;\nconst { Vector2 } = G;\nShape.registerShape('interval', 'tick', {\n draw: function draw(cfg, container) {\n const points = this.parsePoints(cfg.points);\n const style = Util.mix({\n stroke: cfg.color,\n }, Global.shape.interval, cfg.style);\n if (cfg.isInCircle) {\n let newPoints = points.slice(0);\n if (this._coord.transposed) {\n newPoints = [points[0], points[3], points[2], points[1]];\n }\n\n const _cfg$center = cfg.center;\n const { x } = _cfg$center;\n const { y } = _cfg$center;\n\n const v = [1, 0];\n const v0 = [newPoints[0].x - x, newPoints[0].y - y];\n const v1 = [newPoints[1].x - x, newPoints[1].y - y];\n const v2 = [newPoints[2].x - x, newPoints[2].y - y];\n\n let startAngle = Vector2.angleTo(v, v1);\n let endAngle = Vector2.angleTo(v, v2);\n const r0 = Vector2.length(v0);\n const r = Vector2.length(v1);\n\n if (startAngle >= 1.5 * Math.PI) {\n startAngle -= 2 * Math.PI;\n }\n\n if (endAngle >= 1.5 * Math.PI) {\n endAngle -= 2 * Math.PI;\n }\n\n const lineWidth = r - r0;\n const newRadius = r - lineWidth / 2;\n\n return container.addShape('Arc', {\n className: 'interval',\n attrs: Util.mix({\n x,\n y,\n startAngle,\n endAngle,\n r: newRadius,\n lineWidth,\n lineCap: 'round',\n }, style),\n });\n }\n },\n});\nconst app = getApp();\n\nexport let chart = null;\n\nfunction drawChart(canvas, width, height, value) {\n chart = new F2.Chart({\n el: canvas,\n width,\n height,\n /* width: 390,\n height: 292.5 */\n });\n\n const data = [{\n x: '1',\n y: value / 25 >= 100 ? 100 : value / 25,\n }];\n\n chart.source(data, {\n y: {\n max: 100,\n min: 0,\n },\n });\n chart.axis(false);\n chart.tooltip(false);\n chart.coord('polar', {\n transposed: true,\n innerRadius: 0.8,\n radius: 0.85,\n });\n chart.guide().arc({\n start: [0, 0],\n end: [1, 99.98],\n top: false,\n style: {\n lineWidth: 10,\n stroke: '#EDEDED',\n },\n });\n chart.guide().text({\n position: ['50%', '42%'],\n content: '今日步数',\n style: {\n fill: '#999999',\n fontSize: 16,\n },\n });\n chart.guide().text({\n position: ['50%', '56%'],\n content: `${value}`,\n style: {\n fill: '#000000',\n fontSize: 32,\n fontWeight: 'bold',\n },\n });\n chart.interval().position('x*y').shape('tick').size(10)\n .color('l(90) 0:#45B6FF 1:#2189FF')\n .animate({\n appear: {\n duration: 1200,\n easing: 'cubicIn',\n },\n });\n chart.render();\n return chart;\n}\n\nexport default drawChart;\n","client/pages/index/index.acss":"@import '../style/layout.acss';\n.top {\n width: 750rpx;\n overflow: hidden;\n position: relative;\n}\n\n.big-font {\n font-size: 36rpx;\n margin: 32rpx 0 16rpx 0;\n}\n\n.top view {\n transform: translate(-3054rpx, 0);\n}\n\n.header2 {\n position: absolute;\n bottom: 0;\n left: 1502rpx;\n}\n\n.top .flex {\n width: 4506rpx;\n}\n\n.top .flex image {\n height: 407rpx;\n width: 1502rpx;\n}\n\n#lottie-1 {\n width: 750rpx;\n height: 350rpx;\n position: absolute;\n bottom: 35rpx;\n}\n\n.header2-img {\n min-height: 291rpx;\n max-height: 291rpx;\n height: 291rpx;\n width: 1298rpx;\n}\n\n.body {\n width: 702rpx;\n /* height: 744rpx; */\n margin: 0 auto;\n position: relative;\n bottom: 20rpx;\n background: #FFFFFF;\n border-radius: 4rpx;\n}\n\n.info-toast {\n position: absolute;\n top: 36rpx;\n right: 56rpx;\n}\n\n.info-toast-0 {\n height: 65rpx;\n width: 237rpx;\n}\n\n.info-toast-1 {\n height: 86rpx;\n width: 214rpx;\n}\n\n.info-toast-2, .info-toast-3 {\n height: 65rpx;\n width: 257rpx;\n}\n\n.btn {\n border-radius: 47rpx;\n width: 574rpx;\n height: 94rpx;\n line-height: 94rpx;\n background: linear-gradient(to right, #45B6FF, #2189FF);\n color: white;\n font-size: 36rpx;\n}\n\n.info {\n color: #999999;\n font-size: 24rpx;\n margin-top: 20rpx;\n line-height: 1.5;\n}\n\n.share {\n border: 0;\n width: 100%;\n border-top: 1px solid #f0ede8;\n height: 130rpx;\n line-height: 130rpx;\n margin-top: 40rpx;\n font-size: 36rpx;\n color: #2189FF;\n}\n\n.share-modal {\n border: 0;\n width: 100%;\n border-top: 1px solid #f0ede8;\n /* font-size: 36rpx; */\n color: #2189FF;\n}\n\n.footer {\n font-size: 24rpx;\n color: #666666;\n padding-bottom: 80rpx;\n}\n\n.footer .name {\n margin-top: 2rpx;\n}\n\n.gray {\n color: #999999;\n margin: 40rpx 0 20rpx 0;\n}\n\n/** 修改弹出框样式 */\n\n.red-modal .am-modal {\n height: 856rpx;\n width: 638rpx;\n}\n\n.red-modal .red-bgd {\n height: 856rpx;\n min-width: 638rpx;\n max-width: 638rpx;\n width: 638rpx;\n}\n\n.red-modal .am-modal-close {\n opacity: 0;\n}\n\n.red-modal .am-modal-header {\n padding: 0;\n}\n\n.red-modal .my-modal {\n padding: 0;\n margin: 0;\n}\n\n.red-modal .my-modal-header {\n display: flex;\n height: 465px;\n width: 319px;\n position: relative;\n}\n\n.red-modal .open-view {\n position: absolute;\n top: 530rpx;\n left: 218rpx;\n}\n\n.red-modal .open {\n height: 202rpx;\n width: 202rpx;\n}\n\n.icon {\n width: 45rpx;\n height: 33rpx;\n margin-right: 6rpx;\n}\n\n.no-packet .am-modal-close {\n display: none;\n}\n\n.repeat-modal .am-modal-footer {\n height: 100px;\n}\n\n.repeat-close {\n border-top: 1px solid #ddd;\n}\n\n.repeat-modal .am-modal-footer-active {\n background-color: white;\n}\n\n#area {\n /* position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0; */\n}","client/pages/index/index.axml":"<view class=\"top\">\n <view animation=\"{{animation}}\" class=\"flex\">\n <image src=\"https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*2isdSJEPdwYAAAAAAAAAAABkARQnAQ\" />\n <image src=\"https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*2isdSJEPdwYAAAAAAAAAAABkARQnAQ\" />\n <image src=\"https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*2isdSJEPdwYAAAAAAAAAAABkARQnAQ\" />\n </view>\n <lottie \n id=\"lottie-1\" \n autoplay=\"{{true}}\" \n path=\"https://cnicu.cn/assets/images/lottie.json\" \n speed=\"1.0\" \n repeatCount=\"-1\" \n autoReverse=\"0\" \n assetsPath=\"https://cnicu.cn/assets/images/lottie.json\" \n />\n <view class=\"header2\" animation=\"{{animation}}\">\n <image \n class=\"header2-img\" \n src=\"https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*lOe9TboGqSYAAAAAAAAAAABkARQnAQ\" \n />\n </view>\n</view>\n<view class=\"flex-center-column body\">\n <image \n mode=\"scaleToFill\" \n class=\"info-toast info-toast-{{info}}\" \n src=\"{{tipImage[info]}}\"\n />\n <canvas id=\"area\" width=\"{{width}}\" height=\"{{height}}\" />\n <button class=\"btn\" onTap=\"onButton\">{{info == 0 ? '获取步数' : '兑换奖励红包'}}</button>\n <view class=\"flex-center-column info\">\n <text>{{btmInfo === 0 ? '请先进行服务授权获取步数等相关信息,步数满' : btmInfo === 1 ? '加油,走满 2500 步就能兑换奖励红包啦!' : (btmInfo === 2 ? '好棒!今日已走满 2500 步,快去兑换奖励红包吧!' : (btmInfo === 3 ? '已兑换奖励红包,请在支付宝账单查看!' : '很遗憾,红包已被领完,感谢关注「小程序云」'))}}</text>\n <text>{{btmInfo === 0 ? '2500 步即可兑换奖励红包' : btmInfo === 1 || btmInfo === 2 ? '数量有限,领完即止' : btmInfo === 3 ? '还可分享给朋友领红包,数量有限,领完即止' : ''}}</text>\n </view>\n <button size=\"ghost\" onTap=\"onShare\" hover-class='none' class=\"share\">分享给朋友</button>\n</view>\n<view class=\"flex-center-column footer\">\n <text class=\"gray\">本小程序由\"小程序云官方团队\"提供</text>\n <view class=\"flex-center\">\n <image class=\"icon\" src=\"https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*Q7AURqjLPXYAAAAAAAAAAABkARQnAQ\"/><text class=\"name\">小程序云<text>\n </view>\n</view>","client/pages/index/index.js":"import F2 from '@antv/my-f2';\nimport drawChart, { chart } from './chart';\n\nPage({\n data: {\n animation: null,\n openAnim: null,\n info: 0, // 提示文案\n btmInfo: 0, // 按钮下方提示文案\n tipImage: [\n 'https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*yOLKRKKKccMAAAAAAAAAAABkARQnAQ',\n 'https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*yOLKRKKKccMAAAAAAAAAAABkARQnAQ',\n 'https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*hkycRbxlU4cAAAAAAAAAAABkARQnAQ',\n 'https://gw.alipayobjects.com/mdn/rms_cd276b/afts/img/A*J8EpTqbKpJgAAAAAAAAAAABkARQnAQ',\n ],\n },\n onLoad(query) {\n // 页面加载\n this.num = 0; // 步数\n my.hideFavoriteMenu();\n },\n async onReady() {\n // 页面加载完成\n this.myChart();\n\n my.getStorage({\n key: '$count',\n success: (res) => {\n if (res.data && res.data.isCount) {\n this.getCount();\n }\n },\n fail(res) {\n my.alert({ content: '系统繁忙,请稍后重试!' });\n },\n });\n },\n /** 步数图表 */\n myChart() {\n my.createSelectorQuery()\n .select('#area')\n .boundingClientRect()\n .exec((res) => {\n // 获取分辨率\n const { pixelRatio } = my.getSystemInfoSync();\n // 获取画布实际宽高\n // const canvasWidth = res[0].width; // 300\n // const canvasHeight = res[0].height; // 225\n const canvasWidth = 334;\n const canvasHeight = 250.5;\n // 高清解决方案\n this.setData({\n width: canvasWidth * pixelRatio,\n height: canvasHeight * pixelRatio,\n });\n const myCtx = my.createCanvasContext('area');\n myCtx.scale(pixelRatio, pixelRatio); // 必要!按照设置的分辨率进行放大\n const canvas = new F2.Renderer(myCtx);\n this.canvas = canvas;\n drawChart(canvas, canvasWidth, canvasHeight, this.num);\n });\n },\n onShow() {\n // 页面显示\n this.anim();\n if (this.isInit && !this.isRunAuthorize && (my.getSystemInfoSync().platform).toLowerCase() !== 'ios') {\n my.getStorage({\n key: '$count',\n success: (res) => {\n if (res.data && res.data.isCount && this.num === 0) {\n this.getCount(true);\n }\n },\n });\n }\n },\n onHide() {\n // 页面隐藏\n this.onClose();\n },\n onUnload() {\n // 页面被关闭\n this.onClose();\n },\n onTitleClick() {\n // 标题被点击\n },\n onPullDownRefresh() {\n // 页面被下拉\n },\n onReachBottom() {\n // 页面被拉到底部\n },\n onShareAppMessage() {\n // 返回自定义分享信息\n return {\n title: '低碳出行抢红包',\n desc: '走满 2500 步,即可兑换奖励红包!',\n };\n },\n /** 动画 */\n anim() {\n this.animation = my.createAnimation({\n duration: 30000,\n delay: 0,\n });\n this.animation.translate(0, 0).step();\n this.setData({ animation: this.animation.export() });\n this.timeout1 = setTimeout(() => {\n this.animation.translate('-2998rpx', 0).step({ duration: 0 });\n this.setData({ animation: this.animation.export() });\n }, 29900);\n this.setInt = setInterval(() => {\n this.animation.translate(0, 0).step();\n this.setData({ animation: this.animation.export() });\n this.timeout2 = setTimeout(() => {\n this.animation.translate('-2998rpx', 0).step({ duration: 0 });\n this.setData({ animation: this.animation.export() });\n }, 29900);\n }, 30000);\n },\n async getCount(isUse = false) {\n this.isInit = true;\n const date = new Date();\n const month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1;\n const day = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate();\n setTimeout(() => {\n if ((my.getSystemInfoSync().platform).toLowerCase() !== 'ios' && this.num === 0 && !isUse && !this.isRunAuthorize) {\n my.call('startApp', { appId: '20000869' });\n }\n }, 2000);\n // 获取步数\n await my.getRunData({\n countDate: `${date.getFullYear()}-${month}-${day}`,\n success: (res) => {\n console.log('mockdata', res);\n my.serverless.function.invoke('stepdecryption', {\n step: res.response,\n }).then((res) => {\n this.isRunAuthorize = false;\n my.setStorage({\n key: '$count',\n data: {\n isCount: true,\n },\n });\n const data = res.result;\n this.num = data.count || 0;\n if (this.num < 2500) {\n this.setData({\n info: 1,\n btmInfo: 1,\n });\n } else {\n this.setData({\n info: 2,\n btmInfo: 2,\n });\n }\n if (!chart) return;\n chart.changeData([{\n x: '1',\n y: this.num / 25 >= 100 ? 100 : this.num / 25,\n }]);\n chart.guide().clear();\n chart.guide().arc({\n start: [0, 0],\n end: [1, 99.98],\n top: false,\n style: {\n lineWidth: 10,\n stroke: '#EDEDED',\n },\n });\n chart.guide().text({\n position: ['50%', '42%'],\n content: '今日步数',\n style: {\n fill: '#999999',\n fontSize: 16,\n },\n });\n chart.guide().text({\n position: ['50%', '56%'],\n content: `${this.num}`,\n style: {\n fill: '#000000',\n fontSize: 32,\n fontWeight: 'bold',\n },\n });\n chart.render();\n }).catch(() => {\n my.showToast({\n content: '系统繁忙,请稍后重试!',\n duration: 3000,\n });\n });\n },\n fail: (res) => {\n if ((my.getSystemInfoSync().platform).toLowerCase() !== 'ios') {\n this.isRunAuthorize = true;\n }\n },\n complete: (res) => {\n },\n });\n },\n async onButton() {\n // 领取红包\n if (this.data.info === 0) {\n this.getCount();\n return true;\n }\n if (this.num < 2500) {\n // 步数小于2500\n my.showToast({\n content: '步数满 2500 步才能兑换奖励红包',\n duration: 3000,\n });\n } else {\n // 步数大于2500\n my.showToast({\n content: '感谢参与!',\n duration: 3000,\n });\n }\n },\n /** 页面关闭初始化数据 */\n onClose() {\n clearInterval(this.setInt);\n clearTimeout(this.timeout1);\n clearTimeout(this.timeout2);\n this.animation.translate('-3024rpx', 0).step({ duration: 0 });\n this.setData({ animation: this.animation.export() });\n },\n /** 单击分享 */\n onShare() {\n my.showSharePanel();\n },\n});\n","client/pages/index/index.json":"{\n \"defaultTitle\": \"低碳出行抢红包\",\n \"usingComponents\":{\n \"modal\": \"mini-antui/es/modal/index\"\n },\n \"transparentTitle\": \"always\",\n \"titleBarColor\": \"#CF3A3F\",\n \"window\": {\n \"transparentTitle\": \"none\"\n }\n}","client/pages/style/layout.acss":".flex {\n display: flex;\n}\n\n.flex-center-column {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n\n.flex-center {\n display: flex;\n justify-content: center;\n}","client/utils/common.js":"const { toString } = Object.prototype;\n\n/**\n * 简单返回类型的小写标识\n * @param {需要判断的对象} obj\n */\nexport const type = (obj) => {\n const str = toString.call(obj);\n\n return str.slice(8, -1).toLowerCase();\n};\n\nexport const isObject = obj => type(obj) === 'object';\n\nexport const isArray = obj => type(obj) === 'array';\n\nexport const isFunction = obj => type(obj) === 'function';\n\n/**\n * 简单的生成 json 列表\n * @param {要解析的json} json\n */\nexport function getJsonDom(json) {\n // li > span 多嵌入 <span /> 主要是 rich-text 感觉对结构支持不太好\n const startArrayTag = '<ul class=\"json-wrap\"><li class=\"json-item\"><span class=\"json-item-content\">[</span></li>';\n const startObjectTag = '<ul class=\"json-wrap\"><li class=\"json-item\"><span class=\"json-item-content\">{</span></li>';\n\n const endArrayTag = '<li class=\"json-item\"><span class=\"json-item-content\">]</span></li></ul>';\n const endOneObjectTag = '<li class=\"json-item\"><span class=\"json-item-content\">},</span></li></ul>';\n const endObjectTag = '<li class=\"json-item\"><span class=\"json-item-content\">}</span></li></ul>';\n\n let resultDom = '';\n function jsonParse(obj) {\n if (isArray(obj)) {\n resultDom += startArrayTag;\n obj.forEach((o) => {\n resultDom += startObjectTag;\n resultDom += getJsonDomItem(o);\n resultDom += endOneObjectTag;\n });\n\n resultDom += endArrayTag;\n } else {\n resultDom += startObjectTag;\n resultDom += getJsonDomItem(obj);\n resultDom += endObjectTag;\n }\n\n return resultDom;\n }\n\n return jsonParse(json);\n}\n\nfunction getJsonDomItem(obj, dom) {\n let tmpDom = dom !== undefined ? dom : '';\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n tmpDom += '<ul class=\"json-list\">';\n if (isObject(obj[key])) {\n tmpDom += `<li class=\"json-item\"><span class=\"json-item-content\">${key}: {</span></li>`;\n tmpDom = getJsonDomItem(obj[key], tmpDom);\n tmpDom += '<li class=\"json-item\"><span class=\"json-item-content\">}</span></li>';\n } else {\n tmpDom += `<li class=\"json-item\"><span class=\"json-item-content\">${key}: ${obj[key]}</span></li>`;\n }\n\n tmpDom += '</ul>';\n }\n }\n\n return tmpDom;\n}\n\nfunction formatNumber(n) {\n n = n.toString();\n return n[1] ? n : `0${n}`;\n}\n\nexport function formatTime(date) {\n const year = date.getFullYear();\n const month = date.getMonth() + 1;\n const day = date.getDate();\n const hour = date.getHours();\n const minute = date.getMinutes();\n const second = date.getSeconds();\n\n const ymd = [year, month, day].map(formatNumber).join('/');\n const hms = [hour, minute, second].map(formatNumber).join(':');\n\n return [ymd, hms].join(' ');\n}\n\nexport function alertMethodAnnotation(action) {\n my.alert({\n content: `请检查是否打开了 ${action} 方法的代码注释`,\n });\n}\n","client/utils/index.js":"/**\n * 导出一些常用的工具函数\n */\nexport * from './log';\nexport * from './common';\n","client/utils/log.js":"/**\n * 日志打印的功能,打印的内容会出现在调试器面板\n * [MiniDemo]: <你的打印内容>\n * 方便调试的时候按前缀更好搜索\n */\n\n/**\n * 三种等级的日志\n */\nconst method = {\n log: 'log',\n error: 'error',\n warn: 'warn',\n};\n\nconst functionApply = Function.prototype.apply;\n\nconst _log = (method, ...args) => functionApply.call(console[method], console, args);\n\nexport function logFactory(tag = 'MiniDemo') {\n const { log, error, warn } = method;\n\n return {\n info(...msg) {\n _log.apply(window, [log, `[${tag}]: `, ...msg]);\n },\n error(...msg) {\n _log.apply(window, [error, `[${tag}]: `, ...msg]);\n },\n warn(...msg) {\n _log.apply(window, [warn, `[${tag}]: `, ...msg]);\n },\n };\n}\n\n/**\n * 最终使用的对象,参数与 console.log 一样\n * log.info()\n * log.warn()\n * log.error()\n */\nexport const log = logFactory();\n","mini.project.json":"{\n \"cloud\": {\n \"type\": \"miniappServerless\"\n },\n \"miniprogramRoot\": \"client\"\n}\n","mobile.config.js":"const pkg = require('./demo/package.json');\nconst appJson = require('./demo/app.json');\n\nmodule.exports.packages = {\n portal: {\n // 平台参数, container + appid 确定 nblId. 用于通知 nebulamng 部署的关键参数;\n deploy: 'nebula',\n container: 'AP',\n appid: pkg.appid,\n // version 字段已没意义, 但是不写会报错.\n version: 'notDeployNebulamng',\n\n // 文件打包规则\n build: {\n include: [\n './api_permission',\n './*.*',\n './**/img/**',\n './**/imgs/**',\n './**/image/**',\n './**/images/**',\n ],\n ignore: [\n './**/*.md',\n './**/*.lock',\n 'mobile.config.js',\n './**/.*',\n './**/package.json',\n 'src',\n 'hpmfile.json',\n ],\n },\n\n // 以下 3 大参数, 覆盖 nebulamng 的配置;\n mwalletParams: {\n // 这里维护跟 launchParam 同级的参数;\n usePresetPopmenu: 'YES',\n // 如果需要在钱包内能被搜索, 这个改成 'true', 注意是字符串;\n canSearch: 'false',\n },\n launchParams: {\n ...appJson.window,\n // 这里维护容器启动相关的参数\n url: `/index.html#${appJson.pages[0]}`,\n page: appJson.pages[0],\n enableTabBar: appJson.tabBar ? 'YES' : 'NO',\n isInternalApp: 'YES',\n },\n support: {\n ios: {\n // sdk 一般都 0 - 100, 不需要修改\n minSDK: '0',\n maxSDK: '100',\n // iOS 最小支持客户端\n minOS: '10.1.10',\n maxOS: '100',\n },\n android: {\n // sdk 一般都 0 - 100, 不需要修改\n minSDK: '0',\n maxSDK: '100',\n // Android 最小支持客户端\n minOS: '10.1.10',\n maxOS: '100',\n },\n },\n },\n};\n","mock/jsapi/getRunData/app.js":"export default function aaa() {\n return {\n response: 100\n }\n}","mock/lib/@alicloud/mpserverless-sdk/index.js":"function successWrapper(data) {\n return {\n result: data\n }\n}\nmodule.exports = class {\n constructor() {\n Object.assign(this, {\n user: {\n async authorize() {}\n },\n function: {\n async invoke(name, option) {\n if (name === 'stepdecryption') {\n return successWrapper({\n success: true,\n count: option.step + 1033\n })\n }\n }\n }\n })\n }\n}","package.json":"{\n \"name\": \"@alipay/rundata\",\n \"version\": \"0.0.2\",\n \"description\": \"rundata 的模板描述\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"lint-staged\": \"lint-staged\",\n \"build\": \"cp README.md ./dist\",\n \"lint:fix\": \"eslint --fix ./client\",\n \"prepublish\": \"npm run build\",\n \"ci\": \"eslint --ext .ts,.jsx,.js src/\"\n },\n \"files\": [\n \"es\",\n \"README.md\"\n ],\n \"devDependencies\": {\n \"@ali/ci\": \"^4.19.0\",\n \"eslint\": \"^5.16.0\",\n \"eslint-config-ali\": \"^3.1.0\",\n \"eslint-plugin-import\": \"^2.11.0\",\n \"eslint-plugin-typescript\": \"^0.14.0\",\n \"lint-staged\": \"^8.2.0\",\n \"mini-types\": \"^0.0.1\",\n \"pre-commit\": \"^1.2.2\",\n \"stylelint\": \"^10.1.0\",\n \"stylelint-config-standard\": \"^18.2.0\",\n \"sync-files\": \"^1.0.3\",\n \"typescript\": \"^3.2.4\",\n \"typescript-eslint-parser\": \"^22.0.0\"\n },\n \"pre-commit\": [\n \"lint-staged\"\n ],\n \"lint-staged\": {\n \"*.ts\": [\n \"eslint --ext .ts\",\n \"git add\"\n ],\n \"*.js\": [\n \"eslint\",\n \"git add\"\n ],\n \"*.less\": [\n \"stylelint --syntax less\"\n ]\n },\n \"publishConfig\": {\n \"registry\": \"https://registry.npm.alibaba-inc.com\"\n },\n \"ci\": {\n \"type\": \"aci\",\n \"versions\": \"8, 10, 12\",\n \"coverage\": false\n },\n \"author\": \"mas-author\",\n \"license\": \"ISC\"\n}","README.md":"# 小程序模板脚手架\n\n1. 业务代码在src层,内层的package.json,作为小程序项目的依赖\n## 发布脚本\nherbox pub --id=mashi-rundata --serverless --mock\n## Badges\n\n[![TNPM version][tnpm-image]][tnpm-url]\n[![TNPM downloads][tnpm-downloads-image]][tnpm-url]\n[![install size][install-size-image]][install-size-url]\n\n[tnpm-image]: https://npm.alibaba-inc.com/badge/v/@alipay/rundata.svg\n[tnpm-url]: https://npm.alibaba-inc.com/package/@alipay/rundata\n[tnpm-downloads-image]: https://npm.alibaba-inc.com/badge/d/@alipay/rundata.svg\n[install-size-image]: http://npg.dockerlab.alipay.net/badge?p=@alipay/rundata\n[install-size-url]: http://npg.dockerlab.alipay.net/result?p=@alipay/rundata\n\n--------------------\n","server/functions/simple/index.js":"'use strict';\nmodule.exports = async (ctx) => {\n const step = ctx.args.step;\n return {\n success: true,\n count: step + 100\n }\n}","server/functions/stepdecryption/index.js":"'use strict';\n\nconst crypto = require('crypto');\nconst aesSecret = 'NqPBrG********';\n\nmodule.exports = async (ctx) => {\n const step = ctx.args.step;\n if (!step) {\n return {\n success: false,\n error: {\n code: 'InvalidParameter',\n message: '待解密部署不能为空'\n }\n }\n }\n try {\n ctx.logger.info('[args]', ctx.args);\n const crypted = Buffer.from(step, 'base64').toString('binary');\n const key = Buffer.from(aesSecret, 'base64');\n const iv = Buffer.alloc(16, 0);\n const decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);\n let decoded = decipher.update(crypted, 'binary', 'utf8');\n decoded += decipher.final('utf8');\n\n return {\n success: true,\n data: decoded\n }\n } catch (e) {\n ctx.logger.error(e);\n return {\n success: false,\n error: {\n code: 'DecipheStepFail',\n message: e.message\n }\n }\n }\n\n}\n\n"},"dist":[{"ETag":"3942F2D4933AF12177C2577C8B157B75","name":"0.json","size":773335,"type":"json","url":"https://gw.alipayobjects.com/os/mashi/00f0d4f3-58f7-4125-a664-7078fd3f332f/herbox/0.json"}],"name":"@alipay/rundata","description":"rundata 的模板描述","miniprogramRoot":"client","mock":true,"serverless":true,"buildVersion":"0.72.5","preCompilerVersion":"0.4.0","component2":false}