fix: code style
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { useAccess } from '@vben/access';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Spin } from 'ant-design-vue';
|
||||
import { Button, Spin } from 'ant-design-vue';
|
||||
|
||||
const props = defineProps<{
|
||||
list: any[];
|
||||
@@ -25,7 +25,7 @@ const { hasAccessByCodes } = useAccess();
|
||||
<div class="item-name">{{ item.name }}</div>
|
||||
</a>
|
||||
<div class="flex justify-center">
|
||||
<a-button
|
||||
<Button
|
||||
v-if="hasAccessByCodes(['mp:material:delete'])"
|
||||
danger
|
||||
shape="circle"
|
||||
@@ -35,7 +35,7 @@ const { hasAccessByCodes } = useAccess();
|
||||
<template #icon>
|
||||
<IconifyIcon icon="mdi:delete" />
|
||||
</template>
|
||||
</a-button>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { inject, reactive, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { message, Upload } from 'ant-design-vue';
|
||||
import { Button, message, Upload } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
beforeImageUpload,
|
||||
@@ -83,22 +83,19 @@ const customRequest: UploadProps['customRequest'] = async (options) => {
|
||||
:action="UPLOAD_URL"
|
||||
:before-upload="onBeforeUpload"
|
||||
:custom-request="customRequest"
|
||||
:data="uploadData"
|
||||
:file-list="fileList"
|
||||
:headers="HEADERS"
|
||||
:multiple="true"
|
||||
class="mb-4"
|
||||
>
|
||||
<a-button type="primary">
|
||||
<Button type="primary">
|
||||
<IconifyIcon icon="mdi:upload" class="mr-1" />
|
||||
点击上传
|
||||
</a-button>
|
||||
</Button>
|
||||
<template #itemRender="{ file, actions }">
|
||||
<div class="flex items-center">
|
||||
<span>{{ file.name }}</span>
|
||||
<a-button type="link" size="small" @click="actions.remove">
|
||||
删除
|
||||
</a-button>
|
||||
<Button type="link" size="small" @click="actions.remove"> 删除 </Button>
|
||||
</div>
|
||||
</template>
|
||||
</Upload>
|
||||
|
||||
@@ -7,7 +7,15 @@ import { inject, reactive, ref } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { message, Modal, Upload } from 'ant-design-vue';
|
||||
import {
|
||||
Button,
|
||||
Divider,
|
||||
Form,
|
||||
Input,
|
||||
message,
|
||||
Modal,
|
||||
Upload,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { beforeVideoUpload, HEADERS, UPLOAD_URL, UploadType } from './upload';
|
||||
|
||||
@@ -28,8 +36,10 @@ const emit = defineEmits<{
|
||||
const accountId = inject<number>('accountId');
|
||||
|
||||
const uploadRules = {
|
||||
introduction: [{ message: '请输入描述', required: true, trigger: 'blur' }],
|
||||
title: [{ message: '请输入标题', required: true, trigger: 'blur' }],
|
||||
introduction: [
|
||||
{ message: '请输入描述', required: true, trigger: 'blur' } as const,
|
||||
],
|
||||
title: [{ message: '请输入标题', required: true, trigger: 'blur' } as const],
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
@@ -119,36 +129,36 @@ const customRequest: UploadProps['customRequest'] = async (options) => {
|
||||
:multiple="true"
|
||||
class="mb-4"
|
||||
>
|
||||
<a-button type="primary">
|
||||
<Button type="primary">
|
||||
<IconifyIcon icon="mdi:video-plus" class="mr-1" />
|
||||
选择视频
|
||||
</a-button>
|
||||
</Button>
|
||||
</Upload>
|
||||
<div class="mb-4 ml-1 text-sm text-gray-500">
|
||||
格式支持 MP4,文件大小不超过 10MB
|
||||
</div>
|
||||
|
||||
<a-divider />
|
||||
<Divider />
|
||||
|
||||
<a-form
|
||||
<Form
|
||||
ref="uploadFormRef"
|
||||
:model="uploadData"
|
||||
:rules="uploadRules"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-item label="标题" name="title">
|
||||
<a-input
|
||||
<Form.Item label="标题" name="title">
|
||||
<Input
|
||||
v-model:value="uploadData.title"
|
||||
placeholder="标题将展示在相关播放页面,建议填写清晰、准确、生动的标题"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="描述" name="introduction">
|
||||
<a-textarea
|
||||
</Form.Item>
|
||||
<Form.Item label="描述" name="introduction">
|
||||
<Input.TextArea
|
||||
v-model:value="uploadData.introduction"
|
||||
:rows="3"
|
||||
placeholder="介绍语将展示在相关播放页面,建议填写简洁明确、有信息量的内容"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -3,6 +3,8 @@ import { useAccess } from '@vben/access';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDate2 } from '@vben/utils';
|
||||
|
||||
import { Button, Table } from 'ant-design-vue';
|
||||
|
||||
import WxVideoPlayer from '#/views/mp/components/wx-video-play';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -17,18 +19,33 @@ const emit = defineEmits<{
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
const columns = [
|
||||
{ align: 'center', dataIndex: 'mediaId', key: 'mediaId', title: '编号' },
|
||||
{ align: 'center', dataIndex: 'name', key: 'name', title: '文件名' },
|
||||
{ align: 'center', dataIndex: 'title', key: 'title', title: '标题' },
|
||||
{
|
||||
align: 'center',
|
||||
align: 'center' as const,
|
||||
dataIndex: 'mediaId',
|
||||
key: 'mediaId',
|
||||
title: '编号',
|
||||
},
|
||||
{ align: 'center' as const, dataIndex: 'name', key: 'name', title: '文件名' },
|
||||
{ align: 'center' as const, dataIndex: 'title', key: 'title', title: '标题' },
|
||||
{
|
||||
align: 'center' as const,
|
||||
dataIndex: 'introduction',
|
||||
key: 'introduction',
|
||||
title: '介绍',
|
||||
},
|
||||
{ align: 'center', key: 'video', title: '视频' },
|
||||
{ align: 'center', key: 'createTime', title: '上传时间', width: 180 },
|
||||
{ align: 'center', fixed: 'right', key: 'action', title: '操作' },
|
||||
{ align: 'center' as const, key: 'video', title: '视频' },
|
||||
{
|
||||
align: 'center' as const,
|
||||
key: 'createTime',
|
||||
title: '上传时间',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
align: 'center' as const,
|
||||
fixed: 'right' as const,
|
||||
key: 'action',
|
||||
title: '操作',
|
||||
},
|
||||
];
|
||||
|
||||
// 下载文件
|
||||
@@ -38,7 +55,7 @@ const handleDownload = (url: string) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-table
|
||||
<Table
|
||||
:columns="columns"
|
||||
:data-source="props.list"
|
||||
:loading="props.loading"
|
||||
@@ -55,11 +72,11 @@ const handleDownload = (url: string) => {
|
||||
{{ formatDate2(record.createTime) }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-button type="link" @click="handleDownload(record.url)">
|
||||
<Button type="link" @click="handleDownload(record.url)">
|
||||
<IconifyIcon icon="mdi:download" />
|
||||
下载
|
||||
</a-button>
|
||||
<a-button
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasAccessByCodes(['mp:material:delete'])"
|
||||
danger
|
||||
type="link"
|
||||
@@ -67,8 +84,8 @@ const handleDownload = (url: string) => {
|
||||
>
|
||||
<IconifyIcon icon="mdi:delete" />
|
||||
删除
|
||||
</a-button>
|
||||
</Button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</Table>
|
||||
</template>
|
||||
|
||||
@@ -3,6 +3,8 @@ import { useAccess } from '@vben/access';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
import { formatDate2 } from '@vben/utils';
|
||||
|
||||
import { Button, Table } from 'ant-design-vue';
|
||||
|
||||
import WxVoicePlayer from '#/views/mp/components/wx-voice-play';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -17,11 +19,26 @@ const emit = defineEmits<{
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
const columns = [
|
||||
{ align: 'center', dataIndex: 'mediaId', key: 'mediaId', title: '编号' },
|
||||
{ align: 'center', dataIndex: 'name', key: 'name', title: '文件名' },
|
||||
{ align: 'center', key: 'voice', title: '语音' },
|
||||
{ align: 'center', key: 'createTime', title: '上传时间', width: 180 },
|
||||
{ align: 'center', fixed: 'right', key: 'action', title: '操作' },
|
||||
{
|
||||
align: 'center' as const,
|
||||
dataIndex: 'mediaId',
|
||||
key: 'mediaId',
|
||||
title: '编号',
|
||||
},
|
||||
{ align: 'center' as const, dataIndex: 'name', key: 'name', title: '文件名' },
|
||||
{ align: 'center' as const, key: 'voice', title: '语音' },
|
||||
{
|
||||
align: 'center' as const,
|
||||
key: 'createTime',
|
||||
title: '上传时间',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
align: 'center' as const,
|
||||
fixed: 'right' as const,
|
||||
key: 'action',
|
||||
title: '操作',
|
||||
},
|
||||
];
|
||||
|
||||
const handleDownload = (url: string) => {
|
||||
@@ -30,7 +47,7 @@ const handleDownload = (url: string) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-table
|
||||
<Table
|
||||
:columns="columns"
|
||||
:data-source="props.list"
|
||||
:loading="props.loading"
|
||||
@@ -47,11 +64,11 @@ const handleDownload = (url: string) => {
|
||||
{{ formatDate2(record.createTime) }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-button type="link" @click="handleDownload(record.url)">
|
||||
<Button type="link" @click="handleDownload(record.url)">
|
||||
<IconifyIcon icon="mdi:download" />
|
||||
下载
|
||||
</a-button>
|
||||
<a-button
|
||||
</Button>
|
||||
<Button
|
||||
v-if="hasAccessByCodes(['mp:material:delete'])"
|
||||
danger
|
||||
type="link"
|
||||
@@ -59,8 +76,8 @@ const handleDownload = (url: string) => {
|
||||
>
|
||||
<IconifyIcon icon="mdi:delete" />
|
||||
删除
|
||||
</a-button>
|
||||
</Button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</Table>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user