@aiot-toolkit/velasim
Version:
vela for sim
586 lines (551 loc) • 19.5 kB
JavaScript
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/Home/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/Home/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 = {
private: {
test: null,
a: 1,
eventList: []
},
onInit() {
this.test = this.$app.$def.appTest;
const self = this;
this.getEventList().then(eventList => {
self.eventList = eventList;
});
},
onReady() {
setTimeout(() => {
console.log(`getBoundingClientRect结果${this.$element('item0')}`);
this.$element('item0').getBoundingClientRect({
success: function (data) {
const {
top,
bottom,
left,
right,
width,
height
} = data;
console.log(`getBoundingClientRect结果: width:${width}, height:${height}, top:${top}, bottom:${bottom}, left:${left}, right:${right}`);
},
fail: (errorData, errorCode) => {
console.log(`错误原因:${JSON.stringify(errorData)}, 错误代码:${errorCode}`);
},
complete: function () {
console.info('complete');
}
});
}, 5000);
},
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() {
const self = this;
return new Promise((resolve, reject) => {
_system2.default.set({
key: 'eventList',
value: JSON.stringify(self.eventList),
success: function (data) {
resolve();
},
fail: function (data, code) {
console.log(`handling fail, code = ${code}`);
},
complete: function (a, b) {}
});
});
},
saveEditingEvent(idx) {
return new Promise((resolve, reject) => {
_system2.default.set({
key: 'editingEventIdx',
value: JSON.stringify(idx),
success: function (data) {
resolve();
},
fail: function (data, code) {
console.log(`handling fail, code = ${code}`);
}
});
});
},
onBtnAddClick(evt) {
_system.default.push({
uri: '/SetTime'
});
},
onEventItemClick(idx) {
_system.default.push({
uri: `/EditEvent?editingIdx=${idx}`
});
},
onEventSwitcherChange(idx, e) {
this.eventList[idx].checked = e.checked;
this.saveEventList();
}
};
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/Home/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/Home/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-home"
]
],
{
"justifyContent": "center"
}
],
[
[
[
0,
"no-event-wrap"
]
],
{
"height": "100%",
"flexDirection": "column",
"justifyContent": "center",
"alignItems": "center"
}
],
[
[
[
0,
"no-event-img"
]
],
{
"width": "100px",
"height": "100px"
}
],
[
[
[
0,
"no-event-tip"
]
],
{
"color": "#666666",
"fontSize": "15px",
"marginTop": "10px"
}
],
[
[
[
0,
"event-list"
]
],
{
"height": "100%",
"flexDirection": "column",
"width": "260px"
}
],
[
[
[
0,
"event-item"
]
],
{
"alignItems": "center",
"height": "60px"
}
],
[
[
[
0,
"event-desc"
]
],
{
"flexDirection": "column",
"flex": 1
}
],
[
[
[
0,
"event-switcher"
]
],
{
"width": "60px"
}
],
[
[
[
0,
"event-desc-time"
]
],
{
"fontSize": "15px",
"color": "#ffffff"
}
],
[
[
[
0,
"event-desc-days"
]
],
{
"fontSize": "15px",
"color": "#666666"
}
],
[
[
[
0,
"switch-set-color"
]
],
{
"thumbColor": "#999999",
"trackColor": "#666666",
"thumbColor:checked": "#00b7ff",
"trackColor:checked": "#00b7ff"
}
]
]
/***/ }),
/***/ "../../../../../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/Home/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/Home/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-home"
]
}, [
aiot.__ci__({
shown: function () {return _vm_.eventList.length===0}
},
function () {
return aiot.__ce__("div", {
"classList": [
"no-event-wrap"
]
}, [
aiot.__ce__("image", {
"src": "/Common/alarm.png",
"classList": [
"no-event-img"
]
}),
aiot.__ce__("text", {
"classList": [
"no-event-tip"
],
"value": "暂未设置任何闹钟"
})
])}),
aiot.__ci__({
shown: function () {return !(_vm_.eventList.length===0)}
},
function () {
return aiot.__ce__("list", {
"classList": [
"event-list"
]
}, [
aiot.__cf__({
exp: function () {return _vm_.eventList}
},
function ($idx, $item) {
return [
aiot.__ce__("list-item", {
"type": "eventItem",
"id": function () {return 'item'+$idx},
"classList": [
"event-item"
],
"events": {
"click": function (evt) {_vm_.onEventItemClick($idx,evt)}
}
}, [
aiot.__ce__("div", {
"classList": [
"event-desc"
]
}, [
aiot.__ce__("text", {
"classList": [
"event-desc-time"
],
"value": function () {return $item.time}
}),
aiot.__ce__("text", {
"classList": [
"event-desc-days"
],
"value": function () {return $item.days}
})
]),
aiot.__ce__("div", {
"classList": [
"event-switcher"
]
}, [
aiot.__ce__("switch", {
"checked": function () {return $item.checked==null?true:$item.checked},
"classList": [
"switch-set-color"
],
"events": {
"change": function (evt) {_vm_.onEventSwitcherChange($idx,evt)}
}
})
])
])
]})
])})
]),
aiot.__ce__("div", {
"classList": [
"page-opr"
]
}, [
aiot.__ce__("input", {
"type": "button",
"value": "+",
"classList": [
"page-opr-button-default"
],
"events": {
"click": function (evt) {_vm_.onBtnAddClick(evt)}
}
})
])
])
}
/***/ }),
/***/ "./src/Home/index.ux?uxType=page":
/*!***************************************!*\
!*** ./src/Home/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/Home/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/Home/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/Home/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/Home/index.ux?uxType=page");
/******/
/******/ })()
;
};
return createPageHandler();
};