拓恒河湖长制全民护河平台WEB端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 2.7KB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // package_first/pages/volunteerActivity/index.js
  2. import {api_westreamActivity,activitySubmit,api_getApply} from '../../../api/volunteer';
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. activityId: null,
  9. list:[],
  10. nickname:'',
  11. activityTitle:'',
  12. applyName:'',
  13. applyPhone:'',
  14. userPage:{
  15. page:1,
  16. limit:10
  17. },
  18. total:0,
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {
  24. const activityId = options.id
  25. this.setData({
  26. activityId
  27. })
  28. console.log(options);
  29. },
  30. /**
  31. * 生命周期函数--监听页面初次渲染完成
  32. */
  33. onReady() {
  34. },
  35. /**
  36. * 生命周期函数--监听页面显示
  37. */
  38. onShow() {
  39. this.westreamActivity()
  40. },
  41. /**
  42. * 生命周期函数--监听页面隐藏
  43. */
  44. onHide() {
  45. },
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload() {
  50. },
  51. /**
  52. * 页面相关事件处理函数--监听用户下拉动作
  53. */
  54. onPullDownRefresh() {
  55. },
  56. /**
  57. * 页面上拉触底事件的处理函数
  58. */
  59. onReachBottom() {
  60. },
  61. /**
  62. * 用户点击右上角分享
  63. */
  64. onShareAppMessage() {
  65. },
  66. formatDate(dateString) {
  67. const date = new Date(dateString);
  68. const year = date.getFullYear();
  69. const month = ("0" + (date.getMonth() + 1)).slice(-2);
  70. const day = ("0" + date.getDate()).slice(-2);
  71. return `${year}年${month}月${day}日`;
  72. },
  73. westreamActivity(){
  74. const tenantObj = wx.getStorageSync('tenant')
  75. let data = {
  76. tenantId:tenantObj.tenantId,
  77. ...this.data.userPage
  78. }
  79. api_westreamActivity(data).then(res=>{
  80. let list =[]
  81. if(this.data.userPage.page==1){
  82. list =res.data.records
  83. }else{
  84. list = [...this.data.list,...res.data.records]
  85. }
  86. let total = res.data.total
  87. list = list.reduce((pre,item)=>{
  88. return [...pre,{
  89. ...item,
  90. activityBeginTime:this.formatDate(item.activityBeginTime),
  91. activityEndTime:this.formatDate(item.activityEndTime)
  92. }]
  93. },[])
  94. this.setData({
  95. total,
  96. list,
  97. }),
  98. console.log(res);
  99. })
  100. },
  101. showDetail(e) {
  102. let data = JSON.stringify(e.currentTarget.dataset.item)
  103. wx.navigateTo({
  104. url: '/package_first/pages/VolunteerDetail/index?data='+ encodeURIComponent(data),
  105. })
  106. },
  107. })