修改:独立页面管理

This commit is contained in:
jmal 2020-12-13 23:34:53 +08:00
parent a9d62b3931
commit 4615b782f6
8 changed files with 46 additions and 21 deletions

View File

@ -18,6 +18,14 @@ export default {
data data
}) })
}, },
// 修改文档排序 /markdown/sort
sortMarkdown: function(data) {
return request({
url: '/markdown/sort',
method: 'post',
data
})
},
// 删除草稿 /markdown/deleteDraft // 删除草稿 /markdown/deleteDraft
deleteDraft: function(params) { deleteDraft: function(params) {
return request({ return request({

View File

@ -16,7 +16,7 @@ a:hover {
} }
/deep/.box-card { /deep/.box-card {
margin: 0 auto; margin: 0 auto;
max-width: 1080px; max-width: 1140px;
min-width: 640px; min-width: 640px;
.clearfix { .clearfix {
font-size: 16px; font-size: 16px;

View File

@ -29,7 +29,6 @@ export default{
watch: { watch: {
value(value){ value(value){
if (!this.isLocked || !this.innerText) { if (!this.isLocked || !this.innerText) {
console.log('value', value)
this.innerText = value this.innerText = value
document.getElementById('edit-div').innerHTML = value document.getElementById('edit-div').innerHTML = value
} }

View File

@ -274,7 +274,7 @@
this.filename = this.file.name.split('.md')[0] this.filename = this.file.name.split('.md')[0]
this.storageLocation = this.file.path 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() this.loadDynamicTags()
} }
}).then(() => { }).then(() => {

View File

@ -28,4 +28,5 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "src/styles/setting";
</style> </style>

View File

@ -71,15 +71,16 @@
<el-table-column <el-table-column
prop="name" prop="name"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
min-width="200"
label="标题"> label="标题">
<template slot-scope="scope"> <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> <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> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="!alonePage" v-if="!alonePage"
width="150" min-width="100"
label="状态"> label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.draft" size="medium" type="warning">草稿</el-tag> <el-tag v-if="scope.row.draft" size="medium" type="warning">草稿</el-tag>
@ -94,7 +95,6 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="username" prop="username"
width="100"
label="作者"> label="作者">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="$route.path+'?uid='+scope.row.userId">{{scope.row.username}}</router-link> <router-link :to="$route.path+'?uid='+scope.row.userId">{{scope.row.username}}</router-link>
@ -113,7 +113,8 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="updateDate" prop="updateDate"
label="日期"> label="日期"
width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.updateDate.substring(0, 16)}}</span> <span>{{scope.row.updateDate.substring(0, 16)}}</span>
</template> </template>
@ -201,12 +202,14 @@ export default {
} }
window.addEventListener('beforeunload', e => this.beforeunloadFn(e)) window.addEventListener('beforeunload', e => this.beforeunloadFn(e))
// 阻止默认行为 if(this.alonePage){
document.body.ondrop = function (event) { // 阻止默认行为
event.preventDefault(); document.body.ondrop = function (event) {
event.stopPropagation(); event.preventDefault();
}; event.stopPropagation();
this.rowDrop() };
this.rowDrop()
}
}, },
watch: { watch: {
hasChange(val){ hasChange(val){
@ -228,6 +231,18 @@ export default {
onEnd({ newIndex, oldIndex }) { onEnd({ newIndex, oldIndex }) {
const currRow = _this.articleList.splice(oldIndex, 1)[0] const currRow = _this.articleList.splice(oldIndex, 1)[0]
_this.articleList.splice(newIndex, 0, currRow) _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() { goBack() {
const operation = this.$route.query.operation const operation = this.$route.query.operation
if(operation){ this.newArticleDialogVisible = !!operation;
this.newArticleDialogVisible = true
} else {
this.newArticleDialogVisible = false
}
}, },
cancelFilter() { cancelFilter() {
this.$router.push({query: {}}) this.$router.push({query: {}})
@ -303,7 +314,6 @@ export default {
keyword: this.query.keyword, keyword: this.query.keyword,
categoryIds: this.query.categoryIds categoryIds: this.query.categoryIds
}).then((res) => { }).then((res) => {
console.log(res.data)
this.articleList = res.data this.articleList = res.data
this.pagination.total = res.count this.pagination.total = res.count
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -1,5 +1,5 @@
<template> <template>
<div className="container"> <div class="container">
<article-manager :page-title="pageTitle"></article-manager> <article-manager :page-title="pageTitle"></article-manager>
</div> </div>
</template> </template>
@ -27,4 +27,5 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "src/styles/setting";
</style> </style>

View File

@ -82,7 +82,7 @@ export default {
}, },
data() { data() {
return { return {
activeNames: ['2'], activeNames: [],
example: '<i class="fab fa-github">github</i>', example: '<i class="fab fa-github">github</i>',
form: { form: {
backgroundSite: '', backgroundSite: '',
@ -98,6 +98,12 @@ export default {
computed: {}, computed: {},
mounted() { mounted() {
this.getSetting() this.getSetting()
this.$nextTick(() => {
const that = this
setTimeout(function (){
that.activeNames = ['2']
},50)
})
}, },
methods: { methods: {
preview(){ preview(){