Skip to content

Commit d4e4567

Browse files
committed
add
1 parent 03aad95 commit d4e4567

25 files changed

+9724
-5007
lines changed

__pycache__/flask.cpython-311.pyc

21.8 KB
Binary file not shown.

package-lock.json

Lines changed: 4250 additions & 1915 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"@ant-design/icons": "^5.2.6",
67
"@testing-library/jest-dom": "^5.16.5",
78
"@testing-library/react": "^13.4.0",
89
"@testing-library/user-event": "^13.5.0",
10+
"antd": "^5.13.2",
11+
"axios": "^1.6.5",
912
"bootstrap": "^5.3.0",
1013
"chart": "^0.1.2",
1114
"chart.js": "^4.3.0",
1215
"mdb-react-ui-kit": "^6.1.0",
1316
"react": "^18.2.0",
17+
"react-audio-player": "^0.17.0",
1418
"react-chartjs-2": "^5.2.0",
1519
"react-csv": "^2.2.2",
1620
"react-dom": "^18.2.0",
1721
"react-icons": "^4.8.0",
1822
"react-modal": "^3.16.1",
1923
"react-papaparse": "^4.1.0",
2024
"react-router-dom": "^6.11.2",
21-
"react-scripts": "5.0.1",
25+
"react-script": "^2.0.5",
26+
"react-scripts": "^5.0.1",
2227
"reactstrap": "^9.1.10",
28+
"tesseract.js": "^5.0.4",
2329
"web-vitals": "^2.1.4"
2430
},
2531
"scripts": {

src/CauNoiHay.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.container {
2+
background-image: url('./img/house.png');
3+
/* Thay 'path_to_your_image.jpg' bằng đường dẫn đến hình ảnh nền */
4+
background-size: cover;
5+
background-position: center;
6+
height: 100vh;
7+
/* Đảm bảo chiều cao bằng chiều cao của màn hình */
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
flex-direction: column;
12+
}
13+
14+
.centered-text {
15+
color: white;
16+
/* Màu chữ trắng */
17+
font-size: 24px;
18+
/* text-align: center; */
19+
}

src/CauNoiHay.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, { useRef, useState } from 'react';
2+
import './CauNoiHay.css'; // Import file CSS để định dạng giao diện
3+
4+
const CauNoiHay = () => {
5+
const s = "Xin chào các bạn xuống dòng nè \n Bây giờ sẽ công chiếu"
6+
const sentense = s.split(' ')
7+
const [message, setMessage] = useState('');
8+
9+
const a = useRef('')
10+
const handleClick = () => {
11+
let j = 0
12+
let temp = ""
13+
for (let i of sentense) {
14+
setMessage("")
15+
setTimeout(async () => {
16+
await setMessage(temp => temp + i + " ");
17+
}, 200 * j);
18+
j++
19+
temp = message
20+
}
21+
// setTimeout(() => {
22+
// setMessage(message => message + ' rồi');
23+
// setTimeout(() => {
24+
// setMessage(message => message + ' chào');
25+
// }, 10);
26+
// }, 10);
27+
};
28+
29+
const splitSentence = () => {
30+
const words = message.split(' ');
31+
return words.map((word, index) => <span key={index}>{word}&nbsp;</span>);
32+
};
33+
34+
return (
35+
<div className="container"> {/* Đặt className container để tùy chỉnh giao diện */}
36+
<h1 className="centered-text">{message}</h1> {/* Đặt className centered-text để căn giữa chữ */}
37+
<button onClick={handleClick}>Chạm để chào</button>
38+
</div>
39+
);
40+
};
41+
42+
export default CauNoiHay;

src/ReadImage.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import cv2
2+
import pytesseract
3+
from flask import Flask, request, jsonify
4+
from flask_cors import CORS
5+
6+
app = Flask(__name__)
7+
CORS(app)
8+
9+
def process_image(image_path):
10+
# Đọc ảnh từ đường dẫn
11+
img = cv2.imread(image_path)
12+
13+
# Chuyển đổi ảnh sang đen trắng
14+
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
15+
16+
# Áp dụng bộ lọc Gaussian để giảm nhiễu
17+
blurred_img = cv2.GaussianBlur(gray_img, (5, 5), 0)
18+
19+
# Sử dụng thư viện Tesseract OCR để nhận diện chữ số
20+
custom_config = r'--oem 3 --psm 6 outputbase digits'
21+
result = pytesseract.image_to_string(blurred_img, config=custom_config)
22+
23+
return result.strip()
24+
25+
@app.route('/analyze_image', methods=['POST'])
26+
def analyze_image():
27+
# Kiểm tra xem có dữ liệu image trong form data không
28+
if 'image' not in request.files:
29+
return jsonify({'error': 'No image provided'})
30+
31+
image = request.files['image']
32+
33+
# Lưu ảnh tạm thời
34+
image_path = 'temp_image.png'
35+
image.save(image_path)
36+
37+
# Phân tích ảnh và nhận dãy chữ số
38+
result = process_image(image_path)
39+
40+
# Xóa ảnh tạm thời sau khi đã xử lý
41+
import os
42+
os.remove(image_path)
43+
44+
return jsonify({'result': result})
45+
46+
if __name__ == '__main__':
47+
app.run(debug=True)
21.8 KB
Binary file not shown.

src/component/InputSearch.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { Input } from 'antd';
3+
const { Search } = Input;
4+
const InputSearch = () => (
5+
<>
6+
<Search placeholder="input search loading default" loading={false} />
7+
<br />
8+
<br />
9+
<br />
10+
<br />
11+
<Search placeholder="input search text" enterButton="Search" size="large" loading />
12+
</>
13+
);
14+
export default InputSearch;

src/component/Select.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React, { useState } from 'react';
2+
import { Radio, Select, Space } from 'antd';
3+
const handleChange = (value) => {
4+
console.log(`Selected: ${value}`);
5+
};
6+
const App = ({ array }) => {
7+
const [size, setSize] = useState('middle');
8+
const handleSizeChange = (e) => {
9+
setSize(e.target.value);
10+
};
11+
return (
12+
<>
13+
<Space
14+
direction="vertical"
15+
style={{
16+
width: '100%',
17+
}}
18+
>
19+
<Select
20+
size={size}
21+
defaultValue={array[0].label}
22+
onChange={handleChange}
23+
style={{
24+
width: '100%',
25+
}}
26+
options={array}
27+
/>
28+
29+
</Space>
30+
</>
31+
);
32+
};
33+
export default App;

src/component_product/List_Project.js

Lines changed: 76 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
1-
import React, { useState, memo, useEffect } from 'react';
1+
import React, { useState, memo, useEffect, useContext } from 'react';
22
import Modal from 'react-modal';
33
import { AiFillCloseCircle } from "react-icons/ai";
44
import '../style/style.css'
55
import Header from '../header'
6+
import { auth } from '../auth';
67
Modal.setAppElement('#root'); // Thiết lập phần tử gốc của ứng dụng
78

89
function List_Project() {
910
const [data, set_data] = useState([])
1011
const [employee, set_employee] = useState([])
12+
const [tke, set_tke] = useState({})
13+
console.log('in')
14+
useEffect(() => {
15+
// fetch('http://127.0.0.1:5000/list-project', {
16+
fetch('http://127.0.0.1:5000/api/thong-ke', {
17+
method: 'GET',
18+
headers: {
19+
Accept: 'application/json',
20+
'Content-Type': 'application/json',
21+
Authorization: 'Bearer ' + 'token'
22+
},
23+
timeout: 2000,
24+
// body: JSON.stringify([]),
25+
}).then((response) => response.json())
26+
.then((actualData) => {
27+
// console.log(actualData)
28+
if (actualData.result == 1) {
29+
set_tke(actualData)
30+
31+
}
32+
else {
33+
alert(actualData.message)
34+
}
35+
});
36+
}, [])
1137
useEffect(() => {
1238
// fetch('http://127.0.0.1:5000/list-project', {
1339
fetch('http://127.0.0.1:5000/employees', {
@@ -54,7 +80,6 @@ function List_Project() {
5480
}
5581
});
5682
}, [])
57-
5883
const type_name = {
5984
"Type 1": "Phân loại văn bản",
6085
"Type 2": "Hỏi đáp",
@@ -70,54 +95,61 @@ function List_Project() {
7095
"-1": "#FF0000"
7196
}
7297
return (
73-
<div style={{ marginLeft: 10 }}>
98+
<div>
7499
<Header />
75-
<div className='tk-gradient'>
76-
<div className='tk-gradient-each' >
77-
<p style={{ fontSize: 20, fontWeight: 600 }}>879</p>
78-
<p style={{ fontSize: 18, fontWeight: 400 }}>Mẫu API dữ liệu</p>
79-
</div>
80-
<div className='tk-gradient-each'>
81-
<p style={{ fontSize: 20, fontWeight: 600 }}>{data.length}</p>
82-
<p style={{ fontSize: 18, fontWeight: 400 }}>Dự án</p>
83-
</div>
84-
<div className='tk-gradient-each'>
85-
<p style={{ fontSize: 20, fontWeight: 600 }}>2</p>
86-
<p style={{ fontSize: 18, fontWeight: 400 }}>Dự án hoàn thành</p>
100+
101+
<div style={{ marginLeft: 10 }}>
102+
<div className='tk-gradient'>
103+
<div className='tk-gradient-each' >
104+
<p style={{ fontSize: 20, fontWeight: 600 }}>{tke.dataListCount ? tke.dataListCount : 0}</p>
105+
<p style={{ fontSize: 18, fontWeight: 400 }}>Số mẫu dữ liệu</p>
106+
</div>
107+
<div className='tk-gradient-each'>
108+
<p style={{ fontSize: 20, fontWeight: 600 }}>{tke.projectCount ? tke.projectCount : 0}</p>
109+
<p style={{ fontSize: 18, fontWeight: 400 }}>Dự án</p>
110+
</div>
111+
<div className='tk-gradient-each'>
112+
<p style={{ fontSize: 20, fontWeight: 600 }}>{tke.projectFinished ? tke.projectFinished : 0}</p>
113+
<p style={{ fontSize: 18, fontWeight: 400 }}>Dự án hoàn thành</p>
114+
</div>
115+
<div className='tk-gradient-each'>
116+
<p style={{ fontSize: 20, fontWeight: 600 }}>{tke.employeeCount ? tke.employeeCount : 0}</p>
117+
<p style={{ fontSize: 18, fontWeight: 400 }}>Thành viên</p>
118+
</div>
87119
</div>
88-
<div className='tk-gradient-each'>
89-
<p style={{ fontSize: 20, fontWeight: 600 }}>{employee.length}</p>
90-
<p style={{ fontSize: 18, fontWeight: 400 }}>Thành viên</p>
120+
121+
<h1 style={{ textAlign: 'center' }}>Danh sách dự án</h1>
122+
<div style={{ display: 'flex', flexDirection: 'row', marginTop: 40, border: '0.5px solid black', borderColor: 'black', borderTop: 0, borderLeft: 0, borderRight: 0 }}>
123+
<div style={{ width: '3%', fontWeight: 600, marginRight: 10 }}><p>STT</p></div>
124+
<div style={{ width: '18%', fontWeight: 600, marginRight: 10 }}><p>Tên dự án</p></div>
125+
<div style={{ width: '18%', fontWeight: 600, marginRight: 10 }}><p>Loại</p></div>
126+
<div style={{ width: '14%', fontWeight: 600, marginRight: 10 }}><p>Số người tham gia</p></div>
127+
<div style={{ width: '12%', fontWeight: 600 }}><p>Số người tối đa</p></div>
128+
<div style={{ width: '12%', fontWeight: 600 }}><p>Thời gian tạo</p></div>
129+
<div style={{ width: '12%', fontWeight: 600, display: 'flex', alignItems: 'center', }}><p>Status</p></div>
130+
<div style={{ width: '10%', fontWeight: 600 }}><p>Action</p></div>
91131
</div>
132+
{data.map((item, index) => (
133+
<div style={{ display: 'flex', flexDirection: 'row', marginTop: 20, marginBottom: 20 }}>
134+
<div style={{ width: '3%', fontWeight: 400, marginRight: 10 }}><p>{index}</p></div>
135+
<div style={{ width: '20%', fontWeight: 400, marginRight: 10 }}><p>{item.nameProject}</p></div>
136+
<div style={{ width: '20%', fontWeight: 400, marginRight: 10 }}><p>{type_name[item.type.type]}</p></div>
137+
<div style={{ width: '15%', fontWeight: 400, marginRight: 10 }}><p>{item.listEmployee.length}</p></div>
138+
<div style={{ width: '12%', fontWeight: 400 }}><p>{item.maxEmployees}</p></div>
139+
<div style={{ width: '12%', fontWeight: 400 }}><p>{item.time}</p></div>
140+
<div style={{ width: '12%', fontWeight: 400, display: 'flex', alignItems: 'center', }}><p style={{ border: '1px solid rgba(0,0,0,0.5)', width: '80%', textAlign: 'center', borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center', backgroundColor: backgroundColor[item.status], color: 'black' }}>{item.status == 0 ? 'Processing' : item.status == 1 ? 'Finished' : 'Lated'}</p></div>
141+
<div style={{ marginLeft: 0, width: '10%', flexDirection: 'column', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
142+
<a href={'/bieu-do/' + item.id} style={{ marginLeft: 0, color: '#43BFC7' }}>Thống kê</a>
143+
<a href={'/about/' + item.id} style={{ marginLeft: 0 }}>Xem chi tiết</a>
144+
<a href={'/edit-project/' + item.id} style={{ marginLeft: 0, color: 'red' }}>Điều chỉnh</a>
145+
{/* <a href={'/edit-project/' + item.id} style={{ marginLeft: 0, color: 'red' }}>Điều chỉnh</a> */}
146+
</div>
147+
</div>
148+
))}
92149
</div>
93150

94-
<h1 style={{ textAlign: 'center' }}>Danh sách dự án</h1>
95-
<div style={{ display: 'flex', flexDirection: 'row', marginTop: 40, border: '0.5px solid black', borderColor: 'black', borderTop: 0, borderLeft: 0, borderRight: 0 }}>
96-
<div style={{ width: '19%', fontWeight: 600, marginRight: 10 }}><p>Tên dự án</p></div>
97-
<div style={{ width: '19%', fontWeight: 600, marginRight: 10 }}><p>Loại</p></div>
98-
<div style={{ width: '15%', fontWeight: 600, marginRight: 10 }}><p>Số người tham gia</p></div>
99-
<div style={{ width: '12%', fontWeight: 600 }}><p>Số người tối đa</p></div>
100-
<div style={{ width: '12%', fontWeight: 600 }}><p>Thời gian tạo</p></div>
101-
<div style={{ width: '12%', fontWeight: 600, display: 'flex', alignItems: 'center', }}><p>Status</p></div>
102-
<div style={{ width: '10%', fontWeight: 600 }}><p>Action</p></div>
103-
</div>
104-
{data.map((item, index) => (
105-
<div style={{ display: 'flex', flexDirection: 'row', marginTop: 20, marginBottom: 20 }}>
106-
<div style={{ width: '20%', fontWeight: 400, marginRight: 10 }}><p>{item.nameProject}</p></div>
107-
<div style={{ width: '20%', fontWeight: 400, marginRight: 10 }}><p>{type_name[item.type.type]}</p></div>
108-
<div style={{ width: '15%', fontWeight: 400, marginRight: 10 }}><p>{item.listEmployee.length}</p></div>
109-
<div style={{ width: '12%', fontWeight: 400 }}><p>{item.maxEmployees}</p></div>
110-
<div style={{ width: '12%', fontWeight: 400 }}><p>{item.time}</p></div>
111-
<div style={{ width: '12%', fontWeight: 400, display: 'flex', alignItems: 'center', }}><p style={{ border: '1px solid rgba(0,0,0,0.5)', width: '80%', textAlign: 'center', borderRadius: 10, justifyContent: 'center', display: 'flex', alignItems: 'center', backgroundColor: backgroundColor[item.status], color: 'black' }}>{item.status == 0 ? 'Processing' : item.status == 1 ? 'Finished' : 'Lated'}</p></div>
112-
<div style={{ marginLeft: 0, width: '10%', flexDirection: 'column', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
113-
<a href={'/bieu-do/' + item.id} style={{ marginLeft: 0, color: '#43BFC7' }}>Thống kê</a>
114-
<a href={'/about/' + item.id} style={{ marginLeft: 0 }}>Xem chi tiết</a>
115-
<a href={'/edit-project/' + item.id} style={{ marginLeft: 0, color: 'red' }}>Điều chỉnh</a>
116-
{/* <a href={'/edit-project/' + item.id} style={{ marginLeft: 0, color: 'red' }}>Điều chỉnh</a> */}
117-
</div>
118-
</div>
119-
))}
120151
</div>
152+
121153
);
122154
}
123155

0 commit comments

Comments
 (0)