fix frontend bugs
Gitea Actions Demo / build_and_push (push) Successful in 1m17s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m17s
Details
This commit is contained in:
parent
1d5676c58b
commit
976a0b8276
|
|
@ -62,8 +62,8 @@ function httpErrorHandler(error: any) {
|
||||||
//The request was made but no response was received, `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in Node.js
|
//The request was made but no response was received, `error.request` is an instance of XMLHttpRequest in the browser and an instance of http.ClientRequest in Node.js
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Something happened in setting up the request and triggered an Error
|
console.log(error.status, error.message)
|
||||||
console.log(error.message)
|
throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
function responseHandler(response: AxiosResponse<any>) {
|
function responseHandler(response: AxiosResponse<any>) {
|
||||||
|
|
|
||||||
|
|
@ -71,15 +71,6 @@ initWorkouts();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.image-container {
|
|
||||||
cursor: pointer;
|
|
||||||
height: 300px;
|
|
||||||
width: 100%;
|
|
||||||
background-position: 50% 50%;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.news-feed {
|
.news-feed {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -87,45 +78,4 @@ initWorkouts();
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.news-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 1rem;
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
|
|
||||||
transition: transform 0.2s ease-in-out;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.news-item-header {
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
}
|
|
||||||
.news-item-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.news-item h3 {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #3d3d3d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metadata {
|
|
||||||
border-top: #9c9a9a 1px solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metadata li {
|
|
||||||
list-style: none;
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.metadata span {
|
|
||||||
font-size: 0.9em;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,25 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1 class="page-title">Загрузить тренировку</h1>
|
<h1 class="page-title">Загрузить тренировку</h1>
|
||||||
<VaFileUpload
|
<VaFileUpload v-if="!inProgress"
|
||||||
v-model="file"
|
v-model="file"
|
||||||
file-types="gpx,fit"
|
file-types="gpx,fit"
|
||||||
type="single"
|
type="single"
|
||||||
v-on:update:model-value="onFileChanged"
|
v-on:update:model-value="onFileChanged"
|
||||||
color="#F4F6F8"
|
color="#F4F6F8"
|
||||||
|
:hideFileList=true
|
||||||
|
dropzone
|
||||||
/>
|
/>
|
||||||
|
<div v-else>
|
||||||
|
<VaInnerLoading
|
||||||
|
loading
|
||||||
|
:size="60"
|
||||||
|
>
|
||||||
|
</VaInnerLoading>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
import { AxiosResponse, AxiosInstance, AxiosError } from "axios";
|
import { AxiosResponse, AxiosInstance, AxiosError } from "axios";
|
||||||
import { inject } from 'vue'
|
import { inject } from 'vue'
|
||||||
import { VaFileUpload } from "vuestic-ui";
|
import { VaFileUpload } from "vuestic-ui";
|
||||||
|
|
@ -19,7 +29,7 @@ import { useRouter } from "vue-router";
|
||||||
const axiosAuth= inject('axiosAuth') as AxiosInstance;
|
const axiosAuth= inject('axiosAuth') as AxiosInstance;
|
||||||
const { init } = useToast();
|
const { init } = useToast();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const inProgress = ref(false);
|
||||||
let file: {
|
let file: {
|
||||||
name: "Example",
|
name: "Example",
|
||||||
url: "",
|
url: "",
|
||||||
|
|
@ -41,6 +51,14 @@ type Error = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFileChanged() {
|
function onFileChanged() {
|
||||||
|
if (file == undefined) {
|
||||||
|
init({
|
||||||
|
message: "Невозможно загрузить такой тип файла",
|
||||||
|
color: "error",
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
inProgress.value = true;
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
axiosAuth.post(`/api/v0/attachment/upload`, formData).then(
|
axiosAuth.post(`/api/v0/attachment/upload`, formData).then(
|
||||||
|
|
@ -51,11 +69,12 @@ function onFileChanged() {
|
||||||
"name": "Новая тренировка",
|
"name": "Новая тренировка",
|
||||||
})
|
})
|
||||||
.then((response: AxiosResponse) => {
|
.then((response: AxiosResponse) => {
|
||||||
|
inProgress.value = false;
|
||||||
init({ message: "Тренировка успешно загружена!", color: "success" });
|
init({ message: "Тренировка успешно загружена!", color: "success" });
|
||||||
router.push({ name: "workout_item", params: { id: response.data.id } });
|
router.push({ name: "workout_item", params: { id: response.data.id } });
|
||||||
})
|
})
|
||||||
.catch((error: AxiosError) => {
|
.catch((error: AxiosError) => {
|
||||||
|
inProgress.value = false;
|
||||||
if (error.status == 400) {
|
if (error.status == 400) {
|
||||||
let err = <Error>error.response?.data
|
let err = <Error>error.response?.data
|
||||||
if (err.detail.code_string == "ObjectExists") {
|
if (err.detail.code_string == "ObjectExists") {
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,12 @@
|
||||||
if (mapX.length >= 2 || xIndex == undefined) {
|
if (mapX.length >= 2 || xIndex == undefined) {
|
||||||
mapX = [];
|
mapX = [];
|
||||||
clickCoordinates = [];
|
clickCoordinates = [];
|
||||||
|
chart.chart.draw();
|
||||||
}
|
}
|
||||||
if (xIndex !== undefined) {
|
if (xIndex !== undefined) {
|
||||||
clickCoordinates.push(e.coordinates);
|
clickCoordinates.push(e.coordinates);
|
||||||
mapX.push(xIndex);
|
mapX.push(xIndex);
|
||||||
|
chart.chart.draw();
|
||||||
}
|
}
|
||||||
}}"/>
|
}}"/>
|
||||||
<yandex-map-default-marker v-if="currentCoordinates" :settings="{
|
<yandex-map-default-marker v-if="currentCoordinates" :settings="{
|
||||||
|
|
@ -163,7 +165,6 @@ const dzenLink = ref(dzenLinkProps);
|
||||||
const map = shallowRef<null | YMap>(null);
|
const map = shallowRef<null | YMap>(null);
|
||||||
const chart = ref();
|
const chart = ref();
|
||||||
const mapX = ref<Array<number>>([]);
|
const mapX = ref<Array<number>>([]);
|
||||||
const mapXPrev = ref<Array<number>>([]);
|
|
||||||
let currentCoordinates = ref<Array<number> | null>([]);
|
let currentCoordinates = ref<Array<number> | null>([]);
|
||||||
let clickCoordinates = ref<Array<number>>([]);
|
let clickCoordinates = ref<Array<number>>([]);
|
||||||
let coordWithIndex: Map<string, number> = new Map();
|
let coordWithIndex: Map<string, number> = new Map();
|
||||||
|
|
@ -189,7 +190,6 @@ ChartJS.register(
|
||||||
zoomPlugin,
|
zoomPlugin,
|
||||||
TimeScale
|
TimeScale
|
||||||
)
|
)
|
||||||
|
|
||||||
const { init } = useToast();
|
const { init } = useToast();
|
||||||
|
|
||||||
type afterEventEvent = {
|
type afterEventEvent = {
|
||||||
|
|
@ -198,7 +198,6 @@ type afterEventEvent = {
|
||||||
type afterEventArgs = {
|
type afterEventArgs = {
|
||||||
"event": afterEventEvent,
|
"event": afterEventEvent,
|
||||||
}
|
}
|
||||||
let zoomLine = 1.0;
|
|
||||||
const chartPlugins = [
|
const chartPlugins = [
|
||||||
{
|
{
|
||||||
id: 'eventPlugin',
|
id: 'eventPlugin',
|
||||||
|
|
@ -211,25 +210,6 @@ const chartPlugins = [
|
||||||
{
|
{
|
||||||
id: 'yandexMapLine',
|
id: 'yandexMapLine',
|
||||||
mapX: mapX,
|
mapX: mapX,
|
||||||
beforeInit(chart: any, ) {
|
|
||||||
setInterval(() => {
|
|
||||||
let isEq = true
|
|
||||||
for (let i = 0; i < mapX.value.length; i++) {
|
|
||||||
if (mapXPrev.value[i] == mapX.value[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
isEq = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (isEq) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chart.draw();
|
|
||||||
for (let i = 0; i < mapX.value.length; i++) {
|
|
||||||
mapXPrev.value[i] = mapX.value[i];
|
|
||||||
}
|
|
||||||
}, 300)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const chartOptions = {
|
const chartOptions = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue