Merge pull request 'link auto login' (#12) from feature/TKA-29- into dev
Reviewed-on: huyt/fsi_project#12
This commit is contained in:
commit
b3bdabe398
30627
app/package-lock.json
generated
Normal file
30627
app/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -37,6 +37,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
.text-navbar {
|
||||
/* font-family: inherit; */
|
||||
font-family: 'Roboto Condensed', ;
|
||||
font-weight: 400;
|
||||
font-size: 23;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.font-family-text {
|
||||
font-family: 'Roboto Condensed', sans-serif;
|
||||
}
|
||||
|
||||
.color {
|
||||
color: black;
|
||||
font-size: 17;
|
||||
}
|
||||
|
||||
.modal-size {
|
||||
min-width: 50%
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ import "./App.css";
|
|||
import { Provider } from 'react-redux';
|
||||
import store from './store';
|
||||
import ReactRouter from './router/ReactRouter';
|
||||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
|
||||
import { BrowserRouter as Router, Link, Route, Switch } from 'react-router-dom';
|
||||
import AutoLogin from './components/AutoLogin/AutoLogin';
|
||||
|
||||
|
||||
|
||||
function App() {
|
||||
|
@ -23,7 +25,9 @@ function App() {
|
|||
<Provider store={store}>
|
||||
<Router>
|
||||
<Switch>
|
||||
<Route path="/login" exact render={() => <Login />} />
|
||||
{/* <Route path={"/login"} exact render={() => <Login />} /> */}
|
||||
<Route path={"/login"} exact render={() => <Login />} />
|
||||
<Route path={'/auth/:token?'} render={(props) => <AutoLogin {...props} />} />
|
||||
<ReactRouter />
|
||||
</Switch>
|
||||
</Router>
|
||||
|
|
58
app/src/components/AutoLogin/AutoLogin.js
Normal file
58
app/src/components/AutoLogin/AutoLogin.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { login } from '../../actions/isLogin';
|
||||
import React, { Component } from 'react';
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import { HOST } from '../../config/index';
|
||||
import Store from '../../store';
|
||||
import { role } from '../../actions/role';
|
||||
class AutoLogin extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
dataRole: Store.getState().role.role,
|
||||
isLogin: Store.getState().isLogin.isLogin,
|
||||
};
|
||||
Store.subscribe(() => {
|
||||
this.setState({
|
||||
isLogin: Store.getState().isLogin.isLogin,
|
||||
dataRole: Store.getState().role.role,
|
||||
}, () => {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
componentDidMount() {
|
||||
if(this.props.match.params.token){
|
||||
localStorage.setItem("access_token", "Bearer " + this.props.match.params.token);
|
||||
Store.dispatch(login("Bearer " + this.props.match.params.token));
|
||||
let data = fetch(`${HOST}/api/get_info`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': "Bearer " + this.props.match.params.token,
|
||||
// 'Authorization': token,
|
||||
},
|
||||
}).then((response) => {
|
||||
return response.json()
|
||||
}).then((data) => {
|
||||
if(data.status === 10000){
|
||||
localStorage.setItem("roles", JSON.stringify(data.roles));
|
||||
Store.dispatch(role(data.roles));
|
||||
window.location.href = "/";
|
||||
}else{
|
||||
alert('Sai token!!!');
|
||||
window.location.href = "/login";
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
render() {
|
||||
console.log('oke',Store.getState().role.role)
|
||||
return(
|
||||
<div></div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AutoLogin;
|
|
@ -59,6 +59,7 @@ class ImportImage extends Component {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token
|
||||
},
|
||||
data: {
|
||||
|
@ -129,6 +130,7 @@ class ImportImage extends Component {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token
|
||||
},
|
||||
body: JSON.stringify({ 'image_obj_id_list': [img._id] })
|
||||
|
@ -239,7 +241,7 @@ class ImportImage extends Component {
|
|||
<div className="m-portlet__head">
|
||||
<div className="m-portlet__head-caption">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
<h3 className="font-family-text">
|
||||
Kho ảnh
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -257,7 +259,7 @@ class ImportImage extends Component {
|
|||
})
|
||||
}}
|
||||
value={this.state.dataSearch}
|
||||
id="inputSearch" className="form-control m-input"
|
||||
id="inputSearch" className="form-control m-input font-family-text"
|
||||
placeholder="Tên ảnh..."
|
||||
data-col-index={0}
|
||||
/>
|
||||
|
@ -265,6 +267,7 @@ class ImportImage extends Component {
|
|||
<div className="form-group m-form__group col-xl-2">
|
||||
{process.env.REACT_APP_SOURCE_IMG === "1" ?
|
||||
<Select
|
||||
className="font-family-text"
|
||||
placeholder={'Loại ảnh'}
|
||||
value={this.state.valueSelected}
|
||||
onChange={this.changeHandleFilter}
|
||||
|
@ -280,10 +283,10 @@ class ImportImage extends Component {
|
|||
activePage: 1
|
||||
})
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--icon" id="m_search">
|
||||
className="btn btn-primary m-btn m-btn--icon" style={{backgroundColor: '#2673b4'}} id="m_search">
|
||||
<span>
|
||||
<i className="la la-search" />
|
||||
<span>Tìm kiếm</span>
|
||||
<span className="font-family-text">Tìm kiếm</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -295,7 +298,7 @@ class ImportImage extends Component {
|
|||
className="btn btn-secondary m-btn m-btn--icon" id="m_reset">
|
||||
<span>
|
||||
<i className="la la-rotate-left" />
|
||||
<span>Tải lại</span>
|
||||
<span className="font-family-text">Tải lại</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -308,19 +311,21 @@ class ImportImage extends Component {
|
|||
modalUploadShow: true,
|
||||
})
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
style={{backgroundColor: '#2673b4'}}
|
||||
className="btn btn-primary m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
<span>
|
||||
<i className="la la-plus" />
|
||||
<span>Tải ảnh lên</span>
|
||||
<span className="font-family-text">Tải ảnh lên</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
: "" }
|
||||
</div>
|
||||
{/*begin: Datatable */}
|
||||
<table className="table table-striped- table-bordered table-hover table-checkable" id="m_table_1">
|
||||
<thead>
|
||||
<tr>
|
||||
<table className="table table-striped- table-bordered table-hover table-checkable font-family-text" id="m_table_1">
|
||||
|
||||
<thead className='k-grid-header' role='rowgroup' style={{backgroundColor: '#2673b4'}}>
|
||||
<tr className='font-family-text color' style={{color: 'white', fontWeight: 600, fontSize: 16,}}>
|
||||
<th style={{width: "50px"}}>STT</th>
|
||||
<th>Ảnh</th>
|
||||
<th>Tên ảnh</th>
|
||||
|
@ -329,7 +334,7 @@ class ImportImage extends Component {
|
|||
{this.state.dataRole?.indexOf('import:edit') === -1 && this.state.dataRole?.indexOf('import:delete') === -1 ? "" : <th>Thao tác</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{bulletedListImg}</tbody>
|
||||
<tbody className="font-family-text">{bulletedListImg}</tbody>
|
||||
</table>
|
||||
<Modalupload
|
||||
show={this.state.modalUploadShow}
|
||||
|
@ -359,7 +364,7 @@ class ImportImage extends Component {
|
|||
pageRangeDisplayed={5}
|
||||
onChange={this.handlePageChange}
|
||||
/>
|
||||
<div>Tổng kết quả <strong>{this.state.totalLength}</strong></div>
|
||||
<div className="font-family-text">Tổng kết quả <strong>{this.state.totalLength}</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -10,6 +10,7 @@ import { HOST } from '../../config/index';
|
|||
import swal from 'sweetalert';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useSelector } from 'react-redux';
|
||||
import Store from '../../store';
|
||||
|
||||
const initialDataPost = {
|
||||
index: 1,
|
||||
|
@ -76,6 +77,7 @@ export default function LabelImage() {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token,
|
||||
},
|
||||
data: dataDel,
|
||||
|
@ -119,6 +121,7 @@ export default function LabelImage() {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token
|
||||
},
|
||||
data: data ? data : dataPost,
|
||||
|
@ -234,7 +237,7 @@ export default function LabelImage() {
|
|||
<div className="m-portlet__head">
|
||||
<div className="m-portlet__head-caption">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
<h3 className="font-family-text">
|
||||
Gán nhãn
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -250,7 +253,7 @@ export default function LabelImage() {
|
|||
setDataPost({ ...dataPost, search_data: e.target.value })
|
||||
}}
|
||||
value={dataPost.search_data}
|
||||
id="inputSearch" className="form-control m-input"
|
||||
id="inputSearch" className="font-family-text form-control m-input"
|
||||
placeholder="Họ tên..."
|
||||
data-col-index={0}
|
||||
/>
|
||||
|
@ -261,10 +264,10 @@ export default function LabelImage() {
|
|||
setActivePage(1)
|
||||
getData(dataPost)
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--icon" id="m_search">
|
||||
className="btn btn-primary m-btn m-btn--icon" id="m_search" style={{backgroundColor: '#2673b4'}}>
|
||||
<span>
|
||||
<i className="la la-search" />
|
||||
<span>Tìm kiếm</span>
|
||||
<span className='font-family-text'>Tìm kiếm</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -276,7 +279,7 @@ export default function LabelImage() {
|
|||
className="btn btn-secondary m-btn m-btn--icon" id="m_reset">
|
||||
<span>
|
||||
<i className="la la-rotate-left" />
|
||||
<span>Tải lại</span>
|
||||
<span className='font-family-text'>Tải lại</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -297,7 +300,7 @@ export default function LabelImage() {
|
|||
setDataEdit(dataEdit)
|
||||
setShowModal(true)
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
className="btn btn-primary m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air" style={{backgroundColor: '#2673b4'}}>
|
||||
<span>
|
||||
<i className="la la-plus" />
|
||||
<span>Thêm mới</span>
|
||||
|
@ -306,9 +309,10 @@ export default function LabelImage() {
|
|||
</div> : "" }
|
||||
</div>
|
||||
{/*begin: Datatable */}
|
||||
<table className="table table-striped- table-bordered table-hover table-checkable" id="m_table_1">
|
||||
<thead>
|
||||
<tr>
|
||||
<table className="table table-striped- font-family-text color table-bordered table-hover table-checkable" id="m_table_1">
|
||||
|
||||
<thead className='k-grid-header' role='rowgroup' style={{backgroundColor: '#2673b4'}}>
|
||||
<tr className='font-family-text color' style={{color: 'white', fontWeight: 600, fontSize: 16,}}>
|
||||
<th>Ảnh</th>
|
||||
<th>Họ tên</th>
|
||||
<th>FacebookID</th>
|
||||
|
|
|
@ -10,6 +10,7 @@ import { HOST } from '../../config/index';
|
|||
import swal from 'sweetalert';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useSelector } from 'react-redux';
|
||||
import Store from '../../store';
|
||||
|
||||
const initialDataPost = {
|
||||
index: 1,
|
||||
|
@ -74,6 +75,7 @@ export default function ListItem() {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token,
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
data: dataDel,
|
||||
})
|
||||
|
@ -117,6 +119,7 @@ export default function ListItem() {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
data: data ? data : dataPost,
|
||||
})
|
||||
|
@ -228,7 +231,7 @@ export default function ListItem() {
|
|||
<div className="m-portlet__head">
|
||||
<div className="m-portlet__head-caption">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
<h3 className="font-family-text">
|
||||
Danh sách người nổi tiếng
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -255,10 +258,10 @@ export default function ListItem() {
|
|||
setActivePage(1)
|
||||
getData(dataPost)
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--icon" id="m_search">
|
||||
className="btn btn-primary m-btn m-btn--icon" id="m_search" style={{backgroundColor: '#2673b4'}}>
|
||||
<span>
|
||||
<i className="la la-search" />
|
||||
<span>Tìm kiếm</span>
|
||||
<span className='font-family-text'>Tìm kiếm</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -270,7 +273,7 @@ export default function ListItem() {
|
|||
className="btn btn-secondary m-btn m-btn--icon" id="m_reset">
|
||||
<span>
|
||||
<i className="la la-rotate-left" />
|
||||
<span>Tải lại</span>
|
||||
<span className='font-family-text'>Tải lại</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -291,26 +294,27 @@ export default function ListItem() {
|
|||
setDataEdit(dataEdit)
|
||||
setShowModal(true)
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
style={{backgroundColor: '#2673b4'}}
|
||||
className="btn btn-primary m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
<span>
|
||||
<i className="la la-plus" />
|
||||
<span>Thêm mới</span>
|
||||
<span className='font-family-text'>Thêm mới</span>
|
||||
</span>
|
||||
</button>
|
||||
</div> : "" }
|
||||
</div>
|
||||
{/*begin: Datatable */}
|
||||
<table className="table table-striped- table-bordered table-hover table-checkable" id="m_table_1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ảnh</th>
|
||||
<thead className='k-grid-header' role='rowgroup' style={{backgroundColor: '#2673b4'}}>
|
||||
<tr className='font-family-text color' style={{color: 'white', fontWeight: 600, fontSize: 16,}}>
|
||||
<th >Ảnh</th>
|
||||
<th>Họ tên</th>
|
||||
<th>Giới tính</th>
|
||||
<th>Ngày sinh</th>
|
||||
{(dataRole?.indexOf('famous:delete') === -1 && dataRole?.indexOf('famous:edit') === -1) ? "" : <th>Thao tác</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{data && tableRows(data)}</tbody>
|
||||
<tbody className='font-family-text'>{data && tableRows(data)}</tbody>
|
||||
</table>
|
||||
<PulseLoader
|
||||
// css={override}
|
||||
|
|
|
@ -57,6 +57,7 @@ class Login extends Component {
|
|||
}
|
||||
return response.json()
|
||||
}).then((data) => {
|
||||
console.log('data', data);
|
||||
if (data.status === 10000) {
|
||||
console.log(data)
|
||||
console.log(data.data.roles)
|
||||
|
@ -115,6 +116,7 @@ class Login extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
console.log('const',this.props.match);
|
||||
return (
|
||||
<section className="login-block" style={{ 'width': '100%', 'height': '100vh' }}>
|
||||
<div className="container col-md-6 col-lg-5 col-xl-3">
|
||||
|
|
|
@ -9,6 +9,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|||
import { Button, Modal } from 'react-bootstrap';
|
||||
import swal from 'sweetalert';
|
||||
import { HOST } from '../../config/index';
|
||||
import Store from '../../store';
|
||||
|
||||
|
||||
|
||||
|
@ -85,6 +86,8 @@ const ModalEditLabel = (props) => {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token,
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
data: dataPost,
|
||||
})
|
||||
|
@ -232,6 +235,8 @@ const ModalEditLabel = (props) => {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify(dataUploadImg)
|
||||
})
|
||||
|
@ -277,6 +282,8 @@ const ModalEditLabel = (props) => {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
|
|
@ -9,6 +9,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|||
import { Button, Modal } from 'react-bootstrap';
|
||||
import swal from 'sweetalert';
|
||||
import { HOST } from '../../config/index';
|
||||
import Store from '../../store';
|
||||
|
||||
|
||||
|
||||
|
@ -84,6 +85,8 @@ const Modaledit = (props) => {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token,
|
||||
},
|
||||
data: dataPost,
|
||||
|
@ -229,6 +232,8 @@ const Modaledit = (props) => {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token
|
||||
},
|
||||
body: JSON.stringify(dataUploadImg)
|
||||
|
@ -273,7 +278,7 @@ const Modaledit = (props) => {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
person_obj_id: crrData._id ? crrData._id : "",
|
||||
|
|
|
@ -3,6 +3,7 @@ import moment from 'moment';
|
|||
import 'moment/locale/vi';
|
||||
import React, { Component } from 'react';
|
||||
import { Button, Modal } from 'react-bootstrap';
|
||||
import Store from '../../store';
|
||||
import swal from 'sweetalert';
|
||||
import { HOST } from '../../config/index';
|
||||
|
||||
|
@ -25,11 +26,11 @@ class ModalEditImg extends Component {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"origin_name": this.state.valueImg.origin_name,
|
||||
"obj_id": this.state.valueImg._id
|
||||
"obj_id": this.state.valueImg._id,
|
||||
})
|
||||
}).then((response) => {
|
||||
return (
|
||||
|
|
|
@ -5,6 +5,7 @@ import React from 'react';
|
|||
import { Button, Modal } from 'react-bootstrap';
|
||||
import swal from 'sweetalert';
|
||||
import { HOST } from '../../config/index';
|
||||
import Store from '../../store';
|
||||
|
||||
const ModalPassword = (props) => {
|
||||
const { show, onHide, obj_id } = props;
|
||||
|
@ -14,7 +15,11 @@ const ModalPassword = (props) => {
|
|||
const click_handle = async () => {
|
||||
let dataPost = {password: form.getFieldValue('password')}
|
||||
console.log(dataPost, obj_id)
|
||||
const result = await axios.patch(`${HOST}/api/users/${obj_id}/password`, { password: form.getFieldValue('password') })
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
}
|
||||
const result = await axios.patch(`${HOST}/api/users/${obj_id}/password`,{headers} ,{ password: form.getFieldValue('password') })
|
||||
if (result.data.status === 10000) {
|
||||
swal({
|
||||
icon: 'success',
|
||||
|
|
|
@ -5,6 +5,7 @@ import Switch from "react-switch";
|
|||
import swal from 'sweetalert';
|
||||
import $ from 'jquery';
|
||||
import Select from "react-select";
|
||||
import Store from '../../store';
|
||||
import { HOST } from '../../config/index';
|
||||
class ModalRole extends Component {
|
||||
|
||||
|
@ -61,6 +62,7 @@ class ModalRole extends Component {
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify(dataPost)
|
||||
}).then((response) => {
|
||||
|
@ -96,7 +98,7 @@ class ModalRole extends Component {
|
|||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify(dataPost)
|
||||
}).then((response) => {
|
||||
|
@ -178,6 +180,8 @@ class ModalRole extends Component {
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
}).then((response) => {
|
||||
return response.json()
|
||||
|
@ -196,6 +200,8 @@ class ModalRole extends Component {
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
}).then((response) => {
|
||||
return response.json()
|
||||
|
@ -358,7 +364,7 @@ class ModalRole extends Component {
|
|||
<form id="formAddRole">
|
||||
<div className="col-xl-12">
|
||||
<div className="m-widget14">
|
||||
<div className="form-group m-form__group">
|
||||
<div className="form-group m-form__group font-family-text">
|
||||
<label htmlFor="Name">Tên <span className="text-danger"> *</span></label>
|
||||
<input className="form-control m-input" id="Name" name='name' value={this.state.crrRole.name === '' ? '' : this.state.crrRole.name} onKeyDown={(event) => this.handleEnter(event)} onChange={e => this.RoleHandle(e)} placeholder="Tên" required />
|
||||
</div>
|
||||
|
|
|
@ -9,6 +9,7 @@ import LoadingOverlay from 'react-loading-overlay';
|
|||
import { PulseLoader } from 'react-spinners';
|
||||
import swal from 'sweetalert';
|
||||
import { HOST } from '../../config/index';
|
||||
import Store from '../../store';
|
||||
|
||||
const { Dragger } = Upload;
|
||||
|
||||
|
@ -40,6 +41,7 @@ const ModalUpload = (props) => {
|
|||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
}
|
||||
})
|
||||
)
|
||||
|
|
|
@ -9,6 +9,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|||
import { Button, Modal } from 'react-bootstrap';
|
||||
import swal from 'sweetalert';
|
||||
import { HOST } from '../../config/index';
|
||||
import Store from '../../store';
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
|
@ -52,7 +53,11 @@ const ModalUser = (props) => {
|
|||
|
||||
|
||||
const getLevel = async () => {
|
||||
let result = await axios.get(`${HOST}/api/levels/company/1`)
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
}
|
||||
let result = await axios.get(`${HOST}/api/levels/company/1`, {headers} )
|
||||
if (result.data.status === 10000) {
|
||||
var listOptions = []
|
||||
for (let i = 0; i < result.data.data.length; i++) {
|
||||
|
@ -85,6 +90,7 @@ const ModalUser = (props) => {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token,
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
data: dataPost,
|
||||
})
|
||||
|
|
|
@ -51,6 +51,7 @@ class Role extends Component {
|
|||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
}).then((response) => {
|
||||
return response.json()
|
||||
|
@ -91,6 +92,7 @@ class Role extends Component {
|
|||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
// 'Authorization': token,
|
||||
},
|
||||
}).then((response) => {
|
||||
|
@ -210,7 +212,7 @@ class Role extends Component {
|
|||
<div className="m-portlet__head p-3">
|
||||
<div className="m-portlet__head-caption pl-3">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
<h3 className="font-family-text">
|
||||
Thiết lập quyền
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -231,10 +233,10 @@ class Role extends Component {
|
|||
},
|
||||
modalRole: true,
|
||||
});
|
||||
}} className="btn btn-accent m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
}} className="btn btn-primary m-btn--custom m-btn--icon" style={{backgroundColor:'#2673b4'}}>
|
||||
<span>
|
||||
<i className="la la-plus" />
|
||||
<span>Thêm mới</span>
|
||||
<span className='font-family-text'>Thêm mới</span>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
|
@ -246,13 +248,13 @@ class Role extends Component {
|
|||
<div className="col-xl-12">
|
||||
<div className="m-widget1 col-xl-8 mx-auto">
|
||||
<div className="table-responsive text-nowrap">
|
||||
<table className="table table-bordered table-hover table-checkable dataTable no-footer dtr-inline collapsed">
|
||||
<thead>
|
||||
<table className="table table-bordered font-family-text color table-hover table-checkable dataTable no-footer dtr-inline collapsed">
|
||||
<thead className='k-grid-header' role='rowgroup' style={{color: 'white', fontWeight: 600, fontSize: 16, backgroundColor: '#2673b4'}}>
|
||||
<tr>
|
||||
<th style={{ 'verticalAlign': 'middle', 'width': '100px' }}>STT</th>
|
||||
<th style={{ 'verticalAlign': 'middle' }}>Tên</th>
|
||||
{/* <th style={{ 'verticalAlign': 'middle', 'width': '200px' }}>Trạng thái</th> */}
|
||||
{(this.state.dataRole?.indexOf('level:edit') === -1 && this.state.dataRole?.indexOf('level:delete') === -1) ? "" : <th style={{ 'verticalAlign': 'middle', 'width': '150px' }}>Thao tác</th>}
|
||||
{(this.state.dataRole?.indexOf('level:edit') === -1 && this.state.dataRole?.indexOf('level:delete') === -1) ? "" : <th style={{ 'verticalAlign': 'middle', 'width': '150px'}}>Thao tác</th>}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -135,7 +135,7 @@ class SearchImage extends Component {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJjbGFzc2lmeS9sb2dpbiJdLCJleHAiOjE2NDE5NzQ5NjV9.2F2PAUKjpfjPJKzgvzgCDtyBuTXDRl86EnJJGdYgWTM'
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
encodings: this.state.selectedEncoding,
|
||||
|
@ -205,6 +205,7 @@ class SearchImage extends Component {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
image: image_base64
|
||||
|
@ -395,140 +396,141 @@ class SearchImage extends Component {
|
|||
>
|
||||
<p style={{wordWrap: "break-word", marginBottom: "0px"}}><strong>facebookID: </strong>{value.person_id}</p>
|
||||
<p style={{wordWrap: "break-word"}}><strong>ImageID: </strong>{value.image_id}</p>
|
||||
<p style={{wordWrap: "break-word"}}><strong>Độ chính xác: </strong>{parseFloat(value.confidence * 100).toFixed(2)}%</p>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
});
|
||||
|
||||
|
||||
|
||||
console.log('oke em', this.state.isLogin);
|
||||
|
||||
return (
|
||||
<div className="m-portlet m-portlet--mobile pb-3">
|
||||
<div className="m-portlet__head">
|
||||
<div className="m-portlet__head-caption">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
Tìm kiếm ảnh
|
||||
</h3>
|
||||
<div className="m-portlet__head">
|
||||
<div className="m-portlet__head-caption">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="font-family-text color">
|
||||
Tìm kiếm ảnh
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="m-portlet__body pt-2">
|
||||
<div className="m-grid__item m-grid__item--fluid m-wrapper" style={{ backgroundColor: 'white' }}>
|
||||
<div className="m-content mt-3-phone pd_phone_0 p-3">
|
||||
<div className="m-form m-form--fit m-form--label-align-right">
|
||||
<div className="row m-0">
|
||||
<div className="col-md-2 px-0">
|
||||
<img src="./img/photo-placeholder.png" id="previewImagePerson" className="text-center" style={{width: '100%', height: 'auto'}} alt="" />
|
||||
<div className="text-center p-8">
|
||||
<ReactFileReader fileTypes={['image/png', 'image/jpg', 'image/jpeg']} base64={true} multipleFiles={false} handleFiles={this.onFilesChangeImagePerson} >
|
||||
<button style={{ marginTop: '10px' }} className={'btn m-btn--icon m-btn btn-default m-loader--success m-loader--right'}>
|
||||
<span >
|
||||
<i className="la la-cloud-upload"></i>
|
||||
<span>Chọn ảnh</span>
|
||||
</span>
|
||||
</button>
|
||||
</ReactFileReader>
|
||||
<div className="m-portlet__body pt-2">
|
||||
<div className="m-grid__item m-grid__item--fluid m-wrapper" style={{ backgroundColor: 'white' }}>
|
||||
<div className="m-content mt-3-phone pd_phone_0 p-3">
|
||||
<div className="m-form m-form--fit m-form--label-align-right">
|
||||
<div className="row m-0">
|
||||
<div className="col-md-2 px-0">
|
||||
<img src="./img/photo-placeholder.png" id="previewImagePerson" className="text-center" style={{width: '100%', height: 'auto'}} alt="" />
|
||||
<div className="text-center p-8">
|
||||
<ReactFileReader fileTypes={['image/png', 'image/jpg', 'image/jpeg']} base64={true} multipleFiles={false} handleFiles={this.onFilesChangeImagePerson} >
|
||||
<button style={{ marginTop: '10px' }} className={'btn m-btn--icon m-btn btn-default m-loader--success m-loader--right'}>
|
||||
<span >
|
||||
<i className="la la-cloud-upload"></i>
|
||||
<span>Chọn ảnh</span>
|
||||
</span>
|
||||
</button>
|
||||
</ReactFileReader>
|
||||
|
||||
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
|
||||
<div class="carousel-inner" data-interval="false">
|
||||
{rsImages}
|
||||
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
|
||||
<div class="carousel-inner" data-interval="false">
|
||||
{rsImages}
|
||||
</div>
|
||||
<a className={`carousel-control-prev ${rsImages.length <= 1 ? "d-none" : ""}`} href="#carouselExampleControls" role="button" data-slide="prev" onClick={() => this.handlePrevChange()}>
|
||||
<span class="carousel-control-prev-icon fa fa-chevron-left" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a className={`carousel-control-next ${rsImages.length <= 1 ? "d-none" : ""}`} href="#carouselExampleControls" role="button" data-slide="next" onClick={() => this.handleNextChange()}>
|
||||
<span class="carousel-control-next-icon fa fa-chevron-right" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
<a className={`carousel-control-prev ${rsImages.length <= 1 ? "d-none" : ""}`} href="#carouselExampleControls" role="button" data-slide="prev" onClick={() => this.handlePrevChange()}>
|
||||
<span class="carousel-control-prev-icon fa fa-chevron-left" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a className={`carousel-control-next ${rsImages.length <= 1 ? "d-none" : ""}`} href="#carouselExampleControls" role="button" data-slide="next" onClick={() => this.handleNextChange()}>
|
||||
<span class="carousel-control-next-icon fa fa-chevron-right" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
<div style={{ marginTop: '10px', textAlign: 'left' }}>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<span>Số kết quả: </span>
|
||||
</td>
|
||||
<td>
|
||||
<input className="form-control form-control-sm" type="number" step="1" min="1" name="m_table_1_length" value={this.state.valueRes} onChange={(event) => this.isChangeRes(event)} aria-controls="m_table_1" />
|
||||
<div style={{ marginTop: '10px', textAlign: 'left' }}>
|
||||
<table>
|
||||
<tbody className='font-family-text'>
|
||||
<tr>
|
||||
<td>
|
||||
<span>Số kết quả: </span>
|
||||
</td>
|
||||
<td>
|
||||
<input className="form-control form-control-sm" type="number" step="1" min="1" name="m_table_1_length" value={this.state.valueRes} onChange={(event) => this.isChangeRes(event)} aria-controls="m_table_1" />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>Tỷ lệ giống:</span>
|
||||
</td>
|
||||
<td>
|
||||
<label className="percent-simular" data-input="%">
|
||||
<input className="input-percent form-control form-control-sm" type="number" min="1" max="100" step="1" name="m_table_1_length" value={this.state.threshold} onChange={(event) => this.isChangeThreshold(event)} aria-controls="m_table_1" />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span>Tỷ lệ giống:</span>
|
||||
</td>
|
||||
<td>
|
||||
<label className="percent-simular" data-input="%">
|
||||
<input className="input-percent form-control form-control-sm" type="number" min="1" max="100" step="1" name="m_table_1_length" value={this.state.threshold} onChange={(event) => this.isChangeThreshold(event)} aria-controls="m_table_1" />
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div style={{ marginTop: '10px' }} className="ml-2 mb-mobile-10">
|
||||
<button
|
||||
onClick={() => {
|
||||
this.setState({
|
||||
page_num: 1,
|
||||
listHistory: []
|
||||
}, () => {
|
||||
this.getPerson();
|
||||
})
|
||||
}}
|
||||
className="btn btn-sm btn-primary m-btn--icon" style={{backgroundColor: '#2673b4'}}>
|
||||
<span>
|
||||
<i className="la la-search" />
|
||||
<span className='font-family-text'>Tìm kiếm</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style={{ marginTop: '10px' }} className="ml-2 mb-mobile-10">
|
||||
<button
|
||||
onClick={() => {
|
||||
this.setState({
|
||||
page_num: 1,
|
||||
listHistory: []
|
||||
}, () => {
|
||||
this.getPerson();
|
||||
})
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--icon">
|
||||
<span>
|
||||
<i className="la la-search" />
|
||||
<span>Tìm kiếm</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div className="col-md-10">
|
||||
<div className="pl-2 row d-flex justify-content-between">
|
||||
<div>
|
||||
<Pagination
|
||||
prevPageText='Trang trước'
|
||||
nextPageText='Trang sau'
|
||||
firstPageText='Trang đầu'
|
||||
lastPageText='Trang cuối'
|
||||
activePage={this.state.page_num}
|
||||
itemsCountPerPage={this.itemsPerPage}
|
||||
totalItemsCount={this.state.totalLength}
|
||||
pageRangeDisplayed={5}
|
||||
onChange={this.handlePageChange}
|
||||
/>
|
||||
<div className="col-md-10">
|
||||
<div className="pl-2 row d-flex justify-content-between">
|
||||
<div>
|
||||
<Pagination
|
||||
prevPageText='Trang trước'
|
||||
nextPageText='Trang sau'
|
||||
firstPageText='Trang đầu'
|
||||
lastPageText='Trang cuối'
|
||||
activePage={this.state.page_num}
|
||||
itemsCountPerPage={this.itemsPerPage}
|
||||
totalItemsCount={this.state.totalLength}
|
||||
pageRangeDisplayed={5}
|
||||
onChange={this.handlePageChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="pull-right">
|
||||
<div className='font-family-text'>Tổng kết quả <b>{this.state.totalLength}</b></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="pull-right">
|
||||
<div>Tổng kết quả <b>{this.state.totalLength}</b></div>
|
||||
|
||||
<div className='row-sm row pl-3 pr-3 pb-3'>
|
||||
{bulletedImg}
|
||||
<PulseLoader
|
||||
// css={override}
|
||||
sizeUnit={"px"}
|
||||
size={12}
|
||||
margin={'2px'}
|
||||
color={'#36D7B7'}
|
||||
loading={this.state.loading}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='row-sm row pl-3 pr-3 pb-3'>
|
||||
{bulletedImg}
|
||||
<PulseLoader
|
||||
// css={override}
|
||||
sizeUnit={"px"}
|
||||
size={12}
|
||||
margin={'2px'}
|
||||
color={'#36D7B7'}
|
||||
loading={this.state.loading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ export default function Test() {
|
|||
<div className="m-portlet__head">
|
||||
<div className="m-portlet__head-caption">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
<h3 className="font-family-text color">
|
||||
Độ chính xác
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@ export default function Test() {
|
|||
</div>
|
||||
<div className="m-portlet__body pt-2">
|
||||
<div className="pb-4 pt-4">
|
||||
<button type="button" onClick={() => test()} className="btn btn-success">Test</button>
|
||||
<button type="button" onClick={() => test()} className="btn font-family-text btn-primary" style={{backgroundColor: '#2673b4'}}>Test</button>
|
||||
</div>
|
||||
<PulseLoader
|
||||
// css={override}
|
||||
|
@ -65,7 +65,7 @@ export default function Test() {
|
|||
/>
|
||||
{text.length > 0 && text.map((item, index) => {
|
||||
return (
|
||||
<p>{item}</p>
|
||||
<p className='font-family-text color'>{item}</p>
|
||||
)
|
||||
})}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import swal from 'sweetalert';
|
|||
import { useLocation } from 'react-router-dom';
|
||||
import Switch from "react-switch";
|
||||
import Select from "react-select";
|
||||
import Store from '../../store';
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
const initialDataPost = {
|
||||
|
@ -86,7 +87,7 @@ export default function User() {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token,
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
})
|
||||
if (result.data.status === 10000) {
|
||||
|
@ -137,7 +138,7 @@ export default function User() {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
// 'Authorization': token
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
data: data ? data : dataPost,
|
||||
})
|
||||
|
@ -283,7 +284,7 @@ export default function User() {
|
|||
<div className="m-portlet__head p-3">
|
||||
<div className="m-portlet__head-caption pl-3">
|
||||
<div className="m-portlet__head-title">
|
||||
<h3 className="m-portlet__head-text">
|
||||
<h3 className="font-family-text">
|
||||
Quản lý người dùng
|
||||
</h3>
|
||||
</div>
|
||||
|
@ -313,7 +314,7 @@ export default function User() {
|
|||
className="btn btn-accent m-btn m-btn--custom m-btn--icon m-btn--pill m-btn--air">
|
||||
<span>
|
||||
<i className="la la-plus" />
|
||||
<span>Thêm</span>
|
||||
<span className='font-family-text'>Thêm</span>
|
||||
</span>
|
||||
</button>
|
||||
{/* :
|
||||
|
@ -336,7 +337,7 @@ export default function User() {
|
|||
}}
|
||||
value={dataPost.search_data}
|
||||
id="inputSearch"
|
||||
className="form-control m-input"
|
||||
className="form-control m-input font-family-text"
|
||||
placeholder="Tên đăng nhập/Họ tên..."
|
||||
data-col-index={0} />
|
||||
</div>
|
||||
|
@ -353,10 +354,10 @@ export default function User() {
|
|||
setActivePage(1)
|
||||
getData(dataPost)
|
||||
}}
|
||||
className="btn btn-accent m-btn m-btn--icon" id="m_search">
|
||||
className="btn btn-primary m-btn m-btn--icon" style={{backgroundColor: '#2673b4'}} id="m_search">
|
||||
<span>
|
||||
<i className="la la-search" />
|
||||
<span>Tìm kiếm</span>
|
||||
<span className='font-family-text'>Tìm kiếm</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -368,16 +369,16 @@ export default function User() {
|
|||
className="btn btn-secondary m-btn m-btn--icon" id="m_reset">
|
||||
<span>
|
||||
<i className="la la-rotate-left" />
|
||||
<span>Tải lại</span>
|
||||
<span className='font-family-text'>Tải lại</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div className="table-responsive text-nowrap">
|
||||
<table className="table table-bordered table-hover table-checkable dataTable no-footer dtr-inline collapsed">
|
||||
<thead>
|
||||
<tr>
|
||||
<table className="table table-bordered font-family-text color table-hover table-checkable dataTable no-footer dtr-inline collapsed">
|
||||
<thead className='k-grid-header' role='rowgroup' style={{backgroundColor: '#2673b4'}}>
|
||||
<tr className='font-family-text color' style={{color: 'white', fontWeight: 600, fontSize: 16,}}>
|
||||
<th style={{ 'verticalAlign': 'middle', 'width': '80px' }}>STT</th>
|
||||
<th style={{ 'verticalAlign': 'middle', 'width': '240px' }}>Tên đăng nhập</th>
|
||||
<th style={{ 'verticalAlign': 'middle', 'width': '280px' }}>Họ tên</th>
|
||||
|
|
|
@ -13,6 +13,7 @@ class Header extends Component {
|
|||
username : localStorage.getItem('username'),
|
||||
obj_id : localStorage.getItem('obj_id'),
|
||||
isLogin: Store.getState().isLogin.isLogin,
|
||||
role: JSON.parse(localStorage.getItem('roles')),
|
||||
access_token: Store.getState().isLogin.access_token,
|
||||
full_name: ""
|
||||
};
|
||||
|
@ -29,6 +30,7 @@ class Header extends Component {
|
|||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': Store.getState().isLogin.access_token,
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
|
@ -36,8 +38,11 @@ class Header extends Component {
|
|||
}).then(data => {
|
||||
if (data.status === 10000) {
|
||||
Store.dispatch(setbox(data.data.company_id));
|
||||
localStorage.setItem("roles", JSON.stringify(data.data.roles));
|
||||
Store.dispatch(role(data.data.roles));
|
||||
|
||||
this.setState({
|
||||
role: data.data.roles,
|
||||
full_name: data.data.full_name
|
||||
})
|
||||
}
|
||||
|
@ -129,48 +134,55 @@ class Header extends Component {
|
|||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li className="m-nav__item m-dropdown m-dropdown--medium m-dropdown--arrow m-dropdown--align-right m-dropdown--mobile-full-width m-dropdown--skin-light icon_logout" m-dropdown-toggle="click">
|
||||
<a href="#" className="m-nav__link m-dropdown__toggle">
|
||||
<span className="m-topbar__userpic">
|
||||
<img src="/img/photo-placeholder.png" className="m--img-rounded m--marginless m--img-centered" alt="" />
|
||||
</span>
|
||||
<span className="m-nav__link-icon m-topbar__usericon m--hide">
|
||||
<span className="m-nav__link-icon-wrapper"><i className="flaticon-user-ok" /></span>
|
||||
</span>
|
||||
</a>
|
||||
<div className="m-dropdown__wrapper">
|
||||
<span className="m-dropdown__arrow m-dropdown__arrow--right m-dropdown__arrow--adjust" />
|
||||
<div className="m-dropdown__inner">
|
||||
<div className="m-dropdown__header m--align-center">
|
||||
<div className="m-card-user m-card-user--skin-light">
|
||||
<div className="m-card-user__pic">
|
||||
<img src="/img/photo-placeholder.png" className="m--img-rounded m--marginless" alt="" />
|
||||
</div>
|
||||
<div className="m-card-user__details">
|
||||
<span className="m-card-user__name m--font-weight-500">{this.state.username}</span>
|
||||
<div href="#/" className="m-card-user__email m--font-weight-300 m-link">{this.state.full_name}</div>
|
||||
{
|
||||
this.state.role?.indexOf('avatar:hidden') === -1 ? (
|
||||
<li className="m-nav__item m-dropdown m-dropdown--medium m-dropdown--arrow m-dropdown--align-right m-dropdown--mobile-full-width m-dropdown--skin-light icon_logout" m-dropdown-toggle="click">
|
||||
<a href="#" className="m-nav__link m-dropdown__toggle">
|
||||
<span className="m-topbar__userpic">
|
||||
<img src="/img/photo-placeholder.png" className="m--img-rounded m--marginless m--img-centered" alt="" />
|
||||
</span>
|
||||
<span className="m-nav__link-icon m-topbar__usericon m--hide">
|
||||
<span className="m-nav__link-icon-wrapper"><i className="flaticon-user-ok" /></span>
|
||||
</span>
|
||||
</a>
|
||||
<div className="m-dropdown__wrapper">
|
||||
<span className="m-dropdown__arrow m-dropdown__arrow--right m-dropdown__arrow--adjust" />
|
||||
<div className="m-dropdown__inner">
|
||||
<div className="m-dropdown__header m--align-center">
|
||||
<div className="m-card-user m-card-user--skin-light">
|
||||
<div className="m-card-user__pic">
|
||||
<img src="/img/photo-placeholder.png" className="m--img-rounded m--marginless" alt="" />
|
||||
</div>
|
||||
<div className="m-card-user__details">
|
||||
<span className="font-family-text m-card-user__name m--font-weight-500">{this.state.username}</span>
|
||||
<div href="#/" className="m-card-user__email m--font-weight-300 m-link"><span className='font-family-text'>{this.state.full_name}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="m-dropdown__body">
|
||||
<div className="m-dropdown__content">
|
||||
<ul className="m-nav m-nav--skin-light">
|
||||
<li className="m-nav__separator m-nav__separator--fit">
|
||||
</li>
|
||||
<li className="m-nav__item">
|
||||
<a className="btn m-btn--pill btn-secondary m-btn m-btn--custom m-btn--label-brand m-btn--bolder"
|
||||
onClick={() => {
|
||||
localStorage.removeItem("access_token");
|
||||
window.location.href = "/login";
|
||||
}}
|
||||
><span className='font-family-text'>
|
||||
Đăng Xuất
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="m-dropdown__body">
|
||||
<div className="m-dropdown__content">
|
||||
<ul className="m-nav m-nav--skin-light">
|
||||
<li className="m-nav__separator m-nav__separator--fit">
|
||||
</li>
|
||||
<li className="m-nav__item">
|
||||
<a className="btn m-btn--pill btn-secondary m-btn m-btn--custom m-btn--label-brand m-btn--bolder"
|
||||
onClick={() => {
|
||||
localStorage.removeItem("access_token");
|
||||
window.location.href = "/login";
|
||||
}}
|
||||
>Đăng Xuất</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</li>
|
||||
) : null
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -37,9 +37,9 @@ class MenuBar extends Component {
|
|||
console.log(this.state.dataRole)
|
||||
|
||||
return (
|
||||
<div id="m_aside_left" className="m-aside-left m-aside-left--skin-dark">
|
||||
<div id="m_aside_left" className="m-aside-left m-aside-left--skin-dark" style={{backgroundColor: '#2673b4'}}>
|
||||
{/* BEGIN: Aside Menu */}
|
||||
<div id="m_ver_menu" className="m-aside-menu m-aside-menu--skin-dark m-aside-menu--submenu-skin-dark " data-menu-vertical="true" m-menu-scrollable={1} m-menu-dropdown-timeout={500}>
|
||||
<div id="m_ver_menu" className="m-aside-menu" data-menu-vertical="true" m-menu-scrollable={1} m-menu-dropdown-timeout={500}>
|
||||
<ul className="m-menu__nav m-menu__nav--dropdown-submenu-arrow ">
|
||||
<li className="m-menu__section m-menu__section--first">
|
||||
{/* <h4 className="m-menu__section-text">Departments</h4> */}
|
||||
|
@ -48,10 +48,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('search:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/search-image" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-search-1" />
|
||||
<i className="m-menu__link-icon fa fa-search" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Tìm kiếm</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Tìm kiếm</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
@ -61,10 +61,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('import:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/import-image" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-tabs" />
|
||||
<i className="m-menu__link-icon fa fa-file-image" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Kho ảnh</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Kho ảnh</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
@ -74,10 +74,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('famous:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/list-famous" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-avatar" />
|
||||
<i className="m-menu__link-icon fa fa-user-tie mr-2" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Người nổi tiếng</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Người nổi tiếng</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
@ -87,10 +87,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('person:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/label-image" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-delete" />
|
||||
<i className="m-menu__link-icon fa fa-tags" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Gán nhãn</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Gán nhãn</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
@ -100,10 +100,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('user:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/user" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-users" />
|
||||
<i className="m-menu__link-icon fas fa-user-cog mr-2" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Quản lý người dùng</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Quản lý người dùng</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
@ -113,10 +113,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('level:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/role" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-map" />
|
||||
<i className="m-menu__link-icon fa fa-sitemap" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Thiết lập quyền</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Thiết lập quyền</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
@ -126,10 +126,10 @@ class MenuBar extends Component {
|
|||
{this.state.dataRole?.indexOf('level:view') !== -1 ?
|
||||
<li className="m-menu__item m-menu__item--submenu" aria-haspopup="true" m-menu-submenu-toggle="hover">
|
||||
<NavLink to="/test" className={"m-menu__link " + active} activeClassName="m-menu__item--active" onClick={() => this.onClickClose()}>
|
||||
<i className="m-menu__link-icon flaticon-edit" />
|
||||
<i className="m-menu__link-icon fa fa-user-check" style={{color: 'white'}} />
|
||||
<span className="m-menu__link-title">
|
||||
<span className="m-menu__link-wrap">
|
||||
<span className="m-menu__link-text">Độ chính xác</span>
|
||||
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Độ chính xác</span>
|
||||
</span>
|
||||
</span>
|
||||
</NavLink>
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
font-family: 'Roboto Condensed', sans-serif;
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
color: black;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
margin: 0;
|
||||
font-family: 'Roboto Condensed', sans-serif;
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
color: black;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import {ROLE} from '../../actions/role';
|
||||
|
||||
let roles = JSON.parse(localStorage.getItem('roles'));
|
||||
|
||||
const initialState = {
|
||||
role: null
|
||||
role: roles
|
||||
};
|
||||
export default function role(state = initialState, action) {
|
||||
switch(action.type){
|
||||
|
|
|
@ -46,6 +46,7 @@ class ReactRouter extends Component {
|
|||
:
|
||||
''
|
||||
}
|
||||
|
||||
{
|
||||
this.state.dataRole?.indexOf('search:view') !== -1
|
||||
?
|
||||
|
|
15529
app/yarn.lock
15529
app/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user