javascript submit window.open 全屏页面,并post提交参数

本文介绍了一种使用JavaScript实现带有隐藏参数的新窗口的方法,通过设置form的target属性为新窗口的名字,并利用window.open来打开窗口并隐藏工具栏等元素。
有时候我们需要post一些参数,并要打开一个新窗体,一般是设置form 的target等于_blank。
但是客户又需要隐藏工具条,隐藏工具条JavaScript只有window.open能实现。
如果能完成上面的需求?代码如下,大家分享下:

function openWindowWithPost(url,hidevalue){
$("#hidevalue").val(hidevalue);
$("#hideform").attr("action",url);
//打开窗体,并post提交页面
var toDay = new Date();
windowname="win"+toDay.getTime();
window.open(url,windowname,"status=yes,toolbar=no,menubar=no,location=no");
$("#hideform").attr("target",windowname);
$("#hideform").submit();
}


重点知识点
1、form的target属性,可以设置window的name,为目标窗体
2、window.open第二个参数,是它的name。
windowname需要设置成一个不重复的id,否则再次点击只会刷新已经打开的window,而不会打开新页面。

补充:
$("#hideform")是当前页面的一个form
$("#hidevalue")是form里面的一个hide

<form action="" method="post" id="hideform" target="_blank">
<input type="hidden" id="hidevalue" name="hidevalue"/>
</form>
@using HengJiuGamesManage.Models; @{ Layout = null; } @{ Users users = new Users(); if (ViewBag.UserModel != null) { users = ViewBag.UserModel; } } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>恒久游戏管理系统</title> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="~/Scripts/layui/css/layui.css" rel="stylesheet" /> <script src="~/Scripts/jquery-3.4.1.js"></script> <style> .layui-footer { display: flex; justify-content: center; } </style> </head> <body> <div class="layui-layout layui-layout-admin"> <div class="layui-header"> <div class="layui-logo layui-hide-xs layui-bg-black">恒久游戏管理系统</div> <!-- 头部区域(可配合layui 已有的水平导航) --> <ul class="layui-nav layui-layout-left"> <!-- 移动端显示 --> <li class="layui-nav-item layui-hide-xs"><a href="javascript:;">nav 1</a></li> <li class="layui-nav-item layui-hide-xs"><a href="javascript:;">nav 2</a></li> <li class="layui-nav-item layui-hide-xs"><a href="javascript:;">nav 3</a></li> <li class="layui-nav-item"> <a href="javascript:;">nav groups</a> <dl class="layui-nav-child"> <dd><a href="javascript:;">menu 11</a></dd> <dd><a href="javascript:;">menu 22</a></dd> <dd><a href="javascript:;">menu 33</a></dd> </dl> </li> </ul> <ul class="layui-nav layui-layout-right"> <li class="layui-nav-item layui-hide layui-show-sm-inline-block"> <a href="javascript:;"> <img src="//unpkg.com/outeres@0.0.10/img/layui/icon-v2.png" class="layui-nav-img"> @users.UserName </a> <dl class="layui-nav-child"> <dd><a href="javascript:;" onclick="ModifyInfo()">个人资料</a></dd> <dd><a href="javascript:;" onclick="ModifyPassword()">修改密码</a></dd> <!-- 新增修改密码菜单 --> <dd><a href="javascript:;" onclick="Exit()">退出登录</a></dd> </dl> </li> <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect> <a href="javascript:;"> <i class="layui-icon layui-icon-more-vertical"></i> </a> </li> </ul> </div> <div class="layui-side layui-bg-black"> <div class="layui-side-scroll"> <!-- 左侧导航区域(可配合layui已有的垂直导航) --> <ul class="layui-nav layui-nav-tree" lay-filter="test"> <!-- 完整保留原有游戏分类布局 --> <li class="layui-nav-item layui-nav-itemed"> <a class="" href="javascript:;">游戏大类</a> <dl class="layui-nav-child"> <dd><a href="javascript:;">王者荣耀</a></dd> <dd><a href="javascript:;">永劫无间</a></dd> <dd><a href="javascript:;">三角洲行动</a></dd> <dd><a href="javascript:;">解限机</a></dd> </dl> </li> <li class="layui-nav-item"> <a href="javascript:;">权限管理</a> <dl class="layui-nav-child"> <dd><a href="javascript:;">普通用户</a></dd> <dd><a href="javascript:;">管理员</a></dd> <dd><a href="javascript:;">超级管理员</a></dd> </dl> </li> <li class="layui-nav-item"><a href="javascript:;">帮助</a></li> </ul> </div> </div> <div class="layui-body"> <!-- 内容主体区域 --> <div style="padding: 15px;"> <blockquote class="layui-elem-quote layui-text"> Layui 框体布局内容主体区域 </blockquote> <div class="layui-card layui-panel"> <div class="layui-card-header"> 下面是充数内容,为的是出现滚动条 </div> <div class="layui-card-body"> </div> </div> <br><br> </div> </div> <div class="layui-footer" style="justify-content: center;"> Copyright © 2025 Layui MIT Licensed 免责声明开源协议 在线测试 广告赞助 静态主题 </div> </div> <!-- 修改密码弹窗 --> <div id="passwordModal" style="display: none; padding: 20px;"> <form class="layui-form"> <div class="layui-form-item"> <label class="layui-form-label">原密码</label> <div class="layui-input-inline"> <input type="password" name="OldPassword" lay-verify="required|pass" placeholder="请输入原密码" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">新密码</label> <div class="layui-input-inline"> <input type="password" name="NewPassword" id="newPass" lay-verify="required|pass|passcheck" placeholder="请输入新密码" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">确认密码</label> <div class="layui-input-inline"> <input type="password" id="confirmPass" lay-verify="required|passcheck" placeholder="请再次输入新密码" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button class="layui-btn" lay-submit lay-filter="changePass">立即修改</button> <button type="reset" class="layui-btn layui-btn-primary">重置</button> </div> </div> </form> </div> <script src="~/Scripts/layui/layui.js"></script> <script> //JS layui.use(['element', 'layer', 'form', 'util'], function () { var element = layui.element; var layer = layui.layer; var form = layui.form; var util = layui.util; var $ = layui.$; //头部事件 util.event('lay-header-event', { menuLeft: function (othis) { // 左侧菜单事件 layer.msg('展开左侧菜单的操作', { icon: 0 }); }, menuRight: function () { // 右侧菜单事件 layer.open({ type: 1, title: '公告', content: '<div style="padding: 15px;">公告1</div>', area: ['260px', '100%'], offset: 'rt', // 右上角 anim: 'slideLeft', // 从右侧抽屉滑出 shadeClose: true, scrollbar: false }); } }); // 表单验证 form.verify({ pass: [/^[\S]{6,12}$/, '密码必须6-12位且不能包含空格'], passcheck: function (value) { if ($('#newPass').val() && $('#confirmPass').val() && $('#newPass').val() !== $('#confirmPass').val()) { return '两次输入的密码不一致'; } } }); // 提交事件 form.on('submit(changePass)', function (data) { // TODO: 添加密码修改逻辑 console.log(data.field); layer.msg('提交成功', { icon: 1 }); return false; }); }); //退出 function Exit() { $.ajax({ url: "/Home/ExitSession", type: "post", success: function (res) { if (res.code == 0) { layer.msg(res.msg, { icon: 6, time: 2000 }, function () { window.location.href = "/Login/Index"; }) } else { layer.msg(res.msg, { icon: 5, time: 2000 }); } } }) } // 修改资料弹窗 function ModifyInfo() { layer.open({ type: 2, // page 层类型 area: ['669px', '638px'], title: '资料修改', shade: 0.5, // 遮罩透明度 shadeClose: false, // 点击遮罩区域,关闭弹层 maxmin: false, // 允许全屏最小化 anim: 0, // 0-6 的动画形式,-1 不开启 content: '/Home/ModifyBaseInfo', end: function () { // 刷新当前页面 location.reload(); } }); } // 修改密码弹窗 function ModifyPassword() { layer.open({ type: 1, title: '修改密码', area: ['450px', '300px'], content: $('#passwordModal'), success: function () { layui.form.render(); } }); } </script> </body> </html>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using HengJiuGamesManage.Models; namespace HengJiuGamesManage.Controllers { public class HomeController : Controller { ReturnJsonData jsonData = new ReturnJsonData(); public ActionResult Index() { //获取服务器中存储的session数据 var sessionUsers = System.Web.HttpContext.Current.Session["Users"]; if(sessionUsers == null) { return Redirect("/Login/Index"); } //强制转化 Users users = sessionUsers as Users; //赋值 ViewBag.UserModel = users; return View(); } public ActionResult ExitSession() { //删除session 变量 Session.Remove("Users"); var sessionUsers = System.Web.HttpContext.Current.Session["Users"]; if (sessionUsers == null) { jsonData.code = 0; jsonData.msg = "退出成功,请稍后"; } else { jsonData.code = 1; jsonData.msg = "网络不稳定,请重新尝试"; } return Json(jsonData); } public ActionResult ModifyBaseInfo() { var sessionUsers = System.Web.HttpContext.Current.Session["Users"]; if (sessionUsers == null) { return Redirect("/Login/Index"); } return View(); } public ActionResult GetUserInfo(Users users) { try { // 1. 获取当前用户 ID(或从表单隐藏域获取) var userId = users.ID; // 2. 查询数据库中的用户 using (var db = new AoutEntities()) { var user = db.Users.FirstOrDefault(u => u.ID == userId); if (user == null) { return Json(new { code = 1, msg = "用户不存在" }); } // 3. 更新用户信息(根据表单字段赋值) user.UserCode = users.UserCode; user.UserName = users.UserName; user.Sex = users.Sex; user.BirthDay = users.BirthDay; user.NativePlace = users.NativePlace; user.Email = users.Email; user.Tel = users.Tel; user.Address = users.Address; db.SaveChanges(); // 保存到数据库 var result = db.SaveChanges(); return Json(new { code = 0, msg = "修改成功" }); } } catch (Exception ex) { return Json(new { code = 1, msg = "修改失败:" + ex.Message }); } } } }这两段代码给出优化
07-08
using HengJiuGamesManage.Models; using System; using System.Data.Entity; using System.Linq; using System.Web.Mvc; namespace HengJiuGamesManage.Controllers { [LoginActionFitter] public class JobManageController : Controller { // GET: JobManage GameEntities db = new GameEntities(); ReturnListJsonData ListJsonData = new ReturnListJsonData(); ReturnJsonData JsonData = new ReturnJsonData(); #region 主页方法 public ActionResult Index() { return View(); } #endregion #region 加载列表方法 public ActionResult GetList(int page, int limit, string name, string code) { var list = db.Job.Where(a => a.IsDel == false).ToList(); if (!string.IsNullOrEmpty(name)) { list = list.Where(a => a.JobName.Contains(name)).ToList(); } if (!string.IsNullOrEmpty(code)) { list = list.Where(a => a.JobCode.Contains(code)).ToList(); } var offset = (page - 1) * limit; //分页 var data = list.OrderByDescending(a => a.ModifyDate).Skip(offset).Take(limit); ListJsonData.code = 0; ListJsonData.count = list.Count; ListJsonData.data = data; return Json(ListJsonData, JsonRequestBehavior.AllowGet); } #endregion #region 删除表格方法 public ActionResult DelInfo(Guid? id) { if(id == Guid.Empty) { JsonData.code = 0; JsonData.msg = "删除失败,请联系管理员"; } else { //逻辑删除 var entity = db.Job.Find(id); entity.IsDel = true; db.Entry<Job>(entity).State = System.Data.Entity.EntityState.Modified; //真实删除 //var entity1 = db.Job.Find(id); //db.Job.Remove(entity1); var result = db.SaveChanges(); if (result > 0) { JsonData.code = 0; JsonData.msg = "删除成功"; } else { JsonData.code = 0; JsonData.msg = "删除失败,请联系管理员"; } } return Json(JsonData); } #endregion #region 添加职位方法 public ActionResult AddInfo(Job job) { job.ID = Guid.NewGuid(); job.CreateDate = DateTime.Now; db.Job.Add(job); var result = db.SaveChanges(); if (result > 0) { JsonData.code = 0; JsonData.msg = "注册成功"; } else { JsonData.code = 1; JsonData.msg = "注册失败"; } return Json(JsonData); } #endregion #region 修改方法 public ActionResult UpdateJobTable(Job job) { if (job.ID == Guid.Empty) { JsonData.code = 1; JsonData.msg = "未查找到此用户"; } else { Job entity = db.Job.Find(job.ID); //Users entity = db.Users.Where(a => a.ID == users.ID).FirstOrDefault (); 同上 //赋值 if (entity != null) { entity.JobName = job.JobName; entity.JobCode = job.JobCode; //给数据库修改的指令 db.Entry<Job>(entity).State = EntityState.Modified; job = entity; } else { JsonData.code = 1; JsonData.msg = "未查找到此用户"; } } var result = db.SaveChanges(); if (result > 0) { Session["Users"] = job;//更新缓存 JsonData.code = 0; JsonData.msg = "修改个人资料成功"; } else { JsonData.code = 1; JsonData.msg = "修改个人资料失败"; } return Json(JsonData, JsonRequestBehavior.AllowGet); } #endregion } }@using HengJiuGamesManage.Models; @{ Layout = null; } @{ Job job = new Job(); if (ViewBag.UserModel != null) { job = ViewBag.UserModel; } } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <link href="~/Scripts/layui/css/layui.css" rel="stylesheet" /> <script src="~/Scripts/layui/layui.js"></script> <script src="~/Scripts/jquery-3.4.1.js"></script> <style> .layui-input, .layui-textarea { display: block; width: 70%; padding-left: 10px; } .layui-btn { margin-left: 9px; } .layui-field-box { padding: 45px; } .editInfo { display: none; } .updateInfo { display: none; } element.style { z-index: 19891015; width: 442px; height: 284px; position: fixed; top: 265px; left: 219.5px; } </style> </head> <body> <fieldset class="layui-elem-field" style="border:solid"> <legend> <span class="layui-breadcrumb"> <a href="">首页</a> <a><cite>职位管理</cite></a><br /> </span> </legend> <div class="layui-form-item"> <div class="layui-inline"> <label class="layui-form-label">职位名称</label> <div class="layui-input-block"> <input type="text" name="name" id="date1" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-inline"> <label class="layui-form-label">职位代码</label> <div class="layui-input-inline"> <input type="text" name="code" autocomplete="off" class="layui-input"> </div> </div> <button type="button" class="layui-btn layui-btn-radius" onclick="Select()"><i class="layui-icon layui-icon-search"></i>查询</button> <button type="button" class="layui-btn" onclick="Add()"><i class="layui-icon layui-icon-addition"></i> 添加</button> </div> </fieldset> <fieldset style="border:none"> <div class="layui-field-box"> <div style="padding: 16px;"> <table class="layui-hide" id="test" lay-filter="test"></table> <script type="text/html" id="toolDemo"> <div class="layui-clear-space"> <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> <a class="layui-btn layui-btn-xs layui-bg-red" lay-event="more">删除</a> </div> </script> </div> </div> </fieldset> @*新增的弹窗*@ <div class="editInfo"> <form class="layui-form layui-form-pane" action=""> <div class="layui-form-item"> <label class="layui-form-label">职位名称</label> <div class="layui-input-block"> <input type="text" name="JobName" autocomplete="off" placeholder="请输入职位名称" lay-verify="required" class="layui-input"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">职位代码</label> <div class="layui-input-block"> <input type="text" name="JobCode" autocomplete="off" placeholder="请输入职位代码" lay-verify="required" class="layui-input"> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button> <button type="reset" class="layui-btn layui-btn-primary">重置</button> </div> </div> </form> </div> @*修改资料*@ <div class="updateInfo"> <form class="layui-form layui-form-pane" action=""> <div class="layui-form-item"> <label class="layui-form-label">职位名称</label> <div class="layui-input-block"> <input type="text" name="JobName" autocomplete="off" placeholder="请输入职位名称" lay-verify="required" class="layui-input" value="@job.JobName"> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">职位代码</label> <div class="layui-input-block"> <input type="text" name="JobCode" autocomplete="off" placeholder="请输入职位代码" lay-verify="required" class="layui-input" value="@job.JobCode"> </div> </div> <div class="layui-form-item"> <div class="layui-input-block"> <button type="submit" class="layui-btn" lay-submit lay-filter="demo1" onclick="UpdateWeb()">修改</button> <button type="reset" class="layui-btn layui-btn-primary">重置</button> </div> </div> </form> </div> <script> var tableIns; var table; // 创建渲染实例,渲染列表 layui.use(['table'], function () { table = layui.table; tableIns = table.render({ elem: '#test', url: '/JobManage/GetList', // 此处为静态模拟数据,实际使用时需换成真实接口 height: 500, page: true, cols: [[ { type: 'Number', width: '10%', title: '序号' }, { field: 'JobName', width: '10%', title: '职位名称' }, { field: 'JobCode', width: '10%', title: '职位代码' }, { field: 'CreateDate', width: '10%', title: '创建时间', templet: function (d) { //return convertJsonDate(d.CreateDate); return d; } }, { field: 'ModifyDate', title: '修改时间', width: '10%' }, { title: '操作', width: '10%', minWidth: 125, templet: '#toolDemo' } ]], }); //工具栏事件 // 查询重载 function Search() { var nameVal = $('input[name="name"]').val().trim(); var codeVal = $('input[name="code"]').val().trim(); tableIns.reload({ where: { name: nameVal, code: codeVal }, page: { curr: 1 } // 重置分页 }); } //触发单元格工具事件 table.on('tool(test)', function (obj) { // 双击 toolDouble var data = obj.data; // 获得当前行数据 // console.log(obj) if (obj.event === 'edit') { //修改 layer.open({ type: 1, // page 层类型 area: ['500px', '300px'], title: '新建职位', shade: 0.6, // 遮罩透明度 shadeClose: true, // 点击遮罩区域,关闭弹层 maxmin: false, // 允许全屏最小化 anim: 0, // 0-6 的动画形式,-1 不开启 content: $('.updateInfo').html(), }) } else { layer.confirm('真的删除职位 [' + data.JobName + '] 么', function (index) { $.ajax({ url: "/JobManage/DelInfo", type: "post", data: { id: data.ID }, success: function (res) { if (res.code == 0) { layer.msg(res.msg, { icon: 6, time: 1000 }); obj.del(); // 删除对应行(tr)的DOM结构 layer.close(index); // 向服务端发送删除指令 } else { layer.msg(res.msg, { icon: 5, time: 2000 }); } } }) }); } }); var form = layui.form; var layer = layui.layer; // 提交事件 form.on('submit(demo1)', function (data) { var field = data.field; $.ajax({ url: "/JobManage/AddInfo", type: "post", data: field, success: function (res) { if (res.code == 0) { layer.msg(res.msg, { icon: 1, time: 1000 }, function () { /*window.location.href = '/Home/Index';*/ layer.closeAll(); Search(); }); } else if (res.code == 1) { layer.msg(res.msg, { icon: 5, time: 3000 }); } } }) return false; // 阻止默认 form 跳转 }); })//表单结束 //修改方法 function UpdateWeb() { $.ajax({ url: "/JobManage/UpdateJobTable", type: "post", data: { id: data.ID, JobName: data.JobName, JobCode: data.JobCode }, success: function (res) { if (res.code == 0) { layer.msg(res.msg, { icon: 6, time: 1000 }); } else { layer.msg(res.msg, { icon: 5, time: 2000 }); } } }) layer.close(index); Search(); } //新增方法 function Add() { layer.open({ type: 1, // page 层类型 area: ['500px', '300px'], title: '新建职位', shade: 0.6, // 遮罩透明度 shadeClose: true, // 点击遮罩区域,关闭弹层 maxmin: false, // 允许全屏最小化 anim: 0, // 0-6 的动画形式,-1 不开启 content: $('.editInfo').html() }); } //查询方法 function Select() { table.reload = function () { var args = []; layui.each(arguments, function (index, item) { args.push(item); }); args[2] === undefined && (args[2] = true); return tableReload.apply(null, args); }; tableIns.reload({ where: { // 传递数据异步请求时携带的字段 name: $("#date1").val(), code: $("input[name = 'code']").val() }, height: 500 // 重设高度 }) } //时间格式 //function convertJsonDate(jsonDate) { // const timestamp = parseInt(dateStr.match(/\d+/)[0]); // const date = new Date(timestamp); // const year = date.getFullYear(); // const month = String(date.getMonth() + 1).padStart(2, '0'); // const day = String(date.getDate()).padStart(2, '0'); // return `${year}-${month}-${day}`; //} </script> </body> </html> 添加可以成功但成功后页面不更新
07-11
<!DOCTYPE html> <html lang="zh-cn" style="font-size: 15px;"> <head> <meta charset="UTF-8"> <meta name=renderer content=webkit> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <meta http-equiv="Cache-Control" content="max-age=7200" /> <!-- <meta name="referrer" content="no-referrer"> --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="keywords" content="LNB换型事件标准内容,IMES FA 相关文档,技术,架构,流程,知识,规范,标准化"/> <meta name="description" content="``` <?xml version="1.0" encoding="UTF-8"?> <root> <Header> <SystemName>UpperSystem</SystemName" /> <!-- OGP分享协议开始 --> <meta property="og:type" content="website"> <meta property="og:title" content="LNB换型事件标准内容 - IMES FA 相关文档"> <meta property="og:description" content="``` <?xml version="1.0" encoding="UTF-8"?> <root> <Header> <SystemName>UpperSystem</SystemName"> <meta property="og:url" content="http://kk.luxsan-ict.com/doc/13859/"> <link rel="icon" href="/static/search/mrdoc_logo_300.png" sizes="192x192" /> <meta property="og:image" content="http://kk.luxsan-ict.com/static/search/mrdoc_logo_300.png"> <!-- OGP分享协议结束 --> <title>LNB换型事件标准内容 - IMES FA 相关文档 - 立臻IT知识库 </title> <link href="/static/PearAdminLayui/component/layui/css/layui.css?version=1.5.2" rel="stylesheet"> <link rel="stylesheet" href="/static/mr-marked/marked.css?version=1.5.2" /> <link href="/static/viewerjs/viewer.min.css?version=1.5.2" rel="stylesheet"> <link href="/static/mrdoc/mrdoc.css?version=1.5.2" rel="stylesheet"> <link href="/static/mrdoc/mrdoc-docs.css?version=1.5.2" rel="stylesheet"> <link href="/static/iconFont/iconfont.css?version=1.5.2" rel="stylesheet"> <style> .markdown-code .markdown-code-block pre,.vditor-reset > pre > code.hljs{ max-height: max-content!important; } code[class*=language-], pre[class*=language-]{ white-space: pre-wrap !important; } :not(pre)>code[class*=language-]{ white-space: inherit !important; } /* html{ filter: invert(1) hue-rotate(180deg); } */ </style> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body class="big-page"> <div id="doc-container"> <!-- 左侧目录栏 --> <div id="doc-container-sidebar" id="doc-summary"> <div> <!-- 左上角广告块 --> <!-- 广告代码开始 --> <!-- 广告代码结束 --> <!-- 文集名称 --> <div class="project-title"> <svg class="icon" aria-hidden="true"><use xlink:href="#mrdoc-icon-pro-2"></use></svg> <a href="/project/129/" >IMES FA 相关文档 </a> <i class="layui-icon layui-icon-star" style="cursor: pointer;" title="请登录后收藏"></i> <p> </p> </div> <!-- 文档搜索框 --> <form action="/project/129/" method="get" class="project-search-div" > <div id="doc-search-input"> <input type="text" name="kw" placeholder="在文集内搜索文档" value="" class="layui-input doc-search-input"> <button type="submit" style="position: absolute;top:15px;right: 20px;border: none;background-color: white;cursor:pointer"> <i class="layui-icon layui-icon-search"></i> </button> </div> </form> <!-- <hr> --> <!-- 遍历文集大纲 --> <!-- 如果文集的文档数量超过999,使用异步加载文集目录 --> <!-- 文档数量小于999,使用同步加载文集目录 --> <nav> <ul class=""> <!-- 一级目录 --> <li class="doctree-li"> <div class="doctree-item-wrapper"> <span class="doctree-item-name-wrapper"> <i class="layui-icon layui-icon-right switch-toc"></i>  <a href="/doc/13858/" class="doc-link" data-id="13858" title="MLB IMES"> MLB IMES </a> </span> </div> <div class="sub-items"><ul class="doctree-ul"> <!-- 一级目录 --> <li class="doctree-li"> <div class="doctree-item-wrapper"> <span class="doctree-item-name-wrapper"> <a href="/doc/13859/" class="doc-link" data-id="13859" title="LNB换型事件标准内容"> <i class="iconfont mrdoc-icon-wendang"></i>  LNB换型事件标准内容 </a> </span> </div> </li> <li class="doctree-li"> <div class="doctree-item-wrapper"> <span class="doctree-item-name-wrapper"> <a href="/doc/13870/" class="doc-link" data-id="13870" title="LNB配置标准值"> <i class="iconfont mrdoc-icon-wendang"></i>  LNB配置标准值 </a> </span> </div> </li> </ul></div> </li> </ul> </nav> <div class="bq"> <a href="javascript:void(0);" class="mrdoc-link">立臻IT知识库</a> </div> <!-- 右下角广告块 --> <!-- 广告代码开始 --> <!-- 广告代码结束 --> </div> </div> <!-- 左侧目录栏结束 --> <div id="doc-container-splitter"></div> <button class="doc-container-sidebar-toggle" onclick="toggleSidebar()"> <svg class="doc-container-toggle-icon" viewBox="0 0 24 24" width="24" height="24"> <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/> </svg> </button> <!-- 右侧文档栏 --> <div id="doc-container-body"> <!-- 文档导航 --> <div class="doc-header" role="navigation"> <a class="btn pull-left js-toolbar-action" aria-label="" href="javascript:void(0);" title="切换侧边栏"> <i class="layui-icon layui-icon-slider"></i> </a> <a class="btn pull-left font-small layui-hide-xs" href="javascript:void(0);" title="缩小字体"> <i class="iconfont mrdoc-icon-font-size">-</i> </a> <a class="btn pull-left font-large layui-hide-xs" href="javascript:void(0);" title="放大字体"> <i class="iconfont mrdoc-icon-font-size">+</i> </a> <a class="btn pull-left font-switch layui-hide-xs" href="javascript:void(0);" title="切换字体类型"> <i class="iconfont mrdoc-icon-font-type"></i> </a> <a class="btn pull-left theme-switch" href="javascript:void(0);" title="切换至夜间模式"> <i class="iconfont mrdoc-icon-night"></i> </a> <!-- 顶部工具栏 --> <a class="btn pull-right" aria-label="" href="/"> <i class="layui-icon layui-icon-home"></i> <span class="layui-hide-xs">首页</span> </a> </div> <!-- 文档主体 --> <div class="doc-body-content"> <div class="doc-body-content-div"> <!-- 文档内容 --> <div class="doc-content" id="doc-content"> <!-- 标题 --> <div class="doc-info"> <!-- 页面主体头信息 --> <h1>LNB换型事件标准内容</h1><hr> <!-- 广告代码开始 --> <!-- 广告代码结束 --> </div> <!-- 标题结束 --> <!-- 正文开始 --> <div class="markdown-body" id="content"> <textarea style="display: none;">``` <?xml version="1.0" encoding="UTF-8"?> <root> <Header> <SystemName>UpperSystem</SystemName> <SystemVersion>1.00</SystemVersion> <SessionId>6984</SessionId> <CommandName>CHANGE-REQUEST</CommandName> </Header> <CHANGE-REQUEST> <Index> <Element> <Date>2025/10/26,22:40:04</Date> <MCNo>8</MCNo> <Lane>1</Lane> <LotName>639-23039$AK0_T04A_2617</LotName> <Production>7264</Production> <PlannedProduction>0</PlannedProduction> <PassData>0</PassData> <DataCount>10</DataCount> <MountMode>1</MountMode> <LaneMode>1</LaneMode> </Element> </Index> </CHANGE-REQUEST> </root> ```</textarea> </div> <!-- 正文结束 --> <div class="markdown-body"> <!-- 文档附件 --> </div> <hr> </div> <!-- 分享栏 --> <div id="doc-content-bottom-toolbar" style="color: rgba(0,0,0,.65);padding-bottom: 10px;margin-top: 10px;"> <div class="layui-row" style="margin-bottom: 10px;padding-left: 20px;"> </div> <div class="layui-row layui-col-space20" style="padding-left: 20px;"> <span class="doc-bottom-icon"> <i class="layui-icon layui-icon-user"></i> 宋恒林(K17082150) </span> <span tooltip="更新于:2025年11月4日 11:50" class="doc-bottom-icon"> <i class="layui-icon layui-icon-log"></i> 2025年11月4日 11:50 </span> <button id="share" class="doc-bottom-btn" tooltip="转发本文档"> <i class="layui-icon layui-icon-share" ></i> 转发文档 </button> <span class="doc-bottom-icon"> <i class="layui-icon layui-icon-star" title="请登录后收藏"></i> 收藏文档 </span> </div> </div> <!-- 广告代码开始 --> <!-- 广告代码结束 --> <div class="layui-row page-flip" style="margin-top: 10px;padding:10px;display:flex;justify-content:space-around;"> <!-- <hr> --> <div> <a href="/doc/13858/" class="layui-btn layui-btn-primary layui-btn-sm layui-btn-radius"><i class="layui-icon layui-icon-prev "></i>上一篇</a> </div> <div> <a href="/doc/13870/" class="layui-btn layui-btn-primary layui-btn-sm layui-btn-radius">下一篇<i class="layui-icon layui-icon-next"></i></a> </div> </div> </div> <!-- 文档目录 --> <div id="toc-container" class='sidebar doc-toc-hide'></div> </div> </div> <!-- 右侧文档栏结束 --> </div> <!-- 右下角工具按钮 --> <div class="fixed-tool-bar"> <div class="toTop" ><i class="layui-icon layui-icon-up"></i></div> <a class="tocMenu" href="/feedback/?source=/doc/13859/" target="_blank" title="反馈问题"><i class="layui-icon layui-icon-help"></i></a> <!-- 修改文档 --> <!-- 目录 --> <div class="tocMenu" style="display: none;"><i class="iconfont mrdoc-icon-toc"></i></div> <!-- 分享按钮 --> </div> <!-- 转发选项卡模板 --> <div id="share_div" style="display: none;"> <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> <ul class="layui-tab-title"> <li class="layui-this">手机扫码</li> <li>复制链接</li> </ul> <div class="layui-tab-content" style="height: 100px;"> <div class="layui-tab-item layui-show" align='center'> <p style="font-weight: 700;margin-bottom: 10px;">手机扫一扫转发分享</p> <div id="url_qrcode"></div> </div> <div class="layui-tab-item mrdoc-margin-1" align='center'> <input type="text" id="copy_crt_url" name="current_url" class="layui-input" /><br> <button class="layui-btn layui-btn-xs" title="复制链接到粘贴板" style="background-color: #333;" id="copy_doc_url"">复制链接</button> </div> </div> </div> </div> <script src="/jsi18n/"></script> <script src="/static/jquery/3.5.0/jquery.min.js"></script> <script src="/static/PearAdminLayui/component/layui/layui.js?version=1.5.2"></script> <script src="/static/viewerjs/viewer.min.js?version=1.5.2"></script> <script src="/static/qrcodejs/qrcode.min.js?version=1.5.2"></script> <script src="/static/darkmode-js/darkmode-js.min.js?version=1.5.2"></script> <script src="/static/markjs/mark.min.js?version=1.5.2" charset="UTF-8"></script> <script> var layer = layui.layer; var laypage = layui.laypage; var dropdown = layui.dropdown; var element = layer.element; var pro_id = '129'; var csrf_token_str = 'FYiG9BvZxlszgMJHivQ94WymudTPAWw8wrFI75LcqJDTMGzZqTw1jexUzwRvAb0B'; var is_creater = false; var code_line_number = true; </script> <script src="/static/mrdoc/mrdoc-docs.js?version=1.5.2"></script> <script src="/static/iconFont/iconfont.js?version=1.5.2"></script> <script> var layer = layui.layer; var dropdown = layui.dropdown; var pro_id = '129'; var csrf_token_str = 'FYiG9BvZxlszgMJHivQ94WymudTPAWw8wrFI75LcqJDTMGzZqTw1jexUzwRvAb0B'; var doc_editor_mode; if(is_creater){ renderTocDropDown() } function renderTocDropDown(){ dropdown.render({ elem: '.doctree-item-btn', trigger:'hover', data: [ {title:'修改文档',id:'modify'}, {title:'新增文档',id:'add'}, {title:'复制链接',id:'copy'}, ], click:function(obj){ // console.log(obj) var elem = $(this.elem) // console.log(elem.data('id')) switch (obj.id) { case 'modify': window.location.href = `/modify_doc/${elem.data('id')}/`; break; case 'add': window.location.href = `/create_doc/?pid=${pro_id}&parent_id=${elem.data('id')}`; break; case 'copy': var baseURL = window.location.protocol + "//" + window.location.host copyToClipboard(`${baseURL}/doc/${elem.data('id')}/`) break; default: break; } } }); }; </script> <script src="/static/mr-marked/marked.min.js?version=1.5.2"></script> <!-- 文档评论相关js --> <!-- 动态添加广告代码 --> <div id="ad-1"> </div> <div id="ad-2"> </div> <div id="ad-3"> </div> <div id="ad-4"> </div> <script> $("#ad-1").appendTo($("#ad-code-1")); $("#ad-2").appendTo($("#ad-code-2")); $("#ad-3").appendTo($("#ad-code-3")); $("#ad-4").appendTo($("#ad-code-4")); </script> <!-- 广告代码结束 --> <!-- 统计代码开始 --> <!-- 统计代码结束 --> <!-- 解析渲染Markdown --> <script> var editor_mode = 1; var pro_id = 129; var doc_id = 13859; var is_auth = false; initDocRender(mode=editor_mode); // 图片放大显示 var img_options = { url: 'data-original', fullscreen:false,//全屏 rotatable:false,//旋转 scalable:false,//翻转 button:false,//关闭按钮 toolbar:false, title:false, }; var img_viewer = new Viewer(document.getElementById('content'), img_options); </script> <!-- 下载选项卡模板 --> <div id="download_div" style="display: none;"> <div class="layui-row" style="margin: 10px;"> <a class="layui-btn layui-btn-primary layui-btn-sm" download='LNB换型事件标准内容.md' href="/download_doc_md/13859/" target="_blank"> Markdown文件 </a> <button class="layui-btn layui-btn-primary layui-btn-sm" href="/download_doc_docx/13859/" id="download-doc-docx"> Word文件 </button> <button class="layui-btn layui-btn-primary layui-btn-sm" id="download-doc-pdf"> PDF文档 </button> <a href="?print=true" target="_blank" class="layui-btn layui-btn-primary layui-btn-sm" >PDF文档(打印)</a> </div> </div> <!-- 分享文档选项卡模板 --> <div id="share_doc_div" style="display: none;margin:10px;"> <div class="layui-tab-content"> <div class="layui-form layui-form-pane" lay-filter="show-share-form"> <div class="layui-form-item"> <label class="layui-form-label">分享</label> <div class="layui-input-block"> <input type="checkbox" name="switch" lay-skin="switch" lay-text="开启|关闭" lay-filter="share-switch" > </div> </div> <div class="layui-form" style="display: none;" id="share-link"> <div class="layui-form-item"> <label class="layui-form-label">链接</label> <div class="layui-input-block" id='copy_link'> <input type="text" name="share_link" class="layui-input" id="share_link" readonly> </div> </div> </div> <div class="layui-form-item" style="display:none;" id="share-type"> <label class="layui-form-label">类型</label> <div class="layui-input-block"> <input type="radio" name="share_type" value="0" title="公开" checked lay-filter="share_type"> <input type="radio" name="share_type" value="1" title="私密" lay-filter="share_type"> </div> </div> <div class="layui-form" style="display:none;" id="share_value_item"> <div class="layui-form-item"> <label class="layui-form-label">密码</label> <div class="layui-input-inline"> <input type="text" name="share_value" value='' disabled class="layui-input" id="share_doc_value"> </div> <div class="layui-form-mid layui-word-aux"> <button class="layui-btn layui-btn-xs layui-btn-primary" id="updateShareValue"><i class="layui-icon layui-icon-refresh"></i> 更新密码</button> </div> </div> </div> <div class="layui-form-item" style="display:none;" id="share-expire"> <label class="layui-form-label">有效期</label> <div class="layui-input-block"> <input type="radio" name="expire_type" value="-1" title="永久" checked lay-filter="expire_type"> <input type="radio" name="expire_type" value="3" title="3天" lay-filter="expire_type"> <input type="radio" name="expire_type" value="7" title="7天" lay-filter="expire_type"> <input type="radio" name="expire_type" value="15" title="15天" lay-filter="expire_type"> <input type="radio" name="expire_type" value="0" title="自定义" lay-filter="expire_type"> <div class="layui-input-inline" id="expire_date_item" style="display: none;"> <input type="text" class="layui-input" name="expire_date" id="expire_date" value="" autocomplete="off"> </div> </div> </div> </div> </div> </div> <script src="/static/toc/doctoc.js?version=1.5.2"></script> <script src="/static/clipboard/clipboard.min.js"></script> <script> var layer = layui.layer; var form = layui.form; var laydate = layui.laydate; var doc_editor_mode = '1'; // Ajax默认配置 $.ajaxSetup({ data: {csrfmiddlewaretoken: 'FYiG9BvZxlszgMJHivQ94WymudTPAWw8wrFI75LcqJDTMGzZqTw1jexUzwRvAb0B' }, headers: {"X-CSRFToken":'FYiG9BvZxlszgMJHivQ94WymudTPAWw8wrFI75LcqJDTMGzZqTw1jexUzwRvAb0B'}, }); // 非小屏默认展开文档目录 if(window.innerWidth > 1650){ $(".sidebar").toggleClass("doc-toc-hide"); } // 切换文档目录显示与否 $(".tocMenu").click(function() { // console.log("切换文档目录显示") $(".sidebar").toggleClass("doc-toc-hide"); }); //修改a标签链接新窗口打开 // $('#content').on('click','a',function(e){ // e.target.target = '_blank'; // }); // 显示文档下载弹出框 $("#download_doc").click(function(r){ var layer = layui.layer; layer.open({ type: 1, title: false, closeBtn: 0, area: ['350px','150px'], shadeClose: true, content: $('#download_div') }); }); // 生成随机分享码 function randomWord(randomFlag, min, max){ var str = "", range = min, arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; // 随机产生 if(randomFlag){ range = Math.round(Math.random() * (max-min)) + min; } for(var i=0; i<range; i++){ pos = Math.round(Math.random() * (arr.length-1)); str += arr[pos]; } return str; }; // 更新文档分享状态 function updateDocShare(data){ $.ajax({ url:"/share_doc/", method:'post', data:data, success:function(r){ if(r.status){ layer.msg("设置成功",{offset: 't'}) // console.log(r.data) $("input[name=share_link]").val(document.location.protocol + '//' + document.location.host + '/share_doc/?token=' + r.data.doc) }else{ layer.msg("设置出错") } }, error:function(){ layer.msg("文档分享异常") } }) } // 分享文档 $("#shareDoc").click(function(){ layer.open({ type:1, title:'分享文档:LNB换型事件标准内容', content:$("#share_doc_div"), area:'450px', success : function(index, layero) { // 成功弹出后回调 form.render(); }, cannel: function(){ $("#share_doc_div").hide(); } }) }) var share_data = { 'id':'13859', } laydate.render({ elem: '#expire_date', mini:1, done: function(value, date, endDate){ // console.log(value); share_data['expire_date'] = value; updateDocShare(share_data); } }); // 复制分享URL及分享码 var copy_share_link = new ClipboardJS('#copy_link', { text: function() { let share_val = form.val("show-share-form"); if(share_val['share_type'] == 0){ return share_val['share_link'] }else{ let share_link = share_val['share_link'] + "&pwd=" + share_val['share_value'] return share_link } } }); copy_share_link.on('success', function(e) { layer.msg("复制成功!") }); //监听分享框分享类型的单选事件 form.on('radio(share_type)', function(data){ // console.log(data.value); //被点击的radio的value值 if(data.value == 0){ // 公开 $("#share_value_item").css("display","none"); share_data['share_type'] = 0; share_data['share_value'] = $("#share_doc_value").val(); updateDocShare(share_data); }else if(data.value == 1){ // 私密 $("#share_value_item").css("display","block"); // console.log("初始化密码") $("#share_doc_value").val(randomWord(false,4)) share_data['share_type'] = 1; share_data['share_value'] = $("#share_doc_value").val(); updateDocShare(share_data); } }); // 监听分享有效期的单选事件 form.on('radio(expire_type)', function(data){ // console.log(data.value); //被点击的radio的value值 share_data['expire_type'] = data.value; if(data.value == 0){ // 自定义日期 $("#expire_date_item").css("display","block"); layer.msg("请选择日期") share_data['expire_date'] = $("#expire_date").val(); // updateDocShare(share_data); }else{ $("#expire_date_item").css("display","none"); updateDocShare(share_data); } }); // 监听分享开关事件 form.on('switch(share-switch)', function(data){ console.log(data.elem.checked); //开关是否开启,true或者false if(data.elem.checked){ // 开启 // console.log("开启分享") $("#share-type").css('display',"block"); $("#share-expire").css('display',"block"); $("#share-link").css("display","block"); if($("input[name='share_type']:checked").val() == 1){ $("#share_value_item").css("display","block"); } // 开启 share_data['is_enable'] = true updateDocShare(share_data); }else{ // console.log("关闭分享") layer.msg("关闭分享",{offset: 't'}) $("#share-type").css('display',"none") $("#share-expire").css('display',"none") $("#share_value_item").css("display","none"); $("#share-link").css("display","none"); share_data['is_enable'] = false updateDocShare(share_data); } }); // 更新文档分享密码 $("#updateShareValue").click(function(){ $("#share_doc_value").val(randomWord(false,4)); share_data['share_type'] = 1; share_data['share_value'] = $("#share_doc_value").val(); updateDocShare(share_data); }); // 评论组件 </script> <!-- 调用浏览器打印功能 --> <!-- 文档PDF生成 --> <script src="/static/jspdf/jspdf.umd.min.js?version=1.5.2 charset="utf-8"></script> <script src="/static/html2canvas/html2canvas.min.js?version=1.5.2 charset="utf-8"></script> <script type="text/javascript"> // 文档生成PDF function doc2pdf() { //将整个页面转成canvas html2canvas(document.getElementById("doc-content"),{useCORS:true,logging:true}).then(canvas => { var contentWidth = canvas.width; var contentHeight = canvas.height; //一页pdf显示html页面生成的canvas高度; var pageHeight = contentWidth / 592.28 * 841.89; //未生成pdf的html页面高度 var leftHeight = contentHeight; //页面偏移 var position = 0; //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高 var imgWidth = 555.28; //左右边距20 var imgHeight = 555.28/contentWidth * contentHeight; //左右边距20 var pageData = canvas.toDataURL('image/jpeg', 1.0); var doc = new jspdf.jsPDF('', 'pt', 'a4'); //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89) //当内容未超过pdf一页显示的范围,无需分页 if (leftHeight < pageHeight) { doc.addImage(pageData, 'JPEG', 20, 0, imgWidth, imgHeight ); //左右边距20 } else { while(leftHeight > 0) { doc.addImage(pageData, 'JPEG', 20, position, imgWidth, imgHeight) //左右边距20 leftHeight -= pageHeight; position -= 841.89; //避免添加空白页 if(leftHeight > 0) { doc.addPage(); } } }; doc.save('LNB换型事件标准内容.pdf'); }); }; $("#download-doc-pdf").click(function(){ layer.load("PDF生成中……") doc2pdf(); layer.closeAll(); $("#download_div").css("display","none"); }) </script> <script> $("#download-doc-docx").click(function(){ layer.load() $.ajax({ url:'/download_doc_docx/13859/', type:'post', success:function(r){ layer.closeAll() if(r.status){ var downloadLink = $('<a></a>') .attr('href', r.data) downloadLink[0].click(); downloadLink.remove(); }else{ layer.msg(r.data) } }, error:function(){ layer.closeAll() layer.msg("文档导出Docx文件请求异常") } }) }) </script> <script> // 解析文档片段 parseFragment(); </script> <!-- 在线表格文档根据窗口高度调整表格高度 --> <!-- 文集作者或文档作者的JavaScript相关函数 --> <script> // 文档顶部「新建」按钮的下拉菜单 dropdown.render({ elem: '#create-doc-btn', trigger: 'hover', data: [ { title: '文本文档', id: 'text' },{ title: '表格文档', id: 'table' },{ title: '超链接', id: 'link' },{ title:'OnlyOffice', id:'OnlyOffice', },{ title:'思维导图', id:'mindmap', } ], click: function(data, othis){ if(data.id == 'text'){ window.location.href = '/create_doc/?pid=' + pro_id }else if(data.id == 'table'){ window.location.href = '/create_doc/?pid=' + pro_id + '&eid=4' }else if(data.id == 'link'){ window.location.href = '/create_doc/?pid=' + pro_id + '&eid=5' }else if(data.id == 'OnlyOffice'){ window.location.href = '/onlyoffice/create?pid=' + pro_id }else if(data.id == 'mindmap'){ window.location.href = '/create_doc/?pid=' + pro_id + '&eid=9' } } }); // 侦听文集大纲滚动 // document.getElementById("doc-summary").addEventListener('scroll', function(){ // let t = $('.doc-summary').scrollTop(); // 目前监听的是整个body的滚动条距离 // let h = $('.doc-summary').height(); // 文集大纲的高度 // let a = document.getElementById("doc-search-input").offsetTop; // 搜索框至顶部的距离 // // console.log("滚动距离:",t,'div高度:',h,'顶部距离:',a) // if(t == 0){ // // console.log("在可视范围") // $('.project-search-div').removeClass('project-search-active-div') // }else{ // if (a >= t && a < (t + h)) { // // // console.log("在可视范围") // $('.project-search-div').removeClass('project-search-active-div') // } // else{ // // console.log("不在可视范围") // $('.project-search-div').addClass('project-search-active-div') // } // } // }); // 高亮搜索词 setTimeout(function(){ keyLight('doc-content',getQueryVariable("highlight")); scrollIntoKey('doc-content',getQueryVariable("highlight")); },500) document.addEventListener('mouseup', function() { var selection = window.getSelection().toString(); let { x , y } = getSelectionEndPosition(); // console.log(x,y) if (selection) { var range = window.getSelection().getRangeAt(0); var button = document.createElement('button'); button.id = "feedbackBtn"; button.textContent = '我要反馈'; var div = document.createElement('div'); div.appendChild(button); div.style.position = 'absolute'; button.classList.add("layui-btn","layui-btn-normal","layui-btn-xs","layui-btn-radius") div.style.top = y + window.pageYOffset + 'px'; div.style.left = x + window.pageXOffset + 'px'; // div.style.top = range.getBoundingClientRect().top + 30 + window.pageYOffset + 'px'; // div.style.left = range.getBoundingClientRect().right + window.pageXOffset + 'px'; document.body.appendChild(div); // range.commonAncestorContainer.parentNode.appendChild(div); document.addEventListener('mousedown', function(event) { if (event.target === button) { feedbackDialog({'url':document.location.href,'content':selection.toString()}); } else if (!div.contains(event.target)) { div.remove(); } }); } }); feedbackDialog = function(value){ // console.log(value['url'],value['content']) window.open("/feedback/?source="+value['url']+'&content='+value['content']) }; function getSelectionEndPosition() { let x, y; let selection = window.getSelection(); if (selection.rangeCount > 0) { let range = selection.getRangeAt(0); let startNode = range.startContainer; let startOffset = range.startOffset; let endNode = range.endContainer; let endOffset = range.endOffset; let tempRange = document.createRange(); tempRange.setStart(endNode, endOffset); tempRange.collapse(true); let clientRects = tempRange.getClientRects(); if (clientRects.length > 0) { let lastRect = clientRects[clientRects.length - 1]; x = lastRect.right; y = lastRect.bottom; } } return { x, y }; }; </script> <script> const docContainer = document.getElementById('doc-container'); const docSidebar = document.getElementById('doc-container-sidebar'); const docSplitter = document.getElementById('doc-container-splitter'); let isResizing = false; // 从 localStorage 获取上一次保存的宽度 const savedWidth = localStorage.getItem('sidebar-width'); if (savedWidth) { docContainer.style.setProperty('--sidebar-width', savedWidth); docSidebar.style.width = savedWidth; } docSplitter.addEventListener('mousedown', (e) => { isResizing = true; docSplitter.classList.add('active'); document.addEventListener('mousemove', handleMouseMove); document.addEventListener('mouseup', () => { isResizing = false; docSplitter.classList.remove('active'); document.removeEventListener('mousemove', handleMouseMove); }); }); function handleMouseMove(e) { if (isResizing) { const containerRect = docContainer.getBoundingClientRect(); const newSidebarWidth = e.clientX - containerRect.left; // 限制最大宽度 const maxWidth = 800; // 可以根据需要修改 if (newSidebarWidth <= maxWidth) { // 保存当前宽度到 localStorage localStorage.setItem('sidebar-width', `${newSidebarWidth}px`); docContainer.style.setProperty('--sidebar-width', `${newSidebarWidth}px`); docSidebar.style.width = `${newSidebarWidth}px`; } } } </script> <!-- 微信JS-SDK开始 --> <!-- 微信JS-SDK结束 --> </body> </html> 用Python代码将上面的html格式内容转成json格式
11-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值