diff --git a/src/pages/Login/Login.vue b/src/pages/Login/Login.vue index 42589b8..105f32f 100644 --- a/src/pages/Login/Login.vue +++ b/src/pages/Login/Login.vue @@ -66,6 +66,7 @@ export default { self.restTime-- if (self.restTime === 0) { self.wait = false + self.restTime = 120 clearInterval(timer) } }, 1000) diff --git a/src/pages/PersonCenter/PersonCenter.vue b/src/pages/PersonCenter/PersonCenter.vue index 7ba1141..e963746 100644 --- a/src/pages/PersonCenter/PersonCenter.vue +++ b/src/pages/PersonCenter/PersonCenter.vue @@ -12,6 +12,7 @@
  • 我的团队
  • 其他团队
  • 我的活动
  • +
  • 我的志愿服务
  • @@ -502,6 +503,54 @@
    +
    +
    + 我的志愿服务 +
    +
    + + + + + + + + + + + + + + + +
    序号活动名称活动开始时间活动结束时间操作
    {{idx+1}}{{list.serviceName}}{{list.startTime}}{{list.endTime}} + 查看详情 + +
    +
    + 首页 + 上一页 +
      +
    • + {{cpage}} +
    • +
    +
      +
    • + {{cpage}} +
    • +
    • + {{page.totalPage - 5 + cpage}} +
    • +
    • + {{page.page - (3 - cpage)}} +
    • +
    + 下一页 + 尾页 +
    +
    +
    @@ -568,7 +617,8 @@ export default { otherTeam: [], checkOtherTeam: false, otherTeamDetail: [], - signedActivity: [] + signedActivity: [], + signedVolunteer: [] } }, computed: { @@ -589,6 +639,8 @@ export default { this.getOtherTeamList() } else if (this.tab === 7) { this.initSignedActivity() + } else if (this.tab === 8) { + this.getMyVolunteer() } }, // 切换选项卡 @@ -613,6 +665,9 @@ export default { } else if (tab === 7) { this.page.rows = 10 this.initSignedActivity() + } else if (tab === 8) { + this.page.rows = 10 + this.getMyVolunteer() } }, // 获取场馆,按门票 @@ -1119,6 +1174,46 @@ export default { }) } }) + }, + // 获取我的志愿服务 + getMyVolunteer: function () { + var self = this + axios.get('http://192.168.0.111:8888/volunteer/app/volunteerservice/listpagemyjoinservice', { + headers: { + token: self.token + } + }).then(function (res) { + console.log(res) + self.signedVolunteer = res.data.rows + self.page.totalPage = Math.ceil(res.data.total / self.page.rows) + }) + }, + // 取消报名志愿服务 + cancelVolunteer: function (id, team, type) { + var self = this + if (team) { + team = '/' + team + } else { + team = '/' + null + } + self.$layer.open({ + content: '确认退出此志愿服务?', + yes: function () { + axios.get('http://192.168.0.111:8888/volunteer/app/servicemember/cancelapply/' + type + '/' + id + team, { + headers: { + token: self.token + } + }).then(function (res) { + console.log(res) + if (res.status === 200) { + self.$layer.closeAll() + self.$layer.msg('取消报名成功!') + self.page.page = 1 + self.getMyVolunteer() + } + }) + } + }) } }, mounted: function () { diff --git a/src/pages/VolunteerDetail/VolunteerDetail.vue b/src/pages/VolunteerDetail/VolunteerDetail.vue index 4699ea0..95e71f3 100644 --- a/src/pages/VolunteerDetail/VolunteerDetail.vue +++ b/src/pages/VolunteerDetail/VolunteerDetail.vue @@ -138,7 +138,7 @@ export default { }, data () { return { - tab: 3, + tab: 1, volunteerDetail: {}, swiperOptions: { // pagination: '.swiper-pagination', @@ -172,6 +172,22 @@ export default { console.log(self.cover) }) }, + getVolunteerDetailToken: function () { + var self = this + axios.get('http://192.168.0.111:8888/volunteer/app/volunteerservice/getvolunteerservicebyid/' + self.$route.params.id, { + headers: { + token: self.token + } + }).then(function (res) { + res.data.photo = res.data.photo.split(',') + if (res.data.introduce.indexOf('src="') !== -1) { + res.data.introduce = res.data.introduce.replace(/src="/g, 'src="http://192.168.0.111:8888/volunteer/') + } + self.volunteerDetail = res.data + self.cover = self.volunteerDetail.photo[0] + console.log(self.cover) + }) + }, joinTeam: function () { var self = this if (self.token) { @@ -180,16 +196,26 @@ export default { self.getMyTeam() } else { var info = { - voluntaryType: self.volunteerDetail.voluntaryType + voluntaryType: self.volunteerDetail.voluntaryType, + serviceId: self.volunteerDetail.volunteerServiceId } - axios.post('http://192.168.0.111:8888/volunteer/app/servicemember/saveservicemember', info, { - headers: { - token: self.token - } - }).then(function (res) { - console.log(res) - if (res.status === 200) { - self.$layer.msg('申请成功!') + self.$layer.open({ + content: '确认报名该活动?', + yes: function () { + axios.post('http://192.168.0.111:8888/volunteer/app/servicemember/saveservicemember', info, { + headers: { + token: self.token + } + }).then(function (res) { + console.log(res) + if (res.status === 200) { + self.$layer.closeAll() + self.$layer.msg('申请成功!') + setTimeout(function () { + location.reload() + }, 1500) + } + }) } }) } @@ -230,7 +256,7 @@ export default { var info = { teamId: id, teamName: name, - volunteerServiceId: self.volunteerDetail.volunteerServiceId, + serviceId: self.volunteerDetail.volunteerServiceId, voluntaryType: self.volunteerDetail.voluntaryType } axios.post('http://192.168.0.111:8888/volunteer/app/servicemember/saveservicemember', info, { @@ -240,9 +266,12 @@ export default { }).then(function (res) { if (res.status === 200) { self.$layer.msg('申请成功!') - self.showSelectTeam = false - self.page.page = 1 - self.getComment() + setTimeout(function () { + location.reload() + }, 1500) + // self.showSelectTeam = false + // self.page.page = 1 + // self.getComment() } }) } @@ -291,7 +320,11 @@ export default { } }, mounted () { - this.getVolunteerDetail() + if (this.token) { + this.getVolunteerDetailToken() + } else { + this.getVolunteerDetail() + } this.getComment() } }