feat: support set internal sheet's title.

pull/62/head
ruibaby 2020-02-11 14:45:36 +08:00
parent 79325ac182
commit 64a3b6c407
11 changed files with 200 additions and 19 deletions

View File

@ -125,7 +125,6 @@
</template> </template>
<script> <script>
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import { mapGetters } from 'vuex'
import commentApi from '@/api/comment' import commentApi from '@/api/comment'
export default { export default {
name: 'CommentDetail', name: 'CommentDetail',

View File

@ -429,7 +429,6 @@
</template> </template>
<script> <script>
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import { mapGetters } from 'vuex'
import CommentDetail from './CommentDetail' import CommentDetail from './CommentDetail'
import marked from 'marked' import marked from 'marked'
import commentApi from '@/api/comment' import commentApi from '@/api/comment'

View File

@ -322,7 +322,6 @@
<script> <script>
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import { mapGetters } from 'vuex'
import { PageView } from '@/layouts' import { PageView } from '@/layouts'
import AnalysisCard from './components/AnalysisCard' import AnalysisCard from './components/AnalysisCard'
import RecentCommentTab from './components/RecentCommentTab' import RecentCommentTab from './components/RecentCommentTab'

View File

@ -71,7 +71,6 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
import commentApi from '@/api/comment' import commentApi from '@/api/comment'
import postApi from '@/api/post' import postApi from '@/api/post'
import sheetApi from '@/api/sheet' import sheetApi from '@/api/sheet'

View File

@ -311,7 +311,7 @@ export default {
}, },
handleCategoryToMenu(category) { handleCategoryToMenu(category) {
this.menu['name'] = category.name this.menu['name'] = category.name
this.menu['url'] = `/categories/${category.slugName}` this.menu['url'] = `${category.fullPath}`
menuApi.create(this.menu).then(response => { menuApi.create(this.menu).then(response => {
this.$message.success('添加到菜单成功!') this.$message.success('添加到菜单成功!')
this.menu = {} this.menu = {}

View File

@ -518,7 +518,6 @@ import TargetCommentDrawer from '../comment/components/TargetCommentDrawer'
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer' import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
import TagSelect from './components/TagSelect' import TagSelect from './components/TagSelect'
import CategoryTree from './components/CategoryTree' import CategoryTree from './components/CategoryTree'
import { mapGetters } from 'vuex'
import categoryApi from '@/api/category' import categoryApi from '@/api/category'
import postApi from '@/api/post' import postApi from '@/api/post'
const columns = [ const columns = [

View File

@ -62,12 +62,12 @@
style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" style="max-width: 300px;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
> >
<a <a
:href="options.blog_url+item.url" :href="item.url"
target="_blank" target="_blank"
v-if="item.status" v-if="item.status"
>{{ item.title }}</a> >{{ item.title }}</a>
<a <a
:href="options.blog_url+item.url" :href="item.url"
target="_blank" target="_blank"
disabled disabled
v-else v-else
@ -124,12 +124,12 @@
</router-link> </router-link>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a <a
:href="options.blog_url+record.url" :href="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="record.url"
target="_blank" target="_blank"
disabled disabled
v-else v-else
@ -637,7 +637,7 @@ export default {
}, },
handleSheetToMenu(sheet) { handleSheetToMenu(sheet) {
this.menu['name'] = sheet.title this.menu['name'] = sheet.title
this.menu['url'] = `/s/${sheet.url}` this.menu['url'] = `${sheet.fullPath}`
menuApi.create(this.menu).then(response => { menuApi.create(this.menu).then(response => {
this.$message.success('添加到菜单成功!') this.$message.success('添加到菜单成功!')
this.menu = {} this.menu = {}

View File

@ -126,7 +126,10 @@
<a-list-item-meta> <a-list-item-meta>
<template slot="description"> <template slot="description">
<p v-html="item.content" class="journal-list-content"></p> <p
v-html="item.content"
class="journal-list-content"
></p>
</template> </template>
<span slot="title">{{ item.createTime | moment }}</span> <span slot="title">{{ item.createTime | moment }}</span>
<a-avatar <a-avatar
@ -154,6 +157,40 @@
</a-col> </a-col>
</a-row> </a-row>
<div style="position: fixed;bottom: 30px;right: 30px;">
<a-button
type="primary"
shape="circle"
icon="setting"
size="large"
@click="()=>this.optionFormVisible=true"
></a-button>
</div>
<a-modal
v-model="optionFormVisible"
title="页面设置"
:afterClose="onOptionFormClose"
>
<template slot="footer">
<a-button
key="submit"
type="primary"
@click="handleSaveOptions()"
>保存</a-button>
</template>
<a-form layout="vertical">
<a-form-item label="页面标题:">
<a-input v-model="options.journals_title" />
</a-form-item>
<a-form-item label="每页显示条数:">
<a-input
type="number"
v-model="options.journals_page_size"
/>
</a-form-item>
</a-form>
</a-modal>
<!-- 编辑日志弹窗 --> <!-- 编辑日志弹窗 -->
<a-modal v-model="visible"> <a-modal v-model="visible">
<template slot="title"> <template slot="title">
@ -211,9 +248,10 @@
import TargetCommentDrawer from '../../comment/components/TargetCommentDrawer' import TargetCommentDrawer from '../../comment/components/TargetCommentDrawer'
import AttachmentDrawer from '../../attachment/components/AttachmentDrawer' import AttachmentDrawer from '../../attachment/components/AttachmentDrawer'
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import { mapGetters } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import journalApi from '@/api/journal' import journalApi from '@/api/journal'
import journalCommentApi from '@/api/journalComment' import journalCommentApi from '@/api/journalComment'
import optionApi from '@/api/option'
export default { export default {
mixins: [mixin, mixinDevice], mixins: [mixin, mixinDevice],
components: { TargetCommentDrawer, AttachmentDrawer }, components: { TargetCommentDrawer, AttachmentDrawer },
@ -225,6 +263,7 @@ export default {
visible: false, visible: false,
journalCommentVisible: false, journalCommentVisible: false,
attachmentDrawerVisible: false, attachmentDrawerVisible: false,
optionFormVisible: false,
pagination: { pagination: {
page: 1, page: 1,
size: 10, size: 10,
@ -241,16 +280,19 @@ export default {
comments: [], comments: [],
journal: {}, journal: {},
isPublic: true, isPublic: true,
replyComment: {} replyComment: {},
options: []
} }
}, },
created() { created() {
this.loadJournals() this.loadJournals()
this.loadFormOptions()
}, },
computed: { computed: {
...mapGetters(['user']) ...mapGetters(['user'])
}, },
methods: { methods: {
...mapActions(['loadOptions']),
loadJournals() { loadJournals() {
this.listLoading = true this.listLoading = true
this.queryParam.page = this.pagination.page - 1 this.queryParam.page = this.pagination.page - 1
@ -262,6 +304,11 @@ export default {
this.listLoading = false this.listLoading = false
}) })
}, },
loadFormOptions() {
optionApi.listAll().then(response => {
this.options = response.data.data
})
},
handleQuery() { handleQuery() {
this.handlePaginationChange(1, this.pagination.size) this.handlePaginationChange(1, this.pagination.size)
}, },
@ -332,6 +379,17 @@ export default {
this.queryParam.keyword = null this.queryParam.keyword = null
this.queryParam.type = null this.queryParam.type = null
this.handlePaginationChange(1, this.pagination.size) this.handlePaginationChange(1, this.pagination.size)
},
handleSaveOptions() {
optionApi.save(this.options).then(response => {
this.loadFormOptions()
this.loadOptions()
this.$message.success('保存成功!')
this.optionFormVisible = false
})
},
onOptionFormClose() {
this.optionFormVisible = false
} }
} }
} }

View File

@ -195,11 +195,40 @@
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
<div style="position: fixed;bottom: 30px;right: 30px;">
<a-button
type="primary"
shape="circle"
icon="setting"
size="large"
@click="()=>this.optionFormVisible=true"
></a-button>
</div>
<a-modal
v-model="optionFormVisible"
title="页面设置"
:afterClose="onOptionFormClose"
>
<template slot="footer">
<a-button
key="submit"
type="primary"
@click="handleSaveOptions()"
>保存</a-button>
</template>
<a-form layout="vertical">
<a-form-item label="页面标题:">
<a-input v-model="options.links_title" />
</a-form-item>
</a-form>
</a-modal>
</div> </div>
</template> </template>
<script> <script>
import { mapActions } from 'vuex'
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import optionApi from '@/api/option'
import linkApi from '@/api/link' import linkApi from '@/api/link'
const columns = [ const columns = [
{ {
@ -231,12 +260,14 @@ export default {
data() { data() {
return { return {
formType: 'create', formType: 'create',
optionFormVisible: false,
data: [], data: [],
loading: false, loading: false,
columns, columns,
links: [], links: [],
link: {}, link: {},
teams: [] teams: [],
options: []
} }
}, },
computed: { computed: {
@ -250,8 +281,10 @@ export default {
created() { created() {
this.loadLinks() this.loadLinks()
this.loadTeams() this.loadTeams()
this.loadFormOptions()
}, },
methods: { methods: {
...mapActions(['loadOptions']),
loadLinks() { loadLinks() {
this.loading = true this.loading = true
linkApi.listAll().then(response => { linkApi.listAll().then(response => {
@ -264,6 +297,11 @@ export default {
this.teams = response.data.data this.teams = response.data.data
}) })
}, },
loadFormOptions() {
optionApi.listAll().then(response => {
this.options = response.data.data
})
},
handleSaveClick() { handleSaveClick() {
this.createOrUpdateLink() this.createOrUpdateLink()
}, },
@ -318,6 +356,17 @@ export default {
}) })
} }
this.handleAddLink() this.handleAddLink()
},
handleSaveOptions() {
optionApi.save(this.options).then(response => {
this.loadFormOptions()
this.loadOptions()
this.$message.success('保存成功!')
this.optionFormVisible = false
})
},
onOptionFormClose() {
this.optionFormVisible = false
} }
} }
} }

View File

@ -59,7 +59,10 @@
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<div class="table-operator" style="margin-bottom: 0;"> <div
class="table-operator"
style="margin-bottom: 0;"
>
<a-button <a-button
type="primary" type="primary"
icon="plus" icon="plus"
@ -85,7 +88,10 @@
@click="showDrawer(item)" @click="showDrawer(item)"
> >
<div class="photo-thumb"> <div class="photo-thumb">
<img :src="item.thumbnail" loading="lazy"> <img
:src="item.thumbnail"
loading="lazy"
>
</div> </div>
<a-card-meta style="padding: 0.8rem;"> <a-card-meta style="padding: 0.8rem;">
<ellipsis <ellipsis
@ -110,6 +116,39 @@
@showSizeChange="handlePaginationChange" @showSizeChange="handlePaginationChange"
/> />
</div> </div>
<div style="position: fixed;bottom: 30px;right: 30px;">
<a-button
type="primary"
shape="circle"
icon="setting"
size="large"
@click="()=>this.optionFormVisible=true"
></a-button>
</div>
<a-modal
v-model="optionFormVisible"
title="页面设置"
:afterClose="onOptionFormClose"
>
<template slot="footer">
<a-button
key="submit"
type="primary"
@click="handleSaveOptions()"
>保存</a-button>
</template>
<a-form layout="vertical">
<a-form-item label="页面标题:">
<a-input v-model="options.photos_title" />
</a-form-item>
<a-form-item label="每页显示条数:">
<a-input
type="number"
v-model="options.photos_page_size"
/>
</a-form-item>
</a-form>
</a-modal>
<a-drawer <a-drawer
title="图片详情" title="图片详情"
:width="isMobile()?'100%':'460'" :width="isMobile()?'100%':'460'"
@ -289,9 +328,11 @@
</template> </template>
<script> <script>
import { mapActions } from 'vuex'
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import AttachmentSelectDrawer from '../../attachment/components/AttachmentSelectDrawer' import AttachmentSelectDrawer from '../../attachment/components/AttachmentSelectDrawer'
import photoApi from '@/api/photo' import photoApi from '@/api/photo'
import optionApi from '@/api/option'
export default { export default {
components: { components: {
@ -304,6 +345,7 @@ export default {
drawerLoading: false, drawerLoading: false,
listLoading: true, listLoading: true,
thumDrawerVisible: false, thumDrawerVisible: false,
optionFormVisible: false,
photo: {}, photo: {},
photos: [], photos: [],
teams: [], teams: [],
@ -319,14 +361,17 @@ export default {
sort: null, sort: null,
keyword: null, keyword: null,
team: null team: null
} },
options: []
} }
}, },
created() { created() {
this.loadPhotos() this.loadPhotos()
this.loadTeams() this.loadTeams()
this.loadFormOptions()
}, },
methods: { methods: {
...mapActions(['loadOptions']),
loadPhotos() { loadPhotos() {
this.listLoading = true this.listLoading = true
this.queryParam.page = this.pagination.page - 1 this.queryParam.page = this.pagination.page - 1
@ -338,6 +383,11 @@ export default {
this.listLoading = false this.listLoading = false
}) })
}, },
loadFormOptions() {
optionApi.listAll().then(response => {
this.options = response.data.data
})
},
handleQuery() { handleQuery() {
this.handlePaginationChange(1, this.pagination.size) this.handlePaginationChange(1, this.pagination.size)
}, },
@ -406,6 +456,17 @@ export default {
this.drawerVisible = false this.drawerVisible = false
this.photo = {} this.photo = {}
this.editable = false this.editable = false
},
handleSaveOptions() {
optionApi.save(this.options).then(response => {
this.loadFormOptions()
this.loadOptions()
this.$message.success('保存成功!')
this.optionFormVisible = false
})
},
onOptionFormClose() {
this.optionFormVisible = false
} }
} }
} }

View File

@ -637,6 +637,24 @@
</template> </template>
<a-input v-model="options.sheet_prefix" /> <a-input v-model="options.sheet_prefix" />
</a-form-item> </a-form-item>
<a-form-item label="友情链接页面前缀:">
<template slot="help">
<span>{{ options.blog_url }}/{{ options.links_prefix }}</span>
</template>
<a-input v-model="options.links_prefix" />
</a-form-item>
<a-form-item label="图库页面前缀:">
<template slot="help">
<span>{{ options.blog_url }}/{{ options.photos_prefix }}</span>
</template>
<a-input v-model="options.photos_prefix" />
</a-form-item>
<a-form-item label="日志页面前缀:">
<template slot="help">
<span>{{ options.blog_url }}/{{ options.journals_prefix }}</span>
</template>
<a-input v-model="options.journals_prefix" />
</a-form-item>
<a-form-item label="归档前缀:"> <a-form-item label="归档前缀:">
<template slot="help"> <template slot="help">
<span>{{ options.blog_url }}/{{ options.archives_prefix }}{{ options.path_suffix }}</span> <span>{{ options.blog_url }}/{{ options.archives_prefix }}{{ options.path_suffix }}</span>