Auth.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. "use strict";
  2. (wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/Auth"],{
  3. /***/ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/Auth.tsx":
  4. /*!*************************************************************************************************!*\
  5. !*** ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/Auth.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_taro__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  12. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__);
  13. /* harmony import */ var _features_auth_components_Auth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @features/auth/components/Auth */ "./src/features/auth/components/Auth.tsx");
  14. /* harmony import */ var _features_auth_components_CreatePassword__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @features/auth/components/CreatePassword */ "./src/features/auth/components/CreatePassword.tsx");
  15. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  16. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  17. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__);
  18. function Page() {
  19. var router = (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_0__.useRouter)();
  20. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_4__.View, {
  21. style: {
  22. backgroundColor: '#000'
  23. },
  24. children: router.params.type === 'createPassword' ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_features_auth_components_CreatePassword__WEBPACK_IMPORTED_MODULE_2__["default"], {}) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_features_auth_components_Auth__WEBPACK_IMPORTED_MODULE_1__["default"], {})
  25. });
  26. }
  27. /***/ }),
  28. /***/ "./src/components/Box.tsx":
  29. /*!********************************!*\
  30. !*** ./src/components/Box.tsx ***!
  31. \********************************/
  32. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  33. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  34. /* harmony export */ "default": function() { return /* binding */ Component; }
  35. /* harmony export */ });
  36. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  37. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  38. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  39. function Component(props) {
  40. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_1__.View, {
  41. className: "box-container",
  42. children: props.child
  43. });
  44. }
  45. /***/ }),
  46. /***/ "./src/components/Inputs.tsx":
  47. /*!***********************************!*\
  48. !*** ./src/components/Inputs.tsx ***!
  49. \***********************************/
  50. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  51. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  52. /* harmony export */ "default": function() { return /* binding */ Component; }
  53. /* harmony export */ });
  54. /* harmony import */ var _Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  55. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  56. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  57. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  58. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  59. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
  60. function Component(_ref) {
  61. var placeholder = _ref.placeholder,
  62. value = _ref.value,
  63. onChange = _ref.onChange,
  64. disabled = _ref.disabled,
  65. isSecure = _ref.isSecure;
  66. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(value ? value : ''),
  67. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_useState, 2),
  68. inputValue = _useState2[0],
  69. setInputValue = _useState2[1];
  70. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
  71. _useState4 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(_useState3, 2),
  72. isFocus = _useState4[0],
  73. setIsFocus = _useState4[1];
  74. var handleInputChange = function handleInputChange(e) {
  75. var newValue = e.target.value;
  76. setInputValue(newValue);
  77. onChange(newValue);
  78. };
  79. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
  80. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.Input, {
  81. className: isFocus ? "input input_focus" : "input",
  82. placeholder: placeholder ? placeholder : '',
  83. value: inputValue,
  84. type: isSecure ? 'password' : 'text',
  85. onInput: handleInputChange,
  86. disabled: disabled ? disabled : false,
  87. onFocus: function onFocus() {
  88. setIsFocus(true);
  89. },
  90. onBlur: function onBlur() {
  91. setIsFocus(false);
  92. }
  93. })
  94. });
  95. }
  96. /***/ }),
  97. /***/ "./src/features/auth/components/Auth.tsx":
  98. /*!***********************************************!*\
  99. !*** ./src/features/auth/components/Auth.tsx ***!
  100. \***********************************************/
  101. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  102. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  103. /* harmony export */ "default": function() { return /* binding */ Auth; }
  104. /* harmony export */ });
  105. /* harmony import */ var _Users_Work_hola2_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");
  106. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  107. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  108. /* harmony import */ var _Login__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Login */ "./src/features/auth/components/Login.tsx");
  109. /* harmony import */ var _CreateAccount__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CreateAccount */ "./src/features/auth/components/CreateAccount.tsx");
  110. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  111. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__);
  112. function Auth() {
  113. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true),
  114. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState, 2),
  115. isSignup = _useState2[0],
  116. setIsSignup = _useState2[1];
  117. if (isSignup) return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_CreateAccount__WEBPACK_IMPORTED_MODULE_2__["default"], {
  118. login: function login() {
  119. return setIsSignup(false);
  120. }
  121. });
  122. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_Login__WEBPACK_IMPORTED_MODULE_1__["default"], {
  123. register: function register() {
  124. return setIsSignup(true);
  125. }
  126. });
  127. }
  128. /***/ }),
  129. /***/ "./src/features/auth/components/CreateAccount.tsx":
  130. /*!********************************************************!*\
  131. !*** ./src/features/auth/components/CreateAccount.tsx ***!
  132. \********************************************************/
  133. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  134. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  135. /* harmony export */ "default": function() { return /* binding */ Component; }
  136. /* harmony export */ });
  137. /* harmony import */ var _Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  138. /* harmony import */ var _components_Box__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Box */ "./src/components/Box.tsx");
  139. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/Buttons */ "./src/components/Buttons.tsx");
  140. /* harmony import */ var _components_Inputs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/Inputs */ "./src/components/Inputs.tsx");
  141. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/Texts */ "./src/components/Texts.tsx");
  142. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/types */ "./src/utils/types.ts");
  143. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  144. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  145. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_5__);
  146. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  147. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
  148. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  149. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_7__);
  150. /* harmony import */ var _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @assets/svg/check.svg */ "./src/assets/svg/check.svg");
  151. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  152. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__);
  153. function Component(props) {
  154. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_7__.useTranslation)(),
  155. t = _useTranslation.t;
  156. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''),
  157. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__["default"])(_useState, 2),
  158. name = _useState2[0],
  159. setName = _useState2[1];
  160. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''),
  161. _useState4 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_10__["default"])(_useState3, 2),
  162. email = _useState4[0],
  163. setEmail = _useState4[1];
  164. var handleNameChange = function handleNameChange(value) {
  165. setName(value);
  166. };
  167. var handleEmailChange = function handleEmailChange(value) {
  168. setEmail(value);
  169. };
  170. var isButtonDisabled = name === '' || email === '';
  171. function signupComponent() {
  172. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  173. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_2__["default"], {
  174. value: name,
  175. onChange: handleNameChange,
  176. placeholder: t('feature.auth.create_account.input_username_placeholder')
  177. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  178. style: {
  179. height: 20
  180. }
  181. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_2__["default"], {
  182. value: email,
  183. onChange: handleEmailChange,
  184. placeholder: t('feature.auth.create_account.input_email_placeholder')
  185. })]
  186. });
  187. }
  188. function registerF() {
  189. if (isButtonDisabled) {
  190. return;
  191. }
  192. setTimeout(function () {
  193. _tarojs_taro__WEBPACK_IMPORTED_MODULE_5___default().navigateTo({
  194. url: "/pages/Auth?type=createPassword&name=".concat(name, "&email=").concat(email)
  195. });
  196. }, 1000);
  197. // setTimeout(() => {
  198. // Taro.navigateBack()
  199. // Taro.redirectTo({
  200. // url: '/pages/ChooseScenario'
  201. // })
  202. // },1000)
  203. }
  204. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  205. style: {
  206. backgroundColor: '#000',
  207. flex: 1,
  208. flexDirection: 'column',
  209. display: 'flex',
  210. width: '100vw',
  211. height: '100vh'
  212. },
  213. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_3__["default"], {
  214. text: t('feature.auth.create_account.title'),
  215. type: _utils_types__WEBPACK_IMPORTED_MODULE_4__.TextType.primary
  216. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_3__["default"], {
  217. text: t('feature.auth.create_account.sub_title'),
  218. type: _utils_types__WEBPACK_IMPORTED_MODULE_4__.TextType.secondary
  219. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_components_Box__WEBPACK_IMPORTED_MODULE_0__["default"], {
  220. child: signupComponent()
  221. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_1__["default"], {
  222. onClick: registerF,
  223. title: t('feature.auth.create_account.btn_next'),
  224. style: {
  225. marginLeft: 23,
  226. marginRight: 23,
  227. marginTop: 20,
  228. marginBottom: 20
  229. },
  230. status: isButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_4__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_4__.ComponentStatus.enable
  231. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  232. className: "agree_view",
  233. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Image, {
  234. style: "width:12px;height:12px;",
  235. src: _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_8__
  236. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  237. className: "agree_text",
  238. children: t('page.auth.agreement')
  239. })]
  240. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  241. style: {
  242. flex: 1
  243. }
  244. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.View, {
  245. className: "footer",
  246. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  247. className: "have_account",
  248. children: t('feature.auth.create_account.footer_desc')
  249. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_9__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_11__.Text, {
  250. className: "login",
  251. onClick: function onClick() {
  252. return props.login();
  253. },
  254. children: t('feature.auth.create_account.footer_login')
  255. })]
  256. })]
  257. });
  258. }
  259. /***/ }),
  260. /***/ "./src/features/auth/components/CreatePassword.tsx":
  261. /*!*********************************************************!*\
  262. !*** ./src/features/auth/components/CreatePassword.tsx ***!
  263. \*********************************************************/
  264. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  265. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  266. /* harmony export */ "default": function() { return /* binding */ Component; }
  267. /* harmony export */ });
  268. /* 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");
  269. /* harmony import */ var _components_Box__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Box */ "./src/components/Box.tsx");
  270. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/Buttons */ "./src/components/Buttons.tsx");
  271. /* harmony import */ var _components_Inputs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/Inputs */ "./src/components/Inputs.tsx");
  272. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/Texts */ "./src/components/Texts.tsx");
  273. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/utils/types */ "./src/utils/types.ts");
  274. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  275. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  276. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
  277. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  278. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_6__);
  279. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  280. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_7__);
  281. /* harmony import */ var _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @assets/svg/check.svg */ "./src/assets/svg/check.svg");
  282. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  283. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_9__);
  284. /* harmony import */ var _services_user__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @/services/user */ "./src/services/user.tsx");
  285. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  286. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__);
  287. function Component(prop) {
  288. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.useTranslation)(),
  289. t = _useTranslation.t;
  290. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_7__.useDispatch)();
  291. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(''),
  292. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState, 2),
  293. password = _useState2[0],
  294. setPassword = _useState2[1];
  295. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(''),
  296. _useState4 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState3, 2),
  297. repeat = _useState4[0],
  298. setRepeat = _useState4[1];
  299. var handlePasswordChange = function handlePasswordChange(value) {
  300. setPassword(value);
  301. };
  302. var handleRepeatChange = function handleRepeatChange(value) {
  303. setRepeat(value);
  304. };
  305. var isButtonDisabled = password === '' || repeat === '';
  306. function loginComponent() {
  307. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  308. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_2__["default"], {
  309. value: password,
  310. isSecure: true,
  311. onChange: handlePasswordChange,
  312. placeholder: t('feature.auth.create_password.input_password_placeholder')
  313. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  314. style: {
  315. height: 20
  316. }
  317. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_2__["default"], {
  318. value: repeat,
  319. isSecure: true,
  320. onChange: handleRepeatChange,
  321. placeholder: t('feature.auth.create_password.input_password_confirm_placeholder')
  322. })]
  323. });
  324. }
  325. function registerF() {
  326. if (isButtonDisabled) {
  327. return;
  328. }
  329. dispatch((0,_services_user__WEBPACK_IMPORTED_MODULE_10__.register)(prop.name, prop.email, password));
  330. setTimeout(function () {
  331. _tarojs_taro__WEBPACK_IMPORTED_MODULE_9___default().navigateBack({
  332. delta: 2
  333. });
  334. _tarojs_taro__WEBPACK_IMPORTED_MODULE_9___default().redirectTo({
  335. url: '/pages/ChooseScenario'
  336. });
  337. }, 1000);
  338. }
  339. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  340. style: {
  341. backgroundColor: '#000',
  342. flex: 1,
  343. flexDirection: 'column',
  344. display: 'flex',
  345. width: '100vw',
  346. height: '100vh'
  347. },
  348. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_3__["default"], {
  349. text: t('feature.auth.create_password.title'),
  350. type: _utils_types__WEBPACK_IMPORTED_MODULE_4__.TextType.primary
  351. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_3__["default"], {
  352. text: t('feature.auth.create_password.sub_title'),
  353. type: _utils_types__WEBPACK_IMPORTED_MODULE_4__.TextType.secondary
  354. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Box__WEBPACK_IMPORTED_MODULE_0__["default"], {
  355. child: loginComponent()
  356. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_1__["default"], {
  357. onClick: registerF,
  358. title: t('feature.auth.create_password.btn_next'),
  359. style: {
  360. marginLeft: 23,
  361. marginRight: 23,
  362. marginTop: 20,
  363. marginBottom: 20
  364. },
  365. status: isButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_4__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_4__.ComponentStatus.enable
  366. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  367. className: "agree_view",
  368. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Image, {
  369. style: "width:12px;height:12px;",
  370. src: _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_8__
  371. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  372. className: "agree_text",
  373. children: t('page.auth.agreement')
  374. })]
  375. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  376. style: {
  377. flex: 1
  378. }
  379. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  380. className: "footer",
  381. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  382. className: "have_account",
  383. children: t('feature.auth.create_password.footer_desc')
  384. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  385. className: "login",
  386. children: t('feature.auth.create_password.footer_login')
  387. })]
  388. })]
  389. });
  390. }
  391. /***/ }),
  392. /***/ "./src/features/auth/components/Login.tsx":
  393. /*!************************************************!*\
  394. !*** ./src/features/auth/components/Login.tsx ***!
  395. \************************************************/
  396. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  397. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  398. /* harmony export */ "default": function() { return /* binding */ Login; }
  399. /* harmony export */ });
  400. /* harmony import */ var _Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  401. /* harmony import */ var _components_Inputs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Inputs */ "./src/components/Inputs.tsx");
  402. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  403. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  404. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  405. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  406. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_2__);
  407. /* harmony import */ var _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @assets/svg/check.svg */ "./src/assets/svg/check.svg");
  408. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/Texts */ "./src/components/Texts.tsx");
  409. /* harmony import */ var _components_Box__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/components/Box */ "./src/components/Box.tsx");
  410. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/utils/types */ "./src/utils/types.ts");
  411. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @/components/Buttons */ "./src/components/Buttons.tsx");
  412. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  413. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__);
  414. function Login(props) {
  415. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.useTranslation)(),
  416. t = _useTranslation.t;
  417. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
  418. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_9__["default"])(_useState, 2),
  419. name = _useState2[0],
  420. setName = _useState2[1];
  421. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(''),
  422. _useState4 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_9__["default"])(_useState3, 2),
  423. password = _useState4[0],
  424. setPassword = _useState4[1];
  425. var handleNameChange = function handleNameChange(value) {
  426. setName(value);
  427. };
  428. var handlePasswordChange = function handlePasswordChange(value) {
  429. setPassword(value);
  430. };
  431. var isLoginButtonDisabled = name === '' || password === '';
  432. function loginComponent() {
  433. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, {
  434. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_0__["default"], {
  435. value: name,
  436. onChange: handleNameChange,
  437. placeholder: t('feature.auth.login.input_account_placeholder')
  438. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, {
  439. style: {
  440. height: 20
  441. }
  442. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_0__["default"], {
  443. value: password,
  444. isSecure: true,
  445. onChange: handlePasswordChange,
  446. placeholder: t('feature.auth.login.input_password_placeholder')
  447. })]
  448. });
  449. }
  450. function registerF() {}
  451. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, {
  452. style: {
  453. backgroundColor: '#000',
  454. flex: 1,
  455. flexDirection: 'column',
  456. display: 'flex',
  457. width: '100vw',
  458. height: '100vh'
  459. },
  460. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_4__["default"], {
  461. text: t('feature.auth.create_account.title'),
  462. type: _utils_types__WEBPACK_IMPORTED_MODULE_6__.TextType.primary
  463. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_4__["default"], {
  464. text: t('feature.auth.create_account.sub_title'),
  465. type: _utils_types__WEBPACK_IMPORTED_MODULE_6__.TextType.secondary
  466. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_Box__WEBPACK_IMPORTED_MODULE_5__["default"], {
  467. child: loginComponent()
  468. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_7__["default"], {
  469. onClick: registerF,
  470. title: t('feature.auth.create_account.btn_next'),
  471. style: {
  472. marginLeft: 23,
  473. marginRight: 23,
  474. marginTop: 20,
  475. marginBottom: 20
  476. },
  477. status: isLoginButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_6__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_6__.ComponentStatus.enable
  478. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, {
  479. className: "agree_view",
  480. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.Image, {
  481. style: "width:12px;height:12px;",
  482. src: _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_3__
  483. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.Text, {
  484. className: "agree_text",
  485. children: t('page.auth.agreement')
  486. })]
  487. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, {
  488. style: {
  489. flex: 1
  490. }
  491. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, {
  492. className: "footer",
  493. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.Text, {
  494. className: "have_account",
  495. children: t('feature.auth.create_account.footer_desc')
  496. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_8__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.Text, {
  497. className: "login",
  498. onClick: function onClick() {
  499. return props.register();
  500. },
  501. children: t('feature.auth.create_account.footer_login')
  502. })]
  503. })]
  504. });
  505. }
  506. /***/ }),
  507. /***/ "./src/pages/Auth.tsx":
  508. /*!****************************!*\
  509. !*** ./src/pages/Auth.tsx ***!
  510. \****************************/
  511. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  512. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  513. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  514. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_Auth_tsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./Auth.tsx */ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/Auth.tsx");
  515. var config = {};
  516. var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__.createPageConfig)(_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_Auth_tsx__WEBPACK_IMPORTED_MODULE_1__["default"], 'pages/Auth', {root:{cn:[]}}, config || {}))
  517. /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_Auth_tsx__WEBPACK_IMPORTED_MODULE_1__["default"]);
  518. /***/ })
  519. },
  520. /******/ function(__webpack_require__) { // webpackRuntimeModules
  521. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  522. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/Auth.tsx"); });
  523. /******/ var __webpack_exports__ = __webpack_require__.O();
  524. /******/ }
  525. ]);
  526. //# sourceMappingURL=Auth.js.map