decoratecase.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. const app=getApp();
  2. const utils=require("../../../utils/http");
  3. let page=1;
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. titlelist:[],
  10. videotop:'80',
  11. nowfirsTitle:'',
  12. loadFlag:false,
  13. datashow:false,
  14. imgUrl:app.globalData.imgUrl,
  15. nowArr:[],
  16. arri:0,
  17. nowtitle:'',
  18. type:0,
  19. firsTitext:'',
  20. nowTagText:'',
  21. secondtitlist:[],
  22. topdata:false,
  23. articlelist:[]
  24. },
  25. /**
  26. * 生命周期函数--监听页面加载
  27. */
  28. onLoad: function (options) {
  29. wx.showLoading({
  30. title: '加载中...',
  31. })
  32. this.articletit();
  33. this.articleListfun();
  34. },
  35. articletit:function(){
  36. var that=this;
  37. utils.$post({
  38. url: app.globalData.webUrl + 'client/article/type',
  39. header: {
  40. 'Authorization':'bearer '+app.globalData.token
  41. },
  42. data:{},
  43. success: function (res) {
  44. if(res.data.code=='0'){
  45. that.setData({
  46. titlelist:res.data.data
  47. })
  48. }
  49. }
  50. })
  51. },
  52. firsttap:function(e){
  53. var that=this;
  54. if(e.currentTarget.dataset.fid!=''){
  55. that.setData({
  56. firsTitext:e.currentTarget.dataset.fid,
  57. nowTagText:'',
  58. videotop:'168',//顶部padding
  59. secondtitlist:that.data.titlelist[e.currentTarget.dataset.idx].sonLabel
  60. })
  61. }else{
  62. that.setData({
  63. firsTitext:e.currentTarget.dataset.fid,
  64. nowTagText:'',
  65. videotop:'80',//顶部padding
  66. secondtitlist:[]
  67. })
  68. }
  69. this.articleListfun()
  70. },
  71. childtypetap:function(e){
  72. this.setData({
  73. nowTagText:e.currentTarget.dataset.sid,
  74. })
  75. this.articleListfun();
  76. },
  77. articleListfun:function(){
  78. let that=this;
  79. page=1;
  80. utils.$post({
  81. url: app.globalData.webUrl + 'client/article/list',
  82. header: {
  83. 'Authorization':'bearer '+app.globalData.token
  84. },
  85. data:{
  86. type: that.data.firsTitext,
  87. label: that.data.nowTagText,
  88. page: 1,
  89. limit: "10",
  90. keyword:''
  91. },
  92. success: function (res) {
  93. if(res.data.code=='0'){
  94. that.setData({
  95. articlelist:res.data.data,
  96. datashow:true
  97. })
  98. }
  99. setTimeout(() => {
  100. wx.hideLoading()
  101. }, 1200);
  102. }
  103. })
  104. },
  105. onPageScroll:function(e){
  106. if(e.scrollTop>10){
  107. this.setData({
  108. topdata:true
  109. })
  110. }else{
  111. this.setData({
  112. topdata:false
  113. })
  114. }
  115. },
  116. casemsgTap:function(e){
  117. wx.navigateTo({
  118. url: '/customer/pages/decoratecasemsg/decoratecasemsg?aid='+e.currentTarget.dataset.tid
  119. })
  120. },
  121. /**
  122. * 生命周期函数--监听页面初次渲染完成
  123. */
  124. onReady: function () {
  125. },
  126. /**
  127. * 生命周期函数--监听页面显示
  128. */
  129. onShow: function () {
  130. // stoptime=0;
  131. // setTimeout(function(){
  132. // stoptime=stoptime*1+1;
  133. // },1000)
  134. },
  135. /**
  136. * 生命周期函数--监听页面隐藏
  137. */
  138. onHide: function () {
  139. },
  140. /**
  141. * 生命周期函数--监听页面卸载
  142. */
  143. onUnload: function () {
  144. },
  145. /**
  146. * 页面相关事件处理函数--监听用户下拉动作
  147. */
  148. onPullDownRefresh: function () {
  149. let that=this;
  150. page=1;
  151. utils.$post({
  152. url: app.globalData.webUrl + 'client/article/list',
  153. header: {
  154. 'Authorization':'bearer '+app.globalData.token
  155. },
  156. data:{
  157. type: that.data.firsTitext,
  158. label: that.data.nowTagText,
  159. page: 1,
  160. limit: "10",
  161. keyword:''
  162. },
  163. success: function (res) {
  164. wx.stopPullDownRefresh()
  165. if(res.data.code=='0'){
  166. that.setData({
  167. articlelist:res.data.data
  168. })
  169. }
  170. }
  171. })
  172. },
  173. /**
  174. * 页面上拉触底事件的处理函数
  175. */
  176. onReachBottom: function () {
  177. let that=this;
  178. page=page+1;
  179. utils.$post({
  180. url: app.globalData.webUrl + 'client/article/list',
  181. header: {
  182. 'Authorization':'bearer '+app.globalData.token
  183. },
  184. data:{
  185. type: that.data.firsTitext,
  186. label: that.data.nowTagText,
  187. page: page,
  188. limit: "10",
  189. keyword:''
  190. },
  191. success: function (res) {
  192. let articlelist=that.data.articlelist;
  193. if(res.data.code=='0'){
  194. articlelist=articlelist.concat(res.data.data);
  195. that.setData({
  196. articlelist:articlelist
  197. })
  198. }
  199. }
  200. })
  201. },
  202. /**
  203. * 用户点击右上角分享
  204. */
  205. // onShareAppMessage: function () {
  206. // return {
  207. // title: '我是'+app.globalData.sharename+",这是我的个人微网。",
  208. // imageUrl:"../../../img/weiw.png",
  209. // path: '/pages/index/index?share_user_id='+this.data.share_user_id+"&sharename="+app.globalData.sharename
  210. // }
  211. // }
  212. })