Auth.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  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_taro_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_taro_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_taro_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_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
  106. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  107. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @components/Texts */ "./src/components/Texts.tsx");
  108. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @utils/types */ "./src/utils/types.ts");
  109. /* harmony import */ var _components_Box__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @components/Box */ "./src/components/Box.tsx");
  110. /* harmony import */ var _components_Inputs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @components/Inputs */ "./src/components/Inputs.tsx");
  111. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @components/Buttons */ "./src/components/Buttons.tsx");
  112. /* harmony import */ var _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @assets/svg/check.svg */ "./src/assets/svg/check.svg");
  113. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  114. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_6__);
  115. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  116. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__);
  117. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  118. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_8__);
  119. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  120. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_9__);
  121. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  122. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__);
  123. function Auth() {
  124. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.useTranslation)(),
  125. t = _useTranslation.t;
  126. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_8__.useDispatch)();
  127. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(true),
  128. _useState2 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_11__["default"])(_useState, 2),
  129. isSignup = _useState2[0],
  130. setIsSignup = _useState2[1];
  131. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(''),
  132. _useState4 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_11__["default"])(_useState3, 2),
  133. name = _useState4[0],
  134. setName = _useState4[1];
  135. var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(''),
  136. _useState6 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_11__["default"])(_useState5, 2),
  137. email = _useState6[0],
  138. setEmail = _useState6[1];
  139. var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(''),
  140. _useState8 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_11__["default"])(_useState7, 2),
  141. password = _useState8[0],
  142. setPassword = _useState8[1];
  143. var handleNameChange = function handleNameChange(value) {
  144. setName(value);
  145. };
  146. var handleEmailChange = function handleEmailChange(value) {
  147. setEmail(value);
  148. };
  149. var handlePasswordChange = function handlePasswordChange(value) {
  150. setPassword(value);
  151. };
  152. var isButtonDisabled = name === '' || email === '';
  153. var isLoginButtonDisabled = email === '' || password === '';
  154. function signupComponent() {
  155. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  156. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_3__["default"], {
  157. value: name,
  158. onChange: handleNameChange,
  159. placeholder: t('feature.auth.create_account.input_username_placeholder')
  160. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  161. style: {
  162. height: 20
  163. }
  164. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_3__["default"], {
  165. value: email,
  166. onChange: handleEmailChange,
  167. placeholder: t('feature.auth.create_account.input_email_placeholder')
  168. })]
  169. });
  170. }
  171. function loginComponent() {
  172. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  173. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_3__["default"], {
  174. value: email,
  175. onChange: handleEmailChange,
  176. placeholder: t('feature.auth.login.input_account_placeholder')
  177. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  178. style: {
  179. height: 20
  180. }
  181. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_3__["default"], {
  182. value: password,
  183. isSecure: true,
  184. onChange: handlePasswordChange,
  185. placeholder: t('feature.auth.login.input_password_placeholder')
  186. })]
  187. });
  188. }
  189. function registerF() {
  190. if (isButtonDisabled) {
  191. return;
  192. }
  193. setTimeout(function () {
  194. _tarojs_taro__WEBPACK_IMPORTED_MODULE_9___default().navigateTo({
  195. url: "/pages/Auth?type=createPassword&name=".concat(name, "&email=").concat(email)
  196. });
  197. }, 1000);
  198. // setTimeout(() => {
  199. // Taro.navigateBack()
  200. // Taro.redirectTo({
  201. // url: '/pages/ChooseScenario'
  202. // })
  203. // },1000)
  204. }
  205. function changeLogin() {
  206. setIsSignup(false);
  207. console.log(isSignup);
  208. }
  209. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  210. style: {
  211. backgroundColor: '#000',
  212. flex: 1,
  213. flexDirection: 'column',
  214. display: 'flex',
  215. width: '100vw',
  216. height: '100vh'
  217. },
  218. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_0__["default"], {
  219. text: t('feature.auth.create_account.title'),
  220. type: _utils_types__WEBPACK_IMPORTED_MODULE_1__.TextType.primary
  221. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_0__["default"], {
  222. text: t('feature.auth.create_account.sub_title'),
  223. type: _utils_types__WEBPACK_IMPORTED_MODULE_1__.TextType.secondary
  224. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Box__WEBPACK_IMPORTED_MODULE_2__["default"], {
  225. child: isSignup ? signupComponent() : loginComponent()
  226. }), isSignup ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_4__["default"], {
  227. onClick: registerF,
  228. title: t('feature.auth.create_account.btn_next'),
  229. style: {
  230. marginLeft: 23,
  231. marginRight: 23,
  232. marginTop: 20,
  233. marginBottom: 20
  234. },
  235. status: isButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_1__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_1__.ComponentStatus.enable
  236. }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_4__["default"], {
  237. onClick: registerF,
  238. title: t('feature.auth.create_account.btn_next'),
  239. style: {
  240. marginLeft: 23,
  241. marginRight: 23,
  242. marginTop: 20,
  243. marginBottom: 20
  244. },
  245. status: isLoginButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_1__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_1__.ComponentStatus.enable
  246. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  247. className: "agree_view",
  248. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Image, {
  249. style: "width:12px;height:12px;",
  250. src: _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_5__
  251. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  252. className: "agree_text",
  253. children: t('page.auth.agreement')
  254. })]
  255. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  256. style: {
  257. flex: 1
  258. }
  259. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.View, {
  260. className: "footer",
  261. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  262. className: "have_account",
  263. children: t('feature.auth.create_account.footer_desc')
  264. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_12__.Text, {
  265. className: "login",
  266. onClick: function onClick() {
  267. return setIsSignup(!isSignup);
  268. },
  269. children: t('feature.auth.create_account.footer_login')
  270. })]
  271. })]
  272. });
  273. }
  274. /***/ }),
  275. /***/ "./src/features/auth/components/CreatePassword.tsx":
  276. /*!*********************************************************!*\
  277. !*** ./src/features/auth/components/CreatePassword.tsx ***!
  278. \*********************************************************/
  279. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  280. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  281. /* harmony export */ "default": function() { return /* binding */ Component; }
  282. /* harmony export */ });
  283. /* harmony import */ var _Users_Work_taro_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");
  284. /* harmony import */ var _components_Box__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/Box */ "./src/components/Box.tsx");
  285. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/Buttons */ "./src/components/Buttons.tsx");
  286. /* harmony import */ var _components_Inputs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/Inputs */ "./src/components/Inputs.tsx");
  287. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/Texts */ "./src/components/Texts.tsx");
  288. /* harmony import */ var _store_user__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/store/user */ "./src/store/user.tsx");
  289. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/utils/types */ "./src/utils/types.ts");
  290. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  291. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  292. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
  293. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  294. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_7__);
  295. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  296. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_8__);
  297. /* harmony import */ var _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @assets/svg/check.svg */ "./src/assets/svg/check.svg");
  298. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  299. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_10__);
  300. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  301. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__);
  302. function Component(prop) {
  303. var _useTranslation = (0,react_i18next__WEBPACK_IMPORTED_MODULE_7__.useTranslation)(),
  304. t = _useTranslation.t;
  305. var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_8__.useDispatch)();
  306. var _useState = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''),
  307. _useState2 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState, 2),
  308. password = _useState2[0],
  309. setPassword = _useState2[1];
  310. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_6__.useState)(''),
  311. _useState4 = (0,_Users_Work_taro_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState3, 2),
  312. repeat = _useState4[0],
  313. setRepeat = _useState4[1];
  314. var handlePasswordChange = function handlePasswordChange(value) {
  315. setPassword(value);
  316. };
  317. var handleRepeatChange = function handleRepeatChange(value) {
  318. setRepeat(value);
  319. };
  320. var isButtonDisabled = password === '' || repeat === '';
  321. function loginComponent() {
  322. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  323. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_2__["default"], {
  324. value: password,
  325. isSecure: true,
  326. onChange: handlePasswordChange,
  327. placeholder: t('feature.auth.create_password.input_password_placeholder')
  328. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  329. style: {
  330. height: 20
  331. }
  332. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_2__["default"], {
  333. value: repeat,
  334. isSecure: true,
  335. onChange: handleRepeatChange,
  336. placeholder: t('feature.auth.create_password.input_password_confirm_placeholder')
  337. })]
  338. });
  339. }
  340. function registerF() {
  341. if (isButtonDisabled) {
  342. return;
  343. }
  344. dispatch((0,_store_user__WEBPACK_IMPORTED_MODULE_4__.register)(prop.name, prop.email, password));
  345. setTimeout(function () {
  346. _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default().navigateBack({
  347. delta: 2
  348. });
  349. _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default().redirectTo({
  350. url: '/pages/ChooseScenario'
  351. });
  352. }, 1000);
  353. }
  354. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  355. style: {
  356. backgroundColor: '#000',
  357. flex: 1,
  358. flexDirection: 'column',
  359. display: 'flex',
  360. width: '100vw',
  361. height: '100vh'
  362. },
  363. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_3__["default"], {
  364. text: t('feature.auth.create_password.title'),
  365. type: _utils_types__WEBPACK_IMPORTED_MODULE_5__.TextType.primary
  366. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_3__["default"], {
  367. text: t('feature.auth.create_password.sub_title'),
  368. type: _utils_types__WEBPACK_IMPORTED_MODULE_5__.TextType.secondary
  369. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Box__WEBPACK_IMPORTED_MODULE_0__["default"], {
  370. child: loginComponent()
  371. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_1__["default"], {
  372. onClick: registerF,
  373. title: t('feature.auth.create_password.btn_next'),
  374. style: {
  375. marginLeft: 23,
  376. marginRight: 23,
  377. marginTop: 20,
  378. marginBottom: 20
  379. },
  380. status: isButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_5__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_5__.ComponentStatus.enable
  381. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  382. className: "agree_view",
  383. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Image, {
  384. style: "width:12px;height:12px;",
  385. src: _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_9__
  386. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  387. className: "agree_text",
  388. children: t('page.auth.agreement')
  389. })]
  390. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  391. style: {
  392. flex: 1
  393. }
  394. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  395. className: "footer",
  396. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  397. className: "have_account",
  398. children: t('feature.auth.create_password.footer_desc')
  399. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  400. className: "login",
  401. children: t('feature.auth.create_password.footer_login')
  402. })]
  403. })]
  404. });
  405. }
  406. /***/ }),
  407. /***/ "./src/pages/Auth.tsx":
  408. /*!****************************!*\
  409. !*** ./src/pages/Auth.tsx ***!
  410. \****************************/
  411. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  412. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  413. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  414. /* 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");
  415. var config = {};
  416. 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 || {}))
  417. /* 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"]);
  418. /***/ })
  419. },
  420. /******/ function(__webpack_require__) { // webpackRuntimeModules
  421. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  422. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/Auth.tsx"); });
  423. /******/ var __webpack_exports__ = __webpack_require__.O();
  424. /******/ }
  425. ]);
  426. //# sourceMappingURL=Auth.js.map