Compare commits

...

10 Commits

Author SHA1 Message Date
Nguyễn Hải Dũng
f40c3eca9f fix socket 2022-12-23 11:21:51 +07:00
Nguyễn Hải Dũng
c8481e50ec socket 2022-12-23 11:05:40 +07:00
Nguyễn Hải Dũng
3c714fc8c5 fix avatar show 2022-12-22 18:31:09 +07:00
Nguyễn Hải Dũng
208a6b4e26 fix avatar 2022-12-21 16:03:45 +07:00
Nguyễn Hải Dũng
58ebf27cf1 fix link token 2022-12-21 14:26:16 +07:00
Nguyễn Hải Dũng
12daa7b687 fix token 2022-12-20 17:37:58 +07:00
Nguyễn Hải Dũng
ea6f927f87 menu 3 2022-12-20 17:25:21 +07:00
Nguyễn Hải Dũng
c8cae04cfc fix menu 2022-12-20 17:07:48 +07:00
Nguyễn Hải Dũng
061f3da142 fix ui 2022-12-20 17:00:23 +07:00
Nguyễn Hải Dũng
038e12820b style 2022-12-20 11:21:31 +07:00
15 changed files with 244 additions and 198 deletions

View File

@ -1,2 +1,3 @@
REACT_APP_HOST='http://api.face-classify.beetai.com'
REACT_APP_SOURCE_IMG=0
REACT_APP_SOURCE_IMG=1
WDS_SOCKET_PORT=0

View File

@ -39,9 +39,9 @@
.text-navbar {
/* font-family: inherit; */
font-family: 'Roboto Condensed', sans-serif;
font-weight: 900;
font-size: 15;
font-family: 'Roboto Condensed', ;
font-weight: 400;
font-size: 23;
color: #fff;
}

View File

@ -3,6 +3,7 @@ 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);
@ -24,11 +25,30 @@ class AutoLogin extends Component {
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',this.props.match)
console.log('oke',Store.getState().role.role)
return(
<div></div>
)

View File

@ -241,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>
@ -259,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}
/>
@ -267,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}
@ -282,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>
@ -297,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>
@ -310,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>
@ -331,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}

View File

@ -264,7 +264,7 @@ 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 className='font-family-text'>Tìm kiếm</span>
@ -300,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>
@ -310,8 +310,9 @@ export default function LabelImage() {
</div>
{/*begin: Datatable */}
<table className="table table-striped- font-family-text color table-bordered table-hover table-checkable" id="m_table_1">
<thead>
<tr>
<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>

View File

@ -258,7 +258,7 @@ 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 className='font-family-text'>Tìm kiếm</span>
@ -294,7 +294,8 @@ 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 className='font-family-text'>Thêm mới</span>
@ -304,8 +305,8 @@ export default function ListItem() {
</div>
{/*begin: Datatable */}
<table className="table table-striped- table-bordered table-hover table-checkable" id="m_table_1">
<thead>
<tr className='font-family-text color'>
<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>

View File

@ -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',

View File

@ -53,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++) {

View File

@ -233,7 +233,7 @@ 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 className='font-family-text'>Thêm mới</span>
@ -249,12 +249,12 @@ class Role extends Component {
<div className="m-widget1 col-xl-8 mx-auto">
<div className="table-responsive text-nowrap">
<table className="table table-bordered font-family-text color table-hover table-checkable dataTable no-footer dtr-inline collapsed">
<thead>
<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>

View File

@ -1,4 +1,5 @@
import { Card, Image as ImageAntd } from 'antd';
import Header from 'components/layouts/Header';
import Parser from 'html-react-parser';
import $ from 'jquery';
import React, { Component } from 'react';
@ -482,10 +483,10 @@ class SearchImage extends Component {
this.getPerson();
})
}}
className="btn btn-accent m-btn m-btn--icon">
className="btn btn-sm btn-primary m-btn--icon" 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>

View File

@ -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 font-family-text 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}

View File

@ -354,7 +354,7 @@ 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 className='font-family-text'>Tìm kiếm</span>
@ -377,8 +377,8 @@ export default function User() {
</div>
<div className="table-responsive text-nowrap">
<table className="table table-bordered font-family-text color table-hover table-checkable dataTable no-footer dtr-inline collapsed">
<thead>
<tr>
<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>

View File

@ -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: ""
};
@ -37,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
})
}
@ -130,6 +134,8 @@ class Header extends Component {
</div>
</div>
</li>
{
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">
@ -175,6 +181,8 @@ class Header extends Component {
</div>
</div>
</li>
) : null
}
</ul>
</div>
</div>

View File

@ -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="text-navbar 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="text-navbar 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="text-navbar 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="text-navbar m-menu__link-text text-navbar">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="text-navbar 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="text-navbar 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="text-navbar 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="text-navbar 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="text-navbar 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="text-navbar m-menu__link-text">Quản người dùng</span>
<span className="text-navbar" style={{fontSize: 20, fontFamily: 'Roboto'}}>Quản 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="text-navbar 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="text-navbar 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="text-navbar 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="text-navbar 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>

View File

@ -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){