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 { getProfileInfo } from "@redux/outstaffingSlice";
import { setProjectBoardFetch } from "@redux/projectsTrackerSlice"; 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"; import { apiRequest } from "@api/request";
@ -63,6 +63,7 @@ export const ModalTiсket = ({
const [executor, setExecutor] = useState(task.executor); const [executor, setExecutor] = useState(task.executor);
const [members, setMembers] = useState(task.taskUsers); const [members, setMembers] = useState(task.taskUsers);
const [users, setUsers] = useState([]); const [users, setUsers] = useState([]);
const [selectedFile, setSelectedFile] = useState(null)
const [timerStart, setTimerStart] = useState(false); const [timerStart, setTimerStart] = useState(false);
const [timerInfo, setTimerInfo] = useState({}); const [timerInfo, setTimerInfo] = useState({});
const [currentTimerCount, setCurrentTimerCount] = 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() { function startTimer() {
setTimerId( setTimerId(
setInterval(() => { setInterval(() => {
@ -447,14 +474,27 @@ export const ModalTiсket = ({
{/* Добавить под задачу*/} {/* Добавить под задачу*/}
{/* </button>*/} {/* </button>*/}
{/*</p>*/} {/*</p>*/}
<p className="file"> <div className="file">
<button className="button-add-file"> <div className='input__wrapper'>
<img src={file}></img> <input
Загрузить файл name="file"
</button> 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> <span>{0}</span>
{caseOfNum(0, "files")} {caseOfNum(0, "files")}
</p> </div>
</div> </div>
<div className="content__input"> <div className="content__input">
<input <input

View File

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

View File

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