This commit is contained in:
Николай Полтщук 2023-07-13 02:03:40 +03:00
parent 8b9351e3f7
commit 4f613f492e
3 changed files with 62 additions and 9 deletions

View File

@ -10,7 +10,7 @@ import { Link } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { setProjectBoardFetch } from "@redux/projectsTrackerSlice";
import { caseOfNum, getCorrectRequestDate, urlForLocal } from "@utils/helper";
import {caseOfNum, getCorrectRequestDate, getToken, urlForLocal} from "@utils/helper";
import { apiRequest } from "@api/request";
@ -63,6 +63,7 @@ export const ModalTiсket = ({
const [executor, setExecutor] = useState(task.executor);
const [members, setMembers] = useState(task.taskUsers);
const [users, setUsers] = useState([]);
const [selectedFile, setSelectedFile] = useState(null)
const [timerStart, setTimerStart] = useState(false);
const [timerInfo, setTimerInfo] = useState({});
const [currentTimerCount, setCurrentTimerCount] = useState({
@ -302,6 +303,32 @@ export const ModalTiсket = ({
}
}, []);
const handleUpload = async (event) => {
const formData = new FormData()
formData.append('uploadFile ', event.target.files[0])
// apiRequest('/file/upload', {
// method: 'POST',
// data: {
// formData
// }
// }).then((res) => {
// console.log(res)
// })
// console.log(formData)
const res = await fetch('https://itguild.info/file/upload', {
method: 'POST',
body: formData,
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
...getToken()
}
})
console.log(res)
}
function startTimer() {
setTimerId(
setInterval(() => {
@ -447,14 +474,27 @@ export const ModalTiсket = ({
{/* Добавить под задачу*/}
{/* </button>*/}
{/*</p>*/}
<p className="file">
<button className="button-add-file">
<img src={file}></img>
Загрузить файл
</button>
<div className="file">
<div className='input__wrapper'>
<input
name="file"
id="input__file"
type="file"
accept="image/*,.png,.jpg,.svg,.jpeg"
className='input__file'
onChange={handleUpload}
/>
<label
htmlFor="input__file"
className="button-add-file"
>
<img src={file}></img>
Загрузить файл
</label>
</div>
<span>{0}</span>
{caseOfNum(0, "files")}
</p>
</div>
</div>
<div className="content__input">
<input

View File

@ -342,8 +342,21 @@
justify-content: space-between;
margin-left: 7px;
.input__wrapper {
display: flex;
position: relative;
.input__file {
position: absolute;
opacity: 0;
z-index: -10;
width: 10%;
}
}
.button-add-file {
display: flex;
cursor: pointer;
align-items: center;
justify-content: center;
background: white;

View File

@ -727,7 +727,7 @@
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
@ -755,7 +755,7 @@
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}