123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- $(function(){
- var page = 1,//第一页
- type = 0,//类型
- top,//滚动条的位移
- documentLength,//总长
- finish = 0,//加载标志 1为可加载
- winLength = $(window).height();//屏幕框
- mui.plusReady(function() {
- plus.nativeUI.showWaiting();
- initData();
- bindEvent();
- })
- function initData(){
- var params = {};
- sendPost("doctor/consult/evaluate/getScoreTitle", params, queryFailed, success);
- sendPost("doctor/consult/evaluate/label", params, queryFailed, success2);
- sendPost("doctor/consult/evaluate/getScoreListTitle", params, queryFailed, success4);
- queryEvaluateData();
- }
-
- function success(res) {
- if(res.data[0].score == 0){
- $('#score').html('<span style="font-size:20px">暂无评分</span>');
- }else{
- $('#ability').html(res.data[0].ability);
- $('#speed').html(res.data[0].speed);
- $('#attitude').html(res.data[0].attitude);
- $('#score').html(res.data[0].score);
- $('.type-score').css('display','-webkit-box');
- }
- };
- function success2(res) {
- var html='';
- if(res.list.length > 0){
- $.each(res.list, function(i,v) {
- html += '<li class="one">'+v.content+'</li>';
- });
- }else{
- $('.man-tags').hide();
- }
- $('#tagShow').append(html);
- };
- function success4(res) {
- $('#tag_all').html(res.data[0].total);
- $('#tag_good').html(res.data[0].good);
- $('#tag_middle').html(res.data[0].notBad);
- $('#tag_bad').html(res.data[0].bad);
- };
-
- function queryFailed(res) {
- plus.nativeUI.closeWaiting();
- if(res && res.msg) {
- plus.nativeUI.toast(res.msg);
- } else {
- plus.nativeUI.toast("数据加载失败");
- }
- }
-
- template.helper("setSex", function(s) {
- if(s == 1) {
- return "男"
- } else if(s == 2) {
- return "女"
- }
- })
- template.helper("setRemark", function(score,remark) {
- if(remark) {
- return remark
- }else if(score > 70) {
- return "好评"
- }else if(score > 40) {
- return "中评"
- }else{
- return "差评"
- }
- })
-
- function queryEvaluateData(){
- var params = {
- type:type,
- page:page,
- size:10
- };
- sendPost("doctor/consult/evaluate/getDoctorSorceList", params, queryFailed, success3);
-
- function success3(res) {
- plus.nativeUI.closeWaiting();
- if(res.status == 200){
- var html = ''
- if(res.data.length==10){
- html = template("evaluate_list_tmp",{data:res.data})
- finish = 1;
- }else if(res.data.length>0){
- html = template("evaluate_list_tmp",{data:res.data})
- finish = 0;
- }else{
- html = '<li class="nodataimg"><div class="img"><img src="../../../images/shujuweikong_img.png" alt="" /></div><div class="text">暂无数据</div></li>'
- finish = 0;
- }
- $('.table-view').empty();
- $('.table-view').eq(type).append(html);
- resizeH();
- }else{
- queryFailed(res);
- }
- }
- }
- //加载更多
- function queryMoreData(){
- var params = {
- type:type,
- page:page,
- size:10
- };
- sendPost("doctor/consult/evaluate/getDoctorSorceList", params, queryFailed, success5);
-
- function success5(res) {
- if(res.status == 200){
- var html = ''
- if(res.data.length > 0){
- html = template("evaluate_list_tmp",{data:res.data})
- $('.table-view').eq(type).append(html);
- resizeH();
- finish = 1;
- }else{
- mui.toast("没有更多了")
- }
- }else{
- mui.toast("加载失败!")
- }
- }
- }
- //重新计算高度
- function resizeH(){
- documentLength = $(document).height();//总长
- }
-
- function bindEvent(){
- //固定导航栏
- var tagTop = $('#sliderTag').offset().top+88;
- $('.slider-group').css('min-height',winLength-102)
- window.onscroll=function(){
- top = document.body.scrollTop;//滚动条的位移
- if(top > tagTop){
- $('#sliderTag').css({
- 'position':'fixed',
- 'top':'45px',
- 'left':'0px',
- 'border-bottom':'solid 1px #d8d8d8',
- })
- $('#blank_tag').show();
- }else{
- $('#sliderTag').css({
- 'position':'static',
- 'top':'0px',
- 'left':'0px',
- 'border-bottom':'none',
- })
- $('#blank_tag').hide();
- }
- var poor = documentLength - winLength - top;
- if(poor < 100 && finish == 1){
- finish = 0;
- page++;
- queryMoreData();
- }
- }
- //slider切换
- $('.slide-li').click(function(){
- var $this = $(this);
- var num = $this.index();
- $this.addClass('active').siblings().removeClass('active');
- $('.table-view').hide();
- $('.table-view').eq(num).show();
- if (num === 0) {
- type = 0;
- page = 1;
- queryEvaluateData();
- }
- if (num === 1) {
- type = 1;
- page = 1;
- queryEvaluateData();
- }
- if (num === 2) {
- type = 2;
- page = 1;
- queryEvaluateData();
- }
- if (num === 3) {
- type = 3;
- page = 1;
- queryEvaluateData();
- }
- })
- }
- })
|