5 files modified
2 files added
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/article/article/page', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | return request({ |
| | | url: '/api/article/article/page', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/article/article/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | return request({ |
| | | url: '/api/article/article/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/article/article/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | return request({ |
| | | url: '/api/article/article/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/article/article/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | return request({ |
| | | url: '/api/article/article/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const getNotice = (id) => { |
| | | return request({ |
| | | url: '/api/article/article/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | return request({ |
| | | url: '/api/article/article/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const upcomment = (ids, type) => { |
| | | return request({ |
| | | url: '/api/article/article/upcomment', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | type |
| | | } |
| | | }) |
| | | } |
| New file |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/comment/comment/articlepage', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/comment/comment/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/comment/comment/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/comment/comment/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const getNotice = (id) => { |
| | | return request({ |
| | | url: '/api/comment/comment/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | this.$router.push({ path: path }); |
| | | } else { |
| | | } else if (item.label == "首页"){ |
| | | this.tagList.splice(index, 1); |
| | | this.$store.commit("set_hideHome", true); |
| | | var d = this.$router.options.routes, |
| | |
| | | import ( /* webpackChunkName: "views" */ '@/views/animalHeat/animalHeat') |
| | | }] |
| | | }, { |
| | | path: '/comment', |
| | | component: Layout, |
| | | peixun: true, |
| | | redirect: '/comment/index', |
| | | children: [{ |
| | | path: 'index', |
| | | name: '评论审核', |
| | | meta: { |
| | | i18n: 'comment' |
| | | }, |
| | | component: () => |
| | | import ( /* webpackChunkName: "views" */ '@/views/comment/comment') |
| | | }] |
| | | }, { |
| | | path: '/article', |
| | | component: Layout, |
| | | peixun: true, |
| | |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-s-order" |
| | | plain |
| | | @click="kqcomment" |
| | | >开启评论 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-s-release" |
| | | plain |
| | | @click="gbcomment" |
| | | >关闭评论 |
| | | </el-button> |
| | | |
| | | |
| | | </template> |
| | | |
| | | <template slot-scope="{type,size,row }" slot="menu"> |
| | |
| | | </el-tag> |
| | | </template> |
| | | |
| | | <template slot-scope="{ row }" slot="iscomment"> |
| | | <el-tag |
| | | >{{ |
| | | row.iscomment == "1" ? "开启" : row.iscomment == "0" ? "关闭" : "关闭" |
| | | }} |
| | | </el-tag> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getList, remove, update, add, getNotice} from "@/api/article/article"; |
| | | import {getList, remove, update, add, getNotice, upcomment} from "@/api/article/article"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | |
| | | ], |
| | | }, |
| | | { |
| | | label: "评论区", |
| | | prop: "iscomment", |
| | | width: 80, |
| | | slot: true, |
| | | type: "select", |
| | | dicData: [ |
| | | { |
| | | label: "关闭", |
| | | value: "0", |
| | | }, |
| | | { |
| | | label: "开启", |
| | | value: "1", |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "视频", |
| | | prop: "videoUrl", |
| | | type: "upload", |
| | |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | if ( row.videoUrl.length == 0){ |
| | | if (row.videoUrl.length == 0) { |
| | | row.videoUrl = ""; |
| | | } |
| | | add(row).then( |
| | |
| | | endTime: dateTime[1], |
| | | ...this.query, |
| | | }; |
| | | values.datetime = null; |
| | | values.dateTime = null; |
| | | } |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, values).then((res) => { |
| | |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | kqcomment() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据开启评论?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }).then(() => { |
| | | return upcomment(this.ids, "1"); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | gbcomment() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据开启评论?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }).then(() => { |
| | | return upcomment(this.ids, "0"); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | } |
| | | }, |
| | | }; |
| New file |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | ref="crud" |
| | | @row-del="rowDel" |
| | | v-model="form" |
| | | :permission="permissionList" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | :before-open="beforeOpen" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad"> |
| | | <template slot="menuLeft"> |
| | | <el-button type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | v-if="permission.comment_delete" |
| | | @click="handleDelete">删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{type,size,row }" slot="menu"> |
| | | <el-button v-if="row.topping == 0" icon="el-icon-check" :size="size" :type="type" @click.stop="topping(row)">置顶</el-button> |
| | | <el-button v-if="row.topping == 1" icon="el-icon-close" :size="size" :type="type" @click.stop="topping(row)">撤销</el-button> |
| | | </template> |
| | | |
| | | <template slot-scope="{ row }" slot="topping"> |
| | | <el-tag |
| | | >{{ |
| | | row.topping == 1 ? "是" : row.topping == 0 ? "否" : "否" |
| | | }} |
| | | </el-tag> |
| | | </template> |
| | | |
| | | <template slot-scope="{ row }" slot="isexamine"> |
| | | <el-tag |
| | | >{{ |
| | | row.isexamine == 1 ? "审核通过" : row.isexamine == 0 ? "未通过" : "未通过" |
| | | }} |
| | | </el-tag> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getList, remove, update, add, getNotice} from "@/api/comment/comment"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 54, |
| | | dialogWidth: 950, |
| | | menuWidth:320, |
| | | editBtnText:'审核', |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 3, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | excelBtn: false, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "评论内容", |
| | | prop: "content", |
| | | editDisplay:false |
| | | }, |
| | | { |
| | | label: "评论人", |
| | | prop: "name", |
| | | search: true, |
| | | searchSpan: 3, |
| | | editDisplay:false |
| | | }, |
| | | { |
| | | label: "文章标题", |
| | | prop: "title", |
| | | search: true, |
| | | searchSpan: 3, |
| | | editDisplay:false |
| | | }, |
| | | { |
| | | label: "文章来源", |
| | | prop: "sourceName", |
| | | search: true, |
| | | searchSpan: 3, |
| | | editDisplay:false |
| | | }, |
| | | { |
| | | label: "评论时间", |
| | | prop: "dateTime", |
| | | type: "datetime", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | searchSpan: 5, |
| | | searchRange: true, |
| | | hide: true, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | viewDisplay: false, |
| | | search: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择评论时间", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "评论时间", |
| | | prop: "time", |
| | | editDisplay:false |
| | | }, |
| | | { |
| | | label: "审核状态", |
| | | prop: "isexamine", |
| | | searchSpan: 3, |
| | | slot: true, |
| | | width:100, |
| | | search: true, |
| | | type: "select", |
| | | dicData: [ |
| | | { |
| | | label: "未通过", |
| | | value: "0", |
| | | }, |
| | | { |
| | | label: "审核通过", |
| | | value: "1", |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "是否置顶", |
| | | prop: "topping", |
| | | type: "select", |
| | | searchSpan: 3, |
| | | slot: true, |
| | | search: true, |
| | | width:70, |
| | | editDisplay:false, |
| | | dicData: [ |
| | | { |
| | | label: "否", |
| | | value: "0", |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: "1", |
| | | } |
| | | ], |
| | | } |
| | | ] |
| | | }, |
| | | data: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(false, false), |
| | | viewBtn: this.vaildData(this.permission.comment_view, false), |
| | | delBtn: this.vaildData(this.permission.comment_delete, false), |
| | | editBtn: this.vaildData(this.permission.comment_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | methods: { |
| | | topping(row){ |
| | | //置顶或取消置顶 |
| | | if (row.topping == 0) { |
| | | row.topping = 1; |
| | | } else { |
| | | row.topping = 0; |
| | | } |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ); |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | add(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getNotice(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | const {dateTime} = this.query; |
| | | let values = { |
| | | ...params, |
| | | }; |
| | | if (dateTime) { |
| | | values = { |
| | | ...params, |
| | | startTime: dateTime[0], |
| | | endTime: dateTime[1], |
| | | ...this.query, |
| | | }; |
| | | values.dateTime = null; |
| | | } |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, values).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | |
| | | size: "mini", |
| | | border: false, |
| | | //stripe:true, |
| | | menuWidth: 240, |
| | | menuWidth: 260, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | | searchShow: true, |