From 995649ad25ce47d1d6f40744b367ebb0f75ea1ae Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 23 Nov 2021 13:59:09 +0800 Subject: [PATCH] glassPicture --- hb_client/src/api/file.js | 9 ++- hb_client/src/views/mtm/materialdo.vue | 76 ++++++++++++++------------ 2 files changed, 49 insertions(+), 36 deletions(-) diff --git a/hb_client/src/api/file.js b/hb_client/src/api/file.js index 01c683e..9ad01c7 100644 --- a/hb_client/src/api/file.js +++ b/hb_client/src/api/file.js @@ -15,4 +15,11 @@ export function getFileList(query) { method: 'get', params: query }) -} \ No newline at end of file +} +export function upFile(data) { + return request({ + url: '/file/', + method: 'post', + data + }) +} diff --git a/hb_client/src/views/mtm/materialdo.vue b/hb_client/src/views/mtm/materialdo.vue index 029abea..421edae 100644 --- a/hb_client/src/views/mtm/materialdo.vue +++ b/hb_client/src/views/mtm/materialdo.vue @@ -87,32 +87,6 @@ :title="tableForm.name" > - - - -
- -
- - 您的浏览器不支持绘图,请升级或更换浏览器! - - - - -
-
标记
-
文字
- -
回退
-
保存
- -
-
-
-
-
- -
+ +
+ +
+ + 您的浏览器不支持绘图,请升级或更换浏览器! + + + + +
+
标记
+
文字
+ +
回退
+
保存
+
+
+
+
+
@@ -458,7 +453,7 @@ - + - + @@ -513,6 +508,7 @@ updaterffield, deleterffield, } from "@/api/mtm"; + import { upFile } from "@/api/file"; import {genTree} from "@/utils"; import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Treeselect from '@riophae/vue-treeselect' @@ -546,7 +542,7 @@ field_name: "", sort: "", parent: "", - TempPicture: "", + draw_template: "",//图片模板 field_choice: [""], }, field_choice: [""], @@ -604,7 +600,7 @@ datetime: "日期时间", select: "单选", selects: "多选", - img: "图片", + draw: "绘图模板", }, fieldtypeoptions: [ { @@ -640,8 +636,8 @@ label: "多选", }, { - value: "img", - label: "图片", + value: "draw", + label: "绘图模板", }, ], typeoptions: [ @@ -671,8 +667,7 @@ }, methods: { handleAvatarSuccess(res, file) { - this.field.TempPicture = res.data.path; - + this.field.draw_template = res.data.path; }, beforeAvatarUpload(file) { const isLt2M = file.size / 1024 / 1024 < 2; @@ -1012,10 +1007,21 @@ let image = new Image(); image = canvas.toDataURL('image/png'); this.canvasImg = image; + let img = image.split(";")[1]; + debugger; + console.log(image); + debugger; + let imgData = {mime:'base64',file:img,type:'图片'}; + upFile(imgData).then((res) => { + debugger; + console.log(res); + debugger; + }) + + // document.getElementById('res').innerHTML = ''; }, - //新增记录表 handleCreate() { this.recordform = Object.assign({}, defaultrecordform);