修改
This commit is contained in:
parent
1c93de85bb
commit
2ace214334
@ -9,8 +9,16 @@ export function updateNurseStationHeads(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//海报视频上传
|
||||||
|
|
||||||
|
|
||||||
|
export function updatePoserHeads(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/poser/updatePoserHeads',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function posts(data) {
|
export function posts(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -762,11 +762,9 @@ export default {
|
|||||||
getListBy(this.queryParams).then(res => {
|
getListBy(this.queryParams).then(res => {
|
||||||
this.nurseStationlist = res.rows;
|
this.nurseStationlist = res.rows;
|
||||||
this.queryParams.nurseStationId = res.rows[0].id;
|
this.queryParams.nurseStationId = res.rows[0].id;
|
||||||
this.nurseItemquery.nurseStationId = JSON.parse(
|
this.nurseItemquery.nurseStationId = res.rows[0].id;
|
||||||
JSON.stringify(res.rows[0].id)
|
this.getList();
|
||||||
);
|
|
||||||
});
|
});
|
||||||
this.getList();
|
|
||||||
},
|
},
|
||||||
//打开护理站列表
|
//打开护理站列表
|
||||||
nurseStationshowclick() {
|
nurseStationshowclick() {
|
||||||
@ -794,7 +792,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.form.nurseItemName = null;
|
this.form.nurseItemName = null;
|
||||||
this.form.nurseItemId = null;
|
this.form.nurseItemId = null;
|
||||||
this.nurseitemid = null
|
this.nurseitemid = null;
|
||||||
this.nurseStationshow = false;
|
this.nurseStationshow = false;
|
||||||
this.nurseItemnuser = item.id;
|
this.nurseItemnuser = item.id;
|
||||||
this.nurseItemquery.nurseStationId = item.id;
|
this.nurseItemquery.nurseStationId = item.id;
|
||||||
|
|||||||
@ -2,9 +2,18 @@
|
|||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
class="user-info-head"
|
class="user-info-head"
|
||||||
|
:class="video.VideoPath ? 'wihi' : ''"
|
||||||
@click="editCropper()"
|
@click="editCropper()"
|
||||||
style="width: 100px; height: 100px"
|
|
||||||
>
|
>
|
||||||
|
<video
|
||||||
|
style="width: 208px; height: 208px"
|
||||||
|
v-if="video.VideoPath"
|
||||||
|
v-bind:src="video.VideoPath"
|
||||||
|
class="avatar video-avatar"
|
||||||
|
controls="controls"
|
||||||
|
>
|
||||||
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
<img
|
<img
|
||||||
v-if="options.img"
|
v-if="options.img"
|
||||||
v-bind:src="options.img"
|
v-bind:src="options.img"
|
||||||
@ -12,7 +21,7 @@
|
|||||||
style="width: 100px; height: 100px; line-height: 200px"
|
style="width: 100px; height: 100px; line-height: 200px"
|
||||||
/>
|
/>
|
||||||
<i
|
<i
|
||||||
v-else
|
v-else-if="!options.img && !video.VideoPath"
|
||||||
class="el-icon-plus avatar-uploader-icon"
|
class="el-icon-plus avatar-uploader-icon"
|
||||||
style="
|
style="
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -24,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="上传图片"
|
:title="title"
|
||||||
:visible.sync="openimg"
|
:visible.sync="openimg"
|
||||||
width="950px"
|
width="950px"
|
||||||
append-to-body
|
append-to-body
|
||||||
@ -47,6 +56,15 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :md="12" :style="{ height: '350px' }">
|
<el-col :xs="24" :md="12" :style="{ height: '350px' }">
|
||||||
<div class="avatar-upload-preview">
|
<div class="avatar-upload-preview">
|
||||||
|
<video
|
||||||
|
style="width: 100%; height: 100%"
|
||||||
|
v-if="videoForm.showVideoPath"
|
||||||
|
v-bind:src="videoForm.showVideoPath"
|
||||||
|
class="avatar video-avatar"
|
||||||
|
controls="controls"
|
||||||
|
>
|
||||||
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
<img
|
<img
|
||||||
style="width: 100%; height: 100%"
|
style="width: 100%; height: 100%"
|
||||||
v-if="previews.url"
|
v-if="previews.url"
|
||||||
@ -54,6 +72,9 @@
|
|||||||
/>
|
/>
|
||||||
<div v-else></div>
|
<div v-else></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="title" v-if="types != 'posterVideoUrl'&&types!='posterPictureUrl'">
|
||||||
|
请上传图片为800x800px的正方形
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<br />
|
<br />
|
||||||
@ -71,7 +92,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="{ span: 1, offset: 2 }" :md="2">
|
<!-- <el-col :lg="{ span: 1, offset: 2 }" :md="2">
|
||||||
<el-button
|
<el-button
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="small"
|
size="small"
|
||||||
@ -98,8 +119,8 @@
|
|||||||
size="small"
|
size="small"
|
||||||
@click="rotateRight()"
|
@click="rotateRight()"
|
||||||
></el-button>
|
></el-button>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<el-col :lg="{ span: 2, offset: 6 }" :md="2">
|
<el-col :lg="{ span: 2, offset: 20 }" :md="2">
|
||||||
<el-button type="primary" size="small" @click="uploadImg()"
|
<el-button type="primary" size="small" @click="uploadImg()"
|
||||||
>提 交</el-button
|
>提 交</el-button
|
||||||
>
|
>
|
||||||
@ -112,12 +133,16 @@
|
|||||||
<script>
|
<script>
|
||||||
import { VueCropper } from "vue-cropper";
|
import { VueCropper } from "vue-cropper";
|
||||||
import baseurl from "@/api/baseurl.js";
|
import baseurl from "@/api/baseurl.js";
|
||||||
import { updateNurseStationHeads, posts } from "@/api/system/stationAvatar.js";
|
import {
|
||||||
|
updateNurseStationHeads,
|
||||||
|
posts,
|
||||||
|
updatePoserHeads,
|
||||||
|
} from "@/api/system/stationAvatar.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { VueCropper },
|
components: { VueCropper },
|
||||||
|
|
||||||
props: ["img", "type", "item"],
|
props: ["img", "type", "item", "tovideo"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
imageUrl: "",
|
imageUrl: "",
|
||||||
@ -127,7 +152,7 @@ export default {
|
|||||||
// 是否显示cropper
|
// 是否显示cropper
|
||||||
visible: false,
|
visible: false,
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "上传头像",
|
title: "上传图片/视频",
|
||||||
options: {
|
options: {
|
||||||
img: null, //裁剪图片的地址
|
img: null, //裁剪图片的地址
|
||||||
autoCrop: true, // 是否默认生成截图框
|
autoCrop: true, // 是否默认生成截图框
|
||||||
@ -137,11 +162,26 @@ export default {
|
|||||||
},
|
},
|
||||||
previews: {},
|
previews: {},
|
||||||
items: {},
|
items: {},
|
||||||
|
//显示上传按钮
|
||||||
|
videoForm: {
|
||||||
|
showVideoPath: null, //回显的变量
|
||||||
|
},
|
||||||
|
video: {
|
||||||
|
VideoPath: null, //回显的变量
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.types = this.type;
|
this.types = this.type;
|
||||||
this.items = this.item;
|
this.items = this.item;
|
||||||
|
if (this.tovideo == null) {
|
||||||
|
this.video.VideoPath = null;
|
||||||
|
} else if (this.tovideo == "") {
|
||||||
|
this.video.VideoPath = null;
|
||||||
|
} else {
|
||||||
|
this.video.VideoPath = baseurl + this.tovideo;
|
||||||
|
}
|
||||||
|
console.log(this.video);
|
||||||
if (this.img == null) {
|
if (this.img == null) {
|
||||||
this.options.img = null;
|
this.options.img = null;
|
||||||
} else if (this.img == "") {
|
} else if (this.img == "") {
|
||||||
@ -149,8 +189,16 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.options.img = baseurl + this.img;
|
this.options.img = baseurl + this.img;
|
||||||
}
|
}
|
||||||
|
if (this.types == "posterVideoUrl") {
|
||||||
|
this.title = "上传视频";
|
||||||
|
} else {
|
||||||
|
this.title = "上传图片";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
tovideo: {
|
||||||
|
handler(newimg, oldimg) {},
|
||||||
|
},
|
||||||
item: {
|
item: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
this.items = this.item;
|
this.items = this.item;
|
||||||
@ -199,48 +247,72 @@ export default {
|
|||||||
},
|
},
|
||||||
// 上传预处理
|
// 上传预处理
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
if (file.type.indexOf("image/") == -1) {
|
if (this.types == "posterVideoUrl") {
|
||||||
this.$modal.msgError(
|
|
||||||
"文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
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);
|
||||||
|
this.videoForm.showVideoPath = URL.createObjectURL(file);
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
// this.options.img = reader.result;
|
// this.options.img = reader.result;
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
if (file.type.indexOf("image/") == -1) {
|
||||||
|
this.$modal.msgError(
|
||||||
|
"文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const reader = new FileReader();
|
||||||
|
this.previews.data = file;
|
||||||
|
this.previews.url = URL.createObjectURL(file);
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
reader.onload = () => {
|
||||||
|
// this.options.img = reader.result;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 上传图片
|
// 上传图片
|
||||||
uploadImg() {
|
uploadImg() {
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append("file", this.previews.data);
|
if (this.previews.data) {
|
||||||
formData.append("type", this.types);
|
formData.append("file", this.previews.data);
|
||||||
updateNurseStationHeads(formData).then((response) => {
|
formData.append("type", this.types);
|
||||||
this.options.img = baseurl + response.imgUrl;
|
if (this.types == "posterVideoUrl") {
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
updatePoserHeads(formData).then((response) => {
|
||||||
console.log(this.items);
|
this.video.VideoPath = baseurl + response.imgUrl;
|
||||||
console.log(this.types);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
if (this.types == "attributePitureUrl") {
|
this.openimg = false;
|
||||||
this.items.attributePitureUrl = response.imgUrl;
|
});
|
||||||
this.$emit("item", JSON.stringify(this.items));
|
} else {
|
||||||
}
|
updateNurseStationHeads(formData).then((response) => {
|
||||||
if (this.types == "nurseItemClassifyUrl") {
|
this.options.img = baseurl + response.imgUrl;
|
||||||
this.items.classifyPictureUrl = response.imgUrl;
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
this.$emit("item", JSON.stringify(this.items));
|
if (this.types == "attributePitureUrl") {
|
||||||
}
|
this.items.attributePitureUrl = response.imgUrl;
|
||||||
if (this.types == "nurseStationClassifyUrl") {
|
this.$emit("item", JSON.stringify(this.items));
|
||||||
this.items.classifyPictureUrl = 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));
|
||||||
|
}
|
||||||
|
this.openimg = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
this.openimg = false;
|
this.openimg = false;
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
// 实时预览
|
// 实时预览
|
||||||
realTime(data) {
|
realTime(data) {
|
||||||
console.log(data);
|
|
||||||
this.previews = data;
|
this.previews = data;
|
||||||
},
|
},
|
||||||
// 关闭窗口
|
// 关闭窗口
|
||||||
@ -252,6 +324,12 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.title {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 5%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0%);
|
||||||
|
}
|
||||||
.avatar-upload-preview {
|
.avatar-upload-preview {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0%;
|
top: 0%;
|
||||||
@ -266,8 +344,9 @@ export default {
|
|||||||
.user-info-head {
|
.user-info-head {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 120px;
|
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info-head:hover:after {
|
.user-info-head:hover:after {
|
||||||
@ -287,4 +366,12 @@ export default {
|
|||||||
line-height: 110px;
|
line-height: 110px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
.wihi {
|
||||||
|
background-color: #fff;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
.wihi:hover:after {
|
||||||
|
transform: translate(50%, 50%);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user