mirror of https://github.com/halo-dev/halo
Show type property for attachment detail.
parent
c99282074e
commit
51f575f2fd
|
@ -56,4 +56,26 @@ attachmentApi.upload = (formData, uploadProgress, cancelToken) => {
|
|||
})
|
||||
}
|
||||
|
||||
attachmentApi.type = {
|
||||
LOCAL: {
|
||||
type: 'local',
|
||||
text: '本地'
|
||||
},
|
||||
SMMS: {
|
||||
type: 'smms',
|
||||
text: 'SM.MS'
|
||||
},
|
||||
UPYUN: {
|
||||
type: 'upyun',
|
||||
text: '又拍云'
|
||||
},
|
||||
QNYUN: {
|
||||
type: 'qnyun',
|
||||
text: '七牛云'
|
||||
},
|
||||
ALIYUN: {
|
||||
type: 'aliyun',
|
||||
text: '阿里云'
|
||||
}
|
||||
}
|
||||
export default attachmentApi
|
||||
|
|
|
@ -14,18 +14,22 @@
|
|||
<a-col :md="6" :sm="24">
|
||||
<a-form-item label="存储位置">
|
||||
<a-select v-model="queryParam.attachmentType">
|
||||
<a-select-option value="local">本地</a-select-option>
|
||||
<a-select-option value="smms">SM.MS</a-select-option>
|
||||
<a-select-option value="upyun">又拍云</a-select-option>
|
||||
<a-select-option value="qnyun">七牛云</a-select-option>
|
||||
<a-select-option value="aliyun">阿里云</a-select-option>
|
||||
<a-select-option
|
||||
v-for="item in Object.keys(attachmentType)"
|
||||
:key="item"
|
||||
:value="item"
|
||||
>{{ attachmentType[item].text }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="6" :sm="24">
|
||||
<a-form-item label="文件类型">
|
||||
<a-select v-model="queryParam.mediaType">
|
||||
<a-select-option v-for="(item,index) in mediaTypes" :key="index" :value="item">{{ item }}</a-select-option>
|
||||
<a-select-option
|
||||
v-for="(item,index) in mediaTypes"
|
||||
:key="index"
|
||||
:value="item"
|
||||
>{{ item }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -46,7 +50,7 @@
|
|||
<a-col :span="24">
|
||||
<a-list
|
||||
:grid="{ gutter: 12, xs: 1, sm: 2, md: 4, lg: 6, xl: 6, xxl: 6 }"
|
||||
:dataSource="attachments"
|
||||
:dataSource="formattedDatas"
|
||||
>
|
||||
<a-list-item slot="renderItem" slot-scope="item, index" :key="index">
|
||||
<a-card :bodyStyle="{ padding: 0 }" hoverable @click="showDetailDrawer(item)">
|
||||
|
@ -103,6 +107,7 @@ export default {
|
|||
mixins: [mixin, mixinDevice],
|
||||
data() {
|
||||
return {
|
||||
attachmentType: attachmentApi.type,
|
||||
uploadVisible: false,
|
||||
selectAttachment: {},
|
||||
attachments: [],
|
||||
|
@ -125,6 +130,14 @@ export default {
|
|||
drawerVisiable: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formattedDatas() {
|
||||
return this.attachments.map(attachment => {
|
||||
attachment.typeProperty = this.attachmentType[attachment.type]
|
||||
return attachment
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadAttachments()
|
||||
this.loadMediaTypes()
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
<span slot="title">附件类型:</span>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
<a-list-item>
|
||||
<a-list-item-meta :description="attachment.typeProperty">
|
||||
<span slot="title">存储位置:</span>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
<a-list-item>
|
||||
<a-list-item-meta>
|
||||
<template slot="description">
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<a-col :span="24">
|
||||
<div
|
||||
class="attach-item"
|
||||
v-for="(item, index) in attachments"
|
||||
v-for="(item, index) in formattedDatas"
|
||||
:key="index"
|
||||
@click="showDetailDrawer(item)"
|
||||
>
|
||||
|
@ -112,6 +112,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
attachmentType: attachmentApi.type,
|
||||
detailVisiable: false,
|
||||
attachmentDrawerVisible: false,
|
||||
uploadVisible: false,
|
||||
|
@ -126,6 +127,14 @@ export default {
|
|||
attachmentUploadHandler: attachmentApi.upload
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formattedDatas() {
|
||||
return this.attachments.map(attachment => {
|
||||
attachment.typeProperty = this.attachmentType[attachment.type]
|
||||
return attachment
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadSkeleton()
|
||||
this.loadAttachments()
|
||||
|
|
Loading…
Reference in New Issue