|
@@ -3,9 +3,27 @@
|
|
|
<div class="ocr-area-cont">
|
|
|
<img :src="imageUrl" ref="editImage" />
|
|
|
</div>
|
|
|
- <div class="ocr-area-action">
|
|
|
- <el-button type="primary" @click="confirm">确认</el-button>
|
|
|
- <el-button @click="cancel">取消</el-button>
|
|
|
+ <div class="ocr-area-side">
|
|
|
+ <div class="ocr-area-preview">
|
|
|
+ <div class="ocr-area-spin">
|
|
|
+ <div
|
|
|
+ class="ocr-area-spin-img"
|
|
|
+ :style="spinStyle"
|
|
|
+ ref="OcrAreaSpinImg"
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="ocr-area-icon "
|
|
|
+ title="顺时针旋转90度"
|
|
|
+ @click="toRotateSpin"
|
|
|
+ >
|
|
|
+ <i class="icon icon-rotate-right-act"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="ocr-area-action">
|
|
|
+ <el-button type="primary" @click="confirm">确认</el-button>
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -29,7 +47,9 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- cropper: ""
|
|
|
+ cropper: "",
|
|
|
+ rotate: 0,
|
|
|
+ spinStyle: {}
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -39,6 +59,10 @@ export default {
|
|
|
initCropper() {
|
|
|
const _this = this;
|
|
|
const defCodeArea = this.setting || {};
|
|
|
+ this.rotate = defCodeArea.rotate || 0;
|
|
|
+ this.spinStyle = {
|
|
|
+ transform: `translate(-50%, -50%) rotate(${this.rotate}deg)`
|
|
|
+ };
|
|
|
|
|
|
this.cropper = new Cropper(this.$refs.editImage, {
|
|
|
viewMode: 1,
|
|
@@ -46,16 +70,25 @@ export default {
|
|
|
zoomable: false,
|
|
|
minCropBoxWidth: 10,
|
|
|
minCropBoxHeight: 10,
|
|
|
- preview: _this.$refs.CodeAreaSpinImg,
|
|
|
+ preview: _this.$refs.OcrAreaSpinImg,
|
|
|
ready() {
|
|
|
_this.cropper.setData(defCodeArea);
|
|
|
_this.$emit("on-ready");
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ toRotateSpin() {
|
|
|
+ this.rotate += 90;
|
|
|
+ if (this.rotate === 360) this.rotate = 0;
|
|
|
+
|
|
|
+ this.spinStyle = {
|
|
|
+ transform: `translate(-50%, -50%) rotate(${this.rotate}deg)`
|
|
|
+ };
|
|
|
+ },
|
|
|
confirm() {
|
|
|
const codeArea = {
|
|
|
- ...this.cropper.getData()
|
|
|
+ ...this.cropper.getData(),
|
|
|
+ rotate: this.rotate
|
|
|
};
|
|
|
this.$emit("confirm", codeArea);
|
|
|
},
|