Commit 2dcb2781 authored by rencs's avatar rencs

1.7 bug

parent 8094adc6
...@@ -55,31 +55,46 @@ ...@@ -55,31 +55,46 @@
</div> </div>
</div> </div>
<div class="addCate"> <div class="addCate">
<div class="add" @click.stop="addCate"> <div class="add" @click.stop="addCate">添加类别</div>
添加类别
</div>
</div> </div>
</div> </div>
<!-- 添加类别弹框 --> <!-- 添加类别弹框 -->
<el-dialog :title="typeManagerTitle" :visible.sync="typeManagerVisible" append-to-body> <el-dialog
:title="typeManagerTitle"
:visible.sync="typeManagerVisible"
append-to-body
>
<div id="addCateManager"> <div id="addCateManager">
<el-form ref="form" :rules="rules" :model="form" label-width="80px"> <el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="应用类别" prop="type"> <el-form-item label="应用类别" prop="type">
<el-col :span="12"> <el-col :span="12">
<el-input v-model="form.type" placeholder="请输入资讯标题"></el-input> <el-input
v-model="form.type"
placeholder="请输入资讯标题"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="封面图" prop="coverImg"> <el-form-item label="封面图" prop="coverImg">
<singleImageX :value="form.coverImg" @input="onPreview"></singleImageX> <singleImageX
:value="form.coverImg"
@input="onPreview"
></singleImageX>
</el-form-item> </el-form-item>
<el-form-item label="简介" prop="introduce"> <el-form-item label="简介" prop="introduce">
<el-col :span="12"> <el-col :span="12">
<el-input v-model="form.introduce" placeholder="请输入资讯简介"></el-input> <el-input
v-model="form.introduce"
placeholder="请输入资讯简介"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-col :span="12"> <el-col :span="12">
<el-input type="number" v-model="form.sort" placeholder="请输入序号"></el-input> <el-input
type="number"
v-model="form.sort"
placeholder="请输入序号"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="分类设置" prop="level"> <el-form-item label="分类设置" prop="level">
...@@ -108,7 +123,13 @@ ...@@ -108,7 +123,13 @@
</el-dialog> </el-dialog>
<!-- 表格 --> <!-- 表格 -->
<div class="table"> <div class="table">
<el-table :data="tableData" border fit highlight-current-row style="width: 100%"> <el-table
:data="tableData"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column label="序号" width="100" align="center"> <el-table-column label="序号" width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.index }}</span> <span>{{ scope.row.index }}</span>
...@@ -137,12 +158,16 @@ ...@@ -137,12 +158,16 @@
</el-table-column> </el-table-column>
<el-table-column label="类目级别" align="center"> <el-table-column label="类目级别" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="typelevel">{{ scope.row.pid != 0 ? "二级" : "一级"}}</span> <span class="typelevel">{{
scope.row.pid != 0 ? "二级" : "一级"
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="父级" align="center"> <el-table-column label="父级" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="typelevel">{{ getFatherTypeName(scope.row.pid) }}</span> <span class="typelevel">{{
getFatherTypeName(scope.row.pid)
}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center"> <el-table-column label="排序" align="center">
...@@ -152,7 +177,7 @@ ...@@ -152,7 +177,7 @@
</el-table-column> </el-table-column>
<el-table-column label="状态" width="100" align="center"> <el-table-column label="状态" width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.status==1?"上架":"下架" }}</span> <span>{{ scope.row.status == 1 ? "上架" : "下架" }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150" align="center"> <el-table-column label="操作" width="150" align="center">
...@@ -161,8 +186,20 @@ ...@@ -161,8 +186,20 @@
<span> <span>
<div class="operators"> <div class="operators">
<div class="edit" @click.stop="changeCate(scope.row)">编辑</div> <div class="edit" @click.stop="changeCate(scope.row)">编辑</div>
<div class="offshelf" v-if="scope.row.status==1" @click.stop="changeTypeStatus(scope.row)">下架</div> <div
<div class="upshelf" v-else @click.stop="changeTypeStatus(scope.row)">上架</div> class="offshelf"
v-if="scope.row.status == 1"
@click.stop="changeTypeStatus(scope.row)"
>
下架
</div>
<div
class="upshelf"
v-else
@click.stop="changeTypeStatus(scope.row)"
>
上架
</div>
<div class="delete" @click.stop="delType(scope.row)">删除</div> <div class="delete" @click.stop="delType(scope.row)">删除</div>
</div> </div>
</span> </span>
...@@ -175,10 +212,11 @@ ...@@ -175,10 +212,11 @@
@size-change="changeHandleSize" @size-change="changeHandleSize"
@current-change="changeHandleCurrent" @current-change="changeHandleCurrent"
:current-page.sync="typePagination.currentPage" :current-page.sync="typePagination.currentPage"
:page-sizes="[10,20,30,40]" :page-sizes="[10, 20, 30, 40]"
:page-size="typePagination.pageSize" :page-size="typePagination.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="typePagination.total"> :total="typePagination.total"
>
</el-pagination> </el-pagination>
</div> </div>
<!-- 使用图片查看器预览当前缩略图 --> <!-- 使用图片查看器预览当前缩略图 -->
...@@ -193,7 +231,7 @@ ...@@ -193,7 +231,7 @@
<script> <script>
// 导入组件 // 导入组件
import ElImageViewer from "element-ui/packages/image/src/image-viewer"; import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import singleImageX from '@/components/Upload/singleImageX'; import singleImageX from "@/components/Upload/singleImageX";
// 导入请求 // 导入请求
import { import {
getAllApplicationType, getAllApplicationType,
...@@ -204,7 +242,7 @@ export default { ...@@ -204,7 +242,7 @@ export default {
name: "ApplicationList", name: "ApplicationList",
components: { components: {
ElImageViewer, ElImageViewer,
singleImageX singleImageX,
}, },
data() { data() {
return { return {
...@@ -255,7 +293,7 @@ export default { ...@@ -255,7 +293,7 @@ export default {
label: "升序", label: "升序",
}, },
], ],
currentSort: '', currentSort: "",
// 表格数据 // 表格数据
tableDataCache: [], tableDataCache: [],
tableData: [ tableData: [
...@@ -272,127 +310,131 @@ export default { ...@@ -272,127 +310,131 @@ export default {
// }, // },
], ],
typePagination: { typePagination: {
currentPage: 1,// 当前页码 currentPage: 1, // 当前页码
pageSize: 10,// 每页查询数量 pageSize: 10, // 每页查询数量
total: 0,// 总记录数量 total: 0, // 总记录数量
}, },
typeManagerTitle: "添加类别", typeManagerTitle: "添加类别",
typeManagerVisible: false, typeManagerVisible: false,
rules: { rules: {
type: [{ required: true, message: '文案有误', trigger: 'blur' }], type: [{ required: true, message: "文案有误", trigger: "blur" }],
introduce: [{ required: true, message: '请输入简介', trigger: 'blur' }], introduce: [{ required: true, message: "请输入简介", trigger: "blur" }],
coverImg: [{ required: true, message: '请上传封面图', trigger: 'blur' }], coverImg: [
sort: [{ required: true, message: '请输入排序号', trigger: 'blur' }], { required: true, message: "请上传封面图", trigger: "blur" },
level: [{ required: true, message: '请选择级别', trigger: 'blur' }], ],
father: [{ required: true, message: '请选择父级类别', trigger: 'blur' }], sort: [{ required: true, message: "请输入排序号", trigger: "blur" }],
}, level: [{ required: true, message: "请选择级别", trigger: "blur" }],
form:{ father: [
type: '', { required: true, message: "请选择父级类别", trigger: "blur" },
coverImg: '', ],
introduce: '', },
sort: '', form: {
level: '一级类目', type: "",
showFather: false coverImg: "",
}, introduce: "",
editType: '', sort: "",
level: "一级类目",
showFather: false,
},
editType: "",
}; };
}, },
watch:{ watch: {
"form.level":{ "form.level": {
deep: true, deep: true,
handler(newVal){ handler(newVal) {
console.log(newVal) console.log(newVal);
if(newVal=="二级类目"){ if (newVal == "二级类目") {
this.pullAllApplicationType() this.pullAllApplicationType();
this.form.showFather = true this.form.showFather = true;
}else{ } else {
this.form.showFather = false this.form.showFather = false;
}
}
} }
}, },
},
},
mounted() { mounted() {
// 获取所有类型用于下拉框 // 获取所有类型用于下拉框
this.pullAllApplicationType() this.pullAllApplicationType();
// 分页获取类型用于表格 // 分页获取类型用于表格
this.pullListApplicationType() this.pullListApplicationType();
}, },
methods: { methods: {
closeTypeManager(){ closeTypeManager() {
this.typeManagerVisible = false this.typeManagerVisible = false;
this.$bus.$emit('upload-clearFiles') this.$bus.$emit("upload-clearFiles");
}, },
getFatherTypeName(pid){ getFatherTypeName(pid) {
console.log("typesState",this.typesState) console.log("typesState", this.typesState);
let father = this.typesState.find(ele => ele.id == pid) let father = this.typesState.find((ele) => ele.id == pid);
return father ? father.title : "" return father ? father.title : "";
}, },
clickOperator(index){ clickOperator(index) {
console.log("index=>",index) console.log("index=>", index);
if(index==1){ if (index == 1) {
this.currentStatus = '' this.currentStatus = "";
this.currentTypeName = '' this.currentTypeName = "";
this.currentSort = '' this.currentSort = "";
} }
this.pullListApplicationType() this.pullListApplicationType();
}, },
// 添加类别 // 添加类别
addCate(){ addCate() {
this.typeManagerVisible = true this.typeManagerVisible = true;
this.typeManagerTitle = "添加类别" this.typeManagerTitle = "添加类别";
this.form.type = '' this.form.type = "";
this.form.coverImg = '' this.form.coverImg = "";
this.form.introduce = '' this.form.introduce = "";
this.form.sort = '' this.form.sort = "";
}, },
// 修改类别 // 修改类别
changeCate(type){ changeCate(type) {
this.typeManagerVisible = true this.typeManagerVisible = true;
this.typeManagerTitle = "修改类别" this.typeManagerTitle = "修改类别";
this.editType = type this.editType = type;
this.form.type = type.type this.form.type = type.type;
this.form.coverImg = type.icon.url this.form.coverImg = type.icon.url;
this.form.introduce = type.introduce this.form.introduce = type.introduce;
this.form.sort = type.sort this.form.sort = type.sort;
}, },
// 获取所有应用类型 // 获取所有应用类型
pullAllApplicationType(){ pullAllApplicationType() {
this.typesState = [] this.typesState = [];
this.types = [] this.types = [];
getAllApplicationType().then(res => { getAllApplicationType().then((res) => {
if(res.status == 200){ if (res.status == 200) {
// console.log("获取所有的应用类型=>",res) // console.log("获取所有的应用类型=>",res)
res.data.forEach(element => { res.data.forEach((element) => {
this.typesState.push(element) this.typesState.push(element);
if(element.isDel==0&&element.pid==0){ if (element.isDel == 0 && element.pid == 0) {
this.types.push({ this.types.push({
value: element.id, value: element.id,
label: element.title label: element.title,
}); });
} }
}); });
if(this.types.length>0){ if (this.types.length > 0) {
this.currentType = this.types[0].value this.currentType = this.types[0].value;
} }
} }
}) });
}, },
// 分页获取应用类型 // 分页获取应用类型
pullListApplicationType(){ pullListApplicationType() {
getListApplicationType({ getListApplicationType({
page: this.typePagination.currentPage, page: this.typePagination.currentPage,
limit: this.typePagination.pageSize, limit: this.typePagination.pageSize,
}).then(res => { }).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.tableDataCache = [] this.tableDataCache = [];
this.tableData = [] this.tableData = [];
// console.log("分页数据=>",res) // console.log("分页数据=>",res)
this.typePagination.total = res.data.totalCount this.typePagination.total = res.data.totalCount;
res.data.data.forEach(element => { res.data.data.forEach((element) => {
this.tableDataCache.push(element) this.tableDataCache.push(element);
}) });
console.log("获取到的分页类别信息=>",this.tableDataCache) console.log("获取到的分页类别信息=>", this.tableDataCache);
this.screenTableData() this.screenTableData();
// this.tableDataCache.forEach(element => { // this.tableDataCache.forEach(element => {
// this.tableData.push({ // this.tableData.push({
// id: element.id, // id: element.id,
...@@ -413,17 +455,20 @@ export default { ...@@ -413,17 +455,20 @@ export default {
// }) // })
// }) // })
} }
}) });
}, },
// 为表格数据添加过滤条件 // 为表格数据添加过滤条件
screenTableData(){ screenTableData() {
console.log("分页数据的缓存=>",this.tableDataCache) console.log("分页数据的缓存=>", this.tableDataCache);
this.tableData = [] this.tableData = [];
let index = 0 let index = 0;
this.tableDataCache.forEach(element => { this.tableDataCache.forEach((element) => {
if(element.isDel==0){ if (element.isDel == 0) {
this.tableData.push({ this.tableData.push({
index: ((this.typePagination.currentPage-1)*this.typePagination.pageSize)+(++index), index:
(this.typePagination.currentPage - 1) *
this.typePagination.pageSize +
++index,
id: element.id, id: element.id,
type: element.title, type: element.title,
icon: { icon: {
...@@ -438,61 +483,64 @@ export default { ...@@ -438,61 +483,64 @@ export default {
isDel: element.isDel, isDel: element.isDel,
pid: element.pid, pid: element.pid,
updTime: element.updTime, updTime: element.updTime,
indexShow: element.indexShow indexShow: element.indexShow,
}) });
} }
}) });
if(this.currentStatus!=''){ if (this.currentStatus != "") {
this.tableData = this.tableData.filter(element => element.status == this.currentStatus) this.tableData = this.tableData.filter(
(element) => element.status == this.currentStatus
);
} }
if(this.currentTypeName!=''){ if (this.currentTypeName != "") {
// this.tableData = this.tableData.filter(element => element.type == this.currentTypeName) // this.tableData = this.tableData.filter(element => element.type == this.currentTypeName)
this.tableData = this.tableData.filter(element => { this.tableData = this.tableData.filter((element) => {
//正则表达式 //正则表达式
let reg = new RegExp(this.currentTypeName); let reg = new RegExp(this.currentTypeName);
return element.type.match(reg) return element.type.match(reg);
}) });
} }
if(this.currentSort!=''){ if (this.currentSort != "") {
// 1是降序,2是升序 // 1是降序,2是升序
if(this.currentSort==1){ if (this.currentSort == 1) {
this.tableData.sort((obj1,obj2)=>{ this.tableData.sort((obj1, obj2) => {
let val1 = parseInt((obj1.id+"")) console.log(obj1, obj2);
let val2 = parseInt((obj2.id+"")) let val1 = parseInt(obj1.sort + "");
if(val1<val2){ let val2 = parseInt(obj2.sort + "");
return 1 if (val1 < val2) {
}else if(val1>val2){ return 1;
return -1 } else if (val1 > val2) {
}else{ return -1;
return 0 } else {
} return 0;
}) }
}else{ });
} else {
// 升序 // 升序
this.tableData.sort((obj1,obj2)=>{ this.tableData.sort((obj1, obj2) => {
let val1 = parseInt((obj1.id+"")) let val1 = parseInt(obj1.sort + "");
let val2 = parseInt((obj2.id+"")) let val2 = parseInt(obj2.sort + "");
if(val1<val2){ if (val1 < val2) {
return -1 return -1;
}else if(val1>val2){ } else if (val1 > val2) {
return 1 return 1;
}else{ } else {
return 0 return 0;
} }
}) });
} }
} }
}, },
// 删除类型 // 删除类型
delType(type){ delType(type) {
this.$confirm('确定继续执行该操作吗?', '提示', { this.$confirm("确定继续执行该操作吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
type.isDel = 1 type.isDel = 1;
addUpdateApplicationType({ addUpdateApplicationType({
id: type.id+'', id: type.id + "",
title: type.type, title: type.type,
detail: type.introduce, detail: type.introduce,
coverImg: type.coverImg, coverImg: type.coverImg,
...@@ -501,37 +549,38 @@ export default { ...@@ -501,37 +549,38 @@ export default {
rank: type.sort, rank: type.sort,
indexShow: type.indexShow, indexShow: type.indexShow,
pid: type.pid, pid: type.pid,
isDel: type.isDel+'' isDel: type.isDel + "",
}).then(res => { }).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.$message({ this.$message({
message: "删除成功!!!", message: "删除成功!!!",
type: 'success' type: "success",
}); });
this.pullListApplicationType() this.pullListApplicationType();
// let index = this.tableData.findIndex(ele => ele.id == type.id) // let index = this.tableData.findIndex(ele => ele.id == type.id)
// if(index!=-1){ // if(index!=-1){
// this.tableData.splice(index,1) // this.tableData.splice(index,1)
// } // }
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}) });
}) });
}, },
// 改变类型状态 // 改变类型状态
changeTypeStatus(type){ changeTypeStatus(type) {
console.log("status",type.status) console.log("status", type.status);
let message = "" let message = "";
if(type.status==1){//当前状态为上架 if (type.status == 1) {
type.status = 2 //当前状态为上架
message = "下架成功!!!" type.status = 2;
}else{ message = "下架成功!!!";
type.status = 1 } else {
message = "上架成功!!!" type.status = 1;
message = "上架成功!!!";
} }
addUpdateApplicationType({ addUpdateApplicationType({
id: type.id+'', id: type.id + "",
title: type.type, title: type.type,
detail: type.introduce, detail: type.introduce,
coverImg: type.coverImg, coverImg: type.coverImg,
...@@ -540,31 +589,31 @@ export default { ...@@ -540,31 +589,31 @@ export default {
rank: type.sort, rank: type.sort,
indexShow: type.indexShow, indexShow: type.indexShow,
pid: type.pid, pid: type.pid,
isDel: type.isDel+'' isDel: type.isDel + "",
}).then(res => { }).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.$message({ this.$message({
message: message, message: message,
type: 'success' type: "success",
}); });
this.pullListApplicationType() this.pullListApplicationType();
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}) });
}, },
changeHandleSize(val) { changeHandleSize(val) {
// console.log(`每页 ${val} 条`); // console.log(`每页 ${val} 条`);
this.typePagination.pageSize = val this.typePagination.pageSize = val;
this.pullListApplicationType() this.pullListApplicationType();
}, },
changeHandleCurrent(val) { changeHandleCurrent(val) {
// console.log(`当前页: ${val}`); // console.log(`当前页: ${val}`);
this.typePagination.currentPage = val this.typePagination.currentPage = val;
this.pullListApplicationType() this.pullListApplicationType();
}, },
onPreview(url){ onPreview(url) {
this.form.coverImg = url this.form.coverImg = url;
}, },
showPreview(icon) { showPreview(icon) {
this.currentIcon = icon; this.currentIcon = icon;
...@@ -574,18 +623,18 @@ export default { ...@@ -574,18 +623,18 @@ export default {
this.currentIcon.showPreview = false; this.currentIcon.showPreview = false;
}, },
onSubmit() { onSubmit() {
let message = this.typeManagerTitle == "添加类别" ? "添加" : "修改" let message = this.typeManagerTitle == "添加类别" ? "添加" : "修改";
if(this.form.type==''){ if (this.form.type == "") {
this.$message.error(message+'失败,名称为空!!!'); this.$message.error(message + "失败,名称为空!!!");
}else if(this.form.coverImg==''){ } else if (this.form.coverImg == "") {
this.$message.error(message+'失败,封面未上传!!!'); this.$message.error(message + "失败,封面未上传!!!");
}else if(this.form.introduce==''){ } else if (this.form.introduce == "") {
this.$message.error(message+'失败,简介为空!!!'); this.$message.error(message + "失败,简介为空!!!");
}else if(this.form.sort<0){ } else if (this.form.sort < 0) {
this.$message.error(message+'失败,排序值有误!!!'); this.$message.error(message + "失败,排序值有误!!!");
}else{ } else {
let data let data;
if(message=="添加"){ if (message == "添加") {
data = { data = {
title: this.form.type, title: this.form.type,
detail: this.form.introduce, detail: this.form.introduce,
...@@ -595,11 +644,12 @@ export default { ...@@ -595,11 +644,12 @@ export default {
rank: this.form.sort, rank: this.form.sort,
indexShow: 1, indexShow: 1,
pid: this.form.showFather ? this.currentType : 0, pid: this.form.showFather ? this.currentType : 0,
} };
}else{// 修改 } else {
// 修改
data = { data = {
id: this.editType.id+'', id: this.editType.id + "",
title: this.form.type , title: this.form.type,
detail: this.form.introduce, detail: this.form.introduce,
coverImg: this.form.coverImg, coverImg: this.form.coverImg,
detailImg: this.editType.icon.url, detailImg: this.editType.icon.url,
...@@ -607,25 +657,25 @@ export default { ...@@ -607,25 +657,25 @@ export default {
rank: this.form.sort, rank: this.form.sort,
indexShow: this.editType.indexShow, indexShow: this.editType.indexShow,
pid: this.editType.pid, pid: this.editType.pid,
isDel: this.editType.isDel+'' isDel: this.editType.isDel + "",
} };
} }
addUpdateApplicationType(data).then(res => { addUpdateApplicationType(data).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.$message({ this.$message({
message: message+"成功!!!", message: message + "成功!!!",
type: 'success' type: "success",
}); });
this.typeManagerVisible = false this.typeManagerVisible = false;
this.pullListApplicationType() this.pullListApplicationType();
this.$bus.$emit('upload-clearFiles') this.$bus.$emit("upload-clearFiles");
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
}
})
} }
});
} }
}, },
},
}; };
</script> </script>
...@@ -634,7 +684,7 @@ export default { ...@@ -634,7 +684,7 @@ export default {
margin: 0 1% 0 1%; margin: 0 1% 0 1%;
width: 98%; width: 98%;
height: auto; height: auto;
#addCateManager{ #addCateManager {
padding: 0 5%; padding: 0 5%;
width: 90%; width: 90%;
height: auto; height: auto;
...@@ -647,7 +697,9 @@ export default { ...@@ -647,7 +697,9 @@ export default {
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
.sorts,.status,.types { .sorts,
.status,
.types {
width: auto; width: auto;
height: 46px; height: 46px;
display: flex; display: flex;
...@@ -659,7 +711,7 @@ export default { ...@@ -659,7 +711,7 @@ export default {
margin: 0 10px 0 20px; margin: 0 10px 0 20px;
} }
} }
.addCate{ .addCate {
width: 240px; width: 240px;
height: 46px; height: 46px;
display: flex; display: flex;
...@@ -667,7 +719,7 @@ export default { ...@@ -667,7 +719,7 @@ export default {
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
.add{ .add {
width: 50%; width: 50%;
height: 36px; height: 36px;
display: flex; display: flex;
...@@ -675,8 +727,8 @@ export default { ...@@ -675,8 +727,8 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 5px; border-radius: 5px;
background-color: #5178F2; background-color: #5178f2;
color: #FFFFFF; color: #ffffff;
cursor: pointer; cursor: pointer;
} }
} }
...@@ -737,11 +789,12 @@ export default { ...@@ -737,11 +789,12 @@ export default {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.edit,.upshelf{ .edit,
.upshelf {
color: #1890ff; color: #1890ff;
} }
.offshelf { .offshelf {
color: #A6A9AD; color: #a6a9ad;
} }
.delete { .delete {
color: #fe4066; color: #fe4066;
...@@ -749,7 +802,7 @@ export default { ...@@ -749,7 +802,7 @@ export default {
} }
} }
} }
.typePagination{ .typePagination {
margin: 1% 1% 0 1%; margin: 1% 1% 0 1%;
width: 98%; width: 98%;
height: auto; height: auto;
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
</div> </div>
<!-- 类型管理弹框 --> <!-- 类型管理弹框 -->
<el-dialog title="类型管理" :visible.sync="typeManagerVisible" append-to-body> <el-dialog
title="类型管理"
:visible.sync="typeManagerVisible"
append-to-body
>
<div id="typeManager"> <div id="typeManager">
<div class="controls"> <div class="controls">
<div class="addUpdate" @click="typeCreatorVisible = true"> <div class="addUpdate" @click="typeCreatorVisible = true">
...@@ -33,7 +37,14 @@ ...@@ -33,7 +37,14 @@
</div> </div>
<div class="content"> <div class="content">
<el-table :data="tableType" border fit highlight-current-row style="width: 100%" max-height="400"> <el-table
:data="tableType"
border
fit
highlight-current-row
style="width: 100%"
max-height="400"
>
<el-table-column label="序号" align="center"> <el-table-column label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.id }}</span> <span>{{ scope.row.id }}</span>
...@@ -53,10 +64,26 @@ ...@@ -53,10 +64,26 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span> <span>
<div class="operators"> <div class="operators">
<div class="edit" @click.stop="clickTypeEditor(scope.row)">编辑</div> <div class="edit" @click.stop="clickTypeEditor(scope.row)">
<div class="offshelf" v-if="scope.row.status==1" @click.stop="changeTypeStatus(scope.row)">下架</div> 编辑
<div class="upshelf" v-else @click.stop="changeTypeStatus(scope.row)">上架</div> </div>
<div class="delete" @click.stop="delType(scope.row)">删除</div> <div
class="offshelf"
v-if="scope.row.status == 1"
@click.stop="changeTypeStatus(scope.row)"
>
下架
</div>
<div
class="upshelf"
v-else
@click.stop="changeTypeStatus(scope.row)"
>
上架
</div>
<div class="delete" @click.stop="delType(scope.row)">
删除
</div>
</div> </div>
</span> </span>
</template> </template>
...@@ -69,26 +96,43 @@ ...@@ -69,26 +96,43 @@
@size-change="changeHandleSize" @size-change="changeHandleSize"
@current-change="changeHandleCurrent" @current-change="changeHandleCurrent"
:current-page.sync="typePagination.currentPage" :current-page.sync="typePagination.currentPage"
:page-sizes="[2,4,6]" :page-sizes="[2, 4, 6]"
:page-size="typePagination.pageSize" :page-size="typePagination.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="typePagination.total"> :total="typePagination.total"
>
</el-pagination> </el-pagination>
</div> </div>
</div> </div>
<!-- 编辑类型弹框 --> <!-- 编辑类型弹框 -->
<el-dialog width="40%" title="编辑类型" :visible.sync="typeEditorVisible" append-to-body> <el-dialog
width="40%"
title="编辑类型"
:visible.sync="typeEditorVisible"
append-to-body
>
<div id="typeEditor"> <div id="typeEditor">
<div class="content"> <div class="content">
<el-form ref="form" :rules="createRules" :model="editorType" label-width="80px"> <el-form
ref="form"
:rules="createRules"
:model="editorType"
label-width="80px"
>
<el-form-item label="类型名称" prop="name"> <el-form-item label="类型名称" prop="name">
<el-col :span="24"> <el-col :span="24">
<el-input v-model="editorType.name" placeholder="请输入类型名称"></el-input> <el-input
v-model="editorType.name"
placeholder="请输入类型名称"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="类型排序" prop="sort"> <el-form-item label="类型排序" prop="sort">
<el-col :span="24"> <el-col :span="24">
<el-input v-model="editorType.sort" placeholder="请设置排序0-10000,数值越大排序越靠前"></el-input> <el-input
v-model="editorType.sort"
placeholder="请设置排序0-10000,数值越大排序越靠前"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -100,24 +144,43 @@ ...@@ -100,24 +144,43 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 添加类型弹框 --> <!-- 添加类型弹框 -->
<el-dialog width="40%" title="添加类型" :visible.sync="typeCreatorVisible" append-to-body> <el-dialog
width="40%"
title="添加类型"
:visible.sync="typeCreatorVisible"
append-to-body
>
<div id="typeCreator"> <div id="typeCreator">
<div class="content"> <div class="content">
<el-form ref="form" :rules="newRules" :model="newType" label-width="80px"> <el-form
ref="form"
:rules="newRules"
:model="newType"
label-width="80px"
>
<el-form-item label="类型名称" prop="newName"> <el-form-item label="类型名称" prop="newName">
<el-col :span="24"> <el-col :span="24">
<el-input v-model="newType.newName" placeholder="请输入类型名称" size="100px"></el-input> <el-input
v-model="newType.newName"
placeholder="请输入类型名称"
size="100px"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="类型排序" prop="newSort"> <el-form-item label="类型排序" prop="newSort">
<el-col :span="24"> <el-col :span="24">
<el-input v-model="newType.newSort" placeholder="请设置排序0-10000,数值越大排序越靠前"></el-input> <el-input
v-model="newType.newSort"
placeholder="请设置排序0-10000,数值越大排序越靠前"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="operators"> <div class="operators">
<div class="cancel" @click.stop="typeCreatorVisible = false">取消</div> <div class="cancel" @click.stop="typeCreatorVisible = false">
取消
</div>
<div class="confirm" @click.stop="createType">确定</div> <div class="confirm" @click.stop="createType">确定</div>
</div> </div>
</div> </div>
...@@ -194,7 +257,11 @@ ...@@ -194,7 +257,11 @@
<el-table-column label="缩略图" align="center"> <el-table-column label="缩略图" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span> <span>
<img class="icon" :src="scope.row.icon.url" @click="showPreview(scope.row.icon)"/> <img
class="icon"
:src="scope.row.icon.url"
@click="showPreview(scope.row.icon)"
/>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -224,8 +291,20 @@ ...@@ -224,8 +291,20 @@
<span> <span>
<div class="operators"> <div class="operators">
<div class="edit" @click.stop="editorInfo(scope.row)">编辑</div> <div class="edit" @click.stop="editorInfo(scope.row)">编辑</div>
<div class="offshelf" v-if="scope.row.status == 1" @click.stop="changeInfoStatus(scope.row)">下架</div> <div
<div class="upshelf" v-else @click.stop="changeInfoStatus(scope.row)">上架</div> class="offshelf"
v-if="scope.row.status == 1"
@click.stop="changeInfoStatus(scope.row)"
>
下架
</div>
<div
class="upshelf"
v-else
@click.stop="changeInfoStatus(scope.row)"
>
上架
</div>
<div class="delete" @click.stop="delInfo(scope.row)">删除</div> <div class="delete" @click.stop="delInfo(scope.row)">删除</div>
</div> </div>
</span> </span>
...@@ -241,7 +320,8 @@ ...@@ -241,7 +320,8 @@
:page-sizes="[10, 20, 30, 40]" :page-sizes="[10, 20, 30, 40]"
:page-size="infoPagination.pageSize" :page-size="infoPagination.pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="infoPagination.total"> :total="infoPagination.total"
>
</el-pagination> </el-pagination>
</div> </div>
<!-- <el-dialog title="资讯编辑" :visible.sync="infoEditorVisible" append-to-body> <!-- <el-dialog title="资讯编辑" :visible.sync="infoEditorVisible" append-to-body>
...@@ -250,7 +330,11 @@ ...@@ -250,7 +330,11 @@
</div> </div>
</el-dialog> --> </el-dialog> -->
<!-- 使用图片查看器预览当前缩略图 --> <!-- 使用图片查看器预览当前缩略图 -->
<el-image-viewer v-if="currentIcon.showPreview" :on-close="closePreview" :url-list="[currentIcon.url]"/> <el-image-viewer
v-if="currentIcon.showPreview"
:on-close="closePreview"
:url-list="[currentIcon.url]"
/>
</div> </div>
</template> </template>
...@@ -273,12 +357,14 @@ export default { ...@@ -273,12 +357,14 @@ export default {
data() { data() {
return { return {
createRules: { createRules: {
name: [{ required: true, message: '请输入类型名称', trigger: 'blur' }], name: [{ required: true, message: "请输入类型名称", trigger: "blur" }],
sort: [{ required: true, message: '请设置排序号', trigger: 'blur' }], sort: [{ required: true, message: "请设置排序号", trigger: "blur" }],
}, },
newRules: { newRules: {
newName: [{ required: true, message: '请输入类型名称', trigger: 'blur' }], newName: [
newSort: [{ required: true, message: '请设置排序号', trigger: 'blur' }], { required: true, message: "请输入类型名称", trigger: "blur" },
],
newSort: [{ required: true, message: "请设置排序号", trigger: "blur" }],
}, },
// 功能按钮 // 功能按钮
topControls: [ topControls: [
...@@ -367,11 +453,11 @@ export default { ...@@ -367,11 +453,11 @@ export default {
// operator: "操作", // operator: "操作",
// }, // },
], ],
tableDataState: [],// 缓存当前的表格数据 tableDataState: [], // 缓存当前的表格数据
infoPagination: { infoPagination: {
currentPage: this.$parent.currentEditPage,// 当前页码 currentPage: this.$parent.currentEditPage, // 当前页码
pageSize: 10,// 每页查询数量 pageSize: 10, // 每页查询数量
total: 0,// 总记录数量 total: 0, // 总记录数量
}, },
// 当前查看器显示的图片 // 当前查看器显示的图片
currentIcon: "", currentIcon: "",
...@@ -384,15 +470,15 @@ export default { ...@@ -384,15 +470,15 @@ export default {
// }, // },
], ],
typePagination: { typePagination: {
currentPage: 1,// 当前页码 currentPage: 1, // 当前页码
pageSize: 2,// 每页查询数量 pageSize: 2, // 每页查询数量
total: 0,// 总记录数量 total: 0, // 总记录数量
}, },
typeEditorVisible: false, typeEditorVisible: false,
editorType: {},// 编辑中的类型 editorType: {}, // 编辑中的类型
}; };
}, },
watch:{ watch: {
// // 筛选状态发生改变 // // 筛选状态发生改变
// currentStatus(newVal) { // currentStatus(newVal) {
// console.log("状态=>",newVal) // console.log("状态=>",newVal)
...@@ -408,58 +494,58 @@ export default { ...@@ -408,58 +494,58 @@ export default {
// console.log("排序=>",newVal) // console.log("排序=>",newVal)
// this.screenTableData() // this.screenTableData()
// }, // },
canPull(newVal){ canPull(newVal) {
// 分页获取新闻信息 // 分页获取新闻信息
newVal&&(this.pullListNewsInfo()) newVal && this.pullListNewsInfo();
}, },
// 当前页码有改变时重新拉取分页数据 // 当前页码有改变时重新拉取分页数据
"infoPagination.currentPage": { "infoPagination.currentPage": {
deep: true, deep: true,
handler: function(newVal){ handler: function (newVal) {
this.pullListNewsInfo() this.pullListNewsInfo();
} },
}, },
// 当查询数量有改变时重新拉取分页数据 // 当查询数量有改变时重新拉取分页数据
"infoPagination.pageSize": { "infoPagination.pageSize": {
deep: true, deep: true,
handler: function(newVal){ handler: function (newVal) {
this.pullListNewsInfo() this.pullListNewsInfo();
} },
}, },
// 关闭当前类型弹框时重新加载资讯 // 关闭当前类型弹框时重新加载资讯
typeManagerVisible(newVal){ typeManagerVisible(newVal) {
!newVal && (this.pullListNewsInfo()) !newVal && this.pullListNewsInfo();
}, },
// 类型表格筛选页码改变 // 类型表格筛选页码改变
"typePagination.currentPage": { "typePagination.currentPage": {
deep: true, deep: true,
handler(){ handler() {
// this.changeTableType() // this.changeTableType()
this.pullListNewsType() this.pullListNewsType();
} },
}, },
// 类型表格筛选数量改变 // 类型表格筛选数量改变
"typePagination.pageSize": { "typePagination.pageSize": {
deep: true, deep: true,
handler(){ handler() {
// this.changeTableType() // this.changeTableType()
this.pullListNewsType() this.pullListNewsType();
} },
} },
}, },
mounted() { mounted() {
// 获取所有新闻类型 // 获取所有新闻类型
this.pullAllNewsType() this.pullAllNewsType();
}, },
methods: { methods: {
// 删除新闻信息 // 删除新闻信息
delInfo(info){ delInfo(info) {
this.$confirm('确定继续执行该操作吗?', '提示', { this.$confirm("确定继续执行该操作吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
info.isDel = 1 info.isDel = 1;
// 删除资讯 // 删除资讯
addUpdateNewsInfo({ addUpdateNewsInfo({
id: info.id, id: info.id,
...@@ -473,28 +559,29 @@ export default { ...@@ -473,28 +559,29 @@ export default {
indexShow: info.indexShow, indexShow: info.indexShow,
typeName: info.type, typeName: info.type,
isDel: info.isDel, isDel: info.isDel,
}).then(res => { }).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.$message({ this.$message({
message: "删除成功!!!", message: "删除成功!!!",
type: 'success' type: "success",
}) });
this.pullListNewsInfo() this.pullListNewsInfo();
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}) });
}) });
}, },
// 更改资讯状态 // 更改资讯状态
changeInfoStatus(info){ changeInfoStatus(info) {
let message = "" let message = "";
if(info.status==1){// 当前为启用 if (info.status == 1) {
info.status = 2 // 当前为启用
message = "下架成功!!!" info.status = 2;
}else{ message = "下架成功!!!";
info.status = 1 } else {
message = "上架成功" info.status = 1;
message = "上架成功";
} }
// 更新资讯 // 更新资讯
addUpdateNewsInfo({ addUpdateNewsInfo({
...@@ -509,114 +596,119 @@ export default { ...@@ -509,114 +596,119 @@ export default {
indexShow: info.indexShow, indexShow: info.indexShow,
typeName: info.type, typeName: info.type,
isDel: info.isDel, isDel: info.isDel,
}).then(res => { }).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.$message({ this.$message({
message: message, message: message,
type: 'success' type: "success",
}) });
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}) });
}, },
// 编辑资讯 // 编辑资讯
editorInfo(info){ editorInfo(info) {
console.log("Info=>",info) console.log("Info=>", info);
this.$parent.currentEditStatus = this.currentStatus this.$parent.currentEditStatus = this.currentStatus;
this.$parent.currentEditType = this.currentType this.$parent.currentEditType = this.currentType;
this.$parent.currentEditSort = this.currentSort this.$parent.currentEditSort = this.currentSort;
this.$parent.currentEditPage = this.infoPagination.currentPage this.$parent.currentEditPage = this.infoPagination.currentPage;
this.$parent.componentName = "newsCreator"; this.$parent.componentName = "newsCreator";
this.$parent.regions = this.typesState this.$parent.regions = this.typesState;
this.$parent.info = info this.$parent.info = info;
}, },
handleSizeChange(val) { handleSizeChange(val) {
// console.log(`每页 ${val} 条`); // console.log(`每页 ${val} 条`);
this.infoPagination.pageSize = val this.infoPagination.pageSize = val;
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
// console.log(`当前页: ${val}`); // console.log(`当前页: ${val}`);
this.infoPagination.currentPage = val this.infoPagination.currentPage = val;
}, },
// 获取所有的新闻类型 // 获取所有的新闻类型
pullAllNewsType(isInit = true){ pullAllNewsType(isInit = true) {
this.typesState = [] this.typesState = [];
this.types = [{ this.types = [
{
value: "", value: "",
label: "全部", label: "全部",
}] },
];
// 获取所有新闻类型 // 获取所有新闻类型
getAllnewsType().then((res) => { getAllnewsType().then((res) => {
// console.log("所有的新闻类型=>",res) // console.log("所有的新闻类型=>",res)
if(res.status == 200){ if (res.status == 200) {
res.data.forEach(element => { res.data.forEach((element) => {
// 未被删除的类型且已启用 // 未被删除的类型且已启用
if(element.isDel==0&&element.status==1){ if (element.isDel == 0 && element.status == 1) {
this.types.push({ this.types.push({
value: element.id, value: element.id,
label: element.nameCn label: element.nameCn,
}); });
} }
// 缓存所有类型 // 缓存所有类型
this.typesState.push(element); this.typesState.push(element);
}); });
// 升序排序 // 升序排序
this.types.sort((obj1,obj2)=>{ this.types.sort((obj1, obj2) => {
let val1 = parseInt((obj1.value+"")) let val1 = parseInt(obj1.value + "");
let val2 = parseInt((obj2.value+"")) let val2 = parseInt(obj2.value + "");
if(val1<val2){ if (val1 < val2) {
return -1 return -1;
}else if(val1>val2){ } else if (val1 > val2) {
return 1 return 1;
}else{ } else {
return 0 return 0;
} }
}); });
console.log("获取到的所有类型=>",this.typesState) console.log("获取到的所有类型=>", this.typesState);
// 改变类型表格数据 // 改变类型表格数据
// this.changeTableType() // this.changeTableType()
// 拉取分页表格数据 // 拉取分页表格数据
this.pullListNewsType() this.pullListNewsType();
this.canPull = isInit this.canPull = isInit;
} }
}); });
}, },
// 分页获取新闻资讯 // 分页获取新闻资讯
pullListNewsInfo(){ pullListNewsInfo() {
getListNewsInfo({ getListNewsInfo({
page: this.infoPagination.currentPage, page: this.infoPagination.currentPage,
limit: this.infoPagination.pageSize, limit: this.infoPagination.pageSize,
typeId: this.currentType, typeId: this.currentType,
}).then((res) => { }).then((res) => {
if(res.status == 200){ if (res.status == 200) {
// console.log("res=>",res) // console.log("res=>",res)
this.tableDataState = [] // 先清空当前缓存 this.tableDataState = []; // 先清空当前缓存
this.infoPagination.total = res.data.totalCount // 更改总记录数 this.infoPagination.total = res.data.totalCount; // 更改总记录数
res.data.data.forEach(element => { res.data.data.forEach((element) => {
// 缓存当前的表格数据 // 缓存当前的表格数据
this.tableDataState.push(element) this.tableDataState.push(element);
}) });
console.log("获取到的分页新闻资讯",this.tableDataState) console.log("获取到的分页新闻资讯", this.tableDataState);
// 将缓存的数据作进一步的筛选 // 将缓存的数据作进一步的筛选
this.screenTableData() this.screenTableData();
} }
// console.log("获取分页新闻资讯=>", res); // console.log("获取分页新闻资讯=>", res);
}); });
}, },
// 筛选表格数据 // 筛选表格数据
screenTableData(){ screenTableData() {
// 先清空当前表格数据 // 先清空当前表格数据
this.tableData = [] this.tableData = [];
console.log("星云动态缓存的表格数据=>",this.tableDataState) console.log("星云动态缓存的表格数据=>", this.tableDataState);
let index = 0 let index = 0;
// 先把未被删除的数据放入到表格 // 先把未被删除的数据放入到表格
this.tableDataState.forEach((element) => { this.tableDataState.forEach((element) => {
// 未被删除则显示 // 未被删除则显示
if(element.isDel == 0){ if (element.isDel == 0) {
let type = (this.typesState.find(ele => ele.id == element.typeId)) let type = this.typesState.find((ele) => ele.id == element.typeId);
this.tableData.push({ this.tableData.push({
index: (this.infoPagination.pageSize*(this.infoPagination.currentPage-1))+(++index),// 序号 index:
this.infoPagination.pageSize *
(this.infoPagination.currentPage - 1) +
++index, // 序号
id: element.id, id: element.id,
title: element.title, title: element.title,
icon: { icon: {
...@@ -624,7 +716,7 @@ export default { ...@@ -624,7 +716,7 @@ export default {
showPreview: false, showPreview: false,
}, },
introduce: element.detail, introduce: element.detail,
content: element.content,// 富文本内容 content: element.content, // 富文本内容
newsDate: element.newsDate, newsDate: element.newsDate,
type: type ? type.nameCn : "", type: type ? type.nameCn : "",
typeId: element.typeId, typeId: element.typeId,
...@@ -637,41 +729,46 @@ export default { ...@@ -637,41 +729,46 @@ export default {
} }
}); });
// 状态码不为空字符串(全部,上架1,下架2) // 状态码不为空字符串(全部,上架1,下架2)
if(this.currentStatus!=""){ if (this.currentStatus != "") {
this.tableData = this.tableData.filter(element => element.status == this.currentStatus) this.tableData = this.tableData.filter(
(element) => element.status == this.currentStatus
);
} }
// 类型id不为空字符串(类型的id,若为空则筛选全部) // 类型id不为空字符串(类型的id,若为空则筛选全部)
if(this.currentType!=""){ if (this.currentType != "") {
this.tableData = this.tableData.filter(element => element.typeId == this.currentType) this.tableData = this.tableData.filter(
(element) => element.typeId == this.currentType
);
} }
// 排序码不为空字符串(全部,升序1,降序2s) // 排序码不为空字符串(全部,升序1,降序2s)
if(this.currentSort!=""){ if (this.currentSort != "") {
if(this.currentSort==1){ if (this.currentSort == 1) {
// 按降序 // 按降序
this.tableData.sort((obj1,obj2)=>{
let val1 = parseInt((obj1.id+"")) this.tableData.sort((obj1, obj2) => {
let val2 = parseInt((obj2.id+"")) let val1 = parseInt(obj1.sort + "");
if(val1<val2){ let val2 = parseInt(obj2.sort + "");
return 1 if (val1 < val2) {
}else if(val1>val2){ return 1;
return -1 } else if (val1 > val2) {
}else{ return -1;
return 0 } else {
return 0;
} }
}) });
}else{ } else {
// 按升序 // 按升序
this.tableData.sort((obj1,obj2)=>{ this.tableData.sort((obj1, obj2) => {
let val1 = parseInt((obj1.id+"")) let val1 = parseInt(obj1.sort + "");
let val2 = parseInt((obj2.id+"")) let val2 = parseInt(obj2.sort + "");
if(val1<val2){ if (val1 < val2) {
return -1 return -1;
}else if(val1>val2){ } else if (val1 > val2) {
return 1 return 1;
}else{ } else {
return 0 return 0;
} }
}) });
} }
} }
}, },
...@@ -683,17 +780,17 @@ export default { ...@@ -683,17 +780,17 @@ export default {
// console.log("所有新闻类型缓存数据=>",this.typesState) // console.log("所有新闻类型缓存数据=>",this.typesState)
// this.changeTableType() // this.changeTableType()
// 拉取分页数据 // 拉取分页数据
this.pullListNewsType() this.pullListNewsType();
} else { } else {
this.$parent.componentName = "newsCreator"; this.$parent.componentName = "newsCreator";
this.$parent.regions = this.typesState this.$parent.regions = this.typesState;
this.$parent.info = null this.$parent.info = null;
} }
}, },
// 获取类型分页的表格数据 // 获取类型分页的表格数据
pullListNewsType(){ pullListNewsType() {
// 先将当前类型表格数据清空 // 先将当前类型表格数据清空
this.tableType = [] this.tableType = [];
// 获取分页新闻类型 // 获取分页新闻类型
getListnewsType({ getListnewsType({
page: this.typePagination.currentPage, page: this.typePagination.currentPage,
...@@ -701,21 +798,21 @@ export default { ...@@ -701,21 +798,21 @@ export default {
name: "", name: "",
}).then((res) => { }).then((res) => {
console.log("获取分页新闻类型=>", res); console.log("获取分页新闻类型=>", res);
if(res.status==200){ if (res.status == 200) {
this.typePagination.total = res.data.totalCount this.typePagination.total = res.data.totalCount;
res.data.data.forEach(element => { res.data.data.forEach((element) => {
// 未被删除的类型 // 未被删除的类型
if(element.isDel==0){ if (element.isDel == 0) {
this.tableType.push({ this.tableType.push({
id: element.id, id: element.id,
name: element.nameCn, name: element.nameCn,
nameEn: element.nameEn, nameEn: element.nameEn,
sort: element.rank, sort: element.rank,
status: element.status, status: element.status,
isDel: element.isDel isDel: element.isDel,
}) });
} }
}) });
} }
}); });
}, },
...@@ -752,147 +849,157 @@ export default { ...@@ -752,147 +849,157 @@ export default {
// console.log("类型表格数据改变=>",this.tableType) // console.log("类型表格数据改变=>",this.tableType)
// }, // },
// 上下架类型 // 上下架类型
changeTypeStatus(type){ changeTypeStatus(type) {
let message = "" let message = "";
if(type.status==1){// 当前为启用 if (type.status == 1) {
type.status=2 // 当前为启用
message = "下架成功" type.status = 2;
}else{// 当前为弃用 message = "下架成功";
type.status=1 } else {
message = "上架成功" // 当前为弃用
type.status = 1;
message = "上架成功";
} }
addUpdateNewsType({ addUpdateNewsType({
id: type.id+'', id: type.id + "",
nameCn: type.name, nameCn: type.name,
nameEn: type.nameEn, nameEn: type.nameEn,
rank: type.sort, rank: type.sort,
status: type.status, status: type.status,
isDel: type.isDel+'', // 0为不删除,1为删除 isDel: type.isDel + "", // 0为不删除,1为删除
}).then(res => { }).then((res) => {
if(res.status == 200){ if (res.status == 200) {
this.$message({ this.$message({
message: message, message: message,
type: 'success' type: "success",
}) });
this.pullAllNewsType(false) this.pullAllNewsType(false);
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}) });
}, },
// 删除类型 // 删除类型
delType(type){ delType(type) {
this.$confirm('确定继续执行该操作吗?', '提示', { this.$confirm("确定继续执行该操作吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
type.isDel = 1 type.isDel = 1;
addUpdateNewsType({ addUpdateNewsType({
id: type.id+'', id: type.id + "",
nameCn: type.name, nameCn: type.name,
nameEn: type.nameEn, nameEn: type.nameEn,
rank: type.sort, rank: type.sort,
status: type.status, status: type.status,
isDel: type.isDel+'', // 0为不删除,1为删除 isDel: type.isDel + "", // 0为不删除,1为删除
}).then(res => { }).then((res) => {
if(res.status == 200){ if (res.status == 200) {
this.$message({ this.$message({
message: "删除成功", message: "删除成功",
type: 'success' type: "success",
}) });
this.pullAllNewsType(false) this.pullAllNewsType(false);
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}) });
}); });
}, },
// 添加类型 // 添加类型
createType(){ createType() {
if(this.newType.newName&&this.newType.newSort){ if (this.newType.newName && this.newType.newSort) {
// 必须是中文名称 // 必须是中文名称
if(/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(this.newType.newName)){ if (
if(this.newType.newSort>=0&&this.newType.newSort<10000){ /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
this.newType.newName
)
) {
if (this.newType.newSort >= 0 && this.newType.newSort < 10000) {
addUpdateNewsType({ addUpdateNewsType({
nameCn: this.newType.newName, nameCn: this.newType.newName,
nameEn: "", nameEn: "",
rank: this.newType.newSort, rank: this.newType.newSort,
status: 1, // 创建即启用 status: 1, // 创建即启用
isDel: "0", // 0为不删除,1为删除 isDel: "0", // 0为不删除,1为删除
}).then(res => { }).then((res) => {
if(res.status == 200){ if (res.status == 200) {
this.$message({ this.$message({
message: '创建成功!!!', message: "创建成功!!!",
type: 'success' type: "success",
}) });
this.pullAllNewsType(false) this.pullAllNewsType(false);
this.typeCreatorVisible = false this.typeCreatorVisible = false;
} }
}) });
}else{ } else {
this.$message.error('排序值不在指定范围,请输入正确的排序值!!!'); this.$message.error("排序值不在指定范围,请输入正确的排序值!!!");
} }
}else{ } else {
this.$message.error('请输入中文名称!!!'); this.$message.error("请输入中文名称!!!");
} }
}else{ } else {
this.$message.error('必填框有缺乏值,请完善输入!!!'); this.$message.error("必填框有缺乏值,请完善输入!!!");
} }
}, },
clickTypeEditor(type){ clickTypeEditor(type) {
this.typeEditorVisible = true this.typeEditorVisible = true;
this.editorType = JSON.parse(JSON.stringify(type)) this.editorType = JSON.parse(JSON.stringify(type));
}, },
cancelEditor(){ cancelEditor() {
// this.pullListNewsType() // this.pullListNewsType()
this.typeEditorVisible = false this.typeEditorVisible = false;
}, },
// 修改类型 // 修改类型
confirmEditor(){ confirmEditor() {
// 中文对应 // 中文对应
if(/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(this.editorType.name)){ if (
if(this.editorType.sort>=0&&this.editorType.sort<10000){ /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
this.editorType.name
)
) {
if (this.editorType.sort >= 0 && this.editorType.sort < 10000) {
// 上传修改 // 上传修改
addUpdateNewsType({ addUpdateNewsType({
id: this.editorType.id, id: this.editorType.id,
nameCn: this.editorType.name, nameCn: this.editorType.name,
nameEn: this.editorType.nameEn, nameEn: this.editorType.nameEn,
rank: this.editorType.sort, rank: this.editorType.sort,
status: this.editorType.status,// 1启用,2不启用 status: this.editorType.status, // 1启用,2不启用
isDel: this.editorType.isDel,// 0不删除,1删除 isDel: this.editorType.isDel, // 0不删除,1删除
}); });
this.$message({ this.$message({
message: '修改成功!!!', message: "修改成功!!!",
type: 'success' type: "success",
}) });
this.pullListNewsType() this.pullListNewsType();
this.typeEditorVisible = false this.typeEditorVisible = false;
}else{ } else {
this.$message.error('排序值不在指定范围,请输入正确的排序值!!!'); this.$message.error("排序值不在指定范围,请输入正确的排序值!!!");
} }
}else{ } else {
this.$message.error('中文名称不正确!!!'); this.$message.error("中文名称不正确!!!");
} }
}, },
// 功能按钮 // 功能按钮
clickOperator(type){ clickOperator(type) {
if(type == "search"){ if (type == "search") {
this.pullListNewsInfo() this.pullListNewsInfo();
}else{ } else {
this.currentStatus = "" this.currentStatus = "";
this.currentType = "" this.currentType = "";
this.currentSort = "" this.currentSort = "";
this.pullListNewsInfo() this.pullListNewsInfo();
} }
}, },
changeHandleSize(val) { changeHandleSize(val) {
// console.log(`每页 ${val} 条`); // console.log(`每页 ${val} 条`);
this.typePagination.pageSize = val this.typePagination.pageSize = val;
}, },
changeHandleCurrent(val) { changeHandleCurrent(val) {
// console.log(`当前页: ${val}`); // console.log(`当前页: ${val}`);
this.typePagination.currentPage = val this.typePagination.currentPage = val;
}, },
// 显示图片查看器 // 显示图片查看器
showPreview(icon) { showPreview(icon) {
...@@ -1035,11 +1142,12 @@ export default { ...@@ -1035,11 +1142,12 @@ export default {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.edit,.upshelf{ .edit,
.upshelf {
color: #1890ff; color: #1890ff;
} }
.offshelf { .offshelf {
color: #A6A9AD; color: #a6a9ad;
} }
.delete { .delete {
color: #fe4066; color: #fe4066;
...@@ -1102,31 +1210,32 @@ export default { ...@@ -1102,31 +1210,32 @@ export default {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.edit,.upshelf{ .edit,
.upshelf {
color: #1890ff; color: #1890ff;
} }
.offshelf { .offshelf {
color: #A6A9AD; color: #a6a9ad;
} }
.delete { .delete {
color: #fe4066; color: #fe4066;
} }
} }
} }
.typePagination{ .typePagination {
margin: 30px 0; margin: 30px 0;
width: 100%; width: 100%;
} }
} }
#typeCreator,#typeEditor{ #typeCreator,
#typeEditor {
width: 100%; width: 100%;
height: auto; height: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
.content{ .content {
margin-left: 70px; margin-left: 70px;
width: calc(100% - 70px); width: calc(100% - 70px);
height: auto; height: auto;
...@@ -1136,7 +1245,8 @@ export default { ...@@ -1136,7 +1245,8 @@ export default {
align-items: center; align-items: center;
} }
} }
#typeCreator,#typeEditor{ #typeCreator,
#typeEditor {
.operators { .operators {
margin: 25px 0 0 0; margin: 25px 0 0 0;
width: 100%; width: 100%;
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
* @FilePath: \rs-cloud-platform-ui\src\views\webSiteManagement\newsCategory\newsCreator\index.vue * @FilePath: \rs-cloud-platform-ui\src\views\webSiteManagement\newsCategory\newsCreator\index.vue
--> -->
<template> <template>
<div id='newsCreator'> <div id="newsCreator">
<div class="top"> <div class="top">
<div class="title" @click="$parent.componentName='nebulaDynamics'"> <div class="title" @click="$parent.componentName = 'nebulaDynamics'">
<i class="el-icon-back"></i> <i class="el-icon-back"></i>
<!-- <img src="/static/images/return.png"/> --> <!-- <img src="/static/images/return.png"/> -->
返回上一页 返回上一页
...@@ -19,15 +19,24 @@ ...@@ -19,15 +19,24 @@
<el-form ref="form" :rules="rules" :model="form" label-width="80px"> <el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="资讯标题" prop="title"> <el-form-item label="资讯标题" prop="title">
<el-col :span="12"> <el-col :span="12">
<el-input v-model="form.title" placeholder="请输入资讯标题"></el-input> <el-input
v-model="form.title"
placeholder="请输入资讯标题"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="封面图" prop="coverImg"> <el-form-item label="封面图" prop="coverImg">
<singleImageX :value="form.coverImg" @input="onPreview"></singleImageX> <singleImageX
:value="form.coverImg"
@input="onPreview"
></singleImageX>
</el-form-item> </el-form-item>
<el-form-item label="资讯简介" prop="introduce"> <el-form-item label="资讯简介" prop="introduce">
<el-col :span="12"> <el-col :span="12">
<el-input v-model="form.introduce" placeholder="请输入资讯简介"></el-input> <el-input
v-model="form.introduce"
placeholder="请输入资讯简介"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="资讯类型" prop="region"> <el-form-item label="资讯类型" prop="region">
...@@ -45,18 +54,38 @@ ...@@ -45,18 +54,38 @@
</el-select> </el-select>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="是否热门">
<el-col :span="8">
<el-radio-group v-model="form.isHot">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-col>
</el-form-item>
<el-form-item label="资讯详情" prop="content"> <el-form-item label="资讯详情" prop="content">
<el-col :span="20"> <el-col :span="20">
<kind-editor id="editor_id" :content.sync="form.content" :afterChange="afterChange()" :loadStyleMode="false"@on-content-change="onContentChange"></kind-editor> <kind-editor
id="editor_id"
:content.sync="form.content"
:afterChange="afterChange()"
:loadStyleMode="false"
@on-content-change="onContentChange"
></kind-editor>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-col :span="12"> <el-col :span="12">
<el-input type="number" v-model="form.sort" placeholder="请输入序号"></el-input> <el-input
type="number"
v-model="form.sort"
placeholder="请输入序号"
></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="$parent.componentName='nebulaDynamics'">取消</el-button> <el-button @click="$parent.componentName = 'nebulaDynamics'"
>取消</el-button
>
<el-button type="primary" @click="onSubmit">确定</el-button> <el-button type="primary" @click="onSubmit">确定</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -65,151 +94,159 @@ ...@@ -65,151 +94,159 @@
</template> </template>
<script> <script>
import singleImageX from '@/components/Upload/singleImageX'; import singleImageX from "@/components/Upload/singleImageX";
import KindEditor from "@/components/Kindeditor"; import KindEditor from "@/components/Kindeditor";
import {timestamp2Date} from '@/utils/dateUtils'; import { timestamp2Date } from "@/utils/dateUtils";
import {uuid} from "@/utils/uuid";// 导入请求 import { uuid } from "@/utils/uuid"; // 导入请求
import { import { addUpdateNewsInfo } from "@/api/website/newsCategory/index";
addUpdateNewsInfo,
} from "@/api/website/newsCategory/index";
export default { export default {
name: 'newsCreator', name: "newsCreator",
components: { components: {
singleImageX, singleImageX,
KindEditor KindEditor,
}, },
data(){ data() {
return { return {
types: [], types: [],
form: { form: {
id: '', id: "",
title: '', title: "",
coverImg: '', coverImg: "",
introduce: '', introduce: "",
region: '', region: "",
sort: '', sort: "",
content: '', content: "",
isHot: 2,
}, },
rules:{ rules: {
title: [{ required: true, message: '请输入资讯标题', trigger: 'blur' }], title: [{ required: true, message: "请输入资讯标题", trigger: "blur" }],
coverImg: [{ required: true, message: '请上传封面图', trigger: 'blur' }], coverImg: [
introduce: [{ required: true, message: '请输入资讯简介', trigger: 'blur' }], { required: true, message: "请上传封面图", trigger: "blur" },
region: [{ required: true, message: '请选择选择资讯类型', trigger: 'blur' }], ],
content: [{ required: true, message: '请输入资讯详情', trigger: 'blur' }], introduce: [
sort: [{ required: true, message: '请输入序号', trigger: 'blur' }], { required: true, message: "请输入资讯简介", trigger: "blur" },
],
region: [
{ required: true, message: "请选择选择资讯类型", trigger: "blur" },
],
content: [
{ required: true, message: "请输入资讯详情", trigger: "blur" },
],
sort: [{ required: true, message: "请输入序号", trigger: "blur" }],
}, },
} };
}, },
mounted() { mounted() {
this.types = [] this.types = [];
this.$parent.regions.forEach(element => { this.$parent.regions.forEach((element) => {
if(element.status==1){ if (element.status == 1) {
this.types.push({ this.types.push({
value: element.id, value: element.id,
label: element.nameCn, label: element.nameCn,
}) });
} }
}); });
if(this.$parent.info!=null){ if (this.$parent.info != null) {
this.form.id = this.$parent.info.id this.form.id = this.$parent.info.id;
this.form.title = this.$parent.info.title this.form.title = this.$parent.info.title;
this.form.coverImg = this.$parent.info.icon.url this.form.coverImg = this.$parent.info.icon.url;
this.form.introduce = this.$parent.info.introduce this.form.introduce = this.$parent.info.introduce;
this.form.region = this.$parent.info.typeId this.form.region = this.$parent.info.typeId;
this.form.sort = this.$parent.info.sort this.form.sort = this.$parent.info.sort;
this.form.content = this.$parent.info.content this.form.content = this.$parent.info.content;
this.form.isHot = this.$parent.info.isHot;
} }
}, },
methods: { methods: {
onContentChange (val) { onContentChange(val) {
console.log(val) console.log(val);
},
afterChange () {
}, },
onPreview(url){ afterChange() {},
this.form.coverImg = url onPreview(url) {
this.form.coverImg = url;
}, },
onSubmit() { onSubmit() {
if(this.form.title==""){ if (this.form.title == "") {
this.$message.error('请输入资讯标题!!!'); this.$message.error("请输入资讯标题!!!");
}else if(this.form.coverImg==""){ } else if (this.form.coverImg == "") {
this.$message.error('请输入上传封面图!!!'); this.$message.error("请输入上传封面图!!!");
}else if(this.form.introduce==""){ } else if (this.form.introduce == "") {
this.$message.error('请输入资讯简介!!!'); this.$message.error("请输入资讯简介!!!");
}else if(this.form.region==""){ } else if (this.form.region == "") {
this.$message.error('请选择选择资讯类型!!!'); this.$message.error("请选择选择资讯类型!!!");
}else if(this.form.sort==""){ } else if (this.form.sort == "") {
this.$message.error('请输入序号!!!'); this.$message.error("请输入序号!!!");
}else if(this.form.content==""){ } else if (this.form.content == "") {
this.$message.error('请输入资讯详情!!!'); this.$message.error("请输入资讯详情!!!");
}else{ } else {
let data,message let data, message;
if(this.$parent.info!=null){ if (this.$parent.info != null) {
data = { data = {
id: this.form.id, id: this.form.id,
title: this.form.title, title: this.form.title,
detail: this.form.introduce, detail: this.form.introduce,
coverImg: this.form.coverImg, coverImg: this.form.coverImg,
content: this.form.content, content: this.form.content,
newsDate: timestamp2Date((new Date()).getTime()), newsDate: timestamp2Date(new Date().getTime()),
typeId: this.form.region, typeId: this.form.region,
isDel: 0,// 0为未被删除,1为已删除 isDel: 0, // 0为未被删除,1为已删除
status: 2, // 默认上传即为下架状态(1为上架2为下架) status: 2, // 默认上传即为下架状态(1为上架2为下架)
indexShow: 1, indexShow: 1,
typeName: (this.types.find(ele => ele.value == this.form.region)).label, typeName: this.types.find((ele) => ele.value == this.form.region)
isHot: "1", .label,
rank: this.form.sort+"", isHot: this.form.isHot,
} rank: this.form.sort + "",
message = "修改成功!!!" };
}else{ message = "修改成功!!!";
} else {
data = { data = {
title: this.form.title, title: this.form.title,
detail: this.form.introduce, detail: this.form.introduce,
coverImg: this.form.coverImg, coverImg: this.form.coverImg,
content: this.form.content, content: this.form.content,
newsDate: timestamp2Date((new Date()).getTime()), newsDate: timestamp2Date(new Date().getTime()),
typeId: this.form.region, typeId: this.form.region,
isDel: 0,// 0为未被删除,1为已删除 isDel: 0, // 0为未被删除,1为已删除
status: 2, // 默认上传即为下架状态(后端规定1为启用2为禁用) status: 2, // 默认上传即为下架状态(后端规定1为启用2为禁用)
indexShow: 1, indexShow: 1,
typeName: (this.types.find(ele => ele.value == this.form.region)).label, typeName: this.types.find((ele) => ele.value == this.form.region)
isHot: "1", .label,
rank: this.form.sort+"", isHot: this.form.isHot,
} rank: this.form.sort + "",
message = "创建成功!!!" };
message = "创建成功!!!";
} }
// 新增新闻资讯 // 新增新闻资讯
addUpdateNewsInfo(data).then((res) => { addUpdateNewsInfo(data).then((res) => {
if(res.status==200){ if (res.status == 200) {
let _this = this let _this = this;
this.$message({ this.$message({
message: message, message: message,
type: 'success', type: "success",
duration: 2000, duration: 2000,
}); });
setTimeout(()=>{ setTimeout(() => {
_this.$parent.componentName = "nebulaDynamics" _this.$parent.componentName = "nebulaDynamics";
_this.$parent.info = null _this.$parent.info = null;
},2100); }, 2100);
} }
}); });
} }
}
}, },
} },
};
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
#newsCreator{ #newsCreator {
margin: 0 1% 0 1%; margin: 0 1% 0 1%;
width: 98%; width: 98%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
color: #5178F2; color: #5178f2;
.top{ .top {
width: 100%; width: 100%;
height: 68px; height: 68px;
display: flex; display: flex;
...@@ -217,8 +254,8 @@ export default { ...@@ -217,8 +254,8 @@ export default {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #EEEEEE; border-bottom: 1px solid #eeeeee;
.title{ .title {
width: auto; width: auto;
margin: 0 0 0 30px; margin: 0 0 0 30px;
height: 46px; height: 46px;
...@@ -226,19 +263,19 @@ export default { ...@@ -226,19 +263,19 @@ export default {
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: #5178F2; color: #5178f2;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
} }
} }
.form{ .form {
padding: 30px 60px; padding: 30px 60px;
width: calc(100% - 30px); width: calc(100% - 30px);
height: calc(100% - 68px - 60px); height: calc(100% - 68px - 60px);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
color: #5178F2; color: #5178f2;
}
} }
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment