修改
This commit is contained in:
parent
c8b434a69d
commit
c2907a03cd
@ -25,7 +25,6 @@
|
||||
"
|
||||
></i>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="openimg"
|
||||
@ -62,7 +61,11 @@
|
||||
</div>
|
||||
<div
|
||||
class="title"
|
||||
v-if="types != 'posterVideoUrl'&&types!='posterPictureUrl'"
|
||||
v-if="
|
||||
types != 'posterVideoUrl' &&
|
||||
types != 'posterPictureUrl' &&
|
||||
types != 'itemDirectoryUrl'
|
||||
"
|
||||
>请上传图片为800x800px的正方形</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -109,8 +112,9 @@
|
||||
@click="rotateRight()"
|
||||
></el-button>
|
||||
</el-col>-->
|
||||
<el-col :lg="{ span: 2, offset: 20 }" :md="2">
|
||||
<el-button type="primary" size="small" @click="uploadImg()">提 交</el-button>
|
||||
<el-col :lg="{ span: 2, offset: 19 }" :md="2">
|
||||
<el-button v-if="uploadbtn" type="primary" size="small" @click="uploadImg()">提 交</el-button>
|
||||
<el-button v-else :loading="!uploadbtn" type="primary" size="small">提 交 中...</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
@ -123,15 +127,18 @@ import baseurl from "@/api/baseurl.js";
|
||||
import {
|
||||
updateNurseStationHeads,
|
||||
posts,
|
||||
updatePoserHeads
|
||||
uploadVideoUrl,
|
||||
uploadTrainingCategoryPicture,
|
||||
updatePoserHeads,
|
||||
uploadUrl
|
||||
} from "@/api/system/stationAvatar.js";
|
||||
|
||||
export default {
|
||||
components: { VueCropper },
|
||||
|
||||
props: ["img", "type", "item", "tovideo"],
|
||||
data() {
|
||||
return {
|
||||
uploadbtn: true, //上传中不允许点击
|
||||
imageUrl: "",
|
||||
types: "",
|
||||
// 是否显示弹出层
|
||||
@ -175,7 +182,7 @@ export default {
|
||||
} else {
|
||||
this.options.img = baseurl + this.img;
|
||||
}
|
||||
if (this.types == "posterVideoUrl") {
|
||||
if (this.types == "posterVideoUrl" || this.types == "itemDirectoryUrl") {
|
||||
this.title = "上传视频";
|
||||
} else {
|
||||
this.title = "上传图片";
|
||||
@ -233,7 +240,7 @@ export default {
|
||||
},
|
||||
// 上传预处理
|
||||
beforeUpload(file) {
|
||||
if (this.types == "posterVideoUrl") {
|
||||
if (this.types == "posterVideoUrl" || this.types == "itemDirectoryUrl") {
|
||||
const reader = new FileReader();
|
||||
this.previews.data = file;
|
||||
this.previews.url = URL.createObjectURL(file);
|
||||
@ -260,50 +267,110 @@ export default {
|
||||
},
|
||||
// 上传图片
|
||||
uploadImg() {
|
||||
this.uploadbtn = true;
|
||||
let formData = new FormData();
|
||||
if (this.previews.data) {
|
||||
formData.append("file", this.previews.data);
|
||||
formData.append("type", this.types);
|
||||
if (this.types == "posterVideoUrl") {
|
||||
if (this.types == "itemDirectoryUrl") {
|
||||
this.$modal.msgSuccess("上传视频中,请耐心等待");
|
||||
this.uploadbtn = false;
|
||||
uploadVideoUrl(formData).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.video.VideoPath = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
this.items.itemDirectoryUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
this.openimg = false;
|
||||
} else {
|
||||
setTimeout(e => {
|
||||
this.openimg = false;
|
||||
}, 1000);
|
||||
}
|
||||
this.uploadbtn = true;
|
||||
});
|
||||
} else if (
|
||||
this.types == "trainingItemCoverUrl" ||
|
||||
this.types == "trainingItemContentUrl" ||
|
||||
this.types == "trainingItemPosterUrl"
|
||||
) {
|
||||
uploadUrl(formData).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.options.img = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
this.openimg = false;
|
||||
} else {
|
||||
setTimeout(e => {
|
||||
this.openimg = false;
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else if (this.types == "trainingCategoryPictureUrl") {
|
||||
uploadTrainingCategoryPicture(formData).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.options.img = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
this.openimg = false;
|
||||
} else {
|
||||
setTimeout(e => {
|
||||
this.openimg = false;
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else if (this.types == "posterVideoUrl") {
|
||||
updatePoserHeads(formData).then(response => {
|
||||
this.video.VideoPath = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
this.openimg = false;
|
||||
if (response.code == 200) {
|
||||
this.video.VideoPath = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
this.openimg = false;
|
||||
} else {
|
||||
setTimeout(e => {
|
||||
this.openimg = false;
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updateNurseStationHeads(formData).then(response => {
|
||||
this.options.img = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
if (this.types == "attributePitureUrl") {
|
||||
this.items.attributePitureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
if (response.code == 200) {
|
||||
this.options.img = baseurl + response.imgUrl;
|
||||
this.$emit("imgUrl", response.imgUrl);
|
||||
if (this.types == "attributePitureUrl") {
|
||||
this.items.attributePitureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "nurseItemClassifyUrl") {
|
||||
this.items.classifyPictureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "nurseStationClassifyUrl") {
|
||||
this.items.classifyPictureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "posterPictureUrl") {
|
||||
this.items.posterPictureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "certificateUrl") {
|
||||
this.items.certificateUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "personCertificateUrl") {
|
||||
this.items.certificateUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
this.openimg = false;
|
||||
} else {
|
||||
setTimeout(e => {
|
||||
this.openimg = false;
|
||||
}, 1000);
|
||||
}
|
||||
if (this.types == "nurseItemClassifyUrl") {
|
||||
this.items.classifyPictureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "nurseStationClassifyUrl") {
|
||||
this.items.classifyPictureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "posterPictureUrl") {
|
||||
this.items.posterPictureUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "certificateUrl") {
|
||||
this.items.certificateUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
if (this.types == "personCertificateUrl") {
|
||||
this.items.certificateUrl = response.imgUrl;
|
||||
this.$emit("item", JSON.stringify(this.items));
|
||||
}
|
||||
this.openimg = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.openimg = false;
|
||||
}
|
||||
this.videoForm.showVideoPath = null;
|
||||
this.previews.data = null;
|
||||
},
|
||||
// 实时预览
|
||||
realTime(data) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user