consultation.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. new Vue({
  2. el: '#app',
  3. data: {
  4. total:'',//总页数
  5. currentPage:1,//当前页数
  6. list:[],//列表集合
  7. patient:null,
  8. teamCode:null
  9. },
  10. methods:{
  11. msgListView: function(page){
  12. var vm=this;
  13. if(page){
  14. vm.currentPage=page;
  15. var data = {
  16. patient:vm.patient,
  17. teamCode:vm.teamCode,
  18. page:page,
  19. pagesize:10
  20. }
  21. recordAPI.consultList(data).then(function(res){
  22. if(res.status==200){
  23. if(res.data.length>0){
  24. //初始赋总数
  25. if(page == 1){
  26. vm.total = Math.ceil(res.data[0].total/10);
  27. }
  28. vm.list=res.data;
  29. $(".consultation-list").animate({scrollTop:0},0);//滚回顶部
  30. $(".slimScrollBar").css('top',0);
  31. }else{
  32. top.toastr.info("没有更多内容了");
  33. }
  34. }else{
  35. top.toastr.error(res.msg);
  36. }
  37. })
  38. }
  39. }
  40. },
  41. mounted: function(){
  42. this.patient = localStorage.getItem("severPatientCode");
  43. this.teamCode = JSON.parse(localStorage.getItem("severPatientTeam")).id;
  44. this.msgListView(this.currentPage);
  45. },
  46. })