Auth.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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 _tarojs_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  15. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  16. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
  17. function Page() {
  18. _tarojs_taro__WEBPACK_IMPORTED_MODULE_0___default().setBackgroundColor({
  19. backgroundColor: '#000000'
  20. });
  21. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_3__.View, {
  22. style: {
  23. backgroundColor: '#000'
  24. },
  25. children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_features_auth_components_Auth__WEBPACK_IMPORTED_MODULE_1__["default"], {})
  26. });
  27. }
  28. /***/ }),
  29. /***/ "./src/components/Box.tsx":
  30. /*!********************************!*\
  31. !*** ./src/components/Box.tsx ***!
  32. \********************************/
  33. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  34. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  35. /* harmony export */ "default": function() { return /* binding */ Component; }
  36. /* harmony export */ });
  37. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  38. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  39. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  40. function Component(props) {
  41. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_1__.View, {
  42. className: "container",
  43. children: props.child
  44. });
  45. }
  46. /***/ }),
  47. /***/ "./src/components/Inputs.tsx":
  48. /*!***********************************!*\
  49. !*** ./src/components/Inputs.tsx ***!
  50. \***********************************/
  51. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  52. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  53. /* harmony export */ "default": function() { return /* binding */ Component; }
  54. /* harmony export */ });
  55. /* 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");
  56. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  57. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  58. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  59. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  60. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__);
  61. function Component(_ref) {
  62. var placeholder = _ref.placeholder,
  63. value = _ref.value,
  64. onChange = _ref.onChange,
  65. disabled = _ref.disabled;
  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. onInput: handleInputChange,
  85. disabled: disabled ? disabled : false,
  86. onFocus: function onFocus() {
  87. setIsFocus(true);
  88. },
  89. onBlur: function onBlur() {
  90. setIsFocus(false);
  91. }
  92. })
  93. });
  94. }
  95. /***/ }),
  96. /***/ "./src/features/auth/components/Auth.tsx":
  97. /*!***********************************************!*\
  98. !*** ./src/features/auth/components/Auth.tsx ***!
  99. \***********************************************/
  100. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  101. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  102. /* harmony export */ "default": function() { return /* binding */ Auth; }
  103. /* harmony export */ });
  104. /* 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");
  105. /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");
  106. /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @components/Texts */ "./src/components/Texts.tsx");
  107. /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @utils/types */ "./src/utils/types.ts");
  108. /* harmony import */ var _components_Box__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @components/Box */ "./src/components/Box.tsx");
  109. /* harmony import */ var _components_Inputs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @components/Inputs */ "./src/components/Inputs.tsx");
  110. /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @components/Buttons */ "./src/components/Buttons.tsx");
  111. /* harmony import */ var _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @assets/svg/check.svg */ "./src/assets/svg/check.svg");
  112. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-i18next */ "webpack/container/remote/react-i18next");
  113. /* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react_i18next__WEBPACK_IMPORTED_MODULE_6__);
  114. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react */ "webpack/container/remote/react");
  115. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_7__);
  116. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux");
  117. /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_8__);
  118. /* harmony import */ var _store_user__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @/store/user */ "./src/store/user.tsx");
  119. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro");
  120. /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_10__);
  121. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime");
  122. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__);
  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)(''),
  128. _useState2 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState, 2),
  129. name = _useState2[0],
  130. setName = _useState2[1];
  131. var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_7__.useState)(''),
  132. _useState4 = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_slicedToArray_js__WEBPACK_IMPORTED_MODULE_12__["default"])(_useState3, 2),
  133. email = _useState4[0],
  134. setEmail = _useState4[1];
  135. var handleNameChange = function handleNameChange(value) {
  136. setName(value);
  137. };
  138. var handleEmailChange = function handleEmailChange(value) {
  139. setEmail(value);
  140. };
  141. var isButtonDisabled = name === '' || email === '';
  142. function loginComponent() {
  143. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  144. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_3__["default"], {
  145. value: name,
  146. onChange: handleNameChange,
  147. placeholder: t('feature.auth.create_account.input_username_placeholder')
  148. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  149. style: {
  150. height: 20
  151. }
  152. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Inputs__WEBPACK_IMPORTED_MODULE_3__["default"], {
  153. value: email,
  154. onChange: handleEmailChange,
  155. placeholder: t('feature.auth.create_account.input_email_placeholder')
  156. })]
  157. });
  158. }
  159. function registerF() {
  160. if (isButtonDisabled) {
  161. return;
  162. }
  163. dispatch((0,_store_user__WEBPACK_IMPORTED_MODULE_9__.register)(name, email, '123456'));
  164. setTimeout(function () {
  165. _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default().navigateBack();
  166. _tarojs_taro__WEBPACK_IMPORTED_MODULE_10___default().redirectTo({
  167. url: '/pages/ChooseScenario'
  168. });
  169. }, 1000);
  170. }
  171. return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  172. style: {
  173. backgroundColor: '#000',
  174. flex: 1,
  175. flexDirection: 'column',
  176. display: 'flex',
  177. height: '100vh'
  178. },
  179. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_0__["default"], {
  180. text: t('feature.auth.create_account.title'),
  181. type: _utils_types__WEBPACK_IMPORTED_MODULE_1__.TextType.primary
  182. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_0__["default"], {
  183. text: t('feature.auth.create_account.sub_title'),
  184. type: _utils_types__WEBPACK_IMPORTED_MODULE_1__.TextType.secondary
  185. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Box__WEBPACK_IMPORTED_MODULE_2__["default"], {
  186. child: loginComponent()
  187. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_4__["default"], {
  188. onClick: registerF,
  189. title: t('feature.auth.create_account.btn_next'),
  190. style: {
  191. marginLeft: 23,
  192. marginRight: 23,
  193. marginTop: 20,
  194. marginBottom: 20
  195. },
  196. status: isButtonDisabled ? _utils_types__WEBPACK_IMPORTED_MODULE_1__.ComponentStatus.disable : _utils_types__WEBPACK_IMPORTED_MODULE_1__.ComponentStatus.enable
  197. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  198. className: "agree_view",
  199. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Image, {
  200. style: "width:12px;height:12px;",
  201. src: _assets_svg_check_svg__WEBPACK_IMPORTED_MODULE_5__
  202. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  203. className: "agree_text",
  204. children: t('page.auth.agreement')
  205. })]
  206. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  207. style: {
  208. flex: 1
  209. }
  210. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.View, {
  211. className: "footer",
  212. children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  213. className: "have_account",
  214. children: t('feature.auth.create_account.footer_desc')
  215. }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_13__.Text, {
  216. className: "login",
  217. children: t('feature.auth.create_account.footer_login')
  218. })]
  219. })]
  220. });
  221. }
  222. /***/ }),
  223. /***/ "./src/pages/Auth.tsx":
  224. /*!****************************!*\
  225. !*** ./src/pages/Auth.tsx ***!
  226. \****************************/
  227. /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
  228. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime");
  229. /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__);
  230. /* 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");
  231. var config = {};
  232. 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 || {}))
  233. /* 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"]);
  234. /***/ })
  235. },
  236. /******/ function(__webpack_require__) { // webpackRuntimeModules
  237. /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
  238. /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/Auth.tsx"); });
  239. /******/ var __webpack_exports__ = __webpack_require__.O();
  240. /******/ }
  241. ]);
  242. //# sourceMappingURL=Auth.js.map