UNPKG

@aiot-toolkit/velasim

Version:

vela for sim

434 lines (392 loc) 15.3 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/course_box/course_start/course_start.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/course_box/course_start/course_start.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.router")); var _system2 = _interopRequireDefault($app_require$("@app-module/system.interconnect")); var _system3 = _interopRequireDefault($app_require$("@app-module/system.file")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = { protected: { introduceFilePath: "internal://app/courseIntroduce.txt", libraryMotionFilePath: "internal://app/libraryMotion.txt", instance: {}, introduceName: " ", strArr: [] }, goBack(SwipeEvent) { if (SwipeEvent.direction == "right") { if (this.routerName == "courseLibrary") { _system.default.replace({ uri: "pages/course_box/course_library" }); } else { _system.default.replace({ uri: "pages/course_box/course_list", params: { userId: "-2" } }); } } }, clickTranBtn() { let params = { courseName: this.introduceName, userId: this.userId, courseId: this.courseId, burying: this.burying, classTime: "", startDate: "2021-07-19 00:00:00", actionLength: "0", courseType: "library" }; _system.default.push({ uri: "pages/scheduled_box/course_countdown", params: params }); }, sendMessageToApp(motionData) { let that = this; let newData = { type: 3, data: motionData }; that.instance.send({ data: { data: JSON.stringify(newData) }, success: () => { _system3.default.delete({ uri: that.libraryMotionFilePath }); }, fail: data => { console.log(`handling fail, errMsg = ${data.data}, errCode = ${data.code}`); } }); }, readFile(uri, flag) { let that = this; _system3.default.readText({ uri: uri, success: data => { let arr = JSON.parse(data.text); if (flag) { that.introduceName = arr.name; that.getIntroduceArr(arr); } else { that.sendMessageToApp(arr); } }, fail: (data, code) => {} }); }, getIntroduceArr(arr) { let that = this; var surplus = arr.introduce.length % 9; for (var i = 0; i < arr.introduce.length; i++) { var num = i + 1; if (num / 9 >= 1 && num % 9 == 0) { that.strArr.push(arr.introduce.substring(i - 8, num)); } } ; that.strArr.push(arr.introduce.substring(arr.introduce.length - surplus, arr.introduce.length)); }, onInit() { this.instance = _system2.default.instance(); this.readFile(this.introduceFilePath, true); }, onShown() { this.readFile(this.libraryMotionFilePath, false); }, onDestroy() { this.instance = null; } }; 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/course_box/course_start/course_start.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/course_box/course_start/course_start.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": "space-between" } ], [ [ [ 2, "text" ] ], { "fontSize": "34px", "color": "#FFFFFF" } ], [ [ [ 0, "courseTxtBox" ] ], { "marginTop": "84px", "width": "328px", "height": "44px" } ], [ [ [ 0, "courseTxt" ] ], { "width": "328px", "height": "44px", "fontSize": "34px", "color": "#C0191F", "textOverflow": "ellipsis" } ], [ [ [ 0, "introduceBox" ] ], { "width": "328px", "height": "148px", "marginBottom": "20px", "marginTop": "15px" } ], [ [ [ 0, "introduceItem" ] ], { "width": "328px", "height": "44px", "alignItems": "center", "justifyContent": "center" } ], [ [ [ 0, "introduced" ] ], { "width": "328px", "height": "40px", "fontSize": "34px" } ], [ [ [ 0, "trainBtn" ] ], { "width": "260px", "height": "86px", "backgroundColor": "#C0191F", "marginBottom": "37px", "fontSize": "34px" } ] ] /***/ }), /***/ "./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/course_box/course_start/course_start.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/course_box/course_start/course_start.hml?uxType=page& ***! \***************************************************************************************************************************************************************************************************************************************/ /***/ ((module) => { module.exports = function (vm) { const _vm_ = vm || this return aiot.__ce__("div", { "classList": [ "container" ] }, [ aiot.__ce__("div", { "classList": [ "courseTxtBox" ], "events": { "swipe": function (evt) {_vm_.goBack(evt)} } }, [ aiot.__ce__("text", { "classList": [ "courseTxt" ], "value": function () {return _vm_.introduceName} }) ]), aiot.__ce__("list", { "classList": [ "introduceBox" ], "events": { "swipe": function (evt) {_vm_.goBack(evt)} } }, [ aiot.__cf__({ exp: function () {return _vm_.strArr} }, function ($idx, $item) { return aiot.__ce__("list-item", { "classList": [ "introduceItem" ] }, [ aiot.__ce__("text", { "classList": [ "introduced" ], "value": function () {return $item} }) ])}) ]), aiot.__ce__("input", { "type": "button", "value": "准备训练", "classList": [ "trainBtn" ], "events": { "click": function (evt) {_vm_.clickTranBtn(evt)} } }) ]) } /***/ }), /***/ "./src/pages/course_box/course_start/course_start.hml?uxType=page": /*!************************************************************************!*\ !*** ./src/pages/course_box/course_start/course_start.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!./course_start.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/course_box/course_start/course_start.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!./course_start.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/course_box/course_start/course_start.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!./course_start.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/course_box/course_start/course_start.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/course_box/course_start/course_start.hml?uxType=page"); /******/ /******/ })() ; }; return createPageHandler(); };