注册登录
Change-Id: Ic0253e2ef228333a5982e887c8bac7389f914f5f
diff --git a/src/api/auth.ts b/src/api/auth.ts
index cba34b3..ced6d58 100644
--- a/src/api/auth.ts
+++ b/src/api/auth.ts
@@ -1,4 +1,5 @@
export const postUserLogin= '/auth/login';
export const postUserRegister= '/auth/register';
export const postVerifivateCode="/auth/send_verification_code";
-export const getRefreshToken="/auth/refresh_token";
\ No newline at end of file
+export const getRefreshToken="/auth/refresh_token";
+export const sendVerificationCode="/auth/send_verification_code";
\ No newline at end of file
diff --git a/src/views/login/login.tsx b/src/views/login/login.tsx
index 1bc18c2..e135e97 100644
--- a/src/views/login/login.tsx
+++ b/src/views/login/login.tsx
@@ -9,6 +9,8 @@
import { getUserInfo } from '@/api/user';
import debounce from 'lodash/debounce';
import { message } from 'antd';
+import { postUserRegister } from '@/api/auth'
+import { sendVerificationCode } from '@/api/auth'
const Login: React.FC = () => {
const [email, setEmail] = useState('');
@@ -84,7 +86,14 @@
}
}, 1000);
setCodeTimer(timer);
+
// TODO: 调用发送验证码接口
+ const bodyData = {
+ email:registerEmail,
+ }
+
+ const res = await request.post(sendVerificationCode, bodyData);
+ console.log("res", res);
message.success('验证码已发送');
};
@@ -107,6 +116,18 @@
return;
}
// TODO: 调用注册接口
+
+ const sendData = {
+ userName,
+ password:registerPassword,
+ email:registerEmail,
+ verificationCode: emailCode,
+ invitationCode:inviteCode,
+ }
+
+ const res = await request.post(postUserRegister, sendData);
+ console.log("res", res);
+
message.success('注册成功,请登录');
handleBackToLogin();
};
diff --git a/src/views/search/search.tsx b/src/views/search/search.tsx
index aaccc99..c786ac7 100644
--- a/src/views/search/search.tsx
+++ b/src/views/search/search.tsx
@@ -117,22 +117,14 @@
let queryParams: string = '';
if(params.keyword.trim() !== '') {
- // queryParams.append('keyword',params.keyword.trim());
queryParams += "keyword";
queryParams += "=";
queryParams += params.keyword.trim();
queryParams += "&";
- // queryParams.concat("keyword");
- // queryParams.concat(params.keyword.trim());
- // queryParams.concat("&");
}
queryParams += "author";
queryParams += "&";
if (params.tags.length > 0 || params.author !== '') {
- // queryParams.append('tags', params.tags.join(','));
- // queryParams.concat("tags");
- // queryParams.concat(params.tags.join(','));
- // queryParams.concat("&");
queryParams += "tags";
queryParams += "=";
if(params.tags.length >0){
@@ -144,8 +136,6 @@
}
}else{
- // queryParams.append('tags', '');
- // queryParams.concat("tags");
queryParams += "tags";
}