staticInfo.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. if (!Promise) {
  2. var Promise = require("bluebird");
  3. // Configure
  4. Promise.config({
  5. longStackTraces: true,
  6. warnings: true // note, run node with --trace-warnings to see full stack traces for warnings
  7. })
  8. }
  9. require('../css/staticInfo.less')
  10. require('../css/print.css')
  11. const {
  12. post,
  13. throttle,
  14. imageUrlPrefix,
  15. config,
  16. getUrlArgObject,
  17. openNewWin,
  18. Toast
  19. } = require('./promise.js');
  20. const $ = require("jquery");
  21. const print = require("../js/jQuery.print")
  22. let printing = require('./../images/printing.png');
  23. let printing2 = require('./../images/printing2.png');
  24. let recommend = require('./../images/recommend.png');
  25. let hel = require('./../images/icon-hel.png');
  26. let showName, noticeName, clinicalPathwayName, isclick,top = 0
  27. function myBrowser() {
  28. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  29. var isOpera = userAgent.indexOf("Opera") > -1;
  30. if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  31. return "IE";
  32. }; //判断是否IE浏览器
  33. }
  34. function getInfomation() {
  35. var param = {
  36. "type": getUrlArgObject('type'),
  37. "name": getUrlArgObject('name'),
  38. "position": getUrlArgObject('position'),
  39. "contentTypes": [1, 2, 3],
  40. "mrId": getUrlArgObject('mrId')
  41. };
  42. showName = param.name
  43. $(".tabBox .title").html(showName);
  44. post(config.information, param).then((res) => {
  45. const data = res.data.data
  46. // const data = dataaaa.data
  47. document.title = showName
  48. var str = '';
  49. var anchors = '';
  50. if (!data) {
  51. $(".title").html("暂时没有数据");
  52. $(".anchors").css("display", "none");
  53. return;
  54. }
  55. var detailList = data.details
  56. var scale = data.scale
  57. var staticKnowList = detailList['静态知识']
  58. var noticeInfo = detailList['注意事项']
  59. var clinicalPathwayInfo = detailList['临床路径']
  60. var scaleInfo = data.scale ? data.scale.scaleDetails : ''
  61. var name = data.name
  62. noticeName = data.noticeName || "注意事项"
  63. clinicalPathwayName = data.clinicalPathwayName || "临床路径"
  64. renderTab(detailList, scale)
  65. staticKnowList && renderContent(staticKnowList, 'staticKnowledge')
  66. noticeInfo && renderContent(noticeInfo, 'notice')
  67. clinicalPathwayInfo && renderContent(clinicalPathwayInfo, 'clinicalPathway')
  68. scaleInfo && renderContentscale(scaleInfo, 'scale', name)
  69. $('.content img').bind('contextmenu', function () {
  70. return false
  71. })
  72. })
  73. }
  74. getInfomation();
  75. function renderContent(list, contentWrapClassName) {
  76. for (var i = 0; i < list.length; i++) {
  77. var item = list[i];
  78. item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  79. anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
  80. '">' + item.title + '</a></li><li class="anchor-line"></li>';
  81. str = '<div class="infoBox"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
  82. '">'
  83. /*if (getUrlArgObject('type') == 8) {
  84. str += '【' + item.title + '】'
  85. } else {*/
  86. str += item.title
  87. /*}*/
  88. str += '</h2></div>' +
  89. '<div class="contentWrapper"><pre>' + item.content + '</pre><div></div>';
  90. str = `<div class="infoWrapper">${str}</div>`
  91. $(`.${contentWrapClassName} .infos`).append(str);
  92. $(`.${contentWrapClassName} .anchors ul`).append(anchors);
  93. }
  94. function addScrollEvent() {
  95. var scrollTop = $(`.${contentWrapClassName} .infos`).scrollTop()
  96. var divHeight = 0;
  97. for (var i = 0; i < list.length; i++) {
  98. divHeight = divHeight + parseInt($('#' + contentWrapClassName + i).css('height')) + parseInt($('#' + contentWrapClassName + i).parent().next().css('height')) + 20
  99. if (divHeight > scrollTop) {
  100. var anchor = 2 * i;
  101. $(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
  102. return;
  103. }
  104. }
  105. }
  106. $(`.${contentWrapClassName} .infos`).scroll(throttle(addScrollEvent, 200));
  107. addLinkClickEvent(contentWrapClassName);
  108. adjustHeight();
  109. adjustWidth()
  110. }
  111. function renderContentscale(list, contentWrapClassName, name) {
  112. var pushInfo = []
  113. var textType = []
  114. var constant = 0
  115. $('.scaletitle').html(name);
  116. for (var i = 0; i < list[0].detailList.length; i++) {
  117. var item = list[0].detailList[i];
  118. textType.push(item.textType)
  119. if (item.resultType == 1) {
  120. constant += parseFloat(item.constant)
  121. }
  122. if (item.textType == 11) {
  123. item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  124. str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
  125. '">'
  126. str += item.content
  127. str += '</h2></div>'
  128. str = `<div class="infoWrapper">${str}</div>`
  129. $(`.${contentWrapClassName} .infos .infos-box`).append(str);
  130. for (var j = 0; j < item.subList.length; j++) {
  131. var items = item.subList[j];
  132. for (var k = 0; k < items.detailList.length; k++) {
  133. var it = items.detailList[k];
  134. it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  135. str = '<div class="contentList" data-id="' + it.parentId + '-' + it.groupNum + '"><div class="item-list">';
  136. if (it.selectType == 21) {
  137. str += '<p class="item-title">' + it.content + '</p>'
  138. } else if (it.selectType == 22) {
  139. str += '<p class="item-titles">' + it.content + '</p>'
  140. }
  141. str += '<div class="item-content" data-id="' + it.id + '">'
  142. str += '</div></div></div>'
  143. $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
  144. for (var l = 0; l < it.subList[0].detailList.length; l++) {
  145. var its = it.subList[0].detailList[l];
  146. its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  147. str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
  148. if (it.selectType == 21 && item.resultType == 1) {
  149. str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor)) + '" resultType="' + item.resultType + '"/>'
  150. } else if (it.selectType == 22 && item.resultType == 1) {
  151. str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor)) + '" resultType="' + item.resultType + '"/>'
  152. } else if (it.selectType == 21 && item.resultType == 2) {
  153. str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
  154. } else if (it.selectType == 22 && item.resultType == 2) {
  155. str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
  156. }
  157. str += '<span class="inp">' + its.content + '</span>'
  158. if (item.resultType == 1) {
  159. str += '<span class="num">(' + its.score + ')</span>'
  160. }
  161. str += '</label>'
  162. str += `${its.match == 1 ? `<img class="recommend" src="./../images/recommend.png" />` : ``}</div>`
  163. $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "] .contentList .item-content[data-id=" + its.parentId + "]").append(str);
  164. }
  165. }
  166. }
  167. }
  168. if (item.textType == 12) {
  169. item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  170. str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
  171. '">'
  172. str += item.content
  173. str += '</h2></div>'
  174. str = `<div class="infoWrapper">${str}</div>`
  175. $(`.${contentWrapClassName} .infos .infos-box`).append(str);
  176. for (var j = 0; j < item.subList.length; j++) {
  177. var items = item.subList[j];
  178. for (var k = 0; k < items.detailList.length; k++) {
  179. var it = items.detailList[k];
  180. it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
  181. str = '<div class="contentList" data-id="' + it.parentId + '-' + it.groupNum + '"><div class="item-list">';
  182. str += it.content
  183. str += '<div class="item-content" data-id="' + it.id + '">'
  184. str += '</div></div></div>'
  185. $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
  186. }
  187. }
  188. }
  189. if (item.textType == 13) {
  190. for (var m = 0; m < item.subList[0].detailList[0].subList[0].detailList.length; m++) {
  191. var itl = item.subList[0].detailList[0].subList[0].detailList[m]
  192. let arr = {
  193. content: JSON.parse(itl.content),
  194. result: itl.result,
  195. pushInfo: itl.pushInfo
  196. }
  197. pushInfo.push(arr)
  198. }
  199. }
  200. }
  201. str = '<div class="scalebot">'
  202. str += '<button class="but">结果</button><p class="score"></p>'
  203. str += '</div>'
  204. str += `<div class="result"><div class="result_box"><div class="result_left"><img src="./../images/icon-hel.png" class="hel"/><p id="result_title" class="result_title"></p></div><textarea id="inputs"></textarea></div></div>`
  205. str += `<div class="foot"><div class="foot_box"><div class="printing"><img src="./../images/printing.png" class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
  206. $(`.${contentWrapClassName} .infos .infos-box`).append(str);
  207. function addScrollEvent() {
  208. var scrollTop = $(`.${contentWrapClassName} .infos .infos-box`).scrollTop()
  209. var divHeight = 0;
  210. for (var i = 0; i < list.length; i++) {
  211. divHeight = divHeight + parseInt($('#' + contentWrapClassName + i).css('height')) + parseInt($('#' + contentWrapClassName + i).parent().next().css('height')) + 20
  212. if (divHeight > scrollTop) {
  213. var anchor = 2 * i;
  214. $(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
  215. return;
  216. }
  217. }
  218. }
  219. $(`.${contentWrapClassName} .infos .infos-box`).scroll(throttle(addScrollEvent, 200));
  220. addLinkClickEvent(contentWrapClassName);
  221. adjustHeight();
  222. adjustWidth()
  223. getcheck()
  224. getResult(pushInfo, textType, constant)
  225. copy(name)
  226. getprinting()
  227. }
  228. function getprinting() {
  229. $('.printing').click(function () {
  230. $('.foot').hide()
  231. $('.scalebot').hide()
  232. $('#Print').css({
  233. 'height': 'auto', //高度自动
  234. }).print()
  235. $('.foot').show()
  236. $('.scalebot').show()
  237. $('#Print').css({
  238. 'height': '100%', //高度自动
  239. });
  240. })
  241. }
  242. function getcheck() {
  243. $('input:radio').click(function () {
  244. const domName = $(this).attr('name');
  245. const $radio = $(this);
  246. const id = $(this).parents('.contentList').data("id");
  247. if ($radio.data('waschecked') == true) {
  248. $radio.prop('checked', false);
  249. $("input:radio[name='" + domName + "']").data('waschecked', false);
  250. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
  251. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#666666");
  252. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#333333");
  253. if (isclick) {
  254. getchecks()
  255. $(".score").html('');
  256. $(".result_title").html('');
  257. $(".result").css('display', 'none')
  258. $(".foot").css('display', 'none')
  259. }
  260. } else {
  261. $radio.prop('checked', true);
  262. $("input:radio[name='" + domName + "']").data('waschecked', false);
  263. $radio.data('waschecked', true);
  264. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
  265. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#C7C7C7");
  266. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#C7C7C7");
  267. if (isclick) {
  268. getchecks()
  269. $(".score").html('');
  270. $(".result_title").html('');
  271. $(".result").css('display', 'none')
  272. $(".foot").css('display', 'none')
  273. }
  274. }
  275. });
  276. $('input:checkbox').click(function () {
  277. const domName = $(this).attr('name');
  278. const $radio = $(this);
  279. const id = $(this).parents('.contentList').data("id");
  280. $radio.parents('.contentList').each(function (i) {
  281. if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
  282. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
  283. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#666666");
  284. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#333333");
  285. if (isclick) {
  286. getchecks()
  287. $(".score").html('');
  288. $(".result_title").html('');
  289. $(".result").css('display', 'none')
  290. $(".foot").css('display', 'none')
  291. }
  292. } else {
  293. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
  294. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('label').css("color", "#C7C7C7");
  295. $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.item-titles').css("color", "#C7C7C7");
  296. if (isclick) {
  297. getchecks()
  298. $(".score").html('');
  299. $(".result_title").html('');
  300. $(".result").css('display', 'none')
  301. $(".foot").css('display', 'none')
  302. }
  303. }
  304. })
  305. });
  306. }
  307. $('#Print').on('scroll', function () {
  308. top = $('#Print').scrollTop()
  309. })
  310. function copy(name) {
  311. $(".copy").click(function () {
  312. var texts = document.getElementById("result_title").innerText;
  313. if (texts == '') {
  314. Toast('温馨提示:结果为空,无法复制', 500, 'warn')
  315. return
  316. }
  317. var inputs = document.getElementById("inputs");
  318. inputs.value = name + '结果为:' + texts.substring(3); // 修改文本框的内容(赋值内容)
  319. inputs.select(); // 选中文本
  320. document.execCommand("copy"); // 执行浏览器复制命令
  321. Toast('复制成功', 500, 'success')
  322. })
  323. }
  324. function getchecks() {
  325. $(".contentList").each(function (i) {
  326. if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  327. $(this).find(".item-title").addClass('chColor');
  328. } else {
  329. $(this).find(".item-title").removeClass('chColor');
  330. }
  331. if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  332. $(this).find(".item-titles").addClass('chColor');
  333. } else {
  334. $(this).find(".item-titles").removeClass('chColor');
  335. }
  336. });
  337. }
  338. function getResult(pushInfo, textType, constant) {
  339. $(".but").click(function () {
  340. let arr = [];
  341. let multarr = []
  342. let multname
  343. let num = 0
  344. let result
  345. let key = false
  346. let proposal = ''
  347. let proposals = []
  348. let scrollTop = []
  349. let v
  350. let numType = false
  351. isclick = true
  352. for (var i = 0; i < textType.length; i++) {
  353. if (textType[i] == 13) {
  354. numType = true
  355. }
  356. }
  357. $(".contentList").each(function (i) {
  358. if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  359. $(this).find(".item-title").addClass('chColor');
  360. } else {
  361. $(this).find(".item-title").removeClass('chColor');
  362. }
  363. if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
  364. $(this).find(".item-titles").addClass('chColor');
  365. } else {
  366. $(this).find(".item-titles").removeClass('chColor');
  367. }
  368. scrollTop.push($(this).eq(0).find(".chColor").offset())
  369. });
  370. for (var i = 0; i < scrollTop.length; i++) {
  371. if (scrollTop[i] != undefined) {
  372. v = scrollTop[i]
  373. break
  374. }
  375. }
  376. if (v) {
  377. $(`.scale .infos`).scrollTop(v.top + top-160)
  378. }
  379. if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
  380. $('input[type="radio"]:checked').each(function () {
  381. if ($(this).attr("resultType") == 1) {
  382. num += parseFloat($(this).val())
  383. } else {
  384. arr.push($(this).attr("data_obj"))
  385. proposals.push($(this).attr("proposal"))
  386. }
  387. });
  388. $('input[type="checkbox"]:checkbox:checked').each(function () {
  389. if ($(this).attr("resultType") == 1) {
  390. num += parseFloat($(this).val())
  391. } else {
  392. arr.push($(this).attr("data_obj"))
  393. proposals.push($(this).attr("proposal"))
  394. }
  395. });
  396. num = num + constant
  397. num = parseFloat(num).toFixed(2)
  398. tmp = arr.join(";");
  399. if (pushInfo.length > 0) {
  400. for (var i = 0; i < pushInfo.length; i++) {
  401. if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && !tmp) {
  402. result = pushInfo[i].result + '(' + num + '分' + ')'
  403. if (proposals.join(";")) {
  404. proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
  405. } else {
  406. proposal = pushInfo[i].pushInfo
  407. }
  408. break
  409. } else if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && tmp) {
  410. result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
  411. if (proposals.join(";")) {
  412. proposal = pushInfo[i].pushInfo + ';' + proposals.join(";");
  413. } else {
  414. proposal = pushInfo[i].pushInfo
  415. }
  416. break
  417. } else {
  418. result = tmp
  419. proposal = proposals.join(";");
  420. }
  421. }
  422. } else {
  423. result = tmp
  424. proposal = proposals.join(";");
  425. }
  426. if (result) {
  427. $(".hel").attr({
  428. "title": proposal
  429. });
  430. $(".result_title").html('结果:' + result);
  431. if (num >= 0 && numType) {
  432. $(".score").html('总分:' + num + '分');
  433. }
  434. $(".result").css('display', 'block')
  435. $(".score").css('display', 'block')
  436. $(".copy").css('display', 'block')
  437. $(".foot").css('display', 'block')
  438. } else {
  439. if (num >= 0 && numType) {
  440. $(".score").html('总分:' + num + '分');
  441. }
  442. $(".score").css('display', 'block')
  443. $(".copy").css('display', 'none')
  444. $(".foot").css('display', 'block')
  445. }
  446. } else {
  447. Toast('温馨提示:必填选项不能为空~', 500, 'warn')
  448. }
  449. })
  450. $(".printing").hover(
  451. function () {
  452. $(".slideImg").attr("src", "./../images/printing2.png");
  453. }, function () {
  454. $(".slideImg").attr("src", "./../images/printing.png");
  455. });
  456. }
  457. function addLinkClickEvent(contentWrapClassName) {
  458. $(`.${contentWrapClassName} .anchors li:first`).addClass("active");
  459. $(`.${contentWrapClassName} .anchors li>a`).on("click", function () {
  460. const that = this
  461. setTimeout(function () {
  462. $(`.${contentWrapClassName} .anchors .active`).removeClass('active');
  463. $(that).parent().addClass("active");
  464. }, 20)
  465. });
  466. }
  467. function renderTab(detailList, scale) {
  468. if (detailList['静态知识']) {
  469. $(".tabList").append(`<span class="tab" data-module="staticKnowledge" data-title="` + showName + `">静态知识</span>`)
  470. }
  471. if (detailList['临床路径']) {
  472. $(".tabList").append(`<span class="tab" data-module="clinicalPathway" data-title="` + clinicalPathwayName + `">临床路径</span>`)
  473. //$(".tabBox .title").html(clinicalPathwayName);
  474. }
  475. if (detailList['注意事项']) {
  476. $(".tabList").append(`<span class="tab" data-module="notice" data-title="` + noticeName + `">注意事项</span>`)
  477. //$(".tabBox .title").html(noticeName);
  478. }
  479. if (!!scale && getUrlArgObject('type') == 8) {
  480. $(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
  481. //$(".tabBox .title").html(noticeName);
  482. }
  483. let defaultModuleName
  484. if (getUrlArgObject('page') && getUrlArgObject('page') == 1 && scale && detailList['静态知识']) {
  485. $(".tabList .tab").eq(1).addClass("activeTab")
  486. defaultModuleName = $(".tabList .tab").eq(1).attr("data-module")
  487. } else {
  488. $(".tabList .tab").eq(0).addClass("activeTab")
  489. defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
  490. }
  491. $(`.${defaultModuleName}`).css("display", "block")
  492. bindTabClick()
  493. }
  494. function bindTabClick() {
  495. $(".tabList .tab").on("click", function () {
  496. const moduleName = $(this).attr("data-module")
  497. const display = $(`.${moduleName}`).css("display")
  498. $(".tabBox .title").html($(this).attr('data-title'));
  499. if (display == "none") {
  500. $(".activeTab").removeClass("activeTab")
  501. $(this).addClass("activeTab")
  502. $(".container").css("display", "none")
  503. $(`.${moduleName}`).css("display", "block")
  504. $(`.${moduleName} .infos`).scrollTop(0)
  505. }
  506. })
  507. $("#openWin").on("click", function () {
  508. const type = getUrlArgObject('type');
  509. const name = getUrlArgObject('name');
  510. const position = getUrlArgObject('position');
  511. openNewWin("staticInfo.html?name=" + encodeURIComponent(name) + "&position=" + encodeURIComponent(position) + "&type=" + encodeURIComponent(type));
  512. })
  513. }
  514. function adjustHeight() {
  515. var ht = window.innerHeight || document.documentElement.clientHeight;
  516. $(".content").height(ht - 160 + "px");
  517. $(".content .infos").height(ht - 170 + "px");
  518. $(".content .anchors").height(ht - 217 + "px");
  519. }
  520. function adjustWidth() {
  521. var wt = window.innerWidth || document.documentElement.clientWidth;
  522. $(".titleH2").width(wt - 0.2 * wt - 33 - 200 - 17 - 40 - 15 + 'px')
  523. $(".content .infos").width(wt - 210 - 33 - 17 - 40 - 15 + 'px');
  524. }
  525. $(window).on('resize', function () {
  526. adjustHeight()
  527. adjustWidth()
  528. })
  529. //如果是子窗口,隐藏网页查看按钮
  530. if (window.opener) {
  531. $("#openWin").hide();
  532. }