From 4330df4f113637d0286a92494a439d3b06268489 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Tue, 30 Jun 2020 17:27:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/activity/activity.js | 51 +++++++-- pages/activity/activity.json | 4 +- pages/activityDetail/activityDetail.js | 80 ++++++++++--- pages/activityDetail/activityDetail.json | 3 +- pages/activityDetail/activityDetail.wxml | 5 +- pages/activityDialog/activityDialog.js | 59 +++++++++- pages/activityDialog/activityDialog.json | 4 +- pages/activityDialog/activityDialog.wxml | 34 +++--- pages/activitySign/activitySign.js | 107 +++++++++++++++++- pages/activitySign/activitySign.json | 3 +- pages/activitySign/activitySign.wxml | 22 ++-- .../myVolunteerActivity.js | 51 +-------- .../myVolunteerActivity.json | 3 +- pages/myVolunteerTeam/myVolunteerTeam.json | 3 +- pages/newTeam/newTeam.js | 2 +- pages/newTeam/newTeam.json | 3 +- pages/newTeam/newTeam.wxml | 7 +- .../newVolunteerActivity.js | 2 +- .../newVolunteerActivity.json | 3 +- .../newVolunteerActivity.wxml | 8 +- .../serviceActivityDetail.json | 3 +- pages/volunteer/volunteer.js | 40 +++++-- pages/volunteer/volunteer.json | 4 +- .../volunteerRegister/volunteerRegister.json | 3 +- pages/volunteerTeam/volunteerTeam.json | 3 +- 25 files changed, 367 insertions(+), 140 deletions(-) diff --git a/pages/activity/activity.js b/pages/activity/activity.js index 530b1f2..f5ce8cc 100644 --- a/pages/activity/activity.js +++ b/pages/activity/activity.js @@ -6,7 +6,11 @@ Page({ * 页面的初始数据 */ data: { - dataList: [] + dataList: [], + pages: { + page: 1, + rows: 5 + } }, goDetail: function (e) { var id = e.currentTarget.dataset.id; @@ -14,29 +18,46 @@ Page({ url: '../activityDetail/activityDetail?id=' + id }) }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { + getActivityList: function() { var self = this; app.restAjax.get(app.restAjax.path(app.activityUrl + '/wxminiapp/activitylibrary/listpageactivitylibraryfornetrelease', []), - {}, null, function(code, data) { + self.data.pages, null, function(code, data) { if('200' == code) { for(var item of data.rows) { if('' != item.activityImage) { item.activityImage = app.activityUrl + '/route/file/downloadfile/true/' + item.activityImage; } } - self.setData({ - dataList: data.rows, - }) + if(1 === self.data.pages.page) { + self.setData({ + dataList: data.rows, + }) + }else { + if(data.rows.length == 0) { + self.setData({ + [`pages.page`] : self.data.pages.page - 1 + }) + app.dialog.msg('暂无更多') + return false; + } + self.setData({ + dataList: data.rows.concat(self.data.dataList), + }) + } } }, function() { }, function() { - + wx.hideNavigationBarLoading(); //完成停止加载图标 + wx.stopPullDownRefresh(); }) }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getActivityList(); + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -70,14 +91,20 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - + // 在标题栏中显示加载图标 + wx.showNavigationBarLoading(); + var self = this; + self.setData({ + [`pages.page`] : self.data.pages.page + 1 + }) + this.getActivityList(); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + }, /** diff --git a/pages/activity/activity.json b/pages/activity/activity.json index 8835af0..09e623a 100644 --- a/pages/activity/activity.json +++ b/pages/activity/activity.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true, + "backgroundTextStyle": "dark" } \ No newline at end of file diff --git a/pages/activityDetail/activityDetail.js b/pages/activityDetail/activityDetail.js index fb366e4..1f67409 100644 --- a/pages/activityDetail/activityDetail.js +++ b/pages/activityDetail/activityDetail.js @@ -6,31 +6,79 @@ Page({ * 页面的初始数据 */ data: { - dataMap: {} + dataMap: {}, + token: '' }, - goSign: function () { - wx.navigateTo({ - url: '../activitySign/activitySign' + getToken: function() { + var self = this; + return new Promise(resolve =>{ + wx.getStorage({ + key: 'token', + success(res) { + self.setData({ + token: res.data + }) + return resolve(); + } + }) }) }, + goSign: function (e) { + var activityId = e.currentTarget.dataset.id; + wx.navigateTo({ + url: '../activitySign/activitySign?id=' + activityId + }) + }, + cancel: function(e) { + var activityId = e.currentTarget.dataset.id; + app.restAjax.get(app.restAjax.path(app.activityUrl + '/app/activityuserapply/cancelapply/' + activityId, []), + {}, { + headers: { + token: self.data.token + } + }, function(code, data) { + if('200' == code) { + wx.navigateTo({ + url: '../activityDetail/activityDetail?id=' + activityId + }) + } + }, function() { + + }, function() { + + }) + }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var self = this; - var id = options.id; - app.restAjax.get(app.restAjax.path(app.activityUrl + '/wxminiapp/activitylibrary/getactivitylibrarybyidrelease/' + id, []), - {}, null, function(code, data) { - if('200' == code) { - data.activityImage = app.activityUrl + '/route/file/downloadfile/true/' + data.activityImage; - self.setData({ - dataMap: data - }) - } - }, function() { + this.getToken().then(result => { + console.log(self.data.token) + var url; + var id = options.id; + if(!self.data.token) { + url = '/wxminiapp/activitylibrary/getactivitylibrarybyidrelease/' + id; + }else { + url = '/wxminiapp/activitylibrary/getactivitylibrarybyid/' + id + } + app.restAjax.get(app.restAjax.path(app.activityUrl + url, []), + {}, { + headers: { + token: self.data.token + } + }, function(code, data) { + if('200' == code) { + data.activityImage = app.activityUrl + '/route/file/downloadfile/true/' + data.activityImage; + self.setData({ + dataMap: data + }) + } + }, function() { - }, function() { - + }, function() { + + }) }) }, diff --git a/pages/activityDetail/activityDetail.json b/pages/activityDetail/activityDetail.json index 8835af0..7360326 100644 --- a/pages/activityDetail/activityDetail.json +++ b/pages/activityDetail/activityDetail.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/activityDetail/activityDetail.wxml b/pages/activityDetail/activityDetail.wxml index 35dfeb2..b06f942 100644 --- a/pages/activityDetail/activityDetail.wxml +++ b/pages/activityDetail/activityDetail.wxml @@ -41,6 +41,9 @@ - + 报名 + + 取消报名 + diff --git a/pages/activityDialog/activityDialog.js b/pages/activityDialog/activityDialog.js index 1146832..915664e 100644 --- a/pages/activityDialog/activityDialog.js +++ b/pages/activityDialog/activityDialog.js @@ -7,7 +7,12 @@ Page({ */ data: { token: '', - serviceId: '' + serviceId: '', + pages: { + page: 1, + rows: 5 + }, + dataList: {} }, getToken: function() { var self = this; @@ -26,18 +31,55 @@ Page({ getActivityHis: function() { var self = this; app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/teamactivityhis/listpageteamactivityhis?serviceId=' + self.data.serviceId, []), - {}, { + self.data.pages, { headers: { token: self.data.token } }, function(code, data) { if('200' == code) { - console.log(data) + var photos = []; + for(var item of data.rows) { + if('' != item.photo) { + item.photo = app.volunteerUrl + '/route/file/downloadfile/true/' + item.photo; + } + if('' != item.photos) { + var photoArr = item.photos.split(","); + for(var i=0; i - + - + + - - - - - diff --git a/pages/activitySign/activitySign.js b/pages/activitySign/activitySign.js index 13e6be0..6935898 100644 --- a/pages/activitySign/activitySign.js +++ b/pages/activitySign/activitySign.js @@ -1,18 +1,123 @@ // pages/activitySign/activitySign.js +var app = getApp(); Page({ /** * 页面的初始数据 */ data: { - + token: '', + dataMap: {}, + phone: '', + code: '', + name: '', + idCard: '', + trueCode: '', + activityId: '' }, + getToken: function() { + var self = this; + return new Promise(resolve =>{ + wx.getStorage({ + key: 'token', + success(res) { + self.setData({ + token: res.data + }) + return resolve(); + } + }) + }) + }, + getCode: function() { + var self = this; + if(!self.data.phone) { + app.dialog.msg('请输入手机号'); + return false; + } + app.restAjax.get(app.restAjax.path(app.activityUrl + '/app/activityuserapply/saveSmsCoderelease/' + self.data.phone, []), + {}, null, function(code, data) { + console.log(data) + if('200' == code) { + + } + }, function() { + }, function() { + + }) + }, + commit: function() { + var self = this; + if(!self.data.phone) { + app.dialog.msg('请输入手机号'); + return false; + } + if(!self.data.name) { + app.dialog.msg('请输入姓名'); + return false; + } + if(!self.data.idCard) { + app.dialog.msg('请输入身份证号码'); + return false; + } + var activityUserApplyVO = { + activityId: self.data.activityId, + code: self.data.code, + userIdCard: self.data.idCard, + userName: self.data.name, + userPhone: self.data.phone + } + app.restAjax.post(app.restAjax.path(app.activityUrl + '/app/activityuserapply/saveactivityuserapplyrelease', []), + activityUserApplyVO, { + headers: { + token: self.data.token + } + }, function(code, data) { + console.log(data) + if('200' == code) { + + } + }, function() { + + }, function() { + + }) + }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + var self = this; + this.getToken().then(result => { + var url; + var id = options.id; + if(!self.data.token) { + url = '/wxminiapp/activitylibrary/getactivitylibrarybyidrelease/' + id; + }else { + url = '/wxminiapp/activitylibrary/getactivitylibrarybyid/' + id + } + self.setData({ + activityId: options.id + }) + app.restAjax.get(app.restAjax.path(app.activityUrl + url, []), + {}, { + headers: { + token: self.data.token + } + }, function(code, data) { + if('200' == code) { + data.activityImage = app.activityUrl + '/route/file/downloadfile/true/' + data.activityImage; + self.setData({ + dataMap: data + }) + } + }, function() { + }, function() { + + }) + }) }, /** diff --git a/pages/activitySign/activitySign.json b/pages/activitySign/activitySign.json index 8835af0..7360326 100644 --- a/pages/activitySign/activitySign.json +++ b/pages/activitySign/activitySign.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/activitySign/activitySign.wxml b/pages/activitySign/activitySign.wxml index f4bcc14..fb4d4b1 100644 --- a/pages/activitySign/activitySign.wxml +++ b/pages/activitySign/activitySign.wxml @@ -1,29 +1,29 @@ - + - 银保监会印发《关于加快推进意外金融风险… + {{dataMap.activityTitle}} 活动人数: - 100人 + {{dataMap.activityUserNum }} 活动时间: - 2020-02-03至2020-02-04 + {{dataMap.activityStartTime}}至{{dataMap.activityEndTime}} 活动地址: - 活动地址 + {{dataMap.activityAddress }} @@ -32,23 +32,23 @@ 手机号: - + 验证码: - - 获取验证码 + + 获取验证码 姓 名: - + 身份证: - + - 立即报名 + 立即报名 \ No newline at end of file diff --git a/pages/myVolunteerActivity/myVolunteerActivity.js b/pages/myVolunteerActivity/myVolunteerActivity.js index 7387995..362e624 100644 --- a/pages/myVolunteerActivity/myVolunteerActivity.js +++ b/pages/myVolunteerActivity/myVolunteerActivity.js @@ -9,8 +9,7 @@ Page({ token: '', dataMap: {}, type: '1', - teamId: '', - + teamId: '' }, getToken: function() { var self = this; @@ -58,7 +57,7 @@ Page({ myActivity: function(url) { var self = this; app.restAjax.get(app.restAjax.path(url, []), - {}, { + self.data.pages, { headers: { token: self.data.token } @@ -77,50 +76,6 @@ Page({ }, function(code, data) { app.dialog.msg(data.msg); }, function() { - - }) - }, - /** - * 申请/退出加入团队 - */ - joinOrOutTeam: function(e) { - var self = this; - self.setData({ - teamId: e.currentTarget.dataset.teamid - }) - var teamMemberVO; - var url; - var methodType; - var title; - if('1' == self.data.type) { - url = app.volunteerUrl + '/wxminiapp/teammember/saveteammember' - teamMemberVO = { - teamId: e.currentTarget.dataset.teamid - } - methodType = app.restAjax.post - title = '申请成功!' - }else { - url = app.volunteerUrl + '/wxminiapp/teammember/quitTeam/' + self.data.teamId - methodType = app.restAjax.get - title = '退出成功!' - } - - methodType(app.restAjax.path(url, []), - teamMemberVO, { - headers: { - token: self.data.token - } - }, function(code, data) { - if('200' == code) { - app.dialog.msg(title); - wx.navigateTo({ - url: '../volunteer/volunteer', - }) - } - }, function(code, data) { - app.dialog.msg(data.msg); - }, function() { - }) }, /** @@ -164,7 +119,7 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - + }, /** diff --git a/pages/myVolunteerActivity/myVolunteerActivity.json b/pages/myVolunteerActivity/myVolunteerActivity.json index 8835af0..7360326 100644 --- a/pages/myVolunteerActivity/myVolunteerActivity.json +++ b/pages/myVolunteerActivity/myVolunteerActivity.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/myVolunteerTeam/myVolunteerTeam.json b/pages/myVolunteerTeam/myVolunteerTeam.json index 8835af0..7360326 100644 --- a/pages/myVolunteerTeam/myVolunteerTeam.json +++ b/pages/myVolunteerTeam/myVolunteerTeam.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/newTeam/newTeam.js b/pages/newTeam/newTeam.js index 881d966..8177f13 100644 --- a/pages/newTeam/newTeam.js +++ b/pages/newTeam/newTeam.js @@ -74,7 +74,7 @@ Page({ var data = data.substr(9, data.length); data = data.substr(0, data.length - 2); self.setData({ - photo: data + photo: app.volunteerUrl + '/route/file/downloadfile/true/' + data }) } }, function(code, data) { diff --git a/pages/newTeam/newTeam.json b/pages/newTeam/newTeam.json index 8835af0..7360326 100644 --- a/pages/newTeam/newTeam.json +++ b/pages/newTeam/newTeam.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/newTeam/newTeam.wxml b/pages/newTeam/newTeam.wxml index 55fe14c..844a71f 100644 --- a/pages/newTeam/newTeam.wxml +++ b/pages/newTeam/newTeam.wxml @@ -1,10 +1,13 @@ 团队头像: - - + + + 点击上传 + + 团队名称: diff --git a/pages/newVolunteerActivity/newVolunteerActivity.js b/pages/newVolunteerActivity/newVolunteerActivity.js index 3b7aab7..5f2bebc 100644 --- a/pages/newVolunteerActivity/newVolunteerActivity.js +++ b/pages/newVolunteerActivity/newVolunteerActivity.js @@ -99,7 +99,7 @@ Page({ var data = data.substr(9, data.length); data = data.substr(0, data.length - 2); self.setData({ - photo: data + photo: app.volunteerUrl + '/route/file/downloadfile/true/' + data }) } }, function(code, data) { diff --git a/pages/newVolunteerActivity/newVolunteerActivity.json b/pages/newVolunteerActivity/newVolunteerActivity.json index 8835af0..7360326 100644 --- a/pages/newVolunteerActivity/newVolunteerActivity.json +++ b/pages/newVolunteerActivity/newVolunteerActivity.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/newVolunteerActivity/newVolunteerActivity.wxml b/pages/newVolunteerActivity/newVolunteerActivity.wxml index 1562072..1ee51e8 100644 --- a/pages/newVolunteerActivity/newVolunteerActivity.wxml +++ b/pages/newVolunteerActivity/newVolunteerActivity.wxml @@ -86,8 +86,12 @@ 宣传图片: - - + + + + + 点击上传 + diff --git a/pages/serviceActivityDetail/serviceActivityDetail.json b/pages/serviceActivityDetail/serviceActivityDetail.json index 8835af0..7360326 100644 --- a/pages/serviceActivityDetail/serviceActivityDetail.json +++ b/pages/serviceActivityDetail/serviceActivityDetail.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/volunteer/volunteer.js b/pages/volunteer/volunteer.js index 3eb8f9c..c5855e8 100644 --- a/pages/volunteer/volunteer.js +++ b/pages/volunteer/volunteer.js @@ -8,7 +8,11 @@ Page({ data: { indicatorDots: true, autoplay: true, - serviceMap: [] + serviceMap: [], + pages: { + page: 1, + rows: 5 + } }, goDetail: function (e) { var id = e.currentTarget.dataset.id; @@ -37,7 +41,7 @@ Page({ activityList: function() { var self = this; app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteerservice/listpagevolunteerservicerelease', []), - {}, null, function(code, data) { + self.data.pages, null, function(code, data) { if('200' == code) { // 将活动照片,拼接为可访问地址 for(var item of data.rows) { @@ -46,14 +50,30 @@ Page({ item.photo = app.volunteerUrl + '/route/file/downloadfile/true/' + photoArr[0]; } } - self.setData({ - serviceMap: data.rows - }) + if(1 === self.data.pages.page) { + self.setData({ + serviceMap: data.rows + }) + }else { + if(data.rows.length == 0) { + self.setData({ + [`pages.page`] : self.data.pages.page - 1 + }) + app.dialog.msg('暂无更多') + return false; + } + + self.setData({ + serviceMap: data.rows.concat(self.data.serviceMap), + }) + } + } }, function() { }, function() { - + wx.hideNavigationBarLoading(); //完成停止加载图标 + wx.stopPullDownRefresh(); }) }, /** @@ -95,7 +115,13 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - + // 在标题栏中显示加载图标 + wx.showNavigationBarLoading(); + var self = this; + self.setData({ + [`pages.page`] : self.data.pages.page + 1 + }) + this.activityList(); }, /** diff --git a/pages/volunteer/volunteer.json b/pages/volunteer/volunteer.json index 8835af0..09e623a 100644 --- a/pages/volunteer/volunteer.json +++ b/pages/volunteer/volunteer.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true, + "backgroundTextStyle": "dark" } \ No newline at end of file diff --git a/pages/volunteerRegister/volunteerRegister.json b/pages/volunteerRegister/volunteerRegister.json index 8835af0..7360326 100644 --- a/pages/volunteerRegister/volunteerRegister.json +++ b/pages/volunteerRegister/volunteerRegister.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/volunteerTeam/volunteerTeam.json b/pages/volunteerTeam/volunteerTeam.json index 8835af0..7360326 100644 --- a/pages/volunteerTeam/volunteerTeam.json +++ b/pages/volunteerTeam/volunteerTeam.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file