修改:独立页面管理
This commit is contained in:
parent
a9d62b3931
commit
4615b782f6
@ -18,6 +18,14 @@ export default {
|
||||
data
|
||||
})
|
||||
},
|
||||
// 修改文档排序 /markdown/sort
|
||||
sortMarkdown: function(data) {
|
||||
return request({
|
||||
url: '/markdown/sort',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
},
|
||||
// 删除草稿 /markdown/deleteDraft
|
||||
deleteDraft: function(params) {
|
||||
return request({
|
||||
|
||||
@ -16,7 +16,7 @@ a:hover {
|
||||
}
|
||||
/deep/.box-card {
|
||||
margin: 0 auto;
|
||||
max-width: 1080px;
|
||||
max-width: 1140px;
|
||||
min-width: 640px;
|
||||
.clearfix {
|
||||
font-size: 16px;
|
||||
|
||||
@ -29,7 +29,6 @@ export default{
|
||||
watch: {
|
||||
value(value){
|
||||
if (!this.isLocked || !this.innerText) {
|
||||
console.log('value', value)
|
||||
this.innerText = value
|
||||
document.getElementById('edit-div').innerHTML = value
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@
|
||||
this.filename = this.file.name.split('.md')[0]
|
||||
this.storageLocation = this.file.path
|
||||
// 加载标签
|
||||
if(this.tags && this.tags.length > 0) {
|
||||
if(this.file.tagIds && this.file.tagIds.length > 0 && this.tags && this.tags.length > 0) {
|
||||
this.loadDynamicTags()
|
||||
}
|
||||
}).then(() => {
|
||||
|
||||
@ -28,4 +28,5 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import "src/styles/setting";
|
||||
</style>
|
||||
|
||||
@ -71,15 +71,16 @@
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:show-overflow-tooltip="true"
|
||||
min-width="200"
|
||||
label="标题">
|
||||
<template slot-scope="scope">
|
||||
<a :title="'编辑 '+scope.row.name" @click="editArticle(scope.row.id)">{{scope.row.name}}<svg-icon icon-class="bianji-"></svg-icon></a>
|
||||
<router-link :title="'浏览 '+scope.row.name" :to="'/articles/article?mark='+scope.row.id" target="_blank"><svg-icon class="wailian" icon-class="wailian"></svg-icon></router-link>
|
||||
<router-link :title="'浏览 '+scope.row.name" :to="'/articles/'+scope.row.slug" target="_blank"><svg-icon class="wailian" icon-class="wailian"></svg-icon></router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="!alonePage"
|
||||
width="150"
|
||||
min-width="100"
|
||||
label="状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.draft" size="medium" type="warning">草稿</el-tag>
|
||||
@ -94,7 +95,6 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="username"
|
||||
width="100"
|
||||
label="作者">
|
||||
<template slot-scope="scope">
|
||||
<router-link :to="$route.path+'?uid='+scope.row.userId">{{scope.row.username}}</router-link>
|
||||
@ -113,7 +113,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="updateDate"
|
||||
label="日期">
|
||||
label="日期"
|
||||
width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.updateDate.substring(0, 16)}}</span>
|
||||
</template>
|
||||
@ -201,12 +202,14 @@ export default {
|
||||
}
|
||||
window.addEventListener('beforeunload', e => this.beforeunloadFn(e))
|
||||
|
||||
// 阻止默认行为
|
||||
document.body.ondrop = function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
this.rowDrop()
|
||||
if(this.alonePage){
|
||||
// 阻止默认行为
|
||||
document.body.ondrop = function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
this.rowDrop()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
hasChange(val){
|
||||
@ -228,6 +231,18 @@ export default {
|
||||
onEnd({ newIndex, oldIndex }) {
|
||||
const currRow = _this.articleList.splice(oldIndex, 1)[0]
|
||||
_this.articleList.splice(newIndex, 0, currRow)
|
||||
|
||||
let fileIdList = []
|
||||
_this.articleList.forEach(article => {
|
||||
fileIdList.push(article.id)
|
||||
})
|
||||
// 修改排序
|
||||
console.log(fileIdList)
|
||||
markdownApi.sortMarkdown(fileIdList).then(()=>{
|
||||
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -266,11 +281,7 @@ export default {
|
||||
},
|
||||
goBack() {
|
||||
const operation = this.$route.query.operation
|
||||
if(operation){
|
||||
this.newArticleDialogVisible = true
|
||||
} else {
|
||||
this.newArticleDialogVisible = false
|
||||
}
|
||||
this.newArticleDialogVisible = !!operation;
|
||||
},
|
||||
cancelFilter() {
|
||||
this.$router.push({query: {}})
|
||||
@ -303,7 +314,6 @@ export default {
|
||||
keyword: this.query.keyword,
|
||||
categoryIds: this.query.categoryIds
|
||||
}).then((res) => {
|
||||
console.log(res.data)
|
||||
this.articleList = res.data
|
||||
this.pagination.total = res.count
|
||||
this.$nextTick(() => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div className="container">
|
||||
<div class="container">
|
||||
<article-manager :page-title="pageTitle"></article-manager>
|
||||
</div>
|
||||
</template>
|
||||
@ -27,4 +27,5 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import "src/styles/setting";
|
||||
</style>
|
||||
|
||||
@ -82,7 +82,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeNames: ['2'],
|
||||
activeNames: [],
|
||||
example: '<i class="fab fa-github">github</i>',
|
||||
form: {
|
||||
backgroundSite: '',
|
||||
@ -98,6 +98,12 @@ export default {
|
||||
computed: {},
|
||||
mounted() {
|
||||
this.getSetting()
|
||||
this.$nextTick(() => {
|
||||
const that = this
|
||||
setTimeout(function (){
|
||||
that.activeNames = ['2']
|
||||
},50)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
preview(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user