ChooseScenario.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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_hola2_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");
  49. /* harmony import */ var _Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__ = __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_13__ = __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 _services_http_request__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @services/http/request */ "./src/services/http/request.ts");
  60. /* harmony import */ var _services_http_api__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @services/http/api */ "./src/services/http/api.js");
  61. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  62. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_9__);
  63. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  64. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_10__);
  65. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  66. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__);
  67. function Component() {
  68. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.useTranslation)(),
  69. t = _useTranslation.t;
  70. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_9__.useState)(0),
  71. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState, 2),
  72. selIndex = _useState2[0],
  73. setSelIndex = _useState2[1];
  74. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_9__.useState)([]),
  75. _useState4 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState3, 2),
  76. scenarios = _useState4[0],
  77. setScenarios = _useState4[1];
  78. (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_10__.useReady)(function () {
  79. (0,_services_http_request__WEBPACK_IMPORTED_MODULE_7__.request)({
  80. url: _services_http_api__WEBPACK_IMPORTED_MODULE_8__.API_FAST_PLANS,
  81. method: 'GET',
  82. data: {}
  83. }).then(function (res) {
  84. var data = res;
  85. setScenarios(data.scenarios);
  86. });
  87. });
  88. function next() {
  89. console.log(scenarios);
  90. _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default().navigateTo({
  91. url: '/pages/SetSchedule?scenario=' + JSON.stringify(scenarios[selIndex])
  92. });
  93. }
  94. function footerContent() {
  95. var style = {};
  96. switch (selIndex) {
  97. case 0:
  98. style = {
  99. backgroundColor: '#AAFF00'
  100. };
  101. break;
  102. case 1:
  103. style = {
  104. backgroundColor: '#00FFFF'
  105. };
  106. break;
  107. case 2:
  108. style = {
  109. background: 'linear-gradient(to right, #AAFF00, #00FFFF)'
  110. };
  111. break;
  112. }
  113. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  114. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_0__["default"], {
  115. title: "Next",
  116. onClick: next,
  117. style: (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_14__["default"])((0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_14__["default"])({}, style), {}, {
  118. width: 320
  119. })
  120. })
  121. });
  122. }
  123. function items() {
  124. var array = [];
  125. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  126. className: "item_row",
  127. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  128. radius: 33,
  129. strokeWidth: 8,
  130. color: "#AAFF00",
  131. canvasId: "0"
  132. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  133. className: "item_txt_bg",
  134. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  135. className: "item_txt",
  136. style: {
  137. color: '#AAFF00'
  138. },
  139. children: t('page.choose_scenario.fast')
  140. })
  141. })]
  142. }));
  143. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  144. className: "item_row",
  145. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  146. radius: 33,
  147. strokeWidth: 8,
  148. color: "#00FFFF",
  149. canvasId: "1"
  150. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  151. className: "item_txt_bg",
  152. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  153. className: "item_txt",
  154. style: {
  155. color: '#00FFFF'
  156. },
  157. children: t('page.choose_scenario.sleep')
  158. })
  159. })]
  160. }));
  161. array.push( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  162. className: "item_row",
  163. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  164. style: {
  165. position: 'relative',
  166. zIndex: 1
  167. },
  168. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  169. radius: 33,
  170. strokeWidth: 8,
  171. color: "#AAFF00",
  172. canvasId: "3"
  173. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  174. style: {
  175. display: 'flex',
  176. position: 'absolute',
  177. left: 0,
  178. right: 0,
  179. top: 0,
  180. bottom: 0,
  181. alignItems: 'center',
  182. justifyContent: 'center'
  183. },
  184. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Rings__WEBPACK_IMPORTED_MODULE_2__["default"], {
  185. radius: 23,
  186. strokeWidth: 6,
  187. color: "#00FFFF",
  188. canvasId: "4"
  189. })
  190. })]
  191. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  192. className: "item_txt_bg",
  193. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  194. className: "item_txt",
  195. style: {
  196. color: '#00FFFF'
  197. },
  198. children: t('page.choose_scenario.fast_sleep')
  199. })
  200. })]
  201. }));
  202. return array;
  203. }
  204. function handleItemSelect(index) {
  205. console.log('handleItemSelect', index);
  206. setSelIndex(index);
  207. }
  208. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  209. className: "container",
  210. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.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_11__.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_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  217. style: {
  218. height: 20
  219. }
  220. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  221. style: {
  222. position: 'relative',
  223. zIndex: 1
  224. },
  225. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_SingleSelect__WEBPACK_IMPORTED_MODULE_4__["default"], {
  226. items: items(),
  227. itemSelect: handleItemSelect
  228. })
  229. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.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