1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- var code = window.localStorage.getItem("familyCode"),
- name = window.localStorage.getItem("familyName"),
- mobile = window.localStorage.getItem("familyMobile"),
- imgUrl = window.localStorage.getItem("familyImgUrl"),
- relation = window.localStorage.getItem("familyRelation");
- var dd = dialog({contentType:'load', skin:'bk-popup', content:'发送中...'});
- var $sendWxMsg = $('#sendWxMsg'); // 发送添加申请按钮
- var Request = GetRequest();
- var reAdd = Request.reAdd;
- pageInit();
- function sendWXTempPromise(data) {
- return new Promise(function(resolve, reject) {
- sendPost("patient/family/sendWXTemp", data , "json", "POST",
- function failed (res) {
- dd.close();
- if (res && res.msg) {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show();
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:'发送失败'}).show();
- }
- }, function(res) {
- resolve(res)
- });
- })
- }
- function baseInfoInit() {
- var temp = name + ' <span>(' + mobile + ')</span>';
- // 头像为空设置默认头像
- if(imgUrl == undefined || imgUrl == null || imgUrl == ""){
- imgUrl = "../../../images/p-default.png";
- }
- $("#people").html(temp);
- $("#imgUrl").attr("src", getImgUrl(imgUrl));
- }
- function bindEvents() {
- $sendWxMsg.on('click',function() {
- if($(this).hasClass("btn-disabled")){
- return false;
- }
- $(this).addClass("btn-disabled");
-
- var data = {
- member: code,
- relation: relation
- };
- if(reAdd=="1") {
- data.reAdd = reAdd;
- }
- sendWXTempPromise(data)
- .then(function(res) {
- if(res.status=="200") {
- // $sendWxMsg.addClass("btn-disabled");
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:"已发送添加申请"}).show();
- } else {
- $('#sendWxMsg').removeClass("btn-disabled");
- if(res.msg){
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:res.msg}).show();
- }else{
- dialog({contentType:'tipsbox', skin:'bk-popup' , content:"发送失败"}).show();
- }
-
- }
- })
- .catch(function(e) {
- console && console.error(e)
- })
- })
- }
- function pageInit() {
- baseInfoInit();
- bindEvents();
- }
|