123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740 |
- (function (h) {
- var c = {
- options: { sysName: "南方医务通" }, init: function () {
- h("head title").text("南方医务通");
- var s = d.version.getVer();
- if (s) {
- h("link").each(function () {
- h(this).attr("href", h(this).attr("href") + "?v=" + s.version)
- });
- h("script").each(function () {
- h(this).attr("src", h(this).attr("src") + "?v=" + s.version)
- })
- }
- }
- };
- var o = {
- js_Fx_uuid: function (t, s) {
- o.ck(t, s)
- }, android_Fx_uuid: function () {
- try {
- android.js_Fx_uuid()
- } catch (s) {
- o.ck()
- }
- }, ck: function (t, s) {
- var u = { loginName: h("#loginName").val(), password: h("#password").val(), uuid: t, devType: s };
- setTimeout(function () {
- d.sendData(window.apiUrl + "?c=Index&a=login", u, true)
- }, 100)
- }
- };
- var d = {
- version: {
- getVer: function () {
- var s = JSON.parse(localStorage.getItem("hzAppVer"));
- if (s) {
- return s
- } else {
- return d.version.setVer()
- }
- }, setVer: function () {
- h.ajax({
- type: "get",
- url: window.apiUrl + "index.php?c=Config&a=getWebVersion",
- dataType: "jsonp",
- data: {},
- jsonp: "callback",
- async: false,
- crossDomain: true,
- success: function (s) {
- s = s || {};
- if (s.version) {
- localStorage.setItem("hzAppVer", JSON.stringify(s));
- return s
- }
- },
- error: function (u, t, s) {
- return null;
- d.dialog(false, d.options.timeout, "网络链接失败")
- },
- timeout: 9000
- })
- }
- },
- options: { templateHtml: [null, null, null, null], timeout: 2500, rows: null },
- scroll: function (t, z, s, w, A, x, u, v) {
- var y = true;
- h("#content").bind("scroll", function () {
- var B = h("#content").scrollTop();
- if (B >= (h("#list").height() - h("#content").height()) && y == true) {
- z.rowed += z.pageSize;
- if (d.options.rows && z.rowed < d.options.rows) {
- d.getData(t, z, s, w, A, x, u, v)
- } else {
- setTimeout(function () {
- d.dialog(false, d.options.timeout, "没有了")
- }, 1);
- y = false
- }
- }
- })
- },
- dialog: function (s, v, u, t) {
- h("#dialog").addClass("show");
- if (s) {
- if (u) {
- h("#dialog .popup_layer_cont").html('<div class="loading_cont"><div class="cycle"></div><div class="title">' + u + "</div></div>")
- } else {
- h("#dialog .popup_layer_cont").html('<div class="loading_cont"><div class="cycle"></div><div class="title">数据加载中</div></div>')
- }
- } else {
- if (u) {
- h("#dialog .popup_layer_cont").html(u)
- }
- }
- if (v) {
- setTimeout(function () {
- h("#dialog").removeClass("show");
- if (t) {
- if (window.parent) {
- window.parent.location = t
- } else {
- window.location = t
- }
- }
- }, v)
- } else {
- h("#dialog").removeClass("show")
- }
- },
- loginSuccess: function () {
- var s = JSON.parse(localStorage.getItem("hzToken"));
- if (s) {
- if (s.timestamp) {
- h("#login").hide();
- h("#loginSuccess").show();
- h("#userPhoto").attr("src", s.userPhoto);
- h("i.login_open").removeClass("logined");
- h("i.login_open img").attr("src", s.userPhoto);
- if (s.trueName == "" || !s.trueName) {
- h("#userName").text(s.phone)
- } else {
- h("#userName").text(s.trueName)
- }
- }
- }
- },
- logout: function () {
- localStorage.setItem("hzToken", null);
- d.dialog(false, d.options.timeout, "已成功退出", "index.html")
- },
- getToken: function () {
- var s = JSON.parse(localStorage.getItem("hzToken"));
- if (s == null) {
- s = { timestamp: null, token: null, customerFamilyId: null }
- } else {
- s = { timestamp: s.timestamp, token: s.token, customerFamilyId: s.customerFamilyId }
- }
- return s
- },
- setToken: function (t) {
- var s = false;
- if (t.status == "1") {
- var u = JSON.parse(localStorage.getItem("hzToken"));
- u = {
- timestamp: t.timestamp,
- token: t.token,
- userPhoto: u.userPhoto,
- customerFamilyId: u.customerFamilyId,
- phone: u.phone,
- trueName: u.trueName
- };
- localStorage.setItem("hzToken", JSON.stringify(u));
- s = true
- } else {
- localStorage.setItem("hzToken", null);
- d.dialog(false, d.options.timeout, "用户未登录或已退出!", "login.html")
- }
- return s
- },
- setLoginToken: function (s) {
- if (s.status == "1") {
- var t = {
- timestamp: s.data[0].timestamp,
- token: s.data[0].token,
- userPhoto: s.data[0].userPhoto,
- customerFamilyId: s.data[0].customerFamilyId,
- phone: s.data[0].phone,
- trueName: s.data[0].trueName
- };
- localStorage.setItem("hzToken", JSON.stringify(t));
- d.dialog(false, d.options.timeout, "登录成功", "index.html")
- } else {
- d.dialog(false, d.options.timeout, "用户名或密码错误")
- }
- },
- getDataNoTemp: function (t, u, v, s) {
- if (u.rowed > d.options.rows) {
- d.dialog(false, 800, "没有了")
- } else {
- h.ajax({
- type: "get",
- url: t,
- dataType: "jsonp",
- data: h.extend(d.getToken(), u),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- beforeSend: d.dialog(true),
- success: function (w) {
- w = w || {};
- //允许医生列表页面不登录`
- if ((window.location.pathname == '/dept_q_list.html' || window.location.pathname == '/favorite_q_doctor_dept_list.html') && w.dataToken.token == null) {
- if (w.dataInfo.status == "1") {
- v.doing(w.dataInfo.data);
- d.dialog(false, false, null, null)
- } else {
- if (s) {
- d.dialog(false, d.options.timeout, s.message ? s.message : "无数据");
- s.doing()
- } else {
- d.dialog(false, d.options.timeout, "无数据")
- }
- }
- return false;
- }
- if (d.setToken(w.dataToken)) {
- if (w.dataInfo.status == "1") {
- v.doing(w.dataInfo.data);
- d.dialog(false, false, null, null)
- } else {
- if (s) {
- d.dialog(false, d.options.timeout, s.message ? s.message : "无数据");
- s.doing()
- } else {
- d.dialog(false, d.options.timeout, "无数据")
- }
- }
- }
- },
- error: function (y, x, w) {
- d.dialog(false, d.options.timeout, "网络链接失败")
- },
- timeout: 9000
- })
- }
- },
- getData: function (t, A, s, x, B, y, u, w, z, v) {
- if (d.options.rows ? A.rowed >= d.options.rows : false) {
- d.dialog(false, d.options.timeout, "没有了")
- } else {
- h.ajax({
- type: "get",
- url: t,
- dataType: "jsonp",
- data: h.extend(d.getToken(), A),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- beforeSend: d.dialog(true),
- success: function (C) {
- C = C || {};
- if (!x) {
- x = 0
- }
- if (!d.options.templateHtml[x]) {
- d.options.templateHtml[x] = h(s).html();
- d.options.templateHtml[x] = d.replaceEscape(d.options.templateHtml[x]);
- h(s).html("");
- if (C.dataInfo.rows) {
- d.options.rows = parseInt(C.dataInfo.rows)
- }
- }
- if ((window.location.pathname == '/doctorWho.html' || window.location.pathname == '/doctorWhoAnother.html') && C.dataToken.token == null) {
- if (C.dataInfo.status == "1") {
- if (!u) {
- A = null
- }
- if (B) {
- h(s).html(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
- } else {
- h(s).append(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
- }
- h(s).show();
- d.dialog(false, false, null, null);
- if (y) {
- m.icoEventCallback(y)
- }
- if (z) {
- z.doing()
- }
- } else {
- h(s).html("");
- if (!w) {
- w = "无数据"
- }
- d.dialog(false, d.options.timeout, w);
- if (v) {
- setTimeout(function () {
- v.doing()
- }, d.options.timeout)
- }
- }
- return false;
- }
- if (d.setToken(C.dataToken)) {
- if (C.dataInfo.status == "1") {
- if (!u) {
- A = null
- }
- if (B) {
- h(s).html(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
- } else {
- h(s).append(d.setTemplate(d.options.templateHtml[x], C.dataInfo.data, A))
- }
- h(s).show();
- d.dialog(false, false, null, null);
- if (y) {
- m.icoEventCallback(y)
- }
- if (z) {
- z.doing()
- }
- } else {
- h(s).html("");
- if (!w) {
- w = "无数据"
- }
- d.dialog(false, d.options.timeout, w);
- if (v) {
- setTimeout(function () {
- v.doing()
- }, d.options.timeout)
- }
- }
- }
- },
- error: function (E, D, C) {
- d.dialog(false, d.options.timeout, "网络链接失败")
- },
- timeout: 9000
- })
- }
- },
- sendData: function (t, y, u, x, w, v, z, s) {
- h.ajax({
- type: "get",
- url: t,
- dataType: "jsonp",
- data: h.extend(d.getToken(), y),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- beforeSend: d.dialog(true, 2000, "处理中..."),
- success: function (A) {
- A = A || {};
- if (u) {
- d.setLoginToken(A.dataInfo);
- d.version.setVer()
- } else {
- d.setToken(A.dataToken)
- }
- if (A.dataInfo.status == "1") {
- if (x) {
- d.dialog(false, d.options.timeout, x[1], null)
- }
- if (w) {
- m.switchStatus(w)
- }
- if (v) {
- m.icoEventCallback(v)
- }
- if (z) {
- z.doing(A.dataInfo.data)
- }
- } else {
- if (x) {
- if (x[0]) {
- d.dialog(false, d.options.timeout, x[0], null)
- } else {
- d.dialog(false, d.options.timeout, A.dataInfo.info, null)
- }
- } else {
- d.dialog(false, d.options.timeout, A.dataInfo.info, null)
- }
- if (s) {
- setTimeout(function () {
- s.doing()
- }, d.options.timeout)
- }
- }
- },
- error: function (C, B, A) {
- d.dialog(false, d.options.timeout, "网络链接失败")
- },
- timeout: 9000
- })
- },
- register: function (s, u, t, v, w) {
- h.ajax({
- type: "get",
- url: s,
- dataType: "jsonp",
- data: u,
- jsonp: "callback",
- async: false,
- crossDomain: true,
- success: function (x) {
- x = x || {};
- if (x.dataInfo.status == "1") {
- if (t) {
- d.dialog(false, d.options.timeout, t[1], null)
- }
- if (v) {
- v.doing(x.dataInfo.data)
- }
- if (w) {
- if (window.parent) {
- window.parent.location = w
- } else {
- window.location = w
- }
- }
- } else {
- if (t) {
- if (t[0]) {
- d.dialog(false, d.options.timeout, t[0], null)
- } else {
- d.dialog(false, d.options.timeout, x.dataInfo.info, null)
- }
- } else {
- d.dialog(false, d.options.timeout, x.dataInfo.info, null)
- }
- if (v) {
- if (v.err) {
- v.err.doing(x.dataInfo.info)
- }
- }
- }
- },
- error: function (z, y, x) {
- d.dialog(false, d.options.timeout, "网络链接失败")
- },
- timeout: 19000
- })
- },
- check: function (t, v, u, s) {
- h.ajax({
- type: "get",
- url: t,
- dataType: "jsonp",
- data: v,
- jsonp: "callback",
- async: false,
- crossDomain: true,
- success: function (w) {
- w = w || {};
- if (w.dataInfo.status == "1") {
- if (u) {
- if (u[1]) {
- d.dialog(false, d.options.timeout, u[1])
- } else {
- d.dialog(false, d.options.timeout, w.dataInfo.info)
- }
- }
- } else {
- if (u) {
- if (u[0]) {
- d.dialog(false, d.options.timeout, u[0])
- } else {
- d.dialog(false, d.options.timeout, w.dataInfo.info)
- }
- } else {
- d.dialog(false, d.options.timeout, w.dataInfo.info)
- }
- if (s) {
- s.doing()
- }
- }
- },
- error: function (y, x, w) {
- d.dialog(false, d.options.timeout, "网络链接失败")
- },
- timeout: 9000
- })
- },
- setTemplate: function (s, v, u) {
- var w, t = "";
- h.each(v, function (x, y) {
- if (u) {
- h.extend(y, u)
- }
- t += d.TemplateEngine(s, y)
- });
- return t
- },
- TemplateEngine: function (v, u) {
- var w = /\[%([^%]+)?%]/g, s = /(^( )?(var|if|for|else|switch|case|break|{|}))(.*)?/g, x = "var r=[];\n",
- z = 0, t;
- var y = function (A, B) {
- B ? (x += A.match(s) ? A + "\n" : "r.push(" + A + ");\n") : (x += A != "" ? 'r.push("' + A.replace(/"/g, '\\"') + '");\n' : "");
- return y
- };
- while (t = w.exec(v)) {
- y(v.slice(z, t.index))(t[1], true);
- z = t.index + t[0].length
- }
- y(v.substr(z, v.length - z));
- x += 'return r.join("");';
- return new Function(x.replace(/[\r\t\n]/g, "")).apply(u)
- },
- replaceEscape: function (s) {
- s = s.replace(/</g, "<");
- s = s.replace(/>/g, ">");
- s = s.replace(/&&/g, "&&");
- return s
- }
- };
- var g = {
- getDaysInMonth: function (s, t) {
- return 32 - new Date(s, t, 32).getDate()
- }, getFirstDayOfMonth: function (t, u, s) {
- var s = s || 1;
- return new Date(t, u, s).getDay()
- }, getToday: function () {
- var s = new Date();
- g.Y = s.getFullYear();
- g.M = s.getMonth();
- g.D = s.getDate()
- }, toggle: function (s) {
- var s = h(s);
- if (s.hasClass("down")) {
- h("#DateBox").addClass("show");
- h(s).addClass("up").removeClass("down");
- h(s).find(".title").html("收起")
- } else {
- h(s).addClass("down").removeClass("up");
- h("#DateBox").removeClass("show");
- h(s).find(".title").html("展开")
- }
- }, doHook: function () {
- if (!h(this).hasClass("noNum")) {
- h(".doHook").removeClass("hook");
- h(this).addClass("hook").prev().addClass("rightborder").siblings().removeClass("rightborder")
- }
- h(".hzApp-list-calendar-master h2.title").html(h(this).attr("date"))
- }, getList: function () {
- var x = "";
- var A = 1;
- var t = new Date();
- var v = g.getFirstDayOfMonth(g.Y, g.M);
- for (var u = 0; u < 7; u++) {
- var s = "";
- switch (u) {
- case 0:
- s += "日";
- break;
- case 1:
- s += "一";
- break;
- case 2:
- s += "二";
- break;
- case 3:
- s += "三";
- break;
- case 4:
- s += "四";
- break;
- case 5:
- s += "五";
- break;
- case 6:
- s += "六";
- break
- }
- x += ' <li class="doHook title"><div class="mate">' + s + "</div></li>"
- }
- for (var u = 0; u < v; u++) {
- x += ' <li class="doHook"></li>'
- }
- for (var u = 1; u <= g.getDaysInMonth(g.Y, g.M); u++) {
- var z = new Date().toDate(g.Y + "-" + (g.M + 1) + "-1");
- z.setDate(z.getDate() + (u - 1));
- var y = z.format("yyyy-M-d");
- if (A > g.getDaysInMonth(g.Y, g.M)) {
- A = 1
- }
- if (v > 6) {
- v = 0
- }
- if (g.Y == t.getFullYear() && g.M == t.getMonth() && A == t.getDate()) {
- x += ' <li class="doHook hook" date="' + y + '"> <i></i><div class="title">今</div> </li>'
- } else {
- if (u == 5) {
- x += ' <li class="doHook" date="' + y + '"> <i></i><div class="title">' + A + "</div> </li>"
- } else {
- x += ' <li class="doHook" date="' + y + '"> <i></i><div class="title">' + A + "</div> </li>"
- }
- }
- A++;
- v++
- }
- return x
- }, setEvents: function (s) {
- h("#DateBox ul").find("li").each(function () {
- if (h(this).attr("date") == s) {
- h(this).find("i").addClass("icon-event")
- }
- })
- }, init: function () {
- g.getToday();
- h(".hzApp-list-calendar-master h2.title").html(g.Y + "年" + (g.M + 1) + "月" + g.D + "日");
- h("#DateBox ul").html(g.getList());
- h(".doHook").on("tap", g.doHook);
- h(".hzApp-list-calendar-master .arrowT").bind("tap", function () {
- if (h(this).hasClass("right")) {
- if (h(this).hasClass("year")) {
- g.Y++
- } else {
- g.M++
- }
- } else {
- if (h(this).hasClass("left")) {
- if (h(this).hasClass("year")) {
- g.Y--
- } else {
- g.M--
- }
- }
- }
- if (g.M > 11 || g.M < 0) {
- g.M = 0
- }
- var s = new Date();
- if (g.Y == s.getFullYear() && g.M == s.getMonth()) {
- g.D = s.getDate()
- } else {
- g.D = 1
- }
- h(".hzApp-list-calendar-master h2.title").html(g.Y + "年" + (g.M + 1) + "月" + g.D + "日");
- g.change();
- g.setEvents("2015-8-10")
- })
- }, change: function () {
- h("#DateBox ul").html(g.getList());
- h(".doHook").on("tap", g.doHook)
- }
- };
- var p = {
- options: {
- urls: ["#", "index.html", "deptlist.html", "doctorlist.html", "doctorsbooking.html", "#", "favorite.html", "drugCalendar.html", "doctorCalendar.html"],
- // 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"],
- icons: ["", "icon-home home", "icon-workflows dept", "icon-user0 doctor", "icon-news booking", "icon-addRound like", "icon-love favorite"],
- // titles: ["", "应用中心", "科室", "医生", "预约", "关注", "我的关注", "用药日程", "挂号记录"]
- titles: ["", "门诊服务", "科室", "医生", "预约", "关注", "我的关注"]
- }, doing: function (t, s) {
- h.extend(this.options, s);
- this.el = t;
- this._init()
- }, _init: function (u) {
- var t = '<div class="listNav "><ul>', v = "";
- for (var s = 0; s < this.options.count; s++) {
- v = this.options.count;
- if (this.options.current == this.options.idx[s]) {
- v += " current"
- }
- if (this.options.titles[this.options.idx[s]] == '门诊服务') {
- 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>"
- } else {
- 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>"
- }
- }
- t += "</ul></div>";
- this.el.html(t);
- this._addEvent()
- }, _addEvent: function () {
- var s = this;
- this.el.find(".listNav li").bind("tap", function () {
- var token = window.hzAPI.getToken().token; //token
- //判断token是否存在
- if (!token) {
- window.location.href = 'login.html';
- e.preventDefault();
- return false;
- }
- var t = 0;
- if (h(this).find("i").hasClass("*.home")) {
- t = 1
- }
- if (h(this).find("i").hasClass("*.dept")) {
- t = 2
- }
- if (h(this).find("i").hasClass("*.doctor")) {
- t = 3
- }
- if (h(this).find("i").hasClass("*.booking")) {
- t = 4
- }
- if (h(this).find("i").hasClass("*.like")) {
- t = 5
- }
- if (h(this).find("i").hasClass("*.favorite")) {
- t = 6
- }
- if (h(this).find("i").hasClass("*.drugCalendar")) {
- t = 7
- }
- if (h(this).find("i").hasClass("*.doctorCalendar")) {
- t = 8
- }
- window.location = s.options.urls[t]
- })
- }
- };
- var a = {
- show: function () {
- h("#popup_layer").addClass("show")
- }, close: function () {
- h("#popup_layer").removeClass("show");
- h(".popup_layer_cont").html("")
- }, getCount: function (s) {
- var s = h.extend({}, s);
- 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>';
- a.picker_selector_html += '<button id="cancel_counter_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>';
- a.picker_selector_html += '<button id="confirm_counter_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
- h(".popup_layer_cont").html(a.picker_selector_html);
- var t = h("#counterValue");
- t.val(s.obj_callback.val());
- h("#counter_add").bind("tap", function () {
- if (parseInt(t.val()) < 0) {
- t.val(0)
- }
- t.val(parseInt(t.val()) + 1)
- });
- h("#counter_minus").bind("tap", function () {
- if (parseInt(t.val()) < 0) {
- t.val(0)
- }
- t.val(parseInt(t.val()) - 1)
- });
- h("#confirm_counter_picker").bind("tap", function () {
- if (typeof s.obj_callback == "object") {
- s.obj_callback.val(t.val())
- }
- a.close()
- });
- h("#cancel_counter_picker").bind("tap", function () {
- a.close()
- })
- }
- };
- var q = {
- getHours: function (t) {
- var s = t.substring(0, 2);
- return (s.substring(0, 1) == "0" ? s.substring(1, 2) : s)
- }, getPlanFromGroups: function (w, v) {
- var s = new Date().toDate(w);
- var u = { morning: [], afternoon: [], evening: [], night: [] };
- var t = ["night", "morning", "afternoon", "evening"];
- h.each(v, function (B, A) {
- var x = new Date().toDate(A.startDate);
- var E = new Date().toDate(A.startDate);
- E.setDate(x.getDate() + A.days);
- var z, C = new Array();
- var y, D = 0;
- if (s >= x && s <= E) {
- z = A.consumptionHoursString.split(",");
- C = A.quantityString.split(",");
- for (i = 0; i < z.length; i++) {
- y = parseInt(q.getHours(z[i]));
- D = Math.floor(y / 6);
- u[t[D]].push({
- id: A.id,
- date: null,
- consumptionHours: z[i],
- drugName: A.drugName,
- quantity: C[i],
- doseType: A.doseType,
- status: "pending",
- statusCn: "待服"
- })
- }
- }
- });
- return u
- }, getPlanFromSchedules: function (x, w) {
- var t = new Date().toDate(x);
- var v = { morning: [], afternoon: [], evening: [], night: [] };
- var u = ["night", "morning", "afternoon", "evening"];
- var z = { pending: "待服", missing: "漏服", taken: "已服" };
- var s, y = 0;
- h.each(w, function (C, A) {
- var B = new Date().toDate(A.originalDateTime);
- if ((B.getFullYear() == t.getFullYear()) && (B.getMonth() == t.getMonth()) && (B.getDate() == t.getDate())) {
- s = parseInt(q.getHours(A.consumptionHours));
- y = Math.floor(s / 6);
- v[u[y]].push({
- id: A.id,
- date: A.originalDateTime,
- consumptionHours: A.consumptionHours,
- drugName: A.drugName,
- quantity: A.quantity,
- doseType: A.doseType,
- status: A.status,
- statusCn: z[A.status]
- })
- }
- });
- return v
- }, getAllPlan: function (w, u) {
- var t = new Date().toDate(w);
- var v, s = null;
- var x = { dateTime: w, customerFamilyId: u };
- if (t <= new Date()) {
- v = window.apiUrl + "?c=Index&a=medicineSchedule";
- s = 0
- } else {
- v = window.apiUrl + "?c=Index&a=medicineScheduleGroups";
- s = 1
- }
- h.ajax({
- type: "get",
- url: v,
- dataType: "jsonp",
- data: h.extend(d.getToken(), x),
- jsonp: "callback",
- async: false,
- crossDomain: true,
- beforeSend: d.dialog(true),
- success: function (y) {
- y = y || {};
- if (d.setToken(y.dataToken)) {
- var z = null;
- if (y.dataInfo.status == "1") {
- if (s == 1) {
- z = q.getPlanFromGroups(w, y.dataInfo.data)
- } else {
- z = q.getPlanFromSchedules(w, y.dataInfo.data)
- }
- localStorage.setItem("out", JSON.stringify(z));
- q.showPlan(z);
- q.resetEvent();
- d.dialog(false, 300, null, null)
- } else {
- z = { morning: [], afternoon: [], evening: [], night: [] };
- q.showPlan(z);
- localStorage.setItem("out", null);
- d.dialog(false, 2000, "当天无服药信息")
- }
- }
- },
- error: function (A, z, y) {
- d.dialog(false, 2000, "网络链接失败")
- },
- timeout: 9000
- })
- }, showPlan: function (t) {
- for (var u in t) {
- if (t[u].length > 0) {
- h("#" + u).html('<a vhref="drugPopPerDay.html?id=' + u + '"><i class="icon-drug"></i>' + t[u].length + "</a>")
- } else {
- h("#" + u).html("")
- }
- }
- var s = new Date().getHours();
- var v = ["nightTitle", "morningTitle", "afternoonTitle", "eveningTitle"],
- w = ["night", "morning", "afternoon", "evening"];
- h("#" + v[Math.floor(s / 6)]).addClass("doing");
- h("#" + w[Math.floor(s / 6)]).addClass("doing")
- }, resetEvent: function () {
- h("#ListCycle li a").bind("tap", function () {
- var s = { night: "凌晨", morning: "上午", afternoon: "下午", evening: "晚上" };
- title = "服用清单 - " + g.Y + "年" + (g.M + 1) + "月" + g.D + "日 " + s[h(this).parent().attr("id")];
- m.popWinLayer(h(this).attr("vhref") + "&date=" + g.Y + "-" + (g.M + 1) + "-" + g.D, title)
- })
- }
- };
- var f = {
- getUrlParam: function (s) {
- var t = new RegExp("(^|&)" + s + "=([^&]*)(&|$)");
- var u = window.location.search.substr(1).match(t);
- if (u != null) {
- return u[2]
- } else {
- return null
- }
- }, setNewDrugPlanList: function (x, u) {
- var y = "", t = 12 / (x - 1), s = 8, v = "08:00";
- for (var w = 1; w <= x; w++) {
- 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>';
- s += t;
- if (s > 9) {
- v = s
- } else {
- v = "0" + s
- }
- v += ":00"
- }
- u.html(y);
- u.find("li").bind("tap", function () {
- l.getList(h(this).find("[name='consumptionHours']"), h(this).find("[name='quantity']"));
- l.show()
- })
- }, getDrugHoursQuantity: function () {
- var s = "", t = "";
- h("#hours-quantity li").each(function (u) {
- if (u > 0) {
- s += ",";
- t += ","
- }
- s += h(this).find("input[type=text][name=consumptionHours]").val();
- t += h(this).find("input[type=text][name=quantity]").val()
- });
- return [s, t]
- }, setDrugPlanList: function (x, t) {
- var s = x.consumptionHoursString.split(",");
- var v = x.quantityString.split(",");
- var w = "";
- for (var u = 0; u < s.length; u++) {
- 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>'
- }
- t.html(w);
- t.find("li").bind("tap", function () {
- l.getList(h(this).find("[name='consumptionHours']"), h(this).find("[name='quantity']"));
- l.show()
- })
- }, getSelectOptionsText: function (t) {
- var s = "";
- t.find("option").forEach(function (u) {
- if (t.val() == h(u).val()) {
- s = h(u).text()
- }
- });
- return s
- }, getClass: function (s) {
- if (s) {
- return "is-active"
- } else {
- return ""
- }
- }
- };
- var l = {
- addZero: function (s) {
- return (s < 10 ? "0" + s : s)
- }, solarDays: function (u, t) {
- var s = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
- if (t == 1) {
- return (((u % 4 == 0) && (u % 100 != 0) || (u % 400 == 0)) ? 29 : 28)
- } else {
- return (s[t])
- }
- }, show: function () {
- h("#popup_layer").addClass("show")
- }, close: function () {
- h("#popup_layer").removeClass("show");
- h(".popup_layer_cont").html("")
- }, getList: function (t, F) {
- var A = { hasSecond: false, isCustomLeftButton: false, customLeftButtonName: "清除" };
- l.picker_selector_html = '<div class="counterPickerTitle">设置服用时间</div><div class="datepickerscroll" id="hourpickerscroll"><div class="scroller"><ul id="hourpicker" class="listitem"></ul></div></div>';
- if (A.hasSecond) {
- l.picker_selector_html += '<div style="position: absolute;left: 72px;top: 52px;">:</div>';
- l.picker_selector_html += '<div style="position: absolute;left: 148px;top: 52px;">:</div>'
- } else {
- l.picker_selector_html += '<div style="position: absolute;left: 108px;top: 100px;">:</div>'
- }
- l.picker_selector_html += '<div class="datepickerscroll" id="minutepickerscroll"><div class="scroller"><ul id="minutepicker" class="listitem"></ul></div></div>';
- if (A.hasSecond) {
- l.picker_selector_html += '<div class="datepickerscroll" id="secondpickerscroll"><div class="scroller"><ul id="secondpicker" class="listitem"></ul></div></div>'
- }
- 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>';
- if (A.isCustomLeftButton) {
- l.picker_selector_html += '<button id="clear_date_picker" style="color: #000000;"' + A.customLeftButtonName + "</button>"
- } else {
- l.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>'
- }
- l.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
- h(".popup_layer_cont").html(l.picker_selector_html);
- if (!A.hasSecond) {
- h("#hourpickerscroll").css("width", "50%");
- h("#minutepickerscroll").css("width", "50%")
- }
- var u = "<li> </li>", C = '<li id="hourli-1"> </li>', w = '<li id="minuteli-1"> </li>',
- s = '<li id="secondli-1"> </li>';
- var D = h("#hourpicker"), x = h("#minutepicker"), v = null;
- if (A.hasSecond) {
- v = h("#secondpicker")
- }
- var B = (typeof selectedDate == "object") ? selectedDate : new Date();
- var y = t.val().split(":");
- B.setHours(parseInt(y[0]));
- B.setMinutes(parseInt(y[1]));
- l.hourSelected = B.getHours();
- l.minuteSelected = B.getMinutes();
- l.secondSelected = B.getSeconds();
- for (var z = 0; z < 24; z++) {
- C += '<li class="hourli" id="hourli' + z + '">' + l.addZero(z) + "</li>"
- }
- for (var z = 0; z < 60; z++) {
- w += '<li class="minuteli" id="minuteli' + z + '">' + l.addZero(z) + "</li>"
- }
- for (var z = 0; z < 60; z++) {
- s += '<li class="secondli" id="secondli' + z + '">' + l.addZero(z) + "</li>"
- }
- C += u;
- w += u;
- s += u;
- D.html(C);
- x.html(w);
- if (A.hasSecond) {
- v.html(s)
- }
- l.hourScroll = new IScroll("#hourpickerscroll", { scrollbars: false, snap: "li" });
- l.minuteScroll = new IScroll("#minutepickerscroll", { scrollbars: false, snap: "li" });
- if (A.hasSecond) {
- l.secondScroll = new IScroll("#secondpickerscroll", { scrollbars: false, snap: "li" })
- }
- l.hourScroll.scrollToElement("#hourli" + (B.getHours() - 1), 0);
- h("#hourli" + B.getHours()).addClass("selectedli");
- l.minuteScroll.scrollToElement("#minuteli" + (B.getMinutes() - 1), 0);
- h("#minuteli" + B.getMinutes()).addClass("selectedli");
- if (A.hasSecond) {
- l.secondScroll.scrollToElement("#secondli" + (B.getSeconds() - 1), 0);
- h("#secondli" + B.getSeconds()).addClass("selectedli")
- }
- l.hourScroll.on("scrollEnd", function (G) {
- h(".hourli").removeClass("selectedli");
- var H = Math.round(l.hourScroll.y / (-41));
- l.hourSelected = H;
- h("#hourli" + H).addClass("selectedli")
- });
- l.minuteScroll.on("scrollEnd", function (H) {
- h(".minuteli").removeClass("selectedli");
- var G = Math.round(l.minuteScroll.y / (-41));
- l.minuteSelected = G;
- h("#minuteli" + G).addClass("selectedli")
- });
- if (A.hasSecond) {
- l.secondScroll.on("scrollEnd", function (H) {
- h(".secondli").removeClass("selectedli");
- var G = Math.round(l.secondScroll.y / (-41));
- l.secondSelected = G;
- h("#secondli" + G).addClass("selectedli")
- })
- }
- var E = h("#counterValue");
- E.val(F.val());
- h("#counter_add").bind("tap", function () {
- E.val((Number(E.val()) + 0.25).toFixed(2))
- });
- h("#counter_minus").bind("tap", function () {
- if (Number(E.val()) <= 0) {
- E.val("0.00")
- } else {
- E.val((Number(E.val() - 0.25).toFixed(2)))
- }
- });
- h("#confirm_date_picker").bind("tap", function () {
- var J = new Date(B.getFullYear(), B.getMonth(), B.getDate(), l.hourSelected, l.minuteSelected, A.hasSecond ? l.secondSelected : 0),
- I = J.getFullYear() + "-" + (J.getMonth() + 1) + "-" + J.getDate() + " " + l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes()) + ":" + l.addZero(J.getSeconds()),
- H = J.getFullYear() + "-" + (J.getMonth() + 1) + "-" + J.getDate(), G = "";
- if (A.hasSecond) {
- G = l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes()) + ":" + l.addZero(J.getSeconds())
- } else {
- G = l.addZero(J.getHours()) + ":" + l.addZero(J.getMinutes())
- }
- if (typeof t == "object" && typeof F == "object") {
- t.val(G);
- F.val(E.val())
- }
- l.close()
- });
- h("#cancel_date_picker").bind("tap", function () {
- l.close()
- })
- }
- };
- var k = {
- init: function () {
- k.bindUIActions();
- k.hideInactive()
- }, bindUIActions: function () {
- h(".tabBlock-tab").on("tap", function () {
- k.switchTab(h(this))
- })
- }, hideInactive: function () {
- var s = h(".tabBlock");
- s.each(function (v) {
- var u = h(s[v]), t = u.find(".tabBlock-pane"), w = u.find(".tabBlock-tab.is-active");
- t.hide();
- h(t[w.index()]).show()
- })
- }, switchTab: function (s) {
- if (!s.hasClass("is-active")) {
- s.siblings().removeClass("is-active");
- s.addClass("is-active");
- k.showPane(s.index())
- }
- }, showPane: function (t) {
- var s = h(".tabBlock-content .lists");
- s.each(function (u) {
- if (!h(this).hasClass("hide")) {
- h(this).addClass("hide")
- }
- if (u == t) {
- h(this).removeClass("hide")
- }
- })
- }
- };
- var r = {
- show: function () {
- h("#popup_layer").addClass("show")
- }, close: function () {
- h("#popup_layer").removeClass("show");
- h(".popup_layer_cont").html("")
- }, getList: function (w) {
- var z = { hasSecond: false, isCustomLeftButton: false, customLeftButtonName: "清除" };
- r.picker_selector_html = '<div class="datepickerscroll" id="hourpickerscroll"><div class="scroller"><ul id="hourpicker" class="listitem"></ul></div></div>';
- if (z.hasSecond) {
- r.picker_selector_html += '<div style="position: absolute;left: 72px;top: 52px;">:</div>';
- r.picker_selector_html += '<div style="position: absolute;left: 148px;top: 52px;">:</div>'
- } else {
- r.picker_selector_html += '<div style="position: absolute;left: 108px;top: 52px;">:</div>'
- }
- r.picker_selector_html += '<div class="datepickerscroll" id="minutepickerscroll"><div class="scroller"><ul id="minutepicker" class="listitem"></ul></div></div>';
- if (z.hasSecond) {
- r.picker_selector_html += '<div class="datepickerscroll" id="secondpickerscroll"><div class="scroller"><ul id="secondpicker" class="listitem"></ul></div></div>'
- }
- if (z.isCustomLeftButton) {
- r.picker_selector_html += '<button id="clear_date_picker" style="color: #000000;"' + z.customLeftButtonName + "</button>"
- } else {
- r.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">取消</button>'
- }
- r.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
- h(".popup_layer_cont").html(r.picker_selector_html);
- if (!z.hasSecond) {
- h("#hourpickerscroll").css("width", "50%");
- h("#minutepickerscroll").css("width", "50%")
- }
- var t = "<li> </li>", B = '<li id="hourli-1"> </li>', v = '<li id="minuteli-1"> </li>',
- s = '<li id="secondli-1"> </li>';
- var C = h("#hourpicker"), x = h("#minutepicker"), u = null;
- if (z.hasSecond) {
- u = h("#secondpicker")
- }
- var A = (typeof selectedDate == "object") ? selectedDate : new Date();
- r.hourSelected = A.getHours();
- r.minuteSelected = A.getMinutes();
- r.secondSelected = A.getSeconds();
- for (var y = 0; y < 24; y++) {
- B += '<li class="hourli" id="hourli' + y + '">' + l.addZero(y) + "</li>"
- }
- for (var y = 0; y < 60; y++) {
- v += '<li class="minuteli" id="minuteli' + y + '">' + l.addZero(y) + "</li>"
- }
- for (var y = 0; y < 60; y++) {
- s += '<li class="secondli" id="secondli' + y + '">' + l.addZero(y) + "</li>"
- }
- B += t;
- v += t;
- s += t;
- C.html(B);
- x.html(v);
- if (z.hasSecond) {
- u.html(s)
- }
- r.hourScroll = new IScroll("#hourpickerscroll", { scrollbars: false, snap: "li" });
- r.minuteScroll = new IScroll("#minutepickerscroll", { scrollbars: false, snap: "li" });
- if (z.hasSecond) {
- r.secondScroll = new IScroll("#secondpickerscroll", { scrollbars: false, snap: "li" })
- }
- r.hourScroll.scrollToElement("#hourli" + (A.getHours() - 1), 0);
- h("#hourli" + A.getHours()).addClass("selectedli");
- r.minuteScroll.scrollToElement("#minuteli" + (A.getMinutes() - 1), 0);
- h("#minuteli" + A.getMinutes()).addClass("selectedli");
- if (z.hasSecond) {
- r.secondScroll.scrollToElement("#secondli" + (A.getSeconds() - 1), 0);
- h("#secondli" + A.getSeconds()).addClass("selectedli")
- }
- r.hourScroll.on("scrollEnd", function (D) {
- h(".hourli").removeClass("selectedli");
- var E = Math.round(r.hourScroll.y / (-41));
- r.hourSelected = E;
- h("#hourli" + E).addClass("selectedli")
- });
- r.minuteScroll.on("scrollEnd", function (E) {
- h(".minuteli").removeClass("selectedli");
- var D = Math.round(r.minuteScroll.y / (-41));
- r.minuteSelected = D;
- h("#minuteli" + D).addClass("selectedli")
- });
- if (z.hasSecond) {
- r.secondScroll.on("scrollEnd", function (E) {
- h(".secondli").removeClass("selectedli");
- var D = Math.round(r.secondScroll.y / (-41));
- r.secondSelected = D;
- h("#secondli" + D).addClass("selectedli")
- })
- }
- h("#confirm_date_picker").bind("tap", function () {
- var G = new Date(A.getFullYear(), A.getMonth(), A.getDate(), r.hourSelected, r.minuteSelected, z.hasSecond ? r.secondSelected : 0),
- F = G.getFullYear() + "-" + (G.getMonth() + 1) + "-" + G.getDate() + " " + l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes()) + ":" + l.addZero(G.getSeconds()),
- E = G.getFullYear() + "-" + (G.getMonth() + 1) + "-" + G.getDate(), D = "";
- if (z.hasSecond) {
- D = l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes()) + ":" + l.addZero(G.getSeconds())
- } else {
- D = l.addZero(G.getHours()) + ":" + l.addZero(G.getMinutes())
- }
- if (typeof w == "object") {
- w.val(D)
- }
- r.close()
- });
- h("#cancel_date_picker").bind("tap", function () {
- r.close()
- })
- }
- };
- var j = {
- show: function () {
- h("#popup_layer").addClass("show")
- }, close: function () {
- h("#popup_layer").removeClass("show");
- h(".popup_layer_cont").html("")
- }, reCountDay: function () {
- var u = parseInt(solarDays(j.yearSelected, (parseInt(j.monthSelected) - 1)));
- var t = '<li id="dayli0"> </li>';
- for (var s = 1; s <= u; s++) {
- t += '<li class="dayli" id="dayli' + s + '">' + l.addZero(s) + "</li>"
- }
- t += "<li> </li>";
- h("#daypicker").html(t);
- j.dayScroll.destroy();
- j.dayScroll = new IScroll("#daypickerscroll", { scrollbars: false, snap: "li" });
- if (j.daySelected > u) {
- j.dayScroll.scrollToElement("#dayli" + (u - 1), 0);
- h("#dayli" + u).addClass("selectedli");
- j.daySelected = u
- } else {
- j.dayScroll.scrollToElement("#dayli" + (parseInt(j.daySelected) - 1), 0);
- h("#dayli" + parseInt(j.daySelected)).addClass("selectedli")
- }
- j.dayScroll.off("scrollEnd");
- j.dayScroll.on("scrollEnd", function (w) {
- h(".dayli").removeClass("selectedli");
- var v = Math.round(j.dayScroll.y / (-41) + 1);
- j.daySelected = v;
- h("#dayli" + v).addClass("selectedli")
- })
- }, getList: function (v) {
- var x = { isCustomLeftButton: false };
- 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>';
- if (x.isCustomLeftButton) {
- j.picker_selector_html += '<button id="clear_date_picker" style="width: 50%;background: #E8E8E8;color: #000000;">' + x.customLeftButtonName + "</button>"
- } else {
- j.picker_selector_html += '<button id="cancel_date_picker" style="width: 50%;background: #E8E8E8; color: #000000;">取消</button>'
- }
- j.picker_selector_html += '<button id="confirm_date_picker" style="width: 50%;background: #E8E8E8;color: #3779d0;">确定</button>';
- h(".popup_layer_cont").html(j.picker_selector_html);
- var t = "<li> </li>", C = '<li id="yearli1899"> </li>', A = '<li id="monthli0"> </li>',
- u = '<li id="dayli0"> </li>';
- var s = h("#yearpicker"), z = h("#monthpicker"), B = h("#daypicker");
- if (v.val()) {
- selectedDate = new Date().toDate(v.val())
- }
- var y = (typeof selectedDate == "object") ? selectedDate : new Date();
- j.yearSelected = y.getFullYear();
- j.monthSelected = y.getMonth() + 1;
- j.daySelected = y.getDate();
- for (var w = 1900; w < 2050; w++) {
- C += '<li class="yearli" id="yearli' + w + '">' + w + "</li>"
- }
- for (var w = 1; w < 13; w++) {
- A += '<li class="monthli" id="monthli' + w + '">' + w + "月</li>"
- }
- var D = solarDays(j.yearSelected, (parseInt(j.monthSelected) - 1));
- for (var w = 1; w <= D; w++) {
- u += '<li class="dayli" id="dayli' + w + '">' + l.addZero(w) + "</li>"
- }
- C += t;
- A += t;
- u += t;
- s.html(C);
- z.html(A);
- B.html(u);
- j.yearScroll = new IScroll("#yearpickerscroll", { mouseWheel: false, scrollbars: false, snap: "li" });
- j.monthScroll = new IScroll("#monthpickerscroll", { mouseWheel: false, scrollbars: false, snap: "li" });
- j.dayScroll = new IScroll("#daypickerscroll", { mouseWheel: false, scrollbars: false, snap: "li" });
- j.yearScroll.scrollToElement("#yearli" + (y.getFullYear() - 1), 0);
- h("#yearli" + y.getFullYear()).addClass("selectedli");
- j.monthScroll.scrollToElement("#monthli" + y.getMonth(), 0);
- h("#monthli" + (y.getMonth() + 1)).addClass("selectedli");
- j.dayScroll.scrollToElement("#dayli" + (y.getDate() - 1), 0);
- h("#dayli" + y.getDate()).addClass("selectedli");
- j.yearScroll.on("scrollEnd", function (F) {
- h(".yearli").removeClass("selectedli");
- var E = Math.round(j.yearScroll.y / (-41) + 1900);
- j.yearSelected = E;
- h("#yearli" + E).addClass("selectedli");
- j.reCountDay()
- });
- j.monthScroll.on("scrollEnd", function (F) {
- h(".monthli").removeClass("selectedli");
- var E = Math.round(j.monthScroll.y / (-41) + 1);
- j.monthSelected = E;
- h("#monthli" + E).addClass("selectedli");
- j.reCountDay()
- });
- j.dayScroll.on("scrollEnd", function (F) {
- h(".dayli").removeClass("selectedli");
- var E = Math.round(j.dayScroll.y / (-41) + 1);
- j.daySelected = E;
- h("#dayli" + E).addClass("selectedli")
- });
- h("#confirm_date_picker").bind("tap", function () {
- var H = new Date(j.yearSelected, j.monthSelected - 1, j.daySelected, y.getHours(), y.getMinutes(), y.getSeconds()),
- G = H.getFullYear() + "-" + (H.getMonth() + 1) + "-" + H.getDate() + " " + l.addZero(H.getHours()) + ":" + l.addZero(H.getMinutes()) + ":" + l.addZero(H.getSeconds()),
- F = H.getFullYear() + "-" + (H.getMonth() + 1) + "-" + H.getDate(),
- E = l.addZero(H.getHours()) + ":" + l.addZero(H.getMinutes()) + ":" + l.addZero(H.getSeconds());
- if (typeof v == "object") {
- v.val(F)
- }
- j.close()
- });
- h("#cancel_date_picker").bind("tap", function () {
- j.close()
- })
- }
- };
- var b = {
- wait: 59, updateTimer: function (s) {
- if (b.wait == 0) {
- h(s).val("重新发送");
- h(s).removeAttr("disabled");
- h(s).css({ color: "#438eff", "text-align": "left" })
- } else {
- if (b.wait == 59) {
- if (!h(s).attr("disabled")) {
- h(s).attr("disabled", "disabled")
- }
- h(s).css({ color: "#b3b3b3", "text-align": "left" })
- }
- h(s).val("重新发送(" + b.wait + ")");
- b.wait--;
- setTimeout(function () {
- b.updateTimer(s)
- }, 1000)
- }
- }
- };
- var n = {
- rules: {
- email: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,4}){1,2})$/,
- 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})?(\/+.*)*$/,
- counter: /^[a-zA-Z][a-zA-Z0-9_]{4,15}$/,
- number: /^\\-?\\d+(\\.\\d+)?$/,
- tel: /\d{3}-\d{8}|\d{4}-\d{7}/,
- 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}$/,
- zipCode: /[1-9]\d{5}(?!\d)/,
- //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])$)$/,
- idNo: /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1|5|7][0-9]{6}\([0-9Aa]\))|(^[a-zA-Z][0-9]{9}$)|(^((\s?[A-Za-z])|([A-Za-z]{2}))\d{6}(([0−9aA])|([0-9aA]))$)|(^[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])$)$/,
- date: /^\d{4}-\d{1,2}-\d{1,2}/,
- password: /^[a-zA-Z]\w{5,17}$/,
- smsCode: /\d{6}$/,
- cardId: /\d{8}$/,
- address: /^[\s\S]{10,}$/,
- select: /^[\s\S]{1,}$/,
- message: {
- radio: "请选择一个选项",
- checkbox: "如果要继续,请选中此框",
- select: "请选择列表中的一项",
- email: "请输入正确的电子邮件地址",
- url: "请输入正确网站地址",
- tel: "请输入正确的电话号码",
- phone: "请输入正确的手机号码",
- idNo: "请输入正确身份证号码",
- number: "请输入数字",
- date: "请输入正确的日期格式",
- pattern: "内容格式不符合要求",
- empty: "请填写此字段",
- password: "长度6~18,字母开头,含字母数字下划线",
- smsCode: "请输入正确的手机短信验证码",
- cardId: "请输入正确的诊疗卡号码",
- address: "地址长度要大于10个汉字",
- select: "请选择"
- }
- }, matchId: { password: "#password", message: { password: "2次密码输入不一致"} }, check: function (s) {
- if (h("#noValidate")) {
- h("#noValidate").remove()
- }
- var u = h(s).find("input,select").length - 1, t = false;
- h(s).find("input,select").each(function (v) {
- h(this).unbind("tap");
- if (h(this).attr("required")) {
- var w = h(this).attr("required");
- if (n.rules[w]) {
- if (h(this).val().match(n.rules[w])) {
- } else {
- n.tips(this, n.rules.message[w]);
- return false
- }
- } else {
- if (h(this).val().length < 1) {
- n.tips(this, n.rules.message.empty);
- return false
- }
- }
- }
- if (h(this).attr("format")) {
- var w = h(this).attr("format");
- if (n.rules[w] && h(this).val().length > 0) {
- if (h(this).val().match(n.rules[w])) {
- } else {
- n.tips(this, n.rules.message[w]);
- return false
- }
- }
- }
- if (h(this).attr("matchId")) {
- var w = h(this).attr("matchId");
- if (n.matchId[w]) {
- if (h(this).val() == h(n.matchId[w]).val()) {
- } else {
- n.tips(this, n.matchId.message[w]);
- return false
- }
- }
- }
- if (u == v) {
- t = true
- }
- });
- return t
- }, tips: function (w, v) {
- var s = {
- border: "1px solid rgb(247, 206, 57)",
- "text-align": "left",
- color: "rgb(51, 51, 51)",
- "font-size": "0.8rem",
- padding: "5px 10px",
- position: "relative",
- "border-radius": "4px",
- "line-height": "0.8rem",
- top: "0",
- "background-color": "rgb(255, 255, 224)",
- "z-index": "1"
- }, t = {
- "border-color": "transparent transparent rgb(247, 206, 57)",
- "border-style": "dashed dashed solid",
- bottom: "0px",
- width: "0px; height: 0px",
- overflow: "hidden",
- "border-width": "6px; position: absolute",
- top: "-13px"
- }, u = {
- "border-color": "transparent transparent rgb(255, 255, 224)",
- "border-style": "dashed dashed solid; bottom: -1px",
- width: "0px",
- height: "0px",
- overflow: "hidden",
- "border-width": "6px; position: absolute",
- top: "-12px"
- };
- var x = h('<div id="noValidate"><div class="front"></div><div class="back"></div>' + v + "</div>").css(s);
- h(w).parent().append(x);
- h("#noValidate div.front").css(t);
- h("#noValidate div.back").css(u);
- h(w).on("tap", function () {
- h("#noValidate").remove()
- });
- h(w)[0].focus()
- }
- };
- var m = {
- ton: function (s) {
- h(s).on("touchstart touchmove touchend", function (t) {
- if (t.type == "touchstart") {
- h(this).addClass("ton")
- } else {
- if (t.type == "touchmove") {
- h(this).removeClass("ton")
- } else {
- h(this).removeClass("ton")
- }
- }
- })
- }, popWinLayer: function (u, t, s) {
- if (t) {
- h(".asort .fl span").text(t)
- }
- if (u) {
- h("#newwrap").attr("src", u);
- h(".asort").eq(0).addClass("show")
- } else {
- h(".asort").eq(s).addClass("show")
- }
- h(".hzApp-over-layer").addClass("show")
- }, closeWinLayer: function () {
- h(".hzApp-over-layer").removeClass("show");
- setTimeout(function () {
- h(".hzApp-over-layer .asort").removeClass("show")
- }, 100);
- try {
- reload.doing()
- } catch (s) {
- }
- }, icoAddEvent: function () {
- m.ton("header i, .hd .fr, .hd .fl i, A.btn-large");
- if (h(".menu_home")) {
- h(".menu_home").on("touchend", function () {
- setTimeout(function () {
- window.location.href = "index.html"
- }, 200)
- })
- }
- if (h(".menu_back")) {
- h(".menu_back").on("tap", function () {
- window.history.back()
- })
- }
- if (h(".menu_todo")) {
- h(".menu_todo").on("tap", function () {
- if (h(this).hasClass("tap")) {
- h(this).removeClass("tap");
- h("#todo").removeClass("show")
- } else {
- h(this).addClass("tap");
- h("#todo").addClass("show")
- }
- })
- }
- if (h(".selectToggle")) {
- h(".selectToggle .top-nav").on("tap", function () {
- if (h(".selectToggle .arrow-box i").hasClass("icon-arrowdown")) {
- h(".selectToggle ul").css({ display: "block" });
- h(".selectToggle .arrow-box i").removeClass("icon-arrowdown");
- h(".selectToggle .arrow-box i").addClass("icon-arrowup");
- h(".selectToggle .marginall .text").html("")
- } else {
- h(".selectToggle ul").css({ display: "none" });
- h(".selectToggle .arrow-box i").removeClass("icon-arrowup");
- h(".selectToggle .arrow-box i").addClass("icon-arrowdown");
- h(".selectToggle .marginall .text").html(h(".selectToggle ul li.selected").html())
- }
- })
- }
- if (h(".menu_family")) {
- h(".menu_family").on("tap", function () {
- if (h(this).hasClass("tap")) {
- h(this).removeClass("tap");
- h("#family_todo").removeClass("show")
- } else {
- h(this).addClass("tap");
- h("#family_todo").addClass("show")
- }
- })
- }
- if (h("#todo .todo_msk")) {
- h("#todo .todo_msk").on("tap", function () {
- h("#todo").removeClass("show");
- h(".menu_todo").removeClass("tap")
- })
- }
- if (h("#family_todo .todo_msk")) {
- h("#family_todo .todo_msk").on("tap", function () {
- h("#family_todo").removeClass("show");
- h(".menu_family").removeClass("tap")
- })
- }
- if (h("#todo td")) {
- h("#todo td").on("touchend", function () {
- var s = h(this).find("a").attr("vhref");
- if (h("#family_todo .ck").parent().attr("data")) {
- var t = JSON.parse(h("#family_todo .ck").parent().attr("data"));
- s += "?id=" + t.id
- }
- m.popWinLayer(s, h(this).find("label").text(), h(this).parent().index());
- h(".menu_todo").trigger("tap")
- })
- }
- if (h(".menu_close_layer,.hd .fr i.icon-del")) {
- h(".menu_close_layer,.hd .fr i.icon-del").on("tap", function () {
- m.closeWinLayer()
- })
- }
- }, icoEventCallback: function (s) {
- if (!s) {
- s = 0
- }
- switch (s) {
- case 1:
- h(".alist .button").on("tap", function () {
- d.sendData(window.apiUrl + "?c=Index&a=favoriteHospital", JSON.parse(h(this).parent().attr("data")), false, ["更新失败", "更新成功"], [0, h(this)])
- });
- break;
- case 2:
- h(".alist .button").on("tap", function () {
- d.sendData(window.apiUrl + "?c=Index&a=favoriteDoctor", JSON.parse(h(this).parent().attr("data")), false, ["更新失败", "更新成功"], [0, h(this)])
- });
- break;
- case 3:
- h("#list ul").append('<li class="line1 bar hide"></li>');
- h("li.line1.bar").on("tap", function () {
- if (h(this).hasClass("title")) {
- h(this).removeClass("title");
- h(this).find("i").removeClass("icon-arrowup").addClass("icon-arrowdown");
- t(h(this), false)
- } else {
- h(this).addClass("title");
- h(this).find("i").removeClass("icon-arrowdown").addClass("icon-arrowup");
- t(h(this), true)
- }
- function t(w, u) {
- var v = w.next();
- while (!v.hasClass("bar")) {
- if (u) {
- v.removeClass("hide")
- } else {
- v.addClass("hide")
- }
- v = v.next()
- }
- }
- });
- break;
- case 4:
- h(".selectToggle ul").css({ display: "none" });
- h(".selectToggle .marginall .text").html(h(".selectToggle ul li.selected").find("a").html());
- reload.doing();
- h(".selectToggle ul li").on("tap", function () {
- h(".selectToggle ul li").each(function () {
- if (h(this).hasClass("selected")) {
- h(this).removeClass("selected");
- h(this).find("i").removeClass("icon-radioCheck");
- h(this).find("i").addClass("icon-radio")
- }
- });
- h(this).addClass("selected");
- h(this).find("i").removeClass("icon-radio");
- h(this).find("i").addClass("icon-radioCheck");
- h(".selectToggle .arrow-box i").removeClass("icon-arrowup");
- h(".selectToggle .arrow-box i").addClass("icon-arrowdown");
- h(".selectToggle .marginall .text").html(h(this).find("a").html());
- h(".selectToggle ul").css({ display: "none" });
- var t = JSON.parse(h(this).find("a").attr("data"));
- var u = h("#header p").text();
- h("#header p").text(t.trueName + u.substring(u.indexOf("的"), u.length));
- reload.doing()
- });
- break;
- case 5:
- h("#drugName").val("");
- h("#frequency").val(1);
- h("#doseType").val("片");
- h("#start_date").val(new Date().format("yyyy-M-dd"));
- h("#diagnose").val("");
- h("#source").val("");
- break;
- case 6:
- h("input[name=customerFamilyId]").eq(0).attr("checked", "checked");
- break;
- case 7:
- h(".asort .fr").trigger("tap");
- h("input[name=customerFamilyId]").eq(0).attr("checked", "checked");
- break;
- case 8:
- break
- }
- }, switchStatus: function (t) {
- if (t) {
- switch (t[0]) {
- case 0:
- if (t[1].attr("name") == "del") {
- t[1].attr("name", "add");
- t[1].text("添加");
- t[1].siblings(".selected").css("display", "none")
- } else {
- t[1].attr("name", "del");
- t[1].text("取消");
- t[1].siblings(".selected").css("display", "block")
- }
- break;
- case 1:
- var s = ["pending", "missing"];
- t[1].attr("name", "taken");
- t[1].html("已服");
- t[1].removeClass(s[s.indexOf(t[1].attr("name"))]);
- t[1].addClass("button");
- break
- }
- }
- }
- };
- var e = {
- reset: function () {
- c.w = h(window).width();
- c.h = h(window).height();
- h(".reSize").height(c.h / 2);
- if (h("#ListCycle")) {
- h("#ListCycle li").height(c.w * 0.96 / 2);
- h("#ListCycle li").css("padding-top", c.w * 0.96 / 8);
- h("#ListCycle").show()
- }
- if (h(".title_d").width() - h(".title").width() > 0) {
- h(".title_d").addClass("round")
- } else {
- h(".title_d").removeClass("round")
- }
- var u = navigator.userAgent;
- var t = u.toLowerCase();
- function s() {
- WeixinJSBridge.call("hideOptionMenu");
- WeixinJSBridge.call("hideToolbar")
- }
- if (typeof WeixinJSBridge == "undefined") {
- if (document.addEventListener) {
- document.addEventListener("WeixinJSBridgeReady", s, false)
- } else {
- if (document.attachEvent) {
- document.attachEvent("WeixinJSBridgeReady", s);
- document.attachEvent("onWeixinJSBridgeReady", s)
- }
- }
- } else {
- s()
- }
- }
- };
- window.hzAPI = d;
- window.login = o;
- window.Fx = f;
- window.validate = n;
- window.calendar = g;
- window.HoursDose = l;
- window.DatePicker = j;
- window.TimePicker = r;
- window.timerBt = b;
- window.counter = a;
- window.planPerDay = q;
- window.TabBlock = k;
- window.icoNavFx = p;
- window.config = c;
- window.icoNav = m;
- // window.apiUrl = "http://ywtwx.dept.nfyy.com/ywtapi/";
- // window.apiUrl = 'http://homestead.app/dhapi/';
- // window.apiUrl = "http://wxapi.demo.ywtinfo.com/dhapi/";
- // window.apiUrl = "http://localhost:8094/dhapi/";
- window.apiUrl = "http://nfywtapi.clh.com:81/dhapi/";
- h(window).on("load", function () {
- e.reset()
- });
- m.icoAddEvent()
- })(Zepto);
|