From b0885fe610e22462c4b350ac49f32fba10bff96a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=86=8A=E4=B8=BD=E5=90=9B?= <664953382@qq.com>
Date: Wed, 9 Feb 2022 09:07:34 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9B=BE=E7=89=87=E5=83=8F?=
=?UTF-8?q?=E7=B4=A0=E4=BF=AE=E6=94=B9=E5=B1=95=E7=A4=BA=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/ImageUpload/index.vue | 26 ++++++++++++++++++++++
src/views/vehicleMent/map.vue | 33 ++++++++++++++++++----------
src/views/vehicleMent/overview.vue | 9 +++-----
3 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue
index 4d20923..45a07b7 100644
--- a/src/components/ImageUpload/index.vue
+++ b/src/components/ImageUpload/index.vue
@@ -71,6 +71,11 @@ export default {
type: Boolean,
default: true,
},
+ // 是否获取图片宽高
+ isGetPicInfo: {
+ type: Boolean,
+ default: false,
+ },
},
data() {
return {
@@ -164,6 +169,27 @@ export default {
return false;
}
}
+ if (this.isGetPicInfo) {
+ const isSize = new Promise((resolve, reject) => {
+ //上传文件为图片类型
+ let img = new Image();
+ img.onload = function () {
+ resolve(img);
+ };
+ img.src = URL.createObjectURL(file);
+ }).then(
+ (res) => {
+ let picInfo = {
+ width: res.width,
+ height: res.height,
+ };
+ this.$emit("getPicInfo", picInfo);
+ },
+ (err) => {
+ return Promise.reject();
+ }
+ );
+ }
this.loading = this.$loading({
lock: true,
text: "上传中",
diff --git a/src/views/vehicleMent/map.vue b/src/views/vehicleMent/map.vue
index 9a0f965..c5f2638 100644
--- a/src/views/vehicleMent/map.vue
+++ b/src/views/vehicleMent/map.vue
@@ -12,14 +12,20 @@
px/m
-
+
-
+
{
this.dataInfo = response.rows[0] || {};
});
},
+ getPicInfo(e) {
+ this.dataInfo.xpixel = e.width;
+ this.dataInfo.ypixel = e.height;
+ },
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
diff --git a/src/views/vehicleMent/overview.vue b/src/views/vehicleMent/overview.vue
index 4a82792..7141a4a 100644
--- a/src/views/vehicleMent/overview.vue
+++ b/src/views/vehicleMent/overview.vue
@@ -1,11 +1,8 @@
-
+
+