This commit is contained in:
dong_bo0602 2020-06-17 19:14:48 +08:00
parent 2335a730de
commit 1328f33590
3 changed files with 145 additions and 16 deletions

View File

@ -66,6 +66,7 @@ export default {
self.restTime--
if (self.restTime === 0) {
self.wait = false
self.restTime = 120
clearInterval(timer)
}
}, 1000)

View File

@ -12,6 +12,7 @@
<li :class="{active: tab == 5}" @click="changeTab(5)">我的团队</li>
<li :class="{active: tab == 6}" @click="changeTab(6)">其他团队</li>
<li :class="{active: tab == 7}" @click="changeTab(7)">我的活动</li>
<li :class="{active: tab == 8}" @click="changeTab(8)">我的志愿服务</li>
</ul>
</div>
<div class="info-right">
@ -502,6 +503,54 @@
</div>
</div>
</div>
<div class="my-volunteer-activity" v-show="tab == 8">
<div class="box-title">
<span>我的志愿服务</span>
</div>
<div class="my-activity-box">
<table>
<tr>
<td width="10%">序号</td>
<td width="30%">活动名称</td>
<td width="20%">活动开始时间</td>
<td width="20%">活动结束时间</td>
<td width="20%">操作</td>
</tr>
<tr v-for="(list,idx) in signedVolunteer" :key="idx">
<td>{{idx+1}}</td>
<td>{{list.serviceName}}</td>
<td>{{list.startTime}}</td>
<td>{{list.endTime}}</td>
<td>
<router-link :to="{path: '/volunteerDetail/' + list.volunteerServiceId}" tag="button">查看详情</router-link>
<button @click="cancelVolunteer(list.volunteerServiceId, list.teamId, list.voluntaryType)" v-if="list.status == 'isEnroll'">取消报名</button>
</td>
</tr>
</table>
<div class="pager" v-if="signedVolunteer.length > 0">
<span @click="paging(1)">首页</span>
<span @click="paging(page.page - 1)" v-if="page.page > 1">上一页</span>
<ul v-if="page.totalPage > 0 && page.totalPage <= 5">
<li v-for="cpage in page.totalPage" :class="{'active': page.page == cpage}" :key="cpage" @click="paging(cpage)">
{{cpage}}
</li>
</ul>
<ul v-if="page.totalPage > 5">
<li v-if="page.page < 3" v-for="cpage in 5" :class="{'active': page.page == cpage}" :key="cpage" @click="paging(cpage)">
{{cpage}}
</li>
<li v-if="page.page > page.totalPage - 2" v-for="cpage in 5" :class="{'active': page.page == (page.totalPage - 5 + cpage)}" :key="cpage" @click="paging(cpage)">
{{page.totalPage - 5 + cpage}}
</li>
<li v-if="page.page >= 3 && page.page <= page.totalPage - 2" v-for="cpage in 5" :class="{'active': page.page == (page.page - (3 - cpage))}" :key="cpage" @click="paging(cpage)">
{{page.page - (3 - cpage)}}
</li>
</ul>
<span @click="paging(page.page + 1)" v-if="page.page < page.totalPage">下一页</span>
<span @click="paging(page.totalPage)">尾页</span>
</div>
</div>
</div>
</div>
</div>
</div>
@ -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 () {

View File

@ -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()
}
}