UNPKG

@aiot-toolkit/velasim

Version:

vela for sim

941 lines (909 loc) 24.2 kB
export default function(global, globalThis, window, $app_exports$){ var createPageHandler = function() { return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!./node_modules/babel-loader/lib/index.js?cwd=/home/zdying/work/aidong_watch/vela-source&cacheDirectory&plugins[]=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./src/pages/statistics/statistics.js?uxType=page": /*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!./node_modules/babel-loader/lib/index.js?cwd=/home/zdying/work/aidong_watch/vela-source&cacheDirectory&plugins[]=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./src/pages/statistics/statistics.js?uxType=page ***! \**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = function __scriptModule__ (module, exports, $app_require$){"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _system = _interopRequireDefault($app_require$("@app-module/system.file")); var _system2 = _interopRequireDefault($app_require$("@app-module/system.router")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = { protected: { index: 0, swiperList: [1, 2, 3], paginationList: ["#FFFFFF", "#595959", "#595959"], barData: [], calorieBarData: [], rateBarData: [], barOps: { xAxis: { min: 0, max: 40, display: false, axisTick: 7, color: "#FFFFFF" }, yAxis: { min: 0, max: 1000, display: false }, series: { lineStyle: { width: "10px", smooth: true } } }, calorieOps: { xAxis: { min: 0, max: 40, display: false, axisTick: 7, color: "#FFFFFF" }, yAxis: { min: 0, max: 10000, display: false }, series: { lineStyle: { width: "10px", smooth: true } } }, rateOps: { xAxis: { min: 0, max: 40, display: false, axisTick: 7, color: "#FFFFFF" }, yAxis: { min: 0, max: 200, display: false }, series: { lineStyle: { width: "10px", smooth: true } } }, totalHours: 0, totalMinutes: 0, totalCalorie: 0, averageBeats: 0, weekEN: ["S", "M", "T", "W", "T", "F", "S"], weekArr: [], hoursWidth: 30, minutesWidth: 30, calorieWidth: 30, beatsWidth: 30, isEmpty: false }, goBack(SwipeEvent) { if (SwipeEvent.direction == "right" && this.index == 0) { _system2.default.replace({ uri: "pages/home" }); } }, swiperChange(data) { const that = this; this.index = data.index; this.paginationList.splice(data.index, 1, "#FFFFFF"); this.paginationList.forEach(function (item, index) { if (index != data.index) { that.paginationList.splice(index, 1, "#595959"); } }); }, readFile(filename, successCallback, errCallback) { _system.default.readText({ uri: filename, success: function (data) { if (data.text.length != 0) { let arr = JSON.parse(data.text); successCallback(arr); } else { successCallback(data.text); } }, fail: function (data, code) { errCallback("error"); } }); }, onInit() { var that = this; var weekMotionPath = "internal://app/weekMotion.txt"; this.readFile(weekMotionPath, res => { that.isEmpty = false; var durationArr = []; var calorieArr = []; var beatsArr = []; var times = 0; var calorie = 0; var beats = 0; var i = 0; res.forEach((item, index) => { var week = new Date(item.dateTime).getDay(); that.weekArr.push(that.weekEN[week]); times += Number(item.duration); calorie += Number(item.calorie); beats += Number(item.beats); durationArr.push(Math.floor(Number(item.duration) / 60)); calorieArr.push(Number(item.calorie)); beatsArr.push(Number(item.beats)); if (Number(item.beats) == 0) { i = i + 1; } }); that.barData = [{ fillColor: "#EE5928", data: durationArr }]; that.calorieBarData = [{ fillColor: "#FFBD60", data: calorieArr }]; that.rateBarData = [{ fillColor: "#C0191F", data: beatsArr }]; var leaveMinute = times == 0 ? 0 : Math.floor(times % 3600); var NewTotalHours = times == 0 ? 0 : Math.floor(times / 3600); var NewTotalMinutes = leaveMinute == 0 ? 0 : Math.floor(leaveMinute / 60); var NewAverageBeats = beats == 0 ? 0 : Math.floor(beats / (res.length - i)); that.hoursWidth = NewTotalHours >= 0 && NewTotalHours < 10 ? 30 : NewTotalHours >= 10 && NewTotalHours < 100 ? 60 : 95; that.minutesWidth = NewTotalMinutes >= 0 && NewTotalMinutes < 10 ? 30 : NewTotalMinutes >= 10 && NewTotalMinutes < 100 ? 60 : 95; that.beatsWidth = NewAverageBeats >= 0 && NewAverageBeats < 10 ? 30 : NewAverageBeats >= 10 && NewAverageBeats < 100 ? 60 : 95; that.calorieWidth = calorie >= 0 && calorie < 10 ? 30 : calorie >= 10 && calorie < 100 ? 60 : calorie >= 100 && calorie < 1000 ? 95 : calorie >= 1000 && calorie < 10000 ? 130 : calorie >= 10000 && calorie < 100000 ? 162 : 200; that.totalHours = NewTotalHours; that.totalMinutes = NewTotalMinutes; that.totalCalorie = calorie; that.averageBeats = NewAverageBeats; }, error => { that.isEmpty = true; }); } }; exports.default = _default; const moduleOwn = exports.default || module.exports; const accessors = ['public', 'protected', 'private']; if (moduleOwn.data && accessors.some(function (acc) { return moduleOwn[acc]; })) { throw new Error('页面VM对象中的属性data不可与"' + accessors.join(',') + '"同时存在,请使用private替换data名称'); } else if (!moduleOwn.data) { moduleOwn.data = {}; moduleOwn._descriptor = {}; accessors.forEach(function (acc) { const accType = typeof moduleOwn[acc]; if (accType === 'object') { moduleOwn.data = Object.assign(moduleOwn.data, moduleOwn[acc]); for (const name in moduleOwn[acc]) { moduleOwn._descriptor[name] = { access: acc }; } } else if (accType === 'function') { console.warn('页面VM对象中的属性' + acc + '的值不能是函数,请使用对象'); } }); }} /***/ }), /***/ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./node_modules/sass-loader/dist/cjs.js!./src/pages/statistics/statistics.scss?uxType=page": /*!*************************************************************************************************************************************************************************************!*\ !*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./node_modules/sass-loader/dist/cjs.js!./src/pages/statistics/statistics.scss?uxType=page ***! \*************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = [ [ [ [ 0, "publicContainer" ] ], { "width": "464px", "height": "464px", "flexDirection": "column", "alignItems": "center", "backgroundColor": "#000000" } ], [ [ [ 0, "container" ] ], { "width": "464px", "height": "464px", "flexDirection": "column", "alignItems": "center", "backgroundColor": "#000000", "justifyContent": "center" } ], [ [ [ 2, "text" ] ], { "fontSize": "34px", "color": "#FFFFFF" } ], [ [ [ 0, "swiper" ] ], { "width": "464px", "height": "412px" } ], [ [ [ 0, "swiper-item" ] ], { "width": "464px", "height": "412px", "flexDirection": "column", "alignItems": "center", "justifyContent": "center" } ], [ [ [ 0, "topContent" ] ], { "width": "300px", "height": "42px", "flexDirection": "row", "alignItems": "center", "justifyContent": "center", "marginTop": "30px" } ], [ [ [ 0, "topContentIcon" ] ], { "width": "32px", "height": "32px", "marginRight": "10px" } ], [ [ [ 0, "timeContent" ] ], { "width": "300px", "height": "70px", "marginLeft": "40px", "flexDirection": "row", "alignItems": "flex-end" } ], [ [ [ 0, "timeContentNum" ] ], { "color": "#EE5928", "fontSize": "50px" } ], [ [ [ 0, "timeContentSign" ] ], { "color": "#EE5928", "fontSize": "34px", "marginLeft": "8px", "marginRight": "15px", "height": "36px", "marginBottom": "6px" } ], [ [ [ 0, "paginationBox" ] ], { "width": "70px", "height": "52px", "flexDirection": "row", "justifyContent": "space-between", "alignItems": "center" } ], [ [ [ 0, "pagination" ] ], { "width": "12px", "height": "12px", "borderRadius": "6px", "backgroundColor": "#595959" } ], [ [ [ 0, "chart" ] ], { "width": "278px", "height": "220px" } ], [ [ [ 0, "employContent" ] ], { "width": "278px", "height": "220px", "justifyContent": "center", "alignItems": "center" } ], [ [ [ 0, "employContentTxt" ] ], { "fontSize": "34px", "color": "#FFFFFF", "height": "44px" } ], [ [ [ 0, "xAxisContent" ] ], { "width": "278px", "height": "26px", "marginLeft": "4px" } ], [ [ [ 0, "xAxisTxt" ] ], { "width": "35px", "fontSize": "18px", "color": "#AAAAAA", "marginRight": "5px", "textAlign": "center" } ], [ [ [ 0, "calorieNum" ] ], { "color": "#FFBD60" } ], [ [ [ 0, "calorieSign" ] ], { "color": "#FFBD60" } ], [ [ [ 0, "rateNum" ] ], { "color": "#C0191F" } ], [ [ [ 0, "rateSign" ] ], { "color": "#C0191F", "height": "36px" } ], [ [ [ 0, "topContentTxt" ] ], { "fontSize": "34px", "height": "44px" } ] ] /***/ }), /***/ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/pages/statistics/statistics.hml?uxType=page&": /*!************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/pages/statistics/statistics.hml?uxType=page& ***! \************************************************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = function (vm) { const _vm_ = vm || this return aiot.__ce__("div", { "classList": [ "container" ] }, [ aiot.__ce__("swiper", { "loop": "false", "index": function () {return _vm_.index}, "indicator": "false", "classList": [ "swiper" ], "events": { "change": function (evt) {_vm_.swiperChange(evt)}, "swipe": function (evt) {_vm_.goBack(evt)} } }, [ aiot.__ce__("div", { "classList": [ "swiper-item" ] }, [ aiot.__ce__("div", { "classList": [ "topContent" ] }, [ aiot.__ce__("image", { "src": "/common/images/orangeTime.png", "classList": [ "topContentIcon" ] }), aiot.__ce__("text", { "classList": [ "topContentTxt" ], "value": "本周运动时长" }) ]), aiot.__ce__("div", { "classList": [ "timeContent" ] }, [ aiot.__ce__("text", { "classList": [ "timeContentNum" ], "style": { "width": function () {return _vm_.hoursWidth} }, "value": function () {return _vm_.totalHours} }), aiot.__ce__("text", { "classList": [ "timeContentSign" ], "value": "H" }), aiot.__ce__("text", { "classList": [ "timeContentNum" ], "style": { "width": function () {return _vm_.minutesWidth} }, "value": function () {return _vm_.totalMinutes} }), aiot.__ce__("text", { "classList": [ "timeContentSign" ], "value": "M" }) ]), aiot.__ci__({ shown: function () {return _vm_.isEmpty==true} }, function () { return aiot.__ce__("div", { "classList": [ "employContent" ] }, [ aiot.__ce__("text", { "classList": [ "employContentTxt" ], "value": "暂无运动记录" }) ])}), aiot.__ci__({ shown: function () {return _vm_.isEmpty==false} }, function () { return aiot.__ce__("chart", { "type": "bar", "id": "bar-chart", "options": function () {return _vm_.barOps}, "datasets": function () {return _vm_.barData}, "classList": [ "chart" ] })}), aiot.__ci__({ shown: function () {return _vm_.isEmpty==false} }, function () { return aiot.__ce__("div", { "classList": [ "xAxisContent" ] }, [ aiot.__cf__({ exp: function () {return _vm_.weekArr} }, function ($idx, $item) { return aiot.__ce__("text", { "classList": [ "xAxisTxt" ], "value": function () {return $item} })}) ])}) ]), aiot.__ce__("div", { "classList": [ "swiper-item" ] }, [ aiot.__ce__("div", { "classList": [ "topContent" ] }, [ aiot.__ce__("image", { "src": "/common/images/yellowFire.png", "classList": [ "topContentIcon" ] }), aiot.__ce__("text", { "classList": [ "topContentTxt" ], "value": "本周消耗卡路里" }) ]), aiot.__ce__("div", { "classList": [ "timeContent" ] }, [ aiot.__ce__("text", { "classList": [ "timeContentNum", "calorieNum" ], "style": { "width": function () {return _vm_.calorieWidth} }, "value": function () {return _vm_.totalCalorie} }), aiot.__ce__("text", { "classList": [ "timeContentSign", "calorieSign" ], "value": "Kcal" }) ]), aiot.__ci__({ shown: function () {return _vm_.isEmpty==true} }, function () { return aiot.__ce__("div", { "classList": [ "employContent" ] }, [ aiot.__ce__("text", { "classList": [ "employContentTxt" ], "value": "暂无运动记录" }) ])}), aiot.__ci__({ shown: function () {return _vm_.isEmpty==false} }, function () { return aiot.__ce__("chart", { "type": "bar", "id": "bar-chart", "options": function () {return _vm_.calorieOps}, "datasets": function () {return _vm_.calorieBarData}, "classList": [ "chart" ] })}), aiot.__ci__({ shown: function () {return _vm_.isEmpty==false} }, function () { return aiot.__ce__("div", { "classList": [ "xAxisContent" ] }, [ aiot.__cf__({ exp: function () {return _vm_.weekArr} }, function ($idx, $item) { return aiot.__ce__("text", { "classList": [ "xAxisTxt" ], "value": function () {return $item} })}) ])}) ]), aiot.__ce__("div", { "classList": [ "swiper-item" ] }, [ aiot.__ce__("div", { "classList": [ "topContent" ] }, [ aiot.__ce__("image", { "src": "/common/images/redHeart.png", "classList": [ "topContentIcon" ] }), aiot.__ce__("text", { "classList": [ "topContentTxt" ], "value": "本周平均心率" }) ]), aiot.__ce__("div", { "classList": [ "timeContent" ] }, [ aiot.__ce__("text", { "classList": [ "timeContentNum", "rateNum" ], "style": { "width": function () {return _vm_.beatsWidth} }, "value": function () {return _vm_.averageBeats} }), aiot.__ce__("text", { "classList": [ "timeContentSign", "rateSign" ], "value": "次/分" }) ]), aiot.__ci__({ shown: function () {return _vm_.isEmpty==true} }, function () { return aiot.__ce__("div", { "classList": [ "employContent" ] }, [ aiot.__ce__("text", { "classList": [ "employContentTxt" ], "value": "暂无运动记录" }) ])}), aiot.__ci__({ shown: function () {return _vm_.isEmpty==false} }, function () { return aiot.__ce__("chart", { "type": "bar", "id": "bar-chart", "options": function () {return _vm_.rateOps}, "datasets": function () {return _vm_.rateBarData}, "classList": [ "chart" ] })}), aiot.__ci__({ shown: function () {return _vm_.isEmpty==false} }, function () { return aiot.__ce__("div", { "classList": [ "xAxisContent" ] }, [ aiot.__cf__({ exp: function () {return _vm_.weekArr} }, function ($idx, $item) { return aiot.__ce__("text", { "classList": [ "xAxisTxt" ], "value": function () {return $item} })}) ])}) ]) ]), aiot.__ce__("div", { "classList": [ "paginationBox" ] }, [ aiot.__cf__({ exp: function () {return _vm_.paginationList} }, function ($idx, $item) { return aiot.__ce__("div", { "classList": [ "pagination" ], "style": { "backgroundColor": function () {return $item} } })}) ]) ]) } /***/ }), /***/ "./src/pages/statistics/statistics.hml?uxType=page": /*!*********************************************************!*\ !*** ./src/pages/statistics/statistics.hml?uxType=page ***! \*********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var $app_style$ = __webpack_require__(/*! !../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!sass-loader!./statistics.scss?uxType=page */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./node_modules/sass-loader/dist/cjs.js!./src/pages/statistics/statistics.scss?uxType=page") var $app_script$ = __webpack_require__(/*! !../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!../../../node_modules/babel-loader/lib/index.js?cwd=/home/zdying/work/aidong_watch/vela-source&cacheDirectory&plugins[]=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/packager/babel.config.js!../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./statistics.js?uxType=page */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/script-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/module-loader.js!./node_modules/babel-loader/lib/index.js?cwd=/home/zdying/work/aidong_watch/vela-source&cacheDirectory&plugins[]=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/zdying/work/aidong_watch/vela-source/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./src/pages/statistics/statistics.js?uxType=page") var $app_template$ = __webpack_require__(/*! !../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./statistics.hml?uxType=page& */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/template-loader.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/pages/statistics/statistics.hml?uxType=page&") $app_script$({}, $app_exports$, $app_require$); $app_exports$.default.template = $app_template$; $app_exports$.default.style = $app_style$; module.exports = $app_exports$.default; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(__webpack_module_cache__[moduleId]) { /******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __webpack_require__("./src/pages/statistics/statistics.hml?uxType=page"); /******/ /******/ })() ; }; return createPageHandler(); };