|
@@ -49,20 +49,32 @@
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="编号" align="center" prop="id" v-if="true" />
|
|
<el-table-column label="编号" align="center" prop="id" v-if="true" />
|
|
|
<el-table-column label="直播名称" align="center" prop="liveName" />
|
|
<el-table-column label="直播名称" align="center" prop="liveName" />
|
|
|
- <el-table-column label="排序值" align="center" prop="sortOrder" />
|
|
|
|
|
|
|
+ <el-table-column label="直播图" align="center" width="90">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <el-image
|
|
|
|
|
+ v-if="scope.row.imageUrl"
|
|
|
|
|
+ :src="scope.row.imageUrl"
|
|
|
|
|
+ style="width: 40px; height: 40px; border-radius: 4px; cursor: zoom-in"
|
|
|
|
|
+ :preview-src-list="[scope.row.imageUrl]"
|
|
|
|
|
+ :preview-teleported="true"
|
|
|
|
|
+ fit="cover"
|
|
|
|
|
+ />
|
|
|
|
|
+ <span v-else></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="直播开始时间" align="center" prop="startTime" width="180">
|
|
<el-table-column label="直播开始时间" align="center" prop="startTime" width="180">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <!-- <el-table-column label="直播状态:OPENED, CLOSED" align="center" prop="status" />-->
|
|
|
|
|
|
|
+ <el-table-column label="直播流地址" align="center" prop="liveSource" />
|
|
|
|
|
+ <el-table-column label="排序值" align="center" prop="sortOrder" />
|
|
|
<el-table-column label="是否开启回放" align="center">
|
|
<el-table-column label="是否开启回放" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
<el-tag v-if="row.enableReplay === 'YES'" type="success">开启</el-tag>
|
|
<el-tag v-if="row.enableReplay === 'YES'" type="success">开启</el-tag>
|
|
|
<el-tag v-else-if="row.enableReplay === 'NO'" type="info">关闭</el-tag>
|
|
<el-tag v-else-if="row.enableReplay === 'NO'" type="info">关闭</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="直播流地址" align="center" prop="liveSource" />
|
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
|
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
@@ -122,6 +134,41 @@
|
|
|
<el-form-item label="直播流地址" prop="liveSource">
|
|
<el-form-item label="直播流地址" prop="liveSource">
|
|
|
<el-input v-model="form.liveSource" type="textarea" placeholder="请输入内容" />
|
|
<el-input v-model="form.liveSource" type="textarea" placeholder="请输入内容" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="直播图片" prop="imageUrl">
|
|
|
|
|
+ <div class="upload-container">
|
|
|
|
|
+ <el-upload
|
|
|
|
|
+ class="upload-icon"
|
|
|
|
|
+ action="#"
|
|
|
|
|
+ :on-change="handleImageChange"
|
|
|
|
|
+ :on-remove="handleImageRemove"
|
|
|
|
|
+ :file-list="fileList"
|
|
|
|
|
+ :auto-upload="false"
|
|
|
|
|
+ :limit="1"
|
|
|
|
|
+ accept="image/*"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #trigger>
|
|
|
|
|
+ <el-button type="primary">点击选择图片</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template #default>
|
|
|
|
|
+ <div class="preview-area" @click="handlePreviewClick">
|
|
|
|
|
+ <img
|
|
|
|
|
+ v-if="imagePreviewUrl || form.imageUrl"
|
|
|
|
|
+ :src="imagePreviewUrl || form.imageUrl"
|
|
|
|
|
+ alt="预览图" style="max-width: 100px; max-height: 100px; margin-top: 10px; cursor: pointer"
|
|
|
|
|
+ />
|
|
|
|
|
+ <div v-else style="margin-top: 10px; color: #999">无</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template #tip>
|
|
|
|
|
+ <div class="el-upload__tip">
|
|
|
|
|
+ <span v-if="fileList.length > 0">当前已选文件:{{ fileList[0].name }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<template #footer>
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
@@ -130,6 +177,10 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+ <!-- 图片预览弹窗 -->
|
|
|
|
|
+ <el-dialog v-model="dialogVisible" title="图片预览" width="50%">
|
|
|
|
|
+ <img :src="previewSrc || imagePreviewUrl || form.imageUrl" alt="预览图片" style="max-width: 100%; max-height: 80vh" />
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -142,7 +193,7 @@ import {
|
|
|
updateOfficialLiveConfig
|
|
updateOfficialLiveConfig
|
|
|
} from '@/api/system/physical/officialLiveConfig';
|
|
} from '@/api/system/physical/officialLiveConfig';
|
|
|
import { OfficialLiveConfigVO, OfficialLiveConfigQuery, OfficialLiveConfigForm } from '@/api/system/physical/officialLiveConfig/types';
|
|
import { OfficialLiveConfigVO, OfficialLiveConfigQuery, OfficialLiveConfigForm } from '@/api/system/physical/officialLiveConfig/types';
|
|
|
-
|
|
|
|
|
|
|
+import { uploadTournament } from '@/api/system/business/tournaments';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
|
|
const officialLiveConfigList = ref<OfficialLiveConfigVO[]>([]);
|
|
const officialLiveConfigList = ref<OfficialLiveConfigVO[]>([]);
|
|
@@ -156,7 +207,10 @@ const total = ref(0);
|
|
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const officialLiveConfigFormRef = ref<ElFormInstance>();
|
|
const officialLiveConfigFormRef = ref<ElFormInstance>();
|
|
|
-
|
|
|
|
|
|
|
+const imagePreviewUrl = ref('');
|
|
|
|
|
+const fileList = ref([]);
|
|
|
|
|
+const dialogVisible = ref(false);
|
|
|
|
|
+const previewSrc = ref('');
|
|
|
const dialog = reactive<DialogOption>({
|
|
const dialog = reactive<DialogOption>({
|
|
|
visible: false,
|
|
visible: false,
|
|
|
title: ''
|
|
title: ''
|
|
@@ -169,6 +223,7 @@ const initFormData: OfficialLiveConfigForm = {
|
|
|
startTime: undefined,
|
|
startTime: undefined,
|
|
|
status: undefined,
|
|
status: undefined,
|
|
|
enableReplay: undefined,
|
|
enableReplay: undefined,
|
|
|
|
|
+ imageUrl: undefined,
|
|
|
liveSource: undefined,
|
|
liveSource: undefined,
|
|
|
createdAt: undefined,
|
|
createdAt: undefined,
|
|
|
updatedAt: undefined
|
|
updatedAt: undefined
|
|
@@ -220,6 +275,9 @@ const cancel = () => {
|
|
|
const reset = () => {
|
|
const reset = () => {
|
|
|
form.value = { ...initFormData };
|
|
form.value = { ...initFormData };
|
|
|
officialLiveConfigFormRef.value?.resetFields();
|
|
officialLiveConfigFormRef.value?.resetFields();
|
|
|
|
|
+ fileList.value = [];
|
|
|
|
|
+ imagePreviewUrl.value = '';
|
|
|
|
|
+ form.value.imageUrl = '';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
@@ -245,7 +303,10 @@ const handleSelectionChange = (selection: OfficialLiveConfigVO[]) => {
|
|
|
const handleAdd = () => {
|
|
const handleAdd = () => {
|
|
|
reset();
|
|
reset();
|
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
|
- dialog.title = '添加官方直播配置';
|
|
|
|
|
|
|
+ dialog.title = '添加直播配置';
|
|
|
|
|
+ fileList.value = [];
|
|
|
|
|
+ imagePreviewUrl.value = '';
|
|
|
|
|
+ form.value.imageUrl = '';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
@@ -254,8 +315,12 @@ const handleUpdate = async (row?: OfficialLiveConfigVO) => {
|
|
|
const _id = row?.id || ids.value[0];
|
|
const _id = row?.id || ids.value[0];
|
|
|
const res = await getOfficialLiveConfig(_id);
|
|
const res = await getOfficialLiveConfig(_id);
|
|
|
Object.assign(form.value, res.data);
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
+
|
|
|
|
|
+ if (form.value.imageUrl) {
|
|
|
|
|
+ imagePreviewUrl.value = form.value.imageUrl;
|
|
|
|
|
+ }
|
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
|
- dialog.title = '修改官方直播配置';
|
|
|
|
|
|
|
+ dialog.title = '修改直播配置';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
@@ -298,4 +363,54 @@ const handleExport = () => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getList();
|
|
getList();
|
|
|
});
|
|
});
|
|
|
|
|
+// ... existing code ...
|
|
|
|
|
+const handleImageChange = async (file) => {
|
|
|
|
|
+ const index = fileList.value.findIndex((f) => f.uid === file.uid);
|
|
|
|
|
+ fileList.value = [];
|
|
|
|
|
+
|
|
|
|
|
+ if (file.raw) {
|
|
|
|
|
+ imagePreviewUrl.value = URL.createObjectURL(file.raw);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (index === -1) {
|
|
|
|
|
+ fileList.value.push(file);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const rawFile = file.raw;
|
|
|
|
|
+ const res = await uploadTournament(rawFile);
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ fileList.value[index] = {
|
|
|
|
|
+ ...file,
|
|
|
|
|
+ status: 'success',
|
|
|
|
|
+ response: res.data.url
|
|
|
|
|
+ };
|
|
|
|
|
+ form.value.imageUrl = fileList.value[index].response;
|
|
|
|
|
+ imagePreviewUrl.value = fileList.value[index].response;
|
|
|
|
|
+ ElMessage.success('上传成功');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new Error(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ fileList.value[index] = {
|
|
|
|
|
+ ...file,
|
|
|
|
|
+ status: 'fail',
|
|
|
|
|
+ error: '上传失败'
|
|
|
|
|
+ };
|
|
|
|
|
+ ElMessage.error('上传失败,请重试');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleImageRemove = (file, updatedFileList) => {
|
|
|
|
|
+ fileList.value = updatedFileList;
|
|
|
|
|
+ imagePreviewUrl.value = '';
|
|
|
|
|
+ form.value.imageUrl = '';
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handlePreviewClick = () => {
|
|
|
|
|
+ const currentSrc = imagePreviewUrl.value || form.value.imageUrl;
|
|
|
|
|
+ if (currentSrc) {
|
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|