Clock.js 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076
  1. "use strict";
  2. (wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/Clock"],{
  3. /***/ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/Clock.tsx":
  4. /*!**************************************************************************************************!*\
  5. !*** ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/Clock.tsx ***!
  6. \**************************************************************************************************/
  7. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  8. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  9. /* harmony export */ "default": function() { return /* binding */ IndexPage; }
  10. /* harmony export */ });
  11. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js */ "./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js");
  12. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
  13. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  14. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  15. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
  16. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  17. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_1__);
  18. /* harmony import */ var _store_user__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/store/user */ "./src/store/user.tsx");
  19. /* harmony import */ var _services_permission__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/services/permission */ "./src/services/permission.tsx");
  20. /* harmony import */ var _features_trackTimeDuration_components_Clock__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/features/trackTimeDuration/components/Clock */ "./src/features/trackTimeDuration/components/Clock.tsx");
  21. /* harmony import */ var _features_trackTimeDuration_components_Console__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/features/trackTimeDuration/components/Console */ "./src/features/trackTimeDuration/components/Console.tsx");
  22. /* harmony import */ var _features_trackTimeDuration_components_More__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/features/trackTimeDuration/components/More */ "./src/features/trackTimeDuration/components/More.tsx");
  23. /* harmony import */ var _features_trackTimeDuration_components_Schedule__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/features/trackTimeDuration/components/Schedule */ "./src/features/trackTimeDuration/components/Schedule.tsx");
  24. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  25. /* harmony import */ var _store_scenario__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/scenario */ "./src/store/scenario.tsx");
  26. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  27. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  28. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__);
  29. // import ComponentA from './component'
  30. // import TabBar from '../../components/Tabbar';
  31. function IndexPage() {
  32. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useDispatch)();
  33. var array = [];
  34. var user = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(function (state) {
  35. return state.user;
  36. });
  37. var permission = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(function (state) {
  38. return state.permission;
  39. });
  40. var common = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(function (state) {
  41. return state.common;
  42. });
  43. array.push('ffff');
  44. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  45. children: "ffff"
  46. }));
  47. // array.push(<Rings radius={50}/>)
  48. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__.useReady)( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_13__["default"])( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_14__["default"])().mark(function _callee() {
  49. var userData;
  50. return (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_14__["default"])().wrap(function _callee$(_context) {
  51. while (1) switch (_context.prev = _context.next) {
  52. case 0:
  53. _context.next = 2;
  54. return getStorage('userData');
  55. case 2:
  56. userData = _context.sent;
  57. if (userData) {
  58. dispatch((0,_store_user__WEBPACK_IMPORTED_MODULE_2__.getInfoSuccess)(JSON.parse(userData)));
  59. // return JSON.parse(userData as string) as UserState;
  60. setTimeout(function () {
  61. checkWXPubFollow();
  62. getCheckData();
  63. }, 200);
  64. }
  65. case 4:
  66. case "end":
  67. return _context.stop();
  68. }
  69. }, _callee);
  70. })));
  71. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__.useDidShow)(function () {
  72. if (user.isLogin) getCheckData();
  73. });
  74. function getCheckData() {
  75. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_8__.getChecks)().then(function (res) {
  76. if (res.scenario) {
  77. dispatch((0,_store_scenario__WEBPACK_IMPORTED_MODULE_9__.setScenario)(res.scenario));
  78. __webpack_require__.g.scenario = res.scenario;
  79. // global.checkData = res;
  80. // console.log((res as any).scenario.name + ' ' + (res as any).status);
  81. // trackTimeService.send({type:(res as any).scenario.name});
  82. // setSpecifiedStatus('FAST_SLEEP', 'ON_GOING');
  83. // 初始化状态机
  84. // const initialState = machine.initialState;
  85. // 设置指定状态为 C->3
  86. // const nextState = machine.transition(initialState, 'SET_SPECIFIED_STATE');
  87. // const specifiedState = setSpecifiedState(nextState, 'FAST_SLEEP');
  88. // setSpecifiedState();
  89. // console.log('name:'+(res as any).scenario.name)
  90. // machine.reset();
  91. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__["default"].send({
  92. type: 'RESET'
  93. });
  94. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__["default"].send({
  95. type: res.scenario.name
  96. });
  97. var currentState = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__["default"].getSnapshot();
  98. var json = {};
  99. var key = res.scenario.name;
  100. json[key] = res.status;
  101. currentState.value = json;
  102. // debugger
  103. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__.machine.context.currentStatus = "".concat(key, ".").concat(res.status); //'mixed.ON_GOING2'
  104. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__.machine.context.checkData = res;
  105. var obj = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_10__.machine.context;
  106. debugger;
  107. // debugger
  108. // trackTimeService.send('APPLE');
  109. // machine.transition(`${key}.${(res as any).status}`,'' as any);
  110. // trackTimeService.send({type:'START_FAST'});
  111. // trackTimeService.send({type:'START_SLEEP'});
  112. // trackTimeService.send({type:'END_SLEEP'});
  113. // trackTimeService.send({type:'END_SLEEP'});
  114. // trackTimeService.send({type:'START_FAST'});
  115. // trackTimeService.send({type:'END_FAST'});
  116. // trackTimeService.send({type:'START_SLEEP'});
  117. // console.log(currentState.value);
  118. // debugger
  119. // trackTimeService.send('setCurrentStatus', {status:(res as any).status});
  120. // setCurrentStatus((res as any).status);
  121. // trackTimeService.send({type:'START_FAST'});
  122. }
  123. });
  124. }
  125. function checkWXPubFollow() {
  126. (0,_services_permission__WEBPACK_IMPORTED_MODULE_3__.wxPubFollow)().then(function (res) {
  127. console.log(res);
  128. });
  129. }
  130. function followWxPub() {
  131. var resource = common.resources.filter(function (item) {
  132. return item.code == 'follow_wx_pub';
  133. });
  134. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showModal({
  135. title: '提示',
  136. content: '关注公众号后可接收提醒\n点击确定,前往关注',
  137. showCancel: true,
  138. success: function success(result) {
  139. if (result.confirm) {
  140. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  141. url: '/pages/H5?title=fast16cc 关注服务号&url=' + resource[0].url
  142. });
  143. }
  144. }
  145. });
  146. }
  147. function getStorage(_x) {
  148. return _getStorage.apply(this, arguments);
  149. }
  150. function _getStorage() {
  151. _getStorage = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_13__["default"])( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_14__["default"])().mark(function _callee2(key) {
  152. var res;
  153. return (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_14__["default"])().wrap(function _callee2$(_context2) {
  154. while (1) switch (_context2.prev = _context2.next) {
  155. case 0:
  156. _context2.prev = 0;
  157. _context2.next = 3;
  158. return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorage({
  159. key: key
  160. });
  161. case 3:
  162. res = _context2.sent;
  163. return _context2.abrupt("return", res.data);
  164. case 7:
  165. _context2.prev = 7;
  166. _context2.t0 = _context2["catch"](0);
  167. return _context2.abrupt("return", '');
  168. case 10:
  169. case "end":
  170. return _context2.stop();
  171. }
  172. }, _callee2, null, [[0, 7]]);
  173. }));
  174. return _getStorage.apply(this, arguments);
  175. }
  176. function goDetail() {
  177. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  178. // url: '/pages/index/detail'
  179. //src/moduleA/pages/third.tsx
  180. url: '../../moduleA/pages/third'
  181. });
  182. }
  183. function login() {
  184. if (user.isLogin) {
  185. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  186. url: '/pages/ChooseScenario'
  187. });
  188. } else {
  189. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  190. url: '/pages/ChooseAuth'
  191. });
  192. }
  193. }
  194. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  195. style: {
  196. backgroundColor: '#fff',
  197. flex: 1,
  198. flexDirection: 'column',
  199. display: 'flex'
  200. },
  201. children: [permission.wxPubFollow == false ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  202. onClick: function onClick() {
  203. return followWxPub();
  204. },
  205. children: "\u53BB\u5173\u6CE8\u516C\u4F17\u53F7"
  206. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  207. children: "\u5DF2\u5173\u6CE8"
  208. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Button, {
  209. onClick: function onClick() {
  210. return goDetail();
  211. },
  212. children: "go detail"
  213. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  214. className: "login",
  215. onClick: function onClick() {
  216. return login();
  217. },
  218. children: "sss"
  219. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_features_trackTimeDuration_components_Clock__WEBPACK_IMPORTED_MODULE_4__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_features_trackTimeDuration_components_Console__WEBPACK_IMPORTED_MODULE_5__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_features_trackTimeDuration_components_More__WEBPACK_IMPORTED_MODULE_6__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_features_trackTimeDuration_components_Schedule__WEBPACK_IMPORTED_MODULE_7__["default"], {})]
  220. });
  221. }
  222. /***/ }),
  223. /***/ "./src/features/trackTimeDuration/components/Clock.tsx":
  224. /*!*************************************************************!*\
  225. !*** ./src/features/trackTimeDuration/components/Clock.tsx ***!
  226. \*************************************************************/
  227. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  228. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  229. /* harmony export */ "default": function() { return /* binding */ Component; }
  230. /* harmony export */ });
  231. /* harmony import */ var _components_Rings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Rings */ "./src/components/Rings.weapp.tsx");
  232. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  233. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  234. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
  235. function Component() {
  236. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
  237. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_0__["default"], {
  238. radius: 50
  239. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
  240. children: "Clock Component"
  241. })]
  242. });
  243. }
  244. /***/ }),
  245. /***/ "./src/features/trackTimeDuration/components/Console.tsx":
  246. /*!***************************************************************!*\
  247. !*** ./src/features/trackTimeDuration/components/Console.tsx ***!
  248. \***************************************************************/
  249. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  250. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  251. /* harmony export */ "default": function() { return /* binding */ Component; }
  252. /* harmony export */ });
  253. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  254. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  255. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  256. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  257. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  258. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
  259. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  260. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__);
  261. function Component() {
  262. // const [current,send] = useService(machine)
  263. // const currentState = trackTimeService.getSnapshot();
  264. // console.log(currentState.value);
  265. // debugger
  266. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(''),
  267. _useState2 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState, 2),
  268. key = _useState2[0],
  269. setKey = _useState2[1];
  270. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(''),
  271. _useState4 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState3, 2),
  272. value = _useState4[0],
  273. setValue = _useState4[1];
  274. (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
  275. getStateDetail();
  276. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__.machine.context.currentStatus]);
  277. (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
  278. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].onTransition(function (state) {
  279. // console.log(state.value);
  280. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].getSnapshot().value;
  281. // console.log('aaa:'+JSON.parse(JSON.stringify(value)));
  282. if (state.value.FAST_SLEEP) {
  283. setKey('FAST_SLEEP');
  284. setValue(state.value.FAST_SLEEP);
  285. }
  286. if (state.value.FAST) {
  287. setKey('FAST');
  288. setValue(state.value.FAST);
  289. }
  290. if (state.value.SLEEP) {
  291. setKey('SLEEP');
  292. setValue(state.value.SLEEP);
  293. }
  294. });
  295. }, []);
  296. function getStateDetail() {
  297. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].getSnapshot().value;
  298. if (state.FAST_SLEEP) {
  299. setKey('FAST_SLEEP');
  300. setValue(state.FAST_SLEEP);
  301. }
  302. if (state.FAST) {
  303. setKey('FAST');
  304. setValue(state.FAST);
  305. }
  306. if (state.SLEEP) {
  307. setKey('SLEEP');
  308. setValue(state.SLEEP);
  309. }
  310. }
  311. function isMap(obj) {
  312. return obj instanceof Map;
  313. }
  314. function startFast() {
  315. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  316. type: 'START_FAST'
  317. });
  318. var start_time = new Date().getTime();
  319. var duration = 8 * 3600 * 1000;
  320. var extra = {
  321. set_time: start_time - 20 * 1000,
  322. confirm_time: start_time + 50 * 1000
  323. };
  324. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  325. action: 'FAST_START',
  326. real_check_time: start_time,
  327. target_duration: duration,
  328. extra: extra
  329. }).then(function (res) {
  330. console.log(res);
  331. });
  332. // dispatch(startFast());
  333. }
  334. function startSleep() {
  335. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  336. type: 'START_SLEEP'
  337. });
  338. var start_time = new Date().getTime();
  339. var duration = 8 * 3600 * 1000;
  340. var extra = {
  341. set_time: start_time - 20 * 1000,
  342. confirm_time: start_time + 50 * 1000
  343. };
  344. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  345. action: 'SLEEP_START',
  346. real_check_time: start_time,
  347. target_duration: duration,
  348. extra: extra
  349. }).then(function (res) {
  350. console.log(res);
  351. });
  352. // dispatch(startSleep());
  353. }
  354. function endSleep() {
  355. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  356. type: 'END_SLEEP'
  357. });
  358. var start_time = new Date().getTime();
  359. // const duration = 8 * 3600 * 1000;
  360. var extra = {
  361. set_time: start_time - 20 * 1000,
  362. confirm_time: start_time + 50 * 1000
  363. };
  364. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  365. action: 'SLEEP_END',
  366. real_check_time: start_time,
  367. extra: extra
  368. }).then(function (res) {
  369. console.log(res);
  370. });
  371. }
  372. function endFast() {
  373. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  374. type: 'END_FAST'
  375. });
  376. var start_time = new Date().getTime();
  377. // const duration = 8 * 3600 * 1000;
  378. var extra = {
  379. set_time: start_time - 20 * 1000,
  380. confirm_time: start_time + 50 * 1000
  381. };
  382. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  383. action: 'FAST_END',
  384. real_check_time: start_time,
  385. extra: extra
  386. }).then(function (res) {
  387. console.log(res);
  388. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  389. type: 'RESET'
  390. });
  391. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  392. type: __webpack_require__.g.scenario.name
  393. });
  394. });
  395. }
  396. function mixedBtns() {
  397. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  398. children: [(value == 'WAIT_FOR_START' || value == 'DONE') && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  399. onClick: startFast,
  400. children: "Start Fast"
  401. }), (value == 'ONGOING' /* ||value == 'ONGOING1' || value == 'ONGOING2'*/ || value == 'ONGOING3') && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  402. onClick: endFast,
  403. children: "End Fast"
  404. }), value == 'ONGOING1' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  405. onClick: startSleep,
  406. children: "Start Sleep"
  407. }), value == 'ONGOING2' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  408. onClick: endSleep,
  409. children: "End Sleep"
  410. })]
  411. });
  412. }
  413. function fastBtns() {
  414. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  415. children: value == 'ONGOING' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  416. onClick: endFast,
  417. children: "End Fast"
  418. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  419. onClick: startFast,
  420. children: "Start Fast"
  421. })
  422. });
  423. }
  424. function sleepBtns() {
  425. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  426. children: value == 'ONGOING' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  427. onClick: endSleep,
  428. children: "End Sleep"
  429. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  430. onClick: startSleep,
  431. children: "Start Sleep"
  432. })
  433. });
  434. }
  435. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  436. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  437. children: "Console Component"
  438. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  439. children: [key === 'FAST_SLEEP' && mixedBtns(), key === 'FAST' && fastBtns(), key === 'SLEEP' && sleepBtns()]
  440. })]
  441. });
  442. }
  443. /***/ }),
  444. /***/ "./src/features/trackTimeDuration/components/More.tsx":
  445. /*!************************************************************!*\
  446. !*** ./src/features/trackTimeDuration/components/More.tsx ***!
  447. \************************************************************/
  448. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  449. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  450. /* harmony export */ "default": function() { return /* binding */ Component; }
  451. /* harmony export */ });
  452. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  453. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  454. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
  455. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  456. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  457. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  458. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_2__);
  459. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  460. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_3__);
  461. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  462. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  463. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  464. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__);
  465. function Component() {
  466. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.useTranslation)(),
  467. t = _useTranslation.t;
  468. var scenario = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useSelector)(function (state) {
  469. return state.scenario;
  470. });
  471. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  472. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  473. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__.machine.context.currentStatus]);
  474. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  475. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].onTransition(function (state) {
  476. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  477. });
  478. }, []);
  479. function waitActionSheet() {
  480. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  481. itemList: [t('feature.track_time_duration.action_sheet.change_schedule'), t('feature.track_time_duration.action_sheet.switch_scenario')]
  482. }).then(function (res) {
  483. console.log(res.tapIndex);
  484. switch (res.tapIndex) {
  485. case 0:
  486. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  487. url: '/pages/SetSchedule'
  488. });
  489. break;
  490. case 1:
  491. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  492. url: '/pages/ChooseScenario'
  493. });
  494. break;
  495. }
  496. }).catch(function (err) {
  497. console.log(err.errMsg);
  498. });
  499. }
  500. function endFastActionSheet() {
  501. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  502. itemList: [t('feature.track_time_duration.action_sheet.end_fast')]
  503. }).then(function (res) {
  504. console.log(res.tapIndex);
  505. switch (res.tapIndex) {
  506. case 0:
  507. {
  508. var start_time = new Date().getTime();
  509. // const duration = 8 * 3600 * 1000;
  510. var extra = {
  511. set_time: start_time - 20 * 1000,
  512. confirm_time: start_time + 50 * 1000
  513. };
  514. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_5__.recordCheck)({
  515. action: 'FAST_END',
  516. real_check_time: start_time,
  517. extra: extra
  518. }).then(function (res) {
  519. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  520. type: 'END_FAST'
  521. });
  522. console.log(res);
  523. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  524. type: 'RESET'
  525. });
  526. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  527. type: __webpack_require__.g.scenario.name
  528. });
  529. });
  530. }
  531. break;
  532. }
  533. }).catch(function (err) {
  534. console.log(err.errMsg);
  535. });
  536. }
  537. function ongoingActionSheet() {
  538. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  539. itemList: [t('feature.track_time_duration.action_sheet.give_up'), t('feature.track_time_duration.action_sheet.switch_scenario')]
  540. }).then(function (res) {
  541. console.log(res.tapIndex);
  542. }).catch(function (err) {
  543. console.log(err.errMsg);
  544. });
  545. }
  546. function checkActionSheetData() {
  547. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  548. debugger;
  549. if (state.FAST_SLEEP === 'WAIT_FOR_START' || state.FAST === 'WAIT_FOR_START' || state.SLEEP === 'WAIT_FOR_START') {
  550. waitActionSheet();
  551. } else if (state.FAST_SLEEP === 'ONGOING1' || state.FAST_SLEEP === 'ONGOING2') {
  552. endFastActionSheet();
  553. } else if (state.FAST_SLEEP === 'ONGOING3') {
  554. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
  555. title: '暂无更多操作',
  556. icon: 'none',
  557. duration: 2000
  558. });
  559. }
  560. }
  561. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
  562. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
  563. onClick: checkActionSheetData,
  564. children: "More Component"
  565. })
  566. });
  567. }
  568. /***/ }),
  569. /***/ "./src/features/trackTimeDuration/components/Schedule.tsx":
  570. /*!****************************************************************!*\
  571. !*** ./src/features/trackTimeDuration/components/Schedule.tsx ***!
  572. \****************************************************************/
  573. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  574. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  575. /* harmony export */ "default": function() { return /* binding */ Component; }
  576. /* harmony export */ });
  577. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  578. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  579. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  580. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  581. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  582. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  583. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_2__);
  584. /* harmony import */ var _utils_time_format__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/utils/time_format */ "./src/utils/time_format.ts");
  585. /* harmony import */ var taro_ui_dist_style_components_float_layout_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! taro-ui/dist/style/components/float-layout.scss */ "./node_modules/taro-ui/dist/style/components/float-layout.scss");
  586. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  587. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
  588. function Component() {
  589. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(null),
  590. _useState2 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_5__["default"])(_useState, 2),
  591. checkData = _useState2[0],
  592. setCheckData = _useState2[1];
  593. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
  594. _useState4 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_5__["default"])(_useState3, 2),
  595. key = _useState4[0],
  596. setKey = _useState4[1];
  597. var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
  598. _useState6 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_5__["default"])(_useState5, 2),
  599. value = _useState6[0],
  600. setValue = _useState6[1];
  601. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  602. getStateDetail();
  603. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.currentStatus]);
  604. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  605. if (_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData) {
  606. setCheckData(_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData);
  607. }
  608. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__.machine.context.checkData]);
  609. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  610. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__["default"].onTransition(function (state) {
  611. getStateDetail();
  612. });
  613. }, []);
  614. function getStateDetail() {
  615. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_0__["default"].getSnapshot().value;
  616. if (state.FAST_SLEEP) {
  617. setKey('FAST_SLEEP');
  618. setValue(state.FAST_SLEEP);
  619. }
  620. if (state.FAST) {
  621. setKey('FAST');
  622. setValue(state.FAST);
  623. }
  624. if (state.SLEEP) {
  625. setKey('SLEEP');
  626. setValue(state.SLEEP);
  627. }
  628. }
  629. function editSchedule() {
  630. _tarojs_taro__WEBPACK_IMPORTED_MODULE_2___default().navigateTo({
  631. url: '/pages/SetSchedule'
  632. });
  633. }
  634. //🚫❌⭕️✅
  635. function statusString(isFast, isStart) {
  636. if (value == 'WAIT_FOR_START') {
  637. return '⭕️';
  638. } else if (value == 'ONGOING1') {
  639. if (isFast && isStart) {
  640. return '✅';
  641. }
  642. } else if (value == 'ONGOING2') {
  643. if (isStart) {
  644. return '✅';
  645. }
  646. } else if (value == 'ONGOING3') {
  647. if (isFast && !isStart) {
  648. return '⭕️';
  649. } else {
  650. return '✅';
  651. }
  652. }
  653. return '⭕️';
  654. }
  655. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.View, {
  656. style: {
  657. flexDirection: 'column',
  658. display: 'flex',
  659. alignItems: 'center'
  660. },
  661. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  662. children: value == 'WAIT_FOR_START' ? 'Schedule' : 'Log in Progress'
  663. }), checkData && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.View, {
  664. style: {
  665. flexDirection: 'column',
  666. display: 'flex'
  667. },
  668. children: [checkData.target.fast && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  669. children: [statusString(true, true), "\u5F00\u59CB\u65AD\u98DF\uFF1A", _utils_time_format__WEBPACK_IMPORTED_MODULE_7__.TimeFormatter.formatTimestamp(checkData.target.fast.start_time)]
  670. }), checkData.target.sleep && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  671. children: [statusString(false, true), "\u5F00\u59CB\u7761\u7720\uFF1A", _utils_time_format__WEBPACK_IMPORTED_MODULE_7__.TimeFormatter.formatTimestamp(checkData.target.sleep.start_time)]
  672. }), checkData.target.sleep && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  673. children: [statusString(false, false), "\u7ED3\u675F\u7761\u7720\uFF1A", _utils_time_format__WEBPACK_IMPORTED_MODULE_7__.TimeFormatter.formatTimestamp(checkData.target.sleep.end_time)]
  674. }), checkData.target.fast && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  675. children: [statusString(true, false), "\u7ED3\u675F\u65AD\u98DF\uFF1A", _utils_time_format__WEBPACK_IMPORTED_MODULE_7__.TimeFormatter.formatTimestamp(checkData.target.fast.end_time)]
  676. })]
  677. }), value == 'WAIT_FOR_START' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  678. onClick: editSchedule,
  679. children: "\u8C03\u6574\u65E5\u7A0B"
  680. }), value == 'WAIT_FOR_START' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  681. children: "Duration goals by stage"
  682. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_6__.Text, {
  683. children: "Current stage"
  684. })]
  685. });
  686. }
  687. /***/ }),
  688. /***/ "./src/pages/Clock.tsx":
  689. /*!*****************************!*\
  690. !*** ./src/pages/Clock.tsx ***!
  691. \*****************************/
  692. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  693. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  694. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  695. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_Clock_tsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./Clock.tsx */ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/Clock.tsx");
  696. var config = {};
  697. var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__.createPageConfig)(_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_Clock_tsx__WEBPACK_IMPORTED_MODULE_1__["default"], 'pages/Clock', {root:{cn:[]}}, config || {}))
  698. /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_Clock_tsx__WEBPACK_IMPORTED_MODULE_1__["default"]);
  699. /***/ }),
  700. /***/ "./src/store/trackTimeMachine.tsx":
  701. /*!****************************************!*\
  702. !*** ./src/store/trackTimeMachine.tsx ***!
  703. \****************************************/
  704. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  705. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  706. /* harmony export */ machine: function() { return /* binding */ machine; }
  707. /* harmony export */ });
  708. /* unused harmony exports setSpecifiedState, setSpecifiedStatus */
  709. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
  710. /* harmony import */ var xstate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! xstate */ "webpack/container/remote/xstate");
  711. /* harmony import */ var xstate__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(xstate__WEBPACK_IMPORTED_MODULE_0__);
  712. var machine = (0,xstate__WEBPACK_IMPORTED_MODULE_0__.createMachine)({
  713. id: "trackTime",
  714. initial: "choose",
  715. context: {
  716. currentStatus: '',
  717. checkData: null
  718. },
  719. on: {
  720. RESET: {
  721. target: '.choose',
  722. actions: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)(function (_) {
  723. return {
  724. currentStatus: ''
  725. };
  726. })
  727. }
  728. },
  729. states: {
  730. choose: {
  731. on: {
  732. SLEEP: {
  733. target: "SLEEP"
  734. },
  735. FAST_SLEEP: {
  736. target: "FAST_SLEEP"
  737. },
  738. FAST: {
  739. target: "FAST"
  740. }
  741. }
  742. },
  743. SLEEP: {
  744. initial: "WAIT_FOR_START",
  745. states: {
  746. WAIT_FOR_START: {
  747. on: {
  748. START_SLEEP: {
  749. target: "ONGOING"
  750. }
  751. }
  752. },
  753. ONGOING: {
  754. on: {
  755. END_SLEEP: {
  756. target: "DONE"
  757. }
  758. }
  759. },
  760. DONE: {}
  761. }
  762. },
  763. FAST_SLEEP: {
  764. initial: "WAIT_FOR_START",
  765. states: {
  766. WAIT_FOR_START: {
  767. on: {
  768. START_FAST: {
  769. target: "ONGOING1"
  770. }
  771. }
  772. },
  773. ONGOING1: {
  774. on: {
  775. START_SLEEP: {
  776. target: "ONGOING2"
  777. },
  778. END_FAST: {
  779. target: "DONE"
  780. }
  781. }
  782. },
  783. ONGOING2: {
  784. on: {
  785. END_FAST: {
  786. target: "DONE"
  787. },
  788. END_SLEEP: {
  789. target: "ONGOING3"
  790. }
  791. }
  792. },
  793. DONE: {},
  794. ONGOING3: {
  795. on: {
  796. END_FAST: {
  797. target: "DONE"
  798. }
  799. }
  800. }
  801. }
  802. },
  803. FAST: {
  804. initial: "WAIT_FOR_START",
  805. states: {
  806. WAIT_FOR_START: {
  807. on: {
  808. START_FAST: {
  809. target: "ONGOING"
  810. }
  811. }
  812. },
  813. ONGOING: {
  814. on: {
  815. END_FAST: {
  816. target: "DONE"
  817. }
  818. }
  819. },
  820. DONE: {}
  821. }
  822. }
  823. },
  824. schema: {
  825. events: {}
  826. },
  827. predictableActionArguments: true,
  828. preserveActionOrder: true
  829. }, {
  830. actions: {
  831. apple: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({}),
  832. setCurrentStatus: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)(function (context, event) {
  833. return {
  834. currentStatus: event.type
  835. };
  836. })
  837. },
  838. services: {},
  839. guards: {},
  840. delays: {}
  841. });
  842. var setSpecifiedState = function setSpecifiedState(currentState, specifiedState) {
  843. return (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({
  844. myMachine: (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_1__["default"])({}, currentState.myMachine), {}, {
  845. value: specifiedState
  846. })
  847. });
  848. };
  849. var setSpecifiedStatus = function setSpecifiedStatus(currentState, specifiedState) {
  850. return (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({
  851. machine: {
  852. currentState: currentState,
  853. specifiedState: specifiedState
  854. }
  855. });
  856. };
  857. var service = (0,xstate__WEBPACK_IMPORTED_MODULE_0__.interpret)(machine).start();
  858. // const service = machine.withContext(initialContext).start();
  859. /* harmony default export */ __webpack_exports__["default"] = (service);
  860. /***/ }),
  861. /***/ "./src/utils/time_format.ts":
  862. /*!**********************************!*\
  863. !*** ./src/utils/time_format.ts ***!
  864. \**********************************/
  865. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  866. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  867. /* harmony export */ TimeFormatter: function() { return /* binding */ TimeFormatter; }
  868. /* harmony export */ });
  869. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
  870. /* harmony import */ var _Users_Work_hola_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createClass.js */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
  871. var TimeFormatter = /*#__PURE__*/function () {
  872. function TimeFormatter() {
  873. (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this, TimeFormatter);
  874. }
  875. (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__["default"])(TimeFormatter, null, [{
  876. key: "formatTimestamp",
  877. value: function formatTimestamp(timestamp) {
  878. var currentDate = new Date();
  879. var inputDate = new Date(timestamp);
  880. // 判断是否是今天
  881. if (inputDate.getDate() === currentDate.getDate() && inputDate.getMonth() === currentDate.getMonth() && inputDate.getFullYear() === currentDate.getFullYear()) {
  882. return "\u4ECA\u5929 ".concat(TimeFormatter.formatTime(inputDate));
  883. }
  884. // 判断是否是昨天
  885. var yesterday = new Date();
  886. yesterday.setDate(currentDate.getDate() - 1);
  887. if (inputDate.getDate() === yesterday.getDate() && inputDate.getMonth() === yesterday.getMonth() && inputDate.getFullYear() === yesterday.getFullYear()) {
  888. return "\u6628\u5929 ".concat(TimeFormatter.formatTime(inputDate));
  889. }
  890. // 判断是否是明天
  891. var tomorrow = new Date();
  892. tomorrow.setDate(currentDate.getDate() + 1);
  893. if (inputDate.getDate() === tomorrow.getDate() && inputDate.getMonth() === tomorrow.getMonth() && inputDate.getFullYear() === tomorrow.getFullYear()) {
  894. return "\u660E\u5929 ".concat(TimeFormatter.formatTime(inputDate));
  895. }
  896. // 返回 YYYY-MM-DD HH:mm
  897. return "".concat(inputDate.getFullYear(), "-").concat(TimeFormatter.formatNumber(inputDate.getMonth() + 1), "-").concat(TimeFormatter.formatNumber(inputDate.getDate()), " ").concat(TimeFormatter.formatTime(inputDate));
  898. }
  899. }, {
  900. key: "formatTime",
  901. value: function formatTime(date) {
  902. return "".concat(TimeFormatter.formatNumber(date.getHours()), ":").concat(TimeFormatter.formatNumber(date.getMinutes()));
  903. }
  904. }, {
  905. key: "formatNumber",
  906. value: function formatNumber(num) {
  907. return num.toString().padStart(2, '0');
  908. }
  909. }]);
  910. return TimeFormatter;
  911. }();
  912. /***/ }),
  913. /***/ "./node_modules/taro-ui/dist/style/components/float-layout.scss":
  914. /*!**********************************************************************!*\
  915. !*** ./node_modules/taro-ui/dist/style/components/float-layout.scss ***!
  916. \**********************************************************************/
  917. /***/ (function() {
  918. // extracted by mini-css-extract-plugin
  919. /***/ }),
  920. /***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
  921. /*!*******************************************************************!*\
  922. !*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
  923. \*******************************************************************/
  924. /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
  925. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  926. /* harmony export */ "default": function() { return /* binding */ _classCallCheck; }
  927. /* harmony export */ });
  928. function _classCallCheck(instance, Constructor) {
  929. if (!(instance instanceof Constructor)) {
  930. throw new TypeError("Cannot call a class as a function");
  931. }
  932. }
  933. /***/ }),
  934. /***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
  935. /*!****************************************************************!*\
  936. !*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
  937. \****************************************************************/
  938. /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
  939. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  940. /* harmony export */ "default": function() { return /* binding */ _createClass; }
  941. /* harmony export */ });
  942. /* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");
  943. function _defineProperties(target, props) {
  944. for (var i = 0; i < props.length; i++) {
  945. var descriptor = props[i];
  946. descriptor.enumerable = descriptor.enumerable || false;
  947. descriptor.configurable = true;
  948. if ("value" in descriptor) descriptor.writable = true;
  949. Object.defineProperty(target, (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(descriptor.key), descriptor);
  950. }
  951. }
  952. function _createClass(Constructor, protoProps, staticProps) {
  953. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  954. if (staticProps) _defineProperties(Constructor, staticProps);
  955. Object.defineProperty(Constructor, "prototype", {
  956. writable: false
  957. });
  958. return Constructor;
  959. }
  960. /***/ })
  961. },
  962. /******/ function(__webpack_require__) { // webpackRuntimeModules
  963. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  964. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/Clock.tsx"); });
  965. /******/ var __webpack_exports__ = __webpack_require__.O();
  966. /******/ }
  967. ]);
  968. //# sourceMappingURL=Clock.js.map