@aiot-toolkit/velasim
Version:
vela for sim
529 lines (471 loc) • 17.6 kB
JavaScript
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/scheduled_box/rest/rest.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/scheduled_box/rest/rest.js?uxType=page ***!
\************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
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 _utils = _interopRequireDefault(__webpack_require__(/*! ../../../common/js/utils.js */ "./src/common/js/utils.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = {
protected: {
index: 0,
numTxt: "一",
countdownTxt: "__:__",
timer: null,
countTime: 0,
pervCountTime: 0
},
restTime() {
var i = 0;
let that = this;
this.timer = setInterval(function () {
i++;
that.countTime++;
that.countdownTxt = _utils.default.countdownNumChange(i, true);
}, 1000);
},
clickEnterTrainBtn() {
clearInterval(this.timer);
this.timer = null;
var allCountTime = this.countTime + this.pervCountTime;
this.index = parseInt(this.index) + 1;
let params = {
classTime: this.classTime,
startDate: this.startDate,
currentDate: this.currentDate,
courseIndex: this.index,
courseId: this.courseId,
burying: this.burying,
actionLength: this.actionLength,
userId: this.userId,
rest: allCountTime.toString(),
courseName: this.courseName
};
_system.default.replace({
uri: "pages/scheduled_box/motion",
params: params
});
},
onInit() {
let that = this;
const numTxtArr = ["二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五"];
this.index = parseInt(this.courseIndex);
this.numTxt = numTxtArr[this.index];
that.pervCountTime = parseInt(this.rest);
this.restTime();
},
onDestroy() {
clearInterval(this.timer);
this.timer = 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/scheduled_box/rest/rest.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/scheduled_box/rest/rest.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,
"restBox"
]
],
{
"width": "464px",
"height": "464px"
}
],
[
[
[
0,
"motionImg"
]
],
{
"width": "464px",
"height": "464px"
}
],
[
[
[
0,
"restTime"
]
],
{
"fontSize": "34px",
"height": "44px"
}
],
[
[
[
0,
"content"
]
],
{
"width": "354px",
"height": "354px",
"borderRadius": "177px",
"flexDirection": "column",
"justifyContent": "flex-start",
"alignItems": "center",
"left": "54px",
"top": "54px",
"backgroundColor": "rgba(0,0,0,0)"
}
],
[
[
[
0,
"restTxt"
]
],
{
"marginTop": "10px",
"fontSize": "34px",
"height": "44px"
}
],
[
[
[
0,
"trainTxt"
]
],
{
"marginTop": "46px",
"fontSize": "34px",
"height": "44px"
}
],
[
[
[
0,
"enterTrain"
]
],
{
"width": "260px",
"height": "86px",
"backgroundColor": "#C0191F",
"left": "100px",
"top": "282px",
"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/scheduled_box/rest/rest.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/scheduled_box/rest/rest.hml?uxType=page& ***!
\**************************************************************************************************************************************************************************************************************************/
/***/ ((module) => {
module.exports = function (vm) {
const _vm_ = vm || this
return aiot.__ce__("div", {
"classList": [
"container"
]
}, [
aiot.__ce__("stack", {
"classList": [
"restBox"
]
}, [
aiot.__ce__("image", {
"src": "/common/images/rest.png",
"classList": [
"motionImg"
],
"style": {
"position": "absolute"
}
}),
aiot.__ce__("div", {
"classList": [
"content"
],
"style": {
"position": "absolute"
}
}, [
aiot.__ce__("text", {
"classList": [
"restTxt"
],
"value": "组间休息"
}),
aiot.__ce__("text", {
"classList": [
"restTime"
],
"value": function () {return _vm_.countdownTxt}
}),
aiot.__ce__("text", {
"classList": [
"trainTxt"
],
"value": function () {return '' + '第' + (_vm_.numTxt) + '组运动'}
})
]),
aiot.__ce__("input", {
"type": "button",
"value": "进入训练",
"classList": [
"enterTrain"
],
"events": {
"click": function (evt) {_vm_.clickEnterTrainBtn(evt)}
},
"style": {
"position": "absolute"
}
})
])
])
}
/***/ }),
/***/ "./src/pages/scheduled_box/rest/rest.hml?uxType=page":
/*!***********************************************************!*\
!*** ./src/pages/scheduled_box/rest/rest.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!./rest.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/scheduled_box/rest/rest.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!./rest.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/scheduled_box/rest/rest.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!./rest.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/scheduled_box/rest/rest.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;
/***/ }),
/***/ "./src/common/js/utils.js":
/*!********************************!*\
!*** ./src/common/js/utils.js ***!
\********************************/
/***/ ((module) => {
;
/**
* @param {dateDifferenceNum}两个时间相差的秒数
*/
function dateDifference(faultDate, completeTime) {
var sTime = new Date(getDate(faultDate)).getTime();
var eTime = new Date(getDate(completeTime)).getTime();
var usedTime = eTime - sTime; //两个时间戳相差的毫秒数
if (usedTime <= 0) {
return 0;
}
return Math.floor(usedTime / 1000);
}
/**
* 1.0根据日期计算相差的时间 以day:hours:months格式返回
* @param {dateDifferenceNum} 相差的秒数
* @param {isRetainHour} 是否保留小时字段
*/
function countdownNumChange(dateDifferenceNum, isRetainHour) {
//计算出小时数
//var leaveHours = dateDifferenceNum % (24*3600);//计算天数后剩余的毫秒数
var hours = Math.floor(dateDifferenceNum / 3600);
hours = hours < 10 ? `0${hours}` : hours; //计算相差分钟数
var leaveMinute = dateDifferenceNum % 3600; //计算小时数后剩余的毫秒数
var minutes = Math.floor(leaveMinute / 60);
minutes = minutes < 10 ? `0${minutes}` : minutes; //计算相差秒数
var leaveSecond = Math.floor(leaveMinute % 60); //计算分钟数后剩余的毫秒数
var second = leaveSecond;
second = second < 10 ? `0${second}` : second;
var time;
if (isRetainHour == null) {
time = hours + ":" + minutes + ":" + second;
} else {
time = minutes + ":" + second;
}
return time;
}
/**
* 根据字符串时间和上课的时间 计算出当前时间
* @param {dateStr} 字符串时间
* params {courseTime} 相差的时间
*/
function dateWithString(dateStr, courseTime) {
//把课程时间(分钟)转换成毫秒
let courseTimeMill = Number(courseTime) * 60 * 1000;
let currentDate = getDate(dateStr);
console.log(currentDate);
let allTimeMill = currentDate.getTime() + courseTimeMill;
return getCurrentDate();
}
function getDate(strDate) {
var st = strDate;
var a = st.split(" ");
var b = a[0].split("-");
var c = a[1].split(":");
var date = new Date(b[0], b[1] - 1, b[2], c[0], c[1], c[2]);
return date;
}
/**
* 1.0获取当前时间 以yyyy-MM-dd hh:mm:ss格式返回
* @param {timestamp} 时间戳
*/
function getCurrentDate(timestamp) {
let dateTime;
let date = timestamp == null ? new Date() : new Date(timestamp);
let yy = date.getFullYear();
let mm = date.getMonth() + 1;
mm = mm < 10 ? "0" + mm : mm;
let dd = date.getDate();
dd = dd < 10 ? "0" + dd : dd;
let hh = date.getHours();
hh = hh < 10 ? "0" + hh : hh;
let mf = date.getMinutes();
mf = mf < 10 ? "0" + mf : mf;
let ss = date.getSeconds();
ss = ss < 10 ? "0" + ss : ss;
dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss;
return dateTime;
}
/**
* 1.0计算数组的平均值
* @param {array} 数组
*/
function average(array) {
if (array.length == 0) {
return 0;
}
let len = array.length;
let num = 0;
for (let i = 0; i < array.length; i++) {
num += array[i];
}
return num == 0 ? 0 : Math.floor(num / len);
}
module.exports = {
dateDifference: dateDifference,
getCurrentDate: getCurrentDate,
countdownNumChange: countdownNumChange,
dateWithString: dateWithString,
getDate: getDate,
average: average
};
/***/ })
/******/ });
/************************************************************************/
/******/ // 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/scheduled_box/rest/rest.hml?uxType=page");
/******/
/******/ })()
;
};
return createPageHandler();
};