Преглед изворни кода

上传图片后,获取图片路径

Wang-Xiao-Ran пре 1 година
родитељ
комит
d8f7e767cb

+ 1 - 1
data-ui/src/components/ImageUpload/dataUpload.vue

@@ -137,6 +137,7 @@ export default {
         this.fileList = this.fileList.concat(this.uploadList);
         this.uploadList = [];
         this.number = 0;
+        this.dialogName = res.data.url;
         // this.ImageUpload.setUrl(res.data.url)
         this.$emit("input", this.listToString(this.fileList));
         // this.$emit("input", JSON.stringify(this.fileList));
@@ -186,7 +187,6 @@ export default {
     // 预览
     handlePictureCardPreview(file) {
       this.dialogImageUrl = file.url;
-      this.dialogName = file.name;
       this.dialogVisible = true;
     },
     // 对象转成指定字符串分隔

+ 4 - 1
data-ui/src/views/data/digitalagriculture/information/index.vue

@@ -208,7 +208,10 @@
     methods: {
       /** 上传 */
       getUrl(url) {
-        this.form.attachPaths=url
+        //获取图片全路径  例:http://{{ ip }}:{{ port }}/group1/M00/00/07/wKgKEGVxMCiAZbvVAAJE9SGvagw915.jpg
+        this.form.attachPaths = url
+        //获取图片路径  例:group1/M00/00/07/wKgKEGVxL6eACFv2AAJE9SGvagw622.jpg
+        // this.form.attachPaths = this.$refs.ImageUpload.dialogName
       },
       /** 查询部门下拉树结构 */
       getTreeselect() {