Clock.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  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\u53F7"
  201. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  202. children: "\u5DF2\u5173\u6CE8"
  203. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Button, {
  204. onClick: function onClick() {
  205. return goDetail();
  206. },
  207. children: "go detail"
  208. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  209. className: "login",
  210. onClick: function onClick() {
  211. return login();
  212. },
  213. children: "sss"
  214. }), /*#__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"], {})]
  215. });
  216. }
  217. /***/ }),
  218. /***/ "./src/features/trackTimeDuration/components/Clock.tsx":
  219. /*!*************************************************************!*\
  220. !*** ./src/features/trackTimeDuration/components/Clock.tsx ***!
  221. \*************************************************************/
  222. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  223. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  224. /* harmony export */ "default": function() { return /* binding */ Component; }
  225. /* harmony export */ });
  226. /* harmony import */ var _components_Rings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Rings */ "./src/components/Rings.weapp.tsx");
  227. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  228. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  229. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
  230. function Component() {
  231. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
  232. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_0__["default"], {
  233. radius: 50
  234. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.Text, {
  235. children: "Clock Component"
  236. })]
  237. });
  238. }
  239. /***/ }),
  240. /***/ "./src/features/trackTimeDuration/components/Console.tsx":
  241. /*!***************************************************************!*\
  242. !*** ./src/features/trackTimeDuration/components/Console.tsx ***!
  243. \***************************************************************/
  244. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  245. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  246. /* harmony export */ "default": function() { return /* binding */ Component; }
  247. /* harmony export */ });
  248. /* 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");
  249. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  250. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  251. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  252. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  253. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
  254. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  255. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__);
  256. function Component() {
  257. // const [current,send] = useService(machine)
  258. // const currentState = trackTimeService.getSnapshot();
  259. // console.log(currentState.value);
  260. // debugger
  261. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(''),
  262. _useState2 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState, 2),
  263. key = _useState2[0],
  264. setKey = _useState2[1];
  265. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(''),
  266. _useState4 = (0,_Users_Work_hola_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState3, 2),
  267. value = _useState4[0],
  268. setValue = _useState4[1];
  269. (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
  270. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].getSnapshot().value;
  271. if (state.FAST_SLEEP) {
  272. setKey('FAST_SLEEP');
  273. setValue(state.FAST_SLEEP);
  274. }
  275. if (state.FAST) {
  276. setKey('FAST');
  277. setValue(state.FAST);
  278. }
  279. if (state.SLEEP) {
  280. setKey('SLEEP');
  281. setValue(state.SLEEP);
  282. }
  283. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__.machine.context.currentStatus]);
  284. (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(function () {
  285. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].onTransition(function (state) {
  286. // console.log(state.value);
  287. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].getSnapshot().value;
  288. // console.log('aaa:'+JSON.parse(JSON.stringify(value)));
  289. if (state.value.FAST_SLEEP) {
  290. setKey('FAST_SLEEP');
  291. setValue(state.value.FAST_SLEEP);
  292. }
  293. if (state.value.FAST) {
  294. setKey('FAST');
  295. setValue(state.value.FAST);
  296. }
  297. if (state.value.SLEEP) {
  298. setKey('SLEEP');
  299. setValue(state.value.SLEEP);
  300. }
  301. });
  302. }, []);
  303. function isMap(obj) {
  304. return obj instanceof Map;
  305. }
  306. function startFast() {
  307. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  308. type: 'START_FAST'
  309. });
  310. var start_time = new Date().getTime();
  311. var duration = 8 * 3600 * 1000;
  312. var extra = {
  313. set_time: start_time - 20 * 1000,
  314. confirm_time: start_time + 50 * 1000
  315. };
  316. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  317. action: 'FAST_START',
  318. real_check_time: start_time,
  319. target_duration: duration,
  320. extra: extra
  321. }).then(function (res) {
  322. console.log(res);
  323. });
  324. // dispatch(startFast());
  325. }
  326. function startSleep() {
  327. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  328. type: 'START_SLEEP'
  329. });
  330. var start_time = new Date().getTime();
  331. var duration = 8 * 3600 * 1000;
  332. var extra = {
  333. set_time: start_time - 20 * 1000,
  334. confirm_time: start_time + 50 * 1000
  335. };
  336. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  337. action: 'SLEEP_START',
  338. real_check_time: start_time,
  339. target_duration: duration,
  340. extra: extra
  341. }).then(function (res) {
  342. console.log(res);
  343. });
  344. // dispatch(startSleep());
  345. }
  346. function endSleep() {
  347. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  348. type: 'END_SLEEP'
  349. });
  350. var start_time = new Date().getTime();
  351. // const duration = 8 * 3600 * 1000;
  352. var extra = {
  353. set_time: start_time - 20 * 1000,
  354. confirm_time: start_time + 50 * 1000
  355. };
  356. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  357. action: 'SLEEP_END',
  358. real_check_time: start_time,
  359. extra: extra
  360. }).then(function (res) {
  361. console.log(res);
  362. });
  363. }
  364. function endFast() {
  365. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  366. type: 'END_FAST'
  367. });
  368. var start_time = new Date().getTime();
  369. // const duration = 8 * 3600 * 1000;
  370. var extra = {
  371. set_time: start_time - 20 * 1000,
  372. confirm_time: start_time + 50 * 1000
  373. };
  374. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_0__.recordCheck)({
  375. action: 'FAST_END',
  376. real_check_time: start_time,
  377. extra: extra
  378. }).then(function (res) {
  379. console.log(res);
  380. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  381. type: 'RESET'
  382. });
  383. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_1__["default"].send({
  384. type: __webpack_require__.g.scenario.name
  385. });
  386. });
  387. }
  388. function mixedBtns() {
  389. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  390. children: [(value == 'WAIT_FOR_START' || value == 'DONE') && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  391. onClick: startFast,
  392. children: "Start Fast"
  393. }), (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, {
  394. onClick: endFast,
  395. children: "End Fast"
  396. }), value == 'ONGOING1' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  397. onClick: startSleep,
  398. children: "Start Sleep"
  399. }), value == 'ONGOING2' && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  400. onClick: endSleep,
  401. children: "End Sleep"
  402. })]
  403. });
  404. }
  405. function fastBtns() {
  406. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  407. children: value == 'ONGOING' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  408. onClick: endFast,
  409. children: "End Fast"
  410. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  411. onClick: startFast,
  412. children: "Start Fast"
  413. })
  414. });
  415. }
  416. function sleepBtns() {
  417. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  418. children: value == 'ONGOING' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  419. onClick: endSleep,
  420. children: "End Sleep"
  421. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  422. onClick: startSleep,
  423. children: "Start Sleep"
  424. })
  425. });
  426. }
  427. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  428. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.Text, {
  429. children: "Console Component"
  430. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_5__.View, {
  431. children: [key === 'FAST_SLEEP' && mixedBtns(), key === 'FAST' && fastBtns(), key === 'SLEEP' && sleepBtns()]
  432. })]
  433. });
  434. }
  435. /***/ }),
  436. /***/ "./src/features/trackTimeDuration/components/More.tsx":
  437. /*!************************************************************!*\
  438. !*** ./src/features/trackTimeDuration/components/More.tsx ***!
  439. \************************************************************/
  440. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  441. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  442. /* harmony export */ "default": function() { return /* binding */ Component; }
  443. /* harmony export */ });
  444. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  445. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  446. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
  447. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  448. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  449. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  450. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_2__);
  451. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  452. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_3__);
  453. /* harmony import */ var _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/store/trackTimeMachine */ "./src/store/trackTimeMachine.tsx");
  454. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  455. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  456. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__);
  457. function Component() {
  458. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.useTranslation)(),
  459. t = _useTranslation.t;
  460. var scenario = (0,react_redux__WEBPACK_IMPORTED_MODULE_3__.useSelector)(function (state) {
  461. return state.scenario;
  462. });
  463. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  464. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  465. }, [_store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__.machine.context.currentStatus]);
  466. (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () {
  467. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].onTransition(function (state) {
  468. var value = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  469. });
  470. }, []);
  471. function waitActionSheet() {
  472. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  473. itemList: [t('feature.track_time_duration.action_sheet.change_schedule'), t('feature.track_time_duration.action_sheet.switch_scenario')]
  474. }).then(function (res) {
  475. console.log(res.tapIndex);
  476. switch (res.tapIndex) {
  477. case 0:
  478. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  479. url: '/pages/SetSchedule'
  480. });
  481. break;
  482. case 1:
  483. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().navigateTo({
  484. url: '/pages/ChooseScenario'
  485. });
  486. break;
  487. }
  488. }).catch(function (err) {
  489. console.log(err.errMsg);
  490. });
  491. }
  492. function endFastActionSheet() {
  493. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  494. itemList: [t('feature.track_time_duration.action_sheet.end_fast')]
  495. }).then(function (res) {
  496. console.log(res.tapIndex);
  497. switch (res.tapIndex) {
  498. case 0:
  499. {
  500. var start_time = new Date().getTime();
  501. // const duration = 8 * 3600 * 1000;
  502. var extra = {
  503. set_time: start_time - 20 * 1000,
  504. confirm_time: start_time + 50 * 1000
  505. };
  506. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_5__.recordCheck)({
  507. action: 'FAST_END',
  508. real_check_time: start_time,
  509. extra: extra
  510. }).then(function (res) {
  511. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  512. type: 'END_FAST'
  513. });
  514. console.log(res);
  515. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  516. type: 'RESET'
  517. });
  518. _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].send({
  519. type: __webpack_require__.g.scenario.name
  520. });
  521. });
  522. }
  523. break;
  524. }
  525. }).catch(function (err) {
  526. console.log(err.errMsg);
  527. });
  528. }
  529. function ongoingActionSheet() {
  530. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showActionSheet({
  531. itemList: [t('feature.track_time_duration.action_sheet.give_up'), t('feature.track_time_duration.action_sheet.switch_scenario')]
  532. }).then(function (res) {
  533. console.log(res.tapIndex);
  534. }).catch(function (err) {
  535. console.log(err.errMsg);
  536. });
  537. }
  538. function checkActionSheetData() {
  539. var state = _store_trackTimeMachine__WEBPACK_IMPORTED_MODULE_4__["default"].getSnapshot().value;
  540. debugger;
  541. if (state.FAST_SLEEP === 'WAIT_FOR_START' || state.FAST === 'WAIT_FOR_START' || state.SLEEP === 'WAIT_FOR_START') {
  542. waitActionSheet();
  543. } else if (state.FAST_SLEEP === 'ONGOING1' || state.FAST_SLEEP === 'ONGOING2') {
  544. endFastActionSheet();
  545. } else if (state.FAST_SLEEP === 'ONGOING3') {
  546. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().showToast({
  547. title: '暂无更多操作',
  548. icon: 'none',
  549. duration: 2000
  550. });
  551. }
  552. }
  553. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.View, {
  554. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_7__.Text, {
  555. onClick: checkActionSheetData,
  556. children: "More Component"
  557. })
  558. });
  559. }
  560. /***/ }),
  561. /***/ "./src/pages/Clock.tsx":
  562. /*!*****************************!*\
  563. !*** ./src/pages/Clock.tsx ***!
  564. \*****************************/
  565. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  566. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  567. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  568. /* 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");
  569. var config = {};
  570. 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 || {}))
  571. /* 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"]);
  572. /***/ }),
  573. /***/ "./src/store/trackTimeMachine.tsx":
  574. /*!****************************************!*\
  575. !*** ./src/store/trackTimeMachine.tsx ***!
  576. \****************************************/
  577. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  578. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  579. /* harmony export */ machine: function() { return /* binding */ machine; }
  580. /* harmony export */ });
  581. /* unused harmony exports setSpecifiedState, setSpecifiedStatus */
  582. /* 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");
  583. /* harmony import */ var xstate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! xstate */ "webpack/container/remote/xstate");
  584. /* harmony import */ var xstate__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(xstate__WEBPACK_IMPORTED_MODULE_0__);
  585. var machine = (0,xstate__WEBPACK_IMPORTED_MODULE_0__.createMachine)({
  586. id: "trackTime",
  587. initial: "choose",
  588. context: {
  589. currentStatus: ''
  590. },
  591. on: {
  592. RESET: {
  593. target: '.choose',
  594. actions: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)(function (_) {
  595. return {
  596. currentStatus: ''
  597. };
  598. })
  599. }
  600. },
  601. states: {
  602. choose: {
  603. on: {
  604. SLEEP: {
  605. target: "SLEEP"
  606. },
  607. FAST_SLEEP: {
  608. target: "FAST_SLEEP"
  609. },
  610. FAST: {
  611. target: "FAST"
  612. }
  613. }
  614. },
  615. SLEEP: {
  616. initial: "WAIT_FOR_START",
  617. states: {
  618. WAIT_FOR_START: {
  619. on: {
  620. START_SLEEP: {
  621. target: "ONGOING"
  622. }
  623. }
  624. },
  625. ONGOING: {
  626. on: {
  627. END_SLEEP: {
  628. target: "DONE"
  629. }
  630. }
  631. },
  632. DONE: {}
  633. }
  634. },
  635. FAST_SLEEP: {
  636. initial: "WAIT_FOR_START",
  637. states: {
  638. WAIT_FOR_START: {
  639. on: {
  640. START_FAST: {
  641. target: "ONGOING1"
  642. }
  643. }
  644. },
  645. ONGOING1: {
  646. on: {
  647. START_SLEEP: {
  648. target: "ONGOING2"
  649. },
  650. END_FAST: {
  651. target: "DONE"
  652. }
  653. }
  654. },
  655. ONGOING2: {
  656. on: {
  657. END_FAST: {
  658. target: "DONE"
  659. },
  660. END_SLEEP: {
  661. target: "ONGOING3"
  662. }
  663. }
  664. },
  665. DONE: {},
  666. ONGOING3: {
  667. on: {
  668. END_FAST: {
  669. target: "DONE"
  670. }
  671. }
  672. }
  673. }
  674. },
  675. FAST: {
  676. initial: "WAIT_FOR_START",
  677. states: {
  678. WAIT_FOR_START: {
  679. on: {
  680. START_FAST: {
  681. target: "ONGOING"
  682. }
  683. }
  684. },
  685. ONGOING: {
  686. on: {
  687. END_FAST: {
  688. target: "DONE"
  689. }
  690. }
  691. },
  692. DONE: {}
  693. }
  694. }
  695. },
  696. schema: {
  697. events: {}
  698. },
  699. predictableActionArguments: true,
  700. preserveActionOrder: true
  701. }, {
  702. actions: {
  703. apple: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({}),
  704. setCurrentStatus: (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)(function (context, event) {
  705. return {
  706. currentStatus: event.type
  707. };
  708. })
  709. },
  710. services: {},
  711. guards: {},
  712. delays: {}
  713. });
  714. var setSpecifiedState = function setSpecifiedState(currentState, specifiedState) {
  715. return (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({
  716. 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), {}, {
  717. value: specifiedState
  718. })
  719. });
  720. };
  721. var setSpecifiedStatus = function setSpecifiedStatus(currentState, specifiedState) {
  722. return (0,xstate__WEBPACK_IMPORTED_MODULE_0__.assign)({
  723. machine: {
  724. currentState: currentState,
  725. specifiedState: specifiedState
  726. }
  727. });
  728. };
  729. var service = (0,xstate__WEBPACK_IMPORTED_MODULE_0__.interpret)(machine).start();
  730. // const service = machine.withContext(initialContext).start();
  731. /* harmony default export */ __webpack_exports__["default"] = (service);
  732. /***/ })
  733. },
  734. /******/ function(__webpack_require__) { // webpackRuntimeModules
  735. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  736. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/Clock.tsx"); });
  737. /******/ var __webpack_exports__ = __webpack_require__.O();
  738. /******/ }
  739. ]);
  740. //# sourceMappingURL=Clock.js.map