ChooseScenario.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. "use strict";
  2. (wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/ChooseScenario"],{
  3. /***/ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/ChooseScenario.tsx":
  4. /*!***********************************************************************************************************!*\
  5. !*** ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/ChooseScenario.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 */ Page; }
  10. /* harmony export */ });
  11. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  12. /* harmony import */ var _features_trackTimeDuration_components_ChooseScenario__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @features/trackTimeDuration/components/ChooseScenario */ "./src/features/trackTimeDuration/components/ChooseScenario.tsx");
  13. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  14. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
  15. function Page() {
  16. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_2__.View, {
  17. className: "container",
  18. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_features_trackTimeDuration_components_ChooseScenario__WEBPACK_IMPORTED_MODULE_0__["default"], {})
  19. });
  20. }
  21. /***/ }),
  22. /***/ "./src/components/Footer.tsx":
  23. /*!***********************************!*\
  24. !*** ./src/components/Footer.tsx ***!
  25. \***********************************/
  26. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  27. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  28. /* harmony export */ "default": function() { return /* binding */ Component; }
  29. /* harmony export */ });
  30. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  31. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  32. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  33. function Component(props) {
  34. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_1__.View, {
  35. className: "footer1",
  36. children: props.child
  37. });
  38. }
  39. /***/ }),
  40. /***/ "./src/features/trackTimeDuration/components/ChooseScenario.tsx":
  41. /*!**********************************************************************!*\
  42. !*** ./src/features/trackTimeDuration/components/ChooseScenario.tsx ***!
  43. \**********************************************************************/
  44. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  45. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  46. /* harmony export */ "default": function() { return /* binding */ Component; }
  47. /* harmony export */ });
  48. /* harmony import */ var _Users_Work_taro_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
  49. /* harmony import */ var _Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  50. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  51. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @components/Buttons */ "./src/components/Buttons.tsx");
  52. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @components/Texts */ "./src/components/Texts.tsx");
  53. /* harmony import */ var _components_Rings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @components/Rings */ "./src/components/Rings.weapp.tsx");
  54. /* harmony import */ var _components_Footer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @components/Footer */ "./src/components/Footer.tsx");
  55. /* harmony import */ var _components_SingleSelect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../components/SingleSelect */ "./src/components/SingleSelect.tsx");
  56. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @utils/types */ "./src/utils/types.ts");
  57. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  58. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_6__);
  59. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  60. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__);
  61. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  62. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_8__);
  63. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  64. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_9__);
  65. /* harmony import */ var _store_scenario__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/store/scenario */ "./src/store/scenario.tsx");
  66. /* harmony import */ var _services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/services/trackTimeDuration */ "./src/services/trackTimeDuration.tsx");
  67. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  68. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__);
  69. function Component() {
  70. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.useTranslation)(),
  71. t = _useTranslation.t;
  72. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_9__.useDispatch)();
  73. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(0),
  74. _useState2 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_13__["default"])(_useState, 2),
  75. selIndex = _useState2[0],
  76. setSelIndex = _useState2[1];
  77. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)([]),
  78. _useState4 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_13__["default"])(_useState3, 2),
  79. scenarios = _useState4[0],
  80. setScenarios = _useState4[1];
  81. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_8__.useReady)(function () {
  82. (0,_services_trackTimeDuration__WEBPACK_IMPORTED_MODULE_11__.getPlans)().then(function (res) {
  83. var data = res;
  84. setScenarios(data.scenarios);
  85. });
  86. });
  87. function next() {
  88. console.log(scenarios);
  89. _tarojs_taro__WEBPACK_IMPORTED_MODULE_8___default().navigateTo({
  90. url: '/pages/SetSchedule?scenario=' + JSON.stringify(scenarios[selIndex])
  91. });
  92. }
  93. function footerContent() {
  94. var style = {};
  95. switch (selIndex) {
  96. case 0:
  97. style = {
  98. backgroundColor: '#AAFF00'
  99. };
  100. break;
  101. case 1:
  102. style = {
  103. backgroundColor: '#00FFFF'
  104. };
  105. break;
  106. case 2:
  107. style = {
  108. background: 'linear-gradient(to right, #AAFF00, #00FFFF)'
  109. };
  110. break;
  111. }
  112. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  113. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_0__["default"], {
  114. title: "Next",
  115. onClick: next,
  116. style: (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_15__["default"])((0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_15__["default"])({}, style), {}, {
  117. width: 320
  118. })
  119. })
  120. });
  121. }
  122. function items() {
  123. var array = [];
  124. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  125. className: "item_row",
  126. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  127. radius: 33,
  128. strokeWidth: 8,
  129. color: "#AAFF00",
  130. canvasId: "0"
  131. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  132. className: "item_txt_bg",
  133. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.Text, {
  134. className: "item_txt",
  135. style: {
  136. color: '#AAFF00'
  137. },
  138. children: t('page.choose_scenario.fast')
  139. })
  140. })]
  141. }));
  142. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  143. className: "item_row",
  144. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  145. radius: 33,
  146. strokeWidth: 8,
  147. color: "#00FFFF",
  148. canvasId: "1"
  149. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  150. className: "item_txt_bg",
  151. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.Text, {
  152. className: "item_txt",
  153. style: {
  154. color: '#00FFFF'
  155. },
  156. children: t('page.choose_scenario.sleep')
  157. })
  158. })]
  159. }));
  160. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  161. className: "item_row",
  162. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  163. style: {
  164. position: 'relative',
  165. zIndex: 1
  166. },
  167. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  168. radius: 33,
  169. strokeWidth: 8,
  170. color: "#AAFF00",
  171. canvasId: "3"
  172. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  173. style: {
  174. display: 'flex',
  175. position: 'absolute',
  176. left: 0,
  177. right: 0,
  178. top: 0,
  179. bottom: 0,
  180. alignItems: 'center',
  181. justifyContent: 'center'
  182. },
  183. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  184. radius: 23,
  185. strokeWidth: 6,
  186. color: "#00FFFF",
  187. canvasId: "4"
  188. })
  189. })]
  190. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  191. className: "item_txt_bg",
  192. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.Text, {
  193. className: "item_txt",
  194. style: {
  195. color: '#00FFFF'
  196. },
  197. children: t('page.choose_scenario.fast_sleep')
  198. })
  199. })]
  200. }));
  201. return array;
  202. }
  203. function handleItemSelect(index) {
  204. console.log('handleItemSelect', index);
  205. setSelIndex(index);
  206. dispatch((0,_store_scenario__WEBPACK_IMPORTED_MODULE_10__.setScenario)(scenarios[index].scenario));
  207. }
  208. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  209. className: "container",
  210. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_1__["default"], {
  211. text: t('page.choose_scenario.title'),
  212. type: _utils_types__WEBPACK_IMPORTED_MODULE_5__.TextType.primary
  213. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_1__["default"], {
  214. text: t('page.choose_scenario.sub_title'),
  215. type: _utils_types__WEBPACK_IMPORTED_MODULE_5__.TextType.secondary
  216. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  217. style: {
  218. height: 20
  219. }
  220. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_14__.View, {
  221. style: {
  222. position: 'relative',
  223. zIndex: 1
  224. },
  225. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_SingleSelect__WEBPACK_IMPORTED_MODULE_4__["default"], {
  226. items: items(),
  227. itemSelect: handleItemSelect
  228. })
  229. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_12__.jsx)(_components_Footer__WEBPACK_IMPORTED_MODULE_3__["default"], {
  230. child: footerContent()
  231. })]
  232. });
  233. }
  234. /***/ }),
  235. /***/ "./src/pages/ChooseScenario.tsx":
  236. /*!**************************************!*\
  237. !*** ./src/pages/ChooseScenario.tsx ***!
  238. \**************************************/
  239. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  240. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  241. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  242. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_ChooseScenario_tsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./ChooseScenario.tsx */ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/ChooseScenario.tsx");
  243. var config = {};
  244. var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__.createPageConfig)(_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_ChooseScenario_tsx__WEBPACK_IMPORTED_MODULE_1__["default"], 'pages/ChooseScenario', {root:{cn:[]}}, config || {}))
  245. /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_ChooseScenario_tsx__WEBPACK_IMPORTED_MODULE_1__["default"]);
  246. /***/ })
  247. },
  248. /******/ function(__webpack_require__) { // webpackRuntimeModules
  249. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  250. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/ChooseScenario.tsx"); });
  251. /******/ var __webpack_exports__ = __webpack_require__.O();
  252. /******/ }
  253. ]);
  254. //# sourceMappingURL=ChooseScenario.js.map