|
@@ -1,7 +1,16 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div>
|
3
|
|
- <ImgCutter ref="imgCutterModal" v-loading="loadCut" :isModal="false" :sizeChange="true" :scaleAble="false" :originalGraph="true" rate="65:52" @cutDown="cutDown" @onClearAll="onClearAll">
|
|
3
|
+ <ImgCutter ref="imgCutterModal" v-loading="loadCut" :isModal="false" :sizeChange="true" :scaleAble="false" :originalGraph="true" rate="65:52" @cutDown="cutDown">
|
4
|
4
|
<template slot="open"><slot></slot></template>
|
|
5
|
+ <template slot="choose">
|
|
6
|
+ <el-button type="primary" plain size="mini">选择图片</el-button>
|
|
7
|
+ </template>
|
|
8
|
+ <template slot="cancel">
|
|
9
|
+ <el-button type="primary" plain size="mini" style="display:none">取消</el-button>
|
|
10
|
+ </template>
|
|
11
|
+ <template slot="confirm">
|
|
12
|
+ <el-button type="primary" size="mini">确定</el-button>
|
|
13
|
+ </template>
|
5
|
14
|
</ImgCutter>
|
6
|
15
|
</div>
|
7
|
16
|
</template>
|
|
@@ -71,8 +80,8 @@ export default {
|
71
|
80
|
},
|
72
|
81
|
//通过cutDown事件接收选择的图片信息
|
73
|
82
|
cutDown(event) {
|
74
|
|
- console.log(event)
|
75
|
83
|
if (!event.file) {
|
|
84
|
+ this.$emit('imgCutterCallback',{flag:false})
|
76
|
85
|
this.$message({ message: '图片剪裁失败!', type: "error" })
|
77
|
86
|
return
|
78
|
87
|
};
|
|
@@ -94,19 +103,17 @@ export default {
|
94
|
103
|
instance.post(this.URL.BASEURL + this.URL.material_upload,formData).then((res) => {
|
95
|
104
|
var res = res.data
|
96
|
105
|
if (res && res.errno == 0) {
|
97
|
|
-
|
|
106
|
+ this.$emit('imgCutterCallback',{flag:true,data:res.rst})
|
98
|
107
|
} else if (res.errno != 4002) {
|
|
108
|
+ this.$emit('imgCutterCallback',{flag:false})
|
99
|
109
|
this.$message({ message: res.err, type: "error" })
|
100
|
110
|
}
|
101
|
111
|
}).catch((err) => {
|
|
112
|
+ this.$emit('imgCutterCallback',{flag:false})
|
102
|
113
|
this.$message({ message: '服务器错误,获取裁剪图片失败', type: "error" })
|
103
|
114
|
});
|
104
|
115
|
|
105
|
116
|
},
|
106
|
|
- // 清空画布
|
107
|
|
- onClearAll(){
|
108
|
|
- console.log('点击了取消')
|
109
|
|
- },
|
110
|
117
|
}
|
111
|
118
|
|
112
|
119
|
}
|