1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"var _jsxFileName = \"D:\\\\aiproject\\\\goAgent\\\\todo\\\\client\\\\src\\\\components\\\\LoginForm.js\",\n _s = $RefreshSig$();\nimport React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { login } from '../services/api';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst LoginContainer = styled.div`\n background: rgba(255, 255, 255, 0.95);\n backdrop-filter: blur(10px);\n border-radius: 20px;\n padding: 40px;\n box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);\n width: 100%;\n max-width: 400px;\n text-align: center;\n`;\n_c = LoginContainer;\nconst Title = styled.h1`\n color: #333;\n margin-bottom: 30px;\n font-size: 28px;\n font-weight: 300;\n`;\n_c2 = Title;\nconst Form = styled.form`\n display: flex;\n flex-direction: column;\n gap: 20px;\n`;\n_c3 = Form;\nconst Input = styled.input`\n padding: 15px 20px;\n border: 2px solid #e1e5e9;\n border-radius: 12px;\n font-size: 16px;\n transition: all 0.3s ease;\n outline: none;\n\n &:focus {\n border-color: #667eea;\n box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);\n }\n\n &::placeholder {\n color: #a0a0a0;\n }\n`;\n_c4 = Input;\nconst Button = styled.button`\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n color: white;\n border: none;\n padding: 15px 20px;\n border-radius: 12px;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.3s ease;\n margin-top: 10px;\n\n &:hover {\n transform: translateY(-2px);\n box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n transform: none;\n }\n`;\n_c5 = Button;\nconst ErrorMessage = styled.div`\n color: #e74c3c;\n font-size: 14px;\n margin-top: 10px;\n padding: 10px;\n background: rgba(231, 76, 60, 0.1);\n border-radius: 8px;\n`;\n_c6 = ErrorMessage;\nconst Hint = styled.div`\n color: #666;\n font-size: 14px;\n margin-top: 20px;\n padding: 15px;\n background: rgba(102, 126, 234, 0.1);\n border-radius: 8px;\n border-left: 4px solid #667eea;\n`;\n_c7 = Hint;\nfunction LoginForm({\n onLogin\n}) {\n _s();\n const [password, setPassword] = useState('');\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState('');\n const handleSubmit = async e => {\n e.preventDefault();\n setLoading(true);\n setError('');\n try {\n const response = await login(password);\n onLogin(response.token);\n } catch (err) {\n var _err$response, _err$response$data;\n setError(((_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.error) || '登录失败,请重试');\n } finally {\n setLoading(false);\n }\n };\n return /*#__PURE__*/_jsxDEV(LoginContainer, {\n children: [/*#__PURE__*/_jsxDEV(Title, {\n children: \"\\u5DE5\\u4F5C\\u5F85\\u529E\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 112,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(Form, {\n onSubmit: handleSubmit,\n children: [/*#__PURE__*/_jsxDEV(Input, {\n type: \"password\",\n placeholder: \"\\u8BF7\\u8F93\\u5165\\u8BBF\\u95EE\\u5BC6\\u7801\",\n value: password,\n onChange: e => setPassword(e.target.value),\n required: true\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(Button, {\n type: \"submit\",\n disabled: loading,\n children: loading ? '验证中...' : '进入系统'\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 121,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 7\n }, this), error && /*#__PURE__*/_jsxDEV(ErrorMessage, {\n children: error\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 125,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(Hint, {\n children: \"\\uD83D\\uDCA1 \\u63D0\\u793A\\uFF1A\\u9996\\u6B21\\u4F7F\\u7528\\u9700\\u8981\\u8F93\\u5165\\u8BBF\\u95EE\\u5BC6\\u7801\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 5\n }, this);\n}\n_s(LoginForm, \"6NRUuqumFTBu2i+LH6oZYf8GNOA=\");\n_c8 = LoginForm;\nexport default LoginForm;\nvar _c, _c2, _c3, _c4, _c5, _c6, _c7, _c8;\n$RefreshReg$(_c, \"LoginContainer\");\n$RefreshReg$(_c2, \"Title\");\n$RefreshReg$(_c3, \"Form\");\n$RefreshReg$(_c4, \"Input\");\n$RefreshReg$(_c5, \"Button\");\n$RefreshReg$(_c6, \"ErrorMessage\");\n$RefreshReg$(_c7, \"Hint\");\n$RefreshReg$(_c8, \"LoginForm\");","map":{"version":3,"names":["React","useState","styled","login","jsxDEV","_jsxDEV","LoginContainer","div","_c","Title","h1","_c2","Form","form","_c3","Input","input","_c4","Button","button","_c5","ErrorMessage","_c6","Hint","_c7","LoginForm","onLogin","_s","password","setPassword","loading","setLoading","error","setError","handleSubmit","e","preventDefault","response","token","err","_err$response","_err$response$data","data","children","fileName","_jsxFileName","lineNumber","columnNumber","onSubmit","type","placeholder","value","onChange","target","required","disabled","_c8","$RefreshReg$"],"sources":["D:/aiproject/goAgent/todo/client/src/components/LoginForm.js"],"sourcesContent":["import React, { useState } from 'react';\r\nimport styled from 'styled-components';\r\nimport { login } from '../services/api';\r\n\r\nconst LoginContainer = styled.div`\r\n background: rgba(255, 255, 255, 0.95);\r\n backdrop-filter: blur(10px);\r\n border-radius: 20px;\r\n padding: 40px;\r\n box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);\r\n width: 100%;\r\n max-width: 400px;\r\n text-align: center;\r\n`;\r\n\r\nconst Title = styled.h1`\r\n color: #333;\r\n margin-bottom: 30px;\r\n font-size: 28px;\r\n font-weight: 300;\r\n`;\r\n\r\nconst Form = styled.form`\r\n display: flex;\r\n flex-direction: column;\r\n gap: 20px;\r\n`;\r\n\r\nconst Input = styled.input`\r\n padding: 15px 20px;\r\n border: 2px solid #e1e5e9;\r\n border-radius: 12px;\r\n font-size: 16px;\r\n transition: all 0.3s ease;\r\n outline: none;\r\n\r\n &:focus {\r\n border-color: #667eea;\r\n box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);\r\n }\r\n\r\n &::placeholder {\r\n color: #a0a0a0;\r\n }\r\n`;\r\n\r\nconst Button = styled.button`\r\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\r\n color: white;\r\n border: none;\r\n padding: 15px 20px;\r\n border-radius: 12px;\r\n font-size: 16px;\r\n font-weight: 500;\r\n cursor: pointer;\r\n transition: all 0.3s ease;\r\n margin-top: 10px;\r\n\r\n &:hover {\r\n transform: translateY(-2px);\r\n box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);\r\n }\r\n\r\n &:disabled {\r\n opacity: 0.6;\r\n cursor: not-allowed;\r\n transform: none;\r\n }\r\n`;\r\n\r\nconst ErrorMessage = styled.div`\r\n color: #e74c3c;\r\n font-size: 14px;\r\n margin-top: 10px;\r\n padding: 10px;\r\n background: rgba(231, 76, 60, 0.1);\r\n border-radius: 8px;\r\n`;\r\n\r\nconst Hint = styled.div`\r\n color: #666;\r\n font-size: 14px;\r\n margin-top: 20px;\r\n padding: 15px;\r\n background: rgba(102, 126, 234, 0.1);\r\n border-radius: 8px;\r\n border-left: 4px solid #667eea;\r\n`;\r\n\r\nfunction LoginForm({ onLogin }) {\r\n const [password, setPassword] = useState('');\r\n const [loading, setLoading] = useState(false);\r\n const [error, setError] = useState('');\r\n\r\n const handleSubmit = async (e) => {\r\n e.preventDefault();\r\n setLoading(true);\r\n setError('');\r\n\r\n try {\r\n const response = await login(password);\r\n onLogin(response.token);\r\n } catch (err) {\r\n setError(err.response?.data?.error || '登录失败,请重试');\r\n } finally {\r\n setLoading(false);\r\n }\r\n };\r\n\r\n return (\r\n <LoginContainer>\r\n <Title>工作待办</Title>\r\n <Form onSubmit={handleSubmit}>\r\n <Input\r\n type=\"password\"\r\n placeholder=\"请输入访问密码\"\r\n value={password}\r\n onChange={(e) => setPassword(e.target.value)}\r\n required\r\n />\r\n <Button type=\"submit\" disabled={loading}>\r\n {loading ? '验证中...' : '进入系统'}\r\n </Button>\r\n </Form>\r\n {error && <ErrorMessage>{error}</ErrorMessage>}\r\n <Hint>\r\n 💡 提示:首次使用需要输入访问密码\r\n </Hint>\r\n </LoginContainer>\r\n );\r\n}\r\n\r\nexport default LoginForm; "],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,KAAK,QAAQ,iBAAiB;AAAC,SAAAC,MAAA,IAAAC,OAAA;AAExC,MAAMC,cAAc,GAAGJ,MAAM,CAACK,GAAG;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACC,EAAA,GATIF,cAAc;AAWpB,MAAMG,KAAK,GAAGP,MAAM,CAACQ,EAAE;AACvB;AACA;AACA;AACA;AACA,CAAC;AAACC,GAAA,GALIF,KAAK;AAOX,MAAMG,IAAI,GAAGV,MAAM,CAACW,IAAI;AACxB;AACA;AACA;AACA,CAAC;AAACC,GAAA,GAJIF,IAAI;AAMV,MAAMG,KAAK,GAAGb,MAAM,CAACc,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACC,GAAA,GAhBIF,KAAK;AAkBX,MAAMG,MAAM,GAAGhB,MAAM,CAACiB,MAAM;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACC,GAAA,GAtBIF,MAAM;AAwBZ,MAAMG,YAAY,GAAGnB,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