manyidu.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. $(function(){
  2. var page = 1,//第一页
  3. type = 0,//类型
  4. top,//滚动条的位移
  5. documentLength,//总长
  6. finish = 0,//加载标志 1为可加载
  7. winLength = $(window).height();//屏幕框
  8. mui.plusReady(function() {
  9. plus.nativeUI.showWaiting();
  10. initData();
  11. bindEvent();
  12. })
  13. function initData(){
  14. var params = {};
  15. sendPost("doctor/consult/evaluate/getScoreTitle", params, queryFailed, success);
  16. sendPost("doctor/consult/evaluate/label", params, queryFailed, success2);
  17. sendPost("doctor/consult/evaluate/getScoreListTitle", params, queryFailed, success4);
  18. queryEvaluateData();
  19. }
  20. function success(res) {
  21. if(res.data[0].score == 0){
  22. $('#score').html('<span style="font-size:20px">暂无评分</span>');
  23. }else{
  24. $('#ability').html(res.data[0].ability);
  25. $('#speed').html(res.data[0].speed);
  26. $('#attitude').html(res.data[0].attitude);
  27. $('#score').html(res.data[0].score);
  28. $('.type-score').css('display','-webkit-box');
  29. }
  30. };
  31. function success2(res) {
  32. var html='';
  33. if(res.list.length > 0){
  34. $.each(res.list, function(i,v) {
  35. html += '<li class="one">'+v.content+'</li>';
  36. });
  37. }else{
  38. $('.man-tags').hide();
  39. }
  40. $('#tagShow').append(html);
  41. };
  42. function success4(res) {
  43. $('#tag_all').html(res.data[0].total);
  44. $('#tag_good').html(res.data[0].good);
  45. $('#tag_middle').html(res.data[0].notBad);
  46. $('#tag_bad').html(res.data[0].bad);
  47. };
  48. function queryFailed(res) {
  49. plus.nativeUI.closeWaiting();
  50. if(res && res.msg) {
  51. plus.nativeUI.toast(res.msg);
  52. } else {
  53. plus.nativeUI.toast("数据加载失败");
  54. }
  55. }
  56. template.helper("setSex", function(s) {
  57. if(s == 1) {
  58. return "男"
  59. } else if(s == 2) {
  60. return "女"
  61. }
  62. })
  63. template.helper("setRemark", function(score,remark) {
  64. if(remark) {
  65. return remark
  66. }else if(score > 70) {
  67. return "好评"
  68. }else if(score > 40) {
  69. return "中评"
  70. }else{
  71. return "差评"
  72. }
  73. })
  74. function queryEvaluateData(){
  75. var params = {
  76. type:type,
  77. page:page,
  78. size:10
  79. };
  80. sendPost("doctor/consult/evaluate/getDoctorSorceList", params, queryFailed, success3);
  81. function success3(res) {
  82. plus.nativeUI.closeWaiting();
  83. if(res.status == 200){
  84. var html = ''
  85. if(res.data.length==10){
  86. html = template("evaluate_list_tmp",{data:res.data})
  87. finish = 1;
  88. }else if(res.data.length>0){
  89. html = template("evaluate_list_tmp",{data:res.data})
  90. finish = 0;
  91. }else{
  92. html = '<li class="nodataimg"><div class="img"><img src="../../../images/shujuweikong_img.png" alt="" /></div><div class="text">暂无数据</div></li>'
  93. finish = 0;
  94. }
  95. $('.table-view').empty();
  96. $('.table-view').eq(type).append(html);
  97. resizeH();
  98. }else{
  99. queryFailed(res);
  100. }
  101. }
  102. }
  103. //加载更多
  104. function queryMoreData(){
  105. var params = {
  106. type:type,
  107. page:page,
  108. size:10
  109. };
  110. sendPost("doctor/consult/evaluate/getDoctorSorceList", params, queryFailed, success5);
  111. function success5(res) {
  112. if(res.status == 200){
  113. var html = ''
  114. if(res.data.length > 0){
  115. html = template("evaluate_list_tmp",{data:res.data})
  116. $('.table-view').eq(type).append(html);
  117. resizeH();
  118. finish = 1;
  119. }else{
  120. mui.toast("没有更多了")
  121. }
  122. }else{
  123. mui.toast("加载失败!")
  124. }
  125. }
  126. }
  127. //重新计算高度
  128. function resizeH(){
  129. documentLength = $(document).height();//总长
  130. }
  131. function bindEvent(){
  132. //固定导航栏
  133. var tagTop = $('#sliderTag').offset().top+88;
  134. $('.slider-group').css('min-height',winLength-102)
  135. window.onscroll=function(){
  136. top = document.body.scrollTop;//滚动条的位移
  137. if(top > tagTop){
  138. $('#sliderTag').css({
  139. 'position':'fixed',
  140. 'top':'45px',
  141. 'left':'0px',
  142. 'border-bottom':'solid 1px #d8d8d8',
  143. })
  144. $('#blank_tag').show();
  145. }else{
  146. $('#sliderTag').css({
  147. 'position':'static',
  148. 'top':'0px',
  149. 'left':'0px',
  150. 'border-bottom':'none',
  151. })
  152. $('#blank_tag').hide();
  153. }
  154. var poor = documentLength - winLength - top;
  155. if(poor < 100 && finish == 1){
  156. finish = 0;
  157. page++;
  158. queryMoreData();
  159. }
  160. }
  161. //slider切换
  162. $('.slide-li').click(function(){
  163. var $this = $(this);
  164. var num = $this.index();
  165. $this.addClass('active').siblings().removeClass('active');
  166. $('.table-view').hide();
  167. $('.table-view').eq(num).show();
  168. if (num === 0) {
  169. type = 0;
  170. page = 1;
  171. queryEvaluateData();
  172. }
  173. if (num === 1) {
  174. type = 1;
  175. page = 1;
  176. queryEvaluateData();
  177. }
  178. if (num === 2) {
  179. type = 2;
  180. page = 1;
  181. queryEvaluateData();
  182. }
  183. if (num === 3) {
  184. type = 3;
  185. page = 1;
  186. queryEvaluateData();
  187. }
  188. })
  189. }
  190. })