base.min.js 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728
  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. 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>"
  649. }
  650. t += "</ul></div>";
  651. this.el.html(t);
  652. this._addEvent()
  653. }, _addEvent: function () {
  654. var s = this;
  655. this.el.find(".listNav li").bind("tap", function () {
  656. var t = 0;
  657. if (h(this).find("i").hasClass("*.home")) {
  658. t = 1
  659. }
  660. if (h(this).find("i").hasClass("*.dept")) {
  661. t = 2
  662. }
  663. if (h(this).find("i").hasClass("*.doctor")) {
  664. t = 3
  665. }
  666. if (h(this).find("i").hasClass("*.booking")) {
  667. t = 4
  668. }
  669. if (h(this).find("i").hasClass("*.like")) {
  670. t = 5
  671. }
  672. if (h(this).find("i").hasClass("*.favorite")) {
  673. t = 6
  674. }
  675. if (h(this).find("i").hasClass("*.drugCalendar")) {
  676. t = 7
  677. }
  678. if (h(this).find("i").hasClass("*.doctorCalendar")) {
  679. t = 8
  680. }
  681. window.location = s.options.urls[t]
  682. })
  683. }
  684. };
  685. var a = {
  686. show: function () {
  687. h("#popup_layer").addClass("show")
  688. }, close: function () {
  689. h("#popup_layer").removeClass("show");
  690. h(".popup_layer_cont").html("")
  691. }, getCount: function (s) {
  692. var s = h.extend({}, s);
  693. 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>';
  694. a.picker_selector_html += '<button id="cancel_counter_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>';
  695. a.picker_selector_html += '<button id="confirm_counter_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  696. h(".popup_layer_cont").html(a.picker_selector_html);
  697. var t = h("#counterValue");
  698. t.val(s.obj_callback.val());
  699. h("#counter_add").bind("tap", function () {
  700. if (parseInt(t.val()) < 0) {
  701. t.val(0)
  702. }
  703. t.val(parseInt(t.val()) + 1)
  704. });
  705. h("#counter_minus").bind("tap", function () {
  706. if (parseInt(t.val()) < 0) {
  707. t.val(0)
  708. }
  709. t.val(parseInt(t.val()) - 1)
  710. });
  711. h("#confirm_counter_picker").bind("tap", function () {
  712. if (typeof s.obj_callback == "object") {
  713. s.obj_callback.val(t.val())
  714. }
  715. a.close()
  716. });
  717. h("#cancel_counter_picker").bind("tap", function () {
  718. a.close()
  719. })
  720. }
  721. };
  722. var q = {
  723. getHours: function (t) {
  724. var s = t.substring(0, 2);
  725. return (s.substring(0, 1) == "0" ? s.substring(1, 2) : s)
  726. }, getPlanFromGroups: function (w, v) {
  727. var s = new Date().toDate(w);
  728. var u = {morning: [], afternoon: [], evening: [], night: []};
  729. var t = ["night", "morning", "afternoon", "evening"];
  730. h.each(v, function (B, A) {
  731. var x = new Date().toDate(A.startDate);
  732. var E = new Date().toDate(A.startDate);
  733. E.setDate(x.getDate() + A.days);
  734. var z, C = new Array();
  735. var y, D = 0;
  736. if (s >= x && s <= E) {
  737. z = A.consumptionHoursString.split(",");
  738. C = A.quantityString.split(",");
  739. for (i = 0; i < z.length; i++) {
  740. y = parseInt(q.getHours(z[i]));
  741. D = Math.floor(y / 6);
  742. u[t[D]].push({
  743. id: A.id,
  744. date: null,
  745. consumptionHours: z[i],
  746. drugName: A.drugName,
  747. quantity: C[i],
  748. doseType: A.doseType,
  749. status: "pending",
  750. statusCn: "待服"
  751. })
  752. }
  753. }
  754. });
  755. return u
  756. }, getPlanFromSchedules: function (x, w) {
  757. var t = new Date().toDate(x);
  758. var v = {morning: [], afternoon: [], evening: [], night: []};
  759. var u = ["night", "morning", "afternoon", "evening"];
  760. var z = {pending: "待服", missing: "漏服", taken: "已服"};
  761. var s, y = 0;
  762. h.each(w, function (C, A) {
  763. var B = new Date().toDate(A.originalDateTime);
  764. if ((B.getFullYear() == t.getFullYear()) && (B.getMonth() == t.getMonth()) && (B.getDate() == t.getDate())) {
  765. s = parseInt(q.getHours(A.consumptionHours));
  766. y = Math.floor(s / 6);
  767. v[u[y]].push({
  768. id: A.id,
  769. date: A.originalDateTime,
  770. consumptionHours: A.consumptionHours,
  771. drugName: A.drugName,
  772. quantity: A.quantity,
  773. doseType: A.doseType,
  774. status: A.status,
  775. statusCn: z[A.status]
  776. })
  777. }
  778. });
  779. return v
  780. }, getAllPlan: function (w, u) {
  781. var t = new Date().toDate(w);
  782. var v, s = null;
  783. var x = {dateTime: w, customerFamilyId: u};
  784. if (t <= new Date()) {
  785. v = window.apiUrl+"?c=Index&a=medicineSchedule";
  786. s = 0
  787. } else {
  788. v = window.apiUrl+"?c=Index&a=medicineScheduleGroups";
  789. s = 1
  790. }
  791. h.ajax({
  792. type: "get",
  793. url: v,
  794. dataType: "jsonp",
  795. data: h.extend(d.getToken(), x),
  796. jsonp: "callback",
  797. async: false,
  798. crossDomain: true,
  799. beforeSend: d.dialog(true),
  800. success: function (y) {
  801. y = y || {};
  802. if (d.setToken(y.dataToken)) {
  803. var z = null;
  804. if (y.dataInfo.status == "1") {
  805. if (s == 1) {
  806. z = q.getPlanFromGroups(w, y.dataInfo.data)
  807. } else {
  808. z = q.getPlanFromSchedules(w, y.dataInfo.data)
  809. }
  810. localStorage.setItem("out", JSON.stringify(z));
  811. q.showPlan(z);
  812. q.resetEvent();
  813. d.dialog(false, 300, null, null)
  814. } else {
  815. z = {morning: [], afternoon: [], evening: [], night: []};
  816. q.showPlan(z);
  817. localStorage.setItem("out", null);
  818. d.dialog(false, 2000, "当天无服药信息")
  819. }
  820. }
  821. },
  822. error: function (A, z, y) {
  823. d.dialog(false, 2000, "网络链接失败")
  824. },
  825. timeout: 9000
  826. })
  827. }, showPlan: function (t) {
  828. for (var u in t) {
  829. if (t[u].length > 0) {
  830. h("#" + u).html('<a vhref="drugPopPerDay.html?id=' + u + '"><i class="icon-drug"></i>' + t[u].length + "</a>")
  831. } else {
  832. h("#" + u).html("")
  833. }
  834. }
  835. var s = new Date().getHours();
  836. var v = ["nightTitle", "morningTitle", "afternoonTitle", "eveningTitle"],
  837. w = ["night", "morning", "afternoon", "evening"];
  838. h("#" + v[Math.floor(s / 6)]).addClass("doing");
  839. h("#" + w[Math.floor(s / 6)]).addClass("doing")
  840. }, resetEvent: function () {
  841. h("#ListCycle li a").bind("tap", function () {
  842. var s = {night: "凌晨", morning: "上午", afternoon: "下午", evening: "晚上"};
  843. title = "服用清单 - " + g.Y + "年" + (g.M + 1) + "月" + g.D + "日 " + s[h(this).parent().attr("id")];
  844. m.popWinLayer(h(this).attr("vhref") + "&date=" + g.Y + "-" + (g.M + 1) + "-" + g.D, title)
  845. })
  846. }
  847. };
  848. var f = {
  849. getUrlParam: function (s) {
  850. var t = new RegExp("(^|&)" + s + "=([^&]*)(&|$)");
  851. var u = window.location.search.substr(1).match(t);
  852. if (u != null) {
  853. return u[2]
  854. } else {
  855. return null
  856. }
  857. }, setNewDrugPlanList: function (x, u) {
  858. var y = "", t = 12 / (x - 1), s = 8, v = "08:00";
  859. for (var w = 1; w <= x; w++) {
  860. 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>';
  861. s += t;
  862. if (s > 9) {
  863. v = s
  864. } else {
  865. v = "0" + s
  866. }
  867. v += ":00"
  868. }
  869. u.html(y);
  870. u.find("li").bind("tap", function () {
  871. l.getList(h(this).find("[name='consumptionHours']"), h(this).find("[name='quantity']"));
  872. l.show()
  873. })
  874. }, getDrugHoursQuantity: function () {
  875. var s = "", t = "";
  876. h("#hours-quantity li").each(function (u) {
  877. if (u > 0) {
  878. s += ",";
  879. t += ","
  880. }
  881. s += h(this).find("input[type=text][name=consumptionHours]").val();
  882. t += h(this).find("input[type=text][name=quantity]").val()
  883. });
  884. return [s, t]
  885. }, setDrugPlanList: function (x, t) {
  886. var s = x.consumptionHoursString.split(",");
  887. var v = x.quantityString.split(",");
  888. var w = "";
  889. for (var u = 0; u < s.length; u++) {
  890. 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>'
  891. }
  892. t.html(w);
  893. t.find("li").bind("tap", function () {
  894. l.getList(h(this).find("[name='consumptionHours']"), h(this).find("[name='quantity']"));
  895. l.show()
  896. })
  897. }, getSelectOptionsText: function (t) {
  898. var s = "";
  899. t.find("option").forEach(function (u) {
  900. if (t.val() == h(u).val()) {
  901. s = h(u).text()
  902. }
  903. });
  904. return s
  905. }, getClass: function (s) {
  906. if (s) {
  907. return "is-active"
  908. } else {
  909. return ""
  910. }
  911. }
  912. };
  913. var l = {
  914. addZero: function (s) {
  915. return (s < 10 ? "0" + s : s)
  916. }, solarDays: function (u, t) {
  917. var s = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  918. if (t == 1) {
  919. return (((u % 4 == 0) && (u % 100 != 0) || (u % 400 == 0)) ? 29 : 28)
  920. } else {
  921. return (s[t])
  922. }
  923. }, show: function () {
  924. h("#popup_layer").addClass("show")
  925. }, close: function () {
  926. h("#popup_layer").removeClass("show");
  927. h(".popup_layer_cont").html("")
  928. }, getList: function (t, F) {
  929. var A = {hasSecond: false, isCustomLeftButton: false, customLeftButtonName: "清除"};
  930. l.picker_selector_html = '<div class="counterPickerTitle">设置服用时间</div><div class="datepickerscroll" id="hourpickerscroll"><div class="scroller"><ul id="hourpicker" class="listitem"></ul></div></div>';
  931. if (A.hasSecond) {
  932. l.picker_selector_html += '<div style="position: absolute;left: 72px;top: 52px;">:</div>';
  933. l.picker_selector_html += '<div style="position: absolute;left: 148px;top: 52px;">:</div>'
  934. } else {
  935. l.picker_selector_html += '<div style="position: absolute;left: 108px;top: 100px;">:</div>'
  936. }
  937. l.picker_selector_html += '<div class="datepickerscroll" id="minutepickerscroll"><div class="scroller"><ul id="minutepicker" class="listitem"></ul></div></div>';
  938. if (A.hasSecond) {
  939. l.picker_selector_html += '<div class="datepickerscroll" id="secondpickerscroll"><div class="scroller"><ul id="secondpicker" class="listitem"></ul></div></div>'
  940. }
  941. 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>';
  942. if (A.isCustomLeftButton) {
  943. l.picker_selector_html += '<button id="clear_date_picker" style="color: #000000;"' + A.customLeftButtonName + "</button>"
  944. } else {
  945. l.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>'
  946. }
  947. l.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  948. h(".popup_layer_cont").html(l.picker_selector_html);
  949. if (!A.hasSecond) {
  950. h("#hourpickerscroll").css("width", "50%");
  951. h("#minutepickerscroll").css("width", "50%")
  952. }
  953. var u = "<li>&nbsp;</li>", C = '<li id="hourli-1">&nbsp;</li>', w = '<li id="minuteli-1">&nbsp;</li>',
  954. s = '<li id="secondli-1">&nbsp;</li>';
  955. var D = h("#hourpicker"), x = h("#minutepicker"), v = null;
  956. if (A.hasSecond) {
  957. v = h("#secondpicker")
  958. }
  959. var B = (typeof selectedDate == "object") ? selectedDate : new Date();
  960. var y = t.val().split(":");
  961. B.setHours(parseInt(y[0]));
  962. B.setMinutes(parseInt(y[1]));
  963. l.hourSelected = B.getHours();
  964. l.minuteSelected = B.getMinutes();
  965. l.secondSelected = B.getSeconds();
  966. for (var z = 0; z < 24; z++) {
  967. C += '<li class="hourli" id="hourli' + z + '">' + l.addZero(z) + "</li>"
  968. }
  969. for (var z = 0; z < 60; z++) {
  970. w += '<li class="minuteli" id="minuteli' + z + '">' + l.addZero(z) + "</li>"
  971. }
  972. for (var z = 0; z < 60; z++) {
  973. s += '<li class="secondli" id="secondli' + z + '">' + l.addZero(z) + "</li>"
  974. }
  975. C += u;
  976. w += u;
  977. s += u;
  978. D.html(C);
  979. x.html(w);
  980. if (A.hasSecond) {
  981. v.html(s)
  982. }
  983. l.hourScroll = new IScroll("#hourpickerscroll", {scrollbars: false, snap: "li"});
  984. l.minuteScroll = new IScroll("#minutepickerscroll", {scrollbars: false, snap: "li"});
  985. if (A.hasSecond) {
  986. l.secondScroll = new IScroll("#secondpickerscroll", {scrollbars: false, snap: "li"})
  987. }
  988. l.hourScroll.scrollToElement("#hourli" + (B.getHours() - 1), 0);
  989. h("#hourli" + B.getHours()).addClass("selectedli");
  990. l.minuteScroll.scrollToElement("#minuteli" + (B.getMinutes() - 1), 0);
  991. h("#minuteli" + B.getMinutes()).addClass("selectedli");
  992. if (A.hasSecond) {
  993. l.secondScroll.scrollToElement("#secondli" + (B.getSeconds() - 1), 0);
  994. h("#secondli" + B.getSeconds()).addClass("selectedli")
  995. }
  996. l.hourScroll.on("scrollEnd", function (G) {
  997. h(".hourli").removeClass("selectedli");
  998. var H = Math.round(l.hourScroll.y / (-41));
  999. l.hourSelected = H;
  1000. h("#hourli" + H).addClass("selectedli")
  1001. });
  1002. l.minuteScroll.on("scrollEnd", function (H) {
  1003. h(".minuteli").removeClass("selectedli");
  1004. var G = Math.round(l.minuteScroll.y / (-41));
  1005. l.minuteSelected = G;
  1006. h("#minuteli" + G).addClass("selectedli")
  1007. });
  1008. if (A.hasSecond) {
  1009. l.secondScroll.on("scrollEnd", function (H) {
  1010. h(".secondli").removeClass("selectedli");
  1011. var G = Math.round(l.secondScroll.y / (-41));
  1012. l.secondSelected = G;
  1013. h("#secondli" + G).addClass("selectedli")
  1014. })
  1015. }
  1016. var E = h("#counterValue");
  1017. E.val(F.val());
  1018. h("#counter_add").bind("tap", function () {
  1019. E.val((Number(E.val()) + 0.25).toFixed(2))
  1020. });
  1021. h("#counter_minus").bind("tap", function () {
  1022. if (Number(E.val()) <= 0) {
  1023. E.val("0.00")
  1024. } else {
  1025. E.val((Number(E.val() - 0.25).toFixed(2)))
  1026. }
  1027. });
  1028. h("#confirm_date_picker").bind("tap", function () {
  1029. var J = new Date(B.getFullYear(), B.getMonth(), B.getDate(), l.hourSelected, l.minuteSelected, A.hasSecond ? l.secondSelected : 0),
  1030. I = J.getFullYear() + "-" + (J.getMonth() + 1) + "-" + J.getDate() + " " + l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes()) + ":" + l.addZero(J.getSeconds()),
  1031. H = J.getFullYear() + "-" + (J.getMonth() + 1) + "-" + J.getDate(), G = "";
  1032. if (A.hasSecond) {
  1033. G = l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes()) + ":" + l.addZero(J.getSeconds())
  1034. } else {
  1035. G = l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes())
  1036. }
  1037. if (typeof t == "object" && typeof F == "object") {
  1038. t.val(G);
  1039. F.val(E.val())
  1040. }
  1041. l.close()
  1042. });
  1043. h("#cancel_date_picker").bind("tap", function () {
  1044. l.close()
  1045. })
  1046. }
  1047. };
  1048. var k = {
  1049. init: function () {
  1050. k.bindUIActions();
  1051. k.hideInactive()
  1052. }, bindUIActions: function () {
  1053. h(".tabBlock-tab").on("tap", function () {
  1054. k.switchTab(h(this))
  1055. })
  1056. }, hideInactive: function () {
  1057. var s = h(".tabBlock");
  1058. s.each(function (v) {
  1059. var u = h(s[v]), t = u.find(".tabBlock-pane"), w = u.find(".tabBlock-tab.is-active");
  1060. t.hide();
  1061. h(t[w.index()]).show()
  1062. })
  1063. }, switchTab: function (s) {
  1064. if (!s.hasClass("is-active")) {
  1065. s.siblings().removeClass("is-active");
  1066. s.addClass("is-active");
  1067. k.showPane(s.index())
  1068. }
  1069. }, showPane: function (t) {
  1070. var s = h(".tabBlock-content .lists");
  1071. s.each(function (u) {
  1072. if (!h(this).hasClass("hide")) {
  1073. h(this).addClass("hide")
  1074. }
  1075. if (u == t) {
  1076. h(this).removeClass("hide")
  1077. }
  1078. })
  1079. }
  1080. };
  1081. var r = {
  1082. show: function () {
  1083. h("#popup_layer").addClass("show")
  1084. }, close: function () {
  1085. h("#popup_layer").removeClass("show");
  1086. h(".popup_layer_cont").html("")
  1087. }, getList: function (w) {
  1088. var z = {hasSecond: false, isCustomLeftButton: false, customLeftButtonName: "清除"};
  1089. r.picker_selector_html = '<div class="datepickerscroll" id="hourpickerscroll"><div class="scroller"><ul id="hourpicker" class="listitem"></ul></div></div>';
  1090. if (z.hasSecond) {
  1091. r.picker_selector_html += '<div style="position: absolute;left: 72px;top: 52px;">:</div>';
  1092. r.picker_selector_html += '<div style="position: absolute;left: 148px;top: 52px;">:</div>'
  1093. } else {
  1094. r.picker_selector_html += '<div style="position: absolute;left: 108px;top: 52px;">:</div>'
  1095. }
  1096. r.picker_selector_html += '<div class="datepickerscroll" id="minutepickerscroll"><div class="scroller"><ul id="minutepicker" class="listitem"></ul></div></div>';
  1097. if (z.hasSecond) {
  1098. r.picker_selector_html += '<div class="datepickerscroll" id="secondpickerscroll"><div class="scroller"><ul id="secondpicker" class="listitem"></ul></div></div>'
  1099. }
  1100. if (z.isCustomLeftButton) {
  1101. r.picker_selector_html += '<button id="clear_date_picker" style="color: #000000;"' + z.customLeftButtonName + "</button>"
  1102. } else {
  1103. r.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>'
  1104. }
  1105. r.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  1106. h(".popup_layer_cont").html(r.picker_selector_html);
  1107. if (!z.hasSecond) {
  1108. h("#hourpickerscroll").css("width", "50%");
  1109. h("#minutepickerscroll").css("width", "50%")
  1110. }
  1111. var t = "<li>&nbsp;</li>", B = '<li id="hourli-1">&nbsp;</li>', v = '<li id="minuteli-1">&nbsp;</li>',
  1112. s = '<li id="secondli-1">&nbsp;</li>';
  1113. var C = h("#hourpicker"), x = h("#minutepicker"), u = null;
  1114. if (z.hasSecond) {
  1115. u = h("#secondpicker")
  1116. }
  1117. var A = (typeof selectedDate == "object") ? selectedDate : new Date();
  1118. r.hourSelected = A.getHours();
  1119. r.minuteSelected = A.getMinutes();
  1120. r.secondSelected = A.getSeconds();
  1121. for (var y = 0; y < 24; y++) {
  1122. B += '<li class="hourli" id="hourli' + y + '">' + l.addZero(y) + "</li>"
  1123. }
  1124. for (var y = 0; y < 60; y++) {
  1125. v += '<li class="minuteli" id="minuteli' + y + '">' + l.addZero(y) + "</li>"
  1126. }
  1127. for (var y = 0; y < 60; y++) {
  1128. s += '<li class="secondli" id="secondli' + y + '">' + l.addZero(y) + "</li>"
  1129. }
  1130. B += t;
  1131. v += t;
  1132. s += t;
  1133. C.html(B);
  1134. x.html(v);
  1135. if (z.hasSecond) {
  1136. u.html(s)
  1137. }
  1138. r.hourScroll = new IScroll("#hourpickerscroll", {scrollbars: false, snap: "li"});
  1139. r.minuteScroll = new IScroll("#minutepickerscroll", {scrollbars: false, snap: "li"});
  1140. if (z.hasSecond) {
  1141. r.secondScroll = new IScroll("#secondpickerscroll", {scrollbars: false, snap: "li"})
  1142. }
  1143. r.hourScroll.scrollToElement("#hourli" + (A.getHours() - 1), 0);
  1144. h("#hourli" + A.getHours()).addClass("selectedli");
  1145. r.minuteScroll.scrollToElement("#minuteli" + (A.getMinutes() - 1), 0);
  1146. h("#minuteli" + A.getMinutes()).addClass("selectedli");
  1147. if (z.hasSecond) {
  1148. r.secondScroll.scrollToElement("#secondli" + (A.getSeconds() - 1), 0);
  1149. h("#secondli" + A.getSeconds()).addClass("selectedli")
  1150. }
  1151. r.hourScroll.on("scrollEnd", function (D) {
  1152. h(".hourli").removeClass("selectedli");
  1153. var E = Math.round(r.hourScroll.y / (-41));
  1154. r.hourSelected = E;
  1155. h("#hourli" + E).addClass("selectedli")
  1156. });
  1157. r.minuteScroll.on("scrollEnd", function (E) {
  1158. h(".minuteli").removeClass("selectedli");
  1159. var D = Math.round(r.minuteScroll.y / (-41));
  1160. r.minuteSelected = D;
  1161. h("#minuteli" + D).addClass("selectedli")
  1162. });
  1163. if (z.hasSecond) {
  1164. r.secondScroll.on("scrollEnd", function (E) {
  1165. h(".secondli").removeClass("selectedli");
  1166. var D = Math.round(r.secondScroll.y / (-41));
  1167. r.secondSelected = D;
  1168. h("#secondli" + D).addClass("selectedli")
  1169. })
  1170. }
  1171. h("#confirm_date_picker").bind("tap", function () {
  1172. var G = new Date(A.getFullYear(), A.getMonth(), A.getDate(), r.hourSelected, r.minuteSelected, z.hasSecond ? r.secondSelected : 0),
  1173. F = G.getFullYear() + "-" + (G.getMonth() + 1) + "-" + G.getDate() + " " + l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes()) + ":" + l.addZero(G.getSeconds()),
  1174. E = G.getFullYear() + "-" + (G.getMonth() + 1) + "-" + G.getDate(), D = "";
  1175. if (z.hasSecond) {
  1176. D = l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes()) + ":" + l.addZero(G.getSeconds())
  1177. } else {
  1178. D = l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes())
  1179. }
  1180. if (typeof w == "object") {
  1181. w.val(D)
  1182. }
  1183. r.close()
  1184. });
  1185. h("#cancel_date_picker").bind("tap", function () {
  1186. r.close()
  1187. })
  1188. }
  1189. };
  1190. var j = {
  1191. show: function () {
  1192. h("#popup_layer").addClass("show")
  1193. }, close: function () {
  1194. h("#popup_layer").removeClass("show");
  1195. h(".popup_layer_cont").html("")
  1196. }, reCountDay: function () {
  1197. var u = parseInt(solarDays(j.yearSelected, (parseInt(j.monthSelected) - 1)));
  1198. var t = '<li id="dayli0">&nbsp;</li>';
  1199. for (var s = 1; s <= u; s++) {
  1200. t += '<li class="dayli" id="dayli' + s + '">' + l.addZero(s) + "</li>"
  1201. }
  1202. t += "<li>&nbsp;</li>";
  1203. h("#daypicker").html(t);
  1204. j.dayScroll.destroy();
  1205. j.dayScroll = new IScroll("#daypickerscroll", {scrollbars: false, snap: "li"});
  1206. if (j.daySelected > u) {
  1207. j.dayScroll.scrollToElement("#dayli" + (u - 1), 0);
  1208. h("#dayli" + u).addClass("selectedli");
  1209. j.daySelected = u
  1210. } else {
  1211. j.dayScroll.scrollToElement("#dayli" + (parseInt(j.daySelected) - 1), 0);
  1212. h("#dayli" + parseInt(j.daySelected)).addClass("selectedli")
  1213. }
  1214. j.dayScroll.off("scrollEnd");
  1215. j.dayScroll.on("scrollEnd", function (w) {
  1216. h(".dayli").removeClass("selectedli");
  1217. var v = Math.round(j.dayScroll.y / (-41) + 1);
  1218. j.daySelected = v;
  1219. h("#dayli" + v).addClass("selectedli")
  1220. })
  1221. }, getList: function (v) {
  1222. var x = {isCustomLeftButton: false};
  1223. 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>';
  1224. if (x.isCustomLeftButton) {
  1225. j.picker_selector_html += '<button id="clear_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">' + x.customLeftButtonName + "</button>"
  1226. } else {
  1227. j.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8; color: #000000;">取消</button>'
  1228. }
  1229. j.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
  1230. h(".popup_layer_cont").html(j.picker_selector_html);
  1231. var t = "<li>&nbsp;</li>", C = '<li id="yearli1899">&nbsp;</li>', A = '<li id="monthli0">&nbsp;</li>',
  1232. u = '<li id="dayli0">&nbsp;</li>';
  1233. var s = h("#yearpicker"), z = h("#monthpicker"), B = h("#daypicker");
  1234. if (v.val()) {
  1235. selectedDate = new Date().toDate(v.val())
  1236. }
  1237. var y = (typeof selectedDate == "object") ? selectedDate : new Date();
  1238. j.yearSelected = y.getFullYear();
  1239. j.monthSelected = y.getMonth() + 1;
  1240. j.daySelected = y.getDate();
  1241. for (var w = 1900; w < 2050; w++) {
  1242. C += '<li class="yearli" id="yearli' + w + '">' + w + "</li>"
  1243. }
  1244. for (var w = 1; w < 13; w++) {
  1245. A += '<li class="monthli" id="monthli' + w + '">' + w + "月</li>"
  1246. }
  1247. var D = solarDays(j.yearSelected, (parseInt(j.monthSelected) - 1));
  1248. for (var w = 1; w <= D; w++) {
  1249. u += '<li class="dayli" id="dayli' + w + '">' + l.addZero(w) + "</li>"
  1250. }
  1251. C += t;
  1252. A += t;
  1253. u += t;
  1254. s.html(C);
  1255. z.html(A);
  1256. B.html(u);
  1257. j.yearScroll = new IScroll("#yearpickerscroll", {mouseWheel: false, scrollbars: false, snap: "li"});
  1258. j.monthScroll = new IScroll("#monthpickerscroll", {mouseWheel: false, scrollbars: false, snap: "li"});
  1259. j.dayScroll = new IScroll("#daypickerscroll", {mouseWheel: false, scrollbars: false, snap: "li"});
  1260. j.yearScroll.scrollToElement("#yearli" + (y.getFullYear() - 1), 0);
  1261. h("#yearli" + y.getFullYear()).addClass("selectedli");
  1262. j.monthScroll.scrollToElement("#monthli" + y.getMonth(), 0);
  1263. h("#monthli" + (y.getMonth() + 1)).addClass("selectedli");
  1264. j.dayScroll.scrollToElement("#dayli" + (y.getDate() - 1), 0);
  1265. h("#dayli" + y.getDate()).addClass("selectedli");
  1266. j.yearScroll.on("scrollEnd", function (F) {
  1267. h(".yearli").removeClass("selectedli");
  1268. var E = Math.round(j.yearScroll.y / (-41) + 1900);
  1269. j.yearSelected = E;
  1270. h("#yearli" + E).addClass("selectedli");
  1271. j.reCountDay()
  1272. });
  1273. j.monthScroll.on("scrollEnd", function (F) {
  1274. h(".monthli").removeClass("selectedli");
  1275. var E = Math.round(j.monthScroll.y / (-41) + 1);
  1276. j.monthSelected = E;
  1277. h("#monthli" + E).addClass("selectedli");
  1278. j.reCountDay()
  1279. });
  1280. j.dayScroll.on("scrollEnd", function (F) {
  1281. h(".dayli").removeClass("selectedli");
  1282. var E = Math.round(j.dayScroll.y / (-41) + 1);
  1283. j.daySelected = E;
  1284. h("#dayli" + E).addClass("selectedli")
  1285. });
  1286. h("#confirm_date_picker").bind("tap", function () {
  1287. var H = new Date(j.yearSelected, j.monthSelected - 1, j.daySelected, y.getHours(), y.getMinutes(), y.getSeconds()),
  1288. G = H.getFullYear() + "-" + (H.getMonth() + 1) + "-" + H.getDate() + " " + l.addZero(H.getHours()) + ":" + l.addZero(H.getMinutes()) + ":" + l.addZero(H.getSeconds()),
  1289. F = H.getFullYear() + "-" + (H.getMonth() + 1) + "-" + H.getDate(),
  1290. E = l.addZero(H.getHours()) + ":" + l.addZero(H.getMinutes()) + ":" + l.addZero(H.getSeconds());
  1291. if (typeof v == "object") {
  1292. v.val(F)
  1293. }
  1294. j.close()
  1295. });
  1296. h("#cancel_date_picker").bind("tap", function () {
  1297. j.close()
  1298. })
  1299. }
  1300. };
  1301. var b = {
  1302. wait: 59, updateTimer: function (s) {
  1303. if (b.wait == 0) {
  1304. h(s).val("重新发送");
  1305. h(s).removeAttr("disabled");
  1306. h(s).css({color: "#438eff", "text-align": "left"})
  1307. } else {
  1308. if (b.wait == 59) {
  1309. if (!h(s).attr("disabled")) {
  1310. h(s).attr("disabled", "disabled")
  1311. }
  1312. h(s).css({color: "#b3b3b3", "text-align": "left"})
  1313. }
  1314. h(s).val("重新发送(" + b.wait + ")");
  1315. b.wait--;
  1316. setTimeout(function () {
  1317. b.updateTimer(s)
  1318. }, 1000)
  1319. }
  1320. }
  1321. };
  1322. var n = {
  1323. rules: {
  1324. email: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,4}){1,2})$/,
  1325. 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})?(\/+.*)*$/,
  1326. counter: /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/,
  1327. number: /^\\-?\\d+(\\.\\d+)?$/,
  1328. tel: /\d{3}-\d{8}|\d{4}-\d{7}/,
  1329. 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}$/,
  1330. zipCode: /[1-9]\d{5}(?!\d)/,
  1331. 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])$)$/,
  1332. date: /^\d{4}-\d{1,2}-\d{1,2}/,
  1333. password: /^[a-zA-Z]\w{5,17}$/,
  1334. smsCode: /\d{6}$/,
  1335. cardId: /\d{8}$/,
  1336. address: /^[\s\S]{10,}$/,
  1337. select: /^[\s\S]{1,}$/,
  1338. message: {
  1339. radio: "请选择一个选项",
  1340. checkbox: "如果要继续,请选中此框",
  1341. select: "请选择列表中的一项",
  1342. email: "请输入正确的电子邮件地址",
  1343. url: "请输入正确网站地址",
  1344. tel: "请输入正确的电话号码",
  1345. phone: "请输入正确的手机号码",
  1346. idNo: "请输入正确身份证号码",
  1347. number: "请输入数字",
  1348. date: "请输入正确的日期格式",
  1349. pattern: "内容格式不符合要求",
  1350. empty: "请填写此字段",
  1351. password: "长度6~18,字母开头,含字母数字下划线",
  1352. smsCode: "请输入正确的手机短信验证码",
  1353. cardId: "请输入正确的诊疗卡号码",
  1354. address: "地址长度要大于10个汉字",
  1355. select: "请选择"
  1356. }
  1357. }, matchId: {password: "#password", message: {password: "2次密码输入不一致"}}, check: function (s) {
  1358. if (h("#noValidate")) {
  1359. h("#noValidate").remove()
  1360. }
  1361. var u = h(s).find("input,select").length - 1, t = false;
  1362. h(s).find("input,select").each(function (v) {
  1363. h(this).unbind("tap");
  1364. if (h(this).attr("required")) {
  1365. var w = h(this).attr("required");
  1366. if (n.rules[w]) {
  1367. if (h(this).val().match(n.rules[w])) {
  1368. } else {
  1369. n.tips(this, n.rules.message[w]);
  1370. return false
  1371. }
  1372. } else {
  1373. if (h(this).val().length < 1) {
  1374. n.tips(this, n.rules.message.empty);
  1375. return false
  1376. }
  1377. }
  1378. }
  1379. if (h(this).attr("format")) {
  1380. var w = h(this).attr("format");
  1381. if (n.rules[w] && h(this).val().length > 0) {
  1382. if (h(this).val().match(n.rules[w])) {
  1383. } else {
  1384. n.tips(this, n.rules.message[w]);
  1385. return false
  1386. }
  1387. }
  1388. }
  1389. if (h(this).attr("matchId")) {
  1390. var w = h(this).attr("matchId");
  1391. if (n.matchId[w]) {
  1392. if (h(this).val() == h(n.matchId[w]).val()) {
  1393. } else {
  1394. n.tips(this, n.matchId.message[w]);
  1395. return false
  1396. }
  1397. }
  1398. }
  1399. if (u == v) {
  1400. t = true
  1401. }
  1402. });
  1403. return t
  1404. }, tips: function (w, v) {
  1405. var s = {
  1406. border: "1px solid rgb(247, 206, 57)",
  1407. "text-align": "left",
  1408. color: "rgb(51, 51, 51)",
  1409. "font-size": "0.8rem",
  1410. padding: "5px 10px",
  1411. position: "relative",
  1412. "border-radius": "4px",
  1413. "line-height": "0.8rem",
  1414. top: "0",
  1415. "background-color": "rgb(255, 255, 224)",
  1416. "z-index": "1"
  1417. }, t = {
  1418. "border-color": "transparent transparent rgb(247, 206, 57)",
  1419. "border-style": "dashed dashed solid",
  1420. bottom: "0px",
  1421. width: "0px; height: 0px",
  1422. overflow: "hidden",
  1423. "border-width": "6px; position: absolute",
  1424. top: "-13px"
  1425. }, u = {
  1426. "border-color": "transparent transparent rgb(255, 255, 224)",
  1427. "border-style": "dashed dashed solid; bottom: -1px",
  1428. width: "0px",
  1429. height: "0px",
  1430. overflow: "hidden",
  1431. "border-width": "6px; position: absolute",
  1432. top: "-12px"
  1433. };
  1434. var x = h('<div id="noValidate"><div class="front"></div><div class="back"></div>' + v + "</div>").css(s);
  1435. h(w).parent().append(x);
  1436. h("#noValidate div.front").css(t);
  1437. h("#noValidate div.back").css(u);
  1438. h(w).on("tap", function () {
  1439. h("#noValidate").remove()
  1440. });
  1441. h(w)[0].focus()
  1442. }
  1443. };
  1444. var m = {
  1445. ton: function (s) {
  1446. h(s).on("touchstart touchmove touchend", function (t) {
  1447. if (t.type == "touchstart") {
  1448. h(this).addClass("ton")
  1449. } else {
  1450. if (t.type == "touchmove") {
  1451. h(this).removeClass("ton")
  1452. } else {
  1453. h(this).removeClass("ton")
  1454. }
  1455. }
  1456. })
  1457. }, popWinLayer: function (u, t, s) {
  1458. if (t) {
  1459. h(".asort .fl span").text(t)
  1460. }
  1461. if (u) {
  1462. h("#newwrap").attr("src", u);
  1463. h(".asort").eq(0).addClass("show")
  1464. } else {
  1465. h(".asort").eq(s).addClass("show")
  1466. }
  1467. h(".hzApp-over-layer").addClass("show")
  1468. }, closeWinLayer: function () {
  1469. h(".hzApp-over-layer").removeClass("show");
  1470. setTimeout(function () {
  1471. h(".hzApp-over-layer .asort").removeClass("show")
  1472. }, 100);
  1473. try {
  1474. reload.doing()
  1475. } catch (s) {
  1476. }
  1477. }, icoAddEvent: function () {
  1478. m.ton("header i, .hd .fr, .hd .fl i, A.btn-large");
  1479. if (h(".menu_home")) {
  1480. h(".menu_home").on("touchend", function () {
  1481. setTimeout(function () {
  1482. window.location.href = "index.html"
  1483. }, 200)
  1484. })
  1485. }
  1486. if (h(".menu_back")) {
  1487. h(".menu_back").on("tap", function () {
  1488. window.history.back()
  1489. })
  1490. }
  1491. if (h(".menu_todo")) {
  1492. h(".menu_todo").on("tap", function () {
  1493. if (h(this).hasClass("tap")) {
  1494. h(this).removeClass("tap");
  1495. h("#todo").removeClass("show")
  1496. } else {
  1497. h(this).addClass("tap");
  1498. h("#todo").addClass("show")
  1499. }
  1500. })
  1501. }
  1502. if (h(".selectToggle")) {
  1503. h(".selectToggle .top-nav").on("tap", function () {
  1504. if (h(".selectToggle .arrow-box i").hasClass("icon-arrowdown")) {
  1505. h(".selectToggle ul").css({display: "block"});
  1506. h(".selectToggle .arrow-box i").removeClass("icon-arrowdown");
  1507. h(".selectToggle .arrow-box i").addClass("icon-arrowup");
  1508. h(".selectToggle .marginall .text").html("")
  1509. } else {
  1510. h(".selectToggle ul").css({display: "none"});
  1511. h(".selectToggle .arrow-box i").removeClass("icon-arrowup");
  1512. h(".selectToggle .arrow-box i").addClass("icon-arrowdown");
  1513. h(".selectToggle .marginall .text").html(h(".selectToggle ul li.selected").html())
  1514. }
  1515. })
  1516. }
  1517. if (h(".menu_family")) {
  1518. h(".menu_family").on("tap", function () {
  1519. if (h(this).hasClass("tap")) {
  1520. h(this).removeClass("tap");
  1521. h("#family_todo").removeClass("show")
  1522. } else {
  1523. h(this).addClass("tap");
  1524. h("#family_todo").addClass("show")
  1525. }
  1526. })
  1527. }
  1528. if (h("#todo .todo_msk")) {
  1529. h("#todo .todo_msk").on("tap", function () {
  1530. h("#todo").removeClass("show");
  1531. h(".menu_todo").removeClass("tap")
  1532. })
  1533. }
  1534. if (h("#family_todo .todo_msk")) {
  1535. h("#family_todo .todo_msk").on("tap", function () {
  1536. h("#family_todo").removeClass("show");
  1537. h(".menu_family").removeClass("tap")
  1538. })
  1539. }
  1540. if (h("#todo td")) {
  1541. h("#todo td").on("touchend", function () {
  1542. var s = h(this).find("a").attr("vhref");
  1543. if (h("#family_todo .ck").parent().attr("data")) {
  1544. var t = JSON.parse(h("#family_todo .ck").parent().attr("data"));
  1545. s += "?id=" + t.id
  1546. }
  1547. m.popWinLayer(s, h(this).find("label").text(), h(this).parent().index());
  1548. h(".menu_todo").trigger("tap")
  1549. })
  1550. }
  1551. if (h(".menu_close_layer,.hd .fr i.icon-del")) {
  1552. h(".menu_close_layer,.hd .fr i.icon-del").on("tap", function () {
  1553. m.closeWinLayer()
  1554. })
  1555. }
  1556. }, icoEventCallback: function (s) {
  1557. if (!s) {
  1558. s = 0
  1559. }
  1560. switch (s) {
  1561. case 1:
  1562. h(".alist .button").on("tap", function () {
  1563. d.sendData(window.apiUrl+"?c=Index&a=favoriteHospital", JSON.parse(h(this).parent().attr("data")), false, ["更新失败", "更新成功"], [0, h(this)])
  1564. });
  1565. break;
  1566. case 2:
  1567. h(".alist .button").on("tap", function () {
  1568. d.sendData(window.apiUrl+"?c=Index&a=favoriteDoctor", JSON.parse(h(this).parent().attr("data")), false, ["更新失败", "更新成功"], [0, h(this)])
  1569. });
  1570. break;
  1571. case 3:
  1572. h("#list ul").append('<li class="line1 bar hide"></li>');
  1573. h("li.line1.bar").on("tap", function () {
  1574. if (h(this).hasClass("title")) {
  1575. h(this).removeClass("title");
  1576. h(this).find("i").removeClass("icon-arrowup").addClass("icon-arrowdown");
  1577. t(h(this), false)
  1578. } else {
  1579. h(this).addClass("title");
  1580. h(this).find("i").removeClass("icon-arrowdown").addClass("icon-arrowup");
  1581. t(h(this), true)
  1582. }
  1583. function t(w, u) {
  1584. var v = w.next();
  1585. while (!v.hasClass("bar")) {
  1586. if (u) {
  1587. v.removeClass("hide")
  1588. } else {
  1589. v.addClass("hide")
  1590. }
  1591. v = v.next()
  1592. }
  1593. }
  1594. });
  1595. break;
  1596. case 4:
  1597. h(".selectToggle ul").css({display: "none"});
  1598. h(".selectToggle .marginall .text").html(h(".selectToggle ul li.selected").find("a").html());
  1599. reload.doing();
  1600. h(".selectToggle ul li").on("tap", function () {
  1601. h(".selectToggle ul li").each(function () {
  1602. if (h(this).hasClass("selected")) {
  1603. h(this).removeClass("selected");
  1604. h(this).find("i").removeClass("icon-radioCheck");
  1605. h(this).find("i").addClass("icon-radio")
  1606. }
  1607. });
  1608. h(this).addClass("selected");
  1609. h(this).find("i").removeClass("icon-radio");
  1610. h(this).find("i").addClass("icon-radioCheck");
  1611. h(".selectToggle .arrow-box i").removeClass("icon-arrowup");
  1612. h(".selectToggle .arrow-box i").addClass("icon-arrowdown");
  1613. h(".selectToggle .marginall .text").html(h(this).find("a").html());
  1614. h(".selectToggle ul").css({display: "none"});
  1615. var t = JSON.parse(h(this).find("a").attr("data"));
  1616. var u = h("#header p").text();
  1617. h("#header p").text(t.trueName + u.substring(u.indexOf("的"), u.length));
  1618. reload.doing()
  1619. });
  1620. break;
  1621. case 5:
  1622. h("#drugName").val("");
  1623. h("#frequency").val(1);
  1624. h("#doseType").val("片");
  1625. h("#start_date").val(new Date().format("yyyy-M-dd"));
  1626. h("#diagnose").val("");
  1627. h("#source").val("");
  1628. break;
  1629. case 6:
  1630. h("input[name=customerFamilyId]").eq(0).attr("checked", "checked");
  1631. break;
  1632. case 7:
  1633. h(".asort .fr").trigger("tap");
  1634. h("input[name=customerFamilyId]").eq(0).attr("checked", "checked");
  1635. break;
  1636. case 8:
  1637. break
  1638. }
  1639. }, switchStatus: function (t) {
  1640. if (t) {
  1641. switch (t[0]) {
  1642. case 0:
  1643. if (t[1].attr("name") == "del") {
  1644. t[1].attr("name", "add");
  1645. t[1].text("添加");
  1646. t[1].siblings(".selected").css("display", "none")
  1647. } else {
  1648. t[1].attr("name", "del");
  1649. t[1].text("取消");
  1650. t[1].siblings(".selected").css("display", "block")
  1651. }
  1652. break;
  1653. case 1:
  1654. var s = ["pending", "missing"];
  1655. t[1].attr("name", "taken");
  1656. t[1].html("已服");
  1657. t[1].removeClass(s[s.indexOf(t[1].attr("name"))]);
  1658. t[1].addClass("button");
  1659. break
  1660. }
  1661. }
  1662. }
  1663. };
  1664. var e = {
  1665. reset: function () {
  1666. c.w = h(window).width();
  1667. c.h = h(window).height();
  1668. h(".reSize").height(c.h / 2);
  1669. if (h("#ListCycle")) {
  1670. h("#ListCycle li").height(c.w * 0.96 / 2);
  1671. h("#ListCycle li").css("padding-top", c.w * 0.96 / 8);
  1672. h("#ListCycle").show()
  1673. }
  1674. if (h(".title_d").width() - h(".title").width() > 0) {
  1675. h(".title_d").addClass("round")
  1676. } else {
  1677. h(".title_d").removeClass("round")
  1678. }
  1679. var u = navigator.userAgent;
  1680. var t = u.toLowerCase();
  1681. function s() {
  1682. WeixinJSBridge.call("hideOptionMenu");
  1683. WeixinJSBridge.call("hideToolbar")
  1684. }
  1685. if (typeof WeixinJSBridge == "undefined") {
  1686. if (document.addEventListener) {
  1687. document.addEventListener("WeixinJSBridgeReady", s, false)
  1688. } else {
  1689. if (document.attachEvent) {
  1690. document.attachEvent("WeixinJSBridgeReady", s);
  1691. document.attachEvent("onWeixinJSBridgeReady", s)
  1692. }
  1693. }
  1694. } else {
  1695. s()
  1696. }
  1697. }
  1698. };
  1699. window.hzAPI = d;
  1700. window.login = o;
  1701. window.Fx = f;
  1702. window.validate = n;
  1703. window.calendar = g;
  1704. window.HoursDose = l;
  1705. window.DatePicker = j;
  1706. window.TimePicker = r;
  1707. window.timerBt = b;
  1708. window.counter = a;
  1709. window.planPerDay = q;
  1710. window.TabBlock = k;
  1711. window.icoNavFx = p;
  1712. window.config = c;
  1713. window.icoNav = m;
  1714. // window.apiUrl = "http://ywtwx.dept.nfyy.com/ywtapi/";
  1715. // window.apiUrl = 'http://homestead.app/dhapi/';
  1716. // window.apiUrl = "http://wxapi.demo.ywtinfo.com/dhapi/";
  1717. // window.apiUrl = "http://localhost:8094/dhapi/";
  1718. window.apiUrl = "http://homestead.app/dhapi/";
  1719. h(window).on("load", function () {
  1720. e.reset()
  1721. });
  1722. m.icoAddEvent()
  1723. })(Zepto);