mineCollect.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // index.js
  2. //专题
  3. var contentList = [
  4. ];
  5. //商品
  6. var goodsList = [
  7. ];
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. contentList: contentList,
  14. goodsList: goodsList,
  15. currentItem : 1,
  16. showcont : 1
  17. },
  18. onLoad: function (options) {
  19. var classid = options.com_id;
  20. var name = options.name
  21. wx.setNavigationBarTitle({
  22. title: name
  23. })
  24. that = this;
  25. var host = getApp().globalData.servsers;
  26. var un_id = getApp().globalData.un_id;
  27. if (un_id != undefined && un_id != '' && un_id != null){
  28. wx.request({
  29. url: host + "findapi/findMyforxcx",
  30. data: {
  31. user_id: un_id
  32. },
  33. method: 'GET',
  34. header: {
  35. 'Accept': 'application/json'
  36. },
  37. success: function (res) {
  38. var size = res.data.total;
  39. that.setData({
  40. contentList: res.data.rows,
  41. });
  42. if (res == null || res.data == null) {
  43. console.error('网络请求失败');
  44. return;
  45. }
  46. }
  47. })
  48. wx.request({
  49. url: host + "collectionapi/selectcommodity",
  50. data: {
  51. user_id: un_id
  52. },
  53. method: 'GET',
  54. header: {
  55. 'Accept': 'application/json'
  56. },
  57. success: function (res) {
  58. var size = res.data.total;
  59. that.setData({
  60. goodsList: res.data.rows,
  61. });
  62. if (res == null || res.data == null) {
  63. console.error('网络请求失败');
  64. return;
  65. }
  66. }
  67. })
  68. }
  69. },
  70. navChange: function (options){
  71. var that = this
  72. var id = options.currentTarget.dataset.id;
  73. that.setData({
  74. 'currentItem': id,
  75. 'showcont' : id
  76. })
  77. },
  78. onShow: function (options){
  79. var that = this;
  80. var host = getApp().globalData.servsers;
  81. var un_id = getApp().globalData.un_id;
  82. if (un_id != undefined && un_id != '' && un_id != null){
  83. wx.request({
  84. url: host + "findapi/findMyforxcx",
  85. data: {
  86. user_id: un_id
  87. },
  88. method: 'GET',
  89. header: {
  90. 'Accept': 'application/json'
  91. },
  92. success: function (res) {
  93. var size = res.data.total;
  94. that.setData({
  95. contentList: res.data.rows,
  96. });
  97. if (res == null || res.data == null) {
  98. console.error('网络请求失败');
  99. return;
  100. }
  101. }
  102. })
  103. wx.request({
  104. url: host + "collectionapi/selectcommodity",
  105. data: {
  106. user_id: un_id
  107. },
  108. method: 'GET',
  109. header: {
  110. 'Accept': 'application/json'
  111. },
  112. success: function (res) {
  113. var size = res.data.total;
  114. that.setData({
  115. goodsList: res.data.rows,
  116. });
  117. if (res == null || res.data == null) {
  118. console.error('网络请求失败');
  119. return;
  120. }
  121. }
  122. })
  123. }
  124. }
  125. })
  126. var that;
  127. var Util = require('../../utils/util.js');