From ed9dbed48b9d7dd0ff662e50db94e4706ce5342e Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Sat, 09 May 2020 11:24:55 +0800
Subject: [PATCH] 小程序心里疏导
---
SunshineLnsMinApp/pages/fzjdvisitList/fzjdvisitList.js | 112 ++++++++++++++++++++++---------------------------------
1 files changed, 45 insertions(+), 67 deletions(-)
diff --git a/SunshineLnsMinApp/pages/fzjdvisitList/fzjdvisitList.js b/SunshineLnsMinApp/pages/fzjdvisitList/fzjdvisitList.js
index db48d49..225d1f5 100644
--- a/SunshineLnsMinApp/pages/fzjdvisitList/fzjdvisitList.js
+++ b/SunshineLnsMinApp/pages/fzjdvisitList/fzjdvisitList.js
@@ -1,86 +1,64 @@
+// pages/fzpx/fzpx.js
var app = getApp()
+
Page({
+
+ /**
+ * 页面的初始数据
+ */
data: {
- // navbar: ['全部', '未进行', '进行中', '已结束'],
- currentTab: 0,
- src: app.globalData.imgUrl + '/image/bg.jpg',
- itemIcon: app.globalData.imgUrl + '/image/ceshi.jpg',
- icon: app.globalData.imgUrl + '/image/fzl.svg',
- user: app.globalData.imgUrl + '/image/user.svg',
- dataSet: [{
- imgPath: 'https://c-ssl.duitang.com/uploads/item/202001/29/20200129204135_uxfox.png',
- activityTitle: '关于法制基地参观的活动',
- startTime: '2020/2/11 14:26',
- applyNum: 2,
- totalNum: 100,
- flag: false
- }],
- content: '------加载中------',
- size: 10,
- hasMoreData: true,
+ items: []
},
- onLoad: function() {
- // this.showList()
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ this.showList();
},
- showList: function() {
- var userinfo = wx.getStorageSync("user");
+ link: function (e) {
+ var id = e.currentTarget.dataset['id'];
+ var str = e.currentTarget.dataset['str'];
+ var flag = e.currentTarget.dataset['flag'];
+ wx.navigateTo({
+ url: '../' + str + '/' + str + '?id=' + id + '&flag=' + flag
+ })
+ },
+
+ showList: function () {
var that = this;
- var id = userinfo.id;
+ wx.showLoading();
wx.request({
- url: app.globalData.url + '/api/activityInfo/preview?page=1&size=' + that.data.size + '&userId=' + id,
- success: function(res) {
- console.log(res)
+ url: app.globalData.url + '/api/activity/preview',
+ data: {
+ page: 1,
+ size: 1000,
+ userId: wx.getStorageSync("user").id,
+ type: 'act_3'
+ },
+ success: function (res) {
+ wx.hideLoading();
+ console.log('res', res);
if (res.data.code == 0) {
- (res.data.data.content).forEach(e => {
- (e.startTime) = app.formatDate(e.startTime)
+ let content = res.data.data.content.map(({
+ startTime,
+ ...i
+ }) => ({
+ ...i,
+ startTime: app.formatDate(startTime),
+ }));
+ that.setData({
+ items: content
})
-
- if (res.data.data.totalElements < that.data.size) {
- that.setData({
- dataSet: res.data.data.content,
- hasMoreData: false,
- content: '------我是有底线的------'
- })
- } else {
- that.setData({
- dataSet: res.data.data.content,
- hasMoreData: true,
- content: '------加载更多------',
- size: that.data.size + 10
- })
- }
} else {
- wx.showModal({
- title: '提示',
- content: "请求失败!"
+ wx.showToast({
+ title: res.data.msg,
})
}
-
}
})
- },
+ }
- link: function(event) {
- var id = event.currentTarget.dataset['id'];
- var flag = event.currentTarget.dataset['flag'];
- console.log(flag)
- wx.navigateTo({
- url: '../activityDetail/activityDetail?id=' + id + '&flag=' + flag,
- })
- },
- onReachBottom: function() {
- if (this.data.hasMoreData) {
- this.showList()
- this.setData({
- content: '------加载更多------'
- })
- } else {
- this.setData({
- content: '------我是有底线的------'
- })
- }
- },
})
\ No newline at end of file
--
Gitblit v1.8.0