UNPKG

@aiot-toolkit/velasim

Version:

vela for sim

436 lines (390 loc) 15.7 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/hx/work/project/third-app/vela-drinkwater&cacheDirectory&plugins[]=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./src/pages/alarm/alarm.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/hx/work/project/third-app/vela-drinkwater&cacheDirectory&plugins[]=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./src/pages/alarm/alarm.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")); var _system3 = _interopRequireDefault($app_require$("@app-module/system.vibrator")); var _system4 = _interopRequireDefault($app_require$("@app-module/system.brightness")); var _system5 = _interopRequireDefault($app_require$("@app-module/system.interconnect")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = { protected: { receive_data: '', water_progress: 0, page3_title: '', waterarray: [{ time: '' }] }, backToMain() { _system2.default.replace({ uri: "pages/main", params: {} }); }, onReady() { var that = this; this.page3_title = this.$t('strings.hint_time_list'); _system.default.readText({ uri: 'internal://cache/water.txt', encoding: 'UTF-8', success: function (data) { that.receive_data = data.text; that.parseAlarmData(); }, fail: function (data, code) { that.page3_title = that.$t('strings.error_code') + code; } }); let conn = _system5.default.instance(); conn.onmessage = appData => { var recData = appData.data; if (recData != undefined && recData != 'undefined' && recData != null && recData != '') { if (recData == '&EOF&Alarm&EOF&') { _system3.default.vibrate({ mode: 'short' }); _system4.default.setKeepScreenOn({ keepScreenOn: true, success: function () { console.log("handling set keep screen on success."); }, fail: function (data, code) { console.log("handling set keep screen on fail, code:" + code + ", data: " + data); } }); } else if (recData.substr(0, 5) == '&EOF&' && recData.substring(recData.length - 5) == '&EOF&') { that.receive_data = recData.substring(0, recData.length - 5).slice(5); that.parseAlarmData(); that.cacheData(); } else if (recData.substr(0, 5) == '&EOF&') { that.receive_data = recData.slice(5); } else if (recData.substring(recData.length - 5) == '&EOF&') { that.receive_data = that.receive_data + recData.substring(0, recData.length - 5); _system3.default.vibrate({ mode: 'short' }); that.parseAlarmData(); that.cacheData(); } else { that.receive_data = that.receive_data + recData; } } }; }, parseAlarmData() { var jsonObj = JSON.parse(this.receive_data); if (jsonObj.dayList.length > 0) { var today_water_data = jsonObj.dayList[0]; this.water_progress = today_water_data.totalVolume * 100 / jsonObj.target; } if (jsonObj.clockList.length > 0) { var alarmItems = [jsonObj.clockList.length]; for (var i = 0; i < jsonObj.clockList.length; i++) { var alarmItem = { time: jsonObj.clockList[i].time }; alarmItems[i] = alarmItem; } this.waterarray = alarmItems; this.page3_title = this.$t('strings.hint_time_list'); } else { this.page3_title = this.$t('strings.no_hint_time_list'); this.waterarray = [{ time: '' }]; } }, cacheData() { var that = this; _system.default.writeText({ uri: 'internal://cache/water.txt', text: that.receive_data, append: false, encoding: 'UTF-8', success: function () {}, fail: function (data, code) { console.log('alarm fail, message: ' + data + ', code: ' + code); } }); } }; 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!./src/pages/alarm/alarm.css?uxType=page": /*!***********************************************************************************************************************************!*\ !*** ./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./src/pages/alarm/alarm.css?uxType=page ***! \***********************************************************************************************************************************/ /***/ ((module) => { module.exports = [ [ [ [ 0, "container" ] ], { "display": "flex", "justifyContent": "center", "alignItems": "center", "left": "0px", "top": "0px", "width": "454px", "height": "454px" } ], [ [ [ 0, "radiuscontainer" ] ], { "display": "flex", "justifyContent": "center", "alignItems": "center", "width": "454px", "height": "380px" } ], [ [ [ 0, "page3title" ] ], { "marginTop": "35px", "fontSize": "30px", "textAlign": "center", "width": "190px", "height": "80px" } ], [ [ [ 0, "progress" ] ], { "strokeWidth": "20px", "backgroundColor": "#262626", "color": "#007Dff", "radius": "227px", "startAngle": "240deg", "totalAngle": "240deg", "centerX": "227px", "centerY": "227px", "width": "454px", "height": "454px", "borderRadius": "10px" } ], [ [ [ 0, "list" ] ], { "marginTop": "30px", "display": "flex", "flexDirection": "column", "width": "140px", "height": "250px" } ], [ [ [ 0, "listitem" ] ], { "fontSize": "30px", "textAlign": "center", "width": "140px", "height": "50px" } ] ] /***/ }), /***/ "./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/alarm/alarm.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/alarm/alarm.hml?uxType=page& ***! \**************************************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = function (vm) { const _vm_ = vm || this return aiot.__ce__("stack", { "classList": [ "container" ] }, [ aiot.__ce__("progress", { "type": "arc", "percent": function () {return _vm_.water_progress}, "classList": [ "progress" ], "style": { "position": "absolute" } }), aiot.__ce__("div", { "style": { "width": "454px", "height": "454px", "flexDirection": "column", "position": "absolute" } }, [ aiot.__ce__("div", { "classList": [ "radiuscontainer" ] }, [ aiot.__ce__("text", { "classList": [ "page3title" ], "value": function () {return _vm_.page3_title} }), aiot.__ce__("list", { "classList": [ "list" ] }, [ aiot.__cf__({ exp: function () {return _vm_.waterarray} }, function ($idx, $item) { return aiot.__ce__("list-item", { "classList": [ "listitem" ] }, [ aiot.__ce__("text", { "classList": [ "listitem" ], "value": function () {return $item.time} }) ])}) ]) ]), aiot.__ce__("div", { "style": { "width": "454px", "height": "62px", "flexDirection": "column", "justifyContent": "center", "alignItems": "center" } }, [ aiot.__ce__("image", { "src": function () {return _vm_.$t('files.goback_to_main2')}, "style": { "width": "182px", "height": "62px" }, "events": { "click": function (evt) {_vm_.backToMain(evt)} } }) ]) ]) ]) } /***/ }), /***/ "./src/pages/alarm/alarm.hml?uxType=page": /*!***********************************************!*\ !*** ./src/pages/alarm/alarm.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!./alarm.css?uxType=page */ "./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!./src/pages/alarm/alarm.css?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/hx/work/project/third-app/vela-drinkwater&cacheDirectory&plugins[]=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/packager/babel.config.js!../../../node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./alarm.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/hx/work/project/third-app/vela-drinkwater&cacheDirectory&plugins[]=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/home/hx/work/project/third-app/vela-drinkwater/node_modules/@aiot-toolkit/packager/babel.config.js!./node_modules/@aiot-toolkit/dsl-xvm/lib/loaders/access-loader.js!./src/pages/alarm/alarm.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!./alarm.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/alarm/alarm.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/alarm/alarm.hml?uxType=page"); /******/ /******/ })() ; }; return createPageHandler(); };