"use strict"; (wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([["pages/ChooseAuth"],{ /***/ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/ChooseAuth.tsx": /*!*******************************************************************************************************!*\ !*** ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/ChooseAuth.tsx ***! \*******************************************************************************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": function() { return /* binding */ Page; } /* harmony export */ }); /* harmony import */ var _Users_Work_hola2_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js */ "./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js"); /* harmony import */ var _Users_Work_hola2_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"); /* harmony import */ var _tarojs_components__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @tarojs/components */ "./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"); /* harmony import */ var _components_Buttons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @components/Buttons */ "./src/components/Buttons.tsx"); /* harmony import */ var _components_Texts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @components/Texts */ "./src/components/Texts.tsx"); /* harmony import */ var _utils_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/types */ "./src/utils/types.ts"); /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @tarojs/taro */ "webpack/container/remote/@tarojs/taro"); /* harmony import */ var _tarojs_taro__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_tarojs_taro__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-redux */ "webpack/container/remote/react-redux"); /* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_redux__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "webpack/container/remote/react"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _services_user__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/services/user */ "./src/services/user.tsx"); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "webpack/container/remote/react/jsx-runtime"); /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__); function Page() { var dispatch = (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useDispatch)(); var counter = (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(function (state) { return state.counter.value; }); var code = ''; var user = (0,react_redux__WEBPACK_IMPORTED_MODULE_4__.useSelector)(function (state) { return state.user; }); (0,react__WEBPACK_IMPORTED_MODULE_5__.useEffect)(function () { if (user.isLogin) { if (user.scenario_select_count > 0) { _tarojs_taro__WEBPACK_IMPORTED_MODULE_3___default().navigateBack({ delta: 1 }); } else { _tarojs_taro__WEBPACK_IMPORTED_MODULE_3___default().redirectTo({ url: '/pages/ChooseScenario' }); } } }, [user.isLogin]); (0,_tarojs_taro__WEBPACK_IMPORTED_MODULE_3__.useReady)(function () { if (true) { _tarojs_taro__WEBPACK_IMPORTED_MODULE_3___default().login().then(function (res) { code = res.code; }); } }); function login() { return _login.apply(this, arguments); } function _login() { _login = (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_8__["default"])( /*#__PURE__*/(0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_9__["default"])().mark(function _callee() { var _yield$Taro$getUserPr, encryptedData, iv; return (0,_Users_Work_hola2_node_modules_babel_runtime_helpers_esm_regeneratorRuntime_js__WEBPACK_IMPORTED_MODULE_9__["default"])().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.prev = 0; _context.next = 3; return _tarojs_taro__WEBPACK_IMPORTED_MODULE_3___default().getUserProfile({ desc: '获取用户信息' }); case 3: _yield$Taro$getUserPr = _context.sent; encryptedData = _yield$Taro$getUserPr.encryptedData; iv = _yield$Taro$getUserPr.iv; dispatch((0,_services_user__WEBPACK_IMPORTED_MODULE_6__.wxLogin)(code, encryptedData, iv)); // 在这里处理用户信息 _context.next = 12; break; case 9: _context.prev = 9; _context.t0 = _context["catch"](0); console.log('获取用户信息失败:', _context.t0); case 12: case "end": return _context.stop(); } }, _callee, null, [[0, 9]]); })); return _login.apply(this, arguments); } function createAccount() { _tarojs_taro__WEBPACK_IMPORTED_MODULE_3___default().navigateTo({ url: '/pages/Auth' }); } return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, { className: "container choose_container", children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_1__["default"], { text: "App name", type: _utils_types__WEBPACK_IMPORTED_MODULE_2__.TextType.big }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_components_Texts__WEBPACK_IMPORTED_MODULE_1__["default"], { text: counter }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_tarojs_components__WEBPACK_IMPORTED_MODULE_10__.View, { style: { height: 100 } }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_0__["default"], { title: "WeChat", onClick: login, style: { width: 289, marginBottom: 30 } }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_components_Buttons__WEBPACK_IMPORTED_MODULE_0__["default"], { title: "Create account", type: _utils_types__WEBPACK_IMPORTED_MODULE_2__.ButtonType.outline, onClick: createAccount, style: { width: 289, marginBottom: 30 } })] }); } /***/ }), /***/ "./src/pages/ChooseAuth.tsx": /*!**********************************!*\ !*** ./src/pages/ChooseAuth.tsx ***! \**********************************/ /***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tarojs/runtime */ "webpack/container/remote/@tarojs/runtime"); /* harmony import */ var _tarojs_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_ChooseAuth_tsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./ChooseAuth.tsx */ "./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/ChooseAuth.tsx"); var config = {}; var inst = Page((0,_tarojs_runtime__WEBPACK_IMPORTED_MODULE_0__.createPageConfig)(_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_ChooseAuth_tsx__WEBPACK_IMPORTED_MODULE_1__["default"], 'pages/ChooseAuth', {root:{cn:[]}}, config || {})) /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_babel_loader_lib_index_js_ruleSet_1_rules_5_use_0_ChooseAuth_tsx__WEBPACK_IMPORTED_MODULE_1__["default"]); /***/ }) }, /******/ function(__webpack_require__) { // webpackRuntimeModules /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } /******/ __webpack_require__.O(0, ["taro","vendors","common"], function() { return __webpack_exec__("./src/pages/ChooseAuth.tsx"); }); /******/ var __webpack_exports__ = __webpack_require__.O(); /******/ } ]); //# sourceMappingURL=ChooseAuth.js.map