From cd25fa5e9a5950643dbb60244b015db0a388a33a Mon Sep 17 00:00:00 2001 From: tangjie <122778500@qq.com> Date: Fri, 17 Jul 2026 10:17:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95wps=20=E7=9A=84sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +-- src/pages/Container/Test/edtior/index.js | 46 ++++++++---------------- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 1c7fd50..80ae5dd 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ }, "dependencies": { "@ant-design/icons": "^5.0.0", - "@cqsjjb/jjb-common-decorator": "latest", "@cqsjjb/jjb-common-lib": "latest", "@cqsjjb/jjb-dva-runtime": "latest", @@ -29,12 +28,11 @@ "@eigenpal/docx-editor-react": "^1.9.0", "@rc-component/motion": "^1.0.0", "@rc-component/util": "^1.11.1", - "antd": "^5.29.2", "dayjs": "^1.11.7", "echarts": "^6.1.0", "lodash-es": "^4.17.21", - + "react": "^18.2.0", "react-dom": "^18.2.0", "zy-react-library": "^1.2.3" @@ -46,7 +44,6 @@ "@babel/preset-react": "^7.29.7", "@cqsjjb/scripts": "latest", "@eslint-react/eslint-plugin": "^2.2.2", - "babel-loader": "^9.1.3", "cross-env": "^7.0.3", "css-loader": "^6.8.1", diff --git a/src/pages/Container/Test/edtior/index.js b/src/pages/Container/Test/edtior/index.js index ca8bf7c..d8fbbd1 100644 --- a/src/pages/Container/Test/edtior/index.js +++ b/src/pages/Container/Test/edtior/index.js @@ -1,39 +1,21 @@ // App.tsx import { useRef, useState, useEffect } from "react"; -import { DocxEditor } from "@eigenpal/docx-editor-react"; -import { createEmptyDocument } from "@eigenpal/docx-editor-core"; -import "@eigenpal/docx-editor-react/styles.css"; -import "./index.less"; +import WebOfficeSDK from "web-office-sdk-solution-v2.0.7/web-office-sdk-solution-v2.0.7.es.js"; export default function App() { - const editorRef = useRef(null); - const [currentDocument, setCurrentDocument] = useState(createEmptyDocument()); - const [documentBuffer, setDocumentBuffer] = useState(); - - const chooseWord = () => { - fetch( - `https://test-dragon-yf-pub.oss-cn-hangzhou.aliyuncs.com/jjb/6a589a40e4b0f40a8d939aa1.docx`, - ) - .then((res) => res.arrayBuffer()) - .then((buffer) => { - setDocumentBuffer(buffer); + useEffect(() => { + window.onload = async function () { + const instance = WebOfficeSDK.init({ + // 必填项 + officeType: WebOfficeSDK.OfficeType.Writer, + appId: "SX20260717TSGKEA", + fileId: "EOCVQPCDCCE4ZJ2X6MTF", }); - }; - return ( -