staticInfo.js 22 KB

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