default.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. },
  7. onLoad: function () {
  8. app.globalData.userInfo={};
  9. app.globalData.userInfo.UserID=1;
  10. var that = this;
  11. that.setData({
  12. Containnerheight: main.getWindowHeight(),
  13. });
  14. },
  15. onShow:function(){
  16. var that = this;
  17. main.getLocalHost(function () {
  18. common.getStorageValue(that, "CardMaxNumberNew", 10, function () {
  19. common.getStorageValue(that, "CardMaxNumberHistory", 30, function () {
  20. that.getList();
  21. wx.stopPullDownRefresh();
  22. });
  23. });
  24. });
  25. },
  26. onPullDownRefresh:function(){
  27. this.onShow();
  28. },
  29. goto:function(e){
  30. var url=e.currentTarget.dataset.url;
  31. wx.navigateTo({
  32. url: './'+url,
  33. })
  34. },
  35. getList: function () {
  36. var that = this;
  37. var url = 'GetMiaoguoCardToday?UserID=' + app.globalData.userInfo.UserID;
  38. url += "&New=" + this.data.CardMaxNumberNew;
  39. url += "&History=" + this.data.CardMaxNumberHistory;
  40. main.getData(url, function (data) {
  41. if (data) {
  42. var TodayTaskNumber=data.ListNew.length+data.ListReview.length+data.ListHistory.length;
  43. that.setData({
  44. List: data,
  45. TodayTaskNumber: TodayTaskNumber
  46. });
  47. wx.setStorageSync("TaskToday", data);
  48. main.getData("GetBaiduToken",function(data){
  49. app.globalData.BaiduToken = data;
  50. });
  51. }
  52. });
  53. },
  54. gotoCard: function () {
  55. wx.redirectTo({
  56. url: './searchCard',
  57. })
  58. },
  59. onShareAppMessage: function () {
  60. return {
  61. title: '',
  62. path: 'pages/miaoguo/default',
  63. success: function (res) {
  64. },
  65. fail: function (err) {
  66. console.log(err);
  67. },
  68. complete: function (res) {
  69. console.log(res);
  70. },
  71. }
  72. },
  73. })