Clock.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  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_13__ = __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_12__ = __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_11__ = __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 _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  24. /* harmony import */ var _store_scenario__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/store/scenario */ "./src/store/scenario.tsx");
  25. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  26. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  27. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__);
  28. // import ComponentA from './component'
  29. // import TabBar from '../../components/Tabbar';
  30. function IndexPage() {
  31. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useDispatch)();
  32. var array = [];
  33. var user = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(function (state) {
  34. return state.user;
  35. });
  36. var permission = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(function (state) {
  37. return state.permission;
  38. });
  39. var common = (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(function (state) {
  40. return state.common;
  41. });
  42. array.push('ffff');
  43. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  44. children: "ffff"
  45. }));
  46. // array.push(<Rings radius={50}/>)
  47. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__.useReady)( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_12__["default"])( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13__["default"])().mark(function _callee() {
  48. var userData;
  49. return (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13__["default"])().wrap(function _callee$(_context) {
  50. while (1) switch (_context.prev = _context.next) {
  51. case 0:
  52. _context.next = 2;
  53. return getStorage('userData');
  54. case 2:
  55. userData = _context.sent;
  56. if (userData) {
  57. dispatch((0,_store_user__WEBPACK_IMPORTED_MODULE_2__.getInfoSuccess)(JSON.parse(userData)));
  58. // return JSON.parse(userData as string) as UserState;
  59. setTimeout(function () {
  60. checkWXPubFollow();
  61. getCheckData();
  62. }, 200);
  63. }
  64. case 4:
  65. case "end":
  66. return _context.stop();
  67. }
  68. }, _callee);
  69. })));
  70. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__.useDidShow)(function () {
  71. if (user.isLogin) getCheckData();
  72. });
  73. function getCheckData() {
  74. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_7__.getChecks)().then(function (res) {
  75. if (res.scenario) {
  76. dispatch((0,_store_scenario__WEBPACK_IMPORTED_MODULE_8__.setScenario)(res.scenario));
  77. __webpack_require__.g.scenario = res.scenario;
  78. // console.log((res as any).scenario.name + ' ' + (res as any).status);
  79. // trackTimeService.send({type:(res as any).scenario.name});
  80. // setSpecifiedStatus('FAST_SLEEP', 'ON_GOING');
  81. // 初始化状态机
  82. // const initialState = machine.initialState;
  83. // 设置指定状态为 C->3
  84. // const nextState = machine.transition(initialState, 'SET_SPECIFIED_STATE');
  85. // const specifiedState = setSpecifiedState(nextState, 'FAST_SLEEP');
  86. // setSpecifiedState();
  87. // console.log('name:'+(res as any).scenario.name)
  88. // machine.reset();
  89. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_9__["default"].send({
  90. type: 'RESET'
  91. });
  92. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_9__["default"].send({
  93. type: res.scenario.name
  94. });
  95. var currentState = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_9__["default"].getSnapshot();
  96. var json = {};
  97. var key = res.scenario.name;
  98. json[key] = res.status;
  99. currentState.value = json;
  100. // debugger
  101. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_9__.machine.context.currentStatus = "".concat(key, ".").concat(res.status); //'mixed.ON_GOING2'
  102. // debugger
  103. // trackTimeService.send('APPLE');
  104. // machine.transition(`${key}.${(res as any).status}`,'' as any);
  105. // trackTimeService.send({type:'START_FAST'});
  106. // trackTimeService.send({type:'START_SLEEP'});
  107. // trackTimeService.send({type:'END_SLEEP'});
  108. // trackTimeService.send({type:'END_SLEEP'});
  109. // trackTimeService.send({type:'START_FAST'});
  110. // trackTimeService.send({type:'END_FAST'});
  111. // trackTimeService.send({type:'START_SLEEP'});
  112. // console.log(currentState.value);
  113. // debugger
  114. // trackTimeService.send('setCurrentStatus', {status:(res as any).status});
  115. // setCurrentStatus((res as any).status);
  116. // trackTimeService.send({type:'START_FAST'});
  117. }
  118. });
  119. }
  120. function checkWXPubFollow() {
  121. (0,_services_permission__WEBPACK_IMPORTED_MODULE_3__.wxPubFollow)().then(function (res) {
  122. console.log(res);
  123. });
  124. }
  125. function followWxPub() {
  126. var resource = common.resources.filter(function (item) {
  127. return item.code == 'follow_wx_pub';
  128. });
  129. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showModal({
  130. title: '提示',
  131. content: '关注公众号后可接收提醒\n点击确定,前往关注',
  132. showCancel: true,
  133. success: function success(result) {
  134. if (result.confirm) {
  135. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  136. url: '/pages/H5?title=fast16cc 关注服务号&url=' + resource[0].url
  137. });
  138. }
  139. }
  140. });
  141. }
  142. function getStorage(_x) {
  143. return _getStorage.apply(this, arguments);
  144. }
  145. function _getStorage() {
  146. _getStorage = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_12__["default"])( /*#__PURE__*/(0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13__["default"])().mark(function _callee2(key) {
  147. var res;
  148. return (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_13__["default"])().wrap(function _callee2$(_context2) {
  149. while (1) switch (_context2.prev = _context2.next) {
  150. case 0:
  151. _context2.prev = 0;
  152. _context2.next = 3;
  153. return _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().getStorage({
  154. key: key
  155. });
  156. case 3:
  157. res = _context2.sent;
  158. return _context2.abrupt("return", res.data);
  159. case 7:
  160. _context2.prev = 7;
  161. _context2.t0 = _context2["catch"](0);
  162. return _context2.abrupt("return", '');
  163. case 10:
  164. case "end":
  165. return _context2.stop();
  166. }
  167. }, _callee2, null, [[0, 7]]);
  168. }));
  169. return _getStorage.apply(this, arguments);
  170. }
  171. function goDetail() {
  172. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  173. // url: '/pages/index/detail'
  174. //src/moduleA/pages/third.tsx
  175. url: '../../moduleA/pages/third'
  176. });
  177. }
  178. function login() {
  179. if (user.isLogin) {
  180. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  181. url: '/pages/ChooseScenario'
  182. });
  183. } else {
  184. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  185. url: '/pages/ChooseAuth'
  186. });
  187. }
  188. }
  189. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  190. style: {
  191. backgroundColor: '#fff',
  192. flex: 1,
  193. flexDirection: 'column',
  194. display: 'flex'
  195. },
  196. children: [permission.wxPubFollow == false && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  197. onClick: function onClick() {
  198. return followWxPub();
  199. },
  200. children: "\u53BB\u5173\u6CE8\u516C\u4F17\u53F7111"
  201. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Button, {
  202. onClick: function onClick() {
  203. return goDetail();
  204. },
  205. children: "go detail"
  206. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  207. className: "login",
  208. onClick: function onClick() {
  209. return login();
  210. },
  211. children: "sss"
  212. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_features_trackTimeDuration_components_Clock__WEBPACK_IMPORTED_MODULE_4__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_features_trackTimeDuration_components_Console__WEBPACK_IMPORTED_MODULE_5__["default"], {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_features_trackTimeDuration_components_More__WEBPACK_IMPORTED_MODULE_6__["default"], {})]
  213. });
  214. }
  215. /***/ }),
  216. /***/ "./src/features/trackTimeDuration/components/Clock.tsx":
  217. /*!*************************************************************!*\
  218. !*** ./src/features/trackTimeDuration/components/Clock.tsx ***!
  219. \*************************************************************/
  220. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  221. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  222. /* harmony export */ "default": function() { return /* binding */ Component; }
  223. /* harmony export */ });
  224. /* harmony import */ var _components_Rings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Rings */ "./src/components/Rings.weapp.tsx");
  225. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  226. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  227. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
  228. function Component() {
  229. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
  230. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_0__["default"], {
  231. radius: 50
  232. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
  233. children: "Clock Component"
  234. })]
  235. });
  236. }
  237. /***/ }),
  238. /***/ "./src/features/trackTimeDuration/components/Console.tsx":
  239. /*!***************************************************************!*\
  240. !*** ./src/features/trackTimeDuration/components/Console.tsx ***!
  241. \***************************************************************/
  242. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  243. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  244. /* harmony export */ "default": function() { return /* binding */ Component; }
  245. /* harmony export */ });
  246. /* 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");
  247. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  248. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  249. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  250. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  251. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
  252. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  253. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__);
  254. function Component() {
  255. // const [current,send] = useService(machine)
  256. // const currentState = trackTimeService.getSnapshot();
  257. // console.log(currentState.value);
  258. // debugger
  259. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(''),
  260. _useState2 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState, 2),
  261. key = _useState2[0],
  262. setKey = _useState2[1];
  263. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(''),
  264. _useState4 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState3, 2),
  265. value = _useState4[0],
  266. setValue = _useState4[1];
  267. (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
  268. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].getSnapshot().value;
  269. if (state.FAST_SLEEP) {
  270. setKey('FAST_SLEEP');
  271. setValue(state.FAST_SLEEP);
  272. }
  273. if (state.FAST) {
  274. setKey('FAST');
  275. setValue(state.FAST);
  276. }
  277. if (state.SLEEP) {
  278. setKey('SLEEP');
  279. setValue(state.SLEEP);
  280. }
  281. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__.machine.context.currentStatus]);
  282. (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
  283. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].onTransition(function (state) {
  284. // console.log(state.value);
  285. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].getSnapshot().value;
  286. // console.log('aaa:'+JSON.parse(JSON.stringify(value)));
  287. if (state.value.FAST_SLEEP) {
  288. setKey('FAST_SLEEP');
  289. setValue(state.value.FAST_SLEEP);
  290. }
  291. if (state.value.FAST) {
  292. setKey('FAST');
  293. setValue(state.value.FAST);
  294. }
  295. if (state.value.SLEEP) {
  296. setKey('SLEEP');
  297. setValue(state.value.SLEEP);
  298. }
  299. });
  300. }, []);
  301. function isMap(obj) {
  302. return obj instanceof Map;
  303. }
  304. function startFast() {
  305. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  306. type: 'START_FAST'
  307. });
  308. var start_time = new Date().getTime();
  309. var duration = 8 * 3600 * 1000;
  310. var extra = {
  311. set_time: start_time - 20 * 1000,
  312. confirm_time: start_time + 50 * 1000
  313. };
  314. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  315. action: 'FAST_START',
  316. real_check_time: start_time,
  317. target_duration: duration,
  318. extra: extra
  319. }).then(function (res) {
  320. console.log(res);
  321. });
  322. // dispatch(startFast());
  323. }
  324. function startSleep() {
  325. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  326. type: 'START_SLEEP'
  327. });
  328. var start_time = new Date().getTime();
  329. var duration = 8 * 3600 * 1000;
  330. var extra = {
  331. set_time: start_time - 20 * 1000,
  332. confirm_time: start_time + 50 * 1000
  333. };
  334. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  335. action: 'SLEEP_START',
  336. real_check_time: start_time,
  337. target_duration: duration,
  338. extra: extra
  339. }).then(function (res) {
  340. console.log(res);
  341. });
  342. // dispatch(startSleep());
  343. }
  344. function endSleep() {
  345. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  346. type: 'END_SLEEP'
  347. });
  348. var start_time = new Date().getTime();
  349. // const duration = 8 * 3600 * 1000;
  350. var extra = {
  351. set_time: start_time - 20 * 1000,
  352. confirm_time: start_time + 50 * 1000
  353. };
  354. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  355. action: 'SLEEP_END',
  356. real_check_time: start_time,
  357. extra: extra
  358. }).then(function (res) {
  359. console.log(res);
  360. });
  361. }
  362. function endFast() {
  363. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  364. type: 'END_FAST'
  365. });
  366. var start_time = new Date().getTime();
  367. // const duration = 8 * 3600 * 1000;
  368. var extra = {
  369. set_time: start_time - 20 * 1000,
  370. confirm_time: start_time + 50 * 1000
  371. };
  372. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  373. action: 'FAST_END',
  374. real_check_time: start_time,
  375. extra: extra
  376. }).then(function (res) {
  377. console.log(res);
  378. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  379. type: 'RESET'
  380. });
  381. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  382. type: __webpack_require__.g.scenario.name
  383. });
  384. });
  385. }
  386. function mixedBtns() {
  387. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  388. children: [(value == 'WAIT_FOR_START' || value == 'DONE') && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  389. onClick: startFast,
  390. children: "Start Fast"
  391. }), (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, {
  392. onClick: endFast,
  393. children: "End Fast"
  394. }), value == 'ONGOING1' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  395. onClick: startSleep,
  396. children: "Start Sleep"
  397. }), value == 'ONGOING2' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  398. onClick: endSleep,
  399. children: "End Sleep"
  400. })]
  401. });
  402. }
  403. function fastBtns() {
  404. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  405. children: value == 'ONGOING' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  406. onClick: endFast,
  407. children: "End Fast"
  408. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  409. onClick: startFast,
  410. children: "Start Fast"
  411. })
  412. });
  413. }
  414. function sleepBtns() {
  415. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  416. children: value == 'ONGOING' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  417. onClick: endSleep,
  418. children: "End Sleep"
  419. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  420. onClick: startSleep,
  421. children: "Start Sleep"
  422. })
  423. });
  424. }
  425. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  426. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  427. children: "Console Component"
  428. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  429. children: [key === 'FAST_SLEEP' && mixedBtns(), key === 'FAST' && fastBtns(), key === 'SLEEP' && sleepBtns()]
  430. })]
  431. });
  432. }
  433. /***/ }),
  434. /***/ "./src/features/trackTimeDuration/components/More.tsx":
  435. /*!************************************************************!*\
  436. !*** ./src/features/trackTimeDuration/components/More.tsx ***!
  437. \************************************************************/
  438. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  439. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  440. /* harmony export */ "default": function() { return /* binding */ Component; }
  441. /* harmony export */ });
  442. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  443. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  444. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
  445. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  446. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  447. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  448. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_2__);
  449. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  450. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_3__);
  451. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  452. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  453. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  454. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__);
  455. function Component() {
  456. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.useTranslation)(),
  457. t = _useTranslation.t;
  458. var scenario = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useSelector)(function (state) {
  459. return state.scenario;
  460. });
  461. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  462. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  463. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__.machine.context.currentStatus]);
  464. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  465. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].onTransition(function (state) {
  466. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  467. });
  468. }, []);
  469. function waitActionSheet() {
  470. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  471. itemList: [t('feature.track_time_duration.action_sheet.change_schedule'), t('feature.track_time_duration.action_sheet.switch_scenario')]
  472. }).then(function (res) {
  473. console.log(res.tapIndex);
  474. switch (res.tapIndex) {
  475. case 0:
  476. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  477. url: '/pages/SetSchedule'
  478. });
  479. break;
  480. case 1:
  481. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  482. url: '/pages/ChooseScenario'
  483. });
  484. break;
  485. }
  486. }).catch(function (err) {
  487. console.log(err.errMsg);
  488. });
  489. }
  490. function endFastActionSheet() {
  491. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  492. itemList: [t('feature.track_time_duration.action_sheet.end_fast')]
  493. }).then(function (res) {
  494. console.log(res.tapIndex);
  495. switch (res.tapIndex) {
  496. case 0:
  497. {
  498. var start_time = new Date().getTime();
  499. // const duration = 8 * 3600 * 1000;
  500. var extra = {
  501. set_time: start_time - 20 * 1000,
  502. confirm_time: start_time + 50 * 1000
  503. };
  504. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_5__.recordCheck)({
  505. action: 'FAST_END',
  506. real_check_time: start_time,
  507. extra: extra
  508. }).then(function (res) {
  509. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  510. type: 'END_FAST'
  511. });
  512. console.log(res);
  513. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  514. type: 'RESET'
  515. });
  516. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  517. type: __webpack_require__.g.scenario.name
  518. });
  519. });
  520. }
  521. break;
  522. }
  523. }).catch(function (err) {
  524. console.log(err.errMsg);
  525. });
  526. }
  527. function ongoingActionSheet() {
  528. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  529. itemList: [t('feature.track_time_duration.action_sheet.give_up'), t('feature.track_time_duration.action_sheet.switch_scenario')]
  530. }).then(function (res) {
  531. console.log(res.tapIndex);
  532. }).catch(function (err) {
  533. console.log(err.errMsg);
  534. });
  535. }
  536. function checkActionSheetData() {
  537. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  538. debugger;
  539. if (state.FAST_SLEEP === 'WAIT_FOR_START' || state.FAST === 'WAIT_FOR_START' || state.SLEEP === 'WAIT_FOR_START') {
  540. waitActionSheet();
  541. } else if (state.FAST_SLEEP === 'ONGOING1' || state.FAST_SLEEP === 'ONGOING2') {
  542. endFastActionSheet();
  543. } else if (state.FAST_SLEEP === 'ONGOING3') {
  544. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
  545. title: '暂无更多操作',
  546. icon: 'none',
  547. duration: 2000
  548. });
  549. }
  550. }
  551. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
  552. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
  553. onClick: checkActionSheetData,
  554. children: "More Component"
  555. })
  556. });
  557. }
  558. /***/ }),
  559. /***/ "./src/pages/Clock.tsx":
  560. /*!*****************************!*\
  561. !*** ./src/pages/Clock.tsx ***!
  562. \*****************************/
  563. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  564. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  565. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  566. /* 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");
  567. var config = {};
  568. 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 || {}))
  569. /* 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"]);
  570. /***/ }),
  571. /***/ "./src/store/trackTimeMachine.tsx":
  572. /*!****************************************!*\
  573. !*** ./src/store/trackTimeMachine.tsx ***!
  574. \****************************************/
  575. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  576. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  577. /* harmony export */ machine: function() { return /* binding */ machine; }
  578. /* harmony export */ });
  579. /* unused harmony exports setSpecifiedState, setSpecifiedStatus */
  580. /* 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");
  581. /* harmony import */ var xstate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! xstate */ "webpack/container/remote/xstate");
  582. /* harmony import */ var xstate__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(xstate__WEBPACK_IMPORTED_MODULE_0__);
  583. var machine = (0,xstate__WEBPACK_IMPORTED_MODULE_0__.createMachine)({
  584. id: "trackTime",
  585. initial: "choose",
  586. context: {
  587. currentStatus: ''
  588. },
  589. on: {
  590. RESET: {
  591. target: '.choose',
  592. actions: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)(function (_) {
  593. return {
  594. currentStatus: ''
  595. };
  596. })
  597. }
  598. },
  599. states: {
  600. choose: {
  601. on: {
  602. SLEEP: {
  603. target: "SLEEP"
  604. },
  605. FAST_SLEEP: {
  606. target: "FAST_SLEEP"
  607. },
  608. FAST: {
  609. target: "FAST"
  610. }
  611. }
  612. },
  613. SLEEP: {
  614. initial: "WAIT_FOR_START",
  615. states: {
  616. WAIT_FOR_START: {
  617. on: {
  618. START_SLEEP: {
  619. target: "ONGOING"
  620. }
  621. }
  622. },
  623. ONGOING: {
  624. on: {
  625. END_SLEEP: {
  626. target: "DONE"
  627. }
  628. }
  629. },
  630. DONE: {}
  631. }
  632. },
  633. FAST_SLEEP: {
  634. initial: "WAIT_FOR_START",
  635. states: {
  636. WAIT_FOR_START: {
  637. on: {
  638. START_FAST: {
  639. target: "ONGOING1"
  640. }
  641. }
  642. },
  643. ONGOING1: {
  644. on: {
  645. START_SLEEP: {
  646. target: "ONGOING2"
  647. },
  648. END_FAST: {
  649. target: "DONE"
  650. }
  651. }
  652. },
  653. ONGOING2: {
  654. on: {
  655. END_FAST: {
  656. target: "DONE"
  657. },
  658. END_SLEEP: {
  659. target: "ONGOING3"
  660. }
  661. }
  662. },
  663. DONE: {},
  664. ONGOING3: {
  665. on: {
  666. END_FAST: {
  667. target: "DONE"
  668. }
  669. }
  670. }
  671. }
  672. },
  673. FAST: {
  674. initial: "WAIT_FOR_START",
  675. states: {
  676. WAIT_FOR_START: {
  677. on: {
  678. START_FAST: {
  679. target: "ONGOING"
  680. }
  681. }
  682. },
  683. ONGOING: {
  684. on: {
  685. END_FAST: {
  686. target: "DONE"
  687. }
  688. }
  689. },
  690. DONE: {}
  691. }
  692. }
  693. },
  694. schema: {
  695. events: {}
  696. },
  697. predictableActionArguments: true,
  698. preserveActionOrder: true
  699. }, {
  700. actions: {
  701. apple: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({}),
  702. setCurrentStatus: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)(function (context, event) {
  703. return {
  704. currentStatus: event.type
  705. };
  706. })
  707. },
  708. services: {},
  709. guards: {},
  710. delays: {}
  711. });
  712. var setSpecifiedState = function setSpecifiedState(currentState, specifiedState) {
  713. return (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({
  714. 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), {}, {
  715. value: specifiedState
  716. })
  717. });
  718. };
  719. var setSpecifiedStatus = function setSpecifiedStatus(currentState, specifiedState) {
  720. return (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({
  721. machine: {
  722. currentState: currentState,
  723. specifiedState: specifiedState
  724. }
  725. });
  726. };
  727. var service = (0,xstate__WEBPACK_IMPORTED_MODULE_0__.interpret)(machine).start();
  728. // const service = machine.withContext(initialContext).start();
  729. /* harmony default export */ __webpack_exports__["default"] = (service);
  730. /***/ })
  731. },
  732. /******/ function(__webpack_require__) { // webpackRuntimeModules
  733. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  734. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/Clock.tsx"); });
  735. /******/ var __webpack_exports__ = __webpack_require__.O();
  736. /******/ }
  737. ]);
  738. //# sourceMappingURL=Clock.js.map