前端配置菜单完成
This commit is contained in:
23
src/api/front/expressNews.js
Normal file
23
src/api/front/expressNews.js
Normal 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
|
||||||
|
});
|
||||||
|
}
|
@ -26,7 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
import { read, getPolicyReadInfo } from '@/api/front/unscramble';
|
import { handleInformation, getInfo } from '@/api/front/expressNews';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Editor
|
Editor
|
||||||
@ -48,18 +48,22 @@ export default {
|
|||||||
submitForm(formName) {
|
submitForm(formName) {
|
||||||
this.$refs[formName].validate(valid => {
|
this.$refs[formName].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.editPage) {
|
// if (this.editPage) {
|
||||||
// 修改
|
// // 修改
|
||||||
read(this.ruleForm).then(({ message }) => {
|
// handleInformation(this.ruleForm).then(({ message }) => {
|
||||||
this.msgSuccess(message);
|
// this.msgSuccess(message);
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
// 添加
|
// // 添加
|
||||||
read(this.ruleForm).then(({ message }) => {
|
// handleInformation(this.ruleForm).then(({ message }) => {
|
||||||
this.msgSuccess(message);
|
// this.msgSuccess(message);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
this.$router.go(-1);
|
handleInformation(this.ruleForm).then(({ message }) => {
|
||||||
|
this.msgSuccess(message);
|
||||||
|
this.$router.go(-1);
|
||||||
|
});
|
||||||
|
// this.$router.go(-1);
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!!');
|
console.log('error submit!!');
|
||||||
return false;
|
return false;
|
||||||
@ -74,7 +78,7 @@ export default {
|
|||||||
let { id } = this.$route.query;
|
let { id } = this.$route.query;
|
||||||
if (id) {
|
if (id) {
|
||||||
this.editPage = true;
|
this.editPage = true;
|
||||||
getPolicyReadInfo({ readId: id }).then(({ data }) => {
|
getInfo({ id }).then(({ data }) => {
|
||||||
this.ruleForm = data;
|
this.ruleForm = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
align="center"
|
align="center"
|
||||||
type="index"
|
type="index"
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column label="资讯标题" prop="name" align="center">
|
<el-table-column label="资讯标题" prop="title" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link type="primary" :underline="false">{{
|
<el-link type="primary" :underline="false">{{
|
||||||
scope.row.name
|
scope.row.title
|
||||||
}}</el-link>
|
}}</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -25,10 +25,7 @@
|
|||||||
<el-button @click="handlePage(scope.row.id)" type="text" size="small"
|
<el-button @click="handlePage(scope.row.id)" type="text" size="small"
|
||||||
>编辑</el-button
|
>编辑</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button @click="handleDelete(scope.row)" type="text" size="small"
|
||||||
@click="handleDelete(scope.row.id)"
|
|
||||||
type="text"
|
|
||||||
size="small"
|
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
@ -37,14 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { getInformation, handleInformation } from '@/api/front/expressNews';
|
||||||
getCategory,
|
|
||||||
addCategory,
|
|
||||||
addLabel,
|
|
||||||
getLabel,
|
|
||||||
update,
|
|
||||||
del
|
|
||||||
} from '@/api/policy/tag';
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -61,7 +51,7 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
getCategory(this.queryParams).then(({ data }) => {
|
getInformation(this.queryParams).then(({ data }) => {
|
||||||
this.categoryList = data.list;
|
this.categoryList = data.list;
|
||||||
// this.total = data.total
|
// this.total = data.total
|
||||||
});
|
});
|
||||||
@ -71,14 +61,15 @@ export default {
|
|||||||
this.$router.push({ path: '/front/addExpressNews', query: { id } });
|
this.$router.push({ path: '/front/addExpressNews', query: { id } });
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(id) {
|
handleDelete(row) {
|
||||||
this.$confirm('确认删除该分类?', '提示', {
|
this.$confirm('确认删除该分类?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return del({ id });
|
row.status = -1;
|
||||||
|
return handleInformation(row);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
|
Reference in New Issue
Block a user