pull/25/head
ruibaby 2019-06-05 22:00:06 +08:00
parent ab490e2418
commit 4fa8d8f1be
5 changed files with 145 additions and 53 deletions

View File

@ -128,12 +128,12 @@
title="上传附件" title="上传附件"
v-model="uploadVisible" v-model="uploadVisible"
:footer="null" :footer="null"
:afterClose="onUploadClose"
> >
<upload <upload
name="file" name="file"
multiple multiple
:uploadHandler="uploadHandler" :uploadHandler="uploadHandler"
@success="handleUploadSuccess"
> >
<p class="ant-upload-drag-icon"> <p class="ant-upload-drag-icon">
<a-icon type="inbox" /> <a-icon type="inbox" />
@ -223,10 +223,6 @@ export default {
this.selectAttachment = attachment this.selectAttachment = attachment
this.drawerVisiable = true this.drawerVisiable = true
}, },
handleUploadSuccess() {
this.loadAttachments()
this.loadMediaTypes()
},
handlePaginationChange(page, size) { handlePaginationChange(page, size) {
this.$log.debug(`Current: ${page}, PageSize: ${size}`) this.$log.debug(`Current: ${page}, PageSize: ${size}`)
this.pagination.page = page this.pagination.page = page
@ -242,6 +238,10 @@ export default {
handleQuery() { handleQuery() {
this.queryParam.page = 0 this.queryParam.page = 0
this.loadAttachments() this.loadAttachments()
},
onUploadClose(){
this.loadAttachments()
this.loadMediaTypes()
} }
} }
} }

View File

@ -69,13 +69,12 @@
title="上传附件" title="上传附件"
v-model="uploadVisible" v-model="uploadVisible"
:footer="null" :footer="null"
:afterClose="onUploadClose"
> >
<upload <upload
name="file" name="file"
multiple multiple
accept="image/*"
:uploadHandler="attachmentUploadHandler" :uploadHandler="attachmentUploadHandler"
@success="handleAttachmentUploadSuccess"
> >
<p class="ant-upload-drag-icon"> <p class="ant-upload-drag-icon">
<a-icon type="inbox" /> <a-icon type="inbox" />
@ -183,8 +182,8 @@ export default {
this.pagination.size = pageSize this.pagination.size = pageSize
this.loadAttachments() this.loadAttachments()
}, },
handleAttachmentUploadSuccess() { onUploadClose() {
this.$message.success('上传成功!') this.loadSkeleton()
this.loadAttachments() this.loadAttachments()
}, },
handleDelete() { handleDelete() {

View File

@ -60,13 +60,12 @@
title="上传附件" title="上传附件"
v-model="uploadVisible" v-model="uploadVisible"
:footer="null" :footer="null"
:afterClose="onUploadClose"
> >
<upload <upload
name="file" name="file"
multiple multiple
accept="image/*"
:uploadHandler="attachmentUploadHandler" :uploadHandler="attachmentUploadHandler"
@success="handleAttachmentUploadSuccess"
> >
<p class="ant-upload-drag-icon"> <p class="ant-upload-drag-icon">
<a-icon type="inbox" /> <a-icon type="inbox" />
@ -160,7 +159,8 @@ export default {
this.$message.success('上传成功!') this.$message.success('上传成功!')
this.loadAttachments() this.loadAttachments()
}, },
handleDelete() { onUploadClose() {
this.loadSkeleton()
this.loadAttachments() this.loadAttachments()
}, },
onClose() { onClose() {

View File

@ -1,33 +1,63 @@
<template> <template>
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<a-row :gutter="12" type="flex" align="middle"> <a-row
:gutter="12"
type="flex"
align="middle"
>
<a-col :span="24"> <a-col :span="24">
<a-list <a-list
:grid="{ gutter: 12, xs: 1, sm: 1, md: 2, lg: 4, xl: 4, xxl: 4 }" :grid="{ gutter: 12, xs: 1, sm: 1, md: 2, lg: 4, xl: 4, xxl: 4 }"
:dataSource="themes" :dataSource="themes"
:loading="themeLoading" :loading="themeLoading"
> >
<a-list-item slot="renderItem" slot-scope="item, index" :key="index"> <a-list-item
<a-card hoverable :title="item.name" :bodyStyle="{ padding: 0 }"> slot="renderItem"
slot-scope="item, index"
:key="index"
>
<a-card
hoverable
:title="item.name"
:bodyStyle="{ padding: 0 }"
>
<div class="theme-thumb"> <div class="theme-thumb">
<img :alt="item.name" :src="item.screenshots"> <img
:alt="item.name"
:src="item.screenshots"
>
</div> </div>
<template class="ant-card-actions" slot="actions"> <template
class="ant-card-actions"
slot="actions"
>
<div v-if="item.activated"> <div v-if="item.activated">
<a-icon type="unlock" theme="twoTone"/>已启用 <a-icon
type="unlock"
theme="twoTone"
/>
</div> </div>
<div v-else @click="handleActivateClick(item)"> <div
<a-icon type="lock"/>启用 v-else
@click="handleActivateClick(item)"
>
<a-icon type="lock" />启用
</div> </div>
<div @click="handleEditClick(item)"> <div @click="handleEditClick(item)">
<a-icon type="setting"/>设置 <a-icon type="setting" />设置
</div> </div>
<a-dropdown placement="topCenter"> <a-dropdown placement="topCenter">
<a class="ant-dropdown-link" href="#"> <a
<a-icon type="ellipsis"/>更多 class="ant-dropdown-link"
href="#"
>
<a-icon type="ellipsis" />更多
</a> </a>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item :key="1" :disabled="item.activated"> <a-menu-item
:key="1"
:disabled="item.activated"
>
<a-popconfirm <a-popconfirm
v-if="!item.activated" v-if="!item.activated"
:title="'确定删除【' + item.name + '】主题?'" :title="'确定删除【' + item.name + '】主题?'"
@ -35,10 +65,10 @@
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
> >
<a-icon type="delete"/>删除 <a-icon type="delete" />删除
</a-popconfirm> </a-popconfirm>
<span v-else> <span v-else>
<a-icon type="delete"/>删除 <a-icon type="delete" />删除
</span> </span>
</a-menu-item> </a-menu-item>
<a-menu-item :key="2"> <a-menu-item :key="2">
@ -48,7 +78,7 @@
okText="确定" okText="确定"
cancelText="取消" cancelText="取消"
> >
<a-icon type="download"/>更新 <a-icon type="download" />更新
</a-popconfirm> </a-popconfirm>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
@ -68,11 +98,28 @@
:visible="visible" :visible="visible"
destroyOnClose destroyOnClose
> >
<a-row :gutter="12" type="flex"> <a-row
<a-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24"> :gutter="12"
<a-skeleton active :loading="optionLoading" :paragraph="{rows: 10}"> type="flex"
>
<a-col
:xl="12"
:lg="12"
:md="12"
:sm="24"
:xs="24"
>
<a-skeleton
active
:loading="optionLoading"
:paragraph="{rows: 10}"
>
<a-card :bordered="false"> <a-card :bordered="false">
<img :alt="themeProperty.name" :src="themeProperty.screenshots" slot="cover"> <img
:alt="themeProperty.name"
:src="themeProperty.screenshots"
slot="cover"
>
<a-card-meta :description="themeProperty.description"> <a-card-meta :description="themeProperty.description">
<template slot="title"> <template slot="title">
<a <a
@ -86,16 +133,33 @@
size="large" size="large"
slot="avatar" slot="avatar"
/> />
<a-avatar v-else size="large" slot="avatar">{{ themeProperty.author.name }}</a-avatar> <a-avatar
v-else
size="large"
slot="avatar"
>{{ themeProperty.author.name }}</a-avatar>
</a-card-meta> </a-card-meta>
</a-card> </a-card>
</a-skeleton> </a-skeleton>
</a-col> </a-col>
<a-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24" <a-col
style="padding-bottom: 50px;"> :xl="12"
<a-skeleton active :loading="optionLoading" :paragraph="{rows: 20}"> :lg="12"
:md="12"
:sm="24"
:xs="24"
style="padding-bottom: 50px;"
>
<a-skeleton
active
:loading="optionLoading"
:paragraph="{rows: 20}"
>
<div class="card-container"> <div class="card-container">
<a-tabs type="card" defaultActiveKey="0"> <a-tabs
type="card"
defaultActiveKey="0"
>
<a-tab-pane <a-tab-pane
v-for="(group, index) in themeConfiguration" v-for="(group, index) in themeConfiguration"
:key="index.toString()" :key="index.toString()"
@ -153,10 +217,11 @@ style="padding-bottom: 50px;">
</a-col> </a-col>
</a-row> </a-row>
<footer-tool-bar <footer-tool-bar :style="{ width: isSideMenu() && isDesktop() ? `calc(100% - ${sidebarOpened ? 256 : 80}px)` : '100%'}">
:style="{ width: isSideMenu() && isDesktop() ? `calc(100% - ${sidebarOpened ? 256 : 80}px)` : '100%'}" <a-button
> type="primary"
<a-button type="primary" @click="handleSaveSettings"></a-button> @click="handleSaveSettings"
>保存</a-button>
<a-button <a-button
type="dashed" type="dashed"
@click="()=>this.attachmentDrawerVisible = true" @click="()=>this.attachmentDrawerVisible = true"
@ -164,11 +229,19 @@ style="padding-bottom: 50px;">
>附件库</a-button> >附件库</a-button>
</footer-tool-bar> </footer-tool-bar>
<AttachmentDrawer v-model="attachmentDrawerVisible"/> <AttachmentDrawer v-model="attachmentDrawerVisible" />
</a-drawer> </a-drawer>
<div class="upload-button"> <div class="upload-button">
<a-dropdown placement="topLeft" :trigger="['click']"> <a-dropdown
<a-button type="primary" shape="circle" icon="plus" size="large"></a-button> placement="topLeft"
:trigger="['click']"
>
<a-button
type="primary"
shape="circle"
icon="plus"
size="large"
></a-button>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item> <a-menu-item>
<a <a
@ -178,7 +251,11 @@ style="padding-bottom: 50px;">
>安装主题</a> >安装主题</a>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a rel="noopener noreferrer" href="javascript:void(0);" @click="handleReload"></a> <a
rel="noopener noreferrer"
href="javascript:void(0);"
@click="handleReload"
>刷新列表</a>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
@ -191,24 +268,40 @@ style="padding-bottom: 50px;">
> >
<div class="custom-tab-wrapper"> <div class="custom-tab-wrapper">
<a-tabs> <a-tabs>
<a-tab-pane tab="远程拉取" key="1"> <a-tab-pane
tab="远程拉取"
key="1"
>
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="远程地址:"> <a-form-item label="远程地址:">
<a-input v-model="fetchingUrl"/> <a-input v-model="fetchingUrl" />
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="handleFetching" :loading="fetchButtonLoading">下载</a-button> <a-button
type="primary"
@click="handleFetching"
:loading="fetchButtonLoading"
>下载</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
<a-alert type="info" closable> <a-alert
type="info"
closable
>
<template slot="message"> <template slot="message">
远程地址即主题仓库地址https://github.com/halo-dev/halo-theme-quick-starter 远程地址即主题仓库地址https://github.com/halo-dev/halo-theme-quick-starter
<br>更多主题请访问 <br>更多主题请访问
<a target="_blank" href="https://halo.run/theme">https://halo.run/theme</a> <a
target="_blank"
href="https://halo.run/theme"
>https://halo.run/theme</a>
</template> </template>
</a-alert> </a-alert>
</a-tab-pane> </a-tab-pane>
<a-tab-pane tab="本地上传" key="2"> <a-tab-pane
tab="本地上传"
key="2"
>
<upload <upload
name="file" name="file"
multiple multiple
@ -218,7 +311,7 @@ style="padding-bottom: 50px;">
@success="handleUploadSuccess" @success="handleUploadSuccess"
> >
<p class="ant-upload-drag-icon"> <p class="ant-upload-drag-icon">
<a-icon type="inbox"/> <a-icon type="inbox" />
</p> </p>
<p class="ant-upload-text">点击选择主题或将主题拖拽到此处</p> <p class="ant-upload-text">点击选择主题或将主题拖拽到此处</p>
<p class="ant-upload-hint">支持单个或批量上传仅支持 ZIP 格式的文件</p> <p class="ant-upload-hint">支持单个或批量上传仅支持 ZIP 格式的文件</p>

View File

@ -76,13 +76,13 @@
:href="options.blog_url+record.url" :href="options.blog_url+record.url"
target="_blank" target="_blank"
v-if="record.status" v-if="record.status"
>查看</a> >访问</a>
<a <a
:href="options.blog_url+record.url" :href="options.blog_url+record.url"
target="_blank" target="_blank"
disabled disabled
v-else v-else
>查看</a> >访问</a>
</span> </span>
</a-table> </a-table>
</a-tab-pane> </a-tab-pane>