From 4eae7af1ce6cd0ea8ac6485e26528625e83c3c70 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十月 2021 15:18:57 +0800
Subject: [PATCH] 2021-10-12

---
 src/views/printTemplate/index.jsx |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/views/printTemplate/index.jsx b/src/views/printTemplate/index.jsx
index 8be5e6e..3d8dd6c 100644
--- a/src/views/printTemplate/index.jsx
+++ b/src/views/printTemplate/index.jsx
@@ -2,7 +2,7 @@
 import { DndProvider } from 'react-dnd'
 import { is, fromJS } from 'immutable'
 import HTML5Backend from 'react-dnd-html5-backend'
-import { Card, notification, Row, Button, Modal, Input, Icon } from 'antd'
+import { Card, notification, Row, Button, Modal, Input, Icon, Switch } from 'antd'
 import DragElement from './dragelement'
 import MutilForm from './mutilform'
 import SourceElement from './dragelement/source'
@@ -44,7 +44,8 @@
     upPlus: 1,
     upMinus: 1,
     leftPlus: 1,
-    leftMinus: 1
+    leftMinus: 1,
+    debug: false
   }
 
   getclickpoint = (e) => {
@@ -335,19 +336,19 @@
   }
 
   resetbox = () => {
-    const { config } = this.state
+    const { config, debug } = this.state
 
     let ratio = (config.height || 1) / (config.width || 1)
 
     document.getElementById('darea').style.height = parseInt(document.getElementById('darea').style.width) * ratio + 'px'
 
-    printCtrl.sketch(config, null)
+    printCtrl.sketch(config, null, debug)
   }
 
   resetview () {
-    const { config, editItemId } = this.state
+    const { config, editItemId, debug } = this.state
 
-    printCtrl.sketch(config, editItemId)
+    printCtrl.sketch(config, editItemId, debug)
   }
 
   /**
@@ -769,7 +770,7 @@
     }
 
     new Promise(resolve => {
-      printCtrl.sketch(config, null).then(res => {
+      printCtrl.sketch(config, null, false).then(res => {
         let param = {
           Base64Img: res
         }
@@ -881,6 +882,14 @@
     })
   }
 
+  changeDebug = (val) => {
+    this.setState({
+      debug: val
+    }, () => {
+      this.resetview()
+    })
+  }
+
   render () {
     return (
       <div className="print-template">
@@ -897,6 +906,9 @@
               <Input addonBefore={<Icon title="璺濅笂" type="arrow-up" />} addonAfter={<Icon onClick={() => this.updatePosition('upMinus')} type="minus" />} onChange={(e) => this.change(e, 'upMinus')} value={this.state.upMinus} />
               <Input addonBefore={<Icon title="璺濆乏" type="arrow-left" />} addonAfter={<Icon onClick={() => this.updatePosition('leftPlus')} type="plus" />} onChange={(e) => this.change(e, 'leftPlus')} value={this.state.leftPlus} />
               <Input addonBefore={<Icon title="璺濆乏" type="arrow-left" />} addonAfter={<Icon onClick={() => this.updatePosition('leftMinus')} type="minus" />} onChange={(e) => this.change(e, 'leftMinus')} value={this.state.leftMinus} />
+              <div style={{marginTop: '10px'}}>
+                <span>璋冭瘯妯″紡锛�</span><Switch onChange={this.changeDebug} />
+              </div>
             </Card>
           </aside>
           <div className="switchbox" onClick={this.switchbox}></div>

--
Gitblit v1.8.0