Support view when theme setting.

pull/40/head
ruibaby 2019-08-31 23:18:07 +08:00
parent 2ae075c3b1
commit 9e43dfdf69
15 changed files with 119 additions and 37 deletions

View File

@ -541,18 +541,6 @@ body {
} }
} }
.ant-card-wider-padding {
.ant-card-body {
padding: 16px !important;
}
}
.comment-tab-wrapper {
.ant-card-body {
padding: 0 !important;
}
}
.ant-form { .ant-form {
.ant-form-item { .ant-form-item {
padding-bottom: 0 !important; padding-bottom: 0 !important;

View File

@ -9,7 +9,10 @@
:span="24" :span="24"
class="search-box" class="search-box"
> >
<a-card :bordered="false"> <a-card
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">
@ -100,7 +103,10 @@
> >
<div class="attach-thumb"> <div class="attach-thumb">
<span v-show="!handleJudgeMediaType(item)"></span> <span v-show="!handleJudgeMediaType(item)"></span>
<img :src="item.thumbPath" v-show="handleJudgeMediaType(item)"> <img
:src="item.thumbPath"
v-show="handleJudgeMediaType(item)"
>
</div> </div>
<a-card-meta> <a-card-meta>
<ellipsis <ellipsis
@ -280,7 +286,8 @@ export default {
position: relative; position: relative;
padding-bottom: 56%; padding-bottom: 56%;
overflow: hidden; overflow: hidden;
img, span{ img,
span {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;

View File

@ -1,6 +1,9 @@
<template> <template>
<div class="comment-tab-wrapper"> <div class="comment-tab-wrapper">
<a-card :bordered="false"> <a-card
:bordered="false"
:bodyStyle="{ padding: 0 }"
>
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">

View File

@ -9,7 +9,10 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card :title="title"> <a-card
:title="title"
:bodyStyle="{ padding: '16px' }"
>
<a-form layout="horizontal"> <a-form layout="horizontal">
<a-form-item <a-form-item
label="名称:" label="名称:"
@ -96,7 +99,10 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card title="所有菜单"> <a-card
title="所有菜单"
:bodyStyle="{ padding: '16px' }"
>
<a-table <a-table
:columns="columns" :columns="columns"
:dataSource="menus" :dataSource="menus"

View File

@ -9,7 +9,7 @@
:xs="24" :xs="24"
:style="{'padding-bottom':'12px'}" :style="{'padding-bottom':'12px'}"
> >
<a-card> <a-card :bodyStyle="{ padding: '16px' }">
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item> <a-form-item>
<codemirror <codemirror
@ -35,7 +35,7 @@
:xs="24" :xs="24"
:style="{'padding-bottom':'12px'}" :style="{'padding-bottom':'12px'}"
> >
<a-card> <a-card :bodyStyle="{ padding: '16px' }">
<template slot="title"> <template slot="title">
<a-select <a-select
style="width: 100%" style="width: 100%"

View File

@ -18,6 +18,7 @@
:md="12" :md="12"
:sm="24" :sm="24"
:xs="24" :xs="24"
v-if="!viewMode"
> >
<a-skeleton <a-skeleton
active active
@ -53,9 +54,9 @@
</a-skeleton> </a-skeleton>
</a-col> </a-col>
<a-col <a-col
:xl="12" :xl="formColValue"
:lg="12" :lg="formColValue"
:md="12" :md="formColValue"
:sm="24" :sm="24"
:xs="24" :xs="24"
style="padding-bottom: 50px;" style="padding-bottom: 50px;"
@ -158,19 +159,55 @@
</div> </div>
</a-skeleton> </a-skeleton>
</a-col> </a-col>
<a-col
:xl="20"
:lg="20"
:md="20"
:sm="24"
:xs="24"
v-if="viewMode"
>
<a-card
:bordered="true"
:bodyStyle="{ padding: 0}"
>
<iframe
id="themeViewIframe"
title="主题预览"
frameborder="0"
scrolling="auto"
border="0"
:src="options.blog_url"
style="width:100%;height:1000px;overflow-y:hidden;"
> </iframe>
</a-card>
</a-col>
</a-row> </a-row>
<AttachmentSelectDrawer <AttachmentSelectDrawer
v-model="attachmentDrawerVisible" v-model="attachmentDrawerVisible"
@listenToSelect="handleSelectAttachment" @listenToSelect="handleSelectAttachment"
title="选择附件" title="选择附件"
isChooseAvatar
/> />
<footer-tool-bar <footer-tool-bar
v-if="themeConfiguration.length>0" v-if="themeConfiguration.length>0"
:style="{ width: isSideMenu() && isDesktop() ? `calc(100% - ${sidebarOpened ? 256 : 80}px)` : '100%'}" :style="{ width : '100%'}"
> >
<a-button
v-if="theme.activated && viewMode"
type="primary"
@click="toggleViewMode"
style="marginRight: 8px"
ghost
>普通模式</a-button>
<a-button
v-else-if="theme.activated && !viewMode"
type="dashed"
@click="toggleViewMode"
style="marginRight: 8px"
>预览模式</a-button>
<a-button <a-button
type="primary" type="primary"
@click="handleSaveSettings" @click="handleSaveSettings"
@ -185,6 +222,7 @@ import FooterToolBar from '@/components/FooterToolbar'
import Verte from 'verte' import Verte from 'verte'
import 'verte/dist/verte.css' import 'verte/dist/verte.css'
import themeApi from '@/api/theme' import themeApi from '@/api/theme'
import optionApi from '@/api/option'
export default { export default {
name: 'ThemeSetting', name: 'ThemeSetting',
mixins: [mixin, mixinDevice], mixins: [mixin, mixinDevice],
@ -206,7 +244,11 @@ export default {
lg: { span: 12 }, lg: { span: 12 },
sm: { span: 24 }, sm: { span: 24 },
xs: { span: 24 } xs: { span: 24 }
} },
viewMode: false,
formColValue: 12,
options: [],
keys: ['blog_url']
} }
}, },
model: { model: {
@ -227,6 +269,7 @@ export default {
created() { created() {
this.loadSkeleton() this.loadSkeleton()
this.initData() this.initData()
this.loadOptions()
}, },
watch: { watch: {
visible: function(newValue, oldValue) { visible: function(newValue, oldValue) {
@ -258,6 +301,9 @@ export default {
handleSaveSettings() { handleSaveSettings() {
themeApi.saveSettings(this.selectedTheme.id, this.themeSettings).then(response => { themeApi.saveSettings(this.selectedTheme.id, this.themeSettings).then(response => {
this.$message.success('保存成功!') this.$message.success('保存成功!')
if (this.viewMode) {
document.getElementById('themeViewIframe').contentWindow.location.reload(true)
}
}) })
}, },
onClose() { onClose() {
@ -270,6 +316,31 @@ export default {
handleSelectAttachment(data) { handleSelectAttachment(data) {
this.themeSettings[this.selectedField] = encodeURI(data.path) this.themeSettings[this.selectedField] = encodeURI(data.path)
this.attachmentDrawerVisible = false this.attachmentDrawerVisible = false
},
toggleViewMode() {
if (!this.viewMode) {
this.formColValue = 4
this.wrapperCol = {
xl: { span: 24 },
lg: { span: 24 },
sm: { span: 24 },
xs: { span: 24 }
}
} else {
this.formColValue = 12
this.wrapperCol = {
xl: { span: 12 },
lg: { span: 12 },
sm: { span: 24 },
xs: { span: 24 }
}
}
this.viewMode = !this.viewMode
},
loadOptions() {
optionApi.listAll(this.keys).then(response => {
this.options = response.data.data
})
} }
} }
} }

View File

@ -9,7 +9,7 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card :title="title"> <a-card :title="title" :bodyStyle="{ padding: '16px' }">
<a-form layout="horizontal"> <a-form layout="horizontal">
<a-form-item <a-form-item
label="名称:" label="名称:"
@ -68,7 +68,7 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '1rem' }" :style="{ 'padding-bottom': '1rem' }"
> >
<a-card title="分类列表"> <a-card title="分类列表" :bodyStyle="{ padding: '16px' }">
<a-table <a-table
:columns="columns" :columns="columns"
:dataSource="categories" :dataSource="categories"

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<a-card :bordered="false"> <a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">

View File

@ -9,7 +9,7 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card :title="title"> <a-card :title="title" :bodyStyle="{ padding: '16px' }">
<a-form layout="horizontal"> <a-form layout="horizontal">
<a-form-item <a-form-item
label="名称:" label="名称:"
@ -64,7 +64,7 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card title="所有标签"> <a-card title="所有标签" :bodyStyle="{ padding: '16px' }">
<a-tooltip <a-tooltip
placement="topLeft" placement="topLeft"
v-for="tag in tags" v-for="tag in tags"

View File

@ -339,6 +339,7 @@ export default {
categoryApi.create(this.categoryToCreate).then(response => { categoryApi.create(this.categoryToCreate).then(response => {
this.loadCategories() this.loadCategories()
this.categoryToCreate = {} this.categoryToCreate = {}
this.toggleCategoryForm()
}) })
}, },
toggleCategoryForm() { toggleCategoryForm() {

View File

@ -2,7 +2,7 @@
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-card :bordered="false"> <a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">

View File

@ -9,7 +9,7 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card :title="title"> <a-card :title="title" :bodyStyle="{ padding: '16px' }">
<a-form layout="horizontal"> <a-form layout="horizontal">
<a-form-item label="网站名称:"> <a-form-item label="网站名称:">
<a-input v-model="link.name" /> <a-input v-model="link.name" />
@ -65,7 +65,7 @@
:xs="24" :xs="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card title="所有友情链接"> <a-card title="所有友情链接" :bodyStyle="{ padding: '16px' }">
<a-table <a-table
:columns="columns" :columns="columns"
:dataSource="links" :dataSource="links"

View File

@ -9,7 +9,7 @@
:span="24" :span="24"
class="search-box" class="search-box"
> >
<a-card :bordered="false"> <a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">

View File

@ -2,10 +2,14 @@
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-card :bordered="false"> <a-card
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<a-card <a-card
:bordered="false" :bordered="false"
class="environment-info" class="environment-info"
:bodyStyle="{ padding: '16px' }"
> >
<template slot="title"> <template slot="title">
环境信息 环境信息
@ -70,6 +74,7 @@
<a-card <a-card
title="开发者" title="开发者"
:bordered="false" :bordered="false"
:bodyStyle="{ padding: '16px' }"
> >
<a <a
:href="item.github" :href="item.github"
@ -93,6 +98,7 @@
<a-card <a-card
title="时间轴" title="时间轴"
:bordered="false" :bordered="false"
:bodyStyle="{ padding: '16px' }"
> >
<a-timeline> <a-timeline>
<a-timeline-item>...</a-timeline-item> <a-timeline-item>...</a-timeline-item>

View File

@ -6,7 +6,7 @@
:md="24" :md="24"
:style="{ 'padding-bottom': '12px' }" :style="{ 'padding-bottom': '12px' }"
> >
<a-card :bordered="false"> <a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="profile-center-avatarHolder"> <div class="profile-center-avatarHolder">
<a-tooltip <a-tooltip
placement="right" placement="right"