result_list.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. var downloadData={};
  5. Page({
  6. data: {
  7. IsPromotion:false,
  8. },
  9. onLoad: function (options) {
  10. var that = this;
  11. var isPromotion=false;
  12. if (options.AgentCategory=="promotion"){
  13. isPromotion=true;
  14. }
  15. that.setData({
  16. Containnerheight: main.getWindowHeight(),
  17. IsPromotion:isPromotion,
  18. ListType:options.ListType,
  19. AgentCategory:options.AgentCategory,
  20. SelectMenuCss1:"selectItem",
  21. SelectMenuCss2:"",
  22. });
  23. wx.setNavigationBarTitle({
  24. title: that.data.ListType
  25. });
  26. this.getList();
  27. },
  28. getList:function(e){
  29. var that = this;
  30. var url="";
  31. if (that.data.ListType=="团队动态"){
  32. url="GetMiaoguoTeamDynamic?UserID=" + app.globalData.userInfo.UserID;
  33. }
  34. else{
  35. url="GetIntroducerUserList2?ListType="+that.data.ListType;
  36. url+="&AgentCategory="+that.data.AgentCategory;
  37. url+="&UserID=" + app.globalData.userInfo.UserID;
  38. }
  39. main.getData(url, function (data) {
  40. if (data) {
  41. downloadData=data;
  42. var info=data;
  43. if (that.data.ListType=="团队动态"){
  44. if (that.data.SelectMenuCss1=="selectItem")
  45. info=data.团队能量;
  46. else if (id==2)
  47. info=data.其他;
  48. }
  49. that.setData({
  50. Info:info,
  51. });
  52. }
  53. });
  54. },
  55. gotoRecord: function (e) {
  56. var that = this;
  57. var userid = e.currentTarget.dataset.userid;
  58. if (that.data.ListType=="团队动态"){
  59. wx.navigateTo({
  60. url: "user_relation?UserID="+userid,
  61. });
  62. }
  63. else{
  64. var url="GetMiaoguoAgentRecordID?AgentCategory="+that.data.AgentCategory;
  65. url+="&UserID=" + userid;
  66. main.getData(url, function (data) {
  67. if (data) {
  68. wx.navigateTo({
  69. url: "earnings_apply?RecordID="+data+"&AgentCategory="+that.data.AgentCategory,
  70. });
  71. }
  72. });
  73. }
  74. },
  75. goto: function (e) {
  76. var url = e.currentTarget.dataset.url;
  77. wx.navigateTo({
  78. url: url,
  79. });
  80. },
  81. onPullDownRefresh: function () {
  82. wx.stopPullDownRefresh();
  83. },
  84. onMenu:function(e){
  85. var that = this;
  86. var id=e.currentTarget.dataset.id;
  87. var SelectMenuCss1="",SelectMenuCss2="";
  88. if (id==1){
  89. SelectMenuCss1="selectItem";
  90. that.data.Info=downloadData.团队能量;
  91. }
  92. else if (id==2){
  93. SelectMenuCss2="selectItem";
  94. that.data.Info=downloadData.其他;
  95. }
  96. this.setData({
  97. SelectMenuCss1:SelectMenuCss1,
  98. SelectMenuCss2:SelectMenuCss2,
  99. Info: that.data.Info
  100. });
  101. },
  102. ShowImage:function(e){
  103. var url=e.currentTarget.dataset.url;
  104. wx.downloadFile({
  105. url: url,
  106. success(res) {
  107. wx.previewImage({
  108. current: res.tempFilePath, // 当前显示图片的http链接
  109. urls: [res.tempFilePath] // 需要预览的图片http链接列表
  110. });
  111. }
  112. });
  113. },
  114. onShareAppMessage: function () {
  115. return {
  116. title: app.globalData.ShareTitle,
  117. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  118. imageUrl: app.globalData.ShareImage,
  119. }
  120. },
  121. })