1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var msgId,
- concernCode;
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- msgId = self.msgId;
- concernCode = self.concernCode;
- setMessageRead();
- getTemplateHelper();
- backParent();
- });
- function setMessageRead(){
- var url = "/doctor/message/read_health",
- params = {
- msgid: msgId
- };
- sendPost(url, params, null, function(res){
- if(res.status == 200){
- getInfo();
- }else{
- mui.toast(res.msg);
- }
- }, 'POST', '', true)
- }
- function backParent(){
- var old_back = mui.back;
- mui.back = function() {
- var self = plus.webview.currentWebview();
- if(self.opener && self.opener()){
- mui.fire(self.opener(), "refreshMessage");
- }
- old_back();
- }
- }
- function getInfo(){
- var url = "/doctor/concern/findByCode",
- params = {
- concernCode: concernCode
- };
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- var obj = res.data;
- obj.idcardStr = getFormatStr(obj.idcard, 6, 8);
- obj.sscStr = getFormatStr(obj.ssc, 4, 4);
- obj.mobileStr = getFormatStr(obj.mobile, 3, 4);
- var html = template("info-tmp", res.data);
- $("#main").empty().append(html);
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
- function getFormatStr(str, startIndex, length){
- //从字符串的第几位开始,长度为多少的字符串,转换为*
- var sb = str.substr(startIndex, length),
- reg = new RegExp(sb,"gi"),
- rs = "";
- for(i=0; i<length; i++){
- rs += "*";
- }
- return str.replace(reg, rs);
-
- }
- function getTemplateHelper(){
- template.helper("getPhoto", function(str){
- return getImgUrl(str);
- });
-
- template.helper("getSexName", function(type){
- if(type == '1'){
- return "男";
- }else if(type == "2"){
- return "女";
- }else{
- return "未知";
- }
- })
- }
|