lockscreen.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. /**
  2. * 创建锁屏组件
  3. * @param {JQuery} target target是jquery包裹的元素
  4. * @param {Object} urlMap { "urlName":"url" }
  5. */
  6. /**
  7. * [LockScreen =锁屏功能对象]
  8. * @param {[Element]} target [锁屏界面面板]
  9. * @param {[Element]} backgroundImage [背景图片]
  10. * @param {[Element]} homeTool [桌面右下角的工具栏]
  11. * @param {[Number]} lockTimeout [自动锁定超时]
  12. * @param {[Object]} urlMap [存放url连接token]
  13. */
  14. function LockScreen(target, backgroundImage, homeTool, lockTimeout, urlMap) {
  15. this.target = target;
  16. this.urlMap = urlMap;
  17. this.homeTool = homeTool;
  18. this.lockTimeout = lockTimeout;
  19. this.backgroundImage = backgroundImage;
  20. this.bindEvent();
  21. this.startClock();
  22. this.showPic();
  23. this.state = LockScreen.STATE_UNLOCK;
  24. this.setupAutoLock(lockTimeout);
  25. this.allztm = false;
  26. this.cwcs = 0;
  27. this._lockScreenElement=null;
  28. }
  29. LockScreen.STATE_UNLOCK = 0;
  30. LockScreen.STATE_LOCK = 1;
  31. LockScreen.prototype.showMsg2 = function(msg) {
  32. var context = this;
  33. if (parent.$("#msgDiv").length == 0){
  34. parent.$("body").append('<span id="msgDiv" class="warningFlashMsg-div warningFlashMsg-down" style="position: absolute;z-index:2;">肥肥6666</span>');
  35. }
  36. var msgLeft = context.target.find(".lock-controll-button").offset().left;
  37. var msgTop = context.target.find(".lock-controll-button").offset().top;
  38. context.target.find(".lock-controll-button").css("margin-left","10px !important")
  39. parent.$("#msgDiv").html(msg);
  40. parent.$("#msgDiv").css({ "left": (msgLeft) + "px", "top": (msgTop-46) + "px" });
  41. setTimeout (function(){
  42. parent.$("#msgDiv").remove();
  43. },3000);
  44. }
  45. LockScreen.prototype.showMsg = function(msg, num, size) {
  46. var context = this;
  47. if (num == 0) {
  48. // parent.$("#msgDiv").html(msg+",剩余"+num+"次机会");
  49. parent.$("#msgDiv").html(msg);
  50. return false;
  51. }
  52. var msgLeft = context.target.find(".login-sca .login-sc[time='" + (size - num + 1) + "']").offset().left;
  53. var msgTop = context.target.find(".login-sca .login-sc[time='" + (size - num + 1) + "']").offset().top;
  54. if (parent.$("#msgDiv").length == 0)
  55. parent.$("body").append('<span id="msgDiv" class="warningFlashMsg-div warningFlashMsg-down" style="position: absolute;z-index:2;">肥肥6666</span>');
  56. parent.$("#msgDiv").html(msg);
  57. // parent.$("#msgDiv").html(msg+",剩余"+num+"次机会");
  58. parent.$("#msgDiv").css({ "left": (msgLeft - 7) + "px", "top": (msgTop - 46) + "px" });
  59. }
  60. LockScreen.prototype.mmandcwts = function(msg, sydlcs, zcs) {
  61. var context = this;
  62. context.target.find(".login-sca").html("");
  63. var kscs = zcs;
  64. var cs = '';
  65. for (let i = 1; i <= kscs; i++) {
  66. if (i <= (zcs - sydlcs)) {
  67. cs = '<span class="login-sc login-used login-used" style="width: 8px;height: 8px;display:block;border-radius: 50%;float: left;margin-right: 5px;" time="' + i + '"></span>';
  68. } else {
  69. cs = '<span class="login-sc login-used login-unused" style="width: 8px;height: 8px;display: block;border-radius: 50%;float: left;margin-right: 5px;" time="' + i + '"></span>';
  70. }
  71. context.target.find(".login-sca").prepend(cs);
  72. }
  73. if (sydlcs == zcs) {
  74. context.target.find(".login-sca").css("visibility", "hidden");
  75. }
  76. if (0 >= sydlcs) {
  77. context.showMsg("密码错误次数过多,帐号已被锁定,请联系管理员!", 0);
  78. return false;
  79. } else {
  80. context.showMsg(msg, sydlcs, zcs);
  81. }
  82. }
  83. LockScreen.prototype.mima = function() {
  84. var context = this;
  85. var showPwd = context.target.find(".login-unlockInput");
  86. context.target.find(".login-eyeIcon").on('click', function() {
  87. if (context.allztm) {
  88. showPwd.attr('type', 'password');
  89. context.allztm = false;
  90. } else {
  91. showPwd.attr('type', 'text');
  92. context.allztm = true;
  93. };
  94. })
  95. }
  96. LockScreen.prototype.lockSession = function() {
  97. var context = this;
  98. this.showPic();
  99. context.allztm = false;
  100. context.isSessionLock = true;
  101. //context.startCheckIsUnlockedByApp();
  102. context.target.find('#lock-msg').html("");
  103. context.target.find('#mm').val("");
  104. context.target.css('z-index', 1);
  105. context.mima();
  106. // context.target.fadeIn();
  107. context.state = LockScreen.STATE_LOCK;
  108. this._lockScreenElement =wd.topWindow.$("body > *").filter(function(){return this.offsetWidth>0;});
  109. this._lockScreenElement.hide();
  110. $(top.document).find('table[align="center"]').fadeOut();
  111. // wd.topWindow.$(".dhtmlx_window_active,.dhtmlx_window_inactive,.wdMaskDiv,.dhx_modal_cover_ifr,.dhx_modal_cover_dv").hide();
  112. $(top.document).find('#background-desktop').css('display', 'block');
  113. $("#lock-screen").css("display","block");
  114. $.ajax({
  115. url: this.urlMap['url8'],
  116. type: 'POST',
  117. success: function (data) {
  118. // console.log(data);
  119. //标记session为锁定状态
  120. // console.log("自动锁屏,服务调用成功。",context.urlMap['url1'])
  121. },
  122. })
  123. }
  124. LockScreen.prototype.setupAutoLock = function() {
  125. if (this.autoLockTask) {
  126. clearTimeout(this.autoLockTask);
  127. }
  128. var context = this;
  129. this.autoLockTask = setTimeout(function(){
  130. console.log("lock session")
  131. context.lockSession();
  132. },this.lockTimeout*1000*60);
  133. //console.log("auto close session")
  134. //console.log(this.lockTimeout.val()*60*1000)
  135. }
  136. LockScreen.prototype.cancelAutoLock = function() {
  137. }
  138. LockScreen.prototype.startCheckIsUnlockedByApp = function() {
  139. var context = this;
  140. context.aaah = wd.c.acquireAppAuthority({
  141. yhm: this.target.find('input[name=zh]').val(),
  142. callback: function(data) {
  143. if (data.code == 0) {
  144. if (data.status == 2) {
  145. context.unlockScreen();
  146. return;
  147. }
  148. }
  149. },
  150. title: '解锁PC系统授权',
  151. content: null,
  152. })
  153. var count = 60; //60s内不能重复触发
  154. var time = context.target.find('.icon-countdownButton')[0];
  155. time.innerHTML = ' ' + count + 's';
  156. time.style.display = 'block';
  157. var _h = setInterval(function() {
  158. if (--count <= 0) {
  159. console.log(count);
  160. clearInterval(_h);
  161. time.innerHTML = '';
  162. time.style.display = 'none';
  163. } else {
  164. time.innerHTML = ' ' + count + 's';
  165. }
  166. }, 1000)
  167. console.log($("#unlockByApp").css("display"),506)
  168. // $.ajax({
  169. // url: this.urlMap['url2'],
  170. // dataType: 'json',
  171. // type: 'POST',
  172. // success: function (data) {
  173. // if (data.code == 0) {
  174. // if (data.status == 2) {
  175. // context.unlockScreen()
  176. // } else if (data.status == 1) {
  177. // alert('移动端拒绝解锁')
  178. // } else if(context.isSessionLock) {
  179. // setTimeout(context.startCheckIsUnlockedByApp.bind(context), 1000);
  180. // }
  181. // }
  182. // },
  183. // });
  184. }
  185. LockScreen.prototype.unlockScreen = function() {
  186. if (!!this.aaah) { //请求定时获取app认证状态得interval
  187. clearInterval(this.aaah);
  188. this.aaah = null;
  189. }
  190. $(top.document).find('#background-desktop').css('display', 'none');
  191. this.state = LockScreen.STATE_LOCK;
  192. this.target.css('z-index', -1);
  193. this.hideInputPanel();
  194. //this.target.fadeOut();
  195. $(top.document).find('table[align="center"]').fadeIn();
  196. this.setupAutoLock(this.lockTimeout);
  197. // if(wd.topWindow.$(".dhtmlx_window_active").length>0)
  198. // wd.topWindow.$(".dhtmlx_window_active,.dhtmlx_window_inactive,.wdMaskDiv,.dhx_modal_cover_ifr,.dhx_modal_cover_dv").show();
  199. if(this._lockScreenElement){
  200. this._lockScreenElement.show();
  201. }
  202. $("#lock-screen").css("display","none");
  203. }
  204. LockScreen.prototype.unlockSessionByPassword = function() {
  205. var context = this;
  206. var mm=this.target.find('#mm').val();
  207. if(!mm){
  208. context.showMsg2("请输入密码");
  209. return;
  210. }
  211. $.ajax({
  212. url: this.urlMap['url3'],
  213. dataType: 'json',
  214. type: 'POST',
  215. data: {
  216. mm: mm,
  217. },
  218. success: function(data) {
  219. // context.target.find('#lock-msg').html(data.msg);
  220. if (data.code == -1) {
  221. context.mmandcwts(data.msg, data.sydlcs, data.zcs);
  222. }
  223. if (data.code == 0) {
  224. context.isSessionLock = false;
  225. context.unlockScreen();
  226. }
  227. },
  228. })
  229. }
  230. LockScreen.prototype.startClock = function() {
  231. var date = new Date();
  232. var dateStr = (date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()) +
  233. ":" +
  234. (date.getMinutes() < 10 ? ("0" + date.getMinutes()) : date.getMinutes());
  235. this.target.find('.home-clock').text(dateStr);
  236. setTimeout(this.startClock.bind(this), (60 - date.getSeconds()) * 1000)
  237. }
  238. LockScreen.prototype.showPic = function() {
  239. var context = this
  240. $.getJSON(this.urlMap['url4'], function(data) {
  241. if (data.code == 0) {
  242. //显示桌面相关部件
  243. context.homeTool.css('display', "block")
  244. context.target.css('display', "block")
  245. // context.backgroundImage.css('display','block')
  246. //设置图片背景
  247. /* 再改,增加 type="img"。Lin
  248. context.backgroundImage.css('background-image', 'url(/service?wdService=dlByHttp&path=' + data.data.filePath + ')'); // ?wdService=getData&。Lin
  249. */ context.backgroundImage.css('background-image', 'url(/service?ssServ=dlByHttp&type=img&path='+ data.data.filePath +')'); // ?wdService=getData&。Lin
  250. context.homeTool.find('#pl-list a').prop('href', "javascript:" + context.urlMap['url6'].replace(/(\/service\?)/, '$1nrid=' + data.data.nrid + "&"))
  251. // 原来的正则/(token=\d+)/
  252. //nrid
  253. context.nrid = data.data.nrid;
  254. //设置信息
  255. var picInfo = context.homeTool.find('#pic-info');
  256. //picInfo.find('#pic-zz-text').text(data.data.zz);
  257. picInfo.find('#pic-zz-text').text("非繁");
  258. //picInfo.find('#pic-fbsj-text').text(data.data.fbsj);
  259. picInfo.find('#pic-fbsj-text').text("2018.10.18");
  260. picInfo.find('#pic-mc-text').text(data.data.mc);
  261. //点赞数据
  262. var dzCount = context.homeTool.find('#dz-count');
  263. if ("dzs" in data.data) {
  264. if (data.data.dzs != null)
  265. dzCount.find('#dz-count-text').text(data.data.dzs);
  266. else
  267. dzCount.find('#dz-count-text').text("0");
  268. } else
  269. dzCount.find('#dz-count-text').text("0");
  270. //是否已点赞
  271. if ("isLike" in data.data && data.data.isLike)
  272. dzCount.find('a').css('background', 'url(/zzfb_/theme/EasyUses/image/icon_like_alt_red.png)');
  273. //显示评论
  274. context.showNrtz(context.urlMap['url5'] + '&nrid=' + data.data.nrid);
  275. } else {
  276. // context.homeTool.css('display',"block")
  277. context.target.css('display', "block")
  278. context.backgroundImage.css('display', 'block')
  279. }
  280. })
  281. }
  282. LockScreen.prototype.unlockSessionByVoice = function() {
  283. }
  284. LockScreen.prototype.stopPic = function(index, picList) {
  285. if (this.picPlayHandle) {
  286. clearTimeout(this.picPlayHandle)
  287. }
  288. }
  289. LockScreen.prototype.showNrtz = function(url, currentPageNo = 1, rowCountPerPage = 5) {
  290. var context = this;
  291. $.getJSON(url + "&currentPageNo=" + currentPageNo + "&rowCountPerPage=" + rowCountPerPage, function(data) {
  292. var plList = context.homeTool.find('.pl-list');
  293. plList.html("");
  294. for (var i = 0; i < data.data.length; i++) {
  295. var temp = '<div class="pl-item">' +
  296. '<div class="pl-item-header clearfix">' +
  297. '<span class="pl-item-xm">' + data.data[i].xm + '</span>' +
  298. '<span class="pl-item-fbsj">' + data.data[i].fbsj + '</span>' +
  299. '</div>' +
  300. '<div class="pl-item-content">' +
  301. '<span>' + data.data[i].bt + '</span>' +
  302. '</div>' +
  303. '</div>';
  304. plList.append(temp)
  305. }
  306. //设置分页
  307. context.showNrtzPage(url, data.page)
  308. })
  309. }
  310. // LockScreen.prototype.showNrtz = function(url,page){
  311. // var plPage = this.target.find('#pl-page');
  312. // plPage.html("");
  313. // if(page.currentPageNo <= 1){
  314. // plPage.append('<a >&laquo;</a>')
  315. // }else{
  316. // var a = $('<a href="#'+(page.currentPageNo-1)+'">&laquo;</a>');
  317. // a.click(function(){
  318. // var pageNo = $(this).attr('href').substring(1)
  319. // showNrtz(url,pageNo);
  320. // })
  321. // plPage.append(a)
  322. // }
  323. // var pageCount = parseInt((page.rowCount-1)/page.rowCountPerPage)+1;
  324. // var maxPageNum = 5;
  325. // var startPageNo = Math.max(1,parseInt(page.currentPageNo-maxPageNum/2));
  326. // var endPageNo = Math.min(startPageNo+maxPageNum,parseInt((page.rowCount-1)/page.rowCountPerPage)+1);
  327. // for(var i = startPageNo; i <= endPageNo ; i ++ ){
  328. // if(i == page.currentPageNo){
  329. // plPage.append('<a>'+i+'</a>');
  330. // }else{
  331. // var a = $('<a href="#'+i+'">'+i+'</a>');
  332. // a.click(function(){
  333. // var pageNo = $(this).attr('href').substring(1)
  334. // showNrtz(url,pageNo);
  335. // })
  336. // plPage.append(a);
  337. // }
  338. // }
  339. // if(page.currentPageNo < pageCount){
  340. // var a = $('<a href="#'+(page.currentPageNo+1)+'">&raquo;</a>');
  341. // a.click(function(){
  342. // var pageNo = $(this).attr('href').substring(1)
  343. // showNrtz(url,pageNo);
  344. // })
  345. // plPage.append(a)
  346. // }else{
  347. // plPage.append('<a>&raquo;</a>')
  348. // }
  349. // }
  350. LockScreen.prototype.showNrtzPage = function(url, page) {
  351. var context = this;
  352. var plPage = this.homeTool.find('#pl-page');
  353. plPage.html("");
  354. if (page.currentPageNo <= 1) {
  355. plPage.append('<a >&laquo;</a>')
  356. } else {
  357. var a = $('<a href="#' + (page.currentPageNo - 1) + '">&laquo;</a>');
  358. a.click(function() {
  359. var pageNo = $(this).attr('href').substring(1)
  360. context.showNrtz(url, pageNo);
  361. })
  362. plPage.append(a)
  363. }
  364. var pageCount = parseInt((page.rowCount - 1) / page.rowCountPerPage) + 1;
  365. var maxPageNum = 5;
  366. var startPageNo = Math.max(1, parseInt(page.currentPageNo - maxPageNum / 2));
  367. var endPageNo = Math.min(startPageNo + maxPageNum, parseInt((page.rowCount - 1) / page.rowCountPerPage) + 1);
  368. for (var i = startPageNo; i <= endPageNo; i++) {
  369. if (i == page.currentPageNo) {
  370. plPage.append('<a>' + i + '</a>');
  371. } else {
  372. var a = $('<a href="#' + i + '">' + i + '</a>');
  373. a.click(function() {
  374. var pageNo = $(this).attr('href').substring(1)
  375. context.showNrtz(url, pageNo);
  376. })
  377. plPage.append(a);
  378. }
  379. }
  380. if (page.currentPageNo < pageCount) {
  381. var a = $('<a href="#' + (page.currentPageNo + 1) + '">&raquo;</a>');
  382. a.click(function() {
  383. var pageNo = $(this).attr('href').substring(1)
  384. context.showNrtz(url, pageNo);
  385. })
  386. plPage.append(a)
  387. } else {
  388. plPage.append('<a>&raquo;</a>')
  389. }
  390. }
  391. LockScreen.prototype.showInputPanel = function() {
  392. //this.target.find('#lock-screen').fadeIn();
  393. var display=this.target.find(".lock-controll-panel")["0"].style.display;
  394. if(display=="none"||display==""||!display){
  395. this.target.find(".lock-controll-panel").fadeIn();
  396. parent.$("#msgDiv").fadeIn();
  397. }else{
  398. this.target.find(".lock-controll-panel").fadeOut();
  399. parent.$("#msgDiv").fadeOut();
  400. }
  401. //判断不同系统中摇一摇的显示或隐藏
  402. if($("#unlockByApp").css("display")=="none"){
  403. $("#unlockByPassword").css("margin-left", "46px");
  404. $("#mm").attr("style", "background:none !important;width:217px !important;");
  405. $(".ksmm").css("right","-50px");
  406. }
  407. }
  408. LockScreen.prototype.hideInputPanel = function() {
  409. // this.target.find('#lock-screen').fadeOut();
  410. this.target.find(".lock-controll-panel").fadeOut();
  411. parent.$("#msgDiv").fadeOut();
  412. }
  413. LockScreen.prototype.bindEvent = function() {
  414. var context = this;
  415. this.target.on('click', function(event) {
  416. if (event.target == this) {
  417. //$(this).fadeOut();
  418. clearTimeout(context.autoCloseLockScreen);
  419. }
  420. });
  421. this.target.find('.lock-controll-panel').on('mousemove', function() {
  422. if (new Date().getTime() - context.lastSetACLSTime > 2000) { //距上次设置定时关闭器时的间隔大于2s,重新设置自动关闭器
  423. console.log('滑动触发打开输入')
  424. //自动关闭定时器
  425. clearTimeout(context.autoCloseLockScreen);
  426. context.autoCloseLockScreen = setTimeout(function() {
  427. console.log('滑动触发打开输入:关闭')
  428. context.hideInputPanel();
  429. context.autoCloseLockScreen = null;
  430. }, 60000);
  431. context.lastSetACLSTime = new Date().getTime();
  432. }
  433. })
  434. this.target.find('#lock-screen').on('click', function(event) {
  435. if (event.target != this || context.state == LockScreen.STATE_UNLOCK) { //如果事件的目标不是target对象,则不处理
  436. return;
  437. }
  438. clearTimeout(context.autoCloseLockScreen);
  439. var ls = context.target.find('#lock-screen');
  440. context.showInputPanel();
  441. console.log('点击背景打开输入')
  442. //自动关闭定时器
  443. context.autoCloseLockScreen = setTimeout(function() {
  444. console.log('点击背景打开输入:关闭')
  445. context.hideInputPanel();
  446. context.autoCloseLockScreen = null;
  447. }, 60000);
  448. context.lastSetACLSTime = new Date().getTime();
  449. });
  450. this.target.find('#unlockByPassword').click(this.unlockSessionByPassword.bind(this));
  451. this.target.find('.lock-controll-panel').on("keydown", function(event) {
  452. if (event.keyCode == 13) {
  453. var mm=context.target.find('#mm').val();
  454. if(!mm){
  455. context.showMsg2("请输入密码");
  456. return;
  457. }
  458. $.ajax({
  459. url: context.urlMap['url3'],
  460. dataType: 'json',
  461. type: 'POST',
  462. data: {
  463. mm: mm,
  464. },
  465. success: function(data) {
  466. // context.target.find('#lock-msg').html(data.msg);
  467. if (data.code == -1) {
  468. context.mmandcwts(data.msg, data.sydlcs, data.zcs);
  469. }
  470. if (data.code == 0) {
  471. context.isSessionLock = false;
  472. context.unlockScreen();
  473. }
  474. },
  475. })
  476. }
  477. })
  478. this.target.find('#unlockByApp').click(this.startCheckIsUnlockedByApp.bind(this));
  479. this.target.find('#backToHomepage').click(wd.display.exit);
  480. // 点赞
  481. context.homeTool.find('#dz-count').find('a').on('click', function() {
  482. $.ajax({
  483. url: context.urlMap['url7'],
  484. data: {
  485. 'nrid': context.nrid
  486. },
  487. dataType: 'json',
  488. type: 'GET',
  489. success: function(data) {
  490. //根据情况,修改img样式
  491. var result = data;
  492. if (result.result) { //true
  493. //isLike 确认是否为已赞
  494. if (result.isLike) {
  495. //修改样式
  496. context.homeTool.find('#dz-count').find('a').css('background', 'url(/zzfb_/theme/EasyUses/image/icon_like_alt_red.png)');
  497. } else {
  498. //修改样式
  499. context.homeTool.find('#dz-count').find('a').css('background', 'url(/zzfb_/theme/EasyUses/image/icon_like_alt.png)');
  500. }
  501. context.homeTool.find('#dz-count').find('#dz-count-text').text(result.dzs);
  502. } else { //false
  503. console.log('点赞失败');
  504. }
  505. }
  506. });
  507. });
  508. // this.target.find('#pic-info').on('mouseover',function(){
  509. // $(this).find('.pic-info').css('display','block');
  510. // }).on('mouseout',function(){
  511. // $(this).find('.pic-info').css('display','none');
  512. // });
  513. // this.target.find('#dz-count').on('mouseover',function(){
  514. // $(this).find('.dz-count').css('display','block');
  515. // }).on('mouseout',function(){
  516. // $(this).find('.dz-count').css('display','none');
  517. // });
  518. // this.target.find('#pl-list').on('mouseover',function(){
  519. // $(this).find('.pl-list-container').css('display','block');
  520. // }).on('mouseout',function(){
  521. // $(this).find('.pl-list-container').css('display','none');
  522. // })
  523. }
  524. // function lockSession() {
  525. // $.ajax({
  526. // url: '/service?wdApplication=wd&wdService=lockSession',
  527. // dataType: 'json',
  528. // type: 'GET',
  529. // success: function (data) {
  530. // //标记session为锁定状态
  531. // top.isSessionLock = true;
  532. // startCheckIsUnlockedByApp();
  533. // top.document.querySelector('.lock-screen').style.display="block"
  534. // top.document.querySelector('table[align="center"]').style.display='none'//隐藏桌面
  535. // top.document.querySelector('#lock-msg').innerHTML = "";
  536. // top.document.querySelector('#mm').value="";
  537. // },
  538. // })
  539. // }
  540. // function startCheckIsUnlockedByApp() {
  541. // $.ajax({
  542. // url: '/service?wdApplication=wd&wdService=checkIsUnlockedByApp',
  543. // dataType: 'json',
  544. // type: 'POST',
  545. // success: function (data) {
  546. // console.log(data);
  547. // if (data.code == 0) {
  548. // if (data.status == 2) {
  549. // unlockScreen()
  550. // } else if (data.status == 1) {
  551. // alert('移动端拒绝解锁')
  552. // } else if(top.isSessionLock) {
  553. // setTimeout(startCheckIsUnlockedByApp, 1000);
  554. // }
  555. // }
  556. // },
  557. // })
  558. // }
  559. // function unlockScreen(){
  560. // top.document.querySelector('#lock-screen').style.display="none"
  561. // top.document.querySelector('table[align="center"]').style.display="block"
  562. // }
  563. // function unlockSessionByPassword() {
  564. // $.ajax({
  565. // url: '/service?wdApplication=wd&wdService=unlockSessionByPassword',
  566. // dataType: 'json',
  567. // type: 'POST',
  568. // data: {
  569. // mm: top.document.querySelector('#mm').value
  570. // },
  571. // success: function (data) {
  572. // top.document.querySelector('#lock-msg').innerHTML = data.msg;
  573. // if (data.code == 0) {
  574. // top.isSessionLock= false;
  575. // unlockScreen();
  576. // }
  577. // },
  578. // })
  579. // }
  580. // function unlockSessionByVoice() {
  581. // }
  582. // function startClock() {
  583. // var date = new Date();
  584. // var dateStr = (date.getHours() < 10 ? ("0" + date.getHours()) : date.getHours()) +
  585. // ":" +
  586. // (date.getMinutes() < 10 ? ("0" + date.getMinutes()) : date.getMinutes());
  587. // top.document.querySelector('.home-clock').innerHTML = dateStr;
  588. // setTimeout(startClock, 60 - date.getSeconds())
  589. // }
  590. // function showPic(){
  591. // $.getJSON('/service?wdApplication=nr&wdService=getSjtp',function(data){
  592. // if(data.code == 0){
  593. // //设置图片背景
  594. // $(top.document).find('.home-background').css('background-image','url(/service?wdApplication=nr&wdService=getData&path='+data.data.filePath+')');
  595. // //设置信息
  596. // var picInfo = $(top.document).find('#pic-info');
  597. // picInfo.find('#pic-zz-text').text(data.data.zz);
  598. // picInfo.find('#pic-fbsj-text').text(data.data.fbsj);
  599. // picInfo.find('#pic-mc-text').text(data.data.bt);
  600. // //点赞数据
  601. // var dzCount = $(top.document).find('#dz-count');
  602. // dzCount.find('#dz-count-text').text(data.data.dzs);
  603. // //显示评论
  604. // showNrtz('/service?wdApplication=nr&wdService=nr_ck_pl_cx_ajax&nrid='+data.data.nrid);
  605. // }
  606. // })
  607. // }
  608. // function playPic(index,picList){
  609. // if(picList && picList.length > 0){
  610. // $(top.document).find('.home-background').css('background-image','url('+picList[index].url+')');
  611. // //设置信息
  612. // var picInfo = $(top.document).find('#pic-info');
  613. // picInfo.find('#pic-zz-text').text(picList[index].zz);
  614. // picInfo.find('#pic-fbsj-text').text(picList[index].fbsj);
  615. // picInfo.find('#pic-mc-text').text(picList[index].bt);
  616. // //点赞数据
  617. // var dzCount = $(top.document).find('#dz-count');
  618. // dzCount.find('#dz-count-text').text(picList[index].dzs);
  619. // index ++;
  620. // if(index >= picList.length){
  621. // index = 0;
  622. // }
  623. // if(picList.length > 0){
  624. // top.picPlayHandle = setTimeout(function() {
  625. // playPic(index,picList);
  626. // }, 30000);
  627. // }
  628. // }
  629. // }
  630. // function stopPic(index,picList){
  631. // if( top.picPlayHandle ){
  632. // clearTimeout( top.picPlayHandle )
  633. // }
  634. // }
  635. // function showNrtz(url,currentPageNo=1,rowCountPerPage=5){
  636. // $.getJSON(url+"&currentPageNo="+currentPageNo+"&rowCountPerPage="+rowCountPerPage,function(data){
  637. // var plList = $(top.document).find('.pl-list');
  638. // plList.html("");
  639. // for(var i = 0; i < data.data.length ;i++){
  640. // var temp = '<div class="pl-item">'+
  641. // '<div class="pl-item-header clearfix">'+
  642. // '<span class="pl-item-xm">'+data.data[i].xm+'</span>'+
  643. // '<span class="pl-item-fbsj">'+data.data[i].fbsj+'</span>'+
  644. // '</div>'+
  645. // '<div class="pl-item-content">'+
  646. // '<span>'+data.data[i].bt+'</span>'+
  647. // '</div>'+
  648. // '</div>';
  649. // plList.append(temp)
  650. // }
  651. // //设置分页
  652. // showNrtzPage(url,data.page)
  653. // })
  654. // }
  655. // function showNrtzPage(url,page){
  656. // var plPage = $(top.document).find('#pl-page');
  657. // plPage.html("");
  658. // if(page.currentPageNo <= 1){
  659. // plPage.append('<a >&laquo;</a>')
  660. // }else{
  661. // var a = $('<a href="#'+(page.currentPageNo-1)+'">&laquo;</a>');
  662. // a.click(function(){
  663. // var pageNo = $(this).attr('href').substring(1)
  664. // showNrtz(url,pageNo);
  665. // })
  666. // plPage.append(a)
  667. // }
  668. // var pageCount = parseInt((page.rowCount-1)/page.rowCountPerPage)+1;
  669. // var maxPageNum = 5;
  670. // var startPageNo = Math.max(1,parseInt(page.currentPageNo-maxPageNum/2));
  671. // var endPageNo = Math.min(startPageNo+maxPageNum,parseInt((page.rowCount-1)/page.rowCountPerPage)+1);
  672. // for(var i = startPageNo; i <= endPageNo ; i ++ ){
  673. // if(i == page.currentPageNo){
  674. // plPage.append('<a>'+i+'</a>');
  675. // }else{
  676. // var a = $('<a href="#'+i+'">'+i+'</a>');
  677. // a.click(function(){
  678. // var pageNo = $(this).attr('href').substring(1)
  679. // showNrtz(url,pageNo);
  680. // })
  681. // plPage.append(a);
  682. // }
  683. // }
  684. // if(page.currentPageNo < pageCount){
  685. // var a = $('<a href="#'+(page.currentPageNo+1)+'">&raquo;</a>');
  686. // a.click(function(){
  687. // var pageNo = $(this).attr('href').substring(1)
  688. // showNrtz(url,pageNo);
  689. // })
  690. // plPage.append(a)
  691. // }else{
  692. // plPage.append('<a>&raquo;</a>')
  693. // }
  694. // }
  695. // function bindEvent(){
  696. // top.document.querySelector('#unlockByPassword').addEventListener('click',unlockSessionByPassword);
  697. // $(top.document).find('#pic-info').on('mouseover',function(){
  698. // $(this).find('.pic-info').css('display','block');
  699. // }).on('mouseout',function(){
  700. // $(this).find('.pic-info').css('display','none');
  701. // });
  702. // $(top.document).find('#dz-count').on('mouseover',function(){
  703. // $(this).find('.dz-count').css('display','block');
  704. // }).on('mouseout',function(){
  705. // $(this).find('.dz-count').css('display','none');
  706. // });
  707. // $(top.document).find('#pl-list').on('mouseover',function(){
  708. // $(this).find('.pl-list-container').css('display','block');
  709. // }).on('mouseout',function(){
  710. // $(this).find('.pl-list-container').css('display','none');
  711. // })
  712. // }