minh 1 year ago
commit 2a5a6acdcb
  1. 2
      src/App.js
  2. 27
      src/_actions/users.js
  3. 8
      src/_components/Alert/success.js
  4. 8
      src/_components/Header/HeaderMain/index.js
  5. 6
      src/_constants/register.js
  6. 2
      src/_containers/HomePage/HomePage.style.scss
  7. 18
      src/_containers/HomePage/index.js
  8. 311
      src/_containers/RegisterPage/CreateAccount/index.js
  9. 67
      src/_containers/RegisterPage/CreateAccount/index.scss
  10. 2
      src/_containers/RegisterPage/index.js

@ -41,7 +41,7 @@ function App() {
component={ForgotPasswordPage} component={ForgotPasswordPage}
/> />
<RouteRedirectToAdmin <RouteRedirectToAdmin
path="/register" path="/dk"
exact={true} exact={true}
component={RegisterPage} component={RegisterPage}
/> />

@ -38,39 +38,14 @@ function login(data, type = "", typeWeb) {
let method = "POST"; let method = "POST";
return apiCaller(url_call_api, method, data, null, false).then( return apiCaller(url_call_api, method, data, null, false).then(
async (data) => { async (data) => {
let user = data?.data_user; let user = data;
user.isLogin = true; user.isLogin = true;
user.jwt_token = data.jwt_token;
user.is_new_acc = data.is_new_acc;
user.loginType = type;
const dataUser = new FormData();
dataUser.append("user_id", data?.data_user?.id);
dataUser.append("jwt_token", data?.jwt_token);
dataUser.append("signature", "1");
dispatch({ dispatch({
type: userConstants.LOGIN, type: userConstants.LOGIN,
user, user,
}); });
localStorage.setItem("authentication", JSON.stringify(user)); localStorage.setItem("authentication", JSON.stringify(user));
localStorage.setItem("access_token", JSON.stringify(data.access_token)); localStorage.setItem("access_token", JSON.stringify(data.access_token));
if (
data?.data_user?.last_login == null &&
data?.data_user?.role == userConstants.ROLE_STUDENT
) {
dispatch({ type: userConstants.ON_ROOTLESSNESS });
dispatch({ type: userConstants.SHOW_SIDEBAR_ROOTLESSNESS });
}
dispatch(teacherActions.getProfileV2(user.id));
let keyId = "device_id_" + data.id;
const cachedDeviceId = localStorage.getItem(keyId);
if (isNull(cachedDeviceId)) {
localStorage.setItem(keyId, device_id);
localStorage.setItem("device_id_commond", device_id);
} else {
localStorage.setItem("device_id_commond", cachedDeviceId);
}
history.push("/"); history.push("/");
}, },
(error) => { (error) => {

@ -5,12 +5,12 @@ import { useDispatch } from 'react-redux';
function AlertSuccess(props) { function AlertSuccess(props) {
const dispatch = useDispatch(); const dispatch = useDispatch();
let autoClose = setTimeout(() => { // let autoClose = setTimeout(() => {
close(); // close();
}, 2000); // }, 2000);
function close() { function close() {
clearTimeout(autoClose); // clearTimeout(autoClose);
props.onComplete(); props.onComplete();
dispatch(alertActions.clear()); dispatch(alertActions.clear());

@ -2,11 +2,15 @@ import { Link } from "react-router-dom";
import './HeaderMain.style.scss' import './HeaderMain.style.scss'
import { useState } from "react"; import { useState } from "react";
import {history} from '../../../_helpers/history' import {history} from '../../../_helpers/history'
import { apiCaller } from "../../../_helpers";
export default function HeaderMain() { export default function HeaderMain() {
const [isHoverLogout, setIsHoverLogout] = useState(false) const [isHoverLogout, setIsHoverLogout] = useState(false)
const handleLogout = () => { const handleLogout = async () => {
history.replace('/login') await apiCaller('/logout', "POST", {})
window.location.href = "/login";
localStorage.removeItem("authentication");
localStorage.removeItem("access_token");
} }
return ( return (

@ -2,3 +2,9 @@ export const STEP_REGISTER = {
CREATE_ACCOUNT: 'CREATE_ACCOUNT', CREATE_ACCOUNT: 'CREATE_ACCOUNT',
CREATE_INFORMATION: 'CREATE_INFORMATION', CREATE_INFORMATION: 'CREATE_INFORMATION',
} }
export const roleRegister = {
agents: 'agents',
general: 'general',
}

@ -21,7 +21,6 @@
padding: 24px; padding: 24px;
width: 50%; width: 50%;
display: flex; display: flex;
flex-direction: column;
@include screen_mobile { @include screen_mobile {
width: 100%; width: 100%;
@ -70,6 +69,7 @@
} }
.box-link { .box-link {
flex-direction: column;
.title-box-link { .title-box-link {
font-size: 24px; font-size: 24px;
font-weight: 700; font-weight: 700;

@ -2,6 +2,8 @@ import { useState } from "react";
import HeaderMain from "../../_components/Header/HeaderMain"; import HeaderMain from "../../_components/Header/HeaderMain";
import './HomePage.style.scss' import './HomePage.style.scss'
import { homeType } from "../../_constants/home_type"; import { homeType } from "../../_constants/home_type";
import { useSelector } from "react-redux";
import moment from "moment"
export default function HomePage() { export default function HomePage() {
const [typeCopy, setTypeCopy] = useState('') const [typeCopy, setTypeCopy] = useState('')
@ -9,7 +11,7 @@ export default function HomePage() {
[homeType.LANDING]: false, [homeType.LANDING]: false,
[homeType.REGISTER]: false, [homeType.REGISTER]: false,
}) })
const authentication = useSelector((state) => state.authentication);
const handleCopy = (type, value) => { const handleCopy = (type, value) => {
navigator.clipboard.writeText(value) navigator.clipboard.writeText(value)
@ -82,23 +84,23 @@ export default function HomePage() {
<div className="box-info-agency box-info"> <div className="box-info-agency box-info">
<div className="avatar-agency"> <div className="avatar-agency">
<img <img
src="https://letsenhance.io/static/73136da51c245e80edc6ccfe44888a99/1015f/MainBefore.jpg" src="https://www.svgrepo.com/show/384674/account-avatar-profile-user-11.svg"
alt="Logo Sun-E" alt="Logo Sun-E"
/> />
</div> </div>
<div className="main-info-agency"> <div className="main-info-agency">
<p className="name-agency"> <p className="name-agency">
Tên đại {authentication.fullname}
</p> </p>
<div className="sub-info-agency"> <div className="sub-info-agency">
{renderInfoAgencyItem('05/02/2000')} {renderInfoAgencyItem(moment(authentication.birthday).format("DD/MM/YYYY"))}
{renderInfoAgencyItem('0397225122')} {renderInfoAgencyItem(authentication.phone)}
{renderInfoAgencyItem('hoangmt@gmail.com')} {renderInfoAgencyItem(authentication.email)}
</div> </div>
</div> </div>
</div> </div>
{renderBoxLink('Link Đăng ký tuyến dưới', 'https://docs.google.com', homeType.REGISTER)} {renderBoxLink('Link Đăng ký tuyến dưới', authentication.downline_register, homeType.REGISTER)}
{renderBoxLink('Link Landing page cho khách hàng', 'https://docs.google.com/document/d/1hYRL9Su-zTbNXXFGb8AC8-u1NWtCIi4tZKTsRrrqSOg/edit', homeType.LANDING)} {renderBoxLink('Link Landing page cho khách hàng', authentication.promotional_link, homeType.LANDING)}
</div> </div>
</div> </div>
</div> </div>

File diff suppressed because one or more lines are too long

@ -1,4 +1,12 @@
@import "/src/_styles/mixin";
.register_step { .register_step {
@include screen_mobile {
padding-top: 0;
}
.title_register { .title_register {
margin-bottom: 18px; margin-bottom: 18px;
@ -47,6 +55,19 @@
margin: 0 auto; margin: 0 auto;
margin-top: 50px; margin-top: 50px;
@include screen_mobile {
max-width: unset;
}
.register-content-form {
gap: 32px;
@include screen_mobile {
flex-direction: column;
gap: 0;
}
}
.title { .title {
font-size: 32px; font-size: 32px;
text-transform: uppercase; text-transform: uppercase;
@ -59,8 +80,54 @@
margin: 24px 0; margin: 24px 0;
} }
.login_text {
font-size: 18px;
color: #00b9b7;
font-weight: 600
}
} }
.register-side { .register-side {
flex: 1; flex: 1;
.gender_female,
.gender_male {
margin-left: 16px;
}
.image-gender {
width: 64px;
height: 64px;
@include screen_mobile {
width: 44px;
height: 44px;
}
}
.radio-role {
display: flex;
align-items: center;
}
.radio-btn-role {
width: 20px;
height: 20px;
margin: 0;
margin-right: 6px;
}
input[type=radio] {
appearance: none;
border-radius: 50%;
background-clip: content-box;
border: 1px solid #000;
background-color: #fff;
}
input[type="radio"]:checked {
background-color: #00b9b7;
padding: 2px;
border: 2px solid #00b9b7;
}
} }

@ -10,7 +10,7 @@ export default function RegisterPage() {
<div className="bg-login rel"> <div className="bg-login rel">
<HeaderCurve></HeaderCurve> <HeaderCurve></HeaderCurve>
<div> <div>
<div className="sunE-form-container login-form-container"> <div className="sunE-form-container register-form-container">
<div className="sunE-custom-form register-form-container_content responsive_small_screen_margin_login"> <div className="sunE-custom-form register-form-container_content responsive_small_screen_margin_login">
<h2 className="title text-center">Đăng đại </h2> <h2 className="title text-center">Đăng đại </h2>
<div className="sunE-login-app"> <div className="sunE-login-app">

Loading…
Cancel
Save