home.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="format-detection" content="telephone=no"/>
  6. <meta name="format-detection" content="email=no"/>
  7. <title>home</title>
  8. <link rel="stylesheet" href="../css/reset.css">
  9. <link rel="stylesheet" href="../css/style.css">
  10. <script src="../script/flexible.js"></script>
  11. <style>
  12. html,body{
  13. height: 100%;
  14. }
  15. .homeHead{
  16. width: 100%;
  17. height: 5.1rem;
  18. position: relative;
  19. }
  20. .HBgImg{
  21. width: 100%;
  22. height: 100%;
  23. position: absolute;
  24. top: 0;
  25. left: 0;
  26. z-index: -1;
  27. }
  28. .taskRemindDiv{
  29. width: 4rem;
  30. height: 4rem;
  31. margin: 0 auto;
  32. position: relative;
  33. }
  34. .homeHead img{
  35. display: inline-block;
  36. width: 100%;
  37. height: 100%;
  38. }
  39. #taskN{
  40. font-size: 1.54rem;
  41. color: #ff6e6e;
  42. font-family: "Arial";
  43. position: absolute;
  44. left: 49%;
  45. top: 45%;
  46. -webkit-transform: translate(-50%,-50%);
  47. }
  48. .home{
  49. width: 100%;
  50. /*background: url("../image/BG.jpg") no-repeat 100%/100%;*/
  51. /*padding-top: 1rem;*/
  52. position: relative;
  53. }
  54. .mainWarp{
  55. width: 90%;
  56. margin: 0 auto;
  57. }
  58. .mainWarp ul{
  59. padding-bottom: .48rem;
  60. }
  61. .mainWarp ul li{
  62. width: 25%;
  63. font-size: .42rem;
  64. float: left;
  65. padding-top: .2rem;
  66. }
  67. .mainWarp ul li:nth-of-type(2n+1){
  68. margin-left: 0;
  69. }
  70. .mainWarp ul li:nth-of-type(7),.mainWarp ul li:nth-of-type(8){
  71. margin-bottom: 0;
  72. }
  73. .mainWarp ul li div{
  74. width: 100%;
  75. height: 100%;
  76. /*background-color: #096a6c;*/
  77. /*border-radius: .3rem;*/
  78. /*padding-top: .5rem;*/
  79. position: relative;
  80. }
  81. .mainWarp ul li span{
  82. display: block;
  83. width: 1.63rem;
  84. height: 1.63rem;
  85. margin: 0 auto;
  86. }
  87. .navTit{
  88. font-size: .35rem;
  89. color: #616161;
  90. text-align: center;
  91. }
  92. .remindMes{
  93. width: .5rem;
  94. height: .5rem;
  95. line-height: .5rem;
  96. text-align: center;
  97. font-size: .3rem;
  98. color: #fff;
  99. border-radius: 50%;
  100. background-color: #ed1c24;
  101. position: absolute;
  102. right: .35rem;
  103. top: .18rem;
  104. display: none;
  105. }
  106. .remindMes.active{
  107. display: block;
  108. }
  109. .taskTitle{
  110. height: .9rem;
  111. line-height: .9rem;
  112. font-size: .35rem;
  113. color: #898989;
  114. padding-left: .2rem;
  115. background-color: #ececec;
  116. }
  117. .noTask{
  118. height: 1.46rem;
  119. line-height: 1.46rem;
  120. text-align: center;
  121. color: #898989;
  122. font-size: .35rem;
  123. background-color: #fff;
  124. margin-top: .26rem;
  125. }
  126. .task_con {
  127. overflow: auto;
  128. }
  129. .task_con ul{
  130. display: none;
  131. }
  132. .task_con li {
  133. height: 2.83rem;
  134. margin-bottom: .15rem;
  135. background-color: #fff;
  136. position: relative;
  137. overflow: hidden;
  138. }
  139. .task_con li>div {
  140. display: inline-block;
  141. }
  142. .task_status {
  143. height: 100%;
  144. font-size: .38rem;
  145. text-align: center;
  146. white-space: pre-wrap;
  147. color: #fff;
  148. position: relative;
  149. opacity: 0;
  150. }
  151. .task_status_1{
  152. background-color: #f26522;
  153. }
  154. .task_status_2{
  155. background-color: #22ac38;
  156. }
  157. .task_status_3{
  158. background-color: #a0a0a0;
  159. }
  160. .task_status_4{
  161. background-color: #f39700;
  162. }
  163. .task_status span {
  164. display: inline-block;
  165. width: .2rem;
  166. position: absolute;
  167. top: 50%;
  168. left: calc(50% - .1rem);
  169. -webkit-transform: translateY(-50%);
  170. transform: translateY(-50%);
  171. }
  172. .task_taskCon {
  173. max-width: calc(100% - 1.1rem);
  174. padding: .2rem 0 0 .2rem ;
  175. }
  176. .task_taskCon p {
  177. margin-bottom: .1rem;
  178. height: .5rem;
  179. color: #3d3d3d;
  180. font-size: .38rem;
  181. white-space: nowrap;
  182. }
  183. .task_name{
  184. display: inline-block;
  185. max-width: 6.1rem;
  186. font-size: .5rem;
  187. overflow: hidden;
  188. text-overflow: ellipsis;
  189. white-space: nowrap;
  190. vertical-align: middle;
  191. }
  192. .task_taskCon p:first-of-type{
  193. height: .6rem;
  194. position: relative;
  195. }
  196. .task_taskCon p:nth-of-type(n+2){
  197. width: 8rem;
  198. color: #898989;
  199. overflow: hidden;
  200. text-overflow: ellipsis;
  201. white-space: nowrap;
  202. }
  203. .icon_1{
  204. width: .3rem;
  205. height: .3rem;
  206. background: url("../image/task_icon_1.png") no-repeat 100% 110%/100%;
  207. margin-right: .1rem;
  208. }
  209. .icon_2{
  210. width: .3rem;
  211. height: .3rem;
  212. background: url("../image/task_icon_2.png") no-repeat 50% 140%/80%;
  213. margin-right: .1rem;
  214. }
  215. .task_taskCon p:last-of-type{
  216. width: 100%;
  217. overflow: visible;
  218. }
  219. .task_taskCon p:nth-of-type(3) {
  220. margin-bottom: .11rem;
  221. }
  222. .task_dbqk {
  223. display: inline-block;
  224. font-size: .3rem;
  225. padding: 0 .1rem;
  226. border-radius: .03rem;
  227. color: #fff;
  228. margin-left: .26rem;
  229. white-space: nowrap;
  230. }
  231. .task_dbqk1{
  232. background-color: #f39700;
  233. }
  234. .task_dbqk2{
  235. background-color: #ff0000;
  236. }
  237. .task_dbqk3{
  238. background-color: #bbbc5f;
  239. }
  240. .task_dbqk4{
  241. background-color: #e60012;
  242. }
  243. .task_dbqk5{
  244. background-color: #cacbbb;
  245. }
  246. .task_pssj,
  247. .task_wcsj {
  248. display: inline-block;
  249. height: .4rem;
  250. line-height: .4rem;
  251. font-size: .3rem;
  252. padding: 0 .18rem;
  253. border-radius: .03rem;
  254. }
  255. .task_pssj {
  256. border: 1px solid #3aca74;
  257. color: #3aca74;
  258. margin-right: .2rem;
  259. }
  260. .task_wcsj {
  261. border: 1px solid #fd9b53;
  262. color: #fd9b53;
  263. }
  264. .task_jt {
  265. position: absolute;
  266. top:0;
  267. right: 0;
  268. height: 100%;
  269. line-height: 2.6rem;
  270. font-size: .5rem;
  271. color: #b5b5b5;
  272. padding: 0 .18rem;
  273. }
  274. .nomore_tit{
  275. width: 60%;
  276. border-top: 1px solid #e0e0e0;
  277. margin: .2rem auto;
  278. }
  279. .nomore_txt{
  280. font-size: .4rem;
  281. color: #b0b0b0;
  282. text-align: center;
  283. padding: 0 .1rem;
  284. }
  285. .hid{
  286. display: none;
  287. }
  288. </style>
  289. </head>
  290. <body>
  291. <div class="homeHead">
  292. <div class="HBgImg"><img src="../image/home_head.jpg" alt=""></div>
  293. <div class="taskRemindDiv">
  294. <img src="../image/home_head.png" alt="">
  295. <i id="taskN"></i>
  296. <p id="isHas"></p>
  297. </div>
  298. </div>
  299. <div class="home">
  300. <div class="mainWarp">
  301. <ul class="clearFix">
  302. <li><div><span><img src="../image/icon_alltask.png" alt=""></span><p class="navTit">检修任务</p><i class="remindMes" id="taskNum">0</i></div></li>
  303. <li><div><span><img src="../image/icon_remind.png" alt=""></span><p class="navTit">巡查任务</p><i class="remindMes" id="xcNum">0</i></div></li>
  304. <li><div><span><img src="../image/icon_mes.png" alt=""></span><p class="navTit">协助任务</p><i class="remindMes">0</i></div></li>
  305. <li><div><span><img src="../image/icon_underway.png" alt=""></span><p class="navTit">历史任务</p><i class="remindMes">0</i></div></li>
  306. <li><div><span><img src="../image/icon_vcard.png" alt=""></span><p class="navTit">我的审核</p><i class="remindMes" id="shNum">0</i></div></li>
  307. <li><div><span><img src="../image/icon_temporary.png" alt=""></span><p class="navTit">我的管区</p><i class="remindMes">0</i></div></li>
  308. <li><div><span><img src="../image/icon_finish.png" alt=""></span><p class="navTit">发起任务</p><i class="remindMes" id="mesNum">0</i></div></li>
  309. <li><div><span><img src="../image/icon_overdue.png" alt=""></span><p class="navTit">警告异常</p><i class="remindMes" id="warning">0</i></div></li>
  310. </ul>
  311. </div>
  312. <div class="maxZIndex"></div>
  313. </div>
  314. <div class="taskTitle hid">待处理任务</div>
  315. <div class="noTask hid">无检修任务</div>
  316. <div class="flex-con task_con">
  317. <ul>
  318. <li class="flex-wrap" data-taskid="{{taskID}}" data-lon="{{lon}}" data-lat="{{lat}}">
  319. <div class="task_status {{taskstatus}}" data-taskstatus="0"><span>{{status}}</span></div>
  320. <div class="task_taskCon flex-con">
  321. <p><span class="task_name">{{name}}</span><span class="task_dbqk {{statusclass}}">{{type}}</span></p>
  322. <p><i class="icon_1"></i>检修内容:<span class="task_duty">{{duty}}</span></p>
  323. <p><i class="icon_2"></i>地址:<span class="task_dw">{{enterprise}}</span></p>
  324. <p><span class="task_pssj">申请日期:{{pssj}}</span><span class="task_wcsj">计划开始:{{jhks}}</span></p>
  325. </div>
  326. <div class="task_jt">〉</div>
  327. </li>
  328. </ul>
  329. </div>
  330. <div class="nomore hid">
  331. <fieldset class="nomore_tit">
  332. <legend align="center" class="nomore_txt">已经没有更多了</legend>
  333. </fieldset>
  334. </div>
  335. <script src="../script/publicData.js"></script>
  336. <script src="../script/jqueryMin.js"></script>
  337. <script type="text/javascript" src="../script/api.js"></script>
  338. <script type="text/javascript">
  339. var ad=["3"],ld=["1","3","5"];
  340. var duty,page=1;
  341. var ulModel=$(".task_con ul").html();
  342. apiready = function(){
  343. var warp=$api.dom(".mainWarp");
  344. var warpLi=$api.domAll(warp,"li");
  345. for(var i=0,len=warpLi.length;i<len;i++){
  346. !function (i) {
  347. warpLi[i].onclick=function () {
  348. openFrame(i);
  349. $api.rmStorage("dep");
  350. }
  351. }(i)
  352. }
  353. function openFrame(i) {
  354. var jsfun=null;
  355. switch (i){
  356. case 0:jsfun = 'toFrame(1);';break;
  357. case 1:jsfun = 'toFrame(15);';break;
  358. case 3:
  359. api.openFrame({
  360. name: 'homePopups',
  361. url: './homePopups.html',
  362. rect: {
  363. x: 0,
  364. y: 0,
  365. w: api.winWidth,
  366. h: api.winHeight
  367. },
  368. bounces: false
  369. });
  370. return;
  371. case 7:jsfun = 'toFrame(2);';break;
  372. case 5:jsfun = 'toWindow("districtMap");';break;
  373. case 2:jsfun = 'toFrame(17);';break;
  374. case 6:
  375. api.openWin({
  376. name: 'allBDG',
  377. url: './allTask.html',
  378. animation: {
  379. type: 'push',
  380. subType: 'from_right',
  381. duration: 300
  382. },
  383. delay:300
  384. });break;
  385. case 4:jsfun = 'toFrame(13)';break;
  386. }
  387. api.execScript({
  388. script: jsfun
  389. });
  390. }
  391. if(api.systemType=="ios"){
  392. $(".task_taskCon p").css("margin-bottom",".1rem")
  393. }
  394. if(!$api.getStorage("task_frame1Data")){
  395. api.showProgress({
  396. title: '努力加载中...',
  397. text: '请稍等...',
  398. modal: false
  399. });
  400. }
  401. api.addEventListener({
  402. name:'scrolltobottom',
  403. extra:{
  404. threshold:0 //设置距离底部多少距离时触发,默认值为0,数字类型
  405. }
  406. }, function(ret, err){
  407. if(!$(".nomore").hasClass("hid")){
  408. return;
  409. }else {
  410. if($api.getStorage("taskpage")<=1) return;
  411. api.toast({
  412. msg: '正在加载更多',
  413. duration: 2000,
  414. location: 'bottom'
  415. });
  416. }
  417. api.ajax({
  418. url: pageUrl+"/index/task/index",
  419. method: 'get',
  420. timeout: 30,
  421. dataType: 'text',
  422. returnAll: false,
  423. data: {
  424. values: {user_id:$api.getStorage("user").id, page:page, status:0, type:2}
  425. }
  426. }, function (data, err) {
  427. data=JSON.parse(data)
  428. // alert(JSON.stringify(data))
  429. var data=data.data,str="";
  430. var dataNames1=[];
  431. if(!data.length){
  432. }else {
  433. for(var i in data){
  434. str+=ulModel.replace("{{taskID}}",data[i]['id']).replace("{{name}}",data[i]['title']).replace("{{duty}}",data[i]['remark']).replace("{{enterprise}}",data[i]['address']).replace("{{type}}",data[i]['task_type']==1?"紧急":"常规").replace("{{statusclass}}",data[i]['task_type']==0?"task_dbqk1":"task_dbqk2")
  435. .replace("{{pssj}}",data[i]['created_at']?data[i]['created_at'].slice(0,16):"").replace("{{wcsj}}",data[i]['end_time']?data[i]['end_time'].slice(0,16):"").replace("{{lon}}",data[i]['lon']).replace("{{lat}}",data[i]['lat'])
  436. switch (data[i]['status']+""){
  437. case "0":str=str.replace("{{status}}","未开始").replace("{{taskstatus}}","task_status_1");break;
  438. case "1":str=str.replace("{{status}}","进行中").replace("{{taskstatus}}","task_status_2");break;
  439. case "2":str=str.replace("{{status}}","暂停中").replace("{{taskstatus}}","task_status_4");break;
  440. case "3":str=str.replace("{{status}}","已完成").replace("{{taskstatus}}","task_status_3");break;
  441. }
  442. dataNames1.push(data[i]['title'])
  443. }
  444. }
  445. api.refreshHeaderLoadDone();
  446. if(page>=$api.getStorage("taskpage")&&$api.getStorage("taskpage")!=0){
  447. $(".nomore").removeClass("hid")
  448. }else {
  449. page++;
  450. }
  451. $(".task_con ul")[0].insertAdjacentHTML("beforeend",str);
  452. api.execScript({
  453. name: 'root',
  454. script: 'totalTime(0);'
  455. });
  456. });
  457. });
  458. api.addEventListener({
  459. name: 'refresh'
  460. }, function (ret, err) {
  461. var type=ret.value.task_type;
  462. var index=$api.getStorage("selectli");
  463. switch (type){
  464. case 0:$(".task_con li:eq("+index+")").find(".task_status")[0].className="task_status task_status_1";$(".task_con li:eq("+index+") .task_status span").text("未开始");break;
  465. case 1:$(".task_con li:eq("+index+")").find(".task_status")[0].className="task_status task_status_2";$(".task_con li:eq("+index+") .task_status span").text("进行中");break;
  466. case 2:$(".task_con li:eq("+index+")").find(".task_status")[0].className="task_status task_status_4";$(".task_con li:eq("+index+") .task_status span").text("暂停中");break;
  467. case 3:$(".task_con li:eq("+index+")").remove();break;
  468. }
  469. });
  470. $(".task_con ul").on('click','li',function () {
  471. //在名为winName的window中执行jsfun脚本
  472. var jsfun1 = 'toFrame(6);',that=$(this).index();
  473. $api.setStorage("taskXQ",{taskID:this.dataset.taskid,lon:this.dataset.lon,lat:this.dataset.lat,tohome:true,taskType:"service"});
  474. api.execScript({
  475. script: jsfun1
  476. });
  477. })
  478. $(".taskRemindDiv").click(function () {
  479. var jsfun = 'toFrame(1);'
  480. api.execScript({
  481. script: jsfun
  482. });
  483. })
  484. api.addEventListener({
  485. name: 'reloadPage'
  486. }, function (ret, err) {
  487. api.closeFrame({
  488. name: 'home'
  489. });
  490. });
  491. }
  492. function getTaskList() {
  493. api.ajax({
  494. url: pageUrl+"/index/task/index",
  495. method: 'get',
  496. timeout: 30,
  497. dataType: 'text',
  498. returnAll: false,
  499. data: {
  500. values: {user_id:$api.getStorage("user").id, page:1, status:0, type:2}
  501. }
  502. }, function (data, err) {
  503. data=JSON.parse(data)
  504. // alert(JSON.stringify(data))
  505. $api.setStorage("taskpage",data["last_page"]);
  506. var data=data.data,str="";
  507. var dataNames1=[];
  508. if(!data.length){
  509. }else {
  510. for(var i in data){
  511. str+=ulModel.replace("{{taskID}}",data[i]['id']).replace("{{name}}",data[i]['title']).replace("{{duty}}",data[i]['remark']).replace("{{enterprise}}",data[i]['address']).replace("{{type}}",data[i]['task_type']==1?"紧急":"常规").replace("{{statusclass}}",data[i]['task_type']==0?"task_dbqk1":"task_dbqk2")
  512. .replace("{{pssj}}",data[i]['start_time']?data[i]['start_time'].slice(0,16):"").replace("{{jhks}}",data[i]['created_at']?data[i]['created_at'].slice(0,16):"未设定").replace("{{lon}}",data[i]['lon']).replace("{{lat}}",data[i]['lat'])
  513. switch (data[i]['status']=""){
  514. case "0":str=str.replace("{{status}}","未开始").replace("{{taskstatus}}","task_status_1");break;
  515. case "1":str=str.replace("{{status}}","进行中").replace("{{taskstatus}}","task_status_2");break;
  516. case "2":str=str.replace("{{status}}","暂停中").replace("{{taskstatus}}","task_status_4");break;
  517. case "3":str=str.replace("{{status}}","已完成").replace("{{taskstatus}}","task_status_3");break;
  518. }
  519. dataNames1.push(data[i]['title'])
  520. }
  521. }
  522. api.refreshHeaderLoadDone();
  523. api.hideProgress();
  524. if(page>=$api.getStorage("taskpage")&&$api.getStorage("taskpage")!=0){
  525. $(".nomore").removeClass("hid")
  526. }else {
  527. page++;
  528. }
  529. $(".task_con ul").html(str).css("display","block");
  530. api.execScript({
  531. name: 'root',
  532. script: 'totalTime(0);'
  533. });
  534. });
  535. }
  536. function setData() {
  537. getTaskList();
  538. if(!$api.getStorage("user").id) return;
  539. api.ajax({
  540. url: pageUrl+"/index/index",
  541. method: 'get',
  542. timeout: 30,
  543. dataType: 'text',
  544. returnAll: false,
  545. data: {
  546. values: {user_id:$api.getStorage("user").id}
  547. }
  548. }, function (data, err) {
  549. var data=JSON.parse(data),bl="";
  550. data['jinggao']-0>0?$("#warning").text(data['jinggao']).addClass("active"):$("#warning").text("0").removeClass("active");
  551. data['task']-0>0?$("#taskNum").text(data['task']).addClass("active"):$("#taskNum").text("0").removeClass("active");
  552. data['message']-0>0?$("#mesNum").text(data['message']).addClass("active"):$("#mesNum").text("0").removeClass("active");
  553. data['check_task']-0>0?$("#shNum").text(data['check_task']).addClass("active"):$("#shNum").text("0").removeClass("active");
  554. data['task_xc']-0>0?$("#xcNum").text(data['task_xc']).addClass("active"):$("#xcNum").text("0").removeClass("active");
  555. if(data['task']>0){
  556. $(".HBgImg>img").prop("src","../image/home_head2.jpg");
  557. $(".taskRemindDiv>img").prop("src","../image/home_head2.png");
  558. $("#taskN").text(data['task']);
  559. $(".taskTitle").removeClass("hid");
  560. $(".noTask").addClass("hid");
  561. $api.setStorage("first","1");
  562. bl= 'setRed();';
  563. }else {
  564. $(".HBgImg img").prop("src","../image/home_head.jpg");
  565. $(".taskRemindDiv>img").prop("src","../image/home_head.png");
  566. $("#taskN").text("");
  567. $(".noTask").removeClass("hid");
  568. $(".taskTitle").addClass("hid");
  569. if(!$(".nomore").hasClass("hid")){
  570. $(".nomore").addClass("hid");
  571. }
  572. $api.setStorage("first","0");
  573. bl= 'setGreen();';
  574. }
  575. if($api.getStorage("Colorjl")!=$api.getStorage("first")){
  576. api.execScript({
  577. script: bl
  578. });
  579. }
  580. $api.setStorage("Colorjl",$api.getStorage("first"))
  581. $api.setStorage("homeData",data);
  582. api.execScript({
  583. name: 'root',
  584. script: 'totalTime(0);'
  585. });
  586. });
  587. api.ajax({
  588. url: pageUrl+"/index/user/auditor",
  589. method: 'get',
  590. timeout: 30,
  591. dataType: 'text',
  592. returnAll: false,
  593. data: {
  594. values: {user_module_id:326}
  595. }
  596. }, function (data, err) {
  597. var data=JSON.parse(data),selectData=[];
  598. // alert(JSON.stringify(data))
  599. for(var i in data){
  600. selectData[i]={
  601. id:data[i]['id'],
  602. text: data[i]['name'],
  603. status: 'normal'
  604. }
  605. }
  606. $api.setStorage("userList",selectData);
  607. api.execScript({
  608. name: 'root',
  609. script: 'totalTime(0);'
  610. });
  611. });
  612. api.ajax({
  613. url: pageUrl+"/index/user/auditor",
  614. method: 'get',
  615. timeout: 30,
  616. dataType: 'text',
  617. returnAll: false,
  618. data: {
  619. values: {user_module_id:328}
  620. }
  621. }, function (data, err) {
  622. var data=JSON.parse(data),headmanData=[];
  623. // alert(JSON.stringify(data))
  624. for(var i in data){
  625. headmanData[i]={
  626. id:data[i]['id'],
  627. text: data[i]['name'],
  628. status: 'normal'
  629. }
  630. }
  631. $api.setStorage("headmanList",headmanData);
  632. api.execScript({
  633. name: 'root',
  634. script: 'totalTime(0);'
  635. });
  636. });
  637. if($api.getStorage("homeData")){
  638. var data=$api.getStorage("homeData");
  639. data['jinggao']-0>0?$("#warning").text(data['jinggao']).addClass("active"):$("#warning").text("0").removeClass("active");
  640. data['task']-0>0?$("#taskNum").text(data['task']).addClass("active"):$("#taskNum").text("0").removeClass("active");
  641. data['message']-0>0?$("#mesNum").text(data['message']).addClass("active"):$("#mesNum").text("0").removeClass("active");
  642. data['check_task']-0>0?$("#shNum").text(data['check_task']).addClass("active"):$("#shNum").text("0").removeClass("active");
  643. data['task_xc']-0>0?$("#xcNum").text(data['task_xc']).addClass("active"):$("#xcNum").text("0").removeClass("active");
  644. }
  645. }
  646. </script>
  647. </body>
  648. </html>