Skip to content

Commit

Permalink
Merge pull request #181 from GitDataAI/dev/xx
Browse files Browse the repository at this point in the history
Dev/xx
  • Loading branch information
lazhenyi authored Nov 27, 2024
2 parents 3486a12 + a6d1815 commit 0177dce
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 184 deletions.
7 changes: 5 additions & 2 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@
"ResetPass": "Reset your password",
"Username": "Username",
"Password": "Password",
"Tel": "Telephone",
"Captcha": "Captcha",
"CaptchaError": "Captcha Error",
"Email": "Email",
"ConfirmPass": "ConfirmPassword",
"ReAccount": "Retrieve account",
"Confirm": "Confirm",
"Submit": "Submit",
"H2": "About GitDataAi Cloud",
"Description": "GitDataAi Cloud is a platform for data management, visualization, and analysis that helps you manage and explore data resources efficiently.",
"Connectivity": "GitData.AI is a one-stop collaborative platform for the development, management, and trading of data products (such as AI models)to help you efficiently develop and explore data products.",
"Protection": "This site is protected by Cloudflare and subject to the Google",
"Protection": "This site is protected by Cloudflare and subject to the GitData.AI",
"PrivacyPolicy": "Privacy Policy",
"And": "and",
"Service": "Terms of Service.",
Expand All @@ -44,7 +46,8 @@
"Send": "Send",
"SendSuccess": " successfully",
"SendFail": " failed:",
"Search": "Search"
"Search": "Search",
"FindAccount": "Find Account"
},
"Header": {
"Home": "Home",
Expand Down
7 changes: 5 additions & 2 deletions messages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@
"ResetPass": "重置密码",
"Username": "用户名",
"Password": "密码",
"Tel": "手机号",
"Captcha": "验证码",
"CaptchaError": "验证码错误",
"Email": "邮箱",
"ConfirmPass": "确认密码",
"ReAccount": "找回账号",
"Confirm": "确认",
"Submit": "提交",
"H2": "关于 GitDataAi Cloud",
"Description": "GitDataAi Cloud 是一个用于数据管理、可视化和分析的平台,帮助您高效地管理和探索数据资源。",
"Connectivity": "GitData.AI 是一个用于数据产品(例如AI模型)的开发、管理、交易的一站式协作平台,帮助您高效地开发和探索数据产品。",
"Protection": "此站点受 Cloudflare 的保护,且遵循 Google",
"Protection": "此站点受 Cloudflare 的保护,且遵循 GitData.AI",
"PrivacyPolicy": "隐私政策",
"And": "",
"Service": "服务条款。",
Expand All @@ -44,7 +46,8 @@
"Send": "发送",
"Success": "成功",
"Fail": "失败:",
"Search": "搜索"
"Search": "搜索",
"FindAccount": "查找账户"
},
"Header": {
"Home": "主页",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"preview": "vite preview"
},
"dependencies": {
"@vitejs/plugin-basic-ssl": "^1.1.0",
"@types/js-cookie": "^3.0.6",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"axios": "^1.7.7",
"i18next": "^23.16.5",
"i18next-browser-languagedetector": "^8.0.0",
"js-cookie": "^3.0.5",
"less": "^4.2.0",
"jzfs-ts-api": "./jzfs-api",
"localforage": "^1.10.0",
"primeicons": "^7.0.0",
"react": "^18.3.1",
Expand All @@ -36,6 +37,7 @@
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"globals": "^15.11.0",
"jzfs-ts-api": "github:lazhenyi/jzfs-api",
"postcss": "^8.4.47",
"primereact": "^10.8.4",
"react-router-dom": "^6.28.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 32 additions & 84 deletions src/app/auth/FindAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import {Toast} from "primereact/toast";

const FindAccount = () => {
const [t] = useTranslation("Auth")
const [Step,setStep] = useState(0)
const [CountDown,setCountDown] = useState(60)
const [isCountDown,setisCountDown] = useState(false)
const [Oauth,setOauth] = useState<ReactElement<any, any>[]>([]);
const [user,Setuser] = useState({
email:"",
password:"",
Expand All @@ -21,82 +17,25 @@ const FindAccount = () => {
const [Time,setTime] = useState(t("Get")+t("Captcha"))
const nav = useNavigate();
const toast = useRef<Toast>(null)
useEffect(()=>{
setOauth([
// <button className="border border-[#c2c7d0] h-12 w-4/5 mt-2 mb-2"><FcGoogle className="inline mr-2" size={"2rem"}/>Google</button>,
// <button className="border border-[#c2c7d0] h-12 w-4/5 mt-2 mb-2"><FaApple className="inline mr-2" size={"2rem"}/>Apple</button>,
// <button className="border border-[#c2c7d0] h-12 w-4/5 mt-2 mb-2"><FaSlack className="inline mr-2" size={"2rem"}/>Slack</button>,
])
},[])
const handleSend = () => {
if(!isCountDown ){
Auth_api.send(user.email)
.then(res=>{
if (res.data.code === 200){
toast.current?.show({severity:'success',summary:t("Success"),detail:t("Send")+t('Success')})
// alert(t("Send")+t("Success"))
setisCountDown(true)
}else {
toast.current?.show({severity:'error',summary:t("Fail"),detail:t("Send")+t("Fail")})
// alert(t("Send")+t("Fail")+res.data.msg)
}
})
}
}

const validate = (code:string) => {
Auth_api.verification(code)
.then(res=>{
if (res.data.code === 200){
setStep(2)
}else {
toast.current?.show({severity:'error',summary:t("Fail"),detail:t("CaptchaError")})
// alert(t("CaptchaError"))
}
})
}
const InputCode = (code: string) => {
Setuser({...user,code:code})
if (code.length === 6){
validate(code);
}
}
const handleNext = () => {
Auth_api.register({
email:user.email,
password:user.password,
username:user.username
})
.then(res=>{
if (res.data.code === 200){
nav("/auth/login")
}else {
toast.current?.show({severity:'error',summary:t("RegistrationFailed"),detail:res.data.msg})
// alert(t("RegistrationFailed")+res.data.msg)
}
})
// Auth_api.register({
// email:user.email,
// password:user.password,
// username:user.username
// })
// .then(res=>{
// if (res.data.code === 200){
// nav("/auth/login")
// }else {
// toast.current?.show({severity:'error',summary:t("RegistrationFailed"),detail:res.data.msg})
// // alert(t("RegistrationFailed")+res.data.msg)
// }
// })
}
const handleEmailNext = (e:string) => {
Setuser({...user,email:e})
if (Step === 0){
setStep(1)
}
}
useEffect(() => {
if (isCountDown){
const timer = setTimeout(() => {
setCountDown(CountDown - 1)
if(CountDown == 0){
setisCountDown(false)
}
}, 1000)
return () =>{
clearTimeout(timer)
}

}
setCountDown(60)
}, [isCountDown,CountDown]);
const login = () => {
nav("/auth/login")
}
Expand All @@ -106,33 +45,42 @@ const FindAccount = () => {
<Toast ref={toast}/>
<div className="h-full">
<div className="flex items-baseline justify-center cursor-pointer">
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-52" />
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-52"/>
{/*<b className=" text-4xl">GitDataAI</b>*/}
</div>
<h3 className="text-center mt-6 mb-4 font-bold cursor-pointer">找回账号</h3>
<h3 className="text-center mt-6 mb-4 font-bold cursor-pointer">{t("ReAccount")}</h3>
<div>
<form className="flex flex-col items-center ">
<input onChange={(x)=>{
<input onChange={(x) => {
handleEmailNext(x.target.value)
}} type="text" placeholder={t("Enter")+t("Email")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/>
}} type="text" placeholder={t("Enter") + t("Email")}
className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/>

<input onChange={(x)=>{Setuser({...user,password:x.target.value})}} type="password" placeholder={"请输入你关联的手机号"} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/>
<input onChange={(x)=>{Setuser({...user,username:x.target.value})}} type="text" placeholder={t("Enter")+t("Username")} className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2 showDiv"/>
<input onChange={(x) => {
Setuser({...user, password: x.target.value})
}} type="password" placeholder={t("Enter") + t("Tel")}
className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/>
<input onChange={(x) => {
Setuser({...user, username: x.target.value})
}} type="text" placeholder={t("Enter") + t("Username")}
className="border border-[#8790a2] h-10 w-4/5 mt-2 mb-2 px-2"/>

<button type={"button"} onClick={handleNext} className="bg-[#f34d01e6] border border-[#8790a2] h-10 w-4/5"><span className="text-white">找回</span></button>
<button type={"button"} onClick={handleNext}
className="bg-[#f34d01e6] border border-[#8790a2] h-10 w-4/5"><span
className="text-white">{t("Confirm")}</span></button>

</form>
</div>
<div className="text-center mt-4 mb-5 cursor-pointer">

<span className="mr-1 hover:text-[#f34d01e6]"><a onClick={login}>{t("RemAccount")}</a></span>
</div>
<hr className="border-none h-px ml-auto mr-auto bg-[#c2c7d0] w-4/5"/>
<div className="flex items-baseline justify-center mt-1 cursor-pointer">
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-32" />
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-32"/>
{/*<strong className=" text-xl">GitDataAI</strong>*/}
</div>
<h3 className="text-center text-xs mb-2 cursor-pointer">{t("Connectivity")}</h3>
<h3 className="text-center text-xs cursor-pointer">{t("Protection")}<a href="#" className="hover:text-[#f34d01e6]">{t("PrivacyPolicy")}</a>{t("And")}<a href="#" className="hover:text-[#f34d01e6]">{t("Service")}</a></h3>
<h3 className="text-center text-xs cursor-pointer">{t("Protection")} <a href="#" className="hover:text-[#f34d01e6]">{t("PrivacyPolicy")}</a>{t("And")}<a href="#" className="hover:text-[#f34d01e6]">{t("Service")}</a></h3>
</div>
</>
);
Expand Down
4 changes: 1 addition & 3 deletions src/app/auth/Forgot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const Forgot =()=>{
<div className="h-full">
<div className="flex items-baseline justify-center cursor-pointer">
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-52" />
{/*<b className=" text-4xl">GitDataAI</b>*/}
</div>
<h3 className="text-center mt-6 mb-4 font-bold cursor-pointer">{t("ResetPass")}</h3>
<div>
Expand All @@ -118,10 +117,9 @@ const Forgot =()=>{
<hr className="border-none h-px ml-auto mr-auto bg-[#c2c7d0] w-4/5"/>
<div className="flex items-baseline justify-center mt-1 cursor-pointer">
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-32" />
{/*<strong className=" text-xl">GitDataAI</strong>*/}
</div>
<h3 className="text-center text-xs mb-2 cursor-pointer">{t("Connectivity")}</h3>
<h3 className="text-center text-xs cursor-pointer">{t("Protection")}<a href="#" className="hover:text-[#f34d01e6]">{t("PrivacyPolicy")}</a>{t("And")}<a href="#" className="hover:text-[#f34d01e6]">{t("Service")}</a></h3>
<h3 className="text-center text-xs cursor-pointer">{t("Protection")} <a href="#" className="hover:text-[#f34d01e6]">{t("PrivacyPolicy")}</a>{t("And")}<a href="#" className="hover:text-[#f34d01e6]">{t("Service")}</a></h3>
</div>
</>
);
Expand Down
3 changes: 1 addition & 2 deletions src/app/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ const Login = () => {
<hr className="border-none h-px ml-auto mr-auto bg-[#c2c7d0] w-4/5"/>
<div className="flex items-baseline justify-center mt-1 cursor-pointer">
<img src="/gitdata.ai-black-redpanda.png" alt="JZFS" className=" w-32" />
{/*<strong className=" text-xl">GitDataAI</strong>*/}
</div>
<h3 className="text-center text-xs mb-2 cursor-pointer">{t("Connectivity")}</h3>
<h3 className="text-center text-xs cursor-pointer">{t("Protection")}<a href="#" className="hover:text-[#f34d01e6]">{t("PrivacyPolicy")}</a>{t("And")}<a href="#" className="hover:text-[#f34d01e6]">{t("Service")}</a></h3>
<h3 className="text-center text-xs cursor-pointer">{t("Protection")} <a href="#" className="hover:text-[#f34d01e6]">{t("PrivacyPolicy")}</a>{t("And")}<a href="#" className="hover:text-[#f34d01e6]">{t("Service")}</a></h3>
</div>
</>
);
Expand Down
Loading

0 comments on commit 0177dce

Please sign in to comment.