From e03fb16dc7b22780b18e5a90d2537051f53f0905 Mon Sep 17 00:00:00 2001 From: "853931625@qq.com" Date: Sat, 6 Dec 2025 16:16:21 +0800 Subject: [PATCH] no message --- jjb.config.js | 2 +- public/index.html | 12 ++-- src/api/courseware/index.js | 6 ++ src/assets/css/common.css | 62 +++++++++++++++++++ src/components/useImportFile/index.d.ts | 24 +++++++ src/components/useImportFile/index.js | 44 +++++++++++++ src/main.js | 4 +- .../Container/Stakeholder/CorpInfo/index.js | 3 - src/pages/Container/index.js | 34 +++++----- src/pages/index.js | 10 +-- 10 files changed, 162 insertions(+), 39 deletions(-) create mode 100644 src/api/courseware/index.js create mode 100644 src/assets/css/common.css create mode 100644 src/components/useImportFile/index.d.ts create mode 100644 src/components/useImportFile/index.js diff --git a/jjb.config.js b/jjb.config.js index ff0c1ad..1e3fa3a 100644 --- a/jjb.config.js +++ b/jjb.config.js @@ -49,7 +49,7 @@ module.exports = { // 开发服务 server: { // 监听端口号 - port: "8080", + port: "8088", // 服务地址 host: "127.0.0.1", // 是否自动打开浏览器 diff --git a/public/index.html b/public/index.html index 9bfa85d..49f1330 100644 --- a/public/index.html +++ b/public/index.html @@ -44,11 +44,11 @@ <% } %> - - - - - <% const { root } = $element; %> -
+ + + + +<% const { root } = $element; %> +
diff --git a/src/api/courseware/index.js b/src/api/courseware/index.js new file mode 100644 index 0000000..f6b7114 --- /dev/null +++ b/src/api/courseware/index.js @@ -0,0 +1,6 @@ +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const identifyPartList = declareRequest( + "coursewareLoading", + "Post > @/risk/busIdentifyPart/list", +); diff --git a/src/assets/css/common.css b/src/assets/css/common.css new file mode 100644 index 0000000..09f3746 --- /dev/null +++ b/src/assets/css/common.css @@ -0,0 +1,62 @@ +/* 打印时:隐藏所有内容 */ +@media print { + body * { + visibility: hidden; + } + + /* 只显示要打印的 div 及其子元素 */ + #print-invoice, + #print-invoice * { + visibility: visible; + } + + #print-invoice { + position: absolute; + left: 0; + top: 0; + width: 100%; + padding: 1cm; + box-sizing: border-box; + font-size: 12pt; + font-family: 'SimSun', '宋体', serif; + } + + /* 隐藏弹窗中的操作按钮(双重保险) */ + .no-print { + display: none !important; + } +} + +/* 屏幕上正常显示 */ +@media screen { + .modal-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; + } + + .modal-content { + background: white; + padding: 20px; + border-radius: 8px; + width: 80%; + max-width: 600px; + } + + .modal-actions { + margin-top: 20px; + text-align: right; + } + + .modal-actions button { + margin-left: 10px; + padding: 8px 16px; + } +} diff --git a/src/components/useImportFile/index.d.ts b/src/components/useImportFile/index.d.ts new file mode 100644 index 0000000..7ac23e4 --- /dev/null +++ b/src/components/useImportFile/index.d.ts @@ -0,0 +1,24 @@ +export interface UploadFile { + /** 原始文件对象 */ + originFileObj?: File; + [key: string]: any; +} + +interface UseImportFileOptions { + /** 要上传的文件数组 */ + files: UploadFile[]; + /** 额外携带的参数对象 */ + params?: Record; +} + +export interface ImportFileOptions { + url: string; + options: UseImportFileOptions; +} + +export type ImportFileFunction = (url: string, options: UseImportFileOptions) => Promise; + +/** + * 导入文件 + */ +export default function useImportFile(): [boolean, ImportFileFunction]; diff --git a/src/components/useImportFile/index.js b/src/components/useImportFile/index.js new file mode 100644 index 0000000..6c58ec4 --- /dev/null +++ b/src/components/useImportFile/index.js @@ -0,0 +1,44 @@ +import {request} from "@cqsjjb/jjb-common-lib/http"; +import { useState } from "react"; + +/** + * 导入文件 + */ +export default function useImportFile() { + // loading状态 + const [loading, setLoading] = useState(false); + + // 导入文件 + const importFile = (url, options) => { + setLoading(true); + + return new Promise((resolve, reject) => { + const { files = [], params = {} } = options + const formData = new FormData(); + + // 将文件添加到formData中 + files.forEach((f) => { + f.originFileObj && formData.append("file", f.originFileObj); + }); + + // 将额外携带的参数添加到formData中 + Object.keys(params).forEach((key) => { + formData.append(key, params[key]); + }); + + // 发送请求 + request(url, "post", formData, { "Content-Type": "multipart/form-data" }) + .then((res) => { + resolve(res); + }) + .catch((err) => { + reject(err); + }) + .finally(() => { + setLoading(false); + }); + }); + }; + + return [loading, importFile]; +} diff --git a/src/main.js b/src/main.js index f1e0c18..c1cdccb 100644 --- a/src/main.js +++ b/src/main.js @@ -1,17 +1,15 @@ import { setJJBCommonAntdMessage } from "@cqsjjb/jjb-common-lib"; - import { setup } from "@cqsjjb/jjb-dva-runtime"; - import { message } from "antd"; import dayjs from "dayjs"; import "dayjs/locale/zh-cn"; - import "../blessed_by_buddha"; require("antd/dist/reset.css"); dayjs.locale("zh-cn"); setJJBCommonAntdMessage(message); + const app = setup(); // 非底座环境运行 diff --git a/src/pages/Container/Stakeholder/CorpInfo/index.js b/src/pages/Container/Stakeholder/CorpInfo/index.js index 45b065e..0a441ad 100644 --- a/src/pages/Container/Stakeholder/CorpInfo/index.js +++ b/src/pages/Container/Stakeholder/CorpInfo/index.js @@ -141,15 +141,12 @@ function CorpInfo(props) { data.license = [data.licenseStart, data.licenseEnd]; data.scaleType = data.scaleType ?? 0; - // 判断是否所有必填字段都有值(基于原始 data + licenseFile) const hasLicenseFile = Array.isArray(licenseFile) && licenseFile.length > 0; const allRequiredFilled = REQUIRED_FIELDS.every((field) => { const val = data[field]; return val != null && val !== "" && !(typeof val === "number"); }); - - // 最终条件:字段都填了 + 营业执照文件存在 setCanShowQrCode(allRequiredFilled && hasLicenseFile); const values = { diff --git a/src/pages/Container/index.js b/src/pages/Container/index.js index e26b719..c26d322 100644 --- a/src/pages/Container/index.js +++ b/src/pages/Container/index.js @@ -1,6 +1,5 @@ import { ImportCore } from "@cqsjjb/jjb-common-decorator/module"; import { theme as antdTheme, App, ConfigProvider } from "antd"; - import language from "antd/locale/zh_CN"; import React from "react"; @@ -14,7 +13,10 @@ export default class Container extends React.Component { }; get token() { - const { colorPrimary, borderRadius } = this.state; + const { + colorPrimary, + borderRadius, + } = this.state; return { fontFamily: window.process.env.app.antd.fontFamily, colorPrimary, @@ -31,9 +33,7 @@ export default class Container extends React.Component { // eslint-disable-next-line react-web-api/no-leaked-event-listener window.base.addEventListener("EVENT_THEME_CONTROL", (e) => { const config = e.data; - this.setState({ - [config.field]: config.value, - }); + this.setState({ [config.field]: config.value }); }); } } @@ -48,26 +48,28 @@ export default class Container extends React.Component { locale={language} prefixCls={window.process.env.app.antd["ant-prefix"]} > - + ); } } + function AppMiddle(props) { return ( {process.env.NODE_ENV === "development" ? props.children - : {props.children}} + : ( + + {props.children} + + )} ); } + class Interceptor extends React.Component { state = { Component: undefined, @@ -80,9 +82,7 @@ class Interceptor extends React.Component { from: "https://cdn.cqjjb.cn/jcloud/use/plugin/b31c9840a57f11ef91cf7f3cabbb7484/latest", }).then(async (res) => { if (res.status) { - this.setState({ - Component: res.module?.PageCover, - }); + this.setState({ Component: res.module?.PageCover }); } }); } @@ -90,11 +90,7 @@ class Interceptor extends React.Component { render() { const { Component } = this.state; - return ( - Component - && process.env.app.appKey - && process.env.NODE_ENV === "development" - ) + return (Component && process.env.app.appKey && process.env.NODE_ENV === "development") ? ( {this.props.children} diff --git a/src/pages/index.js b/src/pages/index.js index 224bf16..58831cb 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,14 +1,10 @@ export default function () { return (

+ 底座微应用模板,技术文档: - - https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko - + https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko

+ ); }