liqiuying 3 settimane fa
parent
commit
2f8deabd69
100 ha cambiato i file con 0 aggiunte e 29028 eliminazioni
  1. 0 26
      .history/.gitignore_20250814152111
  2. 0 26
      .history/.gitignore_20250814152726
  3. 0 7
      .history/entrypoints/popup/pages/DesignPic_20250812142042.tsx
  4. 0 7
      .history/entrypoints/popup/pages/DesignPic_20250812151635.tsx
  5. 0 21
      .history/entrypoints/popup/pages/DesignPic_20250812152720.tsx
  6. 0 21
      .history/entrypoints/popup/pages/DesignPic_20250812152722.tsx
  7. 0 35
      .history/entrypoints/popup/pages/DesignPic_20250812152737.tsx
  8. 0 36
      .history/entrypoints/popup/pages/DesignPic_20250812153528.tsx
  9. 0 36
      .history/entrypoints/popup/pages/DesignPic_20250812153835.tsx
  10. 0 36
      .history/entrypoints/popup/pages/DesignPic_20250812154026.tsx
  11. 0 36
      .history/entrypoints/popup/pages/DesignPic_20250812154228.tsx
  12. 0 50
      .history/entrypoints/popup/pages/DesignPic_20250812155045.tsx
  13. 0 50
      .history/entrypoints/popup/pages/DesignPic_20250812155116.tsx
  14. 0 51
      .history/entrypoints/popup/pages/DesignPic_20250812155353.tsx
  15. 0 60
      .history/entrypoints/popup/pages/DesignPic_20250812155848.tsx
  16. 0 84
      .history/entrypoints/popup/pages/DesignPic_20250812160408.tsx
  17. 0 84
      .history/entrypoints/popup/pages/DesignPic_20250812160443.tsx
  18. 0 84
      .history/entrypoints/popup/pages/DesignPic_20250812160517.tsx
  19. 0 84
      .history/entrypoints/popup/pages/DesignPic_20250812160644.tsx
  20. 0 84
      .history/entrypoints/popup/pages/DesignPic_20250812160702.tsx
  21. 0 84
      .history/entrypoints/popup/pages/DesignPic_20250812160715.tsx
  22. 0 110
      .history/entrypoints/popup/pages/DesignPic_20250812161830.tsx
  23. 0 116
      .history/entrypoints/popup/pages/DesignPic_20250812162130.tsx
  24. 0 230
      .history/entrypoints/popup/pages/DesignPic_20250812163129.tsx
  25. 0 230
      .history/entrypoints/popup/pages/DesignPic_20250812163306.tsx
  26. 0 230
      .history/entrypoints/popup/pages/DesignPic_20250812163611.tsx
  27. 0 231
      .history/entrypoints/popup/pages/DesignPic_20250812164324.tsx
  28. 0 201
      .history/entrypoints/popup/pages/DesignPic_20250812164810.tsx
  29. 0 230
      .history/entrypoints/popup/pages/DesignPic_20250812165136.tsx
  30. 0 116
      .history/entrypoints/popup/pages/DesignPic_20250812170606.tsx
  31. 0 116
      .history/entrypoints/popup/pages/DesignPic_20250812170807.tsx
  32. 0 159
      .history/entrypoints/popup/pages/DesignPic_20250812171202.tsx
  33. 0 171
      .history/entrypoints/popup/pages/DesignPic_20250812171743.tsx
  34. 0 171
      .history/entrypoints/popup/pages/DesignPic_20250812172029.tsx
  35. 0 181
      .history/entrypoints/popup/pages/DesignPic_20250812172534.tsx
  36. 0 203
      .history/entrypoints/popup/pages/DesignPic_20250812172612.tsx
  37. 0 229
      .history/entrypoints/popup/pages/DesignPic_20250812173407.tsx
  38. 0 229
      .history/entrypoints/popup/pages/DesignPic_20250812173713.tsx
  39. 0 278
      .history/entrypoints/popup/pages/DesignPic_20250813103030.tsx
  40. 0 279
      .history/entrypoints/popup/pages/DesignPic_20250813105303.tsx
  41. 0 265
      .history/entrypoints/popup/pages/DesignPic_20250813105544.tsx
  42. 0 320
      .history/entrypoints/popup/pages/DesignPic_20250813113512.tsx
  43. 0 321
      .history/entrypoints/popup/pages/DesignPic_20250813113756.tsx
  44. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813113827.tsx
  45. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813114002.tsx
  46. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813123735.tsx
  47. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813123819.tsx
  48. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813124018.tsx
  49. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813124507.tsx
  50. 0 322
      .history/entrypoints/popup/pages/DesignPic_20250813133842.tsx
  51. 0 323
      .history/entrypoints/popup/pages/DesignPic_20250813134508.tsx
  52. 0 325
      .history/entrypoints/popup/pages/DesignPic_20250813134541.tsx
  53. 0 326
      .history/entrypoints/popup/pages/DesignPic_20250813135007.tsx
  54. 0 328
      .history/entrypoints/popup/pages/DesignPic_20250813135215.tsx
  55. 0 328
      .history/entrypoints/popup/pages/DesignPic_20250813135420.tsx
  56. 0 337
      .history/entrypoints/popup/pages/DesignPic_20250813144325.tsx
  57. 0 337
      .history/entrypoints/popup/pages/DesignPic_20250813144433.tsx
  58. 0 363
      .history/entrypoints/popup/pages/DesignPic_20250813145924.tsx
  59. 0 379
      .history/entrypoints/popup/pages/DesignPic_20250813150813.tsx
  60. 0 380
      .history/entrypoints/popup/pages/DesignPic_20250813152600.tsx
  61. 0 386
      .history/entrypoints/popup/pages/DesignPic_20250813152910.tsx
  62. 0 402
      .history/entrypoints/popup/pages/DesignPic_20250813154341.tsx
  63. 0 402
      .history/entrypoints/popup/pages/DesignPic_20250813154408.tsx
  64. 0 402
      .history/entrypoints/popup/pages/DesignPic_20250813154438.tsx
  65. 0 400
      .history/entrypoints/popup/pages/DesignPic_20250813154656.tsx
  66. 0 401
      .history/entrypoints/popup/pages/DesignPic_20250813154835.tsx
  67. 0 401
      .history/entrypoints/popup/pages/DesignPic_20250813154909.tsx
  68. 0 403
      .history/entrypoints/popup/pages/DesignPic_20250813160635.tsx
  69. 0 403
      .history/entrypoints/popup/pages/DesignPic_20250813160641.tsx
  70. 0 398
      .history/entrypoints/popup/pages/DesignPic_20250813162307.tsx
  71. 0 402
      .history/entrypoints/popup/pages/DesignPic_20250813162955.tsx
  72. 0 410
      .history/entrypoints/popup/pages/DesignPic_20250813163428.tsx
  73. 0 416
      .history/entrypoints/popup/pages/DesignPic_20250813170203.tsx
  74. 0 432
      .history/entrypoints/popup/pages/DesignPic_20250813171932.tsx
  75. 0 446
      .history/entrypoints/popup/pages/DesignPic_20250813172423.tsx
  76. 0 447
      .history/entrypoints/popup/pages/DesignPic_20250813172446.tsx
  77. 0 447
      .history/entrypoints/popup/pages/DesignPic_20250813172519.tsx
  78. 0 447
      .history/entrypoints/popup/pages/DesignPic_20250813172554.tsx
  79. 0 449
      .history/entrypoints/popup/pages/DesignPic_20250813172925.tsx
  80. 0 449
      .history/entrypoints/popup/pages/DesignPic_20250813172943.tsx
  81. 0 449
      .history/entrypoints/popup/pages/DesignPic_20250813173540.tsx
  82. 0 449
      .history/entrypoints/popup/pages/DesignPic_20250813173756.tsx
  83. 0 449
      .history/entrypoints/popup/pages/DesignPic_20250813173917.tsx
  84. 0 439
      .history/entrypoints/popup/pages/DesignPic_20250813174324.tsx
  85. 0 418
      .history/entrypoints/popup/pages/DesignPic_20250813174400.tsx
  86. 0 425
      .history/entrypoints/popup/pages/DesignPic_20250813174421.tsx
  87. 0 425
      .history/entrypoints/popup/pages/DesignPic_20250813174448.tsx
  88. 0 428
      .history/entrypoints/popup/pages/DesignPic_20250813174832.tsx
  89. 0 453
      .history/entrypoints/popup/pages/DesignPic_20250813180128.tsx
  90. 0 485
      .history/entrypoints/popup/pages/DesignPic_20250813181452.tsx
  91. 0 485
      .history/entrypoints/popup/pages/DesignPic_20250814091334.tsx
  92. 0 492
      .history/entrypoints/popup/pages/DesignPic_20250814091908.tsx
  93. 0 492
      .history/entrypoints/popup/pages/DesignPic_20250814091930.tsx
  94. 0 493
      .history/entrypoints/popup/pages/DesignPic_20250814093143.tsx
  95. 0 500
      .history/entrypoints/popup/pages/DesignPic_20250814094635.tsx
  96. 0 503
      .history/entrypoints/popup/pages/DesignPic_20250814095747.tsx
  97. 0 501
      .history/entrypoints/popup/pages/DesignPic_20250814095806.tsx
  98. 0 501
      .history/entrypoints/popup/pages/DesignPic_20250814095831.tsx
  99. 0 500
      .history/entrypoints/popup/pages/DesignPic_20250814095853.tsx
  100. 0 500
      .history/entrypoints/popup/pages/DesignPic_20250814100138.tsx

+ 0 - 26
.history/.gitignore_20250814152111

@@ -1,26 +0,0 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-pnpm-debug.log*
-lerna-debug.log*
-
-node_modules
-.output
-stats.html
-stats-*.json
-.wxt
-web-ext.config.ts
-
-# Editor directories and files
-.vscode/*
-!.vscode/extensions.json
-.idea
-.DS_Store
-*.suo
-*.ntvs*
-*.njsproj
-*.sln
-*.sw?

+ 0 - 26
.history/.gitignore_20250814152726

@@ -1,26 +0,0 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-pnpm-debug.log*
-lerna-debug.log*
-
-node_modules
-.output
-stats.html
-stats-*.json
-.wxt
-web-ext.config.ts
-
-# Editor directories and files
-.vscode/*
-!.vscode/extensions.json
-.idea
-.DS_Store
-*.suo
-*.ntvs*
-*.njsproj
-*.sln
-*.sw?

+ 0 - 7
.history/entrypoints/popup/pages/DesignPic_20250812142042.tsx

@@ -1,7 +0,0 @@
-import React from 'react'
-
-export default function DesignPic() {
-  return (
-    <div>DesignPic</div>
-  )
-}

+ 0 - 7
.history/entrypoints/popup/pages/DesignPic_20250812151635.tsx

@@ -1,7 +0,0 @@
-import React from 'react'
-
-export default function DesignPic() {
-  return (
-    <div>DesignPic</div>
-  )
-}

+ 0 - 21
.history/entrypoints/popup/pages/DesignPic_20250812152720.tsx

@@ -1,21 +0,0 @@
-import React from 'react'
-import { Button, Dialog  } from '@alifd/next';
-
-export default function DesignPic() {
-  return (
-    <div>
-        <Button onClick={this.onOpen} type="primary">
-          Open dialog
-        </Button>
-        <Dialog
-          v2
-          title="Welcome to Alibaba.com"
-          visible={this.state.visible}
-          onOk={this.onOk}
-          onClose={this.onClose}
-        >
-          <p>Start your business here by searching a popular product</p>
-        </Dialog>
-      </div>
-  )
-}

+ 0 - 21
.history/entrypoints/popup/pages/DesignPic_20250812152722.tsx

@@ -1,21 +0,0 @@
-import React from 'react'
-import { Button, Dialog  } from '@alifd/next';
-
-export default function DesignPic() {
-  return (
-    <div>
-        <Button onClick={this.onOpen} type="primary">
-          Open dialog
-        </Button>
-        <Dialog
-          v2
-          title="Welcome to Alibaba.com"
-          visible={this.state.visible}
-          onOk={this.onOk}
-          onClose={this.onClose}
-        >
-          <p>Start your business here by searching a popular product</p>
-        </Dialog>
-      </div>
-  )
-}

+ 0 - 35
.history/entrypoints/popup/pages/DesignPic_20250812152737.tsx

@@ -1,35 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Dialog } from '@alifd/next'
-
-export default function DesignPic() {
-  const [visible, setVisible] = useState(false)
-
-  const onOpen = () => {
-    setVisible(true)
-  }
-
-  const onOk = () => {
-    setVisible(false)
-  }
-
-  const onClose = () => {
-    setVisible(false)
-  }
-
-  return (
-    <div>
-      <Button onClick={onOpen} type="primary">
-        Open dialog
-      </Button>
-      <Dialog
-        v2
-        title="Welcome to Alibaba.com"
-        visible={visible}
-        onOk={onOk}
-        onClose={onClose}
-      >
-        <p>Start your business here by searching a popular product</p>
-      </Dialog>
-    </div>
-  )
-}

+ 0 - 36
.history/entrypoints/popup/pages/DesignPic_20250812153528.tsx

@@ -1,36 +0,0 @@
-import React from 'react'
-import { Button, Table } from '@alifd/next';
-
-export default function DesignPic() {
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const render = (value: any, index: number, record: any) => {
-    return (
-      <a href="javascript:;">
-        {'Remove('}
-        {record.id}
-        {')'}
-      </a>
-    );
-  };
-  return (
-    <>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="Id" htmlTitle="Unique Id" dataIndex="id" />
-        <Table.Column title="Title" dataIndex="title.name" />
-        <Table.Column title="Time" dataIndex="time" />
-        <Table.Column cell={render} />
-      </Table>
-    </>
-  )
-}

+ 0 - 36
.history/entrypoints/popup/pages/DesignPic_20250812153835.tsx

@@ -1,36 +0,0 @@
-import React from 'react'
-import { Button, Table } from '@alifd/next';
-
-export default function DesignPic() {
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const render = (value: any, index: number, record: any) => {
-    return (
-      <a href="javascript:;">
-        {'Remove('}
-        {record.id}
-        {')'}
-      </a>
-    );
-  };
-  return (
-    <div className='w-px-750 h-px-500'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="Id" htmlTitle="Unique Id" dataIndex="id" />
-        <Table.Column title="Title" dataIndex="title.name" />
-        <Table.Column title="Time" dataIndex="time" />
-        <Table.Column cell={render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 36
.history/entrypoints/popup/pages/DesignPic_20250812154026.tsx

@@ -1,36 +0,0 @@
-import React from 'react'
-import { Button, Table } from '@alifd/next';
-
-export default function DesignPic() {
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const render = (value: any, index: number, record: any) => {
-    return (
-      <a href="javascript:;">
-        {'Remove('}
-        {record.id}
-        {')'}
-      </a>
-    );
-  };
-  return (
-    <div className='w-px-750 h-px-500'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="Id" htmlTitle="Unique Id" dataIndex="id" />
-        <Table.Column title="Title" dataIndex="title.name" />
-        <Table.Column title="Time" dataIndex="time" />
-        <Table.Column cell={render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 36
.history/entrypoints/popup/pages/DesignPic_20250812154228.tsx

@@ -1,36 +0,0 @@
-import React from 'react'
-import { Button, Table } from '@alifd/next';
-
-export default function DesignPic() {
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const render = (value: any, index: number, record: any) => {
-    return (
-      <a href="javascript:;">
-        {'Remove('}
-        {record.id}
-        {')'}
-      </a>
-    );
-  };
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="Id" htmlTitle="Unique Id" dataIndex="id" />
-        <Table.Column title="Title" dataIndex="title.name" />
-        <Table.Column title="Time" dataIndex="time" />
-        <Table.Column cell={render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 50
.history/entrypoints/popup/pages/DesignPic_20250812155045.tsx

@@ -1,50 +0,0 @@
-import React from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img src={record.url} alt={record.title} />
-    );
-  }
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input placeholder="请输入" />
-    </>
-  };
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input placeholder="请输入" />
-    </>
-  };
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red'>
-        删除
-      </a>
-    );
-  };
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 50
.history/entrypoints/popup/pages/DesignPic_20250812155116.tsx

@@ -1,50 +0,0 @@
-import React from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img src={record.url} alt={record.title} />
-    );
-  }
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input placeholder="请输入" />
-    </>
-  };
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input placeholder="请输入" />
-    </>
-  };
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-100'>
-        删除
-      </a>
-    );
-  };
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 51
.history/entrypoints/popup/pages/DesignPic_20250812155353.tsx

@@ -1,51 +0,0 @@
-import React from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-
-    );
-  }
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input placeholder="请输入" />
-    </>
-  };
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input placeholder="请输入" />
-    </>
-  };
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 60
.history/entrypoints/popup/pages/DesignPic_20250812155848.tsx

@@ -1,60 +0,0 @@
-import React from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-
-  const dataSource = () => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-      });
-    }
-    return result;
-  };
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.id}
-        // onChange={handleChange}
-        composition
-        placeholder={'请输入'}
-      />
-    </>
-  };
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.id}
-        // onChange={handleChange}
-        composition
-        placeholder={'请输入'}
-      />
-    </>
-  };
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSource()}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 84
.history/entrypoints/popup/pages/DesignPic_20250812160408.tsx

@@ -1,84 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={tableData}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 84
.history/entrypoints/popup/pages/DesignPic_20250812160443.tsx

@@ -1,84 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.id}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={tableData}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 84
.history/entrypoints/popup/pages/DesignPic_20250812160517.tsx

@@ -1,84 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.id}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].id = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={tableData}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 84
.history/entrypoints/popup/pages/DesignPic_20250812160644.tsx

@@ -1,84 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.id}
-        onBlur={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].id = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={tableData}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 84
.history/entrypoints/popup/pages/DesignPic_20250812160702.tsx

@@ -1,84 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={tableData}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 84
.history/entrypoints/popup/pages/DesignPic_20250812160715.tsx

@@ -1,84 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: number, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a className='text-red-600'>
-        删除
-      </a>
-    );
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={tableData}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 110
.history/entrypoints/popup/pages/DesignPic_20250812161830.tsx

@@ -1,110 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-    
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a 
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button>按钮</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 116
.history/entrypoints/popup/pages/DesignPic_20250812162130.tsx

@@ -1,116 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-    
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a 
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = () => {
-    
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>按钮</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 230
.history/entrypoints/popup/pages/DesignPic_20250812163129.tsx

@@ -1,230 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 230
.history/entrypoints/popup/pages/DesignPic_20250812163306.tsx

@@ -1,230 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 230
.history/entrypoints/popup/pages/DesignPic_20250812163611.tsx

@@ -1,230 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 231
.history/entrypoints/popup/pages/DesignPic_20250812164324.tsx

@@ -1,231 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-      console.log(tab,"tab");
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 201
.history/entrypoints/popup/pages/DesignPic_20250812164810.tsx

@@ -1,201 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-      console.log(tab, "tab");
-
-      if (!tab.id) {
-        Message.error('无法获取当前标签页信息');
-        return;
-      }
-
-      try {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-          Message.success('成功获取表格数据');
-
-        } else {
-          console.log("页面上未找到表格数据");
-          Message.warning('页面上未找到表格数据');
-        }
-      } catch (sendMessageError: any) {
-        console.error("发送消息失败:", sendMessageError);
-        if (sendMessageError?.message?.includes('Could not establish connection') ||
-          sendMessageError?.message?.includes('Receiving end does not exist')) {
-          Message.error('无法连接到页面内容脚本,请确保已在支持的页面上运行此扩展,或刷新页面后重试');
-        } else {
-          Message.error('获取数据时发生错误: ' + sendMessageError.message);
-        }
-      }
-
-    } catch (error: any) {
-      console.error("获取表格数据失败:", error);
-      Message.error('获取标签页信息失败: ' + error.message);
-    }
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 230
.history/entrypoints/popup/pages/DesignPic_20250812165136.tsx

@@ -1,230 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 116
.history/entrypoints/popup/pages/DesignPic_20250812170606.tsx

@@ -1,116 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-    
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a 
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = () => {
-    
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 116
.history/entrypoints/popup/pages/DesignPic_20250812170807.tsx

@@ -1,116 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-    
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a 
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = () => {
-    
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 159
.history/entrypoints/popup/pages/DesignPic_20250812171202.tsx

@@ -1,159 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (!tab.id) {
-        Message.error('无法获取当前标签页信息');
-        return;
-      }
-
-      // 发送消息到 content script 请求获取图片数据
-      const response = await browser.tabs.sendMessage(tab.id, { action: "getImages" });
-
-      if (response.error) {
-        Message.error('获取图片时出错: ' + response.error);
-        return;
-      }
-
-      if (response.images && response.images.length > 0) {
-        // 处理获取到的图片数据并更新表格
-        const newTableData = response.images.map((img: any, index: number) => ({
-          key: index,
-          url: img.url,
-          title: { name: img.alt || `图片 ${index + 1}` },
-          id: index,
-          time: Date.now(),
-          picName: img.alt || `图片 ${index + 1}`,
-          picLabel: `${img.element}${img.class ? '.' + img.class : ''}${img.id ? '#' + img.id : ''}`
-        }));
-
-        setTableData(newTableData);
-        Message.success(`成功获取到 ${response.images.length} 张图片`);
-      } else {
-        Message.warning('未找到图片');
-        setTableData([]);
-      }
-    } catch (error: any) {
-      console.error("获取图片数据失败:", error);
-      if (error?.message?.includes('Could not establish connection') ||
-        error?.message?.includes('Receiving end does not exist')) {
-        Message.error('无法连接到页面内容脚本,请确保扩展已在当前页面激活');
-      } else {
-        Message.error('获取图片数据失败: ' + error.message);
-      }
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 171
.history/entrypoints/popup/pages/DesignPic_20250812171743.tsx

@@ -1,171 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (!tab.id) {
-        Message.error('无法获取当前标签页信息');
-        return;
-      }
-
-      // 检查是否是受限制的页面
-      const restrictedUrls = ['chrome://', 'chrome-extension://', 'about:'];
-      if (restrictedUrls.some(url => tab.url?.startsWith(url))) {
-        Message.error('无法在浏览器内部页面或扩展页面上获取图片,请切换到普通网页');
-        return;
-      }
-
-      try {
-        // 发送消息到 content script 请求获取图片数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getImages" });
-
-        if (response.error) {
-          Message.error('获取图片时出错: ' + response.error);
-          return;
-        }
-
-        if (response.images && response.images.length > 0) {
-          // 处理获取到的图片数据并更新表格
-          const newTableData = response.images.map((img: any, index: number) => ({
-            key: index,
-            url: img.url,
-            title: { name: img.alt || `图片 ${index + 1}` },
-            id: index,
-            time: Date.now(),
-            picName: img.alt || `图片 ${index + 1}`,
-            picLabel: `${img.element}${img.class ? '.' + img.class : ''}${img.id ? '#' + img.id : ''}`
-          }));
-
-          setTableData(newTableData);
-          Message.success(`成功获取到 ${response.images.length} 张图片`);
-        } else {
-          Message.warning('未找到图片');
-          setTableData([]);
-        }
-      } catch (sendMessageError: any) {
-        console.error("发送消息失败:", sendMessageError);
-        if (sendMessageError?.message?.includes('Could not establish connection') ||
-          sendMessageError?.message?.includes('Receiving end does not exist')) {
-          Message.error('无法连接到页面内容脚本,请尝试以下解决方案:\n1. 刷新当前页面\n2. 确保您在普通网页上(非浏览器内部页面)\n3. 检查扩展权限设置');
-        } else {
-          Message.error('获取图片数据失败: ' + sendMessageError.message);
-        }
-      }
-    } catch (error: any) {
-      console.error("获取标签页信息失败:", error);
-      Message.error('获取标签页信息失败: ' + error.message);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 171
.history/entrypoints/popup/pages/DesignPic_20250812172029.tsx

@@ -1,171 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (!tab.id) {
-        Message.error('无法获取当前标签页信息');
-        return;
-      }
-
-      // 检查是否是受限制的页面
-      const restrictedUrls = ['chrome://', 'chrome-extension://', 'about:'];
-      if (restrictedUrls.some(url => tab.url?.startsWith(url))) {
-        Message.error('无法在浏览器内部页面或扩展页面上获取图片,请切换到普通网页');
-        return;
-      }
-
-      try {
-        // 发送消息到 content script 请求获取图片数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getImages" });
-
-        if (response.error) {
-          Message.error('获取图片时出错: ' + response.error);
-          return;
-        }
-
-        if (response.images && response.images.length > 0) {
-          // 处理获取到的图片数据并更新表格
-          const newTableData = response.images.map((img: any, index: number) => ({
-            key: index,
-            url: img.url,
-            title: { name: img.alt || `图片 ${index + 1}` },
-            id: index,
-            time: Date.now(),
-            picName: img.alt || `图片 ${index + 1}`,
-            picLabel: `${img.element}${img.class ? '.' + img.class : ''}${img.id ? '#' + img.id : ''}`
-          }));
-
-          setTableData(newTableData);
-          Message.success(`成功获取到 ${response.images.length} 张图片`);
-        } else {
-          Message.warning('未找到图片');
-          setTableData([]);
-        }
-      } catch (sendMessageError: any) {
-        console.error("发送消息失败:", sendMessageError);
-        if (sendMessageError?.message?.includes('Could not establish connection') ||
-          sendMessageError?.message?.includes('Receiving end does not exist')) {
-          Message.error('无法连接到页面内容脚本,请尝试以下解决方案:\n1. 刷新当前页面\n2. 确保您在普通网页上(非浏览器内部页面)\n3. 检查扩展权限设置');
-        } else {
-          Message.error('获取图片数据失败: ' + sendMessageError.message);
-        }
-      }
-    } catch (error: any) {
-      console.error("获取标签页信息失败:", error);
-      Message.error('获取标签页信息失败: ' + error.message);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 181
.history/entrypoints/popup/pages/DesignPic_20250812172534.tsx

@@ -1,181 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-const getPicData = async () => {
-  try {
-    // 获取当前活动标签页
-    const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-    
-    if (!tab.id) {
-      Message.error('无法获取当前标签页信息');
-      return;
-    }
-
-    // 检查是否是受限制的页面
-    const restrictedUrls = ['chrome://', 'chrome-extension://', 'about:'];
-    if (restrictedUrls.some(url => tab.url?.startsWith(url))) {
-      Message.error('无法在浏览器内部页面或扩展页面上获取图片,请切换到普通网页(如百度、淘宝等)');
-      return;
-    }
-
-    try {
-      // 发送消息到 content script 请求获取图片数据
-      const response = await browser.tabs.sendMessage(tab.id, { action: "getImages" });
-      
-      if (response.error) {
-        Message.error('获取图片时出错: ' + response.error);
-        return;
-      }
-      
-      if (response.images && response.images.length > 0) {
-        // 处理获取到的图片数据并更新表格
-        const newTableData = response.images.map((img: any, index: number) => ({
-          key: index,
-          url: img.url,
-          title: { name: img.alt || `图片 ${index + 1}` },
-          id: index,
-          time: Date.now(),
-          picName: img.alt || `图片 ${index + 1}`,
-          picLabel: `${img.element}${img.class ? '.' + img.class : ''}${img.id ? '#' + img.id : ''}`
-        }));
-        
-        setTableData(newTableData);
-        Message.success(`成功获取到 ${response.images.length} 张图片`);
-      } else {
-        Message.warning('在当前页面未找到图片');
-        setTableData([]);
-      }
-    } catch (sendMessageError: any) {
-      console.error("发送消息失败:", sendMessageError);
-      if (sendMessageError?.message?.includes('Could not establish connection') || 
-          sendMessageError?.message?.includes('Receiving end does not exist')) {
-        Message.error(
-          <div>
-            <div>无法连接到页面内容脚本,请按以下步骤操作:</div>
-            <ol className="list-decimal list-inside mt-2">
-              <li>刷新当前页面后再次尝试</li>
-              <li>确保您在普通网页上(如百度、淘宝等,非浏览器设置页面)</li>
-              <li>检查扩展权限:右键扩展图标 → "此扩展程序可访问的网站" → 选择"在所有网站上"</li>
-              <li>如果问题仍然存在,请重新加载扩展或重启浏览器</li>
-            </ol>
-          </div>
-        );
-      } else {
-        Message.error('获取图片数据失败: ' + sendMessageError.message);
-      }
-    }
-  } catch (error: any) {
-    console.error("获取标签页信息失败:", error);
-    Message.error('获取标签页信息失败: ' + error.message);
-  }
-};
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 203
.history/entrypoints/popup/pages/DesignPic_20250812172612.tsx

@@ -1,203 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (!tab.id) {
-        Message.error('无法获取当前标签页信息');
-        return;
-      }
-
-      // 检查是否是受限制的页面
-      const restrictedUrls = ['chrome://', 'chrome-extension://', 'about:'];
-      if (restrictedUrls.some(url => tab.url?.startsWith(url))) {
-        Message.error('无法在浏览器内部页面或扩展页面上获取图片,请切换到普通网页(如百度、淘宝等)');
-        return;
-      }
-
-      try {
-        // 发送消息到 content script 请求获取图片数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getImages" });
-
-        if (response.error) {
-          Message.error('获取图片时出错: ' + response.error);
-          return;
-        }
-
-        if (response.images && response.images.length > 0) {
-          // 处理获取到的图片数据并更新表格
-          const newTableData = response.images.map((img: any, index: number) => ({
-            key: index,
-            url: img.url,
-            title: { name: img.alt || `图片 ${index + 1}` },
-            id: index,
-            time: Date.now(),
-            picName: img.alt || `图片 ${index + 1}`,
-            picLabel: `${img.element}${img.class ? '.' + img.class : ''}${img.id ? '#' + img.id : ''}`
-          }));
-
-          setTableData(newTableData);
-          Message.success(`成功获取到 ${response.images.length} 张图片`);
-        } else {
-          Message.warning('在当前页面未找到图片');
-          setTableData([]);
-        }
-      } catch (sendMessageError: any) {
-        console.error("发送消息失败:", sendMessageError);
-        if (sendMessageError?.message?.includes('Could not establish connection') ||
-          sendMessageError?.message?.includes('Receiving end does not exist')) {
-          Message.error(
-            <div>
-              <div>无法连接到页面内容脚本,请按以下步骤操作:</div>
-              <ol className="list-decimal list-inside mt-2">
-                <li>刷新当前页面后再次尝试</li>
-                <li>确保您在普通网页上(如百度、淘宝等,非浏览器设置页面)</li>
-                <li>检查扩展权限:右键扩展图标 → "此扩展程序可访问的网站" → 选择"在所有网站上"</li>
-                <li>如果问题仍然存在,请重新加载扩展或重启浏览器</li>
-              </ol>
-            </div>
-          );
-        } else {
-          Message.error('获取图片数据失败: ' + sendMessageError.message);
-        }
-      }
-    } catch (error: any) {
-      console.error("获取标签页信息失败:", error);
-      Message.error('获取标签页信息失败: ' + error.message);
-    }
-  };
-
-  const testConnection = async () => {
-    try {
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (!tab.id) {
-        Message.error('无法获取当前标签页信息');
-        return;
-      }
-
-      // 发送一个简单的测试消息
-      await browser.tabs.sendMessage(tab.id, { action: "test" });
-      Message.success('连接测试成功!Content script 正常工作');
-    } catch (error: any) {
-      if (error?.message?.includes('Could not establish connection')) {
-        Message.error('连接测试失败:Content script 未在当前页面加载');
-      } else {
-        Message.error('连接测试失败:' + error.message);
-      }
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Button onClick={() => testConnection()}>测试连接</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 229
.history/entrypoints/popup/pages/DesignPic_20250812173407.tsx

@@ -1,229 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 229
.history/entrypoints/popup/pages/DesignPic_20250812173713.tsx

@@ -1,229 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-            }
-            // good_info  sku_info  design_info: region text picture
-          });
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-          console.log(tables_arr, "tables_arrddd")
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 278
.history/entrypoints/popup/pages/DesignPic_20250813103030.tsx

@@ -1,278 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string | null>(null);
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        picName: '1235',
-        picLabel: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picName}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.picLabel}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picName = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].picLabel = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        }
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          params_arr.forEach((item, index) => {
-
-          })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 279
.history/entrypoints/popup/pages/DesignPic_20250813105303.tsx

@@ -1,279 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string | null>(null);
-  const [params, setParams] = useState<any[]>([]);
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState(() => {
-    const result = [];
-    for (let i = 0; i < 5; i++) {
-      result.push({
-        // title: { name: `Quotation for 1PCS Nano ${3 + i}.0 controller compatible` },
-        id: 100306660940 + i,
-        time: 2e3 + i,
-        // 添加名称和标签字段
-        title: '1235',
-        label: ''
-      });
-    }
-    return result;
-  });
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.url} alt={record.title} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        }
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          params_arr.map((item, index) => item.cur_index = index + 1)
-          console.log(params_arr,"params_arr")
-          setParams(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 265
.history/entrypoints/popup/pages/DesignPic_20250813105544.tsx

@@ -1,265 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string | null>(null);
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        }
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          params_arr.map((item, index) => item.cur_index = index + 1)
-          console.log(params_arr,"params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 320
.history/entrypoints/popup/pages/DesignPic_20250813113512.tsx

@@ -1,320 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button style={{ marginBottom: '10px' }} onClick={() => {
-        getPicData()
-      }}>获取定制图片数据</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-      <Button onClick={() => {
-        uploadPic()
-      }}>上传图片</Button>
-    </div>
-  )
-}

+ 0 - 321
.history/entrypoints/popup/pages/DesignPic_20250813113756.tsx

@@ -1,321 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} style={{ marginBottom: '10px' }} onClick={() => {
-        uploadPic()
-      }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813113827.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813114002.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813123735.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813123819.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[12],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813124018.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[12],
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[3],
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const prarm = {
-              title: '',
-              label: '',
-              file: '',
-              cur_index: ''
-            };
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813124507.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[12],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[3],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 322
.history/entrypoints/popup/pages/DesignPic_20250813133842.tsx

@@ -1,322 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 323
.history/entrypoints/popup/pages/DesignPic_20250813134508.tsx

@@ -1,323 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas,"table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 325
.history/entrypoints/popup/pages/DesignPic_20250813134541.tsx

@@ -1,325 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data,"data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas,"table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 326
.history/entrypoints/popup/pages/DesignPic_20250813135007.tsx

@@ -1,326 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data,"data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas,"table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 328
.history/entrypoints/popup/pages/DesignPic_20250813135215.tsx

@@ -1,328 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  file: '',
-                  category_id: '',
-                  category_name: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data,"data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas,"table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 328
.history/entrypoints/popup/pages/DesignPic_20250813135420.tsx

@@ -1,328 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            const sku_info = item.sku_info?.text?.split('SKU:')
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${sku_info[1]}-${design_item.region}`
-                  prarm.label = `${sku_info[1]}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 337
.history/entrypoints/popup/pages/DesignPic_20250813144325.tsx

@@ -1,337 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 337
.history/entrypoints/popup/pages/DesignPic_20250813144433.tsx

@@ -1,337 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url;
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 363
.history/entrypoints/popup/pages/DesignPic_20250813145924.tsx

@@ -1,363 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr = []
-          tables_arr.forEach(item => {
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no && items.picture && items.picture != '-') {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = items.text
-                  param['design_pic'] = bg_pic
-                }
-              })
-            }
-          })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 379
.history/entrypoints/popup/pages/DesignPic_20250813150813.tsx

@@ -1,379 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr,"pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 380
.history/entrypoints/popup/pages/DesignPic_20250813152600.tsx

@@ -1,380 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          // let tables_arr: {
-          //   good_info: any;
-          //   sku_info: any;
-          //   order_no: any;
-          //   design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          // }[] = [];
-          // let table_boj: {
-          //   good_info: any;
-          //   sku_info: any;
-          //   order_no: any;
-          //   design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          // } = {
-          //   good_info: null,
-          //   sku_info: null,
-          //   order_no: null,
-          //   design_info: []
-          // };
-
-          const table_arrs = response.tables // 表格数组
-          let i = 0, table_node = table_arrs[i], tables_arr = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            design_info: { region: any; text: any; picture: any }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            design_info: []
-          };
-          while (i < response.tables.length) {
-            // 长度大于4时,指针改变
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],
-                }]
-              }
-              i++
-              table_node = table_arrs[i]
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],
-              })
-              i++
-              table_node = table_arrs[i]
-            }
-          }
-
-          // response.tables.forEach((table_node: any, index: number) => {
-          //   console.log(`表格 ${index + 1}:`, table_node);
-          //   // 处理成接口参数
-
-          //   // 处理成数组对象
-          //   if (table_node.length > 4) {
-          //     if (table_boj.design_info.length) {
-          //       // 一个商品的定制信息
-          //       tables_arr.push(table_boj)
-          //       // 重置
-          //       table_boj = {
-          //         good_info: null,
-          //         sku_info: null,
-          //         order_no: null,
-          //         design_info: []
-          //       }
-          //     }
-          //     table_boj = {
-          //       good_info: table_node[1],
-          //       sku_info: table_node[2],
-          //       order_no: table_node[3],
-          //       design_info: [{
-          //         region: table_node[9],
-          //         text: table_node[10],
-          //         picture: table_node[11],//11
-          //         cur_index: index + 1,
-          //       }]
-          //     }
-          //   } else {
-          //     table_boj.design_info.push({
-          //       region: table_node[0],
-          //       text: table_node[1],
-          //       picture: table_node[2],//2
-          //       cur_index: index + 1,
-          //     })
-          //   }
-          //   // good_info  sku_info  design_info: region text picture cur_index
-          // });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 386
.history/entrypoints/popup/pages/DesignPic_20250813152910.tsx

@@ -1,386 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-          return
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-        }
-      }).catch(error => {
-        Message.error(error.message)
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <div className='w-3xl h-fit'>
-      <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-        onClick={() => {
-          getPicData()
-        }}>获取定制图片数据</Button>
-      <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-        onClick={() => {
-          uploadPic()
-        }}>上传图片</Button>
-      <Table dataSource={dataSourceWithIndex}>
-        <Table.Column title="图片" cell={pic_render} />
-        <Table.Column title="图片名称" cell={name_render} />
-        <Table.Column title="图片标签" cell={label_render} />
-        <Table.Column title="操作" cell={option_render} />
-      </Table>
-    </div>
-  )
-}

+ 0 - 402
.history/entrypoints/popup/pages/DesignPic_20250813154341.tsx

@@ -1,402 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading...</div>
-    </div>
-  );
-
-  return (
-    <Loading indicator={indicator7} visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 402
.history/entrypoints/popup/pages/DesignPic_20250813154408.tsx

@@ -1,402 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading indicator={indicator7} visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 402
.history/entrypoints/popup/pages/DesignPic_20250813154438.tsx

@@ -1,402 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      console.log(data, "data")
-
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 400
.history/entrypoints/popup/pages/DesignPic_20250813154656.tsx

@@ -1,400 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 401
.history/entrypoints/popup/pages/DesignPic_20250813154835.tsx

@@ -1,401 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 401
.history/entrypoints/popup/pages/DesignPic_20250813154909.tsx

@@ -1,401 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_pic ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    bg_pic = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 403
.history/entrypoints/popup/pages/DesignPic_20250813160635.tsx

@@ -1,403 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    let bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 403
.history/entrypoints/popup/pages/DesignPic_20250813160641.tsx

@@ -1,403 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-  const indicator7 = (
-    <div className="load-container load7">
-      <div className="loader">loading..1111.</div>
-    </div>
-  );
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 398
.history/entrypoints/popup/pages/DesignPic_20250813162307.tsx

@@ -1,398 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 402
.history/entrypoints/popup/pages/DesignPic_20250813162955.tsx

@@ -1,402 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 410
.history/entrypoints/popup/pages/DesignPic_20250813163428.tsx

@@ -1,410 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no) {
-              pic_text_arr.push({
-                order_no,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading  visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-          <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 416
.history/entrypoints/popup/pages/DesignPic_20250813170203.tsx

@@ -1,416 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 432
.history/entrypoints/popup/pages/DesignPic_20250813171932.tsx

@@ -1,432 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-
-          // 数据显示
-          let table_data = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach(items => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 446
.history/entrypoints/popup/pages/DesignPic_20250813172423.tsx

@@ -1,446 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          fetch(`${uploadUrl}photo/temuUpload `, {
-            method: 'POST',
-            headers: {
-              'Content-Type': 'application/json',
-            },
-            body: JSON.stringify(params),
-          }).then(resjson => {
-            return resjson.json();
-          }).then(res => {
-            if (res.data) {
-           
-            }
-          })
-
-          // 数据显示
-          // let table_data = []
-          // pic_text_arr.forEach(item => { 
-          //   if (item.data_params.length) {
-          //     item.data_params.forEach((items: any) => {
-          //       table_data.push({
-          //         order_no: item.order_no,
-          //         design_sku: item.design_sku,
-          //         file: items.design_pic,
-          //         region: items.region,
-          //         text: items.text,
-          //       })
-          //     })
-          //   }
-          // })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 447
.history/entrypoints/popup/pages/DesignPic_20250813172446.tsx

@@ -1,447 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          console.log(params,"params")
-          fetch(`${uploadUrl}photo/temuUpload `, {
-            method: 'POST',
-            headers: {
-              'Content-Type': 'application/json',
-            },
-            body: JSON.stringify(params),
-          }).then(resjson => {
-            return resjson.json();
-          }).then(res => {
-            if (res.data) {
-           
-            }
-          })
-
-          // 数据显示
-          // let table_data = []
-          // pic_text_arr.forEach(item => { 
-          //   if (item.data_params.length) {
-          //     item.data_params.forEach((items: any) => {
-          //       table_data.push({
-          //         order_no: item.order_no,
-          //         design_sku: item.design_sku,
-          //         file: items.design_pic,
-          //         region: items.region,
-          //         text: items.text,
-          //       })
-          //     })
-          //   }
-          // })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 447
.history/entrypoints/popup/pages/DesignPic_20250813172519.tsx

@@ -1,447 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          const params = {...pic_text_arr[3],api_token: localStorage.getItem('access_token')}
-          console.log(params,"params")
-          fetch(`${uploadUrl}photo/temuUpload `, {
-            method: 'POST',
-            headers: {
-              'Content-Type': 'application/json',
-            },
-            body: JSON.stringify(params),
-          }).then(resjson => {
-            return resjson.json();
-          }).then(res => {
-            if (res.data) {
-           
-            }
-          })
-
-          // 数据显示
-          // let table_data = []
-          // pic_text_arr.forEach(item => { 
-          //   if (item.data_params.length) {
-          //     item.data_params.forEach((items: any) => {
-          //       table_data.push({
-          //         order_no: item.order_no,
-          //         design_sku: item.design_sku,
-          //         file: items.design_pic,
-          //         region: items.region,
-          //         text: items.text,
-          //       })
-          //     })
-          //   }
-          // })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 447
.history/entrypoints/popup/pages/DesignPic_20250813172554.tsx

@@ -1,447 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          let params_arr: any[] = []
-          tables_arr.forEach(item => {
-            // const sku_info = item.sku_info?.text?.split('SKU:')
-            let order_no = ""
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(design_item => {
-                const prarm = {
-                  title: '',
-                  label: '',
-                  category_id: '',
-                  category_name: '',
-                  file: '',
-                  cur_index: ''
-                };
-                if (order_no && design_item.picture && design_item.picture != '-') {
-                  // const text = design_item.text.split('}')
-                  const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                  let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-                  prarm.title = `${order_no}-${design_item.region}`
-                  prarm.label = `${order_no}-${design_item.region}`
-                  prarm.file = bg_file ?? '';
-                  params_arr.push(prarm)
-                }
-              })
-            }
-          })
-
-          console.log(params_arr, "params_arr")
-          setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          const params = {...pic_text_arr[3],api_token: localStorage.getItem('access_token')}
-          console.log(params,"params")
-          fetch(`http:${uploadUrl}photo/temuUpload `, {
-            method: 'POST',
-            headers: {
-              'Content-Type': 'application/json',
-            },
-            body: JSON.stringify(params),
-          }).then(resjson => {
-            return resjson.json();
-          }).then(res => {
-            if (res.data) {
-           
-            }
-          })
-
-          // 数据显示
-          // let table_data = []
-          // pic_text_arr.forEach(item => { 
-          //   if (item.data_params.length) {
-          //     item.data_params.forEach((items: any) => {
-          //       table_data.push({
-          //         order_no: item.order_no,
-          //         design_sku: item.design_sku,
-          //         file: items.design_pic,
-          //         region: items.region,
-          //         text: items.text,
-          //       })
-          //     })
-          //   }
-          // })
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 449
.history/entrypoints/popup/pages/DesignPic_20250813172925.tsx

@@ -1,449 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[3],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 449
.history/entrypoints/popup/pages/DesignPic_20250813172943.tsx

@@ -1,449 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[3],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="图片名称" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 449
.history/entrypoints/popup/pages/DesignPic_20250813173540.tsx

@@ -1,449 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          const params = {...pic_text_arr[3],api_token: localStorage.getItem('access_token')}
-          console.log(params,"params")
-          fetch(`http:${uploadUrl}photo/temuUpload `, {
-            method: 'POST',
-            headers: {
-              'Content-Type': 'application/json',
-            },
-            body: JSON.stringify(params),
-          }).then(resjson => {
-            return resjson.json();
-          }).then(res => {
-            if (res.data) {
-           
-            }
-          })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 449
.history/entrypoints/popup/pages/DesignPic_20250813173756.tsx

@@ -1,449 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          console.log(params,"params")
-          fetch(`http:${uploadUrl}photo/temuUpload `, {
-            method: 'POST',
-            headers: {
-              'Content-Type': 'application/json',
-            },
-            body: JSON.stringify(params),
-          }).then(resjson => {
-            return resjson.json();
-          }).then(res => {
-            if (res.data) {
-           
-            }
-          })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 449
.history/entrypoints/popup/pages/DesignPic_20250813173917.tsx

@@ -1,449 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.title}
-        onChange={(value) => handleNameChange(value, index)}
-        composition
-        placeholder={'请输入图片名称'}
-      />
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <Input.TextArea
-        value={record.label}
-        onChange={(value) => handleLabelChange(value, index)}
-        composition
-        placeholder={'请输入图片标签'}
-      />
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="" cell={name_render} />
-          <Table.Column title="图片标签" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 439
.history/entrypoints/popup/pages/DesignPic_20250813174324.tsx

@@ -1,439 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 添加名称变化处理函数
-  const handleNameChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].title = value;
-    setTableData(newData);
-  };
-
-  // 添加标签变化处理函数
-  const handleLabelChange = (value: string, index: number) => {
-    const newData = [...tableData];
-    newData[index].label = value;
-    setTableData(newData);
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 418
.history/entrypoints/popup/pages/DesignPic_20250813174400.tsx

@@ -1,418 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 425
.history/entrypoints/popup/pages/DesignPic_20250813174421.tsx

@@ -1,425 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 425
.history/entrypoints/popup/pages/DesignPic_20250813174448.tsx

@@ -1,425 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 428
.history/entrypoints/popup/pages/DesignPic_20250813174832.tsx

@@ -1,428 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-           
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => { 
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData,"tableData")
-    
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 453
.history/entrypoints/popup/pages/DesignPic_20250813180128.tsx

@@ -1,453 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj,"table_obj",Object.values(table_obj))
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}sheInPhoto/upload`
-    } else {
-      fetch_url = `http:${uploadUrl}sheInPhoto/upload`
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 485
.history/entrypoints/popup/pages/DesignPic_20250813181452.tsx

@@ -1,485 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error,"arr_index",arr_index)
-        } else {
-          arr_index++
-          if (arr_index < table_params.length) {
-            FetchFun(table_params[arr_index])
-          } else {
-            Message.success("图片上传完成")
-          }
-        }
-      }).catch(err => {
-        console.log(err, "err")
-      })
-    }
-
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 485
.history/entrypoints/popup/pages/DesignPic_20250814091334.tsx

@@ -1,485 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error,"arr_index",arr_index)
-        } else {
-          arr_index++
-          if (arr_index < table_params.length) {
-            FetchFun(table_params[arr_index])
-          } else {
-            Message.success("图片上传完成")
-          }
-        }
-      }).catch(err => {
-        console.log(err, "err")
-      })
-    }
-
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 492
.history/entrypoints/popup/pages/DesignPic_20250814091908.tsx

@@ -1,492 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        } else {
-          arr_index++
-          if (arr_index < table_params.length) {
-            FetchFun(table_params[arr_index])
-          } else {
-            Message.success("图片上传完成")
-          }
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          Message.success("图片上传完成")
-        }
-      })
-    }
-
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 492
.history/entrypoints/popup/pages/DesignPic_20250814091930.tsx

@@ -1,492 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        } else {
-          arr_index++
-          if (arr_index < table_params.length) {
-            FetchFun(table_params[arr_index])
-          } else {
-            Message.success("图片上传结束")
-          }
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          Message.success("图片上传结束")
-        }
-      })
-    }
-
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 493
.history/entrypoints/popup/pages/DesignPic_20250814093143.tsx

@@ -1,493 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <img className='size-20' src={record.file} alt={record.cur_index} />
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 500
.history/entrypoints/popup/pages/DesignPic_20250814094635.tsx

@@ -1,500 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading, Icon } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <>
-        {
-          record.file ? <>
-            <img className='size-20' src={record.file}/></> : <>
-            <Icon type="picture" />
-          </>
-        }
-      </>
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 503
.history/entrypoints/popup/pages/DesignPic_20250814095747.tsx

@@ -1,503 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading, Icon } from '@alifd/next';
-import '@alifd/next/dist/next.css';
-// 如果使用了图标,可能还需要导入图标字体
-import '@alifd/next/dist/next-icon.css'; // 或者类似路径
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <>
-        {
-          record.file ? <>
-            <img className='size-20' src={record.file}/></> : <>
-            <Icon type="picture" />
-          </>
-        }
-      </>
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 501
.history/entrypoints/popup/pages/DesignPic_20250814095806.tsx

@@ -1,501 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading, Icon } from '@alifd/next';
-import '@alifd/next/dist/next.css';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <>
-        {
-          record.file ? <>
-            <img className='size-20' src={record.file}/></> : <>
-            <Icon type="picture" />
-          </>
-        }
-      </>
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 501
.history/entrypoints/popup/pages/DesignPic_20250814095831.tsx

@@ -1,501 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading, Icon } from '@alifd/next';
-import '@alifd/next/dist/next.min.css';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <>
-        {
-          record.file ? <>
-            <img className='size-20' src={record.file}/></> : <>
-            <Icon type="picture" />
-          </>
-        }
-      </>
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 500
.history/entrypoints/popup/pages/DesignPic_20250814095853.tsx

@@ -1,500 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading, Icon } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <>
-        {
-          record.file ? <>
-            <img className='size-20' src={record.file}/></> : <>
-            <Icon type="picture" />
-          </>
-        }
-      </>
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

+ 0 - 500
.history/entrypoints/popup/pages/DesignPic_20250814100138.tsx

@@ -1,500 +0,0 @@
-import React, { useState } from 'react'
-import { Button, Table, Input, Message, Loading, Icon } from '@alifd/next';
-
-export default function DesignPic() {
-  const [uploadUrl, setUploadUrl] = useState<string>("");
-  // 添加状态管理表格数据
-  const [tableData, setTableData] = useState<any[]>([]);
-  const [loading, setLoading] = useState(false);
-
-  const pic_render = (value: any, index: any, record: any) => {
-    return (
-      <>
-        {
-          record.file ? <>
-            <img className='size-20' src={record.file}/></> : <>
-             <span>暂无图片</span>
-          </>
-        }
-      </>
-    );
-  }
-
-  const text_render = (value: any, index: any, record: any) => {
-    return (
-      <p>{record.text}</p>
-    );
-  }
-
-
-  // 修改图片名称渲染函数
-  const name_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.design_sku}</div>
-    </>
-  };
-
-  // 修改图片标签渲染函数
-  const label_render = (value: any, index: number, record: any) => {
-    return <>
-      <div>{record.region}</div>
-    </>
-  };
-
-  // 完善删除功能
-  const handleDelete = (index: number, record: any) => {
-    // 方案1: 直接删除
-    const newData = [...tableData];
-    newData.splice(index, 1);
-    setTableData(newData);
-
-    // 方案2: 带确认的删除 (可选)
-    // if (window.confirm(`确定要删除 "${record.title.name}" 吗?`)) {
-    //   const newData = [...tableData];
-    //   newData.splice(index, 1);
-    //   setTableData(newData);
-    //   Message.success('删除成功');
-    // }
-  };
-
-  // 删除操作渲染函数
-  const option_render = (value: any, index: number, record: any) => {
-    return (
-      <a
-        className='text-red-600 cursor-pointer'
-        onClick={() => handleDelete(index, record)}
-      >
-        删除
-      </a>
-    );
-  };
-
-  // 添加行索引以确保正确删除
-  const dataSourceWithIndex = tableData.map((item, index) => ({
-    ...item,
-    index
-  }));
-
-  const getPicData = async () => {
-    try {
-      setLoading(true)
-      // 获取上传路径
-      fetch('http://merchant.landwu.com/api/photo/getUploadUrl', {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify({
-          api_token: localStorage.getItem('access_token'),
-        }),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data) {
-          const { data = {} } = res;
-          const { url = null } = data;
-          setUploadUrl(url)
-          setLoading(false)
-        }
-      })
-      // 获取当前活动标签页
-      const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
-
-      if (tab.id) {
-        // 发送消息到content script请求获取tbody数据
-        const response = await browser.tabs.sendMessage(tab.id, { action: "getTbodyData" });
-        const table_datas = []
-        // 在控制台输出结果
-        if (response.tables && response.tables.length > 0) {
-          console.log("找到的表格数据(包含背景图片):");
-          // 显式声明类型
-          let tables_arr: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          }[] = [];
-          let table_boj: {
-            good_info: any;
-            sku_info: any;
-            order_no: any;
-            design_sku: any;
-            design_info: { region: any; text: any; picture: any, cur_index: number }[];
-          } = {
-            good_info: null,
-            sku_info: null,
-            order_no: null,
-            design_sku: null,
-            design_info: []
-          };
-
-          response.tables.forEach((table_node: any, index: number) => {
-            console.log(`表格 ${index + 1}:`, table_node);
-            // 处理成接口参数
-
-            // 处理成数组对象
-            if (table_node.length > 4) {
-              if (table_boj.design_info.length) {
-                // 一个商品的定制信息
-                tables_arr.push(table_boj)
-                // 重置
-                table_boj = {
-                  good_info: null,
-                  sku_info: null,
-                  order_no: null,
-                  design_sku: null,
-                  design_info: []
-                }
-              }
-              table_boj = {
-                good_info: table_node[1],
-                sku_info: table_node[2],
-                order_no: table_node[3],
-                design_sku: table_node[4],
-                design_info: [{
-                  region: table_node[9],
-                  text: table_node[10],
-                  picture: table_node[11],//11
-                  cur_index: index + 1,
-                }]
-              }
-            } else {
-              table_boj.design_info.push({
-                region: table_node[0],
-                text: table_node[1],
-                picture: table_node[2],//2
-                cur_index: index + 1,
-              })
-              // 循环结束
-              if (index == response.tables.length - 1) {
-                if (table_boj.design_info.length) {
-                  // 一个商品的定制信息
-                  tables_arr.push(table_boj)
-                }
-              }
-            }
-            // good_info  sku_info  design_info: region text picture cur_index
-          });
-
-          console.log(tables_arr, "tables_arrddd")
-
-          // 上传图片的参数处理
-          // let params_arr: any[] = []
-          // tables_arr.forEach(item => {
-          //   // const sku_info = item.sku_info?.text?.split('SKU:')
-          //   let order_no = ""
-          //   if (item.order_no && item.order_no != "-") {
-          //     order_no = item.order_no.substring(0, 15); // 取前15位
-          //   }
-          //   if (item.design_info.length) {
-          //     item.design_info.forEach(design_item => {
-          //       const prarm = {
-          //         title: '',
-          //         label: '',
-          //         category_id: '',
-          //         category_name: '',
-          //         file: '',
-          //         cur_index: ''
-          //       };
-          //       if (order_no && design_item.picture && design_item.picture != '-') {
-          //         // const text = design_item.text.split('}')
-          //         const bg_pic = (design_item.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-          //         let bg_file = bg_pic.split('&imageMogr2/thumbnail/60x60')[0]
-          //         prarm.title = `${order_no}-${design_item.region}`
-          //         prarm.label = `${order_no}-${design_item.region}`
-          //         prarm.file = bg_file ?? '';
-          //         params_arr.push(prarm)
-          //       }
-          //     })
-          //   }
-          // })
-
-          // console.log(params_arr, "params_arr")
-          // setTableData(params_arr)
-
-          // 上传图片和文字的参数处理
-          let pic_text_arr: any[] = []
-          tables_arr.forEach(item => {
-            let order_no = "", data_params: any[] = []
-            if (item.order_no && item.order_no != "-") {
-              order_no = item.order_no.substring(0, 15); // 取前15位
-            }
-            if (item.design_info.length) {
-              item.design_info.forEach(items => {
-                const param: any = {}
-                if (order_no || item.design_sku) {
-                  let bg_pic = ""
-                  if (items.picture && items.picture != '-') {
-                    let bg_pic1 = (items.picture.backgroundImages as { url: string }[] | undefined)?.[0]?.url ?? '';
-                    bg_pic = bg_pic1.split('&imageMogr2/thumbnail/60x60')[0]
-                  } else {
-                    bg_pic = ""
-                  }
-                  let des_text = ""
-                  if (items.text && items.text != '-') {
-                    const des_text1 = items.text.split(";}")[1]
-                    des_text = des_text1.split("查看")[0]
-                  } else {
-                    des_text = ""
-                  }
-                  param['region'] = items.region
-                  param['text'] = des_text
-                  param['design_pic'] = bg_pic
-                  data_params.push(param)
-                }
-              })
-            }
-            if (order_no || item.design_sku) {
-              pic_text_arr.push({
-                order_no,
-                design_sku: item.design_sku,
-                data_params
-              })
-            }
-          })
-
-          console.log(pic_text_arr, "pic_text_arr")
-          // const params = {...pic_text_arr[0],api_token: localStorage.getItem('access_token')}
-          // console.log(params,"params")
-          // fetch(`http:${uploadUrl}photo/temuUpload `, {
-          //   method: 'POST',
-          //   headers: {
-          //     'Content-Type': 'application/json',
-          //   },
-          //   body: JSON.stringify(params),
-          // }).then(resjson => {
-          //   return resjson.json();
-          // }).then(res => {
-          //   if (res.data) {
-
-          //   }
-          // })
-
-          // 数据显示
-          let table_data: any[] = []
-          pic_text_arr.forEach(item => {
-            if (item.data_params.length) {
-              item.data_params.forEach((items: any) => {
-                table_data.push({
-                  order_no: item.order_no,
-                  design_sku: item.design_sku,
-                  file: items.design_pic,
-                  region: items.region,
-                  text: items.text,
-                })
-              })
-            }
-          })
-
-          setTableData(table_data)
-
-          // const table_arrs = response.tables // 表格数组
-          // let i = 0, table_node = table_arrs[i], tables_arr = [];
-          // let table_boj: {
-          //     good_info: any;
-          //     sku_info: any;
-          //     design_info: { region: any; text: any; picture: any }[];
-          // } = {
-          //     good_info: null,
-          //     sku_info: null,
-          //     design_info: []
-          // };
-          // while (i < response.tables.length) {
-          //     // 长度大于4时,指针改变
-          //     if (table_node.length > 4) {
-          //         if (table_boj.design_info.length) {
-          //             // 一个商品的定制信息
-          //             tables_arr.push(table_boj)
-          //             // 重置
-          //             table_boj = {
-          //                 good_info: null,
-          //                 sku_info: null,
-          //                 design_info: []
-          //             }
-          //         }
-          //         table_boj = {
-          //             good_info: table_node[1],
-          //             sku_info: table_node[2],
-          //             design_info: [{
-          //                 region: table_node[9],
-          //                 text: table_node[10],
-          //                 picture: table_node[11],
-          //             }]
-          //         }
-          //         i++
-          //         table_node = table_arrs[i]
-          //     } else {
-          //         table_boj.design_info.push({
-          //             region: table_node[0],
-          //             text: table_node[1],
-          //             picture: table_node[2],
-          //         })
-          //         i++
-          //         table_node = table_arrs[i]
-          //     }
-          // }
-
-
-        } else {
-          console.log("页面上未找到表格数据");
-        }
-      }
-    } catch (error) {
-      console.error("获取表格数据失败:", error);
-    }
-  };
-
-  const uploadPic = () => {
-    const token = localStorage.getItem("access_token");
-    console.log(tableData, "tableData")
-    let table_obj: { [key: string]: any } = {};
-    tableData.forEach(item => {
-      if (table_obj[item.design_sku]) {
-        const data_params = table_obj[item.design_sku].data_params
-        data_params.push({
-          design_pic: item.file,
-          region: item.region,
-          text: item.text
-        })
-        table_obj[item.design_sku] = {
-          ...table_obj[item.design_sku],
-          data_params,
-        }
-      } else {
-        table_obj[item.design_sku] = {
-          order_no: item.order_no,
-          design_sku: item.design_sku,
-          data_params: [{
-            design_pic: item.file,
-            region: item.region,
-            text: item.text
-          }]
-        }
-      }
-    })
-    console.log(table_obj, "table_obj", Object.values(table_obj))
-    const table_params = Object.values(table_obj)
-    let fetch_url = "", arr_index = 0
-    if (uploadUrl.includes('http')) {
-      fetch_url = `${uploadUrl}photo/temuUpload`
-    } else {
-      fetch_url = `http:${uploadUrl}photo/temuUpload`
-    }
-    const FetchFun = (params: any) => {
-      console.log(params, "params")
-      params['api_token'] = token
-      fetch(fetch_url, {
-        method: 'POST',
-        headers: {
-          'Content-Type': 'application/json',
-        },
-        body: JSON.stringify(params),
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.data.error && res.data.error.length) {
-          // 未上传成功的 图片
-          console.log(res.data.error, "arr_index", arr_index)
-        }
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      }).catch(err => {
-        console.log(err, "err")
-        arr_index++
-        if (arr_index < table_params.length) {
-          FetchFun(table_params[arr_index])
-        } else {
-          setLoading(false)
-          Message.success("图片上传结束")
-        }
-      })
-    }
-    setLoading(true)
-    FetchFun(table_params[arr_index])
-
-
-
-    return
-    // 在此处添加下标索引参数
-    const table_datas = tableData.map((item, index) => {
-      item.cur_index = index + 1
-      item.api_token = token
-      return item
-    })
-    if (!uploadUrl) {
-      Message.error("图片上传路径未获取到,请重新点击获取定制图片数据按钮")
-      return
-    }
-    const fetch_fn = (data: any) => {
-      const formData = new FormData()
-      for (var key in data) {
-        formData.append(key, data[key])
-      }
-      fetch(fetch_url, {
-        method: 'POST',
-        // headers: {
-        //   'Content-Type': 'application/json',
-        // },
-        body: formData,
-        mode: 'cors'
-      }).then(resjson => {
-        return resjson.json();
-      }).then(res => {
-        if (res.code == -1) {
-          Message.error(res.msg)
-        }
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        } else {
-          // 上传完成
-          Message.success(res.msg)
-          setLoading(false)
-        }
-      }).catch(error => {
-        setLoading(false)
-        Message.error(error.message)
-        arr_index++
-        if (arr_index < table_datas.length) {
-          fetch_fn(table_datas[arr_index])
-        }
-      })
-    }
-
-    console.log(table_datas, "table_datasss")
-    setLoading(true)
-    fetch_fn(table_datas[arr_index])
-
-
-    // setTableData(tableData)
-  }
-
-  return (
-    <Loading visible={loading} fullScreen>
-      <div className='w-3xl h-fit'>
-        <Button type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            getPicData()
-          }}>获取定制图片数据</Button>
-        <Button disabled={!tableData.length} type="primary" style={{ marginBottom: '10px', marginRight: '10px' }}
-          onClick={() => {
-            uploadPic()
-          }}>上传图片</Button>
-        <span className='text-red-500'>ps:上传图片过程中请勿关闭插件</span>
-        <Table dataSource={dataSourceWithIndex}>
-          <Table.Column title="图片" cell={pic_render} />
-          <Table.Column title="定制SKU" cell={name_render} />
-          <Table.Column title="定制区域" cell={label_render} />
-          <Table.Column title="文字" cell={text_render} />
-          <Table.Column title="操作" cell={option_render} />
-        </Table>
-      </div>
-    </Loading>
-  )
-}

Some files were not shown because too many files changed in this diff