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