Commit aaf61f8f authored by rencs's avatar rencs

Merge branch 'dev_ren' into 'dev'

Dev ren

See merge request !23
parents 53bdfc72 0b6d7446
...@@ -35,26 +35,76 @@ ...@@ -35,26 +35,76 @@
@input="(val, info) => getSrc('coverImg', val)" @input="(val, info) => getSrc('coverImg', val)"
></my-upload> ></my-upload>
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="上传源文件">
label="上传源文件" <!-- :prop="'imageInfoRelationList.url' && 'imageInfoRelationList.price'" -->
:prop="'imageInfoRelationList.url' && 'imageInfoRelationList.price'"
>
<!-- 上传 --> <!-- 上传 -->
<my-upload <!-- <my-upload
refName="upload2" refName="upload2"
:value="ruleForm.imageInfoRelationList.url" :value="ruleForm.imageInfoRelationList.url"
@input="(val, info) => getSrc('imageInfoRelationList', val, info)" @input="(val, info) => getSrc('imageInfoRelationList', val, info)"
></my-upload> ></my-upload> -->
<div v-if="ruleForm.imageInfoRelationList.fileWidth"> <!-- <div v-if="ruleForm.imageInfoRelationList.fileWidth">
尺寸大小:{{ ruleForm.imageInfoRelationList.fileWidth }} 尺寸大小:{{ ruleForm.imageInfoRelationList.fileWidth }}
</div> </div> -->
<el-input <!-- <el-input
class="half-width" class="half-width"
size="small" size="small"
v-model="ruleForm.imageInfoRelationList.price" v-model="ruleForm.imageInfoRelationList.price"
placeholder="请输入价格" placeholder="请输入价格"
></el-input> ></el-input> -->
<el-upload
class="upload-demo"
:action="BASE_API + '/api/datacenter/bg/gtdata/upload'"
:on-success="handleDataUpSuccess"
:headers="getHeaderWithToken"
:show-file-list="false"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
<el-row
style="
display: flex;
align-items: center;
margin-top: 10px;
box-sizing:border-box;
margin-bottom:5px
border-bottom: 1px solid #f4f4f5;
"
v-for="(item, idx) in ruleForm.imageInfoRelationList"
:key="idx"
>
<el-col :span="3" style="display: flex; align-items: center">
<span>{{ item.url | filterUrl }}</span>
</el-col>
<el-col :span="6" style="display: flex; align-items: center">
<label>尺寸:&nbsp;</label>
<el-input
v-model="item.fileWidth"
placeholder="请输入尺寸大小"
style="width: 60%"
></el-input>
</el-col>
<el-col :span="6" style="display: flex; align-items: center">
<label>价格:&nbsp;</label>
<el-input-number
style="width: 80%"
v-model="item.price"
:min="0"
:step="0.01"
:precision="2"
></el-input-number>
</el-col>
<el-col :span="4">
<el-button
@click="del_dataImgItem(idx)"
type="primary"
icon="el-icon-delete"
>删除</el-button
>
</el-col>
</el-row>
</el-form-item> </el-form-item>
<el-alert <el-alert
...@@ -206,11 +256,20 @@ import MyUpload from "@/components/Upload/singleImageX"; //上传组件 ...@@ -206,11 +256,20 @@ import MyUpload from "@/components/Upload/singleImageX"; //上传组件
import { update, getAll, getDetail } from "@/api/website/imageLibrary"; import { update, getAll, getDetail } from "@/api/website/imageLibrary";
import KindEditor from "@/components/Kindeditor"; import KindEditor from "@/components/Kindeditor";
import { getToken } from "utils/auth";
export default { export default {
components: { components: {
MyUpload, MyUpload,
KindEditor, KindEditor,
}, },
filters: {
filterUrl: function (val) {
if (val) {
let idx = val.lastIndexOf("/");
return val.substring(idx + 1, val.length);
}
},
},
data() { data() {
let checkNumber = function (rule, value, callback) { let checkNumber = function (rule, value, callback) {
if (value === "") { if (value === "") {
...@@ -224,6 +283,7 @@ export default { ...@@ -224,6 +283,7 @@ export default {
} }
}; };
return { return {
BASE_API: process.env.BASE_API,
//1--影像美图 2--专题图 3--遥感成果图 //1--影像美图 2--专题图 3--遥感成果图
imageTypes: { imageTypes: {
1: "影像美图", 1: "影像美图",
...@@ -233,12 +293,7 @@ export default { ...@@ -233,12 +293,7 @@ export default {
ruleForm: { ruleForm: {
name: "", name: "",
coverImg: "", coverImg: "",
imageInfoRelationList: { imageInfoRelationList: [],
url: "",
price: null,
fileWidth: "",
fileSize: "",
},
intro: "", intro: "",
type: "", type: "",
relatedIds: "", relatedIds: "",
...@@ -258,13 +313,6 @@ export default { ...@@ -258,13 +313,6 @@ export default {
coverImg: [ coverImg: [
{ required: true, message: "请上传缩略图", trigger: "change" }, { required: true, message: "请上传缩略图", trigger: "change" },
], ],
"imageInfoRelationList.url": [
{ required: true, message: "请上传源文件", trigger: "change" },
],
"imageInfoRelationList.price": [
{ required: true, message: "请输入价格", trigger: "blur" },
{ validator: checkNumber, trigger: "blur" }, //校验是否是数字
],
type: [ type: [
{ required: true, message: "请选择影像类型", trigger: "change" }, { required: true, message: "请选择影像类型", trigger: "change" },
], ],
...@@ -316,6 +364,11 @@ export default { ...@@ -316,6 +364,11 @@ export default {
}, },
}; };
}, },
computed: {
getHeaderWithToken() {
return { Authorization: getToken() };
},
},
mounted() { mounted() {
//获取所有相似图像 //获取所有相似图像
this.getAllImages(); this.getAllImages();
...@@ -325,6 +378,30 @@ export default { ...@@ -325,6 +378,30 @@ export default {
this.$bus.$off("imageLibrary-edit-renderData"); this.$bus.$off("imageLibrary-edit-renderData");
}, },
methods: { methods: {
del_dataImgItem(idx) {
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.ruleForm.imageInfoRelationList.splice(idx, 1);
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
handleDataUpSuccess(res, file) {
this.ruleForm.imageInfoRelationList.push({
url: res.data.path,
price: 0,
fileWidth: "",
fileSize: res.data.size,
});
},
afterChange() {}, afterChange() {},
onContentChange(val) { onContentChange(val) {
this.ruleForm.intro = val; this.ruleForm.intro = val;
...@@ -387,10 +464,10 @@ export default { ...@@ -387,10 +464,10 @@ export default {
let val = params; let val = params;
let afterFormat = this.filterParams(val); let afterFormat = this.filterParams(val);
let data = JSON.parse(JSON.stringify(afterFormat)); let data = JSON.parse(JSON.stringify(afterFormat));
console.log(data);
// data.paramJson = JSON.parse(data.paramJson); // data.paramJson = JSON.parse(data.paramJson);
//注意:imageInfoRelationListParse为imageInfoRelationList参数的最后一项,赋值显示 //注意:imageInfoRelationListParse为imageInfoRelationList参数的最后一项,赋值显示
data.imageInfoRelationList = data.imageInfoRelationListParse[0]; data.imageInfoRelationList = data.imageInfoRelationListParse;
data.coverImg = data.coverImg || ""; data.coverImg = data.coverImg || "";
this.ruleForm = data; this.ruleForm = data;
this.images.selects = this.ruleForm.relatedIds.split(","); //相似图片转为数组格式 this.images.selects = this.ruleForm.relatedIds.split(","); //相似图片转为数组格式
...@@ -415,7 +492,7 @@ export default { ...@@ -415,7 +492,7 @@ export default {
for (let key in obj) { for (let key in obj) {
if (!b.includes(key)) { if (!b.includes(key)) {
if (key === "imageInfoRelationList") { if (key === "imageInfoRelationList") {
let temp = this.filterParams(obj[key][0]); let temp = this.filterParams(obj[key]);
obj[key] = [temp]; obj[key] = [temp];
} }
...@@ -442,8 +519,9 @@ export default { ...@@ -442,8 +519,9 @@ export default {
let params = JSON.parse(JSON.stringify(this.ruleForm)); let params = JSON.parse(JSON.stringify(this.ruleForm));
params.paramJson = JSON.stringify(params.paramJson); params.paramJson = JSON.stringify(params.paramJson);
params.imageInfoRelationList = [params.imageInfoRelationList]; // params.imageInfoRelationList = [params.imageInfoRelationList];
// console.log(params)
console.log(params);
//执行方法 //执行方法
update(params).then((res) => { update(params).then((res) => {
if (res.status == 200) { if (res.status == 200) {
...@@ -491,4 +569,9 @@ export default { ...@@ -491,4 +569,9 @@ export default {
.half-width { .half-width {
width: 50%; width: 50%;
} }
.dataImg {
width: 80px;
height: 80px;
border-radius: 5px;
}
</style> </style>
...@@ -156,6 +156,31 @@ ...@@ -156,6 +156,31 @@
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> --> <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="上传源文件" prop="sourceFile">
<el-upload
class="upload-demo"
:action="BASE_API + '/api/datacenter/bg/gtdata/upload'"
:on-success="handleDataUpSuccess"
:headers="getHeaderWithToken"
:show-file-list="false"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
<el-row
style="
display: flex;
align-items: center;
margin-top: 10px;
box-sizing:border-box;
margin-bottom:5px
border-bottom: 1px solid #f4f4f5;
"
>
<el-col :span="3" style="display: flex; align-items: center">
<span>{{ form.sourceFile | filterUrl }}</span>
</el-col>
</el-row>
</el-form-item>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
...@@ -197,6 +222,7 @@ import { ...@@ -197,6 +222,7 @@ import {
getAllApplicationType, getAllApplicationType,
addUpdateApplicationInfo, addUpdateApplicationInfo,
} from "api/website/industryApplication/index"; } from "api/website/industryApplication/index";
import { getToken } from "utils/auth";
export default { export default {
name: "addApp", name: "addApp",
components: { components: {
...@@ -204,8 +230,17 @@ export default { ...@@ -204,8 +230,17 @@ export default {
KindEditor, KindEditor,
ElImageViewer, ElImageViewer,
}, },
filters: {
filterUrl: function (val) {
if (val) {
let idx = val.lastIndexOf("/");
return val.substring(idx + 1, val.length);
}
},
},
data() { data() {
return { return {
BASE_API: process.env.BASE_API,
rules: { rules: {
type: [{ required: true, message: "请选择应用类别", trigger: "blur" }], type: [{ required: true, message: "请选择应用类别", trigger: "blur" }],
title: [{ required: true, message: "请输入应用名称", trigger: "blur" }], title: [{ required: true, message: "请输入应用名称", trigger: "blur" }],
...@@ -237,6 +272,9 @@ export default { ...@@ -237,6 +272,9 @@ export default {
{ required: true, message: "是否提供定制", trigger: "blur" }, { required: true, message: "是否提供定制", trigger: "blur" },
], ],
fileList: [{ required: true, message: "请上传样例", trigger: "blur" }], fileList: [{ required: true, message: "请上传样例", trigger: "blur" }],
sourceFile: [
{ required: true, message: "请上传源文件", trigger: "blur" },
],
introduction: [ introduction: [
{ required: true, message: "请输入产品简介", trigger: "blur" }, { required: true, message: "请输入产品简介", trigger: "blur" },
], ],
...@@ -256,6 +294,7 @@ export default { ...@@ -256,6 +294,7 @@ export default {
isCustomized: "是", // 是否定制 isCustomized: "是", // 是否定制
fileList: [], // 样例图片路径集合 fileList: [], // 样例图片路径集合
introduction: "", // 简介 introduction: "", // 简介
sourceFile: "", //源文件路径
}, },
currentIcon: { currentIcon: {
showPreview: false, showPreview: false,
...@@ -275,6 +314,11 @@ export default { ...@@ -275,6 +314,11 @@ export default {
}, },
}, },
}, },
computed: {
getHeaderWithToken() {
return { Authorization: getToken() };
},
},
mounted() { mounted() {
this.pullAllApplicationType(); this.pullAllApplicationType();
if (!!this.$parent.info) { if (!!this.$parent.info) {
...@@ -287,7 +331,7 @@ export default { ...@@ -287,7 +331,7 @@ export default {
this.form.detailImg = info.icon.url; this.form.detailImg = info.icon.url;
console.log(info); console.log(info);
this.form.price = info.price; this.form.price = info.price;
this.form.sourceFile = info.sourceFile;
this.form.industry = attribute.industry; this.form.industry = attribute.industry;
this.form.region = attribute.area; this.form.region = attribute.area;
this.form.collectTime = attribute.date; this.form.collectTime = attribute.date;
...@@ -321,6 +365,9 @@ export default { ...@@ -321,6 +365,9 @@ export default {
this.$bus.$emit("hideThreeRoute", true); this.$bus.$emit("hideThreeRoute", true);
}, },
methods: { methods: {
handleDataUpSuccess(res, file) {
this.form.sourceFile = res.data.path;
},
// 获取所有应用类型 // 获取所有应用类型
pullAllApplicationType() { pullAllApplicationType() {
this.firstTypes = []; this.firstTypes = [];
...@@ -460,6 +507,7 @@ export default { ...@@ -460,6 +507,7 @@ export default {
coverImg: this.form.coverImg, coverImg: this.form.coverImg,
detailImg: this.form.detailImg, detailImg: this.form.detailImg,
price: this.form.price, price: this.form.price,
sourceFile: this.form.sourceFile,
introduction: this.form.introduction, introduction: this.form.introduction,
attribute: JSON.stringify({ attribute: JSON.stringify({
industry: this.form.industry, industry: this.form.industry,
...@@ -496,6 +544,7 @@ export default { ...@@ -496,6 +544,7 @@ export default {
detailImg: this.form.detailImg, detailImg: this.form.detailImg,
introduction: this.form.introduction, introduction: this.form.introduction,
price: this.form.price, price: this.form.price,
sourceFile: this.form.sourceFile,
attribute: JSON.stringify({ attribute: JSON.stringify({
industry: this.form.industry, industry: this.form.industry,
area: this.form.region, area: this.form.region,
......
...@@ -302,6 +302,7 @@ export default { ...@@ -302,6 +302,7 @@ export default {
id: element.id, id: element.id,
attribute: element.attribute, attribute: element.attribute,
price: element.price, price: element.price,
sourceFile: element.sourceFile,
examples: element.examples, examples: element.examples,
examplesJson: element.examplesJson, examplesJson: element.examplesJson,
indexShow: element.indexShow, indexShow: element.indexShow,
......
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