Commit 099da13d authored by rencs's avatar rencs

1.7

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