|
@@ -32,7 +32,7 @@
|
|
|
<el-table-column class-name="status-col" label="Status" width="80ß">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-tag :type="row.status | statusFilter">
|
|
|
- {{ row.status == 'normal' ? "正常" : "删除" }}
|
|
|
+ {{ row.status == 'normal' ? "正常" : "待发布" }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -45,13 +45,16 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column align="center" label="Actions" width="190" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column align="center" label="Actions" width="320" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<router-link :to="'/article/edit/'+scope.row.id">
|
|
|
<el-button type="primary" size="mini" icon="el-icon-edit">
|
|
|
修改
|
|
|
</el-button>
|
|
|
</router-link>
|
|
|
+ <el-button type="success" size="mini" icon="el-icon-success" style="margin-left: 10px;" :disabled="scope.row.status == 'normal'" @click="handleUpdate(scope)">
|
|
|
+ {{ scope.row.status == 'normal' ? "已发布" : "发布" }}
|
|
|
+ </el-button>
|
|
|
<el-button type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px;" @click="handleDelete(scope)">
|
|
|
删除
|
|
|
</el-button>
|
|
@@ -64,7 +67,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { fetchList, deleteArticle } from '@/api/article'
|
|
|
+import { fetchList, deleteArticle, commitArticle, fetchArticle } from '@/api/article'
|
|
|
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
|
|
import waves from '@/directive/waves'
|
|
|
|
|
@@ -128,6 +131,23 @@ export default {
|
|
|
message: '删除成功'
|
|
|
})
|
|
|
})
|
|
|
+ },
|
|
|
+ handleUpdate({ $index, row }) {
|
|
|
+ console.log(row.id)
|
|
|
+ this.$confirm('您确定要发布吗', '警告', {
|
|
|
+ confirmButtonText: '是的',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(async() => {
|
|
|
+ await commitArticle(row.id)
|
|
|
+ const rs = await fetchArticle(row.id)
|
|
|
+ this.list.splice($index, 1, rs.data.info)
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '发布成功'
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|