前端配置菜单完成

This commit is contained in:
熊丽君
2021-07-27 17:44:13 +08:00
parent 4c43d09327
commit c29b023448
3 changed files with 49 additions and 31 deletions

View File

@ -0,0 +1,23 @@
import request from '@/utils/request';
// 获取资讯列表
export function getInformation(params) {
return request({
url: '/information/getInformation',
params
});
}
// 添加/更新/删除资讯
export function handleInformation(data) {
return request({
url: '/information/handleInformation',
method: 'post',
data
});
}
// 获取资讯数据回显
export function getInfo(params) {
return request({
url: '/information/getInfo',
params
});
}

View File

@ -26,7 +26,7 @@
</template>
<script>
import Editor from '@/components/Editor';
import { read, getPolicyReadInfo } from '@/api/front/unscramble';
import { handleInformation, getInfo } from '@/api/front/expressNews';
export default {
components: {
Editor
@ -48,18 +48,22 @@ export default {
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
if (this.editPage) {
// 修改
read(this.ruleForm).then(({ message }) => {
this.msgSuccess(message);
});
} else {
// 添加
read(this.ruleForm).then(({ message }) => {
this.msgSuccess(message);
});
}
this.$router.go(-1);
// if (this.editPage) {
// // 修改
// handleInformation(this.ruleForm).then(({ message }) => {
// this.msgSuccess(message);
// });
// } else {
// // 添加
// handleInformation(this.ruleForm).then(({ message }) => {
// this.msgSuccess(message);
// });
// }
handleInformation(this.ruleForm).then(({ message }) => {
this.msgSuccess(message);
this.$router.go(-1);
});
// this.$router.go(-1);
} else {
console.log('error submit!!');
return false;
@ -74,7 +78,7 @@ export default {
let { id } = this.$route.query;
if (id) {
this.editPage = true;
getPolicyReadInfo({ readId: id }).then(({ data }) => {
getInfo({ id }).then(({ data }) => {
this.ruleForm = data;
});
}

View File

@ -13,10 +13,10 @@
align="center"
type="index"
></el-table-column>
<el-table-column label="资讯标题" prop="name" align="center">
<el-table-column label="资讯标题" prop="title" align="center">
<template slot-scope="scope">
<el-link type="primary" :underline="false">{{
scope.row.name
scope.row.title
}}</el-link>
</template>
</el-table-column>
@ -25,10 +25,7 @@
<el-button @click="handlePage(scope.row.id)" type="text" size="small"
>编辑</el-button
>
<el-button
@click="handleDelete(scope.row.id)"
type="text"
size="small"
<el-button @click="handleDelete(scope.row)" type="text" size="small"
>删除</el-button
>
</template>
@ -37,14 +34,7 @@
</div>
</template>
<script>
import {
getCategory,
addCategory,
addLabel,
getLabel,
update,
del
} from '@/api/policy/tag';
import { getInformation, handleInformation } from '@/api/front/expressNews';
export default {
data() {
return {
@ -61,7 +51,7 @@ export default {
this.getList();
},
getList() {
getCategory(this.queryParams).then(({ data }) => {
getInformation(this.queryParams).then(({ data }) => {
this.categoryList = data.list;
// this.total = data.total
});
@ -71,14 +61,15 @@ export default {
this.$router.push({ path: '/front/addExpressNews', query: { id } });
},
/** 删除按钮操作 */
handleDelete(id) {
handleDelete(row) {
this.$confirm('确认删除该分类?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return del({ id });
row.status = -1;
return handleInformation(row);
})
.then(() => {
this.getList();