提交 e4eb121c 编写于 作者: Z zorro

增加CAD网页组件JS版集成演示,更新相关文档

上级 c751889d
无法预览此类型文件
@charset "utf-8";
html, body, ol, ul, li, h1, h2, h3, h4, h5, h6, p, th, td, dl, dd, form, fieldset, legend, input, textarea, select {
margin: 0;
padding: 0;
}
body {
font-size: 14px;
font-family: '微软雅黑';
}
input, fieldset {
outline: none;
border: 0;
}
.hidden{
display: none;
}
.show{
display: block;
}
button {
display: inline-block;
line-height: 1;
white-space: nowrap;
cursor: pointer;
background: #fff;
border: 1px solid #dcdfe6;
color: #606266;
-webkit-appearance: none;
text-align: center;
box-sizing: border-box;
outline: 0;
margin: 0;
-webkit-transition: .1s;
transition: .1s;
font-weight: 500;
padding: 10px 10px;
font-size: 14px;
border-radius: 4px;
}
button:hover{
background-color: rgba(64,158,255,0.1);
border: rgba(64,158,255,0.2) 1px solid;
color: #409eff;
}
.button-primary {
color: #fff;
background-color: #409eff;
border-color: #409eff;
}
.button-primary:hover{
background-color: rgba(64,158,255,0.7);
color: #ffffff;
}
textarea {
border: #dcdfe6 1px solid;
border-radius: 4px;
height: 100px;
padding: 10px;
width: 100%;box-sizing: border-box;
}
input {
border: #dcdfe6 1px solid;
border-radius: 4px;
height: 34px;
text-indent: 10px;
}
select{
border: #dcdfe6 1px solid;
border-radius: 4px;
height: 34px;
text-indent: 10px;
}
.mainContainer {
display: block;
width: 1200px;
padding:0 20px;
box-sizing: border-box;
}
.urlbox {
display: flex;
display: -ms-flexbox;
align-items: center;
-ms-flex-align: center;
justify-content: space-between;
margin: 15px 0;
}
.urlbox .item.input {
flex: 1;
margin: 0 15px;
}
.urlbox .item.input input{
width: 100%;
}
.tool {
display: flex;
display: -ms-flexbox;
align-items: center;
-ms-flex-align: center;
margin: 15px 0;
justify-content: space-between;
flex-wrap: wrap;
}
.tool:after{
content: '';
width: 1px;
height: 1px;
margin-left: auto;
}
.tool .item {
margin-right: 15px;
}
.tool .item:last-child {
margin-right: 0;
}
.tool .input {
width: 60px;
}
.video-container {
position: relative;
margin-top: 8px;
height: 480px;
border: #ddd 1px dashed;
display: flex;
display: -ms-flexbox;
align-items: center;
-ms-flex-align: center;
justify-content: center;
font-size: 24px;
color: #ddd;
}
.video-container.hide{
display: none;
}
.tabs{
display: flex;
border-bottom: #dddddd 1px solid;
}
.tabs .tab-item{
background-color: #dddddd;
color: #333;
width: 120px;
height: 36px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 4px 4px 0 0 ;
margin-right: 10px;
cursor: pointer;
position: relative;
margin-bottom: -1px;
position: relative;
}
.tabs .tab-item.active{
background-color: #409eff;
color: #fff;
}
.tabs .tab-item.hide{
display: none;
}
.tabs .tab-item .close{
position: absolute;
top: 0;
right: 8px;
cursor: pointer;
font-size:16px;
}
.alert{
position:fixed;
top: 50px;
width: 400px;
height:45px;
left: calc(50% - 200px);
background-color: #409eff;
border-radius: 4px;
color: #fff;
text-align: center;
display: none;
align-items: center;
justify-content: center;
}
.alert.hide{
display: none;
}
.alert.show{
display: flex;
}
\ No newline at end of file
此差异已折叠。
class CADApplet{
static aidArr = [
{aid: 0, rid: 2, ws1: null, ws2: null},
{aid: 0, rid: 3, ws1: null, ws2: null},
{aid: 0, rid: 4, ws1: null, ws2: null},
{aid: 0, rid: 5, ws1: null, ws2: null},
{aid: 0, rid: 6, ws1: null, ws2: null},
{aid: 0, rid: 7, ws1: null, ws2: null},
] //维护一个数组 用来保存Applet实例的aid
static rid = 1000 //每次请求都要传递一个rid 参数 这里弄成静态变量 每次累加一次就行
openType = 0 // 加载类型 0默认打开软件在线编辑图纸 1 OCX看图
IframeX = -10 // 模拟iFrameX坐标 默认-10 根据自己情况修改
IframeY = 0 // 模拟iFrameY坐标 默认0 根据自己情况修改
CADApplet(ws = null, aid = 0){
this.ws = ws
this.aid = aid
}
/**
* 让rid和aid和ws都映射起来
* @param rid
* @param ws
* @param type=1或者type=2 根据文档来选择例如操作的是宽度 边距等 需要使用第一个ws
*/
static setAidArr(rid=0, aid=0,type=1,ws=null) {
CADApplet.aidArr.forEach((item, index) => {
if (item.rid == rid) {
CADApplet.aidArr[index].aid = aid
if(type==1){
CADApplet.aidArr[index].ws1 = ws
}
if(type==2){
CADApplet.aidArr[index].ws2 = ws
}
if(type==0){
CADApplet.aidArr[index].ws2 = null
CADApplet.aidArr[index].ws1 = null
}
}
})
}
static getAidArr(rid) {
for (let i in CADApplet.aidArr) {
if (CADApplet.aidArr[i].rid == rid) {
return CADApplet.aidArr[i].aid
}
}
return 0
}
/**
* 根据操作的类型 来选择ws
*
* @param aid
* @param type 根据文档来选择 例如操作的是宽度 边距等 需要使用第一个ws
*/
setWebsocket(aid, type = 1) {
this.aid = aid
for (let i in CADApplet.aidArr) {
if (CADApplet.aidArr[i].aid == aid) {
if (type == 1) {
this.ws = CADApplet.aidArr[i].ws1
} else {
this.ws = CADApplet.aidArr[i].ws2
}
}
}
}
/**
* 启动AutoCAD网页组件
* @param rid
* @param left
* @param top
* @param width
* @param height
* @param OpenFile
*/
startACAD(rid, left, top, width, height, OpenFile,edit) {
// 启动第一个CAD网页组件
// Type为浏览器类型,传0自动判断(前提是当前浏览器已启动并显示在最前端,Flag指定当前页加载时必须是0) 可强制指定浏览器类型Type(2代表Chrome 4代表Firefox 8代表Opera 16代表Edge(Chromium内核) 20代表Electron 32代表360极速浏览器 33代表360安全浏览器 34代表360企业安全浏览器 50代表QQ浏览器 60代表搜狗浏览器)
// Title:网页标题中的关键词
// Flag掩码:1指定新标签加载(1和16都不指定时为当前页加载) 2显示标题栏 4不自动裁剪越界窗口 8自动适配网页高度和宽度显示 64启用Web参数 128防截屏 256强制显示到副屏 512允许同一网页加载多实例
// Option:对应变量openType的说明
// Open:为需要打开的文档路径,磁盘目录斜杠用/ 支持服务器HTTP协议的文件下载路径(请确保无需登录即可下载),下载地址中如果没有包含文件名,请在Content-Disposition中指定filename
// 此参数如非全路径,包括服务器路径,除非启动时指定了数据文件目录DataPath,否则默认使用中间件程序Data子目录作为根目录使用 也可在Web中指定
// 注意:Open、Url中如果有特殊字符= & 双引号或中文等,需要用URL编码处理后传递
// BarW和BarH分别是网页右侧和底部预留区域,ScrollTop为顶部滚动预留高度
// Web节点中参数可自行配置,目前支持这些参数:
// DataPath代表文档查找和保存默认路径
let msg = {
"req": "Wrl_ACADApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 0,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
StartDwgView(rid, left, top, width, height, OpenDwg) {
//启动第二个CAD网页组件,参数参考startACAD
let msg = {
"req": "Wrl_ACADApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "DWG看图组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"User": "zorro", "Cookie": ""},
"Open": OpenDwg,
"Option": 1
}
}
this.ws.sendMessage(msg)
}
StartSolidworksApplet(rid, left, top, width, height, OpenFile,edit) {
// 启动一个Solidwork网页组件,参数参考startACAD,不同点是req名称及Open打开图纸的扩展名 Option设置1时代表启动eDrawings看图
let msg = {
"req": "Wrl_SWCadApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 0,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
StartCatiaApplet(rid, left, top, width, height, OpenFile,edit) {
// 启动一个CATIA网页组件,参数参考startACAD,不同点是req名称及Open打开图纸的扩展名
let msg = {
"req": "Wrl_SWCadApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 0,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
StartProEApplet(rid, left, top, width, height, OpenFile,edit) {
// 启动一个ProE网页组件,参数参考CADApplet-class.js中的startACAD Option设置1时代表启动Creo View看图 暂时不支持设置0
let msg = {
"req": "Wrl_ProEApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 1,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
saveFile() {
// 请求保存图纸
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_Save",
"rid": CADApplet.rid,
"para": {}
}
this.ws.sendMessage(msg)
}
saveAsFile() {
CADApplet.rid++ // 增加请求序号
/// 先设置保存位置再另存
let msg = {
"req": "Wrl_SelectFile",
"rid": CADApplet.rid,
"para": {
"Type": 1,
"Title": "请设置另存图纸位置",
"Ext": "另存图纸(*.dwg;*.dxf)\r*.dwg;*.dxf"
}
}
this.ws.sendMessage(msg)
}
ExportFile() {
// 请求导出图纸
CADApplet.rid++ // 增加请求序号
/// 先设置导出位置
let msg = {
"req": "Wrl_SelectFile",
"rid": CADApplet.rid,
"para": {
"Type": 1,
"Title": "请设置导出文件位置",
"Ext": "导出文件(*.pdf;*.png)\r*.pdf;*.png"
}
}
this.ws.sendMessage(msg)
}
printFile(url) {
// 请求打印当前图纸
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_Print",
"rid": CADApplet.rid,
"para": {
"Count": 1
}
}
this.ws.sendMessage(msg)
}
appletFullEdit() {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_SwitchFullScreen",
"rid": CADApplet.rid,
"para": {}
}
this.ws.sendMessage(msg)
}
closeApplet() {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletControl",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Code": 1
}
}
this.ws.sendMessage(msg)
}
checkUpdate(version) {
//校验中间件版本是不是需要升级,如果额外指定PID参数,代表校验PID代表的网页组件,Wrl_Version功能多
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_Version",
"rid": CADApplet.rid,
"para": {
"Version": version
}
}
this.ws.sendMessage(msg)
}
changeOpen(myOpenDoc) {
//重新打开图纸
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_Open",
"rid": CADApplet.rid,
"para": {
"Open": encodeURIComponent(myOpenDoc)
}
}
this.ws.sendMessage(msg)
}
resizeMargin(left, top, width, height) {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletResize",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"X": left,
"Y": top,
"Width": width,
"Height": height
}
}
this.ws.sendMessage(msg)
}
resize(width, height) {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletResize",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Width": width,
"Height": height
}
}
this.ws.sendMessage(msg)
}
showApp() {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletControl",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Code": 8
}
}
this.ws.sendMessage(msg)
}
hideApp(code) {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletControl",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Code": code
}
}
this.ws.sendMessage(msg)
}
appScroll(scrollLeft = 0, scrollTop = 0) {
// 默认纵向滚动网页组件实例,如需要横向滚动,Code设置为1,修改Left的值
// NoLog指示服务日志不输出相关日志,因为时间比较多,输出日志导致日志文件信息过多
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletScroll",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"NoLog": 1,
"Code": 2,
"Left": 0,
"Top": Math.round(scrollTop)
}
}
this.ws.sendMessage(msg)
}
sendScrollInfo(BarCode = 2, scrollLeft = 0, scrollTop = 0) {
/// 设置页码滚动信息,BarW BarH分别为预留右侧宽度和底部高度
if(this.ws)
{
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_ScrollBar",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"BarW": 0,
"BarH": 0,
"Code": BarCode,
"Left": scrollLeft,
"Top": scrollTop
}
}
this.ws.sendMessage(msg)
}
}
beginSaveAsFile(LocalFilePath) {
// 请求开始另存图纸
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_SaveAs",
"rid": CADApplet.rid,
"para": {
"NewFile": encodeURIComponent(LocalFilePath)
}
}
this.ws.sendMessage(msg)
}
beginExpportFile(LocalFilePath) {
// 请求开始另存图纸
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_ConvertTo",
"rid": CADApplet.rid,
"para": {
"DestFile": encodeURIComponent(LocalFilePath)
}
}
this.ws.sendMessage(msg)
}
sendUpdateJson() {
// 发送中间件的升级命令,实现自动升级,同时升级AutoCAD、CATIA、Solidworks、ProE等CAD网页组件
// 注意:Wrl_Update中的请求参数如MD5 TK Size等,请根据文档“中间件制作升级包说明.pdf”中的打包工具生成
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_Update",
"rid": CADApplet.rid,
"para": {
"Name": "PageHiCAD网页组件升级包",
"Date": "2024-02-28",
"Desc": "1、中间件及相关小程序发布海外版,支持360安全浏览器64位版;2、网络版授权服务管理器终端用户信息导出数据支持txt格式;3、优化中间件高级版内嵌小程序嵌入网页后在非小程序窗口区域来回切换焦点后小程序无法获得焦点问题;4、增加ProE CAD网页组件,完善AutoCAD、Solidworks及Catia CAD网页组件功能...",
"DownAddr": "http://local.zorrosoft.com/Files/Update/CAD_Update.pid",
"Open": "http://local.zorrosoft.com/CADJS",
"MD5": "3118FA258D49CB1651EB748824AE2878",
"Version": "2.2.13.1",
"Size": 22544384,
"HideIns": 0,
"Cookie": "",
"Auth": "",
"TK": "70B02061316BE32D13DC0C7D83154989FF284A6DA635354953701BD0900D7ED9B533A43B2BDE8F2AA15B3BF7357B8A6872A61ED42C26EB43ADEC832FC0C8D2B50C12567B3D3FCFCB52E6962E1226490EA3D9354DFF629FAB45D8425D5C0C4D2717101A443B601EB17161E648190E2A715F5771AE3D78DFD448EB3EBA285EDABE2D0C05157408A33ED04606FC14086D806E432DF5AA92B0A40B736D545157341016A87A15558A9538885BA05200EFA9655E74B7F59755C9A2D4E35B588417E70E0AACE4CBA0ACA3CBB1231B38D0DAFA15656755AAD9AB53BBE73491485E8BC6B84E32190A5D322D302CB7224947F220739B698F44A21C6AD898F40471BB508240"
}
}
this.ws.sendMessage(msg)
}
snapDoc() {
CADApplet.rid++ // 增加请求序号
let msg = {"req": "Wrl_AppletSnap", "rid": CADApplet.rid, "para": {"ID": this.aid, "Base64":0, "File": new Date().getTime()+".jpg"}}
this.ws.sendMessage(msg)
}
}
\ No newline at end of file
function CADApplet(ws = null, aid = 0) {
this.ws = ws
this.aid = aid
this.openType = 1 // 加载类型 1启动微软Word 2启动微软Excel 3启动微软PPT 11启动金山文字 12启动金山表格 13启动金山演示 可通过请求Wrl_OfficeInfo获得需要设置的值
this.IframeX = -10 //根据情况自己修改把
this.IframeY = 0 //根据情况自己修改把
}
CADApplet.rid = 1000; //每次请求都要传递一个rid 参数 这里弄成静态变量 每次累加一次就行
//维护一个数组 用来保存Applet实例的aid
CADApplet.aidArr = [
{aid: 0, rid: 2, ws1: null, ws2: null},
{aid: 0, rid: 3, ws1: null, ws2: null},
{aid: 0, rid: 4, ws1: null, ws2: null},
{aid: 0, rid: 5, ws1: null, ws2: null},
{aid: 0, rid: 6, ws1: null, ws2: null},
{aid: 0, rid: 7, ws1: null, ws2: null},
];
/**
* 让rid和aid和ws都映射起来
* @param rid
* @param ws
* @param type=1或者type=2 根据文档来选择例如操作的是宽度 边距等 需要使用第一个ws
*/
CADApplet.setAidArr = function (rid = 0, aid = 0, type = 1, ws = null) {
CADApplet.aidArr.forEach((item, index) => {
if (item.rid == rid) {
CADApplet.aidArr[index].aid = aid
if (type == 1) {
CADApplet.aidArr[index].ws1 = ws
}
if (type == 2) {
CADApplet.aidArr[index].ws2 = ws
}
if (type == 0) {
CADApplet.aidArr[index].ws2 = null
CADApplet.aidArr[index].ws1 = null
}
}
})
}
CADApplet.getAidArr = function (rid) {
for (let i in CADApplet.aidArr) {
if (CADApplet.aidArr[i].rid == rid) {
return CADApplet.aidArr[i].aid
}
}
return 0
}
/**
* 根据操作的类型 来选择ws
*
* @param aid
* @param type 根据文档来选择 例如操作的是宽度 边距等 需要使用第一个ws
*/
CADApplet.prototype.setWebsocket = function (aid, type = 1) {
this.aid = aid
for (let i in CADApplet.aidArr) {
if (CADApplet.aidArr[i].aid == aid) {
if (type == 1) {
this.ws = CADApplet.aidArr[i].ws1
} else {
this.ws = CADApplet.aidArr[i].ws2
}
}
}
}
/**
* 启动AutoCADCAD网页组件
* @param rid
* @param left
* @param top
* @param width
* @param height
* @param OpenFile
*/
CADApplet.prototype.startACAD = function (rid, left, top, width, height, OpenFile, edit) {
//启动一个AutoCAD网页组件,参数参考CADApplet-class.js中的startACAD
let msg = {
"req": "Wrl_ACADApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "Hide": 0, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 0,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.StartDwgView = function (rid, left, top, width, height, OpenDwg) {
//启动第二个CAD网页组件,参数参考CADApplet-class.js中的startACAD
let msg = {
"req": "Wrl_ACADApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "DWG看图组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Hide": 0, "User": "zorro", "Cookie": ""},
"Open": OpenDwg,
"Option": 1
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.StartSolidworksApplet = function (rid, left, top, width, height, OpenFile, edit) {
//启动一个Solidwork网页组件,参数参考CADApplet-class.js中的startACAD Option设置1时代表启动eDrawings看图
let msg = {
"req": "Wrl_SWCadApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "Hide": 0, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 0,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.StartCatiaApplet = function (rid, left, top, width, height, OpenFile, edit) {
//启动一个StartCatiaApplet网页组件,参数参考CADApplet-class.js中的startACAD
let msg = {
"req": "Wrl_CatiaApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "Hide": 0, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 0,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.StartProEApplet = function (rid, left, top, width, height, OpenFile, edit) {
//启动一个ProE网页组件,参数参考CADApplet-class.js中的startACAD Option设置1时代表启动Creo View看图 暂时不支持设置0
let msg = {
"req": "Wrl_ProEApplet",
"rid": rid,
"para": {
"Type": "0",
"Title": "CAD网页组件",
"Flag": 578,
"Left": left,
"Top": top,
"Width": width,
"Height": height,
"IframeX": this.IframeX,
"IframeY": this.IframeY,
"BarW": 0,
"BarH": 0,
"ScrollTop": 0,
"Web": {"Edit": edit, "Hide": 0, "User": "test", "Cookie": "", "DataPath": "c:/CadDoc"},
"Option": 1,
"Open": encodeURIComponent(OpenFile)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.saveFile = function () {
// 请求保存文档
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_Save",
"rid": CADApplet.rid,
"para": {}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.saveAsFile = function () {
CADApplet.rid++ // 增加请求序号
/// 先设置保存位置再另存
let msg = {
"req": "Wrl_SelectFile",
"rid": CADApplet.rid,
"para": {
"Type": 1,
"Title": "请设置另存文件位置",
"Ext": "另存图纸(*.dwg;*.dxf)\r*.dwg;*.dxf"
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.ExportFile = function () {
// 请求导出文档
CADApplet.rid++ // 增加请求序号
/// 先设置导出位置
let msg = {
"req": "Wrl_SelectFile",
"rid": CADApplet.rid,
"para": {
"Type": 1,
"Title": "请设置导出文件位置",
"Ext": "导出文件(*.pdf;*.png)\r*.pdf;*.png"
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.printFile = function (url) {
// 请求打印当前文档
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_Print",
"rid": CADApplet.rid,
"para": {
"Count": 1
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.appletFullEdit = function () {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_SwitchFullScreen",
"rid": CADApplet.rid,
"para": {}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.closeApplet = function () {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletControl",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Code": 1
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.checkUpdate = function (version) {
//校验中间件版本是不是需要升级,如果额外指定PID参数,代表校验PID代表的网页组件,Wrl_Version功能多
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_Version",
"rid": CADApplet.rid,
"para": {
"Version": version
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.changeOpen = function (myOpenDoc) {
//重新打开文档
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_Open",
"rid": CADApplet.rid,
"para": {
"Open": encodeURIComponent(myOpenDoc)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.resizeMargin = function (left, top, width, height) {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletResize",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"X": left,
"Y": top,
"Width": width,
"Height": height
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.resize = function (width, height) {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletResize",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Width": width,
"Height": height
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.showApp = function () {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletControl",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Code": 8
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.hideApp = function (code) {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletControl",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"Code": code
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.appScroll = function (scrollLeft = 0, scrollTop = 0) {
// 默认纵向滚动网页组件实例,如需要横向滚动,Code设置为1,修改Left的值
// NoLog指示服务日志不输出相关日志,因为时间比较多,输出日志导致日志文件信息过多
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletScroll",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"NoLog": 1,
"Code": 2,
"Left": 0,
"Top": Math.round(scrollTop)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.sendScrollInfo = function (BarCode = 2, scrollLeft = 0, scrollTop = 0) {
/// 设置页码滚动信息,BarW BarH分别为预留右侧宽度和底部高度
console.log(scrollLeft,scrollTop)
if(this.ws)
{
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_ScrollBar",
"rid": CADApplet.rid,
"para": {
"ID": this.aid,
"BarW": 0,
"BarH": 0,
"Code": BarCode,
"Left": Math.round(scrollLeft),
"Top": Math.round(scrollTop)
}
}
this.ws.sendMessage(msg)
}
}
CADApplet.prototype.beginSaveAsFile = function (LocalFilePath) {
// 请求开始另存文档
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_SaveAs",
"rid": CADApplet.rid,
"para": {
"NewFile": encodeURIComponent(LocalFilePath)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.beginExpportFile = function (LocalFilePath) {
// 请求开始另存文档
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "CAD_ConvertTo",
"rid": CADApplet.rid,
"para": {
"DestFile": encodeURIComponent(LocalFilePath)
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.sendUpdateJson = function () {
// 发送中间件的升级命令,实现自动升级,同时升级AutoCAD、CATIA、Solidworks、ProE等CAD网页组件
// 注意:Wrl_Update中的请求参数如MD5 TK Size等,请根据文档“中间件制作升级包说明.pdf”中的打包工具生成
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_Update",
"rid": CADApplet.rid,
"para": {
"Name": "PageHiCAD网页组件升级包",
"Date": "2024-02-28",
"Desc": "1、中间件及相关小程序发布海外版,支持360安全浏览器64位版;2、网络版授权服务管理器终端用户信息导出数据支持txt格式;3、优化中间件高级版内嵌小程序嵌入网页后在非小程序窗口区域来回切换焦点后小程序无法获得焦点问题;4、增加ProE CAD网页组件,完善AutoCAD、Solidworks及Catia CAD网页组件功能...",
"DownAddr": "http://local.zorrosoft.com/Files/Update/CAD_Update.pid",
"Open": "http://local.zorrosoft.com/CADJS",
"MD5": "3118FA258D49CB1651EB748824AE2878",
"Version": "2.2.13.1",
"Size": 22544384,
"HideIns": 0,
"Cookie": "",
"Auth": "",
"TK": "70B02061316BE32D13DC0C7D83154989FF284A6DA635354953701BD0900D7ED9B533A43B2BDE8F2AA15B3BF7357B8A6872A61ED42C26EB43ADEC832FC0C8D2B50C12567B3D3FCFCB52E6962E1226490EA3D9354DFF629FAB45D8425D5C0C4D2717101A443B601EB17161E648190E2A715F5771AE3D78DFD448EB3EBA285EDABE2D0C05157408A33ED04606FC14086D806E432DF5AA92B0A40B736D545157341016A87A15558A9538885BA05200EFA9655E74B7F59755C9A2D4E35B588417E70E0AACE4CBA0ACA3CBB1231B38D0DAFA15656755AAD9AB53BBE73491485E8BC6B84E32190A5D322D302CB7224947F220739B698F44A21C6AD898F40471BB508240"
}
}
this.ws.sendMessage(msg)
}
CADApplet.prototype.snapDoc = function () {
CADApplet.rid++ // 增加请求序号
let msg = {
"req": "Wrl_AppletSnap",
"rid": CADApplet.rid,
"para": {"ID": this.aid, "Base64": 0, "File": new Date().getTime() + ".jpg"}
}
this.ws.sendMessage(msg)
}
const location_ws = 'ws://127.0.0.1'
const remote_ws = 'wss://wrl.zorrosoft.com'
const flag = 1 //flag为1代表启用日志输出,系统正式上线后设置0可提高运行速度
const cid = 'zorrosoft'
class websocket {
static wsArr = []
ws = null
url = null
port=''
type = 0
constructor(port='',type=0) {
this.type = type
this.port = port
this.connect()
}
connect = () => {
this.url = this.getDefaultConn(this.port,this.type)
this.ws = new WebSocket(this.url);
this.ws.onopen = this.onopen
this.ws.onerror = this.onerror
this.ws.onclose = this.onclose
}
onopen = (event) => {
console.log("websocket is open");
//只发送一次,获取office 的连接信息
if(websocket.wsArr.length==0){
let msg = {
"req": "Wrl_OfficeInfo",
"rid": 1,
"para": {}
}
this.sendMessage(msg)
}
websocket.wsArr.push(this)
this.success()
}
success(){
}
getInstance = () => {
return this.ws
}
onerror = (event) => {
if (this.ws.readyState == 3) {
this.connect(this.url)
}
}
onclose = (event) => {
console.log("websocket is close");
}
sendMessage = (msg) => {
this.ws.send(JSON.stringify(msg));
}
//获取ws连接的地址
getDefaultConn(port='',type=0) {
/// flag为1代表启用日志输出,系统正式上线后设置0可提高运行速度
/// sid代表本次连接的会话ID,必须保证唯一
let Protocol = location.protocol;
if (Protocol.toUpperCase().indexOf('HTTPS') > -1)
{
port = port=='' ?453:port
/// HTTPS网站,需要申请自己主站下其它地方都不会用到的一个子域名来做SSL证书,如域名在阿里云上,请下载Apache类型的证书并提交给客服制作授权
if(1 == type)
return remote_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '&flag=1&cid='+cid+'&tk=8C4560272C8A38C32EF6102CAB6B4D886504F06C63202A316B3FD88381FC5491704DA444156B9F6FDA313843E412F1E1DC414A7899399F14D76688090FC7DCE11DA121CB2B0E819B2B7080DB9CF09D4D66192C5893ABE182DA38DF8A02EFAACB304BF9A242ADEBFAA09FC0304918895DE3B56E30A17AA8D92E3D61C1AC2453E6C1C637C3E260FE9A445EC858BADEB9312A43DD99323EF5D63414B9BC7D3F4004C7E109ADD5A6289ADAB004A2A544D312BB84E467DAC4C9449418F3FCCC9529049DCFD562B77EF2CE429B242C23975E6EA922E0564B6507177187E92F254EC2678A795B5D2EC92F818A7364FB7CA3E553D4F94119F868261E5A0A8E7EBE841CF7'; // 这里注意test.yuanmaster.com替换为自己的子域名
else
return remote_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '&flag='+flag; // 这里注意wrl.zorrosoft.com替换为自己的子域名
}
else
{
port = port=='' ?83:port
/// type为1时代表中间件启用了安全校验模式,需要按文档生成tk,具体方法参考SDK包中的文档:中间件安全解决方案.pdf
if(1 == type)
return location_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '?flag=1&cid='+cid+'&tk=8C4560272C8A38C32EF6102CAB6B4D886504F06C63202A316B3FD88381FC5491704DA444156B9F6FDA313843E412F1E1DC414A7899399F14D76688090FC7DCE11DA121CB2B0E819B2B7080DB9CF09D4D66192C5893ABE182DA38DF8A02EFAACB304BF9A242ADEBFAA09FC0304918895DE3B56E30A17AA8D92E3D61C1AC2453E6C1C637C3E260FE9A445EC858BADEB9312A43DD99323EF5D63414B9BC7D3F4004C7E109ADD5A6289ADAB004A2A544D312BB84E467DAC4C9449418F3FCCC9529049DCFD562B77EF2CE429B242C23975E6EA922E0564B6507177187E92F254EC2678A795B5D2EC92F818A7364FB7CA3E553D4F94119F868261E5A0A8E7EBE841CF7';
else
return location_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '&flag='+flag;
}
}
// 获取随机数
getRandom(nums) {
return ('000000' + Math.floor(Math.random() * 999999)).slice(-6);
}
}
const location_ws = 'ws://127.0.0.1'
const remote_ws = 'wss://wrl.zorrosoft.com'
const flag = 1 // flag为 1 代表启用日志输出,系统正式上线后设置 0 可提高运行速度
const cid = 'zorrosoft' // 授权公司唯一标识,购买后获得
websocket.wsArr = []
function websocket(port='',type=0){
this.ws = null
this.url = null
this.type = type
this.port = port
this.connect = () => {
this.url = this.getDefaultConn(this.port,this.type)
if (typeof WebSocket != 'undefined')
{
this.ws = new WebSocket(this.url);
this.ws.onopen = this.onopen
this.ws.onerror = this.onerror
this.ws.onclose = this.onclose
}
else
{
console.log("您的浏览器不支持Websocket通信协议,请使用Chrome或者Firefox浏览器!")
this.ws = createObject(getrandom(5))
this.ws.EnableLog = true
if (this.instance)
{
if (this.ws.ReadyState > 1) {
// 还未连接
this.ws.Connect(url);
}
}
}
}
this.getInstance = ()=>{
return this.ws
}
this.onopen = (event) => {
console.log("websocket is open");
//只发送一次,获取本机安装的office软件信息,启动时需要判断哪个Office是当前使用的类型Option
if(websocket.wsArr.length==0){
let msg = {
"req": "Wrl_OfficeInfo",
"rid": 1,
"para": {}
}
this.sendMessage(msg)
}
websocket.wsArr.push(this)
this.success()
}
this.success = ()=>{
}
this.onerror = (event) => {
if (this.ws.readyState == 3 && websocket.wsArr.length==0) {
let isBool = confirm('提示:PageHi办公网页组件 服务端口连接失败,可能是尚未安装,是否马上下载安装?')
if (isBool) {
window.open('http://local.zorrosoft.com/Files/PageHiOfficeIns.exe') // 建议打包为zip等格式下载,解压后安装,EXE文件下载浏览器会提示是否保留
}
}
}
this.onclose = (event) => {
console.log("websocket is close");
}
this.sendMessage = (msg) => {
this.ws.send(JSON.stringify(msg));
}
/*IE中创建WebSocket控件对象*/
this.createObject = (id) => {
var obj = $('<object></object>');
obj.attr('ID', id);
obj.attr('CLASSID', 'CLSID:21ADE2E6-B4DD-4F3E-8BD5-9DDAD1785F3A');/*单机版请替换为C0971B90-4513-4E2D-A0B6-15B915FE748A*/
obj.attr('width', 0);
obj.attr('height', 0);
obj.appendTo('body')
return document.getElementById(id)
}
//获取ws连接的地址
this.getDefaultConn = (port='',type=0)=>{
/// flag为1代表启用日志输出,系统正式上线后设置0可提高运行速度
/// sid代表本次连接的会话ID,必须保证唯一
let Protocol = location.protocol;
if (Protocol.toUpperCase().indexOf('HTTPS') > -1)
{
port = port=='' ?453:port
/// HTTPS网站,需要申请自己主站下其它地方都不会用到的一个子域名来做SSL证书,如域名在阿里云上,请下载Apache类型的证书并提交给客服制作授权
if(1 == type)
return remote_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '&flag=1&cid='+cid+'&tk=8C4560272C8A38C32EF6102CAB6B4D886504F06C63202A316B3FD88381FC5491704DA444156B9F6FDA313843E412F1E1DC414A7899399F14D76688090FC7DCE11DA121CB2B0E819B2B7080DB9CF09D4D66192C5893ABE182DA38DF8A02EFAACB304BF9A242ADEBFAA09FC0304918895DE3B56E30A17AA8D92E3D61C1AC2453E6C1C637C3E260FE9A445EC858BADEB9312A43DD99323EF5D63414B9BC7D3F4004C7E109ADD5A6289ADAB004A2A544D312BB84E467DAC4C9449418F3FCCC9529049DCFD562B77EF2CE429B242C23975E6EA922E0564B6507177187E92F254EC2678A795B5D2EC92F818A7364FB7CA3E553D4F94119F868261E5A0A8E7EBE841CF7'; // 这里注意test.yuanmaster.com替换为自己的子域名
else
return remote_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '&flag='+flag; // 这里注意wrl.zorrosoft.com替换为自己的子域名
}
else
{
port = port=='' ?83:port
/// type为1时代表中间件启用了安全校验模式,需要按文档生成tk,具体方法参考SDK包中的文档:中间件安全解决方案.pdf
if(1 == type)
return location_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '?flag=1&cid='+cid+'&tk=8C4560272C8A38C32EF6102CAB6B4D886504F06C63202A316B3FD88381FC5491704DA444156B9F6FDA313843E412F1E1DC414A7899399F14D76688090FC7DCE11DA121CB2B0E819B2B7080DB9CF09D4D66192C5893ABE182DA38DF8A02EFAACB304BF9A242ADEBFAA09FC0304918895DE3B56E30A17AA8D92E3D61C1AC2453E6C1C637C3E260FE9A445EC858BADEB9312A43DD99323EF5D63414B9BC7D3F4004C7E109ADD5A6289ADAB004A2A544D312BB84E467DAC4C9449418F3FCCC9529049DCFD562B77EF2CE429B242C23975E6EA922E0564B6507177187E92F254EC2678A795B5D2EC92F818A7364FB7CA3E553D4F94119F868261E5A0A8E7EBE841CF7';
else
return location_ws+':'+port+'?sid=' + this.getRandom(5).toLocaleString() + '&flag='+flag;
}
}
// 获取随机数
this.getRandom = (nums)=>{
return ('000000' + Math.floor(Math.random() * 999999)).slice(-6);
}
this.connect()
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/**
* 小程序相关变量
* @type {number}
*/
let OpenType = 1 // 加载类型 1启动微软Word 2启动微软Excel 3启动微软PPT 11启动金山文字 12启动金山表格 13启动金山演示 可通过请求Wrl_OfficeInfo获得需要设置的值
无法预览此类型文件
此差异已折叠。
; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
#define MyAppName "PageHiCAD网页组件"
#define MyAppVersion "2.2.13.1"
#define MyAppPublisher "成都佐罗软件有限公司"
#define MyAppURL "http://www.zorrosoft.com/"
#define MyAppExeName "ZbaSetup.exe"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
AppId={{68C5128A-ACC0-4869-BFC5-48C056E38CAB}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\PageHiCAD
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
; 以下行修改为实际的路径。
LicenseFile=E:\Release\Gitcode\pluginok\PageHiCAD\license.txt
; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
PrivilegesRequired=admin
OutputDir=E:\Release
OutputBaseFilename=PageHiCADIns
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "E:\Release\Gitcode\pluginok\PageHiCAD\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\ZbaSetup.exe";Parameters: "/S /I";Description: "安装服务";StatusMsg:"正在安装服务,请稍后..."
[UninstallRun]
Filename: "{app}\ZbaSetup.exe";Parameters: "/S /U";StatusMsg:"正在停止服务并卸载,请稍后..."
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册