UNPKG

@aiot-toolkit/velasim

Version:

vela for sim

519 lines (480 loc) 21 kB
export default function(global, globalThis, window, $app_exports$){ var createPageHandler = function() { return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/script-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/module-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/rtos/watch-alarm&cacheDirectory&plugins[]=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-packager/babel.config.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/access-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./src/SetDays/index.ux?uxType=page": /*!**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/script-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/module-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/rtos/watch-alarm&cacheDirectory&plugins[]=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-packager/babel.config.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/access-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./src/SetDays/index.ux?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.router")); var _system2 = _interopRequireDefault($app_require$("@app-module/system.storage")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = { protected: { addingEventHour: null, addingEventMinute: null, editingIdx: null }, private: { addingEventTime: null, dayList: [{ text: '星期一', checked: false, value: '一' }, { text: '星期二', checked: false, value: '二' }, { text: '星期三', checked: false, value: '三' }, { text: '星期四', checked: false, value: '四' }, { text: '星期五', checked: false, value: '五' }, { text: '星期六', checked: false, value: '六' }, { text: '星期日', checked: false, value: '日' }] }, onInit() { if (this.addingEventHour && this.addingEventMinute) this.addingEventTime = `${this.addingEventHour}:${this.addingEventMinute}`; if (this.editingIdx !== null) { const self = this; this.getEventList().then(eventList => { const event = eventList[self.editingIdx]; const { days, time } = event; if (!self.addingEventHour) { self.addingEventTime = time; } self.dayList.forEach(element => { if (days.includes(element.value)) { console.log(element.value); element.checked = true; } }); }); } }, onBtnCancelClick() { _system.default.back({ uri: '/Home' }); }, onBtnConfirmClick() { const self = this; const checkedDayList = self.dayList.filter(day => day.checked === true); if (!checkedDayList.length) { return; } else { if (!self.addingEventTime) { console.log('no event time!'); _system.default.push({ uri: '/Home' }); } else { const days = checkedDayList.map(day => day.value).join(''); if (this.editingIdx !== null) { this.getEventList().then(eventList => { eventList[self.editingIdx].time = self.addingEventTime; eventList[self.editingIdx].days = days; return self.saveEventList(eventList); }).then(() => { _system.default.push({ uri: '/Home' }); }); } else { this.getEventList().then(eventList => { eventList.push({ time: self.addingEventTime, days, checked: true }); return self.saveEventList(eventList); }).then(() => { _system.default.push({ uri: '/Home' }); }); } } } }, getEventList() { return new Promise((resolve, reject) => { _system2.default.get({ key: 'eventList', success: function (data) { resolve(data ? JSON.parse(data) : []); }, fail: function (data, code) { resolve([]); }, complete: function (a, b) {} }); }); }, saveEventList(eventList) { return new Promise((resolve, reject) => { _system2.default.set({ key: 'eventList', value: JSON.stringify(eventList), success: function (data) { resolve(); }, fail: function (data, code) { console.log(`handling fail, code = ${code}`); }, complete: function (a, b) {} }); }); }, onDayItemCheckChange(idx, e) { console.log(e.name); console.log(e.value); console.log(e.checked); this.dayList[idx].checked = e.checked; } }; 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 + '的值不能是函数,请使用对象'); } }); }} /***/ }), /***/ "../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./src/SetDays/index.ux?uxType=page": /*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./src/SetDays/index.ux?uxType=page ***! \*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = [ [ [ [ 0, "page" ] ], { "flexDirection": "column", "alignItems": "center", "backgroundColor": "#000000" } ], [ [ [ 0, "page-title" ] ], { "fontSize": "20px", "color": "#ffffff", "height": "80px" } ], [ [ [ 0, "page-content" ] ], { "flex": 1, "width": "100%" } ], [ [ [ 0, "page-opr" ] ], { "height": "100px", "justifyContent": "center", "alignItems": "flex-start", "marginTop": "10px" } ], [ [ [ 0, "page-opr-button-default" ] ], { "height": "50px", "lineHeight": "100%", "backgroundColor": "#00b7ff", "width": "50px", "color": "#ffffff", "borderRadius": "25px", "marginTop": "0px", "marginRight": "5px", "marginBottom": "0px", "marginLeft": "5px" } ], [ [ [ 0, "page-opr-button-secondary" ] ], { "height": "50px", "lineHeight": "100%", "backgroundColor": "#444444", "width": "50px", "color": "#ffffff", "borderRadius": "25px", "marginTop": "0px", "marginRight": "5px", "marginBottom": "0px", "marginLeft": "5px" } ], [ [ [ 0, "page-content-edit-days" ] ], { "justifyContent": "center" } ], [ [ [ 0, "day-list" ] ], { "height": "100%", "flexDirection": "column", "width": "260px" } ], [ [ [ 0, "day-item" ] ], { "height": "40px" } ], [ [ [ 0, "day-text" ] ], { "fontSize": "15px", "color": "#ffffff", "flex": 1 } ], [ [ [ 0, "day-checkbox" ] ], { "width": "20px" } ] ] /***/ }), /***/ "../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/template-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/SetDays/index.ux?uxType=page&": /*!*************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/template-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/SetDays/index.ux?uxType=page& ***! \*************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = function (vm) { const _vm_ = vm || this return aiot.__ce__("div", { "classList": [ "page" ] }, [ aiot.__ce__("text", { "classList": [ "page-title" ], "value": "重复" }), aiot.__ce__("div", { "classList": [ "page-content", "page-content-edit-days" ] }, [ aiot.__ce__("div", { "classList": [ "day-list" ] }, [ aiot.__cf__({ exp: function () {return _vm_.dayList} }, function ($idx, $item) { return aiot.__ce__("div", { "classList": [ "day-item" ] }, [ aiot.__ce__("text", { "classList": [ "day-text" ], "value": function () {return $item.text} }), aiot.__ce__("input", { "value": function () {return $item.value}, "type": "checkbox", "checked": function () {return $item.checked}, "classList": [ "day-checkbox" ], "events": { "change": function (evt) {_vm_.onDayItemCheckChange($idx,evt)} } }) ])}) ]) ]), aiot.__ce__("div", { "classList": [ "page-opr" ] }, [ aiot.__ce__("input", { "type": "button", "value": "×", "classList": [ "page-opr-button-secondary" ], "events": { "click": function (evt) {_vm_.onBtnCancelClick(evt)} } }), aiot.__ce__("input", { "type": "button", "value": "√", "classList": [ "page-opr-button-default" ], "events": { "click": function (evt) {_vm_.onBtnConfirmClick(evt)} } }) ]) ]) } /***/ }), /***/ "./src/SetDays/index.ux?uxType=page": /*!******************************************!*\ !*** ./src/SetDays/index.ux?uxType=page ***! \******************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var $app_style$ = __webpack_require__(/*! !../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./index.ux?uxType=page */ "../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/style-loader.js?index=0&type=style!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=style!./src/SetDays/index.ux?uxType=page") var $app_script$ = __webpack_require__(/*! !../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/script-loader.js!../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/module-loader.js!../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/rtos/watch-alarm&cacheDirectory&plugins[]=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-packager/babel.config.js!../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/access-loader.js!../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./index.ux?uxType=page */ "../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/script-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/module-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/babel-loader/lib/index.js?cwd=/home/zhoubingqing/workspace/rtos/watch-alarm&cacheDirectory&plugins[]=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/babel-plugin-jsx.js&comments=false&configFile=/usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-packager/babel.config.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/access-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=script!./src/SetDays/index.ux?uxType=page") var $app_template$ = __webpack_require__(/*! !../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/template-loader.js!../../../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./index.ux?uxType=page& */ "../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/template-loader.js!../../../../../usr/local/lib/node_modules/@mi/vela-hap-toolkit/node_modules/@mi/vela-hap-toolkit-dsl-xvm/lib/loaders/fragment-loader.js?index=0&type=template!./src/SetDays/index.ux?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 /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.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/SetDays/index.ux?uxType=page"); /******/ /******/ })() ; }; return createPageHandler(); };