chore [P-137]: test
This commit is contained in:
1 parent
27facc4283
commit
009161643e
1 file changed
+84
-123
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<v-carousel
|
<v-carousel
|
||||||
v-model="currentslide"
|
v-model="currentslide"
|
||||||
:interval="interval"
|
:interval="interval"
|
||||||
@@ -8,173 +7,135 @@
|
|||||||
height="450"
|
height="450"
|
||||||
hide-delimiters
|
hide-delimiters
|
||||||
hide-delimiter-background
|
hide-delimiter-background
|
||||||
:show-arrows="carous.length<2?false:'hover'"
|
:show-arrows="carous.length < 2 ? false : 'hover'"
|
||||||
color="white"
|
color="white"
|
||||||
@update:modelValue="slidechanged"
|
@update:modelValue="slidechanged"
|
||||||
>
|
>
|
||||||
|
<template v-for="(x, i) in carous" :key="i">
|
||||||
<template v-for="(x, i) in carous" :key="i">
|
<v-carousel-item v-if="!x.link.endsWith('mp4')" :src="`${burl}${x.link}`" cover eager>
|
||||||
<v-carousel-item
|
<v-container fill-height fluid pa-0 ma-0 pb-3 class="flex-column h-100 d-flex">
|
||||||
v-if="!x.link.endsWith('mp4')"
|
<v-card v-if="x.text != '' || x.title != null" class="bgCard h-100 d-flex flex-column">
|
||||||
:src="`${burl}${x.link}`"
|
<v-card-title
|
||||||
cover
|
v-if="x.title != null"
|
||||||
eager
|
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
|
||||||
>
|
|
||||||
|
|
||||||
<v-container
|
|
||||||
fill-height
|
|
||||||
fluid
|
|
||||||
pa-0
|
|
||||||
ma-0
|
|
||||||
pb-3
|
|
||||||
class="flex-column h-100 d-flex"
|
|
||||||
>
|
|
||||||
<v-card
|
|
||||||
v-if="x.text != '' || x.title != null"
|
|
||||||
class="bgCard h-100 d-flex flex-column"
|
|
||||||
>
|
|
||||||
<v-card-title
|
|
||||||
v-if="x.title != null"
|
|
||||||
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
|
|
||||||
>
|
|
||||||
<v-row no-gutters>
|
|
||||||
<v-col class="align-self-center">
|
|
||||||
{{ x.title }}
|
|
||||||
</v-col>
|
|
||||||
<v-col class="flex-grow-0">
|
|
||||||
<v-img
|
|
||||||
width="50"
|
|
||||||
:aspect-ratio="1"
|
|
||||||
:src="`${burl}${x.sender}`"
|
|
||||||
cover
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card-title>
|
|
||||||
<v-card-text
|
|
||||||
v-if="x.text != ''"
|
|
||||||
class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
|
|
||||||
>
|
|
||||||
<v-textarea
|
|
||||||
class="text-text_caroustext-black textareas font-weight-medium nocursor"
|
|
||||||
:model-value="x.text"
|
|
||||||
variant="solo"
|
|
||||||
readonly
|
|
||||||
auto-grow
|
|
||||||
rows="1"
|
|
||||||
hide-details
|
|
||||||
flat
|
|
||||||
bg-color="transparent"
|
|
||||||
/>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
</v-container>
|
|
||||||
</v-carousel-item>
|
|
||||||
<v-carousel-item v-else >
|
|
||||||
|
|
||||||
<div class="d-flex justify-center">
|
|
||||||
<video
|
|
||||||
ref="videoElement"
|
|
||||||
style="height: 450px"
|
|
||||||
|
|
||||||
controls
|
|
||||||
|
|
||||||
preload="metadata"
|
|
||||||
@ended="ended"
|
|
||||||
@loadedmetadata="interval = 10000000000"
|
|
||||||
>
|
>
|
||||||
<source :src="`${burl}${x.link}`" type="video/mp4" />
|
<v-row no-gutters>
|
||||||
|
<v-col class="align-self-center">
|
||||||
|
{{ x.title }}
|
||||||
|
</v-col>
|
||||||
|
<v-col class="flex-grow-0">
|
||||||
|
<v-img width="50" :aspect-ratio="1" :src="`${burl}${x.sender}`" cover />
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-card-title>
|
||||||
|
<v-card-text
|
||||||
|
v-if="x.text != ''"
|
||||||
|
class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
|
||||||
|
>
|
||||||
|
<v-textarea
|
||||||
|
class="text-text_caroustext-black textareas font-weight-medium nocursor"
|
||||||
|
:model-value="x.text"
|
||||||
|
variant="solo"
|
||||||
|
readonly
|
||||||
|
auto-grow
|
||||||
|
rows="1"
|
||||||
|
hide-details
|
||||||
|
flat
|
||||||
|
bg-color="transparent"
|
||||||
|
/>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</v-carousel-item>
|
||||||
|
<v-carousel-item v-else>
|
||||||
|
<div class="d-flex justify-center">
|
||||||
|
<video
|
||||||
|
ref="videoElement"
|
||||||
|
style="height: 450px"
|
||||||
|
controls
|
||||||
|
preload="metadata"
|
||||||
|
@ended="ended"
|
||||||
|
@loadedmetadata="interval = 10000000000"
|
||||||
|
>
|
||||||
|
<source :src="`${burl}${x.link}`" type="video/mp4" />
|
||||||
|
|
||||||
Текущий браузер не поддерживает воспроизведение этого видео.
|
Текущий браузер не поддерживает воспроизведение этого видео.
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
<!-- currentslide=currentslide<carous.length-1?currentslide+1:0 -->
|
<!-- currentslide=currentslide<carous.length-1?currentslide+1:0 -->
|
||||||
</v-carousel-item>
|
</v-carousel-item>
|
||||||
</template>
|
</template>
|
||||||
</v-carousel>
|
</v-carousel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, computed } from "vue";
|
import { ref } from 'vue';
|
||||||
import { baseURL } from "@/utils/axios-api";
|
import { baseURL } from '@/utils/axios-api';
|
||||||
import { axiosApiInstance } from "@/utils/axios-api";
|
import { axiosApiInstance } from '@/utils/axios-api';
|
||||||
import { useAlertStore } from "@/store/useAlertStore";
|
import { useAlertStore } from '@/store/useAlertStore';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const currentslide=ref(0)
|
const currentslide = ref(0);
|
||||||
const burl = baseURL.slice(0, -1);
|
const burl = baseURL.slice(0, -1);
|
||||||
const videoElement=ref(null)
|
const videoElement = ref(null);
|
||||||
const carous = ref([{ link: `/media/newsimage/scales.jpg`, "title": null, "text": "" }]);
|
const carous = ref([{ link: `/media/newsimage/scales.jpg`, title: null, text: '' }]);
|
||||||
const feedalert = useAlertStore().alert;
|
const feedalert = useAlertStore().alert;
|
||||||
|
|
||||||
const getfromserver = () => {
|
const getfromserver = () => {
|
||||||
axiosApiInstance.get("api/navigation/carousels/").then((result) => {
|
axiosApiInstance.get('api/navigation/carousels/').then((result) => {
|
||||||
if (result.data.mess != "") {
|
if (result.data.mess != '') {
|
||||||
feedalert.alert = true;
|
feedalert.alert = true;
|
||||||
feedalert.text = result.data.mess;
|
feedalert.text = result.data.mess;
|
||||||
feedalert.color = "red-darken-2";
|
feedalert.color = 'red-darken-2';
|
||||||
feedalert.ico = "mdi-alert-outline";
|
feedalert.ico = 'mdi-alert-outline';
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(result.data);
|
|
||||||
if (result.data.result.length > 0) {
|
if (result.data.result.length > 0) {
|
||||||
carous.value = result.data.result;
|
carous.value = result.data.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
getfromserver();
|
getfromserver();
|
||||||
const interval=ref(10000)
|
const interval = ref(10000);
|
||||||
|
|
||||||
const slidechanged=()=>{
|
|
||||||
console.log(videoElement.value);
|
|
||||||
|
|
||||||
if (carous.value[currentslide.value].link.endsWith('mp4')){
|
|
||||||
videoElement.value.forEach((e)=>{
|
|
||||||
if(e.currentSrc!=burl+carous.value[currentslide.value].link){
|
|
||||||
e.pause()
|
|
||||||
|
|
||||||
|
const slidechanged = () => {
|
||||||
|
if (carous.value[currentslide.value].link.endsWith('mp4')) {
|
||||||
|
videoElement.value.forEach((e) => {
|
||||||
|
if (e.currentSrc != burl + carous.value[currentslide.value].link) {
|
||||||
|
e.pause();
|
||||||
}
|
}
|
||||||
// else{
|
// else{
|
||||||
// console.log("sdflkhlh");
|
// console.log("sdflkhlh");
|
||||||
// e.play()
|
// e.play()
|
||||||
// }
|
// }
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (carous.value[currentslide.value].link.endsWith('mp4')) {
|
||||||
|
interval.value = 10000000000;
|
||||||
if(carous.value[currentslide.value].link.endsWith('mp4')){
|
} else {
|
||||||
interval.value = 10000000000
|
interval.value = 10000;
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
interval.value=10000
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
const ended = (val) => {
|
||||||
const ended = (val)=>{
|
val.target.currentTime = 0;
|
||||||
val.target.currentTime = 0
|
|
||||||
val.target.pause();
|
val.target.pause();
|
||||||
document.exitFullscreen()
|
document.exitFullscreen();
|
||||||
currentslide.value=currentslide.value<carous.value.length-1?currentslide.value+1:0
|
currentslide.value =
|
||||||
}
|
currentslide.value < carous.value.length - 1 ? currentslide.value + 1 : 0;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
slidechanged,
|
slidechanged,
|
||||||
videoElement,
|
videoElement,
|
||||||
currentslide,
|
currentslide,
|
||||||
interval,
|
interval,
|
||||||
// intervalcomp,
|
|
||||||
burl,
|
burl,
|
||||||
carous,
|
carous,
|
||||||
ended
|
ended,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user