From f04053c133e6bcf32af6d957b14d9fe899741b65 Mon Sep 17 00:00:00 2001 From: gouziwan <943781166@qq.com> Date: Fri, 30 Jun 2023 18:22:54 +0000 Subject: [PATCH] update README.md. Signed-off-by: gouziwan <943781166@qq.com> --- README.md | 526 +++--------------------------------------------------- 1 file changed, 22 insertions(+), 504 deletions(-) diff --git a/README.md b/README.md index 0e5dc12..440555e 100644 --- a/README.md +++ b/README.md @@ -1,523 +1,41 @@ -
- - - - - - -
+# 低代码平台 -![image](https://badgen.net/packagephobia/publish/vue-plugin-hiprint) -![image](https://badgen.net/npm/v/vue-plugin-hiprint) - -Gitee star - - -Gitee fork - -![image](https://badgen.net/github/stars/CcSimple/vue-plugin-hiprint) -![image](https://badgen.net/github/forks/CcSimple/vue-plugin-hiprint) -![image](https://badgen.net/npm/dw/vue-plugin-hiprint) -![image](https://badgen.net/npm/dm/vue-plugin-hiprint) -![image](https://badgen.net/npm/dy/vue-plugin-hiprint) +低代码平台是一种软件开发工具,旨在通过简化应用程序开发过程,降低编码要求,提高开发效率。它允许用户使用可视化界面、拖放组件和简单的逻辑配置来快速构建应用程序,而无需编写大量的手动代码。 -## 关于此插件 +## 主要特点 -vue-plugin-hiprint(基于[hiprint 2.5.4](http://hiprint.io/)) 当时只是为了方便我(并非hiprint原作者) 在vue项目中引入使用,所以以此命名。 +- **快速开发**:低代码平台提供了丰富的可视化组件和预构建模块,可以快速组装和定制,加快应用程序开发速度。 -此插件仅仅是一个JavaScript【工具库】而非 Vue【组件库】,所以它默认是不包含demo中所见的那些组件页面的(demo代码随便复制修改拿去用)。 +- **可视化建模**:用户可以使用图形化界面设计应用程序的数据模型、业务流程和用户界面,而不需要深入的编码知识。 -由于hiprint官网最后一次更新时间为2019年【hiprint 2.5.4 是 [LGPL](#关于lgpl协议) 协议】,后在诸多使用者及反馈下进行了许多优化调整。[详情](CHANGELOG.md)(同时感谢各位群友支持和参与) +- **自动化生成代码**:低代码平台可以自动生成应用程序的基础代码,减少手动编码工作量。 -## vue-plugin-hiprint -> hiprint for Vue2.x / Vue3.x (基于jQuery, 理论上应该也是支持其他框架的) +- **易于集成**:低代码平台提供了与其他系统和服务的集成功能,如数据库、API、第三方服务等,使应用程序更具功能和扩展性。 -> **jQuery/uniapp** 项目 见下方 [jQuery/uniapp 项目使用](#jQuery/uniapp 项目使用) +- **实时协作**:低代码平台通常支持多人实时协作,团队成员可以同时编辑和共享应用程序。 -## 注意事项!! +## 优势与应用 --
不要用本项目设计导出的模板,在官网提供的版本中使用!
--
不要用本项目设计导出的模板,在官网提供的版本中使用!
--
不要用本项目设计导出的模板,在官网提供的版本中使用!
--
请使用我提供的打印客户端,或者自行修改打印客户端的源码,以适配本项目的模板!
--
请使用我提供的打印客户端,或者自行修改打印客户端的源码,以适配本项目的模板!
--
请使用我提供的打印客户端,或者自行修改打印客户端的源码,以适配本项目的模板!
-- 主分支是融合版本的最新代码,如果你不需要修改 hiprint 相关代码. 请使用 npm 包的方式安装. -- 使用直接客户端时,本地开发连接没问题,部署到线上出现跨域无法连接打印客户端问题: -- [线上跨域问题,请升级 https! 说明:https://www.cnblogs.com/daysme/p/15493523.html](https://www.cnblogs.com/daysme/p/15493523.html) -- [线上跨域问题,请升级 https! 说明:https://www.cnblogs.com/daysme/p/15493523.html](https://www.cnblogs.com/daysme/p/15493523.html) -- [线上跨域问题,请升级 https! 说明:https://www.cnblogs.com/daysme/p/15493523.html](https://www.cnblogs.com/daysme/p/15493523.html) +低代码平台具有许多优势和适用场景,包括但不限于: -## 快速链接 +- **快速原型开发**:低代码平台可以快速搭建原型,验证想法和概念,帮助快速迭代和用户反馈。 -Demo预览:[https://ccsimple.gitee.io/vue-plugin-hiprint/](https://ccsimple.gitee.io/vue-plugin-hiprint/) +- **企业应用开发**:低代码平台可用于构建企业级应用程序,包括内部工具、业务流程管理、CRM、人力资源管理等。 -更新记录:[npm包版本及更新记录](CHANGELOG.md) +- **移动应用开发**:低代码平台支持移动应用开发,可以生成适用于多个平台的原生或混合应用程序。 -打印客户端:[https://gitee.com/CcSimple/electron-hiprint](https://gitee.com/CcSimple/electron-hiprint) +- **业务用户参与**:低代码平台的可视化界面和简化操作使非技术人员也能参与应用程序开发,提高业务部门的自主性。 -## 文章链接 +- **快速响应需求**:低代码平台可以快速响应业务需求变化,减少开发周期,提高敏捷性和灵活性。 -入门篇: [【vue-plugin-hiprint】使用-入门篇](https://mp.weixin.qq.com/s/4N4f7CkxodA-fuTJ_FbkOQ) +## 市场领先的低代码平台 -进阶篇: [【vue-plugin-hiprint】使用-进阶篇](https://mp.weixin.qq.com/s/LYZP2iqV0gy4m76mttplAw) +市场上有许多低代码平台供选择,其中一些领先的低代码平台包括: -provider: [【vue-plugin-hiprint】如何自定义可拖拽元素 provider](https://mp.weixin.qq.com/s/n9i1j8hhVJvnlfJRPRtWog) +- [Example Low-Code Platform](https://www.examplelowcodeplatform.com/) +- [Another Low-Code Platform](https://www.anotherlowcodeplatform.com/) +- [Yet Another Low-Code Platform](https://www.yetanotherlowcodeplatform.com/) -打印篇: [【vue-plugin-hiprint】使用-打印篇](https://mp.weixin.qq.com/s/P-Zz8YfELmRNi4EuED4QmA) +这些平台提供了丰富的功能和工具,适用于各种应用开发需求,并得到了广泛的用户认可和采用。 -参数篇: [【vue-plugin-hiprint】使用-参数篇](https://mp.weixin.qq.com/s/vfgSG62tAXn7Ot7y3x68fw) - -实战动态provider: [【vue-plugin-hiprint】实战-动态provider](https://mp.weixin.qq.com/s/UVkhul1tynjaUjdC_NaHfw) - -实战动态模板: [【vue-plugin-hiprint】实战-动态模板](https://mp.weixin.qq.com/s/JXXC9Fyy_PgPXrwh1mDBTQ) - -常见问题汇总①: [【vue-plugin-hiprint】常见问题汇总①](https://mp.weixin.qq.com/s/E-ZfuKLH3-GvKn4AosRvaw) - -常见问题汇总②: [【vue-plugin-hiprint】常见问题汇总②](https://mp.weixin.qq.com/s/UEnr24bB_P6KmpZ7iZmYvA) - -常见问题汇总③: [【vue-plugin-hiprint】常见问题汇总③](https://mp.weixin.qq.com/s/lRimQ-cjuwN3mg6RicPyag) - -## 更多参数的文档请仔细查阅文档 - -hiprint官方文档:[http://hiprint.io/docs/start](http://hiprint.io/docs/start) - -本人写的部分文档: [https://ccsimple.gitee.io/sv-print-docs/config/hiprint.html](https://ccsimple.gitee.io/sv-print-docs/config/hiprint.html) - -## 安装使用 -``` -npm install vue-plugin-hiprint -``` - -```html - - - - -``` - -## 项目截图 - - - - - - - - - - - - - -
- - -## 拖拽设计使用 -```javascript -import {hiprint,defaultElementTypeProvider} from 'vue-plugin-hiprint' -// 初始化可拖拽的元素 -hiprint.init({ - providers: [new defaultElementTypeProvider()] -}) -// $('.ep-draggable-item') 包含 tid, 与上边的 provider 中的 tid 对应 才能正常拖拽生成元素 -hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item')); -hiprintTemplate = new hiprint.PrintTemplate({ - template: {}, // 模板json - settingContainer: '#PrintElementOptionSetting', // 元素参数容器 - paginationContainer: '.hiprint-printPagination', // 多面板的容器, 实现多面板, 需要在添加一个
- // ------- 下列是可选功能 ------- - // ------- 下列是可选功能 ------- - // ------- 下列是可选功能 ------- - // 图片选择功能 - onImageChooseClick: (target) => { - // 测试 3秒后修改图片地址值 - setTimeout(() => { - // target.refresh(url,options,callback) - // callback(el, width, height) // 原元素,宽,高 - // target.refresh(url,false,(el,width,height)=>{ - // el.options.width = width; - // el.designTarget.css('width', width + "pt"); - // el.designTarget.children('.resize-panel').trigger($.Event('click')); - // }) - target.refresh("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtAAAAIIAQMAAAB99EudAAAABlBMVEUmf8vG2O41LStnAAABD0lEQVR42u3XQQqCQBSAYcWFS4/QUTpaHa2jdISWLUJjjMpclJoPGvq+1WsYfiJCZ4oCAAAAAAAAAAAAAAAAAHin6pL9c6H/fOzHbRrP0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0u/SY9LS0tLS0tLS0tLS0n+edm+UlpaWlpaWlpaWlpaW/tl0Ndyzbno7/+tPTJdd1wal69dNa6abx+Lq6TSeYtK7BX/Diek0XULSZZrakPRtV0i6Hu/KIt30q4fM0pvBqvR9mvsQkZaW9gyJT+f5lsnzjR54xAk8mAUeJyMPwYFH98ALx5Jr0kRLLndT7b64UX9QR/0eAAAAAAAAAAAAAAAAAAD/4gpryzr/bja4QgAAAABJRU5ErkJggg==",{ - // auto: true, // 根据图片宽高自动等比(宽>高?width:height) - // width: true, // 按宽调整高 - // height: true, // 按高调整宽 - real: true // 根据图片实际尺寸调整(转pt) - }) - }, 3000) - // target.getValue() - // target.refresh(url) - }, - // 自定义可选字体 - // 或者使用 hiprintTemplate.setFontList([]) - // 或元素中 options.fontList: [] - fontList: [ - {title: '微软雅黑', value: 'Microsoft YaHei'}, - {title: '黑体', value: 'STHeitiSC-Light'}, - {title: '思源黑体', value: 'SourceHanSansCN-Normal'}, - {title: '王羲之书法体', value: '王羲之书法体'}, - {title: '宋体', value: 'SimSun'}, - {title: '华为楷体', value: 'STKaiti'}, - {title: 'cursive', value: 'cursive'}, - ], - dataMode: 1, // 1:getJson 其他:getJsonTid 默认1 - history: true, // 是否需要 撤销重做功能 - onDataChanged: (type, json) => { // 模板发生改变回调 - console.log(type); // 新增、移动、删除、修改(参数调整)、大小、旋转 - console.log(json); // 返回 template - }, - onUpdateError: (e) => { // 更新失败回调 - console.log(e); - }, -}); -// 设计器的容器 -hiprintTemplate.design('#hiprint-printTemplate'); -``` - -## 代码模式使用 - -```javascript -import {hiprint, defaultElementTypeProvider} from 'vue-plugin-hiprint' -// 引入后使用示例 -hiprint.init(); -// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面 -// 想要实现拖拽设计页面,请往下看 '自定义设计' -var hiprintTemplate = new hiprint.PrintTemplate(); -var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 }); -//文本 -panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint插件手动添加text', textAlign: 'center' } }); -//条形码 -panel.addPrintText({ options: { width: 140, height: 35, top: 40, left: 20, title: '123456', textType: 'barcode' } }); -//二维码 -panel.addPrintText({ options: { width: 35, height: 35, top: 40, left: 165, title: '123456', textType: 'qrcode' } }); -//长文本 -panel.addPrintLongText({ options: { width: 180, height: 35, top: 90, left: 20, title: '长文本:hiprint是一个很好的webjs打印,浏览器在的地方他都可以运行' } }); -//打印 -hiprintTemplate.print({}); -``` - -## vue/vue3 全局引入 - -> 全局引入,方便在任何地方不引入直接调用打印。示例为代码模式 (拖拽设计请往下看) - -```javascript -// main.js中 引入安装 -import {hiPrintPlugin} from 'vue-plugin-hiprint' -Vue.use(hiPrintPlugin, '$pluginName') -hiPrintPlugin.disAutoConnect(); // 取消自动连接直接打印客户端 - -// 下列代码为示例,不要再 main.js中 使用 -// 引入后使用示例 -this.$pluginName.init(); -// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面 -// 想要实现拖拽设计页面,请往下看 '自定义设计' -var hiprintTemplate = new this.$pluginName.PrintTemplate(); -var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 }); -//文本 -panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint插件手动添加text', textAlign: 'center' } }); -//条形码 -panel.addPrintText({ options: { width: 140, height: 35, top: 40, left: 20, title: '123456', textType: 'barcode' } }); -//二维码 -panel.addPrintText({ options: { width: 35, height: 35, top: 40, left: 165, title: '123456', textType: 'qrcode' } }); -//长文本 -panel.addPrintLongText({ options: { width: 180, height: 35, top: 90, left: 20, title: '长文本:hiprint是一个很好的webjs打印,浏览器在的地方他都可以运行' } }); -//表格 -panel.addPrintTable({ options: { width: 252, height: 35, top: 130, left: 20, content: $('#testTable').html() } }); -//Html -panel.addPrintHtml({ options: { width: 140, height: 35, top: 180, left: 20, content:'' } }); -//竖线//不设置宽度 -panel.addPrintVline({ options: { height: 35, top: 230, left: 20 } }); -//横线 //不设置高度 -panel.addPrintHline({ options: { width: 140, top: 245, left: 120 } }); -//矩形 -panel.addPrintRect({ options: { width: 35, height: 35, top: 230, left: 60 } }); -//打印 -hiprintTemplate.print({}); -//直接打印,需要安装客户端 -hiprintTemplate.print2({}); -``` - -## jQuery/uniapp 项目使用 - -> uniapp 需要嵌入到 web 浏览器中.(需要支持 window 全局对象环境) - -```html - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## 配套直接打印客户端(win/mac/linux) -
如果使用npm包或者本项目,请使用如下样子的直接打印客户端
-
如果使用npm包或者本项目,请使用如下样子的直接打印客户端
-
如果使用npm包或者本项目,请使用如下样子的直接打印客户端
-
- -![image](./res/tool.jpeg) - -
-
本项目需要上面样式的直接打印客户端; 下载地址见下表:
- -| 版本 | 下载地址 | -|------------------------|-----------------------------------------------------------------------------------------------------------------------------------| -| Win64 | 下载(v1.0.6) | -| Win32 | 下载(v1.0.6) | -| Linux64 (需要桌面系统) | 下载(v1.0.6) | -| Linux64 arm64 (需要桌面系统) | 下载(v1.0.6) | -| Mac (intel) | 下载(v1.0.6) | -| Mac (M1) | 下载(v1.0.6) | - -- [线上跨域问题,请升级 https! 说明:https://www.cnblogs.com/daysme/p/15493523.html](https://www.cnblogs.com/daysme/p/15493523.html) -- [线上跨域问题,请升级 https! 说明:https://www.cnblogs.com/daysme/p/15493523.html](https://www.cnblogs.com/daysme/p/15493523.html) -- [线上跨域问题,请升级 https! 说明:https://www.cnblogs.com/daysme/p/15493523.html](https://www.cnblogs.com/daysme/p/15493523.html) - -## 常见问题 -> design时怎么修改默认图片? -```vue - - - - - -``` -> print/print2 打印回调 -```javascript -// 浏览器预览打印 -hiprintTemplate.print(this.printData, {}, { - callback: () => { - console.log('浏览器打印窗口已打开') - } -}) -// 直接打印 -// 打印机名称: 通过 hiprintTemplate.getPrinterList() 获取 其中的 name -hiprintTemplate.print2(printData, {printer: '打印机名称', title: '打印标题'}) -hiprintTemplate.on('printSuccess', function (data) { - console.log('打印完成') -}) -hiprintTemplate.on('printError', function (data) { - console.log('打印失败') -}) -``` -> 打印重叠 / 样式问题 -```javascript -/** - * 从 0.0.19 起, 在index.html添加: - * - * 以处理打印所需css, 当然你也可以自行处理 - * 比如: index.html目录下放一个print-lock.css, 然后在index.html添加: - * - */ - -// 添加自定义样式 -hiprintTemplate.print(this.printData, {}, { - styleHandler: () => { - // 这里拼接成放html->head标签内的css/style - // 1.例如:使用hiprin官网的样式 - let css = '' - // 2.重写样式:所有文本红色 - css += '' - return css - } -}) -// 直接打印 -hiprintTemplate.print2(this.printData, { - styleHandler: () => { - // 这里拼接成放html->head标签内的css/style - // 1.例如:使用hiprin官网的样式 - let css = '' - // 2.重写样式:所有文本红色 - css += '' - return css - } -}) -``` -> 修改默认配置 / 显示/隐藏元素设置参数 -```javascript -// 0.0.13, 新增setConfig方法 -// 还原配置 -hiprint.setConfig() -// 替换配置 -hiprint.setConfig({ - movingDistance: 2.5, - text:{ - supportOptions: [ - { - name: 'styler', - hidden: true - }, - { - name: 'formatter', - hidden: true - }, - ] - } -}) -``` -> 取消自动socket连接 / socket连接报错问题 -```javascript -/** - * 取消自动连接 - */ -// 在main.js中设置 -import {hiPrintPlugin} from 'vue-plugin-hiprint' -Vue.use(hiPrintPlugin,'$hiprint', false); -// hiPrintPlugin 同时提供了 disAutoConnect 方法 -hiPrintPlugin.disAutoConnect(); -// 在组件中使用 见: demo/design/index.vue -import {disAutoConnect, autoConnect, hiprint} from 'vue-plugin-hiprint' -disAutoConnect(); -// 同时 export了 autoConnect,disAutoConnect 方法 -/** - * 连接回调及打印 - */ -autoConnect((status,msg) => { - if (status) { - hiprintTemplate.print2(printData, {printer: '', title: 'hiprint测试打印'}); - } -}); -/** - * socket连接报错? - * 由于npm包更新到socket.io 3.x版本,官网提供的客户端,npm包是无法连接的 - * 请使用gitee提供的客户端, 同时gitee客户端可传更多的参数, 如是否打印颜色/打印份数/DPI等 - * 详情electron见:https://www.electronjs.org/zh/docs/latest/api/web-contents - */ -``` - -## 参与项目 -```console -git clone https://gitee.com/CcSimple/vue-plugin-hiprint.git -// init -cd vue-plugin-hiprint -npm i -// 调试预览 -npm run serve -// 打包 -npm run build -``` -## demo调试(显示打印iframe) -```javascript -// 快速显示/隐藏 打印iframe 方便调试  ̄□ ̄|| -// 在浏览器控制台输入: -// 显示打印页面 -$('#app').css('display','none'); -$('#hiwprint_iframe').css('visibility','visible'); -$('#hiwprint_iframe').css('width','100%'); -$('#hiwprint_iframe').css('height','251.09mm'); // 这里替换个实际高度才能显示完 -// 显示vue页面 -$('#app').css('display','block'); -$('#hiwprint_iframe').css('visibility','hidden'); -``` - -## 交流群 - - - - - -
- -> 群人数已超过200 请 '加我好友' 备注加群, 邀你进群 - -## 捐赠支持, 或者请我喝杯咖啡☕️ - -> 如果对您有帮助,请点击右上角⭐Star关注或扫码捐赠,感谢支持开源! - - - - - - -
- -## 状态/调整/优化 请查看[更新记录](CHANGELOG.md) - -本项目使用 开发 - -## 分支说明 -> main: vue2.x + ant1.7.x融合版 及 npm包源代码 - -> npm_demo: vue2.x + ant1.7.x + npm包使用 示例 - -> npm_demo_ele: vue2.x + ElementUi 2.x + npm包使用 示例 - -> npm_demo_v3: vue3.x + vite + npm包(0.0.18)使用 示例 - -## 关于如何融合处理 -> 自己融合请查看 vue.config.js 对比 hiprint.bundle.js - -> webpack.config.js,是npm打包需要处理的 - -## 开源使用说明 -> npm包是基于hiprint官网2.5.4版本基础做的调整及优化;
-> 本人对开源协议理解有限,如有侵权不合理的地方,请联系告知我;
- -hiprint 开源协议如下: -``` -/** - * jQuery Hiprint 2.5.4 - * - * Copyright (c) 2016-2021 www.hinnn.com. All rights reserved. - * - * Licensed under the LGPL or commercial licenses - * To use it on other terms please contact us: hinnn.com@gmail.com - * - */ -``` - -## 关于LGPL协议 - -``` -LGPL是GPL的一个为主要为类库使用设计的开源协议。和GPL要求任何使用/修改/衍生之GPL类库的的软件必须采用GPL协议不同。 - -LGPL允许商业软件通过类库引用(link)方式使用LGPL类库而不需要开源商业软件的代码。这使得采用LGPL协议的开源代码可以被商业软件作为类库引用并发布和销售。 - -但是如果修改LGPL协议的代码或者衍生,则所有修改的代码,涉及修改部分的额外代码和衍生的代码都必须采用LGPL协议。 - -因此LGPL协议的开源代码很适合作为第三方类库被商业软件引用,但不适合希望以LGPL协议代码为基础,通过修改和衍生的方式做二次开发的商业软件采用。 - -GPL/LGPL都保障原作者的知识产权,避免有人利用开源代码复制并开发类似的产品。 -``` +如果您对低代码平台感兴趣,可以查阅以上链接,了解更多详细信息并开始构建自己的应用程序。 -- Gitee