123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var dd = dialog({contentType:'load', skin:'bk-popup', content:'提交中...'});
- var scroller1 = new IScrollPullUpDown('wrapper',{
- probeType:2,
- bounceTime: 250,
- bounceEasing: 'quadratic',
- mouseWheel:false,
- scrollbars:true,
- click:true,
- fadeScrollbars:true,
- interactiveScrollbars:false
- }, null, null);
- $(function(){
- // 判断是否登录
- checkUserAgent();
- // 获取缓存
- var relationIndex = "relation" + window.localStorage.getItem("index");
- var name = window.localStorage.getItem("name");
- var imgUrl = window.localStorage.getItem("imgUrl");
- var code = window.localStorage.getItem("code");
- var mobile = window.localStorage.getItem("mobile");
- var idcard = window.localStorage.getItem("idcard");
- var address = window.localStorage.getItem("address");
- var sign = window.localStorage.getItem("sign");
- var relation = window.localStorage.getItem(relationIndex);
- $("#name").html(name);
- $("#pic").attr("src", getImgUrl(imgUrl));
- $("#idcard").html(idcard);
- $("#mobile").html(mobile);
- $("#address").html(address);
- $("#sign").html(sign);
- var relationText = "";
- if (relation == 1) {
- relationText = "父亲";
- } else if (relation == 2) {
- relationText = "母亲";
- } else if (relation == 3) {
- relationText = "老公";
- } else if (relation == 4) {
- relationText = "老婆";
- } else if (relation == 5) {
- relationText = "儿子";
- } else if (relation == 6) {
- relationText = "女儿";
- } else {
- relationText = "其他";
- }
- $("#select").find("p").html(relationText);
- // 选择家庭关系
- $('#select').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- formatValue: function(d) {
- return d;
- },
- customWheels: true,
- wheels: [
- [{
- keys: ['1', '2', '3', '4', '5', '6', '0'],
- values: ['父亲', '母亲', '老公', '老婆', '儿子', '女儿', '其他']
- }]
- ],
- onSelect: function(valueText, inst) {
- var values = eval("[" + valueText + "]");
- window.localStorage.removeItem(relationIndex);
- window.localStorage.setItem(relationIndex, values[0].keys);
- $('#select').find("p").html(values[0].values);
- selectKey = values[0].keys;
- dd.show();
- var data = {};
- data.member = code;
- data.relation = selectKey;
- sendPost("patient/family/relation_update", data, "json", "post", changeFailed, changeSuccess);
- }
- });
- // 删除家人
- $("#delete").bind("tap", function () {
- dialog({
- content:'删除家人后,无法查看家人信息,并为家人进行相关操作,是否继续删除',
- button: [
- {
- value: '继续删除',
- callback: function(){
- this.close();
- dd.show();
- var data = {};
- data.member = code;
- sendPost("patient/family/member_delete", data, "json", "post", deleteFailed, deleteSuccess);
- }
- },
- {
- value: '不了,谢谢',
- callback: function(){}
- }
- ]
- }).showModal();
- });
- });
- // 禁止拖动
- document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
- // 修改失败
- function changeFailed (res) {
- dd.close();
- if (res && res.msg) {
- var d1 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg});
- } else {
- var d2 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'});
- }
- }
- // 修改成功
- function changeSuccess (res) {
- if (res.status == 200) {
- dd.close();
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:"家庭关系修改成功"}).show();
- } else {
- //非200则为失败
- changeFailed(res);
- }
- }
- // 删除失败
- function deleteFailed (res) {
- dd.close();
- if (res && res.msg) {
- var d1 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg});
- } else {
- var d2 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'});
- }
- }
- // 删除成功
- function deleteSuccess (res) {
- if (res.status == 200) {
- dd.close();
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show();
- setTimeout(function(){
- window.location.href = "family.html";
- }, 1000);
- } else {
- //非200则为失败
- deleteFailed(res);
- }
- }
|