main.0a416c46.chunk.js.map 16 KB

1
  1. {"version":3,"sources":["router/history.js","store/index.js","component/Navbar/index.js","hoc/privateRoute.js","hoc/asyncComponent.js","router/index.js","App.js","serviceWorker.js","index.js"],"names":["history__WEBPACK_IMPORTED_MODULE_0__","__webpack_require__","createBrowserHistory","AppStore","userId","token","sessionStorage","setItem","this","removeItem","undefined","history","push","observable","getItem","action","__webpack_exports__","navbarMap","/login","/information","/admin","/admin/login","Navbar","props","_this","Object","classCallCheck","possibleConstructorReturn","getPrototypeOf","call","state","title","location","pathname","listen","setState","_react_16_8_6_react_default","a","createElement","className","Component","withRouter","PrivateRoute","_ref","component","_ref$redirectPath","redirectPath","rest","objectWithoutProperties","react_router","assign","render","store","to","from","asyncComponent","importComponent","_Component","AsyncComponent","inherits","createClass","key","value","_componentDidMount","asyncToGenerator","regenerator_default","mark","_callee","wrap","_context","prev","next","sent","default","stop","apply","arguments","C","Login","Promise","all","e","then","bind","UserInformation","UserPreview","routes","path","exact","privateRoute","App","observer","src_component_Navbar","map","route","Boolean","window","hostname","match","moment","locale","ReactDOM","locale_provider","zh_CN","src_App","document","getElementById","navigator","serviceWorker","ready","registration","unregister"],"mappings":"yFAAA,IAAAA,EAAAC,EAAA,GAEeC,kHCCTC,sKAKIC,EAAQC,GACVC,eAAeC,QAAQ,SAAWC,KAAKJ,OAASA,GAChDE,eAAeC,QAAQ,QAAUC,KAAKH,MAAQA,oCAM9CC,eAAeG,WAAW,UAC1BD,KAAKJ,YAASM,EACdJ,eAAeG,WAAW,SAC1BD,KAAKH,WAAQK,EAEbC,IAAQC,KANG,uDAXdC,8EAAoBP,eAAeQ,QAAQ,gDAC3CD,8EAAmBP,eAAeQ,QAAQ,6CAE1CC,yGAMAA,2EAWUC,EAAA,MAAIb,uOCrBbc,SAAY,CACdC,SAAU,2BACVC,eAAgB,uCAChBC,SAAU,iCACVC,eAAe,mCAEbC,cAIF,SAAAA,EAAYC,GAAO,IAAAC,EAAA,OAAAC,OAAAC,EAAA,E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CAAcqC,KAAK,IAAI3C,UAAWwC,GAAqB7D,MAE1E,CACEgE,KAAM,SACNxD,MAAO,2BACPoB,OAAQ,SAAA5B,GAAK,OAAIa,EAAAC,EAAAC,cAACwC,EAAUvD,KAE9B,CACEgE,KAAM,oBACNxD,MAAO,uCACPoB,OAAQ,SAAA5B,GAAK,OACXa,EAAAC,EAAAC,cAACmD,EAADhE,OAAAyB,OAAA,CAAcqC,KAAK,oBAAoB3C,UAAWwC,GAAqB7D,MAG3E,CACEgE,KAAM,oBACNxD,MAAO,2BACPoB,OAAQ,SAAA5B,GAAK,OAAIa,EAAAC,EAAAC,cAAC+C,EAAgB9D,cCCvBmE,EAvBdC,+LAGO,OACIvD,EAAAC,EAAAC,cAAA,OAAKC,UAAU,OACXH,EAAAC,EAAAC,cAACW,EAAA,EAAD,CAAQtC,QAASA,KACbyB,EAAAC,EAAAC,cAACsD,EAAD,MACCN,EAAOO,IAAI,SAAAC,GAAK,OACb1D,EAAAC,EAAAC,cAACW,EAAA,EAAD,CACIY,IAAKiC,EAAMP,KACXC,MAAOM,EAAMN,MACbD,KAAMO,EAAMP,KACZpC,OAAQ2C,EAAM3C,iEAXxBX,iBCKEuD,QACW,cAA7BC,OAAOhE,SAASiE,UAEe,UAA7BD,OAAOhE,SAASiE,UAEhBD,OAAOhE,SAASiE,SAASC,MACvB,sGCTNC,IAAOC,OAAO,SAEdC,IAASlD,OAAOf,EAAAC,EAAAC,cAAAgE,EAAA,GAAgBF,OAAQG,KAAOnE,EAAAC,EAAAC,cAACkE,EAAD,OAA0BC,SAASC,eAAe,SDsH3F,kBAAmBC,WACrBA,UAAUC,cAAcC,MAAM3B,KAAK,SAAA4B,GACjCA,EAAaC","file":"static/js/main.0a416c46.chunk.js","sourcesContent":["import { createBrowserHistory } from 'history'\r\n\r\nexport default createBrowserHistory()\r\n","import { observable, action } from \"mobx\";\r\nimport history from \"@/router/history\";\r\n\r\nclass AppStore {\r\n @observable userId = sessionStorage.getItem(\"userId\");\r\n @observable token = sessionStorage.getItem(\"token\");\r\n\r\n @action\r\n login(userId, token) {\r\n sessionStorage.setItem(\"userId\", (this.userId = userId));\r\n sessionStorage.setItem(\"token\", (this.token = token));\r\n }\r\n\r\n @action\r\n logout() {\r\n let path = \"/login\";\r\n sessionStorage.removeItem(\"userId\");\r\n this.userId = undefined;\r\n sessionStorage.removeItem(\"token\");\r\n this.token = undefined;\r\n\r\n history.push(path);\r\n }\r\n}\r\nexport default new AppStore();\r\n","import React, { Component } from \"react\";\r\nimport { withRouter } from \"react-router-dom\";\r\nimport \"./index.scss\";\r\nconst navbarMap = {\r\n \"/login\": \"用户登录\",\r\n \"/information\": \"用户信息录入\",\r\n '/admin' :'管理员中心',\r\n '/admin/login':'管理员登录'\r\n};\r\nclass Navbar extends Component {\r\n state = {\r\n title: navbarMap[this.props.location.pathname]\r\n };\r\n constructor(props) {\r\n super(props);\r\n props.history.listen(location => {\r\n //在这里监听location对象\r\n let { pathname } = location;\r\n this.setState({ title: navbarMap[pathname] });\r\n });\r\n }\r\n render() {\r\n return (\r\n <nav className=\"page-nav\">\r\n <i className=\"nav-logo\" />\r\n <div className=\"nav-title\">{this.state.title}</div>\r\n </nav>\r\n );\r\n }\r\n}\r\n\r\nexport default withRouter(Navbar);\r\n","import React from 'react'\r\nimport { Redirect, Route } from 'react-router-dom'\r\nimport store from '@/store'\r\n\r\nfunction PrivateRoute ({\r\n component: Component,\r\n redirectPath = '/login',\r\n ...rest\r\n}) {\r\n return (\r\n <Route\r\n {...rest}\r\n render={props =>\r\n store.userId && store.token ? (\r\n <Component {...props} />\r\n ) : (\r\n <Redirect\r\n to={{\r\n pathname: redirectPath,\r\n state: { from: props.location }\r\n }}\r\n />\r\n )\r\n }\r\n />\r\n )\r\n}\r\n\r\nexport default PrivateRoute\r\n","import React, { Component } from \"react\";\r\n\r\nexport default function asyncComponent(importComponent) {\r\n class AsyncComponent extends Component {\r\n constructor(props) {\r\n super(props);\r\n\r\n this.state = {\r\n component: null\r\n };\r\n }\r\n\r\n async componentDidMount() {\r\n const { default: component } = await importComponent();\r\n\r\n this.setState({\r\n component: component\r\n });\r\n }\r\n\r\n render() {\r\n const C = this.state.component;\r\n\r\n return C ? <C {...this.props} /> : null;\r\n }\r\n }\r\n\r\n return AsyncComponent;\r\n}","import React from 'react'\r\nimport { PrivateRoute,AsyncComponent } from '@/hoc'\r\n\r\nlet Login = AsyncComponent(()=>{return import('@/page/Login')})\r\nlet UserInformation = AsyncComponent(()=>{return import('@/page/user/information')})\r\nlet UserPreview = AsyncComponent(()=>{return import('@/page/user/preview')})\r\n\r\nlet routes = [\r\n {\r\n path: '/',\r\n exact: true,\r\n render: props => <PrivateRoute path=\"/\" component={UserInformation} {...props}/>\r\n },\r\n {\r\n path: '/login',\r\n title: '用户登录',\r\n render: props => <Login {...props}/>\r\n },\r\n {\r\n path: '/user/information',\r\n title: '用户信息录入',\r\n render: props => (\r\n <PrivateRoute path=\"/user/information\" component={UserInformation} {...props}/>\r\n )\r\n },\r\n {\r\n path: '/user/preview/:id',\r\n title: '简历预览',\r\n render: props => <UserPreview {...props}/>\r\n }\r\n]\r\n\r\nexport default routes\r\n","import React, { Component } from \"react\";\r\nimport { Router, Route } from \"react-router-dom\";\r\nimport { observer } from \"mobx-react\";\r\nimport Navbar from \"./component/Navbar\";\r\nimport routes from \"./router\";\r\nimport history from './router/history'\r\n@observer\r\nclass App extends Component {\r\n render() {\r\n return (\r\n <div className=\"App\">\r\n <Router history={history}>\r\n <Navbar />\r\n {routes.map(route => (\r\n <Route\r\n key={route.path}\r\n exact={route.exact}\r\n path={route.path}\r\n render={route.render}\r\n />\r\n ))}\r\n </Router>\r\n </div>\r\n );\r\n }\r\n componentDidMount() {\r\n }\r\n}\r\n\r\nexport default App;\r\n","// This optional code is used to register a service worker.\r\n// register() is not called by default.\r\n\r\n// This lets the app load faster on subsequent visits in production, and gives\r\n// it offline capabilities. However, it also means that developers (and users)\r\n// will only see deployed updates on subsequent visits to a page, after all the\r\n// existing tabs open on the page have been closed, since previously cached\r\n// resources are updated in the background.\r\n\r\n// To learn more about the benefits of this model and instructions on how to\r\n// opt-in, read https://bit.ly/CRA-PWA\r\n\r\nconst isLocalhost = Boolean(\r\n window.location.hostname === 'localhost' ||\r\n // [::1] is the IPv6 localhost address.\r\n window.location.hostname === '[::1]' ||\r\n // 127.0.0.1/8 is considered localhost for IPv4.\r\n window.location.hostname.match(\r\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\r\n )\r\n)\r\n\r\nexport function register (config) {\r\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\r\n // The URL constructor is available in all browsers that support SW.\r\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href)\r\n if (publicUrl.origin !== window.location.origin) {\r\n // Our service worker won't work if PUBLIC_URL is on a different origin\r\n // from what our page is served on. This might happen if a CDN is used to\r\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\r\n return\r\n }\r\n\r\n window.addEventListener('load', () => {\r\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`\r\n\r\n if (isLocalhost) {\r\n // This is running on localhost. Let's check if a service worker still exists or not.\r\n checkValidServiceWorker(swUrl, config)\r\n\r\n // Add some additional logging to localhost, pointing developers to the\r\n // service worker/PWA documentation.\r\n navigator.serviceWorker.ready.then(() => {\r\n console.log(\r\n 'This web app is being served cache-first by a service ' +\r\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\r\n )\r\n })\r\n } else {\r\n // Is not localhost. Just register service worker\r\n registerValidSW(swUrl, config)\r\n }\r\n })\r\n }\r\n}\r\n\r\nfunction registerValidSW (swUrl, config) {\r\n navigator.serviceWorker\r\n .register(swUrl)\r\n .then(registration => {\r\n registration.onupdatefound = () => {\r\n const installingWorker = registration.installing\r\n if (installingWorker == null) {\r\n return\r\n }\r\n installingWorker.onstatechange = () => {\r\n if (installingWorker.state === 'installed') {\r\n if (navigator.serviceWorker.controller) {\r\n // At this point, the updated precached content has been fetched,\r\n // but the previous service worker will still serve the older\r\n // content until all client tabs are closed.\r\n console.log(\r\n 'New content is available and will be used when all ' +\r\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\r\n )\r\n\r\n // Execute callback\r\n if (config && config.onUpdate) {\r\n config.onUpdate(registration)\r\n }\r\n } else {\r\n // At this point, everything has been precached.\r\n // It's the perfect time to display a\r\n // \"Content is cached for offline use.\" message.\r\n console.log('Content is cached for offline use.')\r\n\r\n // Execute callback\r\n if (config && config.onSuccess) {\r\n config.onSuccess(registration)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n console.error('Error during service worker registration:', error)\r\n })\r\n}\r\n\r\nfunction checkValidServiceWorker (swUrl, config) {\r\n // Check if the service worker can be found. If it can't reload the page.\r\n fetch(swUrl)\r\n .then(response => {\r\n // Ensure service worker exists, and that we really are getting a JS file.\r\n const contentType = response.headers.get('content-type')\r\n if (\r\n response.status === 404 ||\r\n (contentType != null && contentType.indexOf('javascript') === -1)\r\n ) {\r\n // No service worker found. Probably a different app. Reload the page.\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister().then(() => {\r\n window.location.reload()\r\n })\r\n })\r\n } else {\r\n // Service worker found. Proceed as normal.\r\n registerValidSW(swUrl, config)\r\n }\r\n })\r\n .catch(() => {\r\n console.log(\r\n 'No internet connection found. App is running in offline mode.'\r\n )\r\n })\r\n}\r\n\r\nexport function unregister () {\r\n if ('serviceWorker' in navigator) {\r\n navigator.serviceWorker.ready.then(registration => {\r\n registration.unregister()\r\n })\r\n }\r\n}\r\n","import React from 'react'\r\nimport ReactDOM from 'react-dom'\r\nimport './index.css'\r\nimport App from './App'\r\nimport * as serviceWorker from './serviceWorker'\r\nimport { LocaleProvider } from 'antd'\r\nimport zh_CN from 'antd/lib/locale-provider/zh_CN'\r\nimport moment from 'moment'\r\nimport 'moment/locale/zh-cn'\r\nmoment.locale('zh-cn')\r\n\r\nReactDOM.render(<LocaleProvider locale={zh_CN}><App /></LocaleProvider>, document.getElementById('root'))\r\n\r\n// If you want your app to work offline and load faster, you can change\r\n// unregister() to register() below. Note this comes with some pitfalls.\r\n// Learn more about service workers: https://bit.ly/CRA-PWA\r\nserviceWorker.unregister()\r\n"],"sourceRoot":""}