first commit

This commit is contained in:
2026-09-09 09:14:28 +08:00
commit 5343198112
5199 changed files with 1052895 additions and 0 deletions
@@ -0,0 +1,76 @@
<!--活动信息公用页面-->
<div class="activity_img_back">
<van-image :src="FILE_DOMAIN + '/fileStreamPreview?id=' + o.cover" width="100%"
height="200"></van-image>
</div>
<van-cell-group inset class="mt10">
<van-cell title="活动名称" :value="o.name"></van-cell>
<van-cell title="活动地址" :value="o.address"></van-cell>
<!-- <van-cell title="报名时间">
<template #label>
{{moment(o.applyStartTime).format('YYYY/MM/DD HH:mm')}} 至
{{moment(o.applyEndTime).format('YYYY/MM/DD HH:mm')}}
</template>
</van-cell>
<van-cell title="活动时间">
<template #label>
{{moment(o.startTime).format('YYYY/MM/DD HH:mm')}} 至
{{moment(o.endTime).format('YYYY/MM/DD HH:mm')}}
</template>
</van-cell>-->
<van-cell v-if="o.userNumberLimit!=null">
<template #title>
<span v-if="o.userNumberLimit===1">
活动人数
</span>
<span v-else-if="o.userNumberLimit===2">
本工会名额
</span>
</template>
<template>
<span v-if="o.userNumberLimit===1">
<span style="color: orange">{{o.totalUserNumberLimit }}</span>
</span>
<span v-else="o.userNumberLimit===2">
<span style="color: orange">{{unionLimitNum }}</span>
</span>
</template>
</van-cell>
<van-cell title="当前报名" v-if="o.signUpMethod!=null">
<template>
<span style="color: red">{{hasRegUserNum}}</span>
</template>
</van-cell>
<!-- <van-cell title="负&emsp14;&emsp14;责&emsp14;&emsp14;人">-->
<!-- <template>-->
<!-- {{o.createUserName}}({{o.createUserMobile}})-->
<!-- </template>-->
<!-- </van-cell>-->
<van-cell title="报名方式" v-if="o.signUpMethod">
<template>
<span v-if="o.signUpMethod===1">个人报名</span>
<span v-if="o.signUpMethod===2">分工会报名</span>
<span v-if="o.signUpMethod===3">组队报名</span>
</template>
</van-cell>
<van-cell title="组队人数" v-if="o.signUpMethod==3">
<span style="color: red"> {{o.teamNum}}</span>
</van-cell>
<van-cell title="活动内容" v-if="o.projectTypeCode!=='50004'">
<template #label>
{{o.activityContent}}
</template>
</van-cell>
<van-cell title="签到点位" v-if="o.needSign">
<template #label>
<div id="signMap" style="width: 100%;height: 300px"></div>
<div style="margin-top: 10px;color: orange">
活动开始后,请前往签到点位半径({{o.rangeMeter}})米内进行签到。
</div>
</template>
</van-cell>
</van-cell-group>
@@ -0,0 +1,130 @@
const self_mixin = {
data() {
return {
//已报名人数
hasRegUserNum: 0,
unionId: null,
unionLimitNum: 0,
isRegisterFull: false
}
},
methods: {
async getActivityInfo() {
const resp = await $.get('/mobile/activity/unionActivity/findOne', {id: this.activityId})
if (resp.code === 0) {
resp.data.location = JSON.parse(resp.data.location)
resp.data.unionUserNumberLimit = JSON.parse(resp.data.unionUserNumberLimit)
this.o = resp.data
this.unionId = "${@shiro.getPrincipalProperty('unit').getUnionid()}"
if (!this.unionId) {
this.$toast.fail('您的所属工会信息缺失,请联系管理员')
return
}
if (this.o.userNumberLimit === 2) {
const unionLimit = resp.data.unionUserNumberLimit.find(v => v.id === this.unionId)
this.unionLimitNum = unionLimit.limitNum
}
await this.getHasRegUserNum()
this.$nextTick(() => {
// document.getElementsByClassName('activity_img_back')[0].style.backgroundImage = "url(" + FILE_DOMAIN + this.o.cover + ")"
if (this.o.needSign) {
this.initMap()
}
})
}
},
async getHasRegUserNum() {
const resp = await $.get('/mobile/activity/unionActivity/getHasRegUserNum', {activityId: this.activityId})
this.hasRegUserNum = resp.data
if (this.o.signUpMethod === 1) {
if (this.o.userNumberLimit === 1) {
if (this.hasRegUserNum === this.o.totalUserNumberLimit) {
this.isRegisterFull = true
}
}
}
},
initMap() {
let marker = null
let circle = null
this.$nextTick(() => {
let map = new AMap.Map("signMap", {
zoomEnable: true,
dragEnable: false,
resizeEnable: true,
center: [114.402582, 30.521378],
zoom: 16
});
if (this.o.location && Array.isArray(this.o.location)) {
const lng = parseFloat(this.o.location[0])
const lat = parseFloat(this.o.location[1])
marker = new AMap.Marker({
position: [lng, lat],
offset: new AMap.Pixel(-13, -30)
})
map.add(marker)
// marker.setMap(map);
// map.setZoomAndCenter(18, [lng, lat])
circle = new AMap.Circle({
center: new AMap.LngLat(lng, lat), // 圆心位置
radius: this.o.rangeMeter, //半径
strokeColor: "#F33", //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线粗细度
fillColor: "#ee2200", //填充颜色
fillOpacity: 0.35 //填充透明度
})
map.add(circle)
map.setFitView()
}
if (window.location.pathname === '/mobile/activity/myActivity/goSign' && !this.isSign) {
map.plugin('AMap.Geolocation', function () {
geolocation = new AMap.Geolocation({
enableHighAccuracy: true,//是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位,默认:无穷大
maximumAge: 0, //定位结果缓存0毫秒,默认:0
convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
showButton: true, //显示定位按钮,默认:true
buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
showCircle: false, //定位成功后用圆圈表示定位精度范围,默认:true
panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
zoomToAccuracy: true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
});
map.addControl(geolocation)
geolocation.getCurrentPosition()
AMap.event.addListener(geolocation, 'error', (err) => {
alert(JSON.stringify(err))
}); //返回定位出错信息
});
}
})
},
getMapDistance(paramObj) {
let lng1 = paramObj.lng1
let lat1 = paramObj.lat1
let lng2 = paramObj.lng2
let lat2 = paramObj.lat2
let radLat1 = lat1 * Math.PI / 180.0;
let radLat2 = lat2 * Math.PI / 180.0;
let a = radLat1 - radLat2;
let b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378.137;// EARTH_RADIUS;
s = Math.round(s * 10000) / 10000;
s = s * 1000
return s.toFixed(2)
}
}
}
@@ -0,0 +1,177 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.list-card {
margin-bottom: 10px;
}
.activity_card {
padding: 15px;
background: #fff;
margin: 10px;
border-radius: 5px;
}
.activity_card .van-image, .activity_card .van-image img {
border-radius: 5px;
}
.activity_card .activity_content {
margin-top: 10px;
}
.activity_card .activity_content .activity_name {
line-height: 25px;
margin-bottom: 10px;
display: flex;
align-items: center;
}
.activity_card .activity_content .activity_bottom {
line-height: 25px;
display: flex;
}
.activity_card .activity_content .activity_bottom .left {
line-height: 25px;
overflow: hidden;
width: calc(100% - 80px);
font-size: 12px;
color: #c4bebe;
white-space: nowrap;
display: flex;
align-items: center;
}
.activity_card .activity_content .activity_bottom .right {
line-height: 25px;
overflow: hidden;
width: 80px;
max-width: 80px;
text-align: right;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="活动列表" left-arrow placeholder fixed
@click-left="location.replace('/mobile/index')"></van-nav-bar>
<div style="margin: 10px auto 60px auto">
<van-list v-model="loading" :finished="finished" :finished-text="tableData.length>0?'没有更多了':''"
@load="pageData">
<div v-for="o in tableData" class="list-card" @click="openReg(o)">
<div class="activity_card">
<van-image
fit="cover"
width="100%"
height="200"
:src="FILE_DOMAIN + '/fileStreamPreview?id=' + o.cover"
></van-image>
<div class="activity_content">
<div class="activity_name van-ellipsis">
<van-icon name="fire" color="red"></van-icon>
<span style="margin-left: 10px;">{{o.name}}</span>
</div>
<div class="activity_bottom">
<div class="left">
<van-icon name="clock" size="1em"></van-icon>
<span style="margin-left: 10px;">
{{moment(o.startTime).format('YYYY/MM/DD HH:mm')}} 至
{{moment(o.endTime).format('YYYY/MM/DD HH:mm')}}
</span>
</div>
<div class="right">
<span v-if="moment(o.applyEndTime).valueOf() > moment().valueOf() && moment().valueOf() > moment(o.applyStartTime).valueOf()"
style="color: forestgreen">
报名中
</span>
<span v-else-if="moment(o.applyEndTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.startTime).valueOf()"
style="color: #ee1919">
报名结束
</span>
<span v-else-if="moment(o.startTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.endTime).valueOf()"
style="color: forestgreen">
活动进行中
</span>
<span v-else-if="moment().valueOf() > moment(o.endTime).valueOf()"
style="color: #ee1919">
活动结束
</span>
</div>
</div>
</div>
</div>
</div>
</van-list>
</div>
<van-empty v-if="mLoading==false&&tableData.length==0" class="custom-image" image="/none.svg"
description="暂无数据">
</van-empty>
<div>
<van-tabbar v-model="tabBarIndex" :active-color="themeColor">
<van-tabbar-item icon="home-o" url="/mobile/activity/unionActivity">全部活动</van-tabbar-item>
<van-tabbar-item icon="friends-o" url="/mobile/activity/myActivity">我的活动</van-tabbar-item>
</van-tabbar>
</div>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
pageDataUrl: '/mobile/activity/myActivity',
pageForm: {
year: ''
},
tabBarIndex: 1
}
},
methods: {
yearChange() {
this.pageForm.pageNumber = 1
this.pageData()
},
async pageData() {
this.mLoading = true
const resp = await $.post('/mobile/activity/myActivity/pageData', this.pageForm)
if (resp.code === 0) {
if (resp.data.list.length === 0) {
this.tableData = []
} else {
this.tableData = this.tableData.concat(resp.data.list)
}
if (this.tableData.length === resp.data.totalCount) {
this.finished = true
} else {
this.pageForm.pageNumber++
}
}
this.loading = false;
this.mLoading = false
},
openReg(o) {
// window.location.href = '/mobile/activity/unionActivity/goReg?id=' + o.id + '&signUpMethod=1'
if (o.projectTypeCode === '50004') {
window.location.href = '/mobile/activity/myActivity/goMyProject?id=' + o.id
} else {
window.location.href = '/mobile/activity/myActivity/goSign?id=' + o.id
}
}
},
created() {
this.pageForm.year = new Date().getFullYear()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,283 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.list-card {
margin-bottom: 10px;
}
.activity_card {
padding: 15px;
background: #fff;
margin: 10px;
border-radius: 5px;
}
.activity_card .van-image, .activity_card .van-image img {
border-radius: 5px;
}
.activity_card .activity_content {
margin-top: 10px;
}
.activity_card .activity_content .activity_name {
line-height: 25px;
margin-bottom: 10px;
display: flex;
align-items: center;
}
.activity_card .activity_content .activity_bottom {
line-height: 25px;
display: flex;
}
.activity_card .activity_content .activity_bottom .left {
line-height: 25px;
overflow: hidden;
width: calc(100% - 80px);
font-size: 12px;
color: #c4bebe;
white-space: nowrap;
display: flex;
align-items: center;
}
.activity_card .activity_content .activity_bottom .right {
line-height: 25px;
overflow: hidden;
width: 80px;
max-width: 80px;
text-align: right;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="活动列表" left-arrow placeholder fixed
@click-left="history.go(-1)"></van-nav-bar>
<div class="search-fixed">
<van-dropdown-menu active-color="#1989fa">
<van-dropdown-item v-model="pageForm.year" :options="yearList"
@change="formChange"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.activityStatus" :options="activityStatusList"
@change="formChange"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.activityLevel" :options="activityLevelList"
@change="formChange"></van-dropdown-item>
</van-dropdown-menu>
</div>
<div style="margin: 60px auto 80px auto">
<van-list v-model="loading" :finished="finished"
:finished-text="tableData.length>0?'没有更多了':''"
@load="pageData">
<div v-for="o in tableData" class="list-card" @click="openReg(o)">
<div class="activity_card">
<van-image
fit="cover"
width="100%"
height="200"
:src="FILE_DOMAIN + '/fileStreamPreview?id=' + o.cover"
></van-image>
<div class="activity_content">
<div class="activity_name van-ellipsis">
<van-icon name="fire" color="red"></van-icon>
<div style="margin-left: 10px;width: calc(100% - 26px);text-overflow: ellipsis;overflow: hidden;white-space: nowrap">
{{o.name}}
</div>
</div>
<div class="activity_bottom">
<div class="left" style="width: 100%">
<van-icon name="clock" size="1em"></van-icon>
<span style="margin-left: 10px;">
报名时间:{{o.applyStartTime}}至{{o.applyEndTime}}
<!-- {{moment(o.activityStartTime).format('YYYY/MM/DD HH:mm')}} 至-->
<!-- {{moment(o.activityEndTime).format('YYYY/MM/DD HH:mm')}}-->
</span>
</div>
<!-- <div class="right">-->
<!-- <span v-if="moment(o.applyEndTime).valueOf() > moment().valueOf() && moment().valueOf() > moment(o.applyStartTime).valueOf()"-->
<!-- style="color: forestgreen">-->
<!-- 报名中-->
<!-- </span>-->
<!-- <span v-else-if="moment(o.applyEndTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.startTime).valueOf()"-->
<!-- style="color: #ee1919">-->
<!-- 报名结束-->
<!-- </span>-->
<!-- <span v-else-if="moment(o.startTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.endTime).valueOf()"-->
<!-- style="color: forestgreen">-->
<!-- 活动进行中-->
<!-- </span>-->
<!-- <span v-else-if="moment().valueOf() > moment(o.endTime).valueOf()"-->
<!-- style="color: #ee1919">-->
<!-- 活动结束-->
<!-- </span>-->
<!-- </div>-->
</div>
<div class="activity_bottom">
<div class="left">
<van-icon name="clock" size="1em"></van-icon>
<span style="margin-left: 10px;">
活动时间:{{o.startTime}}
<!-- {{moment(o.activityStartTime).format('YYYY/MM/DD HH:mm')}} 至-->
<!-- {{moment(o.activityEndTime).format('YYYY/MM/DD HH:mm')}}-->
</span>
</div>
<div class="right">
<span v-if="moment(o.applyStartTime).valueOf() > moment().valueOf()"
style="color: forestgreen">
未开始报名
</span>
<span v-else-if="moment(o.applyEndTime).valueOf() > moment().valueOf() && moment().valueOf() > moment(o.applyStartTime).valueOf()"
style="color: forestgreen">
报名中
</span>
<span v-else-if="moment(o.applyEndTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.startTime).valueOf()"
style="color: #ee1919">
报名结束
</span>
<span v-else-if="moment(o.startTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.endTime).valueOf()"
style="color: forestgreen">
活动进行中
</span>
<span v-else-if="moment().valueOf() > moment(o.endTime).valueOf()"
style="color: #ee1919">
活动结束
</span>
</div>
</div>
<!-- <div class="activity_content" style="font-size: 12px; color: #c4bebe;">-->
<!-- <div class="left">-->
<!-- <van-icon name="clock" size="1em"></van-icon>-->
<!-- <span style="margin-left: 5px;">-->
<!-- {{moment(o.startTime).format('YYYY/MM/DD HH:mm')}} 至-->
<!-- {{moment(o.endTime).format('YYYY/MM/DD HH:mm')}}-->
<!-- </span>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
</div>
</van-list>
</div>
<van-empty v-if="mLoading==false&&tableData.length==0" class="custom-image" image="/none.svg"
description="暂无数据">
</van-empty>
<div>
<van-tabbar v-model="tabBarIndex" :active-color="themeColor">
<van-tabbar-item icon="home-o" url="/mobile/activity/unionActivity">全部活动
</van-tabbar-item>
<van-tabbar-item icon="friends-o" url="/mobile/activity/myActivity">我的活动
</van-tabbar-item>
</van-tabbar>
</div>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
pageDataUrl: '/mobile/activity/unionActivity/pageData',
pageForm: {
year: '',
activityStatus: null
},
tabBarIndex: 0,
activityLevelList: [],
activityStatusList: [
{text: '全部', value: 1},
{text: '未开始', value: 5},
{text: '报名中', value: 2},
{text: '进行中', value: 3},
{text: '已结束', value: 4}
]
}
},
methods: {
formChange() {
this.pageForm.pageNumber = 1
this.tableData = []
this.pageData()
},
async pageData() {
this.mLoading = true
const resp = await $.post('/mobile/activity/unionActivity/pageData', this.pageForm)
if (resp.code === 0) {
if (resp.data.list.length === 0) {
this.tableData = []
} else {
this.tableData = this.tableData.concat(resp.data.list)
/* this.tableData.forEach(v => {
if (v.cover) {
const cover = JSON.parse(v.cover)
v.cover = cover[0].filepath
}
})*/
}
if (this.tableData.length === resp.data.totalCount) {
this.finished = true
} else {
this.pageForm.pageNumber++
}
}
this.loading = false;
this.mLoading = false
},
//跳转页面
openReg(o) {
console.log(o)
if (moment(o.applyStartTime).valueOf() > moment().valueOf()) {
this.$toast('活动未开始报名')
return;
}
if (o.projectTypeCode === '50004') {
window.location.href = '/mobile/activity/Sports/list/activityEventList?id=' + o.id
} else {
window.location.href = '/mobile/activity/unionActivity/goReg?id=' + o.id + '&signUpMethod=' + o.signUpMethod
}
},
async init() {
this.$set(this.pageForm, "activityStatus", 1)
this.$set(this.pageForm, "year", new Date().getFullYear())
const {data} = await $.get("/platform/activity/basic/basic/settings/getActivityTwoLevelType", {code: 40000})
this.activityLevelList = []
this.activityLevelList.push({value: null, text: "全部类别"})
data.forEach(v => {
this.activityLevelList.push({value: v.code, text: v.name})
})
this.$set(this.pageForm, "activityLevel", this.activityLevelList[0].value)
}
},
async created() {
this.init()
}
})
window.addEventListener('pageshow', e => {
if (e.persisted || (window.performance && window.performance.navigation.type === 2)) {
vue.init()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,110 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.activity_img_back {
background-repeat: no-repeat;
background-size: cover;
height: 200px;
width: 100%;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="签到" left-arrow placeholder fixed @click-left="history.back()"></van-nav-bar>
<!--#include("/mobile/activity/unionActivity/common/activityInfo.html"){}#-->
<div style="margin: 20px 20px 10px 20px" v-if="o.needSign">
<van-button
:disabled="moment().valueOf() > moment(o.endTime).valueOf() || moment().valueOf() < moment(o.startTime).valueOf() || isSign"
@click="doSign()" style="border-radius: 10px" block type="info"
:color="themeColor">
{{isSign?'签到成功':'立即签到'}}
</van-button>
</div>
</div>
<script>
<!--#include("/mobile/activity/unionActivity/common/initMap.js"){}#-->
</script>
<script>
let geolocation = null
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, self_mixin],
data() {
return {
activityId: '',
o: {},
isSign: null
}
},
methods: {
async getSignStatus() {
const resp = await $.post('/mobile/activity/unionActivity/isSign', {activityId: this.activityId})
if (resp.code === 0) {
this.isSign = resp.data
}
},
async doSign() {
geolocation.getCurrentPosition(async (status, result) => {
if (status !== 'complete') {
this.$toast.fail('定位失败!')
return
}
console.log(status)
console.log(result)
const lat = result.position.lat
const lng = result.position.lng
const params = {
lat1: lat, lng1: lng, lat2: this.o.location[1], lng2: this.o.location[0]
}
const distance = this.getMapDistance(params)
console.log(distance)
console.log(this.o.rangeMeter)
if (distance > this.o.rangeMeter) {
this.$toast('距离活动打卡点还有' + distance + '米')
return
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要签到吗?',
})
const loading = this.$toast.loading({
message: '签到中...',
forbidClick: true,
overlay: true,
duration: 0
})
if (confirm === 'confirm') {
const resp = await $.post('/mobile/activity/unionActivity/singleSignUp', {activityId: this.activityId})
if (resp.code === 0) {
await this.getSignStatus()
loading.close()
this.$toast.success(resp.msg)
}
}
})
}
},
created() {
const id = GetQueryString("id")
if (id) {
this.activityId = id
this.getActivityInfo()
this.getSignStatus()
}
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,176 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.activity_img_back {
background-repeat: no-repeat;
background-size: cover;
/*height: 200px;*/
width: 100%;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="个人报名" left-arrow placeholder fixed
@click-left="history.back()"></van-nav-bar>
<!--#include("/mobile/activity/unionActivity/common/activityInfo.html"){}#-->
<div style="margin: 20px 20px 10px 20px"
v-if="moment(o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.applyEndTime).valueOf()">
<van-button v-if="!isRegister && !isRegisterFull" @click="doSave()"
style="border-radius: 10px" block
type="info"
:color="themeColor">
立即报名
</van-button>
<van-button v-else-if="!isRegister && isRegisterFull" @click="doSave()"
style="border-radius: 10px" block
disabled
type="info"
:color="themeColor">
名额已满
</van-button>
<van-button v-else-if="isRegister && moment().valueOf() < moment(o.applyEndTime).valueOf()"
@click="doCancel"
:disabled="isSign"
style="border-radius: 10px" block type="info"
color="red">
取消报名
</van-button>
</div>
<div style="margin: 20px 20px 10px 20px"
v-if="isRegister && moment().valueOf() < moment(o.endTime).valueOf() && moment().valueOf() > moment(o.startTime).valueOf()&&o.needSign">
<van-button
:disabled="moment().valueOf() > moment(o.endTime).valueOf() || moment().valueOf() < moment(o.startTime).valueOf() || isSign"
@click="doSign()" style="border-radius: 10px" block type="info"
:color="themeColor">
{{isSign?'签到成功':'立即签到'}}
</van-button>
</div>
</div>
<script>
<!--#include("/mobile/activity/unionActivity/common/initMap.js"){}#-->
</script>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, self_mixin],
data() {
return {
activityId: '',
o: {},
tagCloseable: true,
isRegister: false,
isSign: false
}
},
methods: {
async isRegisterForMe() {
const resp = await $.get('/mobile/activity/unionActivity/isRegisterForMe', {activityId: this.activityId})
if (resp.code === 0) {
this.isRegister = resp.data
}
},
async doSave() {
let message = ''
if (this.o.needSign) {
message = '报名后若未参加,将有可能影响到其它活动的报名,同时活动开启了现场签到!'
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要报名吗?' + message,
})
if (confirm === 'confirm') {
const loading = this.$toast.loading({
message: '报名中...',
forbidClick: true,
overlay: true,
duration: 2000
})
// await this.getHasRegUserNum()
const resp = await $.post('/mobile/activity/unionActivity/doSingleRegister', {activityId: this.activityId})
if (resp.code === 0) {
setTimeout(() => {
this.init()
this.$toast.success(resp.msg)
window.history.back()
}, 2000)
} else {
this.$toast.fail(resp.msg)
}
}
},
async doCancel() {
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要取消报名吗?',
})
const loading = this.$toast.loading({
message: '取消中...',
forbidClick: true,
overlay: true,
duration: 2000
})
if (confirm === 'confirm') {
const resp = await $.post('/mobile/activity/unionActivity/doSingleCancelRegister', {activityId: this.activityId})
if (resp.code === 0) {
setTimeout(() => {
this.init()
this.$toast.success(resp.msg)
window.history.back()
}, 2000)
} else {
this.$toast.fail(resp.msg)
}
}
},
async getSignStatus() {
const resp = await $.post('/mobile/activity/unionActivity/isSign', {activityId: this.activityId})
if (resp.code === 0) {
this.isSign = resp.data
}
},
async doSign() {
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要签到吗?',
})
if (confirm === 'confirm') {
const resp = await $.post('/mobile/activity/unionActivity/singleSignUp', {activityId: this.activityId})
if (resp.code === 0) {
await this.getSignStatus()
this.$toast.success(resp.msg)
}
}
},
init() {
const id = GetQueryString("id")
if (id) {
this.activityId = id
this.getActivityInfo()
this.isRegisterForMe()
this.getSignStatus()
if (moment(this.o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() > moment(this.o.applyEndTime).valueOf()) {
this.$toast.fail("不在活动范围内")
}
}
}
},
created() {
this.init()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,340 @@
<!--#
layout("/mobile/platform.html"){
#-->
<style>
.activity_img_back {
background-repeat: no-repeat;
background-size: cover;
height: 200px;
width: 100%;
}
.regCell .van-cell__label .van-tag {
margin-right: 10px;
margin-bottom: 10px;
}
.userActionPopup {
height: 80%;
}
.userActionPopup .van-cell__value {
text-align: center;
}
.userActionPopup .addBtn {
width: 24px;
}
.userActionPopup .van-action-sheet__item {
position: relative;
}
.userActionPopup .userSelSuccess {
position: absolute;
right: 20px;
}
.van-search__action {
background-color: #edf0ff
}
</style>
<div id="app" v-cloak>
<van-nav-bar :title="title" left-arrow placeholder fixed
@click-left="history.back()"></van-nav-bar>
<!--#include("/mobile/activity/unionActivity/common/activityInfo.html"){}#-->
<van-cell-group inset class="mt5">
<van-cell title="报名人员" class="regCell">
<template #label>
<div>
<span v-if="o.userNumberLimit===1">
本活动限制总报名人数:({{o.totalUserNumberLimit}})人
</span>
<span v-else-if="o.userNumberLimit===2">
当前分工会报名限额 <span style="color: orange">{{o.limitUnion.limitNum}})人</span>
</span>
</div>
<div class="mt5" v-loading="tagCloseable">
<div v-if="registerList && registerList.length>0">
<template v-for="item in registerList">
<van-tag type="primary" :closeable="tagCloseable" size="medium"
:color="themeColor"
@close="removeRegUser(item)">
{{item.userName}}
</van-tag>
</template>
</div>
<div v-else>
<div style="text-align: center;margin-top: 20px;">
无报名人员
</div>
</div>
</div>
<div class="mt5" style="text-align: right"
v-if="moment(o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.applyEndTime).valueOf()">
<van-button v-if="tagCloseable" size="mini" type="info"
@click="openUserActionSheet" :color="themeColor">选择报名人员
</van-button>
</div>
</template>
</van-cell>
</van-cell-group>
<van-action-sheet v-model="userActionSheet" title="选择报名人员" class="userActionPopup">
<van-search v-model="searchKey" @search="onSearchUser" show-action
placeholder="请输入姓名搜索">
<template #action>
<div @click="onSearchUser(searchKey)">搜索</div>
</template>
</van-search>
<!-- <div class="van-hairline&#45;&#45;bottom">-->
<!-- 点击列表中的人员添加到活动人员中-->
<!-- </div>-->
<template v-if="searchLoading">
<van-loading size="24px" vertical>搜索中...</van-loading>
</template>
<div class="van-action-sheet__content mt5"
v-else-if="searchUserList && searchUserList.length>0">
<template>
<template v-for="item in searchUserList"
v-if="!registerList.map(v=>v.id).includes(item.id)">
<button @click="searchUserAdd(item)"
class="van-action-sheet__item van-hairline--bottom">
<span class="van-action-sheet__name">{{item.userName}}{{item.loginName}}</span>
</button>
</template>
<!--<van-empty description="没有更多了" style="position:absolute;height: 70%"
v-else></van-empty>-->
</template>
</div>
<van-empty description="暂无数据" style="position:absolute;height: 70%"
v-else-if="searchUserList.length===0"></van-empty>
</van-action-sheet>
<div style="margin: 20px 20px 10px 20px"
v-if="moment(o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() < moment(o.applyEndTime).valueOf()">
<van-button v-if="tagCloseable" @click="doSave()" style="border-radius: 10px" block
type="info"
:color="themeColor">
提 交
</van-button>
<van-button v-else="!tagCloseable" @click="tagCloseable = true" style="border-radius: 10px"
block type="info"
:color="themeColor">
修 改
</van-button>
</div>
<!-- <div style="margin: 20px 20px 10px 20px" v-if="tagCloseable">-->
<!-- <van-button-->
<!-- :disabled="moment().valueOf() > moment(o.endTime).valueOf() || moment().valueOf() < moment(o.startTime).valueOf()"-->
<!-- @click="doSign()" style="border-radius: 10px" block type="info"-->
<!-- :color="themeColor">-->
<!-- 立即签到-->
<!-- </van-button>-->
<!-- </div>-->
</div>
<script>
<!--#include("/mobile/activity/unionActivity/common/initMap.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [mobileMixins, self_mixin],
data() {
return {
title: "",
userId: "${@shiro.getPrincipalProperty('id')}",
userName: "${@shiro.getPrincipalProperty('username')}",
activityId: '',
o: {},
registerList: [],
addRegisterList: [],
userActionSheet: false,
searchKey: '',
searchUserList: [],
tagCloseable: true,
searchLoading: false
}
},
methods: {
async getRegisterUser() {
const resp = await $.get('/mobile/activity/myActivity/selectRegisterList', {activityId: this.activityId})
if (resp.code === 0) {
if (this.o.signUpMethod === 3) {
this.registerList = resp.data.filter(v => v.applyUserId === this.userId)
} else {
this.registerList = resp.data
}
this.addRegisterList = resp.data
if (this.registerList.length > 0) {
this.tagCloseable = false
}
}
},
openUserActionSheet() {
this.searchKey = ''
this.searchUserList = []
this.userActionSheet = true
},
async onSearchUser(val) {
if (!val) {
this.$toast.fail("请输入搜索条件")
return
}
this.searchLoading = true
const resp = await $.get('/mobile/activity/unionActivity/searchNoRegisterUser', {
activityId: this.activityId,
searchKey: val
})
if (resp.code === 0) {
this.searchLoading = false
this.searchUserList = resp.data.list
} else {
this.$toast.fail(resp.msg)
}
},
searchUserAdd(item) {
const {id, userName} = item
this.registerList.push({id, userName})
},
async removeRegUser(item) {
if (this.userId === item.id) {
this.$toast.fail("自己不能删除")
return
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: '您确认要移除吗?',
})
if (confirm === 'confirm') {
const index = this.registerList.findIndex(v => v.id === item.id)
this.registerList.splice(index, 1)
}
},
//保存
async doSave() {
if (this.registerList.length === 0) {
this.$toast('请添加报名人员后再提交!')
return
}
if (this.o.signUpMethod === 3) {
if (this.registerList.length !== this.o.teamNum) {
vant.Dialog.alert({
title: '温馨提示',
message: '此活动是双人报名模式您需要报名' + this.o.teamNum + '人!',
}).then(() => {
});
return
}
if (!this.registerList.map(v => v.id).includes(this.userId)) {
vant.Dialog.alert({
title: '温馨提示',
message: '此活动是组队模式请您找' + this.o.teamNum + '朋友一起报名!',
}).then(() => {
});
return
}
// await this.getRegisterUser()
const resp = await $.get('/mobile/activity/myActivity/selectRegisterList', {activityId: this.activityId})
this.addRegisterList = resp.data
let arr = []
if (this.addRegisterList && this.addRegisterList.length > 0) {
this.addRegisterList.forEach(v => {
this.registerList.forEach(r => {
if (v.id === r.id && v.applyUserId !== this.userId) {
arr.push(r.userName)
}
})
})
}
if (arr && arr.length > 0) {
vant.Dialog.alert({
title: '温馨提示',
message: '【' + arr.toString() + '】已成功报名您无需再报名!',
}).then(() => {
});
return
}
/* if (this.addRegisterList.map(v => v.id).includes(this.userId)) {
vant.Dialog.alert({
title: '温馨提示',
message: '您已报名无需再报名!',
}).then(() => {
});
return
}*/
}
let message = ''
if (this.o.needSign) {
message = '此活动开启了签到,需要您活动当天前往签到点位核实活动报名人员后进行签到!'
}
const confirm = await this.$dialog.confirm({
title: '提示',
message: message + '您确认要报名吗?',
})
if (confirm === 'confirm') {
const loading = this.$toast.loading({
message: '报名中...',
forbidClick: true,
overlay: true,
duration: 0
})
const params = {
activityId: this.activityId,
personIds: JSON.stringify(this.registerList.map(v => v.id))
}
const resp = await $.post('/mobile/activity/unionActivity/doSaveUnionRegister', params)
loading.close()
if (resp.code === 0) {
await this.getRegisterUser()
await this.getHasRegUserNum()
this.$toast.success(resp.msg)
} else {
this.$toast.fail(resp.msg)
}
}
}
},
async created() {
const id = GetQueryString("id")
if (id) {
this.activityId = id
await this.getActivityInfo()
await this.getRegisterUser()
if (this.o.signUpMethod === 3 && this.registerList.length === 0) {
this.registerList.push({id: this.userId, userName: this.userName})
}
this.title = (this.o.signUpMethod === 2 ? '分工会报名' : '组队报名')
if (moment(this.o.applyStartTime).valueOf() < moment().valueOf() && moment().valueOf() > moment(this.o.applyEndTime).valueOf()) {
this.$toast.fail("不在活动范围内")
}
}
}
})
</script>
<!--#
}
#-->