借钱借款助手 贷款产品助手

index.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //index.js
  2. var app = getApp();
  3. var utils = require('../../utils/util.js');
  4. Page({
  5. data: {
  6. imgUrls: [
  7. ],
  8. indicatorDots: true,
  9. autoplay: true,
  10. interval: 2000,
  11. duration: 1000,
  12. page:1,
  13. dataList: [
  14. ],
  15. hidden: true,
  16. listId:0
  17. },
  18. onLoad: function (options) {
  19. var that = this, source = '';
  20. const userInfo = wx.getStorageSync('userInfo');
  21. let tel= wx.getStorageSync('tel'), user = wx.getStorageSync('user');
  22. if (userInfo) {
  23. app.globalData.userInfo = userInfo;
  24. if (tel == 0 && user.user_id == 0) {
  25. wx.redirectTo({url: '/pages/getPhone/getPhone'})
  26. }
  27. }else{
  28. wx.redirectTo({url: '/pages/login/login'})
  29. }
  30. if (options.source) {
  31. that.setData({source: options.source})
  32. app.globalData.common['source'] = options.source;
  33. }
  34. const dataParam = Object.assign({}, app.globalData.common, {version: 2, platform: app.globalData.platform});
  35. wx.request({
  36. url: app.globalData.HOST + '/user/product/homeact',
  37. method: 'POST',
  38. data: dataParam,
  39. success: function (res) {
  40. if (res.data.errno == '0'){
  41. that.setData({ imgUrls: res.data.rst.homeact});
  42. }
  43. }
  44. });
  45. utils.initList(that);
  46. },
  47. onShow () {
  48. wx.stopPullDownRefresh();
  49. wx.hideNavigationBarLoading();
  50. },
  51. onHide () {
  52. wx.stopPullDownRefresh()
  53. wx.hideNavigationBarLoading();
  54. },
  55. onPullDownRefresh: function () {
  56. //下拉
  57. var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
  58. that.data.page = 1;
  59. setTimeout(()=>{
  60. utils.initList(that, obj, that.data.page);
  61. }, 800)
  62. },
  63. onReachBottom: function () {
  64. //上拉
  65. var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
  66. if (that.data.hasNext) {
  67. utils.initList(that, obj, ++that.data.page);
  68. }
  69. },
  70. onShareAppMessage: function () {
  71. return {
  72. title: app.globalData.title,
  73. imageUrl: app.globalData.img,
  74. path: '/pages/index/index',
  75. success: function(res) {
  76. app.noticeModal('分享成功')
  77. },
  78. fail: function(res) {
  79. app.noticeModal('您取消了分享')
  80. }
  81. }
  82. },
  83. //FormId
  84. formSubmit(e) {
  85. const formId = e.detail.formId, id = e.target.dataset.id;
  86. const userInfo = app.globalData.userInfo;
  87. this.getFromid(formId,id);
  88. wx.navigateTo({
  89. url: '/pages/details/details?id='+id
  90. })
  91. // console.log(formId + "formID首页")
  92. },
  93. getFromid(formId,ids) {
  94. wx.request({
  95. url: app.globalData.HOST + '/user/wx/getFromid',
  96. method: "POST",
  97. data: Object.assign({}, app.globalData.common, { from_id: formId }),
  98. success: function (res) {
  99. },
  100. complete: function () {
  101. }
  102. });
  103. },
  104. test (e) {
  105. wx.setStorageSync('flag', 1);
  106. console.log(e);
  107. }
  108. })