base.min.js 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739
  1. (function (h) {
  2. var c = {
  3. options: {sysName: "南方医务通"}, init: function () {
  4. h("head title").text("南方医务通");
  5. var s = d.version.getVer();
  6. if (s) {
  7. h("link").each(function () {
  8. h(this).attr("href", h(this).attr("href") + "?v=" + s.version)
  9. });
  10. h("script").each(function () {
  11. h(this).attr("src", h(this).attr("src") + "?v=" + s.version)
  12. })
  13. }
  14. }
  15. };
  16. var o = {
  17. js_Fx_uuid: function (t, s) {
  18. o.ck(t, s)
  19. }, android_Fx_uuid: function () {
  20. try {
  21. android.js_Fx_uuid()
  22. } catch (s) {
  23. o.ck()
  24. }
  25. }, ck: function (t, s) {
  26. var u = {loginName: h("#loginName").val(), password: h("#password").val(), uuid: t, devType: s};
  27. setTimeout(function () {
  28. d.sendData(window.apiUrl+"?c=Index&a=login", u, true)
  29. }, 100)
  30. }
  31. };
  32. var d = {
  33. version: {
  34. getVer: function () {
  35. var s = JSON.parse(localStorage.getItem("hzAppVer"));
  36. if (s) {
  37. return s
  38. } else {
  39. return d.version.setVer()
  40. }
  41. }, setVer: function () {
  42. h.ajax({
  43. type: "get",
  44. url: window.apiUrl+"index.php?c=Config&a=getWebVersion",
  45. dataType: "jsonp",
  46. data: {},
  47. jsonp: "callback",
  48. async: false,
  49. crossDomain: true,
  50. success: function (s) {
  51. s = s || {};
  52. if (s.version) {
  53. localStorage.setItem("hzAppVer", JSON.stringify(s));
  54. return s
  55. }
  56. },
  57. error: function (u, t, s) {
  58. return null;
  59. d.dialog(false, d.options.timeout, "网络链接失败")
  60. },
  61. timeout: 9000
  62. })
  63. }
  64. },
  65. options: {templateHtml: [null, null, null, null], timeout: 2500, rows: null},
  66. scroll: function (t, z, s, w, A, x, u, v) {
  67. var y = true;
  68. h("#content").bind("scroll", function () {
  69. var B = h("#content").scrollTop();
  70. if (B >= (h("#list").height() - h("#content").height()) && y == true) {
  71. z.rowed += z.pageSize;
  72. if (d.options.rows && z.rowed < d.options.rows) {
  73. d.getData(t, z, s, w, A, x, u, v)
  74. } else {
  75. setTimeout(function () {
  76. d.dialog(false, d.options.timeout, "没有了")
  77. }, 1);
  78. y = false
  79. }
  80. }
  81. })
  82. },
  83. dialog: function (s, v, u, t) {
  84. h("#dialog").addClass("show");
  85. if (s) {
  86. if (u) {
  87. h("#dialog .popup_layer_cont").html('<div class="loading_cont"><div class="cycle"></div><div class="title">' + u + "</div></div>")
  88. } else {
  89. h("#dialog .popup_layer_cont").html('<div class="loading_cont"><div class="cycle"></div><div class="title">数据加载中</div></div>')
  90. }
  91. } else {
  92. if (u) {
  93. h("#dialog .popup_layer_cont").html(u)
  94. }
  95. }
  96. if (v) {
  97. setTimeout(function () {
  98. h("#dialog").removeClass("show");
  99. if (t) {
  100. if (window.parent) {
  101. window.parent.location = t
  102. } else {
  103. window.location = t
  104. }
  105. }
  106. }, v)
  107. } else {
  108. h("#dialog").removeClass("show")
  109. }
  110. },
  111. loginSuccess: function () {
  112. var s = JSON.parse(localStorage.getItem("hzToken"));
  113. if (s) {
  114. if (s.timestamp) {
  115. h("#login").hide();
  116. h("#loginSuccess").show();
  117. h("#userPhoto").attr("src", s.userPhoto);
  118. h("i.login_open").removeClass("logined");
  119. h("i.login_open img").attr("src", s.userPhoto);
  120. if (s.trueName == "" || !s.trueName) {
  121. h("#userName").text(s.phone)
  122. } else {
  123. h("#userName").text(s.trueName)
  124. }
  125. }
  126. }
  127. },
  128. logout: function () {
  129. localStorage.setItem("hzToken", null);
  130. d.dialog(false, d.options.timeout, "已成功退出", "index.html")
  131. },
  132. getToken: function () {
  133. var s = JSON.parse(localStorage.getItem("hzToken"));
  134. if (s == null) {
  135. s = {timestamp: null, token: null, customerFamilyId: null}
  136. } else {
  137. s = {timestamp: s.timestamp, token: s.token, customerFamilyId: s.customerFamilyId}
  138. }
  139. return s
  140. },
  141. setToken: function (t) {
  142. var s = false;
  143. if (t.status == "1") {
  144. var u = JSON.parse(localStorage.getItem("hzToken"));
  145. u = {
  146. timestamp: t.timestamp,
  147. token: t.token,
  148. userPhoto: u.userPhoto,
  149. customerFamilyId: u.customerFamilyId,
  150. phone: u.phone,
  151. trueName: u.trueName
  152. };
  153. localStorage.setItem("hzToken", JSON.stringify(u));
  154. s = true
  155. } else {
  156. localStorage.setItem("hzToken", null);
  157. d.dialog(false, d.options.timeout, "用户未登录或已退出!", "login.html")
  158. }
  159. return s
  160. },
  161. setLoginToken: function (s) {
  162. if (s.status == "1") {
  163. var t = {
  164. timestamp: s.data[0].timestamp,
  165. token: s.data[0].token,
  166. userPhoto: s.data[0].userPhoto,
  167. customerFamilyId: s.data[0].customerFamilyId,
  168. phone: s.data[0].phone,
  169. trueName: s.data[0].trueName
  170. };
  171. localStorage.setItem("hzToken", JSON.stringify(t));
  172. d.dialog(false, d.options.timeout, "登录成功", "index.html")
  173. } else {
  174. d.dialog(false, d.options.timeout, "用户名或密码错误")
  175. }
  176. },
  177. getDataNoTemp: function (t, u, v, s) {
  178. if (u.rowed > d.options.rows) {
  179. d.dialog(false, 800, "没有了")
  180. } else {
  181. h.ajax({
  182. type: "get",
  183. url: t,
  184. dataType: "jsonp",
  185. data: h.extend(d.getToken(), u),
  186. jsonp: "callback",
  187. async: false,
  188. crossDomain: true,
  189. beforeSend: d.dialog(true),
  190. success: function (w) {
  191. w = w || {};
  192. //允许医生列表页面不登录`
  193. if((window.location.pathname=='/dept_q_list.html'||window.location.pathname=='/favorite_q_doctor_dept_list.html')&&w.dataToken.token==null){
  194. if (w.dataInfo.status == "1") {
  195. v.doing(w.dataInfo.data);
  196. d.dialog(false, false, null, null)
  197. } else {
  198. if (s) {
  199. d.dialog(false, d.options.timeout, s.message ? s.message : "无数据");
  200. s.doing()
  201. } else {
  202. d.dialog(false, d.options.timeout, "无数据")
  203. }
  204. }
  205. return false;
  206. }
  207. if (d.setToken(w.dataToken)) {
  208. if (w.dataInfo.status == "1") {
  209. v.doing(w.dataInfo.data);
  210. d.dialog(false, false, null, null)
  211. } else {
  212. if (s) {
  213. d.dialog(false, d.options.timeout, s.message ? s.message : "无数据");
  214. s.doing()
  215. } else {
  216. d.dialog(false, d.options.timeout, "无数据")
  217. }
  218. }
  219. }
  220. },
  221. error: function (y, x, w) {
  222. d.dialog(false, d.options.timeout, "网络链接失败")
  223. },
  224. timeout: 9000
  225. })
  226. }
  227. },
  228. getData: function (t, A, s, x, B, y, u, w, z, v) {
  229. if (d.options.rows ? A.rowed >= d.options.rows : false) {
  230. d.dialog(false, d.options.timeout, "没有了")
  231. } else {
  232. h.ajax({
  233. type: "get",
  234. url: t,
  235. dataType: "jsonp",
  236. data: h.extend(d.getToken(), A),
  237. jsonp: "callback",
  238. async: false,
  239. crossDomain: true,
  240. beforeSend: d.dialog(true),
  241. success: function (C) {
  242. C = C || {};
  243. if (!x) {
  244. x = 0
  245. }
  246. if (!d.options.templateHtml[x]) {
  247. d.options.templateHtml[x] = h(s).html();
  248. d.options.templateHtml[x] = d.replaceEscape(d.options.templateHtml[x]);
  249. h(s).html("");
  250. if (C.dataInfo.rows) {
  251. d.options.rows = parseInt(C.dataInfo.rows)
  252. }
  253. }
  254. if((window.location.pathname=='/doctorWho.html'||window.location.pathname=='/doctorWhoAnother.html')&&C.dataToken.token==null){
  255. if (C.dataInfo.status == "1") {
  256. if (!u) {
  257. A = null
  258. }
  259. if (B) {
  260. h(s).html(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
  261. } else {
  262. h(s).append(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
  263. }
  264. h(s).show();
  265. d.dialog(false, false, null, null);
  266. if (y) {
  267. m.icoEventCallback(y)
  268. }
  269. if (z) {
  270. z.doing()
  271. }
  272. } else {
  273. h(s).html("");
  274. if (!w) {
  275. w = "无数据"
  276. }
  277. d.dialog(false, d.options.timeout, w);
  278. if (v) {
  279. setTimeout(function () {
  280. v.doing()
  281. }, d.options.timeout)
  282. }
  283. }
  284. return false;
  285. }
  286. if (d.setToken(C.dataToken)) {
  287. if (C.dataInfo.status == "1") {
  288. if (!u) {
  289. A = null
  290. }
  291. if (B) {
  292. h(s).html(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
  293. } else {
  294. h(s).append(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
  295. }
  296. h(s).show();
  297. d.dialog(false, false, null, null);
  298. if (y) {
  299. m.icoEventCallback(y)
  300. }
  301. if (z) {
  302. z.doing()
  303. }
  304. } else {
  305. h(s).html("");
  306. if (!w) {
  307. w = "无数据"
  308. }
  309. d.dialog(false, d.options.timeout, w);
  310. if (v) {
  311. setTimeout(function () {
  312. v.doing()
  313. }, d.options.timeout)
  314. }
  315. }
  316. }
  317. },
  318. error: function (E, D, C) {
  319. d.dialog(false, d.options.timeout, "网络链接失败")
  320. },
  321. timeout: 9000
  322. })
  323. }
  324. },
  325. sendData: function (t, y, u, x, w, v, z, s) {
  326. h.ajax({
  327. type: "get",
  328. url: t,
  329. dataType: "jsonp",
  330. data: h.extend(d.getToken(), y),
  331. jsonp: "callback",
  332. async: false,
  333. crossDomain: true,
  334. beforeSend: d.dialog(true, 2000, "处理中..."),
  335. success: function (A) {
  336. A = A || {};
  337. if (u) {
  338. d.setLoginToken(A.dataInfo);
  339. d.version.setVer()
  340. } else {
  341. d.setToken(A.dataToken)
  342. }
  343. if (A.dataInfo.status == "1") {
  344. if (x) {
  345. d.dialog(false, d.options.timeout, x[1], null)
  346. }
  347. if (w) {
  348. m.switchStatus(w)
  349. }
  350. if (v) {
  351. m.icoEventCallback(v)
  352. }
  353. if (z) {
  354. z.doing(A.dataInfo.data)
  355. }
  356. } else {
  357. if (x) {
  358. if (x[0]) {
  359. d.dialog(false, d.options.timeout, x[0], null)
  360. } else {
  361. d.dialog(false, d.options.timeout, A.dataInfo.info, null)
  362. }
  363. } else {
  364. d.dialog(false, d.options.timeout, A.dataInfo.info, null)
  365. }
  366. if (s) {
  367. setTimeout(function () {
  368. s.doing()
  369. }, d.options.timeout)
  370. }
  371. }
  372. },
  373. error: function (C, B, A) {
  374. d.dialog(false, d.options.timeout, "网络链接失败")
  375. },
  376. timeout: 9000
  377. })
  378. },
  379. register: function (s, u, t, v, w) {
  380. h.ajax({
  381. type: "get",
  382. url: s,
  383. dataType: "jsonp",
  384. data: u,
  385. jsonp: "callback",
  386. async: false,
  387. crossDomain: true,
  388. success: function (x) {
  389. x = x || {};
  390. if (x.dataInfo.status == "1") {
  391. if (t) {
  392. d.dialog(false, d.options.timeout, t[1], null)
  393. }
  394. if (v) {
  395. v.doing(x.dataInfo.data)
  396. }
  397. if (w) {
  398. if (window.parent) {
  399. window.parent.location = w
  400. } else {
  401. window.location = w
  402. }
  403. }
  404. } else {
  405. if (t) {
  406. if (t[0]) {
  407. d.dialog(false, d.options.timeout, t[0], null)
  408. } else {
  409. d.dialog(false, d.options.timeout, x.dataInfo.info, null)
  410. }
  411. } else {
  412. d.dialog(false, d.options.timeout, x.dataInfo.info, null)
  413. }
  414. if (v) {
  415. if (v.err) {
  416. v.err.doing(x.dataInfo.info)
  417. }
  418. }
  419. }
  420. },
  421. error: function (z, y, x) {
  422. d.dialog(false, d.options.timeout, "网络链接失败")
  423. },
  424. timeout: 19000
  425. })
  426. },
  427. check: function (t, v, u, s) {
  428. h.ajax({
  429. type: "get",
  430. url: t,
  431. dataType: "jsonp",
  432. data: v,
  433. jsonp: "callback",
  434. async: false,
  435. crossDomain: true,
  436. success: function (w) {
  437. w = w || {};
  438. if (w.dataInfo.status == "1") {
  439. if (u) {
  440. if (u[1]) {
  441. d.dialog(false, d.options.timeout, u[1])
  442. } else {
  443. d.dialog(false, d.options.timeout, w.dataInfo.info)
  444. }
  445. }
  446. } else {
  447. if (u) {
  448. if (u[0]) {
  449. d.dialog(false, d.options.timeout, u[0])
  450. } else {
  451. d.dialog(false, d.options.timeout, w.dataInfo.info)
  452. }
  453. } else {
  454. d.dialog(false, d.options.timeout, w.dataInfo.info)
  455. }
  456. if (s) {
  457. s.doing()
  458. }
  459. }
  460. },
  461. error: function (y, x, w) {
  462. d.dialog(false, d.options.timeout, "网络链接失败")
  463. },
  464. timeout: 9000
  465. })
  466. },
  467. setTemplate: function (s, v, u) {
  468. var w, t = "";
  469. h.each(v, function (x, y) {
  470. if (u) {
  471. h.extend(y, u)
  472. }
  473. t += d.TemplateEngine(s, y)
  474. });
  475. return t
  476. },
  477. TemplateEngine: function (v, u) {
  478. var w = /\[%([^%]+)?%]/g, s = /(^( )?(var|if|for|else|switch|case|break|{|}))(.*)?/g, x = "var r=[];\n",
  479. z = 0, t;
  480. var y = function (A, B) {
  481. B ? (x += A.match(s) ? A + "\n" : "r.push(" + A + ");\n") : (x += A != "" ? 'r.push("' + A.replace(/"/g, '\\"') + '");\n' : "");
  482. return y
  483. };
  484. while (t = w.exec(v)) {
  485. y(v.slice(z, t.index))(t[1], true);
  486. z = t.index + t[0].length
  487. }
  488. y(v.substr(z, v.length - z));
  489. x += 'return r.join("");';
  490. return new Function(x.replace(/[\r\t\n]/g, "")).apply(u)
  491. },
  492. replaceEscape: function (s) {
  493. s = s.replace(/&lt;/g, "<");
  494. s = s.replace(/&gt;/g, ">");
  495. s = s.replace(/&amp;&amp;/g, "&&");
  496. return s
  497. }
  498. };
  499. var g = {
  500. getDaysInMonth: function (s, t) {
  501. return 32 - new Date(s, t, 32).getDate()
  502. }, getFirstDayOfMonth: function (t, u, s) {
  503. var s = s || 1;
  504. return new Date(t, u, s).getDay()
  505. }, getToday: function () {
  506. var s = new Date();
  507. g.Y = s.getFullYear();
  508. g.M = s.getMonth();
  509. g.D = s.getDate()
  510. }, toggle: function (s) {
  511. var s = h(s);
  512. if (s.hasClass("down")) {
  513. h("#DateBox").addClass("show");
  514. h(s).addClass("up").removeClass("down");
  515. h(s).find(".title").html("收起")
  516. } else {
  517. h(s).addClass("down").removeClass("up");
  518. h("#DateBox").removeClass("show");
  519. h(s).find(".title").html("展开")
  520. }
  521. }, doHook: function () {
  522. if (!h(this).hasClass("noNum")) {
  523. h(".doHook").removeClass("hook");
  524. h(this).addClass("hook").prev().addClass("rightborder").siblings().removeClass("rightborder")
  525. }
  526. h(".hzApp-list-calendar-master h2.title").html(h(this).attr("date"))
  527. }, getList: function () {
  528. var x = "";
  529. var A = 1;
  530. var t = new Date();
  531. var v = g.getFirstDayOfMonth(g.Y, g.M);
  532. for (var u = 0; u < 7; u++) {
  533. var s = "";
  534. switch (u) {
  535. case 0:
  536. s += "日";
  537. break;
  538. case 1:
  539. s += "一";
  540. break;
  541. case 2:
  542. s += "二";
  543. break;
  544. case 3:
  545. s += "三";
  546. break;
  547. case 4:
  548. s += "四";
  549. break;
  550. case 5:
  551. s += "五";
  552. break;
  553. case 6:
  554. s += "六";
  555. break
  556. }
  557. x += ' <li class="doHook title"><div class="mate">' + s + "</div></li>"
  558. }
  559. for (var u = 0; u < v; u++) {
  560. x += ' <li class="doHook"></li>'
  561. }
  562. for (var u = 1; u <= g.getDaysInMonth(g.Y, g.M); u++) {
  563. var z = new Date().toDate(g.Y + "-" + (g.M + 1) + "-1");
  564. z.setDate(z.getDate() + (u - 1));
  565. var y = z.format("yyyy-M-d");
  566. if (A > g.getDaysInMonth(g.Y, g.M)) {
  567. A = 1
  568. }
  569. if (v > 6) {
  570. v = 0
  571. }
  572. if (g.Y == t.getFullYear() && g.M == t.getMonth() && A == t.getDate()) {
  573. x += ' <li class="doHook hook" date="' + y + '"> <i></i><div class="title">今</div> </li>'
  574. } else {
  575. if (u == 5) {
  576. x += ' <li class="doHook" date="' + y + '"> <i></i><div class="title">' + A + "</div> </li>"
  577. } else {
  578. x += ' <li class="doHook" date="' + y + '"> <i></i><div class="title">' + A + "</div> </li>"
  579. }
  580. }
  581. A++;
  582. v++
  583. }
  584. return x
  585. }, setEvents: function (s) {
  586. h("#DateBox ul").find("li").each(function () {
  587. if (h(this).attr("date") == s) {
  588. h(this).find("i").addClass("icon-event")
  589. }
  590. })
  591. }, init: function () {
  592. g.getToday();
  593. h(".hzApp-list-calendar-master h2.title").html(g.Y + "年" + (g.M + 1) + "月" + g.D + "日");
  594. h("#DateBox ul").html(g.getList());
  595. h(".doHook").on("tap", g.doHook);
  596. h(".hzApp-list-calendar-master .arrowT").bind("tap", function () {
  597. if (h(this).hasClass("right")) {
  598. if (h(this).hasClass("year")) {
  599. g.Y++
  600. } else {
  601. g.M++
  602. }
  603. } else {
  604. if (h(this).hasClass("left")) {
  605. if (h(this).hasClass("year")) {
  606. g.Y--
  607. } else {
  608. g.M--
  609. }
  610. }
  611. }
  612. if (g.M > 11 || g.M < 0) {
  613. g.M = 0
  614. }
  615. var s = new Date();
  616. if (g.Y == s.getFullYear() && g.M == s.getMonth()) {
  617. g.D = s.getDate()
  618. } else {
  619. g.D = 1
  620. }
  621. h(".hzApp-list-calendar-master h2.title").html(g.Y + "年" + (g.M + 1) + "月" + g.D + "日");
  622. g.change();
  623. g.setEvents("2015-8-10")
  624. })
  625. }, change: function () {
  626. h("#DateBox ul").html(g.getList());
  627. h(".doHook").on("tap", g.doHook)
  628. }
  629. };
  630. var p = {
  631. options: {
  632. urls: ["#", "index.html", "deptlist.html", "doctorlist.html", "doctorsbooking.html", "#", "favorite.html", "drugCalendar.html", "doctorCalendar.html"],
  633. // icons: ["", "icon-home home", "icon-workflows dept", "icon-user0 doctor", "icon-news booking", "icon-addRound like", "icon-love favorite", "icon-drug drugCalendar", "icon-calendar doctorCalendar"],
  634. icons: ["", "icon-home home", "icon-workflows dept", "icon-user0 doctor", "icon-news booking", "icon-addRound like", "icon-love favorite"],
  635. // titles: ["", "应用中心", "科室", "医生", "预约", "关注", "我的关注", "用药日程", "挂号记录"]
  636. titles: ["", "门诊服务", "科室", "医生", "预约", "关注", "我的关注"]
  637. }, doing: function (t, s) {
  638. h.extend(this.options, s);
  639. this.el = t;
  640. this._init()
  641. }, _init: function (u) {
  642. var t = '<div class="listNav "><ul>', v = "";
  643. for (var s = 0; s < this.options.count; s++) {
  644. v = this.options.count;
  645. if (this.options.current == this.options.idx[s]) {
  646. v += " current"
  647. }
  648. if(this.options.titles[this.options.idx[s]]=='门诊服务'){
  649. t += '<li class="count' + v + '"><a><i class="' + this.options.icons[this.options.idx[s]] + '"></i><span>' + this.options.titles[this.options.idx[s]] + "</span></a></li>"
  650. }else{
  651. t += '<li class="count' + v + '"><a class="needlogin"><i class="' + this.options.icons[this.options.idx[s]] + '"></i><span>' + this.options.titles[this.options.idx[s]] + "</span></a></li>"
  652. }
  653. }
  654. t += "</ul></div>";
  655. this.el.html(t);
  656. this._addEvent()
  657. }, _addEvent: function () {
  658. var s = this;
  659. this.el.find(".listNav li").bind("tap", function () {
  660. var token = window.hzAPI.getToken().token;//token
  661. //判断token是否存在
  662. if(!token){
  663. window.location.href = 'login.html';
  664. e.preventDefault();
  665. return false;
  666. }
  667. var t = 0;
  668. if (h(this).find("i").hasClass("*.home")) {
  669. t = 1
  670. }
  671. if (h(this).find("i").hasClass("*.dept")) {
  672. t = 2
  673. }
  674. if (h(this).find("i").hasClass("*.doctor")) {
  675. t = 3
  676. }
  677. if (h(this).find("i").hasClass("*.booking")) {
  678. t = 4
  679. }
  680. if (h(this).find("i").hasClass("*.like")) {
  681. t = 5
  682. }
  683. if (h(this).find("i").hasClass("*.favorite")) {
  684. t = 6
  685. }
  686. if (h(this).find("i").hasClass("*.drugCalendar")) {
  687. t = 7
  688. }
  689. if (h(this).find("i").hasClass("*.doctorCalendar")) {
  690. t = 8
  691. }
  692. window.location = s.options.urls[t]
  693. })
  694. }
  695. };
  696. var a = {
  697. show: function () {
  698. h("#popup_layer").addClass("show")
  699. }, close: function () {
  700. h("#popup_layer").removeClass("show");
  701. h(".popup_layer_cont").html("")
  702. }, getCount: function (s) {
  703. var s = h.extend({}, s);
  704. a.picker_selector_html = '<div class="counterPickerTitle">' + s.title + '</div><div class="counterPickerScroll" id="counter_minus">-</div><div class="counterPickerScroll"><input type="text" readonly="true" class="hasBottomLine center fontL" id="counterValue"></div><div class="counterPickerScroll" id="counter_add">+</div>';
  705. a.picker_selector_html += '<button id="cancel_counter_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>';
  706. a.picker_selector_html += '<button id="confirm_counter_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  707. h(".popup_layer_cont").html(a.picker_selector_html);
  708. var t = h("#counterValue");
  709. t.val(s.obj_callback.val());
  710. h("#counter_add").bind("tap", function () {
  711. if (parseInt(t.val()) < 0) {
  712. t.val(0)
  713. }
  714. t.val(parseInt(t.val()) + 1)
  715. });
  716. h("#counter_minus").bind("tap", function () {
  717. if (parseInt(t.val()) < 0) {
  718. t.val(0)
  719. }
  720. t.val(parseInt(t.val()) - 1)
  721. });
  722. h("#confirm_counter_picker").bind("tap", function () {
  723. if (typeof s.obj_callback == "object") {
  724. s.obj_callback.val(t.val())
  725. }
  726. a.close()
  727. });
  728. h("#cancel_counter_picker").bind("tap", function () {
  729. a.close()
  730. })
  731. }
  732. };
  733. var q = {
  734. getHours: function (t) {
  735. var s = t.substring(0, 2);
  736. return (s.substring(0, 1) == "0" ? s.substring(1, 2) : s)
  737. }, getPlanFromGroups: function (w, v) {
  738. var s = new Date().toDate(w);
  739. var u = {morning: [], afternoon: [], evening: [], night: []};
  740. var t = ["night", "morning", "afternoon", "evening"];
  741. h.each(v, function (B, A) {
  742. var x = new Date().toDate(A.startDate);
  743. var E = new Date().toDate(A.startDate);
  744. E.setDate(x.getDate() + A.days);
  745. var z, C = new Array();
  746. var y, D = 0;
  747. if (s >= x && s <= E) {
  748. z = A.consumptionHoursString.split(",");
  749. C = A.quantityString.split(",");
  750. for (i = 0; i < z.length; i++) {
  751. y = parseInt(q.getHours(z[i]));
  752. D = Math.floor(y / 6);
  753. u[t[D]].push({
  754. id: A.id,
  755. date: null,
  756. consumptionHours: z[i],
  757. drugName: A.drugName,
  758. quantity: C[i],
  759. doseType: A.doseType,
  760. status: "pending",
  761. statusCn: "待服"
  762. })
  763. }
  764. }
  765. });
  766. return u
  767. }, getPlanFromSchedules: function (x, w) {
  768. var t = new Date().toDate(x);
  769. var v = {morning: [], afternoon: [], evening: [], night: []};
  770. var u = ["night", "morning", "afternoon", "evening"];
  771. var z = {pending: "待服", missing: "漏服", taken: "已服"};
  772. var s, y = 0;
  773. h.each(w, function (C, A) {
  774. var B = new Date().toDate(A.originalDateTime);
  775. if ((B.getFullYear() == t.getFullYear()) && (B.getMonth() == t.getMonth()) && (B.getDate() == t.getDate())) {
  776. s = parseInt(q.getHours(A.consumptionHours));
  777. y = Math.floor(s / 6);
  778. v[u[y]].push({
  779. id: A.id,
  780. date: A.originalDateTime,
  781. consumptionHours: A.consumptionHours,
  782. drugName: A.drugName,
  783. quantity: A.quantity,
  784. doseType: A.doseType,
  785. status: A.status,
  786. statusCn: z[A.status]
  787. })
  788. }
  789. });
  790. return v
  791. }, getAllPlan: function (w, u) {
  792. var t = new Date().toDate(w);
  793. var v, s = null;
  794. var x = {dateTime: w, customerFamilyId: u};
  795. if (t <= new Date()) {
  796. v = window.apiUrl+"?c=Index&a=medicineSchedule";
  797. s = 0
  798. } else {
  799. v = window.apiUrl+"?c=Index&a=medicineScheduleGroups";
  800. s = 1
  801. }
  802. h.ajax({
  803. type: "get",
  804. url: v,
  805. dataType: "jsonp",
  806. data: h.extend(d.getToken(), x),
  807. jsonp: "callback",
  808. async: false,
  809. crossDomain: true,
  810. beforeSend: d.dialog(true),
  811. success: function (y) {
  812. y = y || {};
  813. if (d.setToken(y.dataToken)) {
  814. var z = null;
  815. if (y.dataInfo.status == "1") {
  816. if (s == 1) {
  817. z = q.getPlanFromGroups(w, y.dataInfo.data)
  818. } else {
  819. z = q.getPlanFromSchedules(w, y.dataInfo.data)
  820. }
  821. localStorage.setItem("out", JSON.stringify(z));
  822. q.showPlan(z);
  823. q.resetEvent();
  824. d.dialog(false, 300, null, null)
  825. } else {
  826. z = {morning: [], afternoon: [], evening: [], night: []};
  827. q.showPlan(z);
  828. localStorage.setItem("out", null);
  829. d.dialog(false, 2000, "当天无服药信息")
  830. }
  831. }
  832. },
  833. error: function (A, z, y) {
  834. d.dialog(false, 2000, "网络链接失败")
  835. },
  836. timeout: 9000
  837. })
  838. }, showPlan: function (t) {
  839. for (var u in t) {
  840. if (t[u].length > 0) {
  841. h("#" + u).html('<a vhref="drugPopPerDay.html?id=' + u + '"><i class="icon-drug"></i>' + t[u].length + "</a>")
  842. } else {
  843. h("#" + u).html("")
  844. }
  845. }
  846. var s = new Date().getHours();
  847. var v = ["nightTitle", "morningTitle", "afternoonTitle", "eveningTitle"],
  848. w = ["night", "morning", "afternoon", "evening"];
  849. h("#" + v[Math.floor(s / 6)]).addClass("doing");
  850. h("#" + w[Math.floor(s / 6)]).addClass("doing")
  851. }, resetEvent: function () {
  852. h("#ListCycle li a").bind("tap", function () {
  853. var s = {night: "凌晨", morning: "上午", afternoon: "下午", evening: "晚上"};
  854. title = "服用清单 - " + g.Y + "年" + (g.M + 1) + "月" + g.D + "日 " + s[h(this).parent().attr("id")];
  855. m.popWinLayer(h(this).attr("vhref") + "&date=" + g.Y + "-" + (g.M + 1) + "-" + g.D, title)
  856. })
  857. }
  858. };
  859. var f = {
  860. getUrlParam: function (s) {
  861. var t = new RegExp("(^|&)" + s + "=([^&]*)(&|$)");
  862. var u = window.location.search.substr(1).match(t);
  863. if (u != null) {
  864. return u[2]
  865. } else {
  866. return null
  867. }
  868. }, setNewDrugPlanList: function (x, u) {
  869. var y = "", t = 12 / (x - 1), s = 8, v = "08:00";
  870. for (var w = 1; w <= x; w++) {
  871. y += '<li><div class="title2-1"><input class="green" readonly="true" value="' + v + '" type="text" name="consumptionHours"></div><div class="title2-1 right green">服用<input class="green" style="width: 5em" readonly="true" value="1.00" type="text" name="quantity"></div></li>';
  872. s += t;
  873. if (s > 9) {
  874. v = s
  875. } else {
  876. v = "0" + s
  877. }
  878. v += ":00"
  879. }
  880. u.html(y);
  881. u.find("li").bind("tap", function () {
  882. l.getList(h(this).find("[name='consumptionHours']"), h(this).find("[name='quantity']"));
  883. l.show()
  884. })
  885. }, getDrugHoursQuantity: function () {
  886. var s = "", t = "";
  887. h("#hours-quantity li").each(function (u) {
  888. if (u > 0) {
  889. s += ",";
  890. t += ","
  891. }
  892. s += h(this).find("input[type=text][name=consumptionHours]").val();
  893. t += h(this).find("input[type=text][name=quantity]").val()
  894. });
  895. return [s, t]
  896. }, setDrugPlanList: function (x, t) {
  897. var s = x.consumptionHoursString.split(",");
  898. var v = x.quantityString.split(",");
  899. var w = "";
  900. for (var u = 0; u < s.length; u++) {
  901. w += '<li><div class="title2-1"><input class="green" readonly="true" value="' + s[u] + '" type="text" name="consumptionHours"></div><div class="title2-1 right green">服用<input class="green" style="width: 5em" readonly="true" value="' + v[u] + '" type="text" name="quantity"></div></li>'
  902. }
  903. t.html(w);
  904. t.find("li").bind("tap", function () {
  905. l.getList(h(this).find("[name='consumptionHours']"), h(this).find("[name='quantity']"));
  906. l.show()
  907. })
  908. }, getSelectOptionsText: function (t) {
  909. var s = "";
  910. t.find("option").forEach(function (u) {
  911. if (t.val() == h(u).val()) {
  912. s = h(u).text()
  913. }
  914. });
  915. return s
  916. }, getClass: function (s) {
  917. if (s) {
  918. return "is-active"
  919. } else {
  920. return ""
  921. }
  922. }
  923. };
  924. var l = {
  925. addZero: function (s) {
  926. return (s < 10 ? "0" + s : s)
  927. }, solarDays: function (u, t) {
  928. var s = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  929. if (t == 1) {
  930. return (((u % 4 == 0) && (u % 100 != 0) || (u % 400 == 0)) ? 29 : 28)
  931. } else {
  932. return (s[t])
  933. }
  934. }, show: function () {
  935. h("#popup_layer").addClass("show")
  936. }, close: function () {
  937. h("#popup_layer").removeClass("show");
  938. h(".popup_layer_cont").html("")
  939. }, getList: function (t, F) {
  940. var A = {hasSecond: false, isCustomLeftButton: false, customLeftButtonName: "清除"};
  941. l.picker_selector_html = '<div class="counterPickerTitle">设置服用时间</div><div class="datepickerscroll" id="hourpickerscroll"><div class="scroller"><ul id="hourpicker" class="listitem"></ul></div></div>';
  942. if (A.hasSecond) {
  943. l.picker_selector_html += '<div style="position: absolute;left: 72px;top: 52px;">:</div>';
  944. l.picker_selector_html += '<div style="position: absolute;left: 148px;top: 52px;">:</div>'
  945. } else {
  946. l.picker_selector_html += '<div style="position: absolute;left: 108px;top: 100px;">:</div>'
  947. }
  948. l.picker_selector_html += '<div class="datepickerscroll" id="minutepickerscroll"><div class="scroller"><ul id="minutepicker" class="listitem"></ul></div></div>';
  949. if (A.hasSecond) {
  950. l.picker_selector_html += '<div class="datepickerscroll" id="secondpickerscroll"><div class="scroller"><ul id="secondpicker" class="listitem"></ul></div></div>'
  951. }
  952. l.picker_selector_html += '<div class="counterPickerTitle">设置服用数量</div><div class="counterPickerScroll" id="counter_minus">-</div><div class="counterPickerScroll"><input type="text" readonly="true" class="hasBottomLine center fontL" id="counterValue" value="1.00"></div><div class="counterPickerScroll" id="counter_add">+</div>';
  953. if (A.isCustomLeftButton) {
  954. l.picker_selector_html += '<button id="clear_date_picker" style="color: #000000;"' + A.customLeftButtonName + "</button>"
  955. } else {
  956. l.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>'
  957. }
  958. l.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  959. h(".popup_layer_cont").html(l.picker_selector_html);
  960. if (!A.hasSecond) {
  961. h("#hourpickerscroll").css("width", "50%");
  962. h("#minutepickerscroll").css("width", "50%")
  963. }
  964. var u = "<li>&nbsp;</li>", C = '<li id="hourli-1">&nbsp;</li>', w = '<li id="minuteli-1">&nbsp;</li>',
  965. s = '<li id="secondli-1">&nbsp;</li>';
  966. var D = h("#hourpicker"), x = h("#minutepicker"), v = null;
  967. if (A.hasSecond) {
  968. v = h("#secondpicker")
  969. }
  970. var B = (typeof selectedDate == "object") ? selectedDate : new Date();
  971. var y = t.val().split(":");
  972. B.setHours(parseInt(y[0]));
  973. B.setMinutes(parseInt(y[1]));
  974. l.hourSelected = B.getHours();
  975. l.minuteSelected = B.getMinutes();
  976. l.secondSelected = B.getSeconds();
  977. for (var z = 0; z < 24; z++) {
  978. C += '<li class="hourli" id="hourli' + z + '">' + l.addZero(z) + "</li>"
  979. }
  980. for (var z = 0; z < 60; z++) {
  981. w += '<li class="minuteli" id="minuteli' + z + '">' + l.addZero(z) + "</li>"
  982. }
  983. for (var z = 0; z < 60; z++) {
  984. s += '<li class="secondli" id="secondli' + z + '">' + l.addZero(z) + "</li>"
  985. }
  986. C += u;
  987. w += u;
  988. s += u;
  989. D.html(C);
  990. x.html(w);
  991. if (A.hasSecond) {
  992. v.html(s)
  993. }
  994. l.hourScroll = new IScroll("#hourpickerscroll", {scrollbars: false, snap: "li"});
  995. l.minuteScroll = new IScroll("#minutepickerscroll", {scrollbars: false, snap: "li"});
  996. if (A.hasSecond) {
  997. l.secondScroll = new IScroll("#secondpickerscroll", {scrollbars: false, snap: "li"})
  998. }
  999. l.hourScroll.scrollToElement("#hourli" + (B.getHours() - 1), 0);
  1000. h("#hourli" + B.getHours()).addClass("selectedli");
  1001. l.minuteScroll.scrollToElement("#minuteli" + (B.getMinutes() - 1), 0);
  1002. h("#minuteli" + B.getMinutes()).addClass("selectedli");
  1003. if (A.hasSecond) {
  1004. l.secondScroll.scrollToElement("#secondli" + (B.getSeconds() - 1), 0);
  1005. h("#secondli" + B.getSeconds()).addClass("selectedli")
  1006. }
  1007. l.hourScroll.on("scrollEnd", function (G) {
  1008. h(".hourli").removeClass("selectedli");
  1009. var H = Math.round(l.hourScroll.y / (-41));
  1010. l.hourSelected = H;
  1011. h("#hourli" + H).addClass("selectedli")
  1012. });
  1013. l.minuteScroll.on("scrollEnd", function (H) {
  1014. h(".minuteli").removeClass("selectedli");
  1015. var G = Math.round(l.minuteScroll.y / (-41));
  1016. l.minuteSelected = G;
  1017. h("#minuteli" + G).addClass("selectedli")
  1018. });
  1019. if (A.hasSecond) {
  1020. l.secondScroll.on("scrollEnd", function (H) {
  1021. h(".secondli").removeClass("selectedli");
  1022. var G = Math.round(l.secondScroll.y / (-41));
  1023. l.secondSelected = G;
  1024. h("#secondli" + G).addClass("selectedli")
  1025. })
  1026. }
  1027. var E = h("#counterValue");
  1028. E.val(F.val());
  1029. h("#counter_add").bind("tap", function () {
  1030. E.val((Number(E.val()) + 0.25).toFixed(2))
  1031. });
  1032. h("#counter_minus").bind("tap", function () {
  1033. if (Number(E.val()) <= 0) {
  1034. E.val("0.00")
  1035. } else {
  1036. E.val((Number(E.val() - 0.25).toFixed(2)))
  1037. }
  1038. });
  1039. h("#confirm_date_picker").bind("tap", function () {
  1040. var J = new Date(B.getFullYear(), B.getMonth(), B.getDate(), l.hourSelected, l.minuteSelected, A.hasSecond ? l.secondSelected : 0),
  1041. I = J.getFullYear() + "-" + (J.getMonth() + 1) + "-" + J.getDate() + " " + l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes()) + ":" + l.addZero(J.getSeconds()),
  1042. H = J.getFullYear() + "-" + (J.getMonth() + 1) + "-" + J.getDate(), G = "";
  1043. if (A.hasSecond) {
  1044. G = l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes()) + ":" + l.addZero(J.getSeconds())
  1045. } else {
  1046. G = l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes())
  1047. }
  1048. if (typeof t == "object" && typeof F == "object") {
  1049. t.val(G);
  1050. F.val(E.val())
  1051. }
  1052. l.close()
  1053. });
  1054. h("#cancel_date_picker").bind("tap", function () {
  1055. l.close()
  1056. })
  1057. }
  1058. };
  1059. var k = {
  1060. init: function () {
  1061. k.bindUIActions();
  1062. k.hideInactive()
  1063. }, bindUIActions: function () {
  1064. h(".tabBlock-tab").on("tap", function () {
  1065. k.switchTab(h(this))
  1066. })
  1067. }, hideInactive: function () {
  1068. var s = h(".tabBlock");
  1069. s.each(function (v) {
  1070. var u = h(s[v]), t = u.find(".tabBlock-pane"), w = u.find(".tabBlock-tab.is-active");
  1071. t.hide();
  1072. h(t[w.index()]).show()
  1073. })
  1074. }, switchTab: function (s) {
  1075. if (!s.hasClass("is-active")) {
  1076. s.siblings().removeClass("is-active");
  1077. s.addClass("is-active");
  1078. k.showPane(s.index())
  1079. }
  1080. }, showPane: function (t) {
  1081. var s = h(".tabBlock-content .lists");
  1082. s.each(function (u) {
  1083. if (!h(this).hasClass("hide")) {
  1084. h(this).addClass("hide")
  1085. }
  1086. if (u == t) {
  1087. h(this).removeClass("hide")
  1088. }
  1089. })
  1090. }
  1091. };
  1092. var r = {
  1093. show: function () {
  1094. h("#popup_layer").addClass("show")
  1095. }, close: function () {
  1096. h("#popup_layer").removeClass("show");
  1097. h(".popup_layer_cont").html("")
  1098. }, getList: function (w) {
  1099. var z = {hasSecond: false, isCustomLeftButton: false, customLeftButtonName: "清除"};
  1100. r.picker_selector_html = '<div class="datepickerscroll" id="hourpickerscroll"><div class="scroller"><ul id="hourpicker" class="listitem"></ul></div></div>';
  1101. if (z.hasSecond) {
  1102. r.picker_selector_html += '<div style="position: absolute;left: 72px;top: 52px;">:</div>';
  1103. r.picker_selector_html += '<div style="position: absolute;left: 148px;top: 52px;">:</div>'
  1104. } else {
  1105. r.picker_selector_html += '<div style="position: absolute;left: 108px;top: 52px;">:</div>'
  1106. }
  1107. r.picker_selector_html += '<div class="datepickerscroll" id="minutepickerscroll"><div class="scroller"><ul id="minutepicker" class="listitem"></ul></div></div>';
  1108. if (z.hasSecond) {
  1109. r.picker_selector_html += '<div class="datepickerscroll" id="secondpickerscroll"><div class="scroller"><ul id="secondpicker" class="listitem"></ul></div></div>'
  1110. }
  1111. if (z.isCustomLeftButton) {
  1112. r.picker_selector_html += '<button id="clear_date_picker" style="color: #000000;"' + z.customLeftButtonName + "</button>"
  1113. } else {
  1114. r.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>'
  1115. }
  1116. r.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  1117. h(".popup_layer_cont").html(r.picker_selector_html);
  1118. if (!z.hasSecond) {
  1119. h("#hourpickerscroll").css("width", "50%");
  1120. h("#minutepickerscroll").css("width", "50%")
  1121. }
  1122. var t = "<li>&nbsp;</li>", B = '<li id="hourli-1">&nbsp;</li>', v = '<li id="minuteli-1">&nbsp;</li>',
  1123. s = '<li id="secondli-1">&nbsp;</li>';
  1124. var C = h("#hourpicker"), x = h("#minutepicker"), u = null;
  1125. if (z.hasSecond) {
  1126. u = h("#secondpicker")
  1127. }
  1128. var A = (typeof selectedDate == "object") ? selectedDate : new Date();
  1129. r.hourSelected = A.getHours();
  1130. r.minuteSelected = A.getMinutes();
  1131. r.secondSelected = A.getSeconds();
  1132. for (var y = 0; y < 24; y++) {
  1133. B += '<li class="hourli" id="hourli' + y + '">' + l.addZero(y) + "</li>"
  1134. }
  1135. for (var y = 0; y < 60; y++) {
  1136. v += '<li class="minuteli" id="minuteli' + y + '">' + l.addZero(y) + "</li>"
  1137. }
  1138. for (var y = 0; y < 60; y++) {
  1139. s += '<li class="secondli" id="secondli' + y + '">' + l.addZero(y) + "</li>"
  1140. }
  1141. B += t;
  1142. v += t;
  1143. s += t;
  1144. C.html(B);
  1145. x.html(v);
  1146. if (z.hasSecond) {
  1147. u.html(s)
  1148. }
  1149. r.hourScroll = new IScroll("#hourpickerscroll", {scrollbars: false, snap: "li"});
  1150. r.minuteScroll = new IScroll("#minutepickerscroll", {scrollbars: false, snap: "li"});
  1151. if (z.hasSecond) {
  1152. r.secondScroll = new IScroll("#secondpickerscroll", {scrollbars: false, snap: "li"})
  1153. }
  1154. r.hourScroll.scrollToElement("#hourli" + (A.getHours() - 1), 0);
  1155. h("#hourli" + A.getHours()).addClass("selectedli");
  1156. r.minuteScroll.scrollToElement("#minuteli" + (A.getMinutes() - 1), 0);
  1157. h("#minuteli" + A.getMinutes()).addClass("selectedli");
  1158. if (z.hasSecond) {
  1159. r.secondScroll.scrollToElement("#secondli" + (A.getSeconds() - 1), 0);
  1160. h("#secondli" + A.getSeconds()).addClass("selectedli")
  1161. }
  1162. r.hourScroll.on("scrollEnd", function (D) {
  1163. h(".hourli").removeClass("selectedli");
  1164. var E = Math.round(r.hourScroll.y / (-41));
  1165. r.hourSelected = E;
  1166. h("#hourli" + E).addClass("selectedli")
  1167. });
  1168. r.minuteScroll.on("scrollEnd", function (E) {
  1169. h(".minuteli").removeClass("selectedli");
  1170. var D = Math.round(r.minuteScroll.y / (-41));
  1171. r.minuteSelected = D;
  1172. h("#minuteli" + D).addClass("selectedli")
  1173. });
  1174. if (z.hasSecond) {
  1175. r.secondScroll.on("scrollEnd", function (E) {
  1176. h(".secondli").removeClass("selectedli");
  1177. var D = Math.round(r.secondScroll.y / (-41));
  1178. r.secondSelected = D;
  1179. h("#secondli" + D).addClass("selectedli")
  1180. })
  1181. }
  1182. h("#confirm_date_picker").bind("tap", function () {
  1183. var G = new Date(A.getFullYear(), A.getMonth(), A.getDate(), r.hourSelected, r.minuteSelected, z.hasSecond ? r.secondSelected : 0),
  1184. F = G.getFullYear() + "-" + (G.getMonth() + 1) + "-" + G.getDate() + " " + l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes()) + ":" + l.addZero(G.getSeconds()),
  1185. E = G.getFullYear() + "-" + (G.getMonth() + 1) + "-" + G.getDate(), D = "";
  1186. if (z.hasSecond) {
  1187. D = l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes()) + ":" + l.addZero(G.getSeconds())
  1188. } else {
  1189. D = l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes())
  1190. }
  1191. if (typeof w == "object") {
  1192. w.val(D)
  1193. }
  1194. r.close()
  1195. });
  1196. h("#cancel_date_picker").bind("tap", function () {
  1197. r.close()
  1198. })
  1199. }
  1200. };
  1201. var j = {
  1202. show: function () {
  1203. h("#popup_layer").addClass("show")
  1204. }, close: function () {
  1205. h("#popup_layer").removeClass("show");
  1206. h(".popup_layer_cont").html("")
  1207. }, reCountDay: function () {
  1208. var u = parseInt(solarDays(j.yearSelected, (parseInt(j.monthSelected) - 1)));
  1209. var t = '<li id="dayli0">&nbsp;</li>';
  1210. for (var s = 1; s <= u; s++) {
  1211. t += '<li class="dayli" id="dayli' + s + '">' + l.addZero(s) + "</li>"
  1212. }
  1213. t += "<li>&nbsp;</li>";
  1214. h("#daypicker").html(t);
  1215. j.dayScroll.destroy();
  1216. j.dayScroll = new IScroll("#daypickerscroll", {scrollbars: false, snap: "li"});
  1217. if (j.daySelected > u) {
  1218. j.dayScroll.scrollToElement("#dayli" + (u - 1), 0);
  1219. h("#dayli" + u).addClass("selectedli");
  1220. j.daySelected = u
  1221. } else {
  1222. j.dayScroll.scrollToElement("#dayli" + (parseInt(j.daySelected) - 1), 0);
  1223. h("#dayli" + parseInt(j.daySelected)).addClass("selectedli")
  1224. }
  1225. j.dayScroll.off("scrollEnd");
  1226. j.dayScroll.on("scrollEnd", function (w) {
  1227. h(".dayli").removeClass("selectedli");
  1228. var v = Math.round(j.dayScroll.y / (-41) + 1);
  1229. j.daySelected = v;
  1230. h("#dayli" + v).addClass("selectedli")
  1231. })
  1232. }, getList: function (v) {
  1233. var x = {isCustomLeftButton: false};
  1234. j.picker_selector_html = '<div class="datepickerscroll" id="yearpickerscroll"><div class="scroller"><ul id="yearpicker" class="listitem"></ul></div></div><div class="datepickerscroll" id="monthpickerscroll"><div class="scroller"><ul id="monthpicker" class="listitem"></ul></div></div><div class="datepickerscroll" id="daypickerscroll"><div class="scroller"><ul id="daypicker" class="listitem"></ul></div></div>';
  1235. if (x.isCustomLeftButton) {
  1236. j.picker_selector_html += '<button id="clear_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">' + x.customLeftButtonName + "</button>"
  1237. } else {
  1238. j.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8; color: #000000;">取消</button>'
  1239. }
  1240. j.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  1241. h(".popup_layer_cont").html(j.picker_selector_html);
  1242. var t = "<li>&nbsp;</li>", C = '<li id="yearli1899">&nbsp;</li>', A = '<li id="monthli0">&nbsp;</li>',
  1243. u = '<li id="dayli0">&nbsp;</li>';
  1244. var s = h("#yearpicker"), z = h("#monthpicker"), B = h("#daypicker");
  1245. if (v.val()) {
  1246. selectedDate = new Date().toDate(v.val())
  1247. }
  1248. var y = (typeof selectedDate == "object") ? selectedDate : new Date();
  1249. j.yearSelected = y.getFullYear();
  1250. j.monthSelected = y.getMonth() + 1;
  1251. j.daySelected = y.getDate();
  1252. for (var w = 1900; w < 2050; w++) {
  1253. C += '<li class="yearli" id="yearli' + w + '">' + w + "</li>"
  1254. }
  1255. for (var w = 1; w < 13; w++) {
  1256. A += '<li class="monthli" id="monthli' + w + '">' + w + "月</li>"
  1257. }
  1258. var D = solarDays(j.yearSelected, (parseInt(j.monthSelected) - 1));
  1259. for (var w = 1; w <= D; w++) {
  1260. u += '<li class="dayli" id="dayli' + w + '">' + l.addZero(w) + "</li>"
  1261. }
  1262. C += t;
  1263. A += t;
  1264. u += t;
  1265. s.html(C);
  1266. z.html(A);
  1267. B.html(u);
  1268. j.yearScroll = new IScroll("#yearpickerscroll", {mouseWheel: false, scrollbars: false, snap: "li"});
  1269. j.monthScroll = new IScroll("#monthpickerscroll", {mouseWheel: false, scrollbars: false, snap: "li"});
  1270. j.dayScroll = new IScroll("#daypickerscroll", {mouseWheel: false, scrollbars: false, snap: "li"});
  1271. j.yearScroll.scrollToElement("#yearli" + (y.getFullYear() - 1), 0);
  1272. h("#yearli" + y.getFullYear()).addClass("selectedli");
  1273. j.monthScroll.scrollToElement("#monthli" + y.getMonth(), 0);
  1274. h("#monthli" + (y.getMonth() + 1)).addClass("selectedli");
  1275. j.dayScroll.scrollToElement("#dayli" + (y.getDate() - 1), 0);
  1276. h("#dayli" + y.getDate()).addClass("selectedli");
  1277. j.yearScroll.on("scrollEnd", function (F) {
  1278. h(".yearli").removeClass("selectedli");
  1279. var E = Math.round(j.yearScroll.y / (-41) + 1900);
  1280. j.yearSelected = E;
  1281. h("#yearli" + E).addClass("selectedli");
  1282. j.reCountDay()
  1283. });
  1284. j.monthScroll.on("scrollEnd", function (F) {
  1285. h(".monthli").removeClass("selectedli");
  1286. var E = Math.round(j.monthScroll.y / (-41) + 1);
  1287. j.monthSelected = E;
  1288. h("#monthli" + E).addClass("selectedli");
  1289. j.reCountDay()
  1290. });
  1291. j.dayScroll.on("scrollEnd", function (F) {
  1292. h(".dayli").removeClass("selectedli");
  1293. var E = Math.round(j.dayScroll.y / (-41) + 1);
  1294. j.daySelected = E;
  1295. h("#dayli" + E).addClass("selectedli")
  1296. });
  1297. h("#confirm_date_picker").bind("tap", function () {
  1298. var H = new Date(j.yearSelected, j.monthSelected - 1, j.daySelected, y.getHours(), y.getMinutes(), y.getSeconds()),
  1299. G = H.getFullYear() + "-" + (H.getMonth() + 1) + "-" + H.getDate() + " " + l.addZero(H.getHours()) + ":" + l.addZero(H.getMinutes()) + ":" + l.addZero(H.getSeconds()),
  1300. F = H.getFullYear() + "-" + (H.getMonth() + 1) + "-" + H.getDate(),
  1301. E = l.addZero(H.getHours()) + ":" + l.addZero(H.getMinutes()) + ":" + l.addZero(H.getSeconds());
  1302. if (typeof v == "object") {
  1303. v.val(F)
  1304. }
  1305. j.close()
  1306. });
  1307. h("#cancel_date_picker").bind("tap", function () {
  1308. j.close()
  1309. })
  1310. }
  1311. };
  1312. var b = {
  1313. wait: 59, updateTimer: function (s) {
  1314. if (b.wait == 0) {
  1315. h(s).val("重新发送");
  1316. h(s).removeAttr("disabled");
  1317. h(s).css({color: "#438eff", "text-align": "left"})
  1318. } else {
  1319. if (b.wait == 59) {
  1320. if (!h(s).attr("disabled")) {
  1321. h(s).attr("disabled", "disabled")
  1322. }
  1323. h(s).css({color: "#b3b3b3", "text-align": "left"})
  1324. }
  1325. h(s).val("重新发送(" + b.wait + ")");
  1326. b.wait--;
  1327. setTimeout(function () {
  1328. b.updateTimer(s)
  1329. }, 1000)
  1330. }
  1331. }
  1332. };
  1333. var n = {
  1334. rules: {
  1335. email: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,4}){1,2})$/,
  1336. url: /^((http(s)?|ftp|telnet|news|rtsp|mms):\/\/)?(((\w(\-*\w)*\.)+[a-zA-Z]{2,4})|(((1\d\d|2([0-4]\d|5[0-5])|[1-9]\d|\d).){3}(1\d\d|2([0-4]\d|5[0-5])|[1-9]\d|\d).?))(:\d{0,5})?(\/+.*)*$/,
  1337. counter: /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/,
  1338. number: /^\\-?\\d+(\\.\\d+)?$/,
  1339. tel: /\d{3}-\d{8}|\d{4}-\d{7}/,
  1340. phone: /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|17[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/,
  1341. zipCode: /[1-9]\d{5}(?!\d)/,
  1342. idNo: /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/,
  1343. date: /^\d{4}-\d{1,2}-\d{1,2}/,
  1344. password: /^[a-zA-Z]\w{5,17}$/,
  1345. smsCode: /\d{6}$/,
  1346. cardId: /\d{8}$/,
  1347. address: /^[\s\S]{10,}$/,
  1348. select: /^[\s\S]{1,}$/,
  1349. message: {
  1350. radio: "请选择一个选项",
  1351. checkbox: "如果要继续,请选中此框",
  1352. select: "请选择列表中的一项",
  1353. email: "请输入正确的电子邮件地址",
  1354. url: "请输入正确网站地址",
  1355. tel: "请输入正确的电话号码",
  1356. phone: "请输入正确的手机号码",
  1357. idNo: "请输入正确身份证号码",
  1358. number: "请输入数字",
  1359. date: "请输入正确的日期格式",
  1360. pattern: "内容格式不符合要求",
  1361. empty: "请填写此字段",
  1362. password: "长度6~18,字母开头,含字母数字下划线",
  1363. smsCode: "请输入正确的手机短信验证码",
  1364. cardId: "请输入正确的诊疗卡号码",
  1365. address: "地址长度要大于10个汉字",
  1366. select: "请选择"
  1367. }
  1368. }, matchId: {password: "#password", message: {password: "2次密码输入不一致"}}, check: function (s) {
  1369. if (h("#noValidate")) {
  1370. h("#noValidate").remove()
  1371. }
  1372. var u = h(s).find("input,select").length - 1, t = false;
  1373. h(s).find("input,select").each(function (v) {
  1374. h(this).unbind("tap");
  1375. if (h(this).attr("required")) {
  1376. var w = h(this).attr("required");
  1377. if (n.rules[w]) {
  1378. if (h(this).val().match(n.rules[w])) {
  1379. } else {
  1380. n.tips(this, n.rules.message[w]);
  1381. return false
  1382. }
  1383. } else {
  1384. if (h(this).val().length < 1) {
  1385. n.tips(this, n.rules.message.empty);
  1386. return false
  1387. }
  1388. }
  1389. }
  1390. if (h(this).attr("format")) {
  1391. var w = h(this).attr("format");
  1392. if (n.rules[w] && h(this).val().length > 0) {
  1393. if (h(this).val().match(n.rules[w])) {
  1394. } else {
  1395. n.tips(this, n.rules.message[w]);
  1396. return false
  1397. }
  1398. }
  1399. }
  1400. if (h(this).attr("matchId")) {
  1401. var w = h(this).attr("matchId");
  1402. if (n.matchId[w]) {
  1403. if (h(this).val() == h(n.matchId[w]).val()) {
  1404. } else {
  1405. n.tips(this, n.matchId.message[w]);
  1406. return false
  1407. }
  1408. }
  1409. }
  1410. if (u == v) {
  1411. t = true
  1412. }
  1413. });
  1414. return t
  1415. }, tips: function (w, v) {
  1416. var s = {
  1417. border: "1px solid rgb(247, 206, 57)",
  1418. "text-align": "left",
  1419. color: "rgb(51, 51, 51)",
  1420. "font-size": "0.8rem",
  1421. padding: "5px 10px",
  1422. position: "relative",
  1423. "border-radius": "4px",
  1424. "line-height": "0.8rem",
  1425. top: "0",
  1426. "background-color": "rgb(255, 255, 224)",
  1427. "z-index": "1"
  1428. }, t = {
  1429. "border-color": "transparent transparent rgb(247, 206, 57)",
  1430. "border-style": "dashed dashed solid",
  1431. bottom: "0px",
  1432. width: "0px; height: 0px",
  1433. overflow: "hidden",
  1434. "border-width": "6px; position: absolute",
  1435. top: "-13px"
  1436. }, u = {
  1437. "border-color": "transparent transparent rgb(255, 255, 224)",
  1438. "border-style": "dashed dashed solid; bottom: -1px",
  1439. width: "0px",
  1440. height: "0px",
  1441. overflow: "hidden",
  1442. "border-width": "6px; position: absolute",
  1443. top: "-12px"
  1444. };
  1445. var x = h('<div id="noValidate"><div class="front"></div><div class="back"></div>' + v + "</div>").css(s);
  1446. h(w).parent().append(x);
  1447. h("#noValidate div.front").css(t);
  1448. h("#noValidate div.back").css(u);
  1449. h(w).on("tap", function () {
  1450. h("#noValidate").remove()
  1451. });
  1452. h(w)[0].focus()
  1453. }
  1454. };
  1455. var m = {
  1456. ton: function (s) {
  1457. h(s).on("touchstart touchmove touchend", function (t) {
  1458. if (t.type == "touchstart") {
  1459. h(this).addClass("ton")
  1460. } else {
  1461. if (t.type == "touchmove") {
  1462. h(this).removeClass("ton")
  1463. } else {
  1464. h(this).removeClass("ton")
  1465. }
  1466. }
  1467. })
  1468. }, popWinLayer: function (u, t, s) {
  1469. if (t) {
  1470. h(".asort .fl span").text(t)
  1471. }
  1472. if (u) {
  1473. h("#newwrap").attr("src", u);
  1474. h(".asort").eq(0).addClass("show")
  1475. } else {
  1476. h(".asort").eq(s).addClass("show")
  1477. }
  1478. h(".hzApp-over-layer").addClass("show")
  1479. }, closeWinLayer: function () {
  1480. h(".hzApp-over-layer").removeClass("show");
  1481. setTimeout(function () {
  1482. h(".hzApp-over-layer .asort").removeClass("show")
  1483. }, 100);
  1484. try {
  1485. reload.doing()
  1486. } catch (s) {
  1487. }
  1488. }, icoAddEvent: function () {
  1489. m.ton("header i, .hd .fr, .hd .fl i, A.btn-large");
  1490. if (h(".menu_home")) {
  1491. h(".menu_home").on("touchend", function () {
  1492. setTimeout(function () {
  1493. window.location.href = "index.html"
  1494. }, 200)
  1495. })
  1496. }
  1497. if (h(".menu_back")) {
  1498. h(".menu_back").on("tap", function () {
  1499. window.history.back()
  1500. })
  1501. }
  1502. if (h(".menu_todo")) {
  1503. h(".menu_todo").on("tap", function () {
  1504. if (h(this).hasClass("tap")) {
  1505. h(this).removeClass("tap");
  1506. h("#todo").removeClass("show")
  1507. } else {
  1508. h(this).addClass("tap");
  1509. h("#todo").addClass("show")
  1510. }
  1511. })
  1512. }
  1513. if (h(".selectToggle")) {
  1514. h(".selectToggle .top-nav").on("tap", function () {
  1515. if (h(".selectToggle .arrow-box i").hasClass("icon-arrowdown")) {
  1516. h(".selectToggle ul").css({display: "block"});
  1517. h(".selectToggle .arrow-box i").removeClass("icon-arrowdown");
  1518. h(".selectToggle .arrow-box i").addClass("icon-arrowup");
  1519. h(".selectToggle .marginall .text").html("")
  1520. } else {
  1521. h(".selectToggle ul").css({display: "none"});
  1522. h(".selectToggle .arrow-box i").removeClass("icon-arrowup");
  1523. h(".selectToggle .arrow-box i").addClass("icon-arrowdown");
  1524. h(".selectToggle .marginall .text").html(h(".selectToggle ul li.selected").html())
  1525. }
  1526. })
  1527. }
  1528. if (h(".menu_family")) {
  1529. h(".menu_family").on("tap", function () {
  1530. if (h(this).hasClass("tap")) {
  1531. h(this).removeClass("tap");
  1532. h("#family_todo").removeClass("show")
  1533. } else {
  1534. h(this).addClass("tap");
  1535. h("#family_todo").addClass("show")
  1536. }
  1537. })
  1538. }
  1539. if (h("#todo .todo_msk")) {
  1540. h("#todo .todo_msk").on("tap", function () {
  1541. h("#todo").removeClass("show");
  1542. h(".menu_todo").removeClass("tap")
  1543. })
  1544. }
  1545. if (h("#family_todo .todo_msk")) {
  1546. h("#family_todo .todo_msk").on("tap", function () {
  1547. h("#family_todo").removeClass("show");
  1548. h(".menu_family").removeClass("tap")
  1549. })
  1550. }
  1551. if (h("#todo td")) {
  1552. h("#todo td").on("touchend", function () {
  1553. var s = h(this).find("a").attr("vhref");
  1554. if (h("#family_todo .ck").parent().attr("data")) {
  1555. var t = JSON.parse(h("#family_todo .ck").parent().attr("data"));
  1556. s += "?id=" + t.id
  1557. }
  1558. m.popWinLayer(s, h(this).find("label").text(), h(this).parent().index());
  1559. h(".menu_todo").trigger("tap")
  1560. })
  1561. }
  1562. if (h(".menu_close_layer,.hd .fr i.icon-del")) {
  1563. h(".menu_close_layer,.hd .fr i.icon-del").on("tap", function () {
  1564. m.closeWinLayer()
  1565. })
  1566. }
  1567. }, icoEventCallback: function (s) {
  1568. if (!s) {
  1569. s = 0
  1570. }
  1571. switch (s) {
  1572. case 1:
  1573. h(".alist .button").on("tap", function () {
  1574. d.sendData(window.apiUrl+"?c=Index&a=favoriteHospital", JSON.parse(h(this).parent().attr("data")), false, ["更新失败", "更新成功"], [0, h(this)])
  1575. });
  1576. break;
  1577. case 2:
  1578. h(".alist .button").on("tap", function () {
  1579. d.sendData(window.apiUrl+"?c=Index&a=favoriteDoctor", JSON.parse(h(this).parent().attr("data")), false, ["更新失败", "更新成功"], [0, h(this)])
  1580. });
  1581. break;
  1582. case 3:
  1583. h("#list ul").append('<li class="line1 bar hide"></li>');
  1584. h("li.line1.bar").on("tap", function () {
  1585. if (h(this).hasClass("title")) {
  1586. h(this).removeClass("title");
  1587. h(this).find("i").removeClass("icon-arrowup").addClass("icon-arrowdown");
  1588. t(h(this), false)
  1589. } else {
  1590. h(this).addClass("title");
  1591. h(this).find("i").removeClass("icon-arrowdown").addClass("icon-arrowup");
  1592. t(h(this), true)
  1593. }
  1594. function t(w, u) {
  1595. var v = w.next();
  1596. while (!v.hasClass("bar")) {
  1597. if (u) {
  1598. v.removeClass("hide")
  1599. } else {
  1600. v.addClass("hide")
  1601. }
  1602. v = v.next()
  1603. }
  1604. }
  1605. });
  1606. break;
  1607. case 4:
  1608. h(".selectToggle ul").css({display: "none"});
  1609. h(".selectToggle .marginall .text").html(h(".selectToggle ul li.selected").find("a").html());
  1610. reload.doing();
  1611. h(".selectToggle ul li").on("tap", function () {
  1612. h(".selectToggle ul li").each(function () {
  1613. if (h(this).hasClass("selected")) {
  1614. h(this).removeClass("selected");
  1615. h(this).find("i").removeClass("icon-radioCheck");
  1616. h(this).find("i").addClass("icon-radio")
  1617. }
  1618. });
  1619. h(this).addClass("selected");
  1620. h(this).find("i").removeClass("icon-radio");
  1621. h(this).find("i").addClass("icon-radioCheck");
  1622. h(".selectToggle .arrow-box i").removeClass("icon-arrowup");
  1623. h(".selectToggle .arrow-box i").addClass("icon-arrowdown");
  1624. h(".selectToggle .marginall .text").html(h(this).find("a").html());
  1625. h(".selectToggle ul").css({display: "none"});
  1626. var t = JSON.parse(h(this).find("a").attr("data"));
  1627. var u = h("#header p").text();
  1628. h("#header p").text(t.trueName + u.substring(u.indexOf("的"), u.length));
  1629. reload.doing()
  1630. });
  1631. break;
  1632. case 5:
  1633. h("#drugName").val("");
  1634. h("#frequency").val(1);
  1635. h("#doseType").val("片");
  1636. h("#start_date").val(new Date().format("yyyy-M-dd"));
  1637. h("#diagnose").val("");
  1638. h("#source").val("");
  1639. break;
  1640. case 6:
  1641. h("input[name=customerFamilyId]").eq(0).attr("checked", "checked");
  1642. break;
  1643. case 7:
  1644. h(".asort .fr").trigger("tap");
  1645. h("input[name=customerFamilyId]").eq(0).attr("checked", "checked");
  1646. break;
  1647. case 8:
  1648. break
  1649. }
  1650. }, switchStatus: function (t) {
  1651. if (t) {
  1652. switch (t[0]) {
  1653. case 0:
  1654. if (t[1].attr("name") == "del") {
  1655. t[1].attr("name", "add");
  1656. t[1].text("添加");
  1657. t[1].siblings(".selected").css("display", "none")
  1658. } else {
  1659. t[1].attr("name", "del");
  1660. t[1].text("取消");
  1661. t[1].siblings(".selected").css("display", "block")
  1662. }
  1663. break;
  1664. case 1:
  1665. var s = ["pending", "missing"];
  1666. t[1].attr("name", "taken");
  1667. t[1].html("已服");
  1668. t[1].removeClass(s[s.indexOf(t[1].attr("name"))]);
  1669. t[1].addClass("button");
  1670. break
  1671. }
  1672. }
  1673. }
  1674. };
  1675. var e = {
  1676. reset: function () {
  1677. c.w = h(window).width();
  1678. c.h = h(window).height();
  1679. h(".reSize").height(c.h / 2);
  1680. if (h("#ListCycle")) {
  1681. h("#ListCycle li").height(c.w * 0.96 / 2);
  1682. h("#ListCycle li").css("padding-top", c.w * 0.96 / 8);
  1683. h("#ListCycle").show()
  1684. }
  1685. if (h(".title_d").width() - h(".title").width() > 0) {
  1686. h(".title_d").addClass("round")
  1687. } else {
  1688. h(".title_d").removeClass("round")
  1689. }
  1690. var u = navigator.userAgent;
  1691. var t = u.toLowerCase();
  1692. function s() {
  1693. WeixinJSBridge.call("hideOptionMenu");
  1694. WeixinJSBridge.call("hideToolbar")
  1695. }
  1696. if (typeof WeixinJSBridge == "undefined") {
  1697. if (document.addEventListener) {
  1698. document.addEventListener("WeixinJSBridgeReady", s, false)
  1699. } else {
  1700. if (document.attachEvent) {
  1701. document.attachEvent("WeixinJSBridgeReady", s);
  1702. document.attachEvent("onWeixinJSBridgeReady", s)
  1703. }
  1704. }
  1705. } else {
  1706. s()
  1707. }
  1708. }
  1709. };
  1710. window.hzAPI = d;
  1711. window.login = o;
  1712. window.Fx = f;
  1713. window.validate = n;
  1714. window.calendar = g;
  1715. window.HoursDose = l;
  1716. window.DatePicker = j;
  1717. window.TimePicker = r;
  1718. window.timerBt = b;
  1719. window.counter = a;
  1720. window.planPerDay = q;
  1721. window.TabBlock = k;
  1722. window.icoNavFx = p;
  1723. window.config = c;
  1724. window.icoNav = m;
  1725. // window.apiUrl = "http://ywtwx.dept.nfyy.com/ywtapi/";
  1726. // window.apiUrl = 'http://homestead.app/dhapi/';
  1727. // window.apiUrl = "http://wxapi.demo.ywtinfo.com/dhapi/";
  1728. // window.apiUrl = "http://localhost:8094/dhapi/";
  1729. window.apiUrl = "http://homestead.app/dhapi/";
  1730. h(window).on("load", function () {
  1731. e.reset()
  1732. });
  1733. m.icoAddEvent()
  1734. })(Zepto);