123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var id = 0;
- var pageSize = 10;
- var generatedCount=0;
- var pagetype=3;
- var userAgent = window.localStorage.getItem(agentName);
- var iscrollState='';//判断滑动方向
- $(function(){
- // 判断是否登录
- checkUserAgent();
- // 点击咨询详情
- $("body").on("tap", ".n-list", function () {
- var id = $(this).data("id");
- var photo = $(this).data("photo");
- window.location.href = "guidance-detail.html?id=" + id;
- })
-
- //一键已读
- $("#read_all").on("tap", function(){
- d.show();
- sendPost("/patient/health/guidance/modifyStatus",{},'json','post', function(res){
- d.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(res){
- if(res.status == 200){
- //隐藏所有的newicon
- $(".icon-news").hide();
- }
- d.close();
- })
- })
-
- mui.init({
- pullRefresh : {
- container:'#wrapper',
- down : {
- height:50,
- auto: false,
- contentdown : "下拉可以刷新",
- contentover : "释放立即刷新",
- contentrefresh : "正在刷新...",
- callback: function(){
- id = 0;
- iscrollState='down'
- queryInit()
- }
- },
- up : {
- height:50,
- contentinit: '',
- contentdown: '',
- contentrefresh : "正在加载...",
- contentnomore:'没有更多数据了',
- callback: function() {
- iscrollState='up'
- queryInit()
- }
- }
- }
- })
- })
- appendFamilyMember($('#memberContainer'),function(){
- $("#ul_guidance").empty();
- $(".div-no-info").hide();
- $(".main").show();
- $("#read_all").show();
- id=0;
- iscrollState='';
- mui('#wrapper').pullRefresh().refresh(true)
- queryInit();
- },function(){
- //判断有授权家人,修改样式
- if($('#memberContainer').is(':hidden')){
- $('#wrapper').css('top','0px');
- }else{
- $('#wrapper').css('top','90px');
- $('.div-no-info').css('padding-top','90px');
- }
- })
- /**
- * 界面数据初始化
- */
- function queryInit(){
- // 验证居民信息是否完善
- checkBaseInfo()
-
- var data = {};
- data.id = id;
- data.pagesize = pageSize;
- sendPost("patient/health/guidance/list", data, "json", "post", queryListFailed, queryAppoListSuccess);
- }
- function queryListFailed() {
- d.close();
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'});
- }
- function queryAppoListSuccess(res){
- if (res.status == 200) {
- if (res.list.length > 0) {
- var list = res.list;
- var html=''
- for (var i = 0; i < list.length; i++){
- id = list[i].id;
- var content1 = list[i].content;
- var name = list[i].name;
- var createTime = list[i].createTime.substring(0,16);
- var photo = list[i].photo;
- var docType=list[i].level;
- var job = "健管师";
- if(docType==1){
- job = "专科医生";
- }if(docType==2){
- job = "全科医生";
- }
- if(photo == undefined || photo == null || photo == ""){
- photo = "../../../images/d-default.png";
- }
- var newHtml = "";
- if(list[i].readStatus == 0){ //readStatus: 0未读 1已读
- newHtml = '<div class="icon-news"></div>';
- }
- var content = '<li><div class="div-date">'+createTime+'</div>'+
- '<div class="n-list dr-item c-border" data-id="'+id+'" data-photo="'+photo+'">'+
- '<div class="n-list-li">'+
- '<div class="n-list-key">'+
- '<div class="div-title">健康指导</div><div class="n-avatar-l img-round">'+
- '<img src="'+getImgUrl(photo)+'">'+
- '</div>'+
- '<div class="div-name"><span class="span-name">'+name+'</span></div>'+
- '</div>'+
- '<div class="div-list-info pl10" >'+
- content1+
- '</div>'+
- newHtml+
- '</div>'+
- '<div class="list-area list-arrow-r">'+
- '<div class="c-list-info">'+
- '<p>点击查看</p>'+
- '</div>'+
- '</div>'+
- '</div></li>';
- html += content;
- }
- if(iscrollState == 'down'){
- $('#ul_guidance').empty().append(html);
- setTimeout(function(){
- mui('#wrapper').pullRefresh().endPulldownToRefresh(false);
- mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置
- },1000)
- }else{
- $('#ul_guidance').append(html);
- if(list.length < pageSize){
- mui('#wrapper').pullRefresh().endPullupToRefresh(true);
- }else{
- mui('#wrapper').pullRefresh().endPullupToRefresh(false);
- }
- }
- } else {
- if(id!=0){
- setTimeout(function(){
- mui('#wrapper').pullRefresh().endPullupToRefresh(true);
- },1000)
- }else{
- //显示无数据的图片
- $(".main").hide();
- $("#read_all").hide();
- $(".div-no-info").show();
- mui('#wrapper').pullRefresh().enablePullupToRefresh();
- }
- }
- d.close()
- } else {
- queryListFailed()
- }
- }
|