Commit 099da13d authored by rencs's avatar rencs

1.7

parent 9940b231
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
:http-request="onUploadRequest" :http-request="onUploadRequest"
:show-file-list="false" :show-file-list="false"
:multiple="false" :multiple="false"
:limit="1"> :limit="1"
>
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__text">只能上传1个文件</div> <div class="el-upload__text">只能上传1张图片</div>
</el-upload> </el-upload>
<div class="image-preview" v-show="value"> <div class="image-preview" v-show="value">
<div class="image-preview-wrapper"> <div class="image-preview-wrapper">
...@@ -33,7 +34,7 @@ export default { ...@@ -33,7 +34,7 @@ export default {
props: { props: {
refName: { refName: {
type: String, type: String,
default: 'upload' default: "upload",
}, },
//图片地址 //图片地址
value: { value: {
...@@ -43,19 +44,19 @@ export default { ...@@ -43,19 +44,19 @@ export default {
}, },
data() { data() {
return { return {
uploading: false uploading: false,
}; };
}, },
mounted() { mounted() {
this.$bus.$on('upload-clearFiles', this.clearFiles) this.$bus.$on("upload-clearFiles", this.clearFiles);
}, },
beforeDestroy() { beforeDestroy() {
this.$bus.$off('upload-clearFiles') this.$bus.$off("upload-clearFiles");
}, },
methods: { methods: {
//清空上传过的图片 //清空上传过的图片
clearFiles() { clearFiles() {
this.$refs[this.refName].clearFiles() this.$refs[this.refName].clearFiles();
}, },
//删除图片 //删除图片
rmImage() { rmImage() {
...@@ -68,13 +69,13 @@ export default { ...@@ -68,13 +69,13 @@ export default {
let fileObj = data.file; let fileObj = data.file;
//获取图片详情信息 //获取图片详情信息
let imgInfo = {}; let imgInfo = {};
let temp = URL.createObjectURL(fileObj) let temp = URL.createObjectURL(fileObj);
let img = new Image(); let img = new Image();
img.src = temp; img.src = temp;
img.onload = function () { img.onload = function () {
imgInfo.width = img.width; imgInfo.width = img.width;
imgInfo.height = img.height; imgInfo.height = img.height;
} };
imgInfo.size = fileObj.size; imgInfo.size = fileObj.size;
imgInfo.type = fileObj.type; imgInfo.type = fileObj.type;
// FormData 对象 // FormData 对象
...@@ -82,21 +83,21 @@ export default { ...@@ -82,21 +83,21 @@ export default {
// 文件对象 // 文件对象
form.append("file", fileObj); form.append("file", fileObj);
uploadFile(form).then(res => { uploadFile(form).then((res) => {
this.uploading = false; this.uploading = false;
if (res.status == 200) { if (res.status == 200) {
this.emitFunc(res.data, imgInfo) this.emitFunc(res.data, imgInfo);
} else { } else {
this.emitFunc("", null); this.emitFunc("", null);
this.$message.error(res.message) this.$message.error(res.message);
} }
}) });
}, },
//组件通信 //组件通信
emitFunc(val, info = null) { emitFunc(val, info = null) {
this.$emit('input', val, info) this.$emit("input", val, info);
} },
}, },
}; };
</script> </script>
...@@ -153,4 +154,4 @@ export default { ...@@ -153,4 +154,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file
<!-- <!--
* @Author: Jenkins * @Author: Jenkins
* @Date: 2020-12-01 09:54:12 * @Date: 2020-12-01 09:54:12
* @LastEditTime: 2021-01-06 09:53:06 * @LastEditTime: 2020-12-11 11:27:34
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 星云动态 * @Description: 星云动态
* @FilePath: \rs-cloud-platform-ui\src\views\webSiteManagement\newsCategory\index.vue * @FilePath: \rs-cloud-platform-ui\src\views\webSiteManagement\newsCategory\index.vue
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
> >
<el-table-column label="序号" align="center"> <el-table-column label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.index }}</span> <span>{{ scope.row.id }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="类型名称" align="center"> <el-table-column label="类型名称" align="center">
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
@size-change="changeHandleSize" @size-change="changeHandleSize"
@current-change="changeHandleCurrent" @current-change="changeHandleCurrent"
:current-page.sync="typePagination.currentPage" :current-page.sync="typePagination.currentPage"
:page-sizes="[6,8,10]" :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"
...@@ -237,7 +237,13 @@ ...@@ -237,7 +237,13 @@
</div> </div>
<!-- 表格 --> <!-- 表格 -->
<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>
...@@ -464,9 +470,9 @@ export default { ...@@ -464,9 +470,9 @@ export default {
// }, // },
], ],
typePagination: { typePagination: {
currentPage: 1,// 当前页码 currentPage: 1, // 当前页码
pageSize: 6,// 每页查询数量 pageSize: 2, // 每页查询数量
total: 0,// 总记录数量 total: 0, // 总记录数量
}, },
typeEditorVisible: false, typeEditorVisible: false,
editorType: {}, // 编辑中的类型 editorType: {}, // 编辑中的类型
...@@ -782,32 +788,29 @@ export default { ...@@ -782,32 +788,29 @@ export default {
} }
}, },
// 获取类型分页的表格数据 // 获取类型分页的表格数据
pullListNewsType(){ pullListNewsType() {
// 先将当前类型表格数据清空 // 先将当前类型表格数据清空
this.tableType = [] this.tableType = [];
// 获取分页新闻类型 // 获取分页新闻类型
getListnewsType({ getListnewsType({
page: this.typePagination.currentPage, page: this.typePagination.currentPage,
limit: this.typePagination.pageSize, limit: this.typePagination.pageSize,
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,index) => { res.data.data.forEach((element) => {
// 未被删除的类型 // 未被删除的类型
if(element.isDel==0){ if (element.isDel == 0) {
this.tableType.push({ this.tableType.push({
index: (this.typePagination.currentPage-1) * this.typePagination.pageSize + index + 1, 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 });
})
}
})
} }
}); });
} }
...@@ -949,38 +952,31 @@ export default { ...@@ -949,38 +952,31 @@ export default {
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
addUpdateNewsType({ )
id: this.editorType.id, ) {
nameCn: this.editorType.name, if (this.editorType.sort >= 0 && this.editorType.sort < 10000) {
nameEn: this.editorType.nameEn, // 上传修改
rank: this.editorType.sort, addUpdateNewsType({
status: this.editorType.status,// 1启用,2不启用 id: this.editorType.id,
isDel: this.editorType.isDel,// 0不删除,1删除 nameCn: this.editorType.name,
}).then(res => { nameEn: this.editorType.nameEn,
if(res.status == 200){ rank: this.editorType.sort,
this.$message({ status: this.editorType.status, // 1启用,2不启用
message: '修改成功!!!', isDel: this.editorType.isDel, // 0不删除,1删除
type: 'success' });
}) this.$message({
this.pullListNewsType() message: "修改成功!!!",
this.typeEditorVisible = false type: "success",
}else{ });
this.$message({ this.pullListNewsType();
message: '修改失败请稍后重试!!!', this.typeEditorVisible = false;
type: 'fail' } else {
}) this.$message.error("排序值不在指定范围,请输入正确的排序值!!!");
}
})
}else{
this.$message.error('排序值不在指定范围,请输入正确的排序值!!!');
}
}else{
this.$message.error('中文名称不正确!!!');
} }
} else { } else {
this.$message.error("中文名称不正确!!!"); this.$message.error("中文名称不正确!!!");
......
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