Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Support view when theme setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Aug 31, 2019
1 parent 2ae075c commit 9e43dfd
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 37 deletions.
12 changes: 0 additions & 12 deletions src/components/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -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-item {
padding-bottom: 0 !important;
Expand Down
13 changes: 10 additions & 3 deletions src/views/attachment/AttachmentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
:span="24"
class="search-box"
>
<a-card :bordered="false">
<a-card
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
Expand Down Expand Up @@ -100,7 +103,10 @@
>
<div class="attach-thumb">
<span v-show="!handleJudgeMediaType(item)">当前格式不支持预览</span>
<img :src="item.thumbPath" v-show="handleJudgeMediaType(item)">
<img
:src="item.thumbPath"
v-show="handleJudgeMediaType(item)"
>
</div>
<a-card-meta>
<ellipsis
Expand Down Expand Up @@ -280,7 +286,8 @@ export default {
position: relative;
padding-bottom: 56%;
overflow: hidden;
img, span{
img,
span {
width: 100%;
height: 100%;
position: absolute;
Expand Down
5 changes: 4 additions & 1 deletion src/views/comment/components/CommentTab.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<div class="comment-tab-wrapper">
<a-card :bordered="false">
<a-card
:bordered="false"
:bodyStyle="{ padding: 0 }"
>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
Expand Down
10 changes: 8 additions & 2 deletions src/views/interface/MenuList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card :title="title">
<a-card
:title="title"
:bodyStyle="{ padding: '16px' }"
>
<a-form layout="horizontal">
<a-form-item
label="名称:"
Expand Down Expand Up @@ -96,7 +99,10 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card title="所有菜单">
<a-card
title="所有菜单"
:bodyStyle="{ padding: '16px' }"
>
<a-table
:columns="columns"
:dataSource="menus"
Expand Down
4 changes: 2 additions & 2 deletions src/views/interface/ThemeEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:xs="24"
:style="{'padding-bottom':'12px'}"
>
<a-card>
<a-card :bodyStyle="{ padding: '16px' }">
<a-form layout="vertical">
<a-form-item>
<codemirror
Expand All @@ -35,7 +35,7 @@
:xs="24"
:style="{'padding-bottom':'12px'}"
>
<a-card>
<a-card :bodyStyle="{ padding: '16px' }">
<template slot="title">
<a-select
style="width: 100%"
Expand Down
83 changes: 77 additions & 6 deletions src/views/interface/components/ThemeSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:md="12"
:sm="24"
:xs="24"
v-if="!viewMode"
>
<a-skeleton
active
Expand Down Expand Up @@ -53,9 +54,9 @@
</a-skeleton>
</a-col>
<a-col
:xl="12"
:lg="12"
:md="12"
:xl="formColValue"
:lg="formColValue"
:md="formColValue"
:sm="24"
:xs="24"
style="padding-bottom: 50px;"
Expand Down Expand Up @@ -158,19 +159,55 @@
</div>
</a-skeleton>
</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>

<AttachmentSelectDrawer
v-model="attachmentDrawerVisible"
@listenToSelect="handleSelectAttachment"
title="选择附件"
isChooseAvatar
/>

<footer-tool-bar
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
type="primary"
@click="handleSaveSettings"
Expand All @@ -185,6 +222,7 @@ import FooterToolBar from '@/components/FooterToolbar'
import Verte from 'verte'
import 'verte/dist/verte.css'
import themeApi from '@/api/theme'
import optionApi from '@/api/option'
export default {
name: 'ThemeSetting',
mixins: [mixin, mixinDevice],
Expand All @@ -206,7 +244,11 @@ export default {
lg: { span: 12 },
sm: { span: 24 },
xs: { span: 24 }
}
},
viewMode: false,
formColValue: 12,
options: [],
keys: ['blog_url']
}
},
model: {
Expand All @@ -227,6 +269,7 @@ export default {
created() {
this.loadSkeleton()
this.initData()
this.loadOptions()
},
watch: {
visible: function(newValue, oldValue) {
Expand Down Expand Up @@ -258,6 +301,9 @@ export default {
handleSaveSettings() {
themeApi.saveSettings(this.selectedTheme.id, this.themeSettings).then(response => {
this.$message.success('保存成功!')
if (this.viewMode) {
document.getElementById('themeViewIframe').contentWindow.location.reload(true)
}
})
},
onClose() {
Expand All @@ -270,6 +316,31 @@ export default {
handleSelectAttachment(data) {
this.themeSettings[this.selectedField] = encodeURI(data.path)
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
})
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/post/CategoryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card :title="title">
<a-card :title="title" :bodyStyle="{ padding: '16px' }">
<a-form layout="horizontal">
<a-form-item
label="名称:"
Expand Down Expand Up @@ -68,7 +68,7 @@
:xs="24"
:style="{ 'padding-bottom': '1rem' }"
>
<a-card title="分类列表">
<a-card title="分类列表" :bodyStyle="{ padding: '16px' }">
<a-table
:columns="columns"
:dataSource="categories"
Expand Down
2 changes: 1 addition & 1 deletion src/views/post/PostList.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="page-header-index-wide">
<a-card :bordered="false">
<a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
Expand Down
4 changes: 2 additions & 2 deletions src/views/post/TagList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card :title="title">
<a-card :title="title" :bodyStyle="{ padding: '16px' }">
<a-form layout="horizontal">
<a-form-item
label="名称:"
Expand Down Expand Up @@ -64,7 +64,7 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card title="所有标签">
<a-card title="所有标签" :bodyStyle="{ padding: '16px' }">
<a-tooltip
placement="topLeft"
v-for="tag in tags"
Expand Down
1 change: 1 addition & 0 deletions src/views/post/components/PostSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ export default {
categoryApi.create(this.categoryToCreate).then(response => {
this.loadCategories()
this.categoryToCreate = {}
this.toggleCategoryForm()
})
},
toggleCategoryForm() {
Expand Down
2 changes: 1 addition & 1 deletion src/views/sheet/internal/JournalList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="page-header-index-wide">
<a-row>
<a-col :span="24">
<a-card :bordered="false">
<a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
Expand Down
4 changes: 2 additions & 2 deletions src/views/sheet/internal/LinkList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card :title="title">
<a-card :title="title" :bodyStyle="{ padding: '16px' }">
<a-form layout="horizontal">
<a-form-item label="网站名称:">
<a-input v-model="link.name" />
Expand Down Expand Up @@ -65,7 +65,7 @@
:xs="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card title="所有友情链接">
<a-card title="所有友情链接" :bodyStyle="{ padding: '16px' }">
<a-table
:columns="columns"
:dataSource="links"
Expand Down
2 changes: 1 addition & 1 deletion src/views/sheet/internal/PhotoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:span="24"
class="search-box"
>
<a-card :bordered="false">
<a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
Expand Down
8 changes: 7 additions & 1 deletion src/views/system/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
<div class="page-header-index-wide">
<a-row>
<a-col :span="24">
<a-card :bordered="false">
<a-card
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<a-card
:bordered="false"
class="environment-info"
:bodyStyle="{ padding: '16px' }"
>
<template slot="title">
环境信息
Expand Down Expand Up @@ -70,6 +74,7 @@
<a-card
title="开发者"
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<a
:href="item.github"
Expand All @@ -93,6 +98,7 @@
<a-card
title="时间轴"
:bordered="false"
:bodyStyle="{ padding: '16px' }"
>
<a-timeline>
<a-timeline-item>...</a-timeline-item>
Expand Down
2 changes: 1 addition & 1 deletion src/views/user/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:md="24"
:style="{ 'padding-bottom': '12px' }"
>
<a-card :bordered="false">
<a-card :bordered="false" :bodyStyle="{ padding: '16px' }">
<div class="profile-center-avatarHolder">
<a-tooltip
placement="right"
Expand Down

0 comments on commit 9e43dfd

Please sign in to comment.