Browse Source

chore: 铃声支持在线预览

master
wangxiang 2 years ago
parent
commit
05031bddc3
  1. 21
      src/views/common/push/pushRingtone/ringtone.data.ts
  2. 7
      src/views/system/file/file.data.ts

21
src/views/common/push/pushRingtone/ringtone.data.ts

@ -1,18 +1,33 @@
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import { h } from 'vue'; import { h } from 'vue';
import { Tag } from 'ant-design-vue'; import { useGlobSetting } from '/@/hooks/setting';
import { Button, Tag } from 'ant-design-vue';
import { commonUpload } from '/@/api/platform/core/controller/upload'; import { commonUpload } from '/@/api/platform/core/controller/upload';
import { encodeURL } from 'js-base64';
import { getCloudProxyUrl } from '/@/utils';
const { filePreviewUrl = '' } = useGlobSetting();
/** 表格列配置 */ /** 表格列配置 */
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '铃声名称', title: '铃声名称',
dataIndex: 'name' dataIndex: 'name',
align: 'left',
ellipsis: true,
width: 180,
customRender: ({ record }) => {
const url = encodeURL(`${getCloudProxyUrl()}${record.ringtone}`);
return h(Button, {
type: 'link',
target: '_blank',
href: `${filePreviewUrl}/onlinePreview?url=${encodeURIComponent(url)}` }, () => record.name);
}
}, },
{ {
title: '铃声地址', title: '铃声地址',
dataIndex: 'ringtone' dataIndex: 'ringtone',
width: 260,
}, },
{ {
title: '创建人', title: '创建人',

7
src/views/system/file/file.data.ts

@ -10,7 +10,7 @@ import { FormSchema } from '/@/components/Table';
import { getFileSize } from '/@/utils/file/download'; import { getFileSize } from '/@/utils/file/download';
import { h } from 'vue'; import { h } from 'vue';
import { useGlobSetting } from '/@/hooks/setting'; import { useGlobSetting } from '/@/hooks/setting';
import { Tag, Button } from 'ant-design-vue'; import { Button } from 'ant-design-vue';
const { filePreviewUrl = '' } = useGlobSetting(); const { filePreviewUrl = '' } = useGlobSetting();
import { Api } from '/@/api/platform/system/controller/file'; import { Api } from '/@/api/platform/system/controller/file';
import { encodeURL } from 'js-base64'; import { encodeURL } from 'js-base64';
@ -34,11 +34,10 @@ export const columns: BasicColumn[] = [
width: 380, width: 380,
customRender: ({ record }) => { customRender: ({ record }) => {
const url = encodeURL(`${getCloudProxyUrl()}${Api.get}/${record.bucketName}/${record.fileName}`); const url = encodeURL(`${getCloudProxyUrl()}${Api.get}/${record.bucketName}/${record.fileName}`);
return record.fileName ? h(Button, { return h(Button, {
type: 'link', type: 'link',
target: '_blank', target: '_blank',
href: `${filePreviewUrl}/onlinePreview?url=${encodeURIComponent(url)}` }, () => record.fileName) href: `${filePreviewUrl}/onlinePreview?url=${encodeURIComponent(url)}` }, () => record.fileName);
: h(Tag, { color: 'red' }, () => '暂无文件');
} }
}, },
{ {

Loading…
Cancel
Save