|
@@ -8,6 +8,7 @@ const { t } = useI18n();
|
|
|
const mainStore = useMainStore();
|
|
|
const mainStoreRef = storeToRefs(mainStore);
|
|
|
const videos = mainStoreRef.readVideos;
|
|
|
+const WS = mainStore.videosWebSocket;
|
|
|
|
|
|
const headers = [
|
|
|
{
|
|
@@ -34,7 +35,20 @@ function previewVideo(name: String) {
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await mainStore.actionGetVideos();
|
|
|
+ WS.onmessage = function (e) {
|
|
|
+ console.log('onmessage',e);
|
|
|
+ const data = e.data.split(':');
|
|
|
+ mainStore.videos.map(e=>{
|
|
|
+ if(e.stored_filename===data[0]) {
|
|
|
+ e.progress_state = data[1]; // 影片狀態
|
|
|
+ if (mainStore.userProfile && data[2]) {
|
|
|
+ mainStore.userProfile.available_time = mainStore.userProfile.available_time - parseInt(data[2]); // 使用秒數
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ };
|
|
|
});
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -50,15 +64,15 @@ onMounted(async () => {
|
|
|
:sort-by="[{ key: 'id', order: 'desc' }]"
|
|
|
>
|
|
|
<template v-slot:item.progress_state="{ item }">
|
|
|
- <span v-if="item.raw.progress_state === 'completed'">
|
|
|
+ <span v-if="item.raw.progress_state === 'SUCCESS'">
|
|
|
<v-icon icon="check_circle" color="success" />
|
|
|
完成
|
|
|
</span>
|
|
|
- <span v-else-if="item.raw.progress_state === 'waiting'">
|
|
|
+ <span v-else-if="item.raw.progress_state === 'PENDING'">
|
|
|
<v-icon icon="pending" color="warning" />
|
|
|
等待中
|
|
|
</span>
|
|
|
- <span v-else-if="item.raw.progress_state === 'processing'">
|
|
|
+ <span v-else-if="item.raw.progress_state === 'STARTED'">
|
|
|
<v-progress-circular
|
|
|
indeterminate
|
|
|
color="info"
|
|
@@ -74,8 +88,8 @@ onMounted(async () => {
|
|
|
<template v-slot:item.id="{ item }">
|
|
|
<v-btn
|
|
|
flat
|
|
|
- :disabled="item.raw.progress_state !== 'completed'"
|
|
|
- @click="previewVideo(item.raw.stored_file_name)"
|
|
|
+ :disabled="item.raw.progress_state !== 'SUCCESS'"
|
|
|
+ @click="previewVideo(item.raw.stored_filename)"
|
|
|
>
|
|
|
<v-icon icon="play_circle" />
|
|
|
</v-btn>
|