Commit d13d368e by 任建

rj

parent c2454e01
......@@ -60,5 +60,15 @@ export function getCompanyInfoByLikeName(name) {
actionBody: {
likestr: name
}
})
});
}
//图片转pdf
export function pic2pdf(url) {
return http.post(baseUrl, {
actionType: "pic2pdf",
actionBody: {
key: url
}
});
}
\ No newline at end of file
......@@ -8,8 +8,21 @@
<div class="from-main">
<div class="from-items">
<div class="from-item-title"><span>*</span>上传材料:营业执照</div>
<div class="upload-box">
<div class="upload-box" v-loading="loading1">
<img v-if="imgUrl1" :src="imgUrl1" alt="" />
<div v-else class="imgs">
<i class="el-icon-plus"></i>
<span>(需盖公章)</span>
</div>
<!-- 1 -->
<UploadImg
:action="action"
:data="dataone"
ref="upImg"
flag="picUrl"
:num="1"
@getsuccess="getImgUrl"
/>
</div>
<div class="upload-box-next">
<img src="@/assets/imgs/sbzc/yyzz1.png" alt="" />
......@@ -26,8 +39,21 @@
>下载委托书模板</a
>
</div>
<div class="upload-box">
<div class="upload-box" v-loading="loading2">
<img v-if="imgUrl2" :src="imgUrl2" alt="" />
<div v-else class="imgs">
<i class="el-icon-plus"></i>
<span>(需盖公章)</span>
</div>
<!-- 2 -->
<UploadImg
:action="action"
:data="datatwo"
ref="upImg"
flag="picUrl"
:num="2"
@getsuccess="getImgUrl"
/>
</div>
<div class="upload-box-next">
<img src="@/assets/imgs/sbzc/wts1.png" alt="" />
......@@ -44,8 +70,21 @@
>下载优先权证明</a
>
</div>
<div class="upload-box">
<div class="upload-box" v-loading="loading3">
<img v-if="imgUrl3" :src="imgUrl3" alt="" />
<div v-else class="imgs">
<i class="el-icon-plus"></i>
<span>(需盖公章)</span>
</div>
<!-- 3 -->
<UploadImg
:action="action"
:data="datathree"
ref="upImg"
flag="picUrl"
:num="3"
@getsuccess="getImgUrl"
/>
</div>
<div class="upload-box-next">
<img src="@/assets/imgs/sbzc/yxq.png" alt="" />
......@@ -81,15 +120,101 @@
import imgUrl1 from "@/assets/imgs/sbzc/yyzzD.png";
import imgUrl2 from "@/assets/imgs/sbzc/wtsD.png";
import imgUrl3 from "@/assets/imgs/sbzc/yxqD.png";
//
import UploadImg from "./uploadImg";
//
import { getOss, uploadStandardTm, pic2pdf } from "@/api/tmTools.js";
export default {
components: {
UploadImg
},
data() {
return {
chakanKey: null,
toViewImgType: false,
toViewImgSrc: ""
toViewImgSrc: "",
action: "",
dataone: {},
datatwo: {},
datathree: {},
loading1: false,
loading2: false,
loading3: false,
imgUrl: "",
imgUrl1: "",
imgUrl2: "",
imgUrl3: ""
};
},
mounted() {
this.getOss();
},
methods: {
getImgUrl(msg, num) {
console.log(num, msg);
this.imgUrl = msg;
if (num == 1) {
this.loading1 = true;
this.imgUrl1 = msg;
}
if (num == 2) {
this.loading2 = true;
this.imgUrl2 = msg;
}
if (num == 3) {
this.loading3 = true;
this.imgUrl3 = msg;
}
uploadStandardTm(this.imgUrl).then(res => {
if (res.status == 0) {
//图片转pdf
pic2pdf(res.data.url).then(re => {
this.loading1 = false;
this.loading2 = false;
this.loading3 = false;
if (re.status == 0) {
this.$message({
type: "success",
message: "上传成功"
});
} else {
this.$message.error("上传失败,请重新上传!");
}
});
} else {
this.$message.error("上传失败,请重新上传!");
}
//上传后重新获取偶oss
this.getOss();
});
},
getOss() {
getOss().then(re => {
this.dataone = re.data;
this.datatwo = re.data;
this.datathree = re.data;
this.dataone.key = this.setKey();
this.datatwo.key = this.setKey();
this.datathree.key = this.setKey();
this.action = re.data.url;
});
},
setKey(name, flag) {
// name = name.substring(name.length - 5);
var myDate = new Date();
var key =
"zc_" +
flag +
Math.round(Math.random() * 10000) +
myDate.getTime() +
myDate.getFullYear() +
myDate.getMonth() +
myDate.getDate() +
".jpg";
// this.$refs[flag].data.key = key;
return key;
},
//
enter(index) {
this.chakanKey = index;
},
......@@ -180,6 +305,27 @@ export default {
position: relative;
border: 3px dashed #ccc;
margin-left: 20px;
img {
width: 100%;
height: 100%;
}
.imgs {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
i {
font-size: 30px;
color: #b8b8b8;
}
span {
color: #0f8ee9;
font-size: 12px;
margin-top: 20px;
}
}
}
.upload-box-next {
width: 98px;
......
......@@ -14,7 +14,7 @@
<script>
export default {
props:["action","data"],
props: ["action", "data", "num"],
data() {
return {
imageUrl: ""
......@@ -22,9 +22,9 @@ export default {
},
methods: {
handleAvatarSuccess(res) {
var doc = (new DOMParser()).parseFromString(res,'text/xml');
let url = doc.getElementsByTagName('Location')[0].innerHTML;
this.$emit("getsuccess",url)
var doc = new DOMParser().parseFromString(res, "text/xml");
let url = doc.getElementsByTagName("Location")[0].innerHTML;
this.$emit("getsuccess", url, this.num);
},
beforeAvatarUpload(file) {
const isJPG = file.type === "image/jpeg" || file.type === "image/png";
......@@ -49,7 +49,8 @@ export default {
position: absolute;
top: 0;
left: 0;
.avatar-uploader,.el-upload {
.avatar-uploader,
.el-upload {
border-radius: 6px;
cursor: pointer;
position: relative;
......
......@@ -185,6 +185,11 @@ export default {
type: "success",
message: "上传成功"
});
getOss().then(res => {
this.data = res.data;
this.data.key = this.setKey();
this.action = res.data.url;
});
} 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