Commit f812aa63 by 朱哲铨

bug 修复

parent 6fca9a19

50 KB | W: | H:

134 KB | W: | H:

build/icons/1024x1024.png
build/icons/1024x1024.png
build/icons/1024x1024.png
build/icons/1024x1024.png
  • 2-up
  • Swipe
  • Onion skin

3.09 KB | W: | H:

3.99 KB | W: | H:

build/icons/128x128.png
build/icons/128x128.png
build/icons/128x128.png
build/icons/128x128.png
  • 2-up
  • Swipe
  • Onion skin

299 Bytes | W: | H:

396 Bytes | W: | H:

build/icons/16x16.png
build/icons/16x16.png
build/icons/16x16.png
build/icons/16x16.png
  • 2-up
  • Swipe
  • Onion skin

461 Bytes | W: | H:

658 Bytes | W: | H:

build/icons/24x24.png
build/icons/24x24.png
build/icons/24x24.png
build/icons/24x24.png
  • 2-up
  • Swipe
  • Onion skin

7.21 KB | W: | H:

14.9 KB | W: | H:

build/icons/256x256.png
build/icons/256x256.png
build/icons/256x256.png
build/icons/256x256.png
  • 2-up
  • Swipe
  • Onion skin

632 Bytes | W: | H:

791 Bytes | W: | H:

build/icons/32x32.png
build/icons/32x32.png
build/icons/32x32.png
build/icons/32x32.png
  • 2-up
  • Swipe
  • Onion skin

1.02 KB | W: | H:

1.27 KB | W: | H:

build/icons/48x48.png
build/icons/48x48.png
build/icons/48x48.png
build/icons/48x48.png
  • 2-up
  • Swipe
  • Onion skin

17.3 KB | W: | H:

44 KB | W: | H:

build/icons/512x512.png
build/icons/512x512.png
build/icons/512x512.png
build/icons/512x512.png
  • 2-up
  • Swipe
  • Onion skin

1.42 KB | W: | H:

1.69 KB | W: | H:

build/icons/64x64.png
build/icons/64x64.png
build/icons/64x64.png
build/icons/64x64.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
No preview for this file type
{ {
"name": "Jomall_Graphics_Lab", "name": "JomallProductionAssistant",
"productName": "Jomall Graphics Lab", "productName": "JomallProductionAssistant",
"description": "", "description": "",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
......
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bDivide>false</bDivide>
<bTransColor>false</bTransColor>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<bUniPrint>false</bUniPrint>
<byResolution>1</byResolution>
<byInk>1</byInk>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>1</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file

11.6 KB | W: | H:

3.98 KB | W: | H:

src/assets/logo.jpg
src/assets/logo.jpg
src/assets/logo.jpg
src/assets/logo.jpg
  • 2-up
  • Swipe
  • Onion skin
import {downloadImage, toSend, writeProfileXml} from "@/backend/webserver/utils"; import { downloadImage, toSend, writeProfileXml } from "@/backend/webserver/utils";
const compressing = require('compressing'); const compressing = require("compressing");
var uuid = require("uuid"); var uuid = require("uuid");
const path = require('path'); const path = require("path");
const fs = require('fs'); const fs = require("fs");
const os = require('os'); const os = require("os");
import axios from "axios"; import axios from "axios";
var multiparty = require("multiparty"); var multiparty = require("multiparty");
let fn = new Object(); let fn = new Object();
fn.getPodProductionInfo = async (req, res) => { fn.getPodProductionInfo = async (req, res) => {
const token = req.headers["jwt-token"] const token = req.headers["jwt-token"];
const company = req.headers["company"] const company = req.headers["company"];
const productionNo = req.body.productionNo const productionNo = req.body.productionNo;
try { try {
let {data} = await axios.post(`https://${company}/api/podDesignCenter/getPodImageByProduction`, {productionNo}, {headers: {'jwt-token': token}}) let { data } = await axios.post(`https://${company}/api/podDesignCenter/getPodImageByProduction`, { productionNo }, { headers: { "jwt-token": token } });
if (data.code === 200 && data.data && data.data.length > 0) { console.log(data);
downloadImage(data.data, company, data => { if (data.code === 200 && data.data && data.data.length > 0) {
res.json({code: 200, data}) let f = data.data.find(el => !el.productionFile);
}, (err) => { data.data.forEach((el ) => {
res.json({code: 500, msg: '素材图下载失败'}) if (!el.productionFile.includes("http")) {
}) el.productionFile = el.productionFile.replace("/data/upload/erp", "");
} else { el.productionFile = `https://${company}/upload/erp/${el.productionFile}`;
res.json({code: 200, msg: '未找到素材图', data: []})
} }
} catch (err) { });
console.log(err) if (f) {
res.json({code: 500, msg: '接口调用失败'}) return res.json({ code: 500, msg: "存在地址错误的素材图" });
}
downloadImage(data.data, company, data => {
res.json({ code: 200, data });
}, (err) => {
res.json({ code: 500, msg: "素材图下载失败" });
});
} else {
res.json({ code: 200, msg: "未找到素材图", data: [] });
} }
} catch (err) {
console.log(err);
res.json({ code: 500, msg: "接口调用失败" });
}
} };
fn.findByPodProductionNo = async (req, res) => { fn.findByPodProductionNo = async (req, res) => {
const token = req.headers["jwt-token"] const token = req.headers["jwt-token"];
const company = req.headers["company"] const company = req.headers["company"];
const q = req.body const q = req.body;
try { try {
let {data} = await axios.get(`https://${company}/api/pod/podProductionInfo/findByPodProductionNo`, { let { data } = await axios.get(`https://${company}/api/pod/podProductionInfo/findByPodProductionNo`, {
params: q, params: q,
headers: {'jwt-token': token} headers: { "jwt-token": token }
}) });
res.json(data) res.json(data);
} catch (err) { } catch (err) {
res.json({code: 500, msg: err}) res.json({ code: 500, msg: err });
} }
} };
fn.getCompanyList = async (req, res) => { fn.getCompanyList = async (req, res) => {
try { try {
let {data} = await axios.get('https://platform.jomalls.com/api/tools/getCompanyList') let { data } = await axios.get("https://platform.jomalls.com/api/tools/getCompanyList");
res.send(data) res.send(data);
} catch (err) { } catch (err) {
console.log(err) console.log(err);
res.json({code: 500, msg: err}) res.json({ code: 500, msg: err });
} }
} };
fn.commitApply = async (req, res) => { fn.commitApply = async (req, res) => {
const company = req.headers["company"] const company = req.headers["company"];
const q = req.body const q = req.body;
try { try {
let {data} = await axios.post(`https://${company}/api/sysDeviceInfo/commitApply`, q) let { data } = await axios.post(`https://${company}/api/sysDeviceInfo/commitApply`, q);
res.send(data) res.send(data);
} catch (err) { } catch (err) {
console.log(err) console.log(err);
res.json({code: 500, msg: err}) res.json({ code: 500, msg: err });
} }
} };
fn.completeDelivery = async (req, res) => { fn.completeDelivery = async (req, res) => {
const token = req.headers["jwt-token"] const token = req.headers["jwt-token"];
const company = req.headers["company"] const company = req.headers["company"];
const q = req.body const q = req.body;
try { try {
let {data} = await axios.post(`https://${company}/api/pod/podProductionInfo/completeDelivery`, q, { let { data } = await axios.post(`https://${company}/api/pod/podProductionInfo/completeDelivery`, q, {
headers: {'jwt-token': token} headers: { "jwt-token": token }
}) });
res.json(data) res.json(data);
} catch (err) { } catch (err) {
res.json({code: 500, msg: err}) res.json({ code: 500, msg: err });
} }
} };
fn.downloadByDesignId = async (req, res) => { fn.downloadByDesignId = async (req, res) => {
let q = req.body let q = req.body;
try { try {
let dir = path.join(os.homedir(), '/Desktop/' + q.productionNo+'.zip') let dir = path.join(os.homedir(), "/Desktop/" + q.productionNo + ".zip");
const zipStream = new compressing.zip.Stream(); const zipStream = new compressing.zip.Stream();
for(let k in q.imgList){ for (let k in q.imgList) {
const p = path.join(process.cwd(),'./print/Input/'+q.imgList[k].fileName) const p = path.join(process.cwd(), "./print/Input/" + q.imgList[k].fileName);
zipStream.addEntry(p); zipStream.addEntry(p);
}
const destStream = fs.createWriteStream(dir);
zipStream.pipe(destStream)
.on('finish', () => {
console.log('success');
res.json({code: 200, msg: q.productionNo+'.zip' + '已下载到桌面'})
})
.on('error', () => {
res.json({code: 500, msg: '文件下载失败'})
});
// let ws=fs.createWriteStream(dir );
// console.log(downloadByDesignId)
//
// ws.write(downloadByDesignId.data);
// ws.on('drain',function () {
// console.log("内存干了");
// });
// ws.on('error',function (err) {
// res.json({code: 500, msg: '文件下载失败'})
// });
// ws.on('close',function (err) {
//
// });
// ws.end()
} catch (err) {
console.log(err)
res.json({code: 500, msg: err})
} }
} const destStream = fs.createWriteStream(dir);
zipStream.pipe(destStream)
.on("finish", () => {
console.log("success");
res.json({ code: 200, msg: q.productionNo + ".zip" + "已下载到桌面" });
})
.on("error", () => {
res.json({ code: 500, msg: "文件下载失败" });
});
// let ws=fs.createWriteStream(dir );
// console.log(downloadByDesignId)
//
// ws.write(downloadByDesignId.data);
// ws.on('drain',function () {
// console.log("内存干了");
// });
// ws.on('error',function (err) {
// res.json({code: 500, msg: '文件下载失败'})
// });
// ws.on('close',function (err) {
//
// });
// ws.end()
} catch (err) {
console.log(err);
res.json({ code: 500, msg: err });
}
};
fn.uploadImage = async (req, res) => { fn.uploadImage = async (req, res) => {
try { try {
const p = path.join(process.cwd(), './print/Input/') const p = path.join(process.cwd(), "./print/Input/");
let fileName = uuid.v4() + ".png"; let fileName = uuid.v4() + ".png";
console.log(fileName) console.log(fileName);
const form = new multiparty.Form({uploadDir: p}); const form = new multiparty.Form({ uploadDir: p });
form.parse(req, function (err, fields, files) { form.parse(req, function(err, fields, files) {
console.log(fields, files, err) console.log(fields, files, err);
if (err) { if (err) {
res.send({code: 500, err}) res.send({ code: 500, err });
} else { } else {
fs.renameSync(files.file[0].path, path.join(p, fileName)) fs.renameSync(files.file[0].path, path.join(p, fileName));
res.json({code: 200, data: {fileName, url: path.join(process.cwd(), './print/Input/' + fileName)}}) res.json({ code: 200, data: { fileName, url: path.join(process.cwd(), "./print/Input/" + fileName) } });
} }
}); });
} catch (err) { } catch (err) {
console.log(err) console.log(err);
res.json({code: 500, msg: err}) res.json({ code: 500, msg: err });
} }
} };
fn.getPngImg = async (req, res) => { fn.getPngImg = async (req, res) => {
try { try {
const filePath = path.join(process.cwd(), `./print/Input/${req.body.fileName}`); const filePath = path.join(process.cwd(), `./print/Input/${req.body.fileName}`);
console.log(filePath) console.log(filePath);
// 给客户端返回一个文件流 type类型 // 给客户端返回一个文件流 type类型
res.set('content-type', {"png": "image/png", "jpg": "image/jpeg"});//设置返回类型 res.set("content-type", { "png": "image/png", "jpg": "image/jpeg" });//设置返回类型
let stream = fs.createReadStream(filePath); let stream = fs.createReadStream(filePath);
let responseData = [];//存储文件流 let responseData = [];//存储文件流
if (stream) {//判断状态 if (stream) {//判断状态
stream.on('data', function (chunk) { stream.on("data", function(chunk) {
responseData.push(chunk); responseData.push(chunk);
}); });
stream.on('end', function () { stream.on("end", function() {
const finalData = Buffer.concat(responseData); const finalData = Buffer.concat(responseData);
res.write(finalData); res.write(finalData);
res.end(); res.end();
}); });
}
} catch (err) {
res.send({code: 500, msg: err})
} }
} catch (err) {
res.send({ code: 500, msg: err });
}
} };
fn.login = async (req, res) => { fn.login = async (req, res) => {
const {loginName, company, password, deviceId} = req.body const { loginName, company, password, deviceId } = req.body;
try { try {
let {data} = await axios.post(`https://${company}/api/sysLogin/login`, {loginName, password, deviceId}) let { data } = await axios.post(`https://${company}/api/sysLogin/login`, { loginName, password, deviceId });
res.send(data) res.send(data);
} catch (err) { } catch (err) {
console.log(err) console.log(err);
res.json({code: 500, msg: err}) res.json({ code: 500, msg: err });
} }
} };
fn.toPrint = (req, res) => { fn.toPrint = (req, res) => {
let body = req.body; let body = req.body;
writeProfileXml(body) // 写入xml文件 writeProfileXml(body); // 写入xml文件
// GTXproCMD.exe print -X "Profile\\CO12.xml" -I "Input\\sample.png" -A "Output\\pO12.arxp" -S 03000400 -L 02540254 // GTXproCMD.exe print -X "Profile\\CO12.xml" -I "Input\\sample.png" -A "Output\\pO12.arxp" -S 03000400 -L 02540254
toSend(body).then(r => { toSend(body).then(r => {
res.send({code: 200, msg: '操作成功'}) res.send({ code: 200, msg: "操作成功" });
}).catch(err => { }).catch(err => {
res.send({code: 500, msg: err}) res.send({ code: 500, msg: err });
}) });
}; };
export {fn as default}; export { fn as default };
import {exec, execSync} from "child_process"; import { exec, execSync } from "child_process";
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
var request = require("request"); var request = require("request");
var uuid = require("uuid"); var uuid = require("uuid");
const compressing = require("compressing");
function zip(from, to, callback, errorback) {
let dirName = path.join(to, uuid.v4());
console.log(dirName);
if (!fs.existsSync(dirName)) {
fs.mkdirSync(dirName);
}
let arr = [];
compressing.zip
.uncompress(from, dirName, { zipFileNameEncoding: "gbk" })
.then(() => {
console.log("success");
let data = fs.readdirSync(dirName);
data.forEach(el => {
let file_path = path.join(dirName, el);
console.log(file_path, to);
fs.renameSync(file_path, path.join(to, el));
arr.push({
fileName: el,
productionFile: path.join(to, el)
});
});
fs.unlinkSync(from); // 删除压缩包
fs.rmdirSync(dirName); // 删除目录文件
console.log(arr);
callback && callback(arr);
})
.catch(err => {
console.log(err);
errorback && errorback("压缩包解压失败");
});
}
// 下载素材 // 下载素材
export const downloadImage = (list, company, callback, errorBack = null) => { export const downloadImage = (list, company, callback, errorBack = null) => {
try { try {
let dirPath = path.join(process.cwd(), "./print/Input/"); let dirPath = path.join(process.cwd(), "./print/Input/");
if (!fs.existsSync(dirPath)) { if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath); fs.mkdirSync(dirPath);
}
for (let i = 0; i < list.length; i++) {
if (!list[i].productionFile) return
if (!list[i].productionFile.includes('http')) return;
let fileName = uuid.v4() + ".png";
let p = path.join(process.cwd(), './print/Input/' + fileName)
let stream = fs.createWriteStream(p);
list[i].fileName = fileName
request(list[i].productionFile).pipe(stream).on("close", function (err) {
console.log("文件[" + fileName + "]下载完毕");
if (i === list.length - 1) {
callback && callback(list)
}
});
}
} catch (err) {
console.log(err)
errorBack && errorBack(err)
} }
for (let i = 0; i < list.length; i++) {
if (list[i].productionFile && list[i].productionFile.includes("http")) {
let fileName = "";
let type = 2;
let flag =[
".zip",
".gzip",
".tar",
".taz",
".rar",
".7z",
".gz",
".bz2"
].filter(el=>list[i].productionFile.toLowerCase().includes(el)).length>0
if (
flag
) {
fileName = list[i].productionFile.split("/")[
list[i].productionFile.split("/").length - 1
];
type = 1;
} else {
fileName = uuid.v4() + ".png";
type = 2;
}
let p = path.join(process.cwd(), "./print/Input/" + fileName);
let stream = fs.createWriteStream(p);
list[i].fileName = fileName;
list[i].type = type;
console.log(list[i].productionFile);
request(list[i].productionFile)
.pipe(stream)
.on("close", function(err) {
console.log(6666666666,list[i]);
if (type === 1) {
} zip(
p,
// 传递素材给前端 dirPath,
export const sendImg = (filename = 'sample.png') => { data => {
let filePath = path.join(process.cwd(), './print/Input/' + filename) list[i].list = data;
if (!fs.existsSync(filePath)) { },
return false errorBack
);
} else {
if (i === list.length - 1) {
callback && callback(list);
}
}
});
}
} }
let data = fs.readFileSync(filePath); } catch (err) {
data = Buffer.from(data).toString('base64'); console.log(err);
return 'data:' + 'png' + ';base64,' + data; errorBack && errorBack(err);
}
} };
export const toSend = (body) => {
return new Promise((resolve, reject) => {
exec(
body.cmd,
{cwd: path.join(process.cwd(), 'print'), shell: true},
(err, stdout, stderr) => {
console.log(stdout, 1)
console.log(stderr, 2)
console.log(err, 4)
if (!err) {
exec(
body.print_cmd,
{cwd: path.join(process.cwd(), 'print'), shell: true},
(err2, stdout2, stderr2) => {
console.log(err2)
if (!err2) {
// 成功后删除 素材图,xml,output文件
// fs.unlinkSync(path.join(process.cwd(), 'print/Input/' + body.fileName))
// fs.unlinkSync(path.join(process.cwd(), 'print/Profile/' + body.fileName.replace('.png', '') + '.xml'))
// fs.unlinkSync(path.join(process.cwd(), 'print/Output/' + body.fileName.replace('.png', '') + '.arxp'))
resolve('操作成功')
} else {
reject('打印机参数错误')
}
})
} else { // 传递素材给前端
reject('生成arxp文件失败') export const sendImg = (filename = "sample.png") => {
} let filePath = path.join(process.cwd(), "./print/Input/" + filename);
if (!fs.existsSync(filePath)) {
}) return false;
}) }
} let data = fs.readFileSync(filePath);
data = Buffer.from(data).toString("base64");
export const writeProfileXml = (b) => { return "data:" + "png" + ";base64," + data;
try { };
let p = path.join(process.cwd(), `./print/Profile/${b.byInk}.xml`);
let file = fs.readFileSync(p, {encoding: "utf8"});
file = file.replace(/<uiCopies>(.*)<\/uiCopies>/i, `<uiCopies>${b.printNum}</uiCopies>`)
file = file.replace(/<byPlatenSize>(.*)<\/byPlatenSize>/i, `<byPlatenSize>${b.byPlatenSize}</byPlatenSize>`)
file = file.replace(/<bEcoMode>(.*)<\/bEcoMode>/i, `<bEcoMode>${b.bEcoMode}</bEcoMode>`)
file = file.replace(/<bMaterialBlack>(.*)<\/bMaterialBlack>/i, `<bMaterialBlack>${b.bMaterialBlack}</bMaterialBlack>`)
file = file.replace(/<byHighlight>(.*)<\/byHighlight>/i, `<byHighlight>${b.byHighlight}</byHighlight>`)
file = file.replace(/<byMask>(.*)<\/byMask>/i, `<byMask>${b.byMask}</byMask>`)
file = file.replace(/<bTransColor>(.*)<\/bTransColor>/i, `<bTransColor>${b.bTransColor}</bTransColor>`)
file = file.replace(/<bPause>(.*)<\/bPause>/i, `<bPause>${b.bPause}</bPause>`)
file = file.replace(/<bDivide>(.*)<\/bDivide>/i, `<bDivide>${b.bDivide}</bDivide>`)
file = file.replace(/<byChoke>(.*)<\/byChoke>/i, `<byChoke>${b.byChoke}</byChoke>`)
file = file.replace(/<byInk>(.*)<\/byInk>/i, `<byInk>${b.byInk}</byInk>`)
file = file.replace(/<bFastMode>(.*)<\/bFastMode>/i, `<bFastMode>${b.bFastMode}</bFastMode>`)
file = file.replace(/<byResolution>(.*)<\/byResolution>/i, `<byResolution>${1}</byResolution>`)
file = file.replace(/<byInkVolume>(.*)<\/byInkVolume>/i, `<byInkVolume>${b.byInkVolume}</byInkVolume>`)
file = file.replace(/<byDoublePrint>(.*)<\/byDoublePrint>/i, `<byDoublePrint>${b.byDoublePrint}</byDoublePrint>`)
file = file.replace(/<bMultiple>(.*)<\/bMultiple>/i, `<bMultiple>${b.bMultiple}</bMultiple>`)
file = file.replace(/<bySaturation>(.*)<\/bySaturation>/i, `<bySaturation>${b.bySaturation}</bySaturation>`)
file = file.replace(/<byBrightness>(.*)<\/byBrightness>/i, `<byBrightness>${b.byBrightness}</byBrightness>`)
file = file.replace(/<byContrast>(.*)<\/byContrast>/i, `<byContrast>${b.byContrast}</byContrast>`)
file = file.replace(/<iCyanBalance>(.*)<\/iCyanBalance>/i, `<iCyanBalance>${b.iCyanBalance}</iCyanBalance>`)
file = file.replace(/<iMagentaBalance>(.*)<\/iMagentaBalance>/i, `<iMagentaBalance>${b.iMagentaBalance}</iMagentaBalance>`)
file = file.replace(/<iYellowBalance>(.*)<\/iYellowBalance>/i, `<iYellowBalance>${b.iYellowBalance}</iYellowBalance>`)
file = file.replace(/<iBlackBalance>(.*)<\/iBlackBalance>/i, `<iBlackBalance>${b.iBlackBalance}</iBlackBalance>`)
file = file.replace(/<bUniPrint>(.*)<\/bUniPrint>/i, `<bUniPrint>${b.bUniPrint}</bUniPrint>`)
fs.writeFileSync(path.join(process.cwd(), `./print/Profile/${b.fileName.replace('.png', '')}.xml`), file)
} catch (err) { export const toSend = body => {
console.log(err) return new Promise((resolve, reject) => {
exec(
body.cmd,
{ cwd: path.join(process.cwd(), "print"), shell: true },
(err, stdout, stderr) => {
console.log(stdout, 1);
console.log(stderr, 2);
console.log(err, 4);
if (!err) {
exec(
body.print_cmd,
{ cwd: path.join(process.cwd(), "print"), shell: true },
(err2, stdout2, stderr2) => {
console.log(err2);
if (!err2) {
// 成功后删除 素材图,xml,output文件
// fs.unlinkSync(path.join(process.cwd(), 'print/Input/' + body.fileName))
// fs.unlinkSync(path.join(process.cwd(), 'print/Profile/' + body.fileName.replace('.png', '') + '.xml'))
// fs.unlinkSync(path.join(process.cwd(), 'print/Output/' + body.fileName.replace('.png', '') + '.arxp'))
resolve("操作成功");
} else {
reject("打印机参数错误");
}
}
);
} else {
reject("生成arxp文件失败");
}
}
);
});
};
} export const writeProfileXml = b => {
} try {
let p = path.join(process.cwd(), `./print/Profile/${b.byInk}.xml`);
let file = fs.readFileSync(p, { encoding: "utf8" });
file = file.replace(
/<uiCopies>(.*)<\/uiCopies>/i,
`<uiCopies>${b.printNum}</uiCopies>`
);
file = file.replace(
/<byPlatenSize>(.*)<\/byPlatenSize>/i,
`<byPlatenSize>${b.byPlatenSize}</byPlatenSize>`
);
file = file.replace(
/<bEcoMode>(.*)<\/bEcoMode>/i,
`<bEcoMode>${b.bEcoMode}</bEcoMode>`
);
file = file.replace(
/<bMaterialBlack>(.*)<\/bMaterialBlack>/i,
`<bMaterialBlack>${b.bMaterialBlack}</bMaterialBlack>`
);
file = file.replace(
/<byHighlight>(.*)<\/byHighlight>/i,
`<byHighlight>${b.byHighlight}</byHighlight>`
);
file = file.replace(
/<byMask>(.*)<\/byMask>/i,
`<byMask>${b.byMask}</byMask>`
);
file = file.replace(
/<bTransColor>(.*)<\/bTransColor>/i,
`<bTransColor>${b.bTransColor}</bTransColor>`
);
file = file.replace(
/<bPause>(.*)<\/bPause>/i,
`<bPause>${b.bPause}</bPause>`
);
file = file.replace(
/<bDivide>(.*)<\/bDivide>/i,
`<bDivide>${b.bDivide}</bDivide>`
);
file = file.replace(
/<byChoke>(.*)<\/byChoke>/i,
`<byChoke>${b.byChoke}</byChoke>`
);
file = file.replace(/<byInk>(.*)<\/byInk>/i, `<byInk>${b.byInk}</byInk>`);
file = file.replace(
/<bFastMode>(.*)<\/bFastMode>/i,
`<bFastMode>${b.bFastMode}</bFastMode>`
);
file = file.replace(
/<byResolution>(.*)<\/byResolution>/i,
`<byResolution>${1}</byResolution>`
);
file = file.replace(
/<byInkVolume>(.*)<\/byInkVolume>/i,
`<byInkVolume>${b.byInkVolume}</byInkVolume>`
);
file = file.replace(
/<byDoublePrint>(.*)<\/byDoublePrint>/i,
`<byDoublePrint>${b.byDoublePrint}</byDoublePrint>`
);
file = file.replace(
/<bMultiple>(.*)<\/bMultiple>/i,
`<bMultiple>${b.bMultiple}</bMultiple>`
);
file = file.replace(
/<bySaturation>(.*)<\/bySaturation>/i,
`<bySaturation>${b.bySaturation}</bySaturation>`
);
file = file.replace(
/<byBrightness>(.*)<\/byBrightness>/i,
`<byBrightness>${b.byBrightness}</byBrightness>`
);
file = file.replace(
/<byContrast>(.*)<\/byContrast>/i,
`<byContrast>${b.byContrast}</byContrast>`
);
file = file.replace(
/<iCyanBalance>(.*)<\/iCyanBalance>/i,
`<iCyanBalance>${b.iCyanBalance}</iCyanBalance>`
);
file = file.replace(
/<iMagentaBalance>(.*)<\/iMagentaBalance>/i,
`<iMagentaBalance>${b.iMagentaBalance}</iMagentaBalance>`
);
file = file.replace(
/<iYellowBalance>(.*)<\/iYellowBalance>/i,
`<iYellowBalance>${b.iYellowBalance}</iYellowBalance>`
);
file = file.replace(
/<iBlackBalance>(.*)<\/iBlackBalance>/i,
`<iBlackBalance>${b.iBlackBalance}</iBlackBalance>`
);
file = file.replace(
/<bUniPrint>(.*)<\/bUniPrint>/i,
`<bUniPrint>${b.bUniPrint}</bUniPrint>`
);
fs.writeFileSync(
path.join(
process.cwd(),
`./print/Profile/${b.fileName.replace(".png", "")}.xml`
),
file
);
} catch (err) {
console.log(err);
}
};
...@@ -4,60 +4,65 @@ import VueRouter from "vue-router"; ...@@ -4,60 +4,65 @@ import VueRouter from "vue-router";
Vue.use(VueRouter); Vue.use(VueRouter);
const routes = [ const routes = [
{ {
path: '/', path: "/",
name: 'login', name: "login",
meta: { meta: {
title: '登录' title: "登录"
},
component: (resolve) => require(['../views/login/index.vue'], resolve)
}, },
{ component: resolve => require(["../views/login/index.vue"], resolve)
path: '/design', },
name: 'design', {
meta: { path: "/design",
title: '设计页面' name: "design",
}, meta: {
component: (resolve) => require(['../views/design/index.vue'], resolve) title: "设计页面"
}, },
{ component: resolve => require(["../views/design/index.vue"], resolve)
path: '/design-copy', },
name: 'design', {
meta: { path: "/design-copy",
title: '设计页面' name: "design",
}, meta: {
component: (resolve) => require(['../views/design/copy.vue'], resolve) title: "设计页面"
}, {
path: '/design-detail',
name: 'design',
meta: {
title: '设计详情页面'
},
component: (resolve) => require(['../views/design/detail/index.vue'], resolve)
}, {
path: '*',
redirect: '/'
}, },
component: resolve => require(["../views/design/copy.vue"], resolve)
},
{
path: "/design-detail",
name: "design",
meta: {
title: "设计详情页面"
},
component: resolve => require(["../views/design/detail/index.vue"], resolve)
},
{
path: "*",
redirect: "/"
}
]; ];
const router = new VueRouter({ const router = new VueRouter({
mode: "hash", mode: "hash",
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes
}); });
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
let user = Vue.prototype.$dataStore.get('user') let user = Vue.prototype.$dataStore.get("user");
if (to.name === 'login') { if (to.name === "login") {
if (user) { if (user) {
console.log(1) console.log(1);
return next({path:'/design'}) return next({ path: "/design" });
} else {
return next( )
}
} else { } else {
return next() return next();
}
} else {
if (user) {
return next();
} else {
return next("/");
} }
}) }
});
export default router; export default router;
...@@ -4,52 +4,53 @@ import Vuex from "vuex"; ...@@ -4,52 +4,53 @@ import Vuex from "vuex";
Vue.use(Vuex); Vue.use(Vuex);
const defaultSetting = { const defaultSetting = {
gridShow: 1, gridShow: 1,
language: 'cn', language: "cn",
gridValue: 1, gridValue: 1,
autoPrint: false, autoPrint: false,
gridSpacing: "10mm" gridSpacing: "10mm"
} };
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
actionList:[], actionList: [],
imgList:[], imgList: [],
actionIndex:-1, actionIndex: -1,
systemSetting: { systemSetting: {
gridShow: 1, gridShow: 1,
gridValue: 1, gridValue: 1,
language: 'cn', unit: "mm",
autoPrint: false, language: "cn",
gridSpacing: "10mm" autoPrint: false,
} gridSpacing: 10
}
},
mutations: {
setDefaultSetting(state) {
state.systemSetting = JSON.parse(JSON.stringify(defaultSetting));
}, },
mutations: { updateSystemSetting(state, f) {
setDefaultSetting(state) { state.systemSetting[f.field] = f.value;
state.systemSetting = JSON.parse(JSON.stringify(defaultSetting))
},
updateSystemSetting(state, f) {
state.systemSetting[f.field] = f.value
},
changeActionList(state, value) {
state.actionList = value
},
changeActionIndex(state, value) {
state.actionIndex = value
},
changeImgList(state, value) {
state.imgList = value
}
}, },
getters: { changeActionList(state, value) {
systemSetting(state) { state.actionList = value;
return state.systemSetting;
},
getActionList(state) {
return state.actionList;
},
getActionIndex:(state)=> state.actionIndex,
imgList:(state)=> state.imgList
}, },
actions: {}, changeActionIndex(state, value) {
modules: {} state.actionIndex = value;
},
changeImgList(state, value) {
state.imgList = value;
}
},
getters: {
systemSetting(state) {
return state.systemSetting;
},
getActionList(state) {
return state.actionList;
},
getActionIndex: (state) => state.actionIndex,
imgList: (state) => state.imgList
},
actions: {},
modules: {}
}); });
import axios from 'axios' import axios from "axios";
import Vue from 'vue' import Vue from "vue";
import {Loading} from 'element-ui' import { Loading } from "element-ui";
import router from "../router/index"; import router from "../router/index";
// create an axios instance // create an axios instance
const service = axios.create({ const service = axios.create({
baseURL: 'http://localhost:3000', // url = base url + request url baseURL: "http://localhost:3000", // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
timeout: 50000000 // request timeout timeout: 50000000 // request timeout
}) });
let loading let loading;
function startLoading() { function startLoading() {
loading = Loading.service({ loading = Loading.service({
lock: true, lock: true,
text: '拼命加载中...', text: "拼命加载中...",
spinner: 'el-icon-loading', spinner: "el-icon-loading",
background: 'rgba(0,0,0,.7)' background: "rgba(0,0,0,.7)"
}) });
} }
function endLoading() { function endLoading() {
loading.close() loading.close();
} }
// Add a request interceptor // Add a request interceptor
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
const user = Vue.prototype.$dataStore.get('user') const user = Vue.prototype.$dataStore.get("user");
const company = Vue.prototype.$dataStore.get('company') const company = Vue.prototype.$dataStore.get("company");
if (user) { if (user) {
config.headers['jwt-token'] = user.token config.headers["jwt-token"] = user.token;
config.headers['company'] = company.domain config.headers["company"] = company.domain;
}
startLoading()
return config
},
error => {
endLoading()
// do something with request error
return Promise.reject(error)
} }
) startLoading();
return config;
},
error => {
endLoading();
// do something with request error
return Promise.reject(error);
}
);
// Add a response interceptor // Add a response interceptor
service.interceptors.response.use( service.interceptors.response.use(
/** /**
* If you want to get http information such as headers or status * If you want to get http information such as headers or status
* Please return response => response * Please return response => response
*/ */
/**
* Determine the request status by custom code
* Here is just an example
* You can also judge the status by HTTP Status Code
*/
response => {
// do something with response data
const res = response.data
endLoading()
if (res.code) {
if (res.code !== 200) {
if (res.code === 411) {
return Promise.resolve(res) /**
} * Determine the request status by custom code
if (res.code === 403) { * Here is just an example
router.replace('/') * You can also judge the status by HTTP Status Code
Vue.prototype.$message.error({showClose: true, message: res.msg || res.message || 'Error'}) */
Vue.prototype.$dataStore.delete('user') async response => {
return Promise.reject(new Error(res.msg || res.message || 'Error')) // do something with response data
} const res = response.data;
endLoading();
if (res.code) {
if (res.code !== 200) {
if (res.code === 411) {
return Promise.resolve(res);
}
if (res.code === 403) {
Vue.prototype.$dataStore.delete("user");
Vue.prototype.$message.error({
showClose: true,
message: res.msg || res.message || "Error"
});
setTimeout(() => {
location.reload();
}, 500);
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; return Promise.reject(new Error(res.msg || res.message || "Error"));
if (res.code === 50008 || res.code === 50012 || res.code === 50014) { }
// TODO: to re-login
}
Vue.prototype.$message.error({showClose: true, message: res.msg || res.message || 'Error'})
// reject
return Promise.reject(new Error(res.msg || res.message || 'Error'))
} else {
return Promise.resolve(res) // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
} if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// TODO: to re-login
} }
return Promise.resolve(res) Vue.prototype.$message.error({
}, showClose: true,
error => { message: res.msg || res.message || "Error"
endLoading() });
// do something with response error // reject
return Promise.reject(error) return Promise.reject(new Error(res.msg || res.message || "Error"));
} else {
return Promise.resolve(res);
}
} }
) return Promise.resolve(res);
},
error => {
endLoading();
// do something with response error
return Promise.reject(error);
}
);
export default service export default service;
export const grid = [
// {
// label: '7×8',
// value: 4,
// col: 7,
// row: 8
// },
// {
// label: '10×12',
// col: 10,
// value: 3,
// row: 12
// },
// {
// label: '14×16',
// col: 14,
// value: 2,
// row: 16
// },
{
label: "16×18",
value: 1,
row: 16,
col: 18,
h: 542,
w: 482
}
// {
// label: '16×21',
// value: 0,
// col: 16,
// row: 21
// }
];
\ No newline at end of file
export default { export default {
byInk:` byInk: `
<b>油墨选择</b> <b>油墨选择</b>
<p>选择所使用油墨的组合方式:</p> <p>选择所使用油墨的组合方式:</p>
<p>选择所使用油墨的组合方式:</p> <p>选择所使用油墨的组合方式:</p>
...@@ -7,30 +7,30 @@ export default { ...@@ -7,30 +7,30 @@ export default {
<p>仅彩色油墨:在白底或淡色底上打印彩色图像。</p> <p>仅彩色油墨:在白底或淡色底上打印彩色图像。</p>
<p>仅黑色油墨:只使用黑色油墨,打印黑白图像。</p> <p>仅黑色油墨:只使用黑色油墨,打印黑白图像。</p>
`, `,
bEcoMode:` bEcoMode: `
<b>模式</b> <b>模式</b>
<p>自动调整底材的白色油墨量,抑制整体的油墨消耗量。</p> <p>自动调整底材的白色油墨量,抑制整体的油墨消耗量。</p>
<p>但是,根据颜色,完成品的亮度有时会略微降低。</p> <p>但是,根据颜色,完成品的亮度有时会略微降低。</p>
`, `,
bMaterialBlack: bMaterialBlack:
` `
<b>利用底材的黑色</b> <b>利用底材的黑色</b>
<p>在黑色底材上打印时,利用底材的黑色打印时,设定为ON。</p> <p>在黑色底材上打印时,利用底材的黑色打印时,设定为ON。</p>
<p>自动将黑色(RGB=0)作为透明色处理。</p> <p>自动将黑色(RGB=0)作为透明色处理。</p>
<p>已在详细设置菜单中将其它颜色指定为透明色时,设定为OFF。</p> <p>已在详细设置菜单中将其它颜色指定为透明色时,设定为OFF。</p>
`, `,
bMultiple: bMultiple:
` `
<b>彩色的复合路径打印</b> <b>彩色的复合路径打印</b>
<p>彩色的复合路径打印是针对含有彩色的图像通过增加压板的进给次数(LF)来喷出更精细的油墨液滴。尽管打印时间变长,但可以更加细致地再现色彩。</p> <p>彩色的复合路径打印是针对含有彩色的图像通过增加压板的进给次数(LF)来喷出更精细的油墨液滴。尽管打印时间变长,但可以更加细致地再现色彩。</p>
`, `,
byHighlight: byHighlight:
` `
<b>高光</b> <b>高光</b>
<p>选择RGB=254的白度(浓度)。值越大,白度越增加。</p> <p>选择RGB=254的白度(浓度)。值越大,白度越增加。</p>
<p>打印HighlightCheckPattern.arxp选择适当的值。</p> <p>打印HighlightCheckPattern.arxp选择适当的值。</p>
`, `,
byMask: byMask:
` `
<b>遮光</b> <b>遮光</b>
<p>调节底材的白色油墨量。</p> <p>调节底材的白色油墨量。</p>
...@@ -40,62 +40,62 @@ export default { ...@@ -40,62 +40,62 @@ export default {
<p>4:用于红色、紫色、绿色等鲜艳的底色。</p> <p>4:用于红色、紫色、绿色等鲜艳的底色。</p>
<p>5:在暗色区以外的所有区域中以最大白色油墨量打印。</p> <p>5:在暗色区以外的所有区域中以最大白色油墨量打印。</p>
`, `,
bFastMode: bFastMode:
` `
<b>白色高速打印</b> <b>白色高速打印</b>
<p>在白色油墨使用模式下高速打印。油墨量和浓度不变。</p> <p>在白色油墨使用模式下高速打印。油墨量和浓度不变。</p>
<p>横纹明显时设定为OFF。</p> <p>横纹明显时设定为OFF。</p>
`, `,
bDivide: bDivide:
` `
<b>白色分次打印</b> <b>白色分次打印</b>
<p>分两层,每层用一半的油墨量进行白色打印。 <p>分两层,每层用一半的油墨量进行白色打印。
总油墨量不变。</p> 总油墨量不变。</p>
`, `,
bPause: bPause:
` `
<b>白色/彩色个别打印</b> <b>白色/彩色个别打印</b>
<p>打印白色层后,暂停(等待时间)后打印彩色层。打印极小的图像时请选择。</p> <p>打印白色层后,暂停(等待时间)后打印彩色层。打印极小的图像时请选择。</p>
`, `,
bTransColor: bTransColor:
` `
<b>透明色</b> <b>透明色</b>
<p>指定打印时不使用油墨而是作为透明色处理的颜色。</p> <p>指定打印时不使用油墨而是作为透明色处理的颜色。</p>
<p>根据颜色的再现性,建议取消选中[利用底材的黑色]。</p> <p>根据颜色的再现性,建议取消选中[利用底材的黑色]。</p>
`, `,
byChoke: byChoke:
` `
<b>白色油墨的削减范围</b> <b>白色油墨的削减范围</b>
<p>通过减少白色油墨的打印范围,防止白色油墨从彩色油墨下露出。</p> <p>通过减少白色油墨的打印范围,防止白色油墨从彩色油墨下露出。</p>
<p>通常为1-3,数字越大,白色油墨的削减量增力口。</p> <p>通常为1-3,数字越大,白色油墨的削减量增力口。</p>
<p>如果原图像的周围能看到白色的线或点,很可能是“抗锯齿“导致,请确认原图像。</p> <p>如果原图像的周围能看到白色的线或点,很可能是“抗锯齿“导致,请确认原图像。</p>
`, `,
byMinWhite: byMinWhite:
` `
<b>最小白色油墨量</b> <b>最小白色油墨量</b>
<p>设置值越大,使用“彩色+白色油墨"打印时的暗色区域底材的白色油墨量越增加。</p> <p>设置值越大,使用“彩色+白色油墨"打印时的暗色区域底材的白色油墨量越增加。</p>
<p>如果选择“特殊”,则设置值可以选择大于“3”的值。</p> <p>如果选择“特殊”,则设置值可以选择大于“3”的值。</p>
<p>请注意,设置值越大,越容易渗透。</p> <p>请注意,设置值越大,越容易渗透。</p>
`, `,
bySaturation: bySaturation:
` `
<b>饱和度</b> <b>饱和度</b>
<p>增加颜色的鲜艳度。请用于稍暗或色调不足的图像、CMYK颜色模式的图像、扫描仪的图像旁。</p> <p>增加颜色的鲜艳度。请用于稍暗或色调不足的图像、CMYK颜色模式的图像、扫描仪的图像旁。</p>
`, `,
byBrightness: byBrightness:
` `
<b>亮度</b> <b>亮度</b>
<p>值越大,颜色变得越亮。</p> <p>值越大,颜色变得越亮。</p>
`, `,
byContrast: byContrast:
` `
<b>对比度</b> <b>对比度</b>
<p>使亮的颜色更亮、暗的颜色更暗,从而给呆板的图像增加颜色强弱。</p> <p>使亮的颜色更亮、暗的颜色更暗,从而给呆板的图像增加颜色强弱。</p>
`, `,
iCyanBalance : iCyanBalance:
` `
<b>青色</b> <b>青色</b>
<p>调整青色油墨量。</p> <p>调整青色油墨量。</p>
...@@ -103,7 +103,7 @@ export default { ...@@ -103,7 +103,7 @@ export default {
<p>如果减少值,整体会偏红。</p> <p>如果减少值,整体会偏红。</p>
`, `,
iMagentaBalance : iMagentaBalance:
` `
<b>红色</b> <b>红色</b>
<p>调整青色油墨量。</p> <p>调整青色油墨量。</p>
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
<p>如果减少值,整体会偏绿。</p> <p>如果减少值,整体会偏绿。</p>
`, `,
iYellowBalance : iYellowBalance:
` `
<b>黄色</b> <b>黄色</b>
<p>调整黄色油墨量。</p> <p>调整黄色油墨量。</p>
...@@ -119,7 +119,7 @@ export default { ...@@ -119,7 +119,7 @@ export default {
<p>如果减少值,整体会偏蓝。</p> <p>如果减少值,整体会偏蓝。</p>
`, `,
iBlackBalance : iBlackBalance:
` `
<b>黑色</b> <b>黑色</b>
<p>调整黑色油墨量。</p> <p>调整黑色油墨量。</p>
...@@ -128,19 +128,19 @@ export default { ...@@ -128,19 +128,19 @@ export default {
`, `,
printTime : printTime:
` `
<b>打印时间</b> <b>打印时间</b>
<p>“x1”以按照高光5打印的时间作为标准。</p> <p>“x1”以按照高光5打印的时间作为标准。</p>
<p>提高高光增加了白色油墨量时打印时间变长。</p> <p>提高高光增加了白色油墨量时打印时间变长。</p>
`, `,
whiteInk : whiteInk:
` `
<b>白色油墨量</b> <b>白色油墨量</b>
<p>高光5的油墨量为“400%",以此作为标准。</p> <p>高光5的油墨量为“400%",以此作为标准。</p>
<p>实际油墨消耗量取决于打印图像内的色彩。请将其当作油墨消耗量的标准。</p> <p>实际油墨消耗量取决于打印图像内的色彩。请将其当作油墨消耗量的标准。</p>
`, `,
byInkVolume : byInkVolume:
` `
<b>油墨量</b> <b>油墨量</b>
<p>减少彩色油墨量以防止油墨渗透。</p> <p>减少彩色油墨量以防止油墨渗透。</p>
...@@ -150,11 +150,20 @@ export default { ...@@ -150,11 +150,20 @@ export default {
<p>6-4 用于薄平纹织物和棉/聚酯纤维/聚氨酯混纺。</p> <p>6-4 用于薄平纹织物和棉/聚酯纤维/聚氨酯混纺。</p>
<p>3-1用于聚酯纤维针织物和没有吸水性合成纤维。</p> <p>3-1用于聚酯纤维针织物和没有吸水性合成纤维。</p>
`, `,
bUniPrint : bUniPrint:
` `
<b>单向打印</b> <b>单向打印</b>
<p>将打印方向固定为一个方向。</p> <p>将打印方向固定为一个方向。</p>
<p>优先执行来自打印机操作面板的指定,仅在打印机的设置是[自动]时有效。</p> <p>优先执行来自打印机操作面板的指定,仅在打印机的设置是[自动]时有效。</p>
`,
byDoublePrint:
`
<b>2次打印</b>
<p>设置为0时,打印1次。</p>
<p>设置为1~3时,分2次打印。</p>
<p>分2次打印时,无需增加油墨消耗量也可期待提高黑度。</p>
<p>设置值越大,从第1次打印开始到第2次打印开始的间隔越长,可以更加期待提高黑度效果。</p>
` `
} };
\ No newline at end of file \ No newline at end of file
<script> <script>
import bus from '@/bus' import bus from "@/bus";
import PrintDialog from "./printDialog.vue"; import PrintDialog from "./printDialog.vue";
import {ipcRenderer} from "electron"; import { ipcRenderer } from "electron";
import { grid } from "../data";
export default { export default {
components: {PrintDialog}, components: { PrintDialog },
props: { props: {
user: { user: {
default: { default: {
avatar: '' avatar: ""
}, },
type: Object type: Object
}, },
...@@ -24,96 +24,73 @@ export default { ...@@ -24,96 +24,73 @@ export default {
actionIndex: -1, actionIndex: -1,
isAutoFinish: false, isAutoFinish: false,
showPrintDialog: false, showPrintDialog: false,
productionNo: '', productionNo: "",
setting: {}, setting: {
gridShow: 1,
gridValue: 0,
unit: "mm",
language: "cn",
autoPrint: false,
gridSpacing: 10
},
imgList: [], imgList: [],
detail: null, detail: null,
selectBgColor: '#ececec', selectBgColor: "#ececec",
predefineColors: [ predefineColors: [
'#ff4500', "#ff4500",
'#ff8c00', "#ff8c00",
'#ffd700', "#ffd700",
'#90ee90', "#90ee90",
'#00ced1', "#00ced1",
'#1e90ff', "#1e90ff",
'#c71585', "#c71585",
'rgba(255, 69, 0, 0.68)', "rgba(255, 69, 0, 0.68)",
'rgb(255, 120, 0)', "rgb(255, 120, 0)",
'hsv(51, 100, 98)', "hsv(51, 100, 98)",
'hsva(120, 40, 94, 0.5)', "hsva(120, 40, 94, 0.5)",
'hsl(181, 100%, 37%)', "hsl(181, 100%, 37%)",
'hsla(209, 100%, 56%, 0.73)', "hsla(209, 100%, 56%, 0.73)",
'#c7158577' "#c7158577"
], ],
grid: [ grid
// { };
// label: '7×8',
// value: 4,
// col: 7,
// row: 8
// },
// {
// label: '10×12',
// col: 10,
// value: 3,
// row: 12
// },
// {
// label: '14×16',
// col: 14,
// value: 2,
// row: 16
// },
{
label: '16×18',
value: 1,
col: 543,
row: 482
},
// {
// label: '16×21',
// value: 0,
// col: 16,
// row: 21
// }
]
}
}, },
computed: { computed: {
avatar() { avatar() {
if (this.user && this.user.avatar) { if (this.user && this.user.avatar) {
console.log(this.user, 9) console.log(this.user, 9);
let host = this.company.domain let host = this.company.domain;
if (host.includes('console')) { if (host.includes("console")) {
host = host.replace('.jomalls.com', '.joshine.cn') host = host.replace(".jomalls.com", ".joshine.cn");
} }
let avatar = this.user.avatar.includes('http') ? this.user.avatar : `https://${host}/erpimg/${this.user.avatar}` let avatar = this.user.avatar.includes("http") ? this.user.avatar : `https://${host}/erpimg/${this.user.avatar}`;
console.log(avatar) console.log(avatar);
return avatar return avatar;
} }
return '' return "";
}, },
actionList() { actionList() {
return this.$store.getters.getActionList return this.$store.getters.getActionList;
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.searchRef.focus() this.$refs.searchRef.focus();
}) });
}, },
created() { created() {
if(this.$dataStore.get('setting')){ if (this.$dataStore.get("setting")) {
this.setting = this.$dataStore.get('setting') this.setting = this.$dataStore.get("setting");
} else {
this.$dataStore.set("setting", this.setting);
} }
}, },
watch: { watch: {
setting: { setting: {
handler() { handler() {
this.$dataStore.set('setting', this.setting) this.$dataStore.set("setting", this.setting);
bus.$emit("busEmit", { type: "updateSystemSetting" });
}, },
deep: true deep: true
} }
...@@ -121,152 +98,197 @@ export default { ...@@ -121,152 +98,197 @@ export default {
methods: { methods: {
dropdownCommand(v) { dropdownCommand(v) {
switch (v) { switch (v) {
case 'logout': case "logout":
this.$confirm('是否退出登录?', '提示', { this.$confirm("是否退出登录?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning"
}).then(() => { }).then(() => {
this.$dataStore.delete('user') this.$dataStore.delete("user");
this.$router.push('/') this.$router.push("/");
}).catch(() => { }).catch(() => {
}); });
break break;
case 'company': case "company":
this.$confirm('是否切换系统?', '提示', { this.$confirm("是否切换系统?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning"
}).then(() => { }).then(() => {
this.$dataStore.delete('company') this.$dataStore.delete("company");
this.$dataStore.delete('user') this.$dataStore.delete("user");
this.$router.push('/') this.$router.push("/");
}).catch(() => { }).catch(() => {
}); });
break;
case "clear":
// this.$confirm("是否清除缓存?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning"
// }).then(() => {
// for (let k in this.$dataStore.store) {
// this.$dataStore.delete(k);
// }
// location.reload();
// }).catch(() => {
//
// });
break;
} }
}, },
async setData(data) { async setData(data) {
if (!data) return this.$message.warning('请扫描生产单号') if (!data) return this.$message.warning("请扫描生产单号");
await this.$api.post('/completeDelivery', {id: data.id}).then(() => { await this.$api.post("/completeDelivery", { id: data.id }).then(() => {
}) });
this.$message.success('成功生产完成') this.$message.success("成功生产完成");
}, },
async sureData() { async sureData() {
if (!this.detail || Object.keys(this.detail).length <= 1) { if (!this.detail || Object.keys(this.detail).length <= 1) {
return this.$message.warning('请扫描生产单号') return this.$message.warning("请扫描生产单号");
} }
this.$confirm( this.$confirm(
`确定生产完成?`, `确定生产完成?`,
'提示', "提示",
{ {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning"
} }
).then(async () => { ).then(async () => {
await this.setData(this.detail) await this.setData(this.detail);
}) });
}, },
async downloadImage() { async downloadImage() {
if (!this.detail || Object.keys(this.detail).length === 0) return this.$message.warning('请扫描生产单号') if (!this.detail || Object.keys(this.detail).length === 0) return this.$message.warning("请扫描生产单号");
let params = { let params = {
productionNo: this.detail.podProductionNo, productionNo: this.detail.podProductionNo,
imgList: this.imgList imgList: this.imgList
} };
let res = await this.$api.post('/downloadByDesignId', params) let res = await this.$api.post("/downloadByDesignId", params);
this.$message.success(res.msg) this.$message.success(res.msg);
}, },
async getDataInfo() { async getDataInfo() {
if (this.detail && Object.keys(this.detail).length > 0 && this.isAutoFinish) { if (this.detail && Object.keys(this.detail).length > 0 && this.isAutoFinish) {
await this.setData(this.detail) await this.setData(this.detail);
} }
if (this.productionNo === '') return this.$message.warning('请录入生产单号') if (this.productionNo === "") return this.$message.warning("请录入生产单号");
try { try {
const findByPodProductionNo = await this.$api.post('/findByPodProductionNo', { const findByPodProductionNo = await this.$api.post("/findByPodProductionNo", {
podProductionNo: this.productionNo, podProductionNo: this.productionNo,
status: 'IN_PRODUCTION' status: "IN_PRODUCTION"
}) });
this.detail = findByPodProductionNo.data this.detail = findByPodProductionNo.data;
ipcRenderer.send('win-subScreen', findByPodProductionNo.data) ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
} catch (err) { } catch (err) {
this.productionNo = '' this.productionNo = "";
this.$refs.searchRef.focus() this.$refs.searchRef.focus();
} }
try { try {
let res = await this.$api.post('/getPodProductionInfo', {productionNo: this.productionNo}) let res = await this.$api.post("/getPodProductionInfo", { productionNo: this.productionNo });
if (res.data.length === 0) return this.$message.warning('未找到素材图!') if (res.data.length === 0) return this.$message.warning("未找到素材图!");
for (let i = 0; i < res.data.length; i++) { let arr = [];
this.$api.post('/getPngImg', {fileName: res.data[i].fileName}, { res.data.forEach(el => {
headers: { arr.push(el);
'responseType': 'blob' if (el.list) {
} el.list.forEach(it => {
}).then(r => { arr.push({
...it,
res.data[i].file = new File([r], res.data[i].fileName, {type: 'image/png'}) ...{
if (i === res.data.length - 1) { designId:el.designId
this.imgList = res.data }
bus.$emit('busEmit', {type: 'sendFile', value: res.data}) });
} });
}) }
} });
this.productionNo = '' console.log(arr,'arr');
this.$refs.searchRef.focus() res.data = arr.filter(el=>el.type!==1);
// for (let i = 0; i < res.data.length; i++) {
// this.$api.post("/getPngImg", { fileName: res.data[i].fileName }, {
// headers: {
// "responseType": "blob"
// }
// }).then(r => {
//
// res.data[i].file = new File([r], res.data[i].fileName, { type: "image/png" });
// if (i === res.data.length - 1) {
// this.imgList = res.data;
//
// }
// });
// }
bus.$emit("busEmit", { type: "sendFile", value: res.data });
this.productionNo = "";
this.$refs.searchRef.focus();
} catch (err) { } catch (err) {
bus.$emit('busEmit', {type: 'sendFile', value: []}) bus.$emit("busEmit", { type: "sendFile", value: [] });
this.productionNo = '' this.productionNo = "";
this.$refs.searchRef.focus() this.$refs.searchRef.focus();
} }
}, },
changeActionIndex(t) { changeActionIndex(t) {
let index = this.actionIndex let index = this.actionIndex;
if (t === '+') { if (t === "+") {
if (index === this.$store.state.actionList.length - 1) return; if (index === this.$store.state.actionList.length - 1) return;
this.actionIndex = this.actionIndex + 1 this.actionIndex = this.actionIndex + 1;
} else { } else {
if (index === 0) return if (index === 0) return;
this.actionIndex = this.actionIndex - 1 this.actionIndex = this.actionIndex - 1;
} }
console.log(this.actionIndex, 88) console.log(this.actionIndex, 88);
bus.$emit('busEmit', {type: 'index', value: this.actionIndex}) bus.$emit("busEmit", { type: "index", value: this.actionIndex });
this.$store.commit('changeActionIndex', this.actionIndex) this.$store.commit("changeActionIndex", this.actionIndex);
}, },
setDefaultSetting() { setDefaultSetting() {
this.$store.commit('setDefaultSetting') this.$store.commit("setDefaultSetting");
this.setting = JSON.parse(JSON.stringify(this.$store.getters.systemSetting)) this.setting = {
this.$message.success('重置应用程序设置成功') gridShow: 1,
gridValue: 0,
unit: "mm",
language: "cn",
autoPrint: false,
gridSpacing: 10
};
this.$message.success("重置应用程序设置成功");
}, },
settingChange(field, value) { settingChange(field, value) {
this.$store.commit('updateSystemSetting', {field, value}); if (value === "inch") {
this.setting.gridSpacing = 1;
} else if (value === "mm") {
this.setting.gridSpacing = 20;
}
this.$store.commit("updateSystemSetting", { field, value });
}, },
setBg() { setBg() {
bus.$emit('busEmit', {type: 'bg', value: this.selectBgColor}) bus.$emit("busEmit", { type: "bg", value: this.selectBgColor });
}, },
async uploadImage(f) { async uploadImage(f) {
let formData = new FormData() let formData = new FormData();
formData.append('file', f) formData.append("file", f);
let {data} = await this.$api.post('/uploadImage', formData, { let { data } = await this.$api.post("/uploadImage", formData, {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
} }
}) });
bus.$emit('busEmit', {type: 'uploadImage', value: data}) bus.$emit("busEmit", { type: "uploadImage", value: data });
return false return false;
}, },
command(i) { command(i) {
this.selectGridIndex = i this.selectGridIndex = i;
this.$store.commit('updateSystemSetting', {field: 'gridValue', value: this.grid[i]}) this.setting.gridValue = i;
bus.$emit('busEmit', {type: 'grid', value: this.grid[i]}) this.$store.commit("updateSystemSetting", { field: "gridValue", value: this.grid[i] });
}, bus.$emit("busEmit", { type: "grid", value: this.grid[i] });
}
} }
} };
</script> </script>
<style scoped> <style scoped>
.page-header { .page-header {
...@@ -327,33 +349,41 @@ export default { ...@@ -327,33 +349,41 @@ export default {
<!-- </el-tooltip>--> <!-- </el-tooltip>-->
<el-tooltip content="背景色"> <el-tooltip content="背景色">
<el-color-picker <el-color-picker
style="margin-right: 3px" style="margin-right: 3px"
v-model="selectBgColor" v-model="selectBgColor"
@change="setBg" @change="setBg"
color-format="hex" color-format="hex"
:predefine="predefineColors"> :predefine="predefineColors">
</el-color-picker> </el-color-picker>
</el-tooltip> </el-tooltip>
<el-popover <el-popover
width="320" width="320"
:offset="-120" :offset="-120"
trigger="click" trigger="click"
placement="bottom" placement="bottom"
> >
<div class="setting-form"> <div class="setting-form">
<el-form :model="setting" label-position="left" size="small"> <el-form :model="setting" label-position="left" label-width="80px" size="small">
<el-form-item prop="setting" label="网格显示"> <el-form-item prop="setting" label="网格显示">
<el-select @change="(e)=>settingChange('gridShow',e)" clearable v-model="setting.gridShow"> <el-select @change="(e)=>settingChange('gridShow',e)" clearable v-model="setting.gridShow">
<el-option :value="1" label="未缩放的网格"></el-option> <el-option :value="1" label="未缩放的网格"></el-option>
<el-option :value="0" label="无"></el-option> <el-option :value="0" label="无"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="gridSpacing" label="单位">
<el-select @change="(e)=>settingChange('unit',e)" clearable v-model="setting.unit">
<el-option value="mm" label="mm"></el-option>
<el-option value="inch" label="inch"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="gridSpacing" label="网格间隔"> <el-form-item prop="gridSpacing" label="网格间隔">
<el-select @change="(e)=>settingChange('gridSpacing',e)" clearable v-model="setting.gridSpacing"> <el-select @change="(e)=>settingChange('gridSpacing',e)" clearable v-model="setting.gridSpacing">
<el-option value="20mm" label="20mm"></el-option> <el-option v-if="setting.unit==='mm'" :value="20" :label="`20 ${setting.unit}`"></el-option>
<el-option value="10mm" label="10mm"></el-option> <el-option v-if="setting.unit==='mm'" :value="10" :label="`10 ${setting.unit}`"></el-option>
<el-option v-if="setting.unit==='inch'" :value="1" :label="`1 ${setting.unit}`"></el-option>
<el-option v-if="setting.unit==='inch'" :value="0.5" :label="`0.5 ${setting.unit}`"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="language" label="语言设置"> <el-form-item prop="language" label="语言设置">
...@@ -406,6 +436,7 @@ export default { ...@@ -406,6 +436,7 @@ export default {
<el-dropdown @command="dropdownCommand"> <el-dropdown @command="dropdownCommand">
<b style="cursor:pointer;">{{ user.employeeName }}</b> <b style="cursor:pointer;">{{ user.employeeName }}</b>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item command="clear">清除缓存</el-dropdown-item>-->
<el-dropdown-item command="company">切换系统</el-dropdown-item> <el-dropdown-item command="company">切换系统</el-dropdown-item>
<el-dropdown-item command="logout">退出登录</el-dropdown-item> <el-dropdown-item command="logout">退出登录</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
......
<script> <script>
import fieldDescription from "./fieldDescription"; import fieldDescription from "./fieldDescription";
import {ipcRenderer} from "electron" import { ipcRenderer } from "electron";
import axios from 'axios' import axios from "axios";
import html2canvas from 'html2canvas' import html2canvas from "html2canvas";
export default { export default {
data() { data() {
...@@ -13,36 +13,36 @@ export default { ...@@ -13,36 +13,36 @@ export default {
printerList: [], printerList: [],
printSettingList: [], printSettingList: [],
printSettingVal: 0, printSettingVal: 0,
description: '', description: "",
printSettingSelectLabel: 'default', printSettingSelectLabel: "default",
printer: '', printer: "",
settingName: '', settingName: "",
printInkList: [ printInkList: [
{ {
label: '仅彩色油墨', label: "仅彩色油墨"
}, },
{ {
label: '仅白色油墨' label: "仅白色油墨"
}, },
{ {
label: '彩色 + 白色油墨' label: "彩色 + 白色油墨"
}, },
{ {
label: '仅黑色油墨' label: "仅黑色油墨"
}, }
], ],
detailShow: false, detailShow: false,
showPopover: false, showPopover: false,
printSetting: { printSetting: {
printer: '', printer: "",
xy: '', xy: "",
byInk: 2, byInk: 2,
byInkVolume: 1, byInkVolume: 1,
byDoublePrint: 3, byDoublePrint: 3,
bEcoMode: false, bEcoMode: false,
bMaterialBlack: false, bMaterialBlack: false,
byHighlight: 1, byHighlight: 5,
printNum: 1, printNum: 1,
bFastMode: false, bFastMode: false,
bUniPrint: false, bUniPrint: false,
...@@ -60,9 +60,9 @@ export default { ...@@ -60,9 +60,9 @@ export default {
iBlackBalance: 0, iBlackBalance: 0,
iYellowBalance: 0, iYellowBalance: 0,
byMinWhite: 1, byMinWhite: 1,
bMultiple: false, bMultiple: false
} }
} };
}, },
props: { props: {
visible: { visible: {
...@@ -74,263 +74,274 @@ export default { ...@@ -74,263 +74,274 @@ export default {
type: Number type: Number
}, },
imgList: { imgList: {
default: [], default: () => [],
type: Array type: Array
} }
}, },
mounted() { mounted() {
this.$dataStore.set('default-print-setting', this.printSetting) this.$dataStore.set("default-print-setting", this.printSetting);
let select = this.$dataStore.get('print-setting-select') this.getPrintSettingList(()=>{
if (select) { let select = this.$dataStore.get("print-setting-select");
this.printSettingSelectLabel = select console.log(this.$dataStore, "select");
let index = this.printSettingList.findIndex(el => el.label === select) if (select) {
if (index >= 0) { this.printSettingSelectLabel = select;
this.printSettingVal = index let index = this.printSettingList.findIndex(el => el.label === select);
this.printSetting = JSON.parse(JSON.stringify(this.printSettingList[index].value)) if (index >= 0) {
this.printSettingVal = index;
this.printSetting = JSON.parse(
JSON.stringify(this.printSettingList[index].value)
);
} else {
this.printSettingVal = 0;
this.printSetting = JSON.parse(
JSON.stringify(this.printSettingList[0].value)
);
}
} else { } else {
this.printSettingVal = 0 this.printSettingVal = 0;
this.printSetting = JSON.parse(JSON.stringify(this.printSettingList[0].value)) this.printSetting = JSON.parse(
JSON.stringify(this.printSettingList[0].value)
);
} }
} else { });
this.printSettingVal = 0
this.printSetting = JSON.parse(JSON.stringify(this.printSettingList[0].value))
}
}, },
computed: { computed: {
inkNum() { inkNum() {
return 200 + (Number(this.printSetting.byHighlight) * 50) - 50 return 200 + (Number(this.printSetting.byHighlight) * 50) - 50;
}, },
defaultTime() { defaultTime() {
if ([6, 7].includes(Number(this.printSetting.byHighlight))) { if ([6, 7].includes(Number(this.printSetting.byHighlight))) {
return '1.25' return "1.25";
} else if (this.printSetting.byHighlight < 6) { } else if (this.printSetting.byHighlight < 6) {
return '1.00' return "1.00";
} else { } else {
return '1.5' return "1.5";
} }
} }
}, },
watch: { watch: {
visible() { visible() {
this.dialogShow = this.visible this.dialogShow = this.visible;
} }
}, },
created() { created() {
this.getPrinter() this.getPrinter();
this.getPrintSettingList()
}, },
methods: { methods: {
delSetting() { delSetting() {
this.$confirm( this.$confirm(
`确定删除该预设?`, `确定删除该预设?`,
'提示', "提示",
{ {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning"
} }
).then(() => { ).then(() => {
this.$dataStore.delete(this.printSettingList[this.printSettingVal].label + '-print-setting') this.$dataStore.delete(this.printSettingList[this.printSettingVal].label + "-print-setting");
this.getPrintSettingList() this.getPrintSettingList();
this.printSettingVal = 0 this.printSettingVal = 0;
}) });
}, },
getPrintSettingList() { getPrintSettingList(callback) {
let arr = [] let arr = [];
for (let k in this.$dataStore.store) { for (let k in this.$dataStore.store) {
if (k.includes('-print-setting')) { if (k.includes("-print-setting")) {
arr.push({ arr.push({
label: k.replace('-print-setting', ''), label: k.replace("-print-setting", ""),
value: this.$dataStore.get(k) value: this.$dataStore.get(k)
}) });
} }
} }
this.printSettingList = arr this.printSettingList = arr;
callback && callback();
}, },
printSettingChange(v) { printSettingChange(v) {
let label = this.printSettingList[v].label let label = this.printSettingList[v].label;
this.$dataStore.set('print-setting-select', label) this.$dataStore.set("print-setting-select", label);
this.printSetting = JSON.parse(JSON.stringify(this.printSettingList[v].value)) this.printSetting = JSON.parse(JSON.stringify(this.printSettingList[v].value));
}, },
saveSetting() { saveSetting() {
if (this.settingName.trim() === '') { if (this.settingName.trim() === "") {
return this.$message.warning('预设名称不能为空') return this.$message.warning("预设名称不能为空");
} }
if (this.printSettingList.find(el => el.label === this.settingName)) { if (this.printSettingList.find(el => el.label === this.settingName)) {
return this.$message.warning('预设名称不能重复') return this.$message.warning("预设名称不能重复");
} }
this.$dataStore.set(`${this.settingName}-print-setting`, this.printSetting) this.$dataStore.set(`${this.settingName}-print-setting`, this.printSetting);
this.showPopover = false this.showPopover = false;
this.printSettingVal = this.printSettingList.length this.printSettingVal = this.printSettingList.length;
this.getPrintSettingList() this.getPrintSettingList();
}, },
openPopover() { openPopover() {
this.showPopover = true this.showPopover = true;
this.settingName = '' this.settingName = "";
}, },
singleStr(str) { singleStr(str) {
if (Number(str) >= 0) { if (Number(str) >= 0) {
str = str.toString().replace('.', '') str = str.toString().replace(".", "");
if (str.length >= 4) { if (str.length >= 4) {
str = str.slice(0, 5) str = str.slice(0, 5);
} else if (str.length === 3) { } else if (str.length === 3) {
str = '0' + str str = "0" + str;
} else if (str.length === 2) { } else if (str.length === 2) {
str = '00' + str str = "00" + str;
} else if (str.length === 1) { } else if (str.length === 1) {
str = '000' + str str = "000" + str;
} }
} else { } else {
str = str.toString().replace('.', '').replace('-', '') str = str.toString().replace(".", "").replace("-", "");
if (str.length >= 4) { if (str.length >= 4) {
str = str.slice(0, 5) str = str.slice(0, 5);
} else if (str.length === 3) { } else if (str.length === 3) {
str = '0' + str str = "0" + str;
} else if (str.length === 2) { } else if (str.length === 2) {
str = '00' + str str = "00" + str;
} else if (str.length === 1) { } else if (str.length === 1) {
str = '000' + str str = "000" + str;
} }
str = '-' + str str = "-" + str;
} }
// 不足四位前面用0补齐 // 不足四位前面用0补齐
console.log(str) console.log(str);
return str return str;
}, },
dataURLtoBlob(dataurl) { dataURLtoBlob(dataurl) {
var arr = dataurl.split(',') var arr = dataurl.split(",");
//注意base64的最后面中括号和引号是不转译的 //注意base64的最后面中括号和引号是不转译的
var _arr = arr[1].substring(0, arr[1].length - 2) var _arr = arr[1].substring(0, arr[1].length - 2);
var mime = arr[0].match(/:(.*?);/)[1], var mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(_arr), bstr = atob(_arr),
n = bstr.length, n = bstr.length,
u8arr = new Uint8Array(n) u8arr = new Uint8Array(n);
while (n--) { while (n--) {
u8arr[n] = bstr.charCodeAt(n) u8arr[n] = bstr.charCodeAt(n);
} }
return new Blob([u8arr], { return new Blob([u8arr], {
type: mime type: mime
}) });
}, },
moreImageCmd(arr) { moreImageCmd(arr) {
var canvas1 = document.createElement("canvas"); var canvas1 = document.createElement("canvas");
let _canvas = document.getElementsByClassName('sucaitu')[0];//目标块 let _canvas = document.getElementsByClassName("sucaitu")[0];//目标块
var bodyW = parseInt(window.getComputedStyle(_canvas).width) var bodyW = parseInt(window.getComputedStyle(_canvas).width);
var bodyH = parseInt(window.getComputedStyle(_canvas).height) var bodyH = parseInt(window.getComputedStyle(_canvas).height);
canvas1.width = bodyW; canvas1.width = bodyW;
canvas1.height = bodyH; canvas1.height = bodyH;
canvas1.style.width = bodyW + "px"; canvas1.style.width = bodyW + "px";
canvas1.style.height = bodyH + "px"; canvas1.style.height = bodyH + "px";
canvas1.style.background = 'transparent'; canvas1.style.background = "transparent";
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
document.body.scrollTop = 0; document.body.scrollTop = 0;
var context = canvas1.getContext("2d"); var context = canvas1.getContext("2d");
// context.scale(2, 2); // context.scale(2, 2);
let that = this let that = this;
html2canvas(_canvas, { html2canvas(_canvas, {
canvas: canvas1, canvas: canvas1,
backgroundColor: null, backgroundColor: null,
useCORS: true, useCORS: true,
allowTaint: true allowTaint: true
}).then(async function (canvas) { }).then(async function(canvas) {
let dataURL = canvas.toDataURL('image/png') let dataURL = canvas.toDataURL("image/png");
let pageBlob = that.dataURLtoBlob(dataURL) let pageBlob = that.dataURLtoBlob(dataURL);
let params = new FormData() let params = new FormData();
let fileOfBlob = new File([pageBlob], new Date().getTime() + '.jpg') let fileOfBlob = new File([pageBlob], new Date().getTime() + ".jpg");
params.append('file', fileOfBlob) params.append("file", fileOfBlob);
let {data} = await that.$api.post('/uploadImage', params, { let { data } = await that.$api.post("/uploadImage", params, {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
} }
}) });
let w_mm = Number((canvas1.width * 0.84183).toFixed(1)) let w_mm = Number((canvas1.width * 0.84183).toFixed(1));
let h_mm = Number((canvas1.height * 0.84183).toFixed(1)) let h_mm = Number((canvas1.height * 0.84183).toFixed(1));
let size = `${that.singleStr(Number(w_mm).toFixed(1))}${that.singleStr(Number(h_mm).toFixed(1))}` let size = `${that.singleStr(Number(w_mm).toFixed(1))}${that.singleStr(Number(h_mm).toFixed(1))}`;
await that.sendCmd(data.fileName, size, '00000000', 0) await that.sendCmd(data.fileName, size, "00000000", 0);
//canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载 //canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载
// document.querySelector(".down").setAttribute('href', canvas.toDataURL()); // document.querySelector(".down").setAttribute('href', canvas.toDataURL());
}); });
}, },
async getPrintCmd() { async getPrintCmd() {
if (this.imgList.length === 0) return this.$message.warning('素材不能为空') if (this.imgList.length === 0) return this.$message.warning("素材不能为空");
console.log(this.imgList[0]) console.log(this.imgList[0]);
if (this.imgList.length > 1) { if (this.imgList.length > 1) {
let dom = document.getElementsByClassName('drr') let dom = document.getElementsByClassName("drr");
for (let i = 0; i < dom.length; i++) { for (let i = 0; i < dom.length; i++) {
dom[i].classList.remove("active") dom[i].classList.remove("active");
dom[i].classList.add("inactive") dom[i].classList.add("inactive");
} }
setTimeout(() => { setTimeout(() => {
this.moreImageCmd(this.imgList) this.moreImageCmd(this.imgList);
}, 500) }, 500);
return return;
} }
let {x, y, r, w, h} = this.imgList[0] let { x, y, r, w, h } = this.imgList[0];
y = (Number(y) - Number(h) / 2) y = (Number(y) - Number(h) / 2);
x = (Number(x) - Number(w) / 2) x = (Number(x) - Number(w) / 2);
let x_mm = Number((x * 0.84183).toFixed(1)) let x_mm = Number((x * 0.84183).toFixed(1));
let w_mm = Number((w * 0.84183).toFixed(1)) let w_mm = Number((w * 0.84183).toFixed(1));
let h_mm = Number((h * 0.84183).toFixed(1)) let h_mm = Number((h * 0.84183).toFixed(1));
let y_mm = Number((y * 0.84183).toFixed(1)) let y_mm = Number((y * 0.84183).toFixed(1));
console.log(x_mm, y_mm) console.log(x_mm, y_mm);
r = Number(r).toFixed(0) r = Number(r).toFixed(0);
const imgFileName = this.imgList[0].fileName const imgFileName = this.imgList[0].fileName;
let position = '' // 位置 let position = ""; // 位置
let size = '' // 图像大小 let size = ""; // 图像大小
if (Number(x_mm) < 0 || Number(y_mm) < 0) { if (Number(x_mm) < 0 || Number(y_mm) < 0) {
position = `"${this.singleStr(Number(x_mm).toFixed(1))},${this.singleStr(Number(y_mm).toFixed(1))}"` position = `"${this.singleStr(Number(x_mm).toFixed(1))},${this.singleStr(Number(y_mm).toFixed(1))}"`;
} else { } else {
position = `${this.singleStr(x_mm.toFixed(1))}${this.singleStr(y_mm.toFixed(1))}` position = `${this.singleStr(x_mm.toFixed(1))}${this.singleStr(y_mm.toFixed(1))}`;
} }
size = `${this.singleStr(Number(w_mm).toFixed(1))}${this.singleStr(Number(h_mm).toFixed(1))}` size = `${this.singleStr(Number(w_mm).toFixed(1))}${this.singleStr(Number(h_mm).toFixed(1))}`;
const bigNum = '0031131' // 图像放大倍数 -R const bigNum = "0031131"; // 图像放大倍数 -R
await this.sendCmd(imgFileName, size, position, r) await this.sendCmd(imgFileName, size, position, r);
}, },
async sendCmd(imgFileName, size, position, r) { async sendCmd(imgFileName, size, position, r) {
const whitePrint = [1, 2].includes(this.printSetting.byInk) ? 1 : 0 // 白色打印 const whitePrint = [1, 2].includes(this.printSetting.byInk) ? 1 : 0; // 白色打印
let cmd = `GTXproCMD.exe print -X "${`Profile\\${imgFileName.replace('.png', '')}.xml`}" -I "${'Input\\' + imgFileName}" -A "Output\\${imgFileName.replace('.png', '')}.arxp" -S ${size} -L ${position} -D ${r} -W ${whitePrint}` let cmd = `GTXproCMD.exe print -X "${`Profile\\${imgFileName.replace(".png", "")}.xml`}" -I "${"Input\\" + imgFileName}" -A "Output\\${imgFileName.replace(".png", "")}.arxp" -S ${size} -L ${position} -D ${r} -W ${whitePrint}`;
let print_cmd = `GTXproCMD.exe send -A "Output\\${imgFileName.replace('.png', '')}.arxp" -P "${this.printer}` let print_cmd = `GTXproCMD.exe send -A "Output\\${imgFileName.replace(".png", "")}.arxp" -P "${this.printer}`;
let data = { let data = {
...this.printSetting, ...this.printSetting,
...{ ...{
byPlatenSize: this.byPlatenSize, byPlatenSize: this.byPlatenSize,
cmd, cmd,
fileName: imgFileName, fileName: imgFileName,
print_cmd, print_cmd
} }
} };
let res = await this.$api.post('/toPrint', data) let res = await this.$api.post("/toPrint", data);
this.$message.success(res.msg) this.$message.success(res.msg);
}, },
async getPrinter() { async getPrinter() {
ipcRenderer.send('allPrint') ipcRenderer.send("allPrint");
ipcRenderer.once('printName', (event, data) => { ipcRenderer.once("printName", (event, data) => {
console.log(data, 996) // data就是返回的打印机数据列表 console.log(data, 996); // data就是返回的打印机数据列表
this.printerList = data this.printerList = data;
if (this.printerList.length > 0) { if (this.printerList.length > 0) {
this.printer = this.printerList[0].name this.printer = this.printerList[0].name;
} }
}) });
}, },
setDetailShow() { setDetailShow() {
this.detailShow = !this.detailShow this.detailShow = !this.detailShow;
} }
} }
} };
</script> </script>
<template> <template>
...@@ -351,10 +362,10 @@ export default { ...@@ -351,10 +362,10 @@ export default {
</el-select> </el-select>
<div style="margin-left: 15px;display: flex" class="save-btn"> <div style="margin-left: 15px;display: flex" class="save-btn">
<el-popover <el-popover
placement="bottom" placement="bottom"
width="200" width="200"
v-model="showPopover" v-model="showPopover"
trigger="manual"> trigger="manual">
<el-button style="margin-right: 10px" @click="openPopover" slot="reference" type="primary">保存预设 <el-button style="margin-right: 10px" @click="openPopover" slot="reference" type="primary">保存预设
</el-button> </el-button>
<div class="save-setting"> <div class="save-setting">
...@@ -403,7 +414,7 @@ export default { ...@@ -403,7 +414,7 @@ export default {
</template> </template>
<div v-if="printSetting.byInk===2"> <div v-if="printSetting.byInk===2">
<el-form-item <el-form-item
label="利用底材的黑色"> label="利用底材的黑色">
<el-switch v-model="printSetting.bMaterialBlack"></el-switch> <el-switch v-model="printSetting.bMaterialBlack"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -416,7 +427,7 @@ export default { ...@@ -416,7 +427,7 @@ export default {
<div v-if="printSetting.byInk!==1" <div v-if="printSetting.byInk!==1"
> >
<el-form-item <el-form-item
label="彩色的复合路径打印"> label="彩色的复合路径打印">
<el-switch v-model="printSetting.bMultiple"></el-switch> <el-switch v-model="printSetting.bMultiple"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -489,7 +500,7 @@ export default { ...@@ -489,7 +500,7 @@ export default {
</template> </template>
<div v-if="[2].includes(printSetting.byInk)"> <div v-if="[2].includes(printSetting.byInk)">
<el-form-item <el-form-item
label="白色高速打印"> label="白色高速打印">
<el-switch v-model="printSetting.bFastMode"></el-switch> <el-switch v-model="printSetting.bFastMode"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -500,7 +511,7 @@ export default { ...@@ -500,7 +511,7 @@ export default {
</template> </template>
<div> <div>
<el-form-item <el-form-item
label="白色分次打印"> label="白色分次打印">
<el-switch v-model="printSetting.bDivide"></el-switch> <el-switch v-model="printSetting.bDivide"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -512,7 +523,7 @@ export default { ...@@ -512,7 +523,7 @@ export default {
<div v-if="[2].includes(printSetting.byInk)" <div v-if="[2].includes(printSetting.byInk)"
> >
<el-form-item <el-form-item
label="白色/彩色个别打印"> label="白色/彩色个别打印">
<el-switch v-model="printSetting.bPause"></el-switch> <el-switch v-model="printSetting.bPause"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -534,7 +545,7 @@ export default { ...@@ -534,7 +545,7 @@ export default {
<div v-if="[2].includes(printSetting.byInk)" <div v-if="[2].includes(printSetting.byInk)"
> >
<el-form-item <el-form-item
label="白色油墨的削减范围"> label="白色油墨的削减范围">
<div class="flex-row"> <div class="flex-row">
<el-slider :step="1" :min="0" :max="10" v-model="printSetting.byChoke"></el-slider> <el-slider :step="1" :min="0" :max="10" v-model="printSetting.byChoke"></el-slider>
<span>{{ printSetting.byChoke }}</span> <span>{{ printSetting.byChoke }}</span>
...@@ -549,7 +560,7 @@ export default { ...@@ -549,7 +560,7 @@ export default {
<div v-if="[2].includes(printSetting.byInk)" <div v-if="[2].includes(printSetting.byInk)"
> >
<el-form-item <el-form-item
label="最小白色油墨量"> label="最小白色油墨量">
<div class="flex-column"> <div class="flex-column">
<el-select v-model="printSetting.minWhiteInkType"> <el-select v-model="printSetting.minWhiteInkType">
<el-option label="通常" :value="0"></el-option> <el-option label="通常" :value="0"></el-option>
...@@ -615,7 +626,7 @@ export default { ...@@ -615,7 +626,7 @@ export default {
<div v-if="[1].includes(printSetting.byInk)" <div v-if="[1].includes(printSetting.byInk)"
> >
<el-form-item <el-form-item
label="单向打印"> label="单向打印">
<el-switch v-model="printSetting.bUniPrint"></el-switch> <el-switch v-model="printSetting.bUniPrint"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -685,7 +696,7 @@ export default { ...@@ -685,7 +696,7 @@ export default {
</template> </template>
<div> <div>
<el-form-item <el-form-item
label="单向打印"> label="单向打印">
<el-switch v-model="printSetting.bUniPrint"></el-switch> <el-switch v-model="printSetting.bUniPrint"></el-switch>
</el-form-item> </el-form-item>
</div> </div>
...@@ -693,7 +704,7 @@ export default { ...@@ -693,7 +704,7 @@ export default {
</div> </div>
<el-button size="small" @click="setDetailShow">{{ <el-button size="small" @click="setDetailShow">{{
detailShow ? '关闭详细设置' : '打开详细设置' detailShow ? "关闭详细设置" : "打开详细设置"
}}... }}...
</el-button> </el-button>
</div> </div>
......
<script> <script>
import VueDragResizeRotate from "@minogin/vue-drag-resize-rotate"; import VueDragResizeRotate from "@minogin/vue-drag-resize-rotate";
import { grid } from "../data";
import ImgSetting from './imgSetting.vue' import ImgSetting from "./imgSetting.vue";
import bus from '@/bus' import bus from "@/bus";
import PrintDialog from "@/views/design/head/printDialog.vue"; import PrintDialog from "@/views/design/head/printDialog.vue";
import {debounce} from 'lodash' import { debounce } from "lodash";
const img = require('../../../assets/bg_tshirt_shadow.png') const img = require("../../../assets/bg_tshirt_shadow.png");
export default { export default {
components: { components: {
PrintDialog, PrintDialog,
VueDragResizeRotate, VueDragResizeRotate,
ImgSetting, ImgSetting
}, },
destroyed() { destroyed() {
document.removeEventListener('keyup', this.keyup) document.removeEventListener("keyup", this.keyup);
document.removeEventListener('dragover', this.dragover) document.removeEventListener("dragover", this.dragover);
document.removeEventListener('drop', this.drop) document.removeEventListener("drop", this.drop);
}, },
computed: {
sysSetting() {
if(this.$dataStore.get('setting')){
return this.$dataStore.get('setting')
}else{
return this.$store.getters.systemSetting
}
computed: {
gridWH() {
if (!this.systemSetting || !this.grid || !this.grid[this.systemSetting.gridValue]) return { w: 0, h: 0 };
return {
w: this.grid[this.systemSetting.gridValue].w,
h: this.grid[this.systemSetting.gridValue].h
};
}, },
gridSpacing() { gridSpacing() {
return this.sysSetting.gridSpacing.slice(0, 2) + 'px' if (!this.systemSetting) return { w: 0, h: 0 };
if (this.systemSetting.unit === "mm") {
return { w: this.systemSetting.gridSpacing + "px", h: this.systemSetting.gridSpacing + "px" };
} else if (this.systemSetting.unit === "inch") {
console.log(this.systemSetting.gridValue);
let w = this.grid[this.systemSetting.gridValue].w;
let row = this.grid[this.systemSetting.gridValue].row;
let col = this.grid[this.systemSetting.gridValue].col;
let h = this.grid[this.systemSetting.gridValue].h;
return {
w: this.systemSetting.gridSpacing * ((w - row + 1) / row) + "px",
h: this.systemSetting.gridSpacing * ((h) / col) + "px"
};
}
}, },
computedGridSize() { computedGridSize() {
const getter = this.sysSetting const getter = this.systemSetting;
const num = getter.gridSpacing.slice(0, 2) const num = getter.gridSpacing.slice(0, 2);
return 10 + 'px' return 10 + "px";
}, },
returnItem() { returnItem() {
if (this.selectIndex < 0) { if (this.selectIndex < 0) {
this.showImgSetting = false this.showImgSetting = false;
return null return null;
} }
let item = this.imgList[this.selectIndex] let item = this.imgList[this.selectIndex];
if (item) { if (item) {
item = JSON.parse(JSON.stringify(item)) item = JSON.parse(JSON.stringify(item));
item.x = Number(item.x) - Number(item.w) item.x = Number(item.x) - Number(item.w);
item.y = Number(item.y) + (Number(item.h) / 2) item.y = Number(item.y) + (Number(item.h) / 2);
return JSON.parse(JSON.stringify(this.imgList[this.selectIndex])) return JSON.parse(JSON.stringify(this.imgList[this.selectIndex]));
} }
this.showImgSetting = false this.showImgSetting = false;
return null return null;
} }
}, },
...@@ -58,9 +72,11 @@ export default { ...@@ -58,9 +72,11 @@ export default {
return { return {
actionList: [], actionList: [],
parentWidth: 0, parentWidth: 0,
systemSetting: {},
imgHeight: 0, imgHeight: 0,
selectImgList: [], selectImgList: [],
bus: 0, bus: 0,
grid,
showImgSetting: false, showImgSetting: false,
parentHeight: 0, parentHeight: 0,
width: 0, width: 0,
...@@ -75,26 +91,25 @@ export default { ...@@ -75,26 +91,25 @@ export default {
row: 8, row: 8,
img, img,
col: 7 col: 7
} };
}, },
watch: { watch: {
imgList: { imgList: {
handler() { handler() {
if (this.imgList.length > 0) { if (this.imgList.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {
let dom = document.getElementsByClassName('drr') let dom = document.getElementsByClassName("drr");
this.imgList.forEach((el, i) => { this.imgList.forEach((el, i) => {
let dom_i = document.getElementsByClassName('drr')[i] let dom_i = document.getElementsByClassName("drr")[i];
dom_i.style.zIndex = dom_i.style.zIndex === '' || !dom_i.style.zIndex ? 0 : dom_i.style.zIndex dom_i.style.zIndex = dom_i.style.zIndex === "" || !dom_i.style.zIndex ? 0 : dom_i.style.zIndex;
dom[i].addEventListener('click', (e) => { dom[i].addEventListener("click", (e) => {
this.selectIndex = i this.selectIndex = i;
this.selectItem(i) this.selectItem(i);
}) });
}) });
}) });
} }
this.$store.commit('changeImgList', this.imgList) this.$store.commit("changeImgList", this.imgList);
}, },
deep: true, deep: true,
immediate: true immediate: true
...@@ -102,85 +117,85 @@ export default { ...@@ -102,85 +117,85 @@ export default {
selectIndex() { selectIndex() {
if (this.selectIndex >= 0) { if (this.selectIndex >= 0) {
if (!this.showImgSetting) { if (!this.showImgSetting) {
this.showImgSetting = true this.showImgSetting = true;
} }
} else { } else {
this.showImgSetting = false this.showImgSetting = false;
} }
} }
}, },
methods: { methods: {
async drop(e) { async drop(e) {
let that = this let that = this;
e.stopPropagation(); e.stopPropagation();
//阻止浏览器默认打开文件的操作 //阻止浏览器默认打开文件的操作
e.preventDefault(); e.preventDefault();
console.log(e) console.log(e);
const files = e.dataTransfer.files; const files = e.dataTransfer.files;
if (files.length === 0) return if (files.length === 0) return;
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
if (files[i].type !== 'image/png') { if (files[i].type !== "image/png") {
return that.$message.warning('只能上传png格式文件') return that.$message.warning("只能上传png格式文件");
} }
let formData = new FormData() let formData = new FormData();
formData.append('file', files[i]) formData.append("file", files[i]);
let {data} = await that.$api.post('/uploadImage', formData, { let { data } = await that.$api.post("/uploadImage", formData, {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
} }
}) });
that.selectImgIndex = 0 that.selectImgIndex = 0;
that.addFile(data, file => { that.addFile(data, file => {
that.imgHistoryList.push(JSON.parse(JSON.stringify(that.imgList))) that.imgHistoryList.push(JSON.parse(JSON.stringify(that.imgList)));
}) });
} }
}, },
dragover(e) { dragover(e) {
e.stopPropagation(); e.stopPropagation();
//阻止浏览器默认打开文件的操作 //阻止浏览器默认打开文件的操作
e.preventDefault(); e.preventDefault();
e.dataTransfer.dropEffect = 'copy'; e.dataTransfer.dropEffect = "copy";
}, },
keyup(e) { keyup(e) {
console.log(e) console.log(e);
if (e.keyCode == 90 && e.ctrlKey) { if (e.keyCode == 90 && e.ctrlKey) {
let i = this.imgHistoryList.length - (2 + this.imgHistoryIndex) let i = this.imgHistoryList.length - (2 + this.imgHistoryIndex);
if (this.imgHistoryList[i]) { if (this.imgHistoryList[i]) {
this.imgList = JSON.parse(JSON.stringify(this.imgHistoryList[i])) this.imgList = JSON.parse(JSON.stringify(this.imgHistoryList[i]));
this.imgHistoryIndex = this.imgHistoryIndex + 1 this.imgHistoryIndex = this.imgHistoryIndex + 1;
} }
} }
if (this.selectIndex >= 0) { if (this.selectIndex >= 0) {
if (e.keyCode === 38) { if (e.keyCode === 38) {
//上 //上
this.$set(this.imgList[this.selectIndex], 'y', Number(this.imgList[this.selectIndex].y) - 1) this.$set(this.imgList[this.selectIndex], "y", Number(this.imgList[this.selectIndex].y) - 1);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
} }
if (e.keyCode === 40) { if (e.keyCode === 40) {
//下 //下
this.$set(this.imgList[this.selectIndex], 'y', Number(this.imgList[this.selectIndex].y) + 1) this.$set(this.imgList[this.selectIndex], "y", Number(this.imgList[this.selectIndex].y) + 1);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
} }
if (e.keyCode === 37) { if (e.keyCode === 37) {
//左 //左
this.$set(this.imgList[this.selectIndex], 'x', Number(this.imgList[this.selectIndex].x) - 1) this.$set(this.imgList[this.selectIndex], "x", Number(this.imgList[this.selectIndex].x) - 1);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
} }
if (e.keyCode === 39) { if (e.keyCode === 39) {
//右 //右
this.$set(this.imgList[this.selectIndex], 'x', Number(this.imgList[this.selectIndex].x) + 1) this.$set(this.imgList[this.selectIndex], "x", Number(this.imgList[this.selectIndex].x) + 1);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
} }
} }
if (e.keyCode === 8) { if (e.keyCode === 8) {
if (this.selectIndex >= 0) { if (this.selectIndex >= 0) {
this.imgList.splice(this.selectIndex, 1) this.imgList.splice(this.selectIndex, 1);
if (this.imgList.length > 0) { if (this.imgList.length > 0) {
this.selectIndex = 0 this.selectIndex = 0;
} else { } else {
this.selectIndex = -1 this.selectIndex = -1;
} }
} }
...@@ -188,23 +203,23 @@ export default { ...@@ -188,23 +203,23 @@ export default {
}, },
debounce, debounce,
indexChange(v) { indexChange(v) {
console.log(v) console.log(v);
if (this.imgList.length === 0) return; if (this.imgList.length === 0) return;
let index = !this.imgList[this.selectIndex] ? 0 : this.selectIndex let index = !this.imgList[this.selectIndex] ? 0 : this.selectIndex;
let item = this.$store.state.actionList[v] let item = this.$store.state.actionList[v];
if (!item) return; if (!item) return;
if (item.t === 'drag') { if (item.t === "drag") {
this.$set(this.imgList[index], 'x', item.x) this.$set(this.imgList[index], "x", item.x);
this.$set(this.imgList[index], 'y', item.y) this.$set(this.imgList[index], "y", item.y);
} else if (item.t === 'resize') { } else if (item.t === "resize") {
this.$set(this.imgList[index], 'x', item.x) this.$set(this.imgList[index], "x", item.x);
this.$set(this.imgList[index], 'y', item.y) this.$set(this.imgList[index], "y", item.y);
this.$set(this.imgList[index], 'w', item.w) this.$set(this.imgList[index], "w", item.w);
this.$set(this.imgList[index], 'h', item.h) this.$set(this.imgList[index], "h", item.h);
} }
console.log() console.log();
}, },
getOneMmsPx() { getOneMmsPx() {
// 创建一个1mm宽的元素插入到页面,然后坐等出结果 // 创建一个1mm宽的元素插入到页面,然后坐等出结果
...@@ -222,67 +237,67 @@ export default { ...@@ -222,67 +237,67 @@ export default {
// this.selectImgIndexList.push(i) // this.selectImgIndexList.push(i)
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList)) // this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this.getBackFile([it], file => { this.getBackFile([it], file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}) });
}, },
ev(type) { ev(type) {
if (this.selectIndex < 0) return if (this.selectIndex < 0) return;
// if (this.selectIndex === -1) this.selectIndex = 0 // if (this.selectIndex === -1) this.selectIndex = 0
if (!this.imgList[this.selectIndex]) return if (!this.imgList[this.selectIndex]) return;
let w = document.getElementById('line').clientWidth / 2 let w = document.getElementById("line").clientWidth / 2;
let h = document.getElementById('line').clientHeight / 2 let h = document.getElementById("line").clientHeight / 2;
let dom = document.getElementsByClassName('drr')[this.selectIndex] let dom = document.getElementsByClassName("drr")[this.selectIndex];
let z_index = dom.style.zIndex === '' || !dom.style.zIndex ? 0 : dom.style.zIndex let z_index = dom.style.zIndex === "" || !dom.style.zIndex ? 0 : dom.style.zIndex;
switch (type) { switch (type) {
case 'center': case "center":
this.$set(this.imgList[this.selectIndex], 'x', Number(w)) this.$set(this.imgList[this.selectIndex], "x", Number(w));
this.$set(this.imgList[this.selectIndex], 'y', Number(h)) this.$set(this.imgList[this.selectIndex], "y", Number(h));
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
break; break;
case 'x_center': case "x_center":
this.$set(this.imgList[this.selectIndex], 'x', Number(w)) this.$set(this.imgList[this.selectIndex], "x", Number(w));
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
break; break;
case 'y_center': case "y_center":
this.$set(this.imgList[this.selectIndex], 'y', Number(h)) this.$set(this.imgList[this.selectIndex], "y", Number(h));
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
break; break;
case 'add_index': case "add_index":
dom.style.zIndex = Number(z_index) + 1 dom.style.zIndex = Number(z_index) + 1;
console.log(dom.style.zIndex) console.log(dom.style.zIndex);
this.$set(this.imgList[this.selectIndex], 'zIndex', this.imgList[this.selectIndex].zIndex + 1) this.$set(this.imgList[this.selectIndex], "zIndex", this.imgList[this.selectIndex].zIndex + 1);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
break; break;
case 'reduce_index': case "reduce_index":
dom.style.zIndex = Number(z_index) - 1 dom.style.zIndex = Number(z_index) - 1;
console.log(dom.style.zIndex) console.log(dom.style.zIndex);
this.$set(this.imgList[this.selectIndex], 'zIndex', this.imgList[this.selectIndex].zIndex - 1) this.$set(this.imgList[this.selectIndex], "zIndex", this.imgList[this.selectIndex].zIndex - 1);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
break; break;
default: default:
break break;
} }
}, },
formChange(form) { formChange(form) {
// if (this.selectIndex === -1) this.selectIndex = 0 // if (this.selectIndex === -1) this.selectIndex = 0
if (!this.imgList[this.selectIndex]) return if (!this.imgList[this.selectIndex]) return;
let f = JSON.parse(JSON.stringify(form)) let f = JSON.parse(JSON.stringify(form));
let x_mm = f.x let x_mm = f.x;
let w_mm = f.w let w_mm = f.w;
let h_mm = f.h let h_mm = f.h;
let y_mm = f.y let y_mm = f.y;
this.$set(this.imgList[this.selectIndex], 'x', x_mm) this.$set(this.imgList[this.selectIndex], "x", x_mm);
this.$set(this.imgList[this.selectIndex], 'y', y_mm) this.$set(this.imgList[this.selectIndex], "y", y_mm);
this.$set(this.imgList[this.selectIndex], 'w', w_mm) this.$set(this.imgList[this.selectIndex], "w", w_mm);
this.$set(this.imgList[this.selectIndex], 'h', h_mm) this.$set(this.imgList[this.selectIndex], "h", h_mm);
this.$set(this.imgList[this.selectIndex], 'r', f.r) this.$set(this.imgList[this.selectIndex], "r", f.r);
this.$set(this.imgList[this.selectIndex], 'zIndex', f.zIndex) this.$set(this.imgList[this.selectIndex], "zIndex", f.zIndex);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
close() { close() {
this.showImgSetting = false this.showImgSetting = false;
}, },
onDragDebounce(left, top, item, index) { onDragDebounce(left, top, item, index) {
...@@ -290,8 +305,8 @@ export default { ...@@ -290,8 +305,8 @@ export default {
dragStop(data, item) { dragStop(data, item) {
this.$set(item, 'y', data.y) this.$set(item, "y", data.y);
this.$set(item, 'x', data.x) this.$set(item, "x", data.x);
// console.log(left, top) // console.log(left, top)
// if (!this.imgList[this.selectIndex]) return // if (!this.imgList[this.selectIndex]) return
// this.$set(this.imgList[this.selectIndex], 'x', left) // this.$set(this.imgList[this.selectIndex], 'x', left)
...@@ -302,17 +317,17 @@ export default { ...@@ -302,17 +317,17 @@ export default {
// x: left, // x: left,
// y: top // y: top
// }) // })
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
// this.$store.commit('changeActionList', this.actionList) // this.$store.commit('changeActionList', this.actionList)
}, },
resizeStop(data, item) { resizeStop(data, item) {
// if (this.selectIndex === -1) this.selectIndex = 0 // if (this.selectIndex === -1) this.selectIndex = 0
console.log('drag', this.selectIndex) console.log("drag", this.selectIndex);
if (this.selectIndex < 0) return if (this.selectIndex < 0) return;
this.$set(item, 'y', data.y) this.$set(item, "y", data.y);
this.$set(item, 'w', data.w) this.$set(item, "w", data.w);
this.$set(item, 'h', data.h) this.$set(item, "h", data.h);
this.$set(item, 'x', data.x) this.$set(item, "x", data.x);
// console.log(this.selectIndex,'resize',x, y, w, h) // console.log(this.selectIndex,'resize',x, y, w, h)
// this.actionList.unshift({ // this.actionList.unshift({
...@@ -323,49 +338,49 @@ export default { ...@@ -323,49 +338,49 @@ export default {
// h // h
// }) // })
// this.$store.commit('changeActionList', this.actionList) // this.$store.commit('changeActionList', this.actionList)
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
resizing(index) { resizing(index) {
}, },
rotating(data, item) { rotating(data, item) {
console.log(data) console.log(data);
this.$set(item, 'r', data.angle.toFixed(2)) this.$set(item, "r", data.angle.toFixed(2));
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
outsideClick(e) { outsideClick(e) {
if (!(e.target.className.includes('drr') || e.target.className.includes('sucaitu-img'))) { if (!(e.target.className.includes("drr") || e.target.className.includes("sucaitu-img"))) {
this.selectIndex = -1 this.selectIndex = -1;
this.close() this.close();
} }
}, },
selectItem(index) { selectItem(index) {
let dom = document.getElementsByClassName('drr') let dom = document.getElementsByClassName("drr");
for (let i = 0; i < dom.length; i++) { for (let i = 0; i < dom.length; i++) {
if (index !== i) { if (index !== i) {
dom[i].classList.remove("active") dom[i].classList.remove("active");
dom[i].classList.add("inactive") dom[i].classList.add("inactive");
} }
} }
this.selectIndex = index this.selectIndex = index;
}, },
deSelect(index) { deSelect(index) {
console.log(index, 222222222) console.log(index, 222222222);
this.close() this.close();
this.selectIndex = -1 this.selectIndex = -1;
}, },
delImg(index) { delImg(index) {
console.log(index, 'index') console.log(index, "index");
this.imgList.splice(index, 1) this.imgList.splice(index, 1);
if (this.imgList.length > 0) { if (this.imgList.length > 0) {
this.selectIndex = 0 this.selectIndex = 0;
this.showImgSetting = true this.showImgSetting = true;
} else { } else {
this.selectIndex = -1 this.selectIndex = -1;
} }
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
fileToBase64(file) { fileToBase64(file) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -374,7 +389,7 @@ export default { ...@@ -374,7 +389,7 @@ export default {
// 读取 File 对象 // 读取 File 对象
reader.readAsDataURL(file); reader.readAsDataURL(file);
// 加载完成后 // 加载完成后
reader.onload = function () { reader.onload = function() {
// 将读取的数据转换为 base64 编码的字符串 // 将读取的数据转换为 base64 编码的字符串
const base64String = reader.result; const base64String = reader.result;
// 解析为 Promise 对象,并返回 base64 编码的字符串 // 解析为 Promise 对象,并返回 base64 编码的字符串
...@@ -382,84 +397,92 @@ export default { ...@@ -382,84 +397,92 @@ export default {
}; };
// 加载失败时 // 加载失败时
reader.onerror = function () { reader.onerror = function() {
reject(new Error("Failed to load file")); reject(new Error("Failed to load file"));
}; };
}); });
}, },
getBackFile(files, callback) { getBackFile(files, callback) {
console.log(files) console.log(files);
let that = this let that = this;
let bw = document.getElementById("line").clientWidth;
let bh = document.getElementById("line").clientHeight;
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
files[i].url = files[i].productionFile files[i].url = files[i].productionFile;
that.$nextTick(() => { that.$nextTick(() => {
that.getImageSize(files[i].url).then(data => { that.getImageSize(files[i].url).then(data => {
let w = document.getElementById('line').clientWidth / 2 let w = document.getElementById("line").clientWidth / 2;
let rate = data.height / data.width let rate = data.height / data.width;
that.imgList.push({ that.imgList.push({
url: files[i].url, url: files[i].url,
fileName: files[i].fileName, fileName: files[i].fileName,
rate, rate,
w: 100, w: bw * (2 / 3),
zIndex: that.imgList.length, zIndex: that.imgList.length,
x: w, x: w,
y: (100 * rate) / 2, y: (bw * (2 / 3) * rate) / 2,
h: 100 * rate, h: bw * (2 / 3) * rate,
r: 0, r: 0
}); });
that.selectIndex = that.imgList.length - 1 that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true that.showImgSetting = true;
if (i === files.length - 1) { if (i === files.length - 1) {
callback && callback() callback && callback();
} }
}) });
}) });
} }
}, },
addFile(file, callback) { addFile(file, callback) {
let that = this let that = this;
let bw = document.getElementById("line").clientWidth;
let bh = document.getElementById("line").clientHeight;
console.log(bw, bh);
that.$nextTick(() => { that.$nextTick(() => {
that.getImageSize(file.url).then(data => { that.getImageSize(file.url).then(data => {
let w = document.getElementById('line').clientWidth / 2 let w = document.getElementById("line").clientWidth / 2;
let rate = data.height / data.width let rate = data.height / data.width;
that.imgList.push({ that.imgList.push({
url: file.url, url: file.url,
w: 100, w: bw * (2 / 3),
rate, rate,
fileName: file.fileName, fileName: file.fileName,
zIndex: that.imgList.length, zIndex: that.imgList.length,
x: w, x: w,
y: (100 * rate) / 2, y: (bw * (2 / 3) * rate) / 2,
h: 100 * rate, h: bw * (2 / 3) * rate,
r: 0, r: 0
}); });
console.log(that.imgList) console.log(that.imgList);
that.selectIndex = that.imgList.length - 1 that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true that.showImgSetting = true;
callback && callback(file) callback && callback(file);
}) });
}) });
}, },
listenUpload() { listenUpload() {
let that = this let that = this;
that.parentWidth = document.getElementById('img').clientWidth document.getElementById("img").onmousedown = function(e) {
that.parentHeight = document.getElementById('img').clientHeight e.preventDefault();
let dp = document.getElementsByClassName('container')[0] };
dp.addEventListener('dragover', this.dragover); that.parentWidth = document.getElementById("img").clientWidth;
that.parentHeight = document.getElementById("img").clientHeight;
let dp = document.getElementsByClassName("container")[0];
dp.addEventListener("dragover", this.dragover);
dp.addEventListener("drop", this.drop); dp.addEventListener("drop", this.drop);
}, },
getImageSize(url) { getImageSize(url) {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
let image = new Image(); let image = new Image();
image.onload = function () { image.onload = function() {
resolve({ resolve({
width: image.width, width: image.width,
height: image.height height: image.height
}); });
}; };
image.onerror = function () { image.onerror = function() {
reject(new Error('error')); reject(new Error("error"));
}; };
image.src = url; image.src = url;
}); });
...@@ -473,16 +496,16 @@ export default { ...@@ -473,16 +496,16 @@ export default {
*/ */
changeImageColor(color = "#00ff7f", callback) { changeImageColor(color = "#00ff7f", callback) {
let threshold = 114; //默认颜色阀值 为 114 ->和默认图相关 let threshold = 114; //默认颜色阀值 为 114 ->和默认图相关
let img = new Image() let img = new Image();
img.src = require('../../../assets/bg_tshirt_shadow.png'); img.src = require("../../../assets/bg_tshirt_shadow.png");
let newR = parseInt("0x" + color.substr(1, 2)); let newR = parseInt("0x" + color.substr(1, 2));
let newG = parseInt("0x" + color.substr(3, 2)); let newG = parseInt("0x" + color.substr(3, 2));
let newB = parseInt("0x" + color.substr(5, 2)); let newB = parseInt("0x" + color.substr(5, 2));
//图片加载后进行处理 //图片加载后进行处理
img.onload = function () { img.onload = function() {
let width = img.width, height = img.height, canvas = document.createElement("canvas"), let width = img.width, height = img.height, canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
canvas.width = width; canvas.width = width;
canvas.height = height; canvas.height = height;
// 将源图片复制到画布上 // 将源图片复制到画布上
...@@ -493,9 +516,9 @@ export default { ...@@ -493,9 +516,9 @@ export default {
let i = 0; let i = 0;
while (i < data.length) { while (i < data.length) {
let r = data[i++], let r = data[i++],
g = data[i++], g = data[i++],
b = data[i++], b = data[i++],
a = data[i++]; a = data[i++];
//计算透明度 //计算透明度
let alp = (255 - r) / (255 - threshold); let alp = (255 - r) / (255 - threshold);
//判断是否透明 //判断是否透明
...@@ -521,56 +544,61 @@ export default { ...@@ -521,56 +544,61 @@ export default {
} }
}, },
mounted() { mounted() {
this.imgHeight = window.screen.height + 'px' this.imgHeight = window.screen.height + "px";
this.systemSetting = this.$dataStore.get("setting");
bus.$on('busEmit', (v) => { bus.$on("busEmit", (v) => {
let {type, value} = v let { type, value } = v;
switch (type) { switch (type) {
case 'grid': case "grid":
this.row = value.row this.row = value.row;
this.col = value.col this.col = value.col;
break; break;
case 'index': case "index":
this.indexChange(value) this.indexChange(value);
break; break;
case 'bg': case "bg":
this.changeImageColor(value, (res) => { this.changeImageColor(value, (res) => {
this.img = res this.img = res;
}) });
break; break;
case 'uploadImage': case "updateSystemSetting":
console.log(this.$dataStore);
this.systemSetting = this.$dataStore.get("setting");
break;
case "uploadImage":
this.addFile(value, file => { this.addFile(value, file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
// this.selectImgList.push(file) // this.selectImgList.push(file)
// this.selectImgIndex = this.selectImgList.length - 1 // this.selectImgIndex = this.selectImgList.length - 1
}) });
break; break;
case 'sendFile': case "sendFile":
this.imgList = [] this.imgList = [];
this.selectIndex = -1 this.selectIndex = -1;
if (value.length > 0) { if (value.length > 0) {
console.log(value) console.log(value);
this.selectImgList = value this.selectImgList = value;
this.selectImgIndex = 0 this.selectImgIndex = 0;
this.getBackFile([value[0]], file => { this.getBackFile([value[0]], file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))) this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}) });
// this.addFile([value[0].file]) // this.addFile([value[0].file])
} }
break; break;
default: default:
break; break;
} }
}) });
document.addEventListener("keyup", this.keyup);
this.$nextTick(() => {
this.listenUpload();
});
document.addEventListener('keyup', this.keyup)
this.listenUpload()
document.getElementById('img').onmousedown = function (e) {
e.preventDefault()
}
} }
} };
</script> </script>
<template> <template>
...@@ -581,33 +609,33 @@ export default { ...@@ -581,33 +609,33 @@ export default {
<div @click="selectImg(it,i)" v-for="(it,i) in selectImgList" <div @click="selectImg(it,i)" v-for="(it,i) in selectImgList"
:key="i" :key="i"
class="img-item"> class="img-item">
<el-image style="width: 100px;height: auto;" :src="it.productionFile" <img style="width: 100px;height: auto;" :src="it.productionFile" />
></el-image>
<span>{{ it.designId }}</span> <span>{{ it.designId }}</span>
</div> </div>
</div> </div>
<div :style="{height:imgHeight}" id="img"> <div :style="{height:imgHeight}" id="img">
<div id="line" v-if="sysSetting.gridShow"> <div id="line">
<div class="sucaitu" style="width:482px;height:542px"> <div class="sucaitu"
:style="{width:gridWH.w+'px',height:gridWH.h+'px'}">
<vue-drag-resize-rotate <vue-drag-resize-rotate
:w="item.w" :w="item.w"
class-name="my-drag-resize-rotate" class-name="my-drag-resize-rotate"
:prevent-deactivation="false" :prevent-deactivation="false"
:h="item.h" :h="item.h"
:x="item.x" :x="item.x"
:z="item.zIndex" :z="item.zIndex"
:aspectRatio="true" :aspectRatio="true"
:isActive="index===selectIndex" :isActive="index===selectIndex"
:y="item.y" :y="item.y"
v-for="(item,index) in imgList" v-for="(item,index) in imgList"
:key="index" :key="index"
:draggable="true" :draggable="true"
:resizable="true" :resizable="true"
:rotatable="true" :rotatable="true"
@dragstop="(a)=>dragStop(a,item)" @dragstop="(a)=>dragStop(a,item)"
@resizestop="(a)=>resizeStop(a,item)" @resizestop="(a)=>resizeStop(a,item)"
@rotatestop="(a)=>rotating(a,item)" @rotatestop="(a)=>rotating(a,item)"
:angle="item.r" :angle="item.r"
> >
<div ref="sucaitu-img" <div ref="sucaitu-img"
:class="{'active': index === selectIndex}" :class="{'active': index === selectIndex}"
...@@ -620,28 +648,22 @@ export default { ...@@ -620,28 +648,22 @@ export default {
</vue-drag-resize-rotate> </vue-drag-resize-rotate>
</div> </div>
<div v-if="$store.getters.systemSetting.gridShow" style="width:482px;height:542px" class="grid"> <div v-if="systemSetting.gridShow===1"
<div :style="{height:gridSpacing,lineHeight:gridSpacing}" class="grid-row" v-for="it in 100" :key="it"> :style="{width:gridWH.w+'px',height:gridWH.h+'px'}"
<div :style="{width:gridSpacing,height:gridSpacing}" class="grid">
<div :style="{height:gridSpacing.h,lineHeight:gridSpacing.h}" class="grid-row" v-for="it in 100"
:key="it">
<div :style="{width:gridSpacing.w,height:gridSpacing.h}"
class="grid-col" v-for="it in 100" :key="it"> class="grid-col" v-for="it in 100" :key="it">
</div> </div>
</div> </div>
</div> </div>
<!-- <table v-if="$store.getters.systemSetting.gridShow" border="none">-->
<!-- <tr :style="{height:computedGridSize}" style="width: 482px;overflow: hidden;"-->
<!-- v-for="it in Number((543/Number($store.getters.systemSetting.gridSpacing.slice(0,2))).toFixed(0))">-->
<!-- <td v-for="it in Number((482/Number($store.getters.systemSetting.gridSpacing.slice(0,2))).toFixed(0))"-->
<!-- :style="{width:computedGridSize ,height:computedGridSize}">-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
</div> </div>
<img class="template-img" draggable="false" :src="img" alt=""> <img class="template-img" draggable="false" :src="img" alt="">
</div> </div>
<print-dialog :imgList="imgList" :byPlatenSize="$store.getters.systemSetting.gridValue"/> <print-dialog :imgList="imgList" :byPlatenSize="systemSetting.gridValue" />
</div> </div>
</div> </div>
<img-setting @ev="ev" @change="formChange" :item="returnItem" @close="close" <img-setting @ev="ev" @change="formChange" :item="returnItem" @close="close"
...@@ -684,6 +706,7 @@ export default { ...@@ -684,6 +706,7 @@ export default {
white-space: nowrap; white-space: nowrap;
} }
.grid-row:nth-of-type(1) .grid-col { .grid-row:nth-of-type(1) .grid-col {
border-top: none !important; border-top: none !important;
} }
...@@ -694,12 +717,15 @@ export default { ...@@ -694,12 +717,15 @@ export default {
.grid-row .grid-col:nth-of-type(1) { .grid-row .grid-col:nth-of-type(1) {
border-left: none !important; border-left: none !important;
} }
.grid .grid-row .grid-col { .grid .grid-row .grid-col {
display: inline-block; display: inline-block;
border: 1px solid gray; border: 1px solid gray;
border-right: none; border-right: none;
border-bottom: none;
} }
......
...@@ -4,144 +4,155 @@ export default { ...@@ -4,144 +4,155 @@ export default {
data() { data() {
return { return {
rules: { rules: {
company: [{validator: this.validatePass, required: true, trigger: 'blur'}], company: [{ validator: this.validatePass, required: true, trigger: "blur" }],
loginName: [{message: '请输入用户名', required: true, trigger: 'blur'}], loginName: [{ message: "请输入用户名", required: true, trigger: "blur" }],
password: [{message: '请输入密码', required: true, trigger: 'blur'}], password: [{ message: "请输入密码", required: true, trigger: "blur" }]
}, },
companyList: [], companyList: [],
userList: [], userList: [],
company: null, company: null,
authorityVisible: false, authorityVisible: false,
remember: true, remember: true,
authorityForm: {}, authorityForm: {},
form: { form: {
loginName: '', loginName: "",
user: '', user: "",
company: '', company: "",
password: '' password: ""
} }
} };
}, },
created() { created() {
console.log(this.$dataStore, 'this.$dataStore') // this.len = Object.keys(this.$dataStore.store).length
this.company = this.$dataStore.get('company') console.log(this.$dataStore, "this.$dataStore");
this.userList = this.$dataStore.get('userList') || [] // this.$dataStore.set('deviceIdceshi03','b27a0777451f789521f4240e99f65913')
this.company = this.$dataStore.get("company");
this.userList = this.$dataStore.get("userList") || [];
if (this.company) { if (this.company) {
this.form.company = this.company.domain this.form.company = this.company.domain;
} }
// if (user) { // if (user) {
// return this.$router.push('/design') // return this.$router.push('/design')
// } // }
this.getCompanyList() this.getCompanyList();
}, },
mounted() { mounted() {
document.addEventListener('keyup', this.keyUp) document.addEventListener("keyup", this.keyUp);
}, },
beforeDestroy() { beforeDestroy() {
document.removeEventListener('keyup', this.keyUp) document.removeEventListener("keyup", this.keyUp);
}, },
methods: { methods: {
keyUp(e) { keyUp(e) {
console.log(e) console.log(e);
if (e.keyCode === 13) { if (e.keyCode === 13) {
this.login() this.login();
} }
}, },
submitAuthority() { submitAuthority() {
this.$refs.authorityForm.validate((v) => { this.$refs.authorityForm.validate((v) => {
if (v) { if (v) {
this.$api.post('/commitApply', { this.$api.post("/commitApply", {
...this.authorityForm, ...this.authorityForm,
...this.form ...this.form
}, { }, {
headers: { headers: {
'company': this.form.company + '.jomalls.com' "company": this.form.company + ".jomalls.com"
} }
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.authorityVisible = false this.authorityVisible = false;
this.$message.success('申请提交成功') this.$message.success("申请提交成功");
this.$dataStore.set('deviceId' + this.form.loginName, res.data.id) this.$dataStore.set("deviceId" + this.form.loginName, res.data.id);
} }
}) });
} }
}) });
}, },
validatePass(rule, value, callback) { validatePass(rule, value, callback) {
if (!value || value === '') { if (!value || value === "") {
return callback(new Error('请输入客户(例如demo)')); return callback(new Error("请输入客户(例如demo)"));
} }
let item = this.companyList.find(item => item.domain.replace('.jomalls.com', '') === value) let item = this.companyList.find(item => item.domain.replace(".jomalls.com", "") === value);
if (item) { if (item) {
return callback() return callback();
} else { } else {
return callback(new Error('未查找到该客户')) return callback(new Error("未查找到该客户"));
} }
}, },
async login() { async login() {
// if (this.form.auth) {
// this.$dataStore.set(this.form.auth.split(",")[0], this.form.auth.split(",")[1]);
// console.log("存储成功");
// console.log(this.$dataStore.store);
//
// }
this.$refs.formRef.validate(async valid => { this.$refs.formRef.validate(async valid => {
if (valid) { if (valid) {
let f = JSON.parse(JSON.stringify(this.form)) let f = JSON.parse(JSON.stringify(this.form));
if (f.company.split('.').length === 1) { if (f.company.split(".").length === 1) {
f.company = f.company + '.jomalls.com' f.company = f.company + ".jomalls.com";
} }
if (!f.deviceId) { if (!f.deviceId) {
f.deviceId = this.$dataStore.get('deviceId' + this.form.loginName) f.deviceId = this.$dataStore.get("deviceId" + this.form.loginName);
} }
if (!f.deviceId) delete f.deviceId if (!f.deviceId) delete f.deviceId;
let {data, code, message} = await this.$api.post('/login', f) let { data, code, message } = await this.$api.post("/login", f);
if (code === 411) { if (code === 411) {
this.authorityVisible = true this.authorityVisible = true;
this.authorityForm = {} this.authorityForm = {};
return this.$message.error(message) return this.$message.error(message);
} }
data = { data = {
...data.sysUser, ...data.sysUser,
...{ ...{
token: data.token token: data.token
} }
} };
delete data.sysMenus delete data.sysMenus;
delete data.sysUser delete data.sysUser;
let item = this.companyList.find(item => item.domain === f.company) let item = this.companyList.find(item => item.domain === f.company);
console.log(item, 111222) console.log(item, 111222);
this.$dataStore.set('user', data) this.$dataStore.set("user", data);
this.$dataStore.set('company', item) this.$dataStore.set("company", item);
if (this.remember) { if (this.remember) {
let userList = this.$dataStore.get('userList') let userList = this.$dataStore.get("userList");
if (userList && !userList.find(el => el.loginName === f.loginName && el.company === f.company)) { if (userList && !userList.find(el => el.loginName === f.loginName && el.company === f.company)) {
userList.push(f) userList.push(f);
} else { } else {
userList = [f] userList = [f];
} }
this.$dataStore.set('userList', userList) this.$dataStore.set("userList", userList);
} }
await this.$router.push('/design') await this.$router.push("/design");
} }
}) });
}, },
userChange(v) { userChange(v) {
if (v === '') { if (v === "") {
this.form.deviceId = '' this.form.deviceId = "";
return return;
} }
console.log(this.userList, v) console.log(this.userList, v);
this.form.company = this.userList[v].company.split('.')[0] this.form.company = this.userList[v].company.split(".")[0];
this.form.loginName = this.userList[v].loginName this.form.loginName = this.userList[v].loginName;
this.form.password = this.userList[v].password this.form.password = this.userList[v].password;
this.form.deviceId = this.userList[v].deviceId this.form.deviceId = this.userList[v].deviceId;
}, },
async getCompanyList() { async getCompanyList() {
let {data} = await this.$api.get('/getCompanyList') let { data } = await this.$api.get("/getCompanyList");
this.companyList = data.records this.companyList = data.records;
} }
} }
} };
</script> </script>
<template> <template>
...@@ -177,6 +188,10 @@ export default { ...@@ -177,6 +188,10 @@ export default {
<el-input placeholder="密码" show-password prefix-icon="el-icon-lock" type="password" v-model="form.password" <el-input placeholder="密码" show-password prefix-icon="el-icon-lock" type="password" v-model="form.password"
clearable></el-input> clearable></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item v-if="len===0" prop="授权信息">-->
<!-- <el-input placeholder="授权信息" prefix-icon="el-icon-lock" v-model="form.auth"-->
<!-- clearable></el-input>-->
<!-- </el-form-item>-->
<div class="check"> <div class="check">
<el-checkbox v-model="remember">记住账号</el-checkbox> <el-checkbox v-model="remember">记住账号</el-checkbox>
</div> </div>
...@@ -188,16 +203,16 @@ export default { ...@@ -188,16 +203,16 @@ export default {
</el-form> </el-form>
</div> </div>
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
title="权限申请" title="权限申请"
:visible.sync="authorityVisible" :visible.sync="authorityVisible"
top="15%" top="15%"
width="400px"> width="400px">
<el-form <el-form
:model="authorityForm" :model="authorityForm"
size="mini" size="mini"
ref="authorityForm" ref="authorityForm"
label-width="80px"> label-width="80px">
<el-form-item label="设备名称" prop="deviceName" required> <el-form-item label="设备名称" prop="deviceName" required>
<el-input v-model="authorityForm.deviceName"></el-input> <el-input v-model="authorityForm.deviceName"></el-input>
</el-form-item> </el-form-item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment