first commit

This commit is contained in:
2026-08-26 14:25:17 +08:00
commit 06debfd1fc
10595 changed files with 1836924 additions and 0 deletions
@@ -0,0 +1,234 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style>
.list-card {
border-radius: 0;
}
.list-card-body {
/* width: calc(100% - 140px);
display: flex;*/
width: calc(100% - 140px);
display: flex;
flex-direction: column;
justify-content: space-between;
}
.list-card-body .title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1.1em;
}
.list-card-body .time {
color: #9a9696;
line-height: 20px;
}
.list-card-body .footer {
text-align: right;
}
.list-card-body .footer .tag {
border: 1px solid transparent;
padding: 5px;
border-radius: 5px;
}
.list-card-img img{
width: 100%;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="活动列表" @click-left="historyBack" left-arrow left-text="返回" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu>
<year-van-dropdown-item :num="5" @change="doSearch" v-model="pageForm.year"></year-van-dropdown-item>
<van-dropdown-item :options="stateList" @change="doSearch" v-model="pageForm.state"></van-dropdown-item>
<van-dropdown-item :options="isEnrolledOptions" @change="doSearch" v-model="pageForm.isEnrolled"></van-dropdown-item>
<van-dropdown-item :options="activityTypeOptions" @change="doSearch" v-model="pageForm.activity_type"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/activity/culture/applyUser/pageData"
:page_form.sync="pageForm"
ref="tableListRef"
title="name"
img="cover"
@ready="onReady"
>
<template v-slot="{index,row}">
<table-column label="报名开始时间">
{{$moment(row.startTime).format('MM/DD HH:mm')}}
</table-column>
<table-column label="报名结束时间">
{{$moment(row.endTime).format('MM/DD HH:mm')}}
</table-column>
</template>
<template #actions="{index,row}">
<template v-if="$moment().isBefore($moment(row.endTime))">
<div class="action-btn" @click="openDetail(row)">
<i class="fa fa-edit"></i>
<span>去报名</span>
</div>
</template>
</template>
</table-list>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" v-model="viewShow">
<mobile-culture-apply-user :id="viewData.id" @back="back" @submit_back="submit_back" ref="viewInfo"></mobile-culture-apply-user>
</van-popup>
</div>
<script nonce="${cspNonce!}">
<!--#include("mobileCultureApplyUser.js"){}#-->
new Vue({
el: "#app",
data() {
return {
tableData: [],
finished: false,
loading: false,
refreshing: false,
pageForm: {
state: 2,
isEnrolled: 0,
year: new Date().getFullYear(),
pageNumber: 1,
pageSize: 5,
totalCount: 0,
activity_type: 40001
},
yearList: [],
isEnrolledOptions: [
{ value: 0, text: "未报名" },
{ value: 1, text: "已报名" }
],
stateList: [
{ value: 1, text: "全部" },
{ value: 2, text: "报名中" },
{ value: 3, text: "报名已结束" }
],
subLoading: false,
viewShow: false,
viewData: {},
activityTypeOptions: [
{ value: 40001, text: "校文化活动" },
{ value: 40002, text: "分工会文化活动" },
{ value: 40003, text: "社团文化活动" },
]
}
},
components: {
"mobile-culture-apply-user": MOBILE_CULTURE_APPLY_USER
},
methods: {
onReady() {
this.doSearch()
},
openDetail(row) {
this.$axios.post('/platform/activity/basic/scope/getScopeUser',{activityGroupId:row.groupId}).then(res=>{
if(res.code===0){
if(res.data>0){
this.$pjaxReplace("/platform/h5/activity/culture/signUp?id=" + row.id)
}else{
this.$toast('您没有权限参加此活动')
}
}
})
},
submit_back(id, countUser) {
this.tableData.map((t) => {
if (t.id === id) {
t.countUser = countUser
}
})
this.viewShow = false
this.$toast.success("报名成功")
},
back() {
this.viewShow = false
},
openAudit(row) {
this.viewData = row
this.viewShow = true
setTimeout(() => {
this.$refs.viewInfo.getActivityInfo()
}, 500)
},
async doAdd(row) {
this.$dialog
.confirm({
title: "提示",
message: "确认要报名吗?"
})
.then(() => {
this.$axios.post("/platform/activity/culture/applyUser/singleSignUp", { activityId: row.id }).then((res) => {
if (res.code === 0) {
this.$toast.loading({
duration: 0,
forbidClick: true,
message: "加载中...."
})
setTimeout(() => {
this.$toast.clear()
this.$toast.success(res.msg)
this.doSearch()
this.subLoading = false
}, 1000)
} else {
this.subLoading = false
}
})
})
.catch(() => {})
},
async doDelete(row) {
this.$dialog
.confirm({
title: "提示",
message: "确认要取消报名吗?"
})
.then(() => {
this.$axios.post("/platform/activity/culture/applyUser/cancelSignUp", { activityId: row.id }).then((res) => {
if (res.code === 0) {
this.$toast.loading({
duration: 0,
forbidClick: true,
message: "加载中...."
})
setTimeout(() => {
this.$toast.clear()
this.$toast.success(res.msg)
this.doSearch()
this.subLoading = false
}, 1000)
} else {
this.$toast.fail(res.msg)
}
})
})
.catch(() => {})
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
}
},
created() {
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,334 @@
var MOBILE_CULTURE_APPLY_USER = {
template: `
<div>
<van-nav-bar :title="title" @click-left="back" fixed left-arrow left-text="返回"
placeholder></van-nav-bar>
<div class="activity_img_back">
<van-image :src="viewData.cover" height="200"
width="100%"></van-image>
</div>
<van-cell-group class="mt10" inset>
<van-cell :value="viewData.name" title="活动名称"></van-cell>
<van-cell :value="viewData.address" title="活动地址"></van-cell>
<van-cell v-if="viewData.userNumberLimit!=null">
<template #title>
<span v-if="viewData.userNumberLimit===1">
活动限制人数
</span>
<span v-else-if="viewData.userNumberLimit===2">
本工会限制名额
</span>
</template>
<template>
<span v-if="viewData.userNumberLimit===1">
<span style="color: orange">{{viewData.totalUserNumberLimit }}</span>人
</span>
<span v-else="viewData.userNumberLimit===2">
<span style="color: orange">{{viewData.unionLimitNum }}</span>人
</span>
</template>
</van-cell>
<van-cell title="当前活动报名" v-if="viewData.signUpMethod!=null">
<template>
<span style="color: red">{{viewData.tissuePersonList.length}}</span>人
</template>
</van-cell>
<van-cell title="报名方式" v-if="viewData.signUpMethod">
<template>
<span v-if="viewData.signUpMethod===1">个人报名</span>
<span v-if="viewData.signUpMethod===2">分工会报名</span>
<span v-if="viewData.signUpMethod===3">组队报名</span>
</template>
</van-cell>
<van-cell title="组队人数" v-if="viewData.signUpMethod==3">
<span style="color: red"> {{viewData.teamNum}}</span>人
</van-cell>
<van-cell title="活动内容" v-if="viewData.projectTypeCode!=='50004'">
<template #label>
<span style="white-space: pre-line">
{{viewData.activityContent}}
</span>
</template>
</van-cell>
</van-cell-group>
<van-cell-group class="mt5" inset>
<van-cell class="regCell" title="报名人员">
<template #label>
<div>
<span v-if="viewData.userNumberLimit===1">
本活动限制总报名人数:({{viewData.totalUserNumberLimit}})人
</span>
<span v-else-if="viewData.userNumberLimit===2">
当前分工会报名限额 <span style="color: orange">{{viewData.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 closeable type="success"
:plain="false"
@close="removeRegUser(item)" style="margin: 5px;font-size: 13px;">
<span style="margin: 5px;">{{item.userName}}</span>
</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(viewData.applyStartTime).valueOf() < $moment().valueOf() &&
$moment().valueOf() < $moment(viewData.applyEndTime).valueOf()">
<van-button @click="openUserActionSheet" size="mini"
type="primary" style="font-size: 15px;height:25px;margin: 5px">
<span>选择报名人员</span>
</van-button>
</div>
</template>
</van-cell>
</van-cell-group>
<van-action-sheet class="userActionPopup" title="选择报名人员" v-model="userActionSheet">
<van-search @search="onSearchUser" placeholder="请输入姓名搜索" show-action
v-model="searchKey">
<template #action>
<div @click="onSearchUser(searchKey)">搜索</div>
</template>
</van-search>
<template v-if="searchLoading">
<van-loading size="24px" vertical>搜索中...</van-loading>
</template>
<div>
<div class="van-action-sheet__content mt5"
v-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>
</template>
</div>
<van-empty v-else image="/assets/platform/plugins/vant-green/images/nodata/nodata.png" description="暂无数据"></van-empty>
</div>
</van-action-sheet>
<div style="margin: 15px">
<van-button @click="doSave()" block style="border-radius: 10px;"
type="primary">
提 交
</van-button>
</div>
</div>
`,
store,
props: {
id: {
value: { type: Object, default: "" }
}
},
data() {
return {
title: "活动报名",
viewData: {},
registerList: [],
addRegisterList: [],
userActionSheet: false,
searchKey: "",
searchUserList: [],
tagCloseable: true,
searchLoading: false
}
},
methods: {
async doSave() {
if (this.registerList.length === 0) {
this.$toast("请添加报名人员后再提交!")
return
}
//如果是组队报名
if (this.viewData.signUpMethod === 3) {
//判断报名了几个人
if (this.registerList.length !== this.viewData.teamNum) {
this.$dialog
.alert({
title: "温馨提示",
message: "此活动是双人报名模式您需要报名" + this.viewData.teamNum + "人!"
})
.then(() => {})
return
}
if (!this.registerList.map((v) => v.id).includes(this.$store.state.user.id)) {
this.$dialog
.alert({
title: "温馨提示",
message: "此活动是组队模式需要" + this.viewData.teamNum + "个人一起报名!"
})
.then(() => {})
return
}
let arr = []
//判断提交的人员当中有没有人报名
this.$axios.post("/platform/h5/activity/culture/selectRegisterList", { activityId: this.id }).then((resp) => {
this.addRegisterList = resp.data
if (this.addRegisterList && this.addRegisterList.length > 0) {
this.addRegisterList.forEach((v) => {
this.registerList.forEach((r) => {
if (v.id === r.id && v.applyUserId !== this.$store.state.user.id) {
arr.push(r.userName)
}
})
})
}
})
if (arr && arr.length > 0) {
vant.Dialog.alert({
title: "温馨提示",
message: "【" + arr.toString() + "】已成功报名您无需再报名!"
}).then(() => {})
return
}
}
const confirm = await this.$dialog.confirm({
title: "提示",
message: "您确认要报名吗?"
})
if (confirm === "confirm") {
const loading = this.$toast.loading({
message: "报名中...",
forbidClick: true,
overlay: true,
duration: 0
})
const params = {
activityId: this.viewData.id,
personIds: JSON.stringify(this.registerList.map((v) => v.id))
}
this.$axios.post("/platform/activity/culture/applyUser/doSaveUnionRegister", params).then((resp) => {
if (resp.code === 0) {
setTimeout(() => {
loading.close()
this.$emit("submit_back", this.viewData.id, this.registerList.length)
}, 1000)
} else {
this.$toast.fail(resp.msg)
}
})
}
},
searchUserAdd(item) {
const { id, userName } = item
this.registerList.push({ id, userName })
this.$toast.success("添加成功")
},
onSearchUser(val) {
if (!val) {
this.$toast.fail("请输入搜索条件")
return
}
this.searchLoading = true
this.$axios
.post("/platform/h5/activity/culture/searchNoRegisterUser", {
activityId: this.viewData.id,
searchKey: val
})
.then((resp) => {
if (resp.code === 0) {
this.searchLoading = false
this.searchUserList = resp.data.list
} else {
this.$toast.fail(resp.msg)
}
})
},
openUserActionSheet() {
this.searchKey = ""
this.searchUserList = []
this.userActionSheet = true
},
async removeRegUser(item) {
if (this.$store.state.user.id === 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)
}
},
back() {
this.$emit("back")
},
getRegisterUser() {
this.$axios.post("/platform/h5/activity/culture/selectRegisterList", { activityId: this.id }).then((resp) => {
if (resp.code === 0) {
if (this.viewData.signUpMethod === 3) {
this.registerList = resp.data.filter((v) => v.applyUserId === this.$store.state.user.id)
} else {
this.registerList = resp.data
}
this.addRegisterList = resp.data
if (this.registerList.length > 0) {
this.tagCloseable = false
}
}
})
},
getActivityInfo() {
this.$toast.loading({
message: "加载中...",
forbidClick: true
})
this.getRegisterUser()
this.$axios.post("/platform/activity/culture/infoManage/findOne", { id: this.id }).then((res) => {
if (res.data) {
res.data.billFiles = JSON.parse(res.data.billFiles)
res.data.photoFiles = JSON.parse(res.data.photoFiles)
res.data.otherFiles = JSON.parse(res.data.otherFiles)
res.data.unionUserNumberLimit = JSON.parse(res.data.unionUserNumberLimit)
if (!this.$store.state.user.union.id) {
this.$toast.fail("您的所属工会信息缺失,请联系管理员")
return
}
if (res.data.userNumberLimit === 2) {
const unionLimit = res.data.unionUserNumberLimit.find((v) => v.id === this.$store.state.user.union.id)
res.data.unionLimitNum = unionLimit.limitNum
}
this.viewData = res.data
if (this.viewData.signUpMethod === 3 && this.registerList.length === 0) {
this.registerList.push({
id: this.$store.state.user.id,
userName: this.$store.state.user.username
})
}
setTimeout(() => {
this.$toast.clear()
}, 1000)
} else {
this.viewData = {}
}
})
}
}
}
@@ -0,0 +1,794 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style>
.title {
padding: 10px;
font-size: 1.2em;
font-weight: bold;
background: #ffffff;
}
.info-item {
display: flex;
align-items: center;
padding: 20px 15px;
border-bottom: 1px solid #ededed;
column-gap: 10px;
background: #ffffff;
}
.left-tag-title::before {
content: "";
width: 5px;
background: var(--color-primary);
display: inline-block;
position: absolute;
left: 0;
top: 0;
bottom: 0;
}
.users {
padding: 10px;
margin-top: 10px;
border-top: 1px solid #e8e0e0;
background: #ffffff;
}
.users-title {
font-size: 1.1em;
position: relative;
padding-left: 10px;
}
.users-content {
padding: 10px;
overflow-x: auto;
display: flex;
flex-wrap: nowrap;
gap: 20px;
}
.users-content .users-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
width: 80px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
}
.block {
padding: 10px;
margin-top: 10px;
border-top: 1px solid #e8e0e0;
background: #ffffff;
}
.notice {
padding: 10px;
margin-top: 10px;
border-top: 1px solid #e8e0e0;
background: #ffffff;
}
.notice-title {
font-size: 1.1em;
position: relative;
padding-left: 10px;
}
.notice-content {
padding: 10px;
box-sizing: border-box;
}
.notice-content img {
max-width: 100% !important;
}
.footer {
position: fixed;
background: #ffffff;
height: 56px;
display: flex;
align-items: center;
justify-content: space-between;
bottom: 0;
left: 0;
right: 0;
}
.footer .bottom-button {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: rgb(255, 255, 255);
height: 100%;
}
.form-create-h5 {
background-color: #ffffff;
margin-top: 10px;
padding: 10px 10px 56px 10px;
}
.form-create-h5 .el-form {
margin-top: 20px;
}
.form-create-h5 .el-col-12 {
width: 100%;
}
.form-create-h5 .el-row--flex.is-align-middle {
flex-direction: column;
}
.form-create-h5 .el-form-item {
display: flex;
flex-direction: column;
}
.form-create-h5 .el-form-item .el-form-item__label {
width: 100% !important;
text-align: left !important;
color: #000;
font-size: 16px;
}
.form-create-h5 .el-form-item .el-form-item__content {
margin-left: 0 !important;
}
.form-create-h5 .el-radio-group {
display: flex;
flex-direction: column;
row-gap: 20px;
}
.form-create-h5 .el-radio-group label {
width: 100%;
margin-right: 0;
}
</style>
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" placeholder fixed left-arrow left-text="返回" placeholder
title="活动详情"></van-nav-bar>
<div style="background: #ededed; padding-bottom: 56px">
<van-image :src="viewData.cover"></van-image>
<div class="title">{{viewData.name}}</div>
<div class="info">
<div class="info-item">
<van-icon name="underway-o"></van-icon>
<div>{{viewData.startTime}}至{{viewData.endTime}}</div>
</div>
<div class="info-item">
<van-icon name="location-o"></van-icon>
<div>{{viewData.address}}</div>
</div>
<div class="info-item" v-if="viewData.userNumberLimit===1">
<van-icon name="location-o"></van-icon>
活动限制人数
<span>{{viewData.totalUserNumberLimit}}人</span>
</div>
<div class="info-item" v-if="viewData.userNumberLimit===2">
<van-icon name="location-o"></van-icon>
本工会限制名额
<span>{{viewData.unionLimitNum}}人</span>
</div>
<div class="info-item">
<van-icon name="location-o"></van-icon>
报名方式:
<span v-if="viewData.signUpMethod===1" style="color: var(--color-primary)">个人报名</span>
<span v-if="viewData.signUpMethod===2" style="color: var(--color-primary)">组队报名</span>
<span v-if="viewData.signUpMethod===3" style="color: var(--color-primary)">分工会报名</span>
</div>
<div class="info-item" v-if="viewData.signUpMethod==3">
<van-icon name="location-o"></van-icon>
组队人数:
<span style="color: var(--color-primary)">{{viewData.teamNum}}</span>
</div>
<!-- <div class="info-item" v-if="viewData.signUpMethod==1">-->
<!-- <van-icon name="location-o"></van-icon>-->
<!-- 报名人数:-->
<!-- <span style="color: var(&#45;&#45;color-primary)">2</span>-->
<!---->
<!-- </div>-->
</div>
<div class="notice">
<div class="notice-title left-tag-title">活动详情</div>
<rich-text :value="viewData.activityContent" :height="300"></rich-text>
</div>
<!-- 个人报名 啥也不要-->
<template v-if="viewData.signUpMethod===1" class="block"></template>
<!-- 组队报名-->
<div v-if="viewData.signUpMethod===2" class="block">
<div class="notice-title left-tag-title">
选择组队队友,组队人数
<span style="color: red">{{viewData.teamNum}}</span>
</div>
<span v-if="!isApplyUser" class="text-primary">如需取消报名,请联系报名人。</span>
<div style="margin-top: 10px">
<el-select
v-if="isApplyUser && inApplyTime"
v-model="searchTeammateUserId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入关键词"
:remote-method="queryTeammate"
>
<el-option
v-for="item in teammateOptions"
:key="item.userId"
:label="item.userName + '(' + item.loginName + ')'"
:value="item.userId"
></el-option>
</el-select>
<el-button v-if="isApplyUser && inApplyTime" class="ml5" type="primary" icon="el-icon-plus"
@click="addTeamUser">添加
</el-button>
<el-table :data="teamUsers" class="mt10" border>
<el-table-column label="序号" type="index" width="60px"></el-table-column>
<el-table-column prop="userName" label="姓名"></el-table-column>
<el-table-column prop="loginName" label="工号"></el-table-column>
<!-- <el-table-column prop="sex" label="性别"></el-table-column>-->
<!-- <el-table-column prop="unitName" label="单位"></el-table-column>-->
<!-- <el-table-column prop="mobile" label="手机号"></el-table-column>-->
<el-table-column prop="applyUserId" label="标识">
<template slot-scope="{row}">
<!-- v-if="scope.row.applyUserId===scope.row.userId"-->
<el-tag size="mini" v-if="row.applyUserId==row.userId">报名人</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="100px"
v-if="(isApplyUser || teamUsers.length===0) && inApplyTime">
<template slot-scope="scope">
<el-button
type="danger"
size="mini"
@click="removeTeamUser(scope.$index)"
v-if="scope.row.applyUserId!==scope.row.userId"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 分工会报名-->
<div v-else-if="viewData.signUpMethod===3" class="block">
<div class="notice-title left-tag-title">选择报名人员
<span v-if="viewData.userNumberLimit===2">
,报名人数 <span style="color: red">
{{viewData.unionTeamNum}}</span>
</span>
</div>
<el-select
v-if="inApplyTime"
v-model="searchTeammateUserId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入关键词"
:remote-method="queryTeammate">
<el-option
v-for="item in teammateOptions"
:key="item.userId"
:label="item.userName + '(' + item.loginName + ')'"
:value="item.userId">
</el-option>
</el-select>
<el-button v-if="inApplyTime" class="ml5" type="primary" icon="el-icon-plus"
@click="addTeamUser">添加
</el-button>
<el-table :data="teamUsers" class="mt10">
<el-table-column label="序号" type="index" width="60px"></el-table-column>
<el-table-column prop="userName" label="姓名"></el-table-column>
<el-table-column prop="loginName" label="工号"></el-table-column>
<!-- <el-table-column prop="sex" label="性别"></el-table-column>-->
<!-- <el-table-column prop="unitName" label="单位"></el-table-column>-->
<!-- <el-table-column prop="mobile" label="手机号"></el-table-column>-->
<el-table-column label="操作" width="100px"
v-if="inApplyTime">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="removeTeamUser(scope.$index)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="form-create-h5" v-if="isCustomForm">
<div class="notice-title left-tag-title">填写报名信息</div>
<form-create :value.sync="dynamicFormData" v-model="fapi" :rule="formCreateRule"
:option="formCreateOption"></form-create>
</div>
</div>
<div class="footer">
<div class="bottom-button" style="background: var(--color-primary)" v-if="!isSignUp && inApplyTime"
@click="onConfirm">
<span>立即报名</span>
<span style="font-size: 12px; margin-top: 5px">{{viewData.applyEndTime}}截止报名</span>
</div>
<div class="bottom-button" style="background: var(--color-primary)" v-if="isSignUp && inApplyTime"
@click="onConfirmAgain">
<span>重新提交</span>
<span style="font-size: 12px; margin-top: 5px">{{viewData.applyEndTime}}截止报名</span>
</div>
<div class="bottom-button" style="background: red" v-if="isSignUp && inApplyTime" @click="onCancel">
<span>取消报名</span>
<span style="font-size: 12px; margin-top: 5px">{{viewData.applyEndTime}}截止报名</span>
</div>
<div class="bottom-button" v-if="$moment(viewData.endTime).valueOf() < $moment().valueOf()">活动已结束</div>
</div>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: "#app",
store,
data() {
return {
id: GetQueryString("id"),
viewData: {},
signUpInfo: {},
dynamicFormData: {},
formCreateRule: [],
formCreateOption: {},
fapi: null,
//搜索框
searchTeammateUserId: null,
//搜索框选新娘
teammateOptions: [],
//表格用户
teamUsers: [],
//是否报名
isSignUp: false
}
},
computed: {
isCustomForm() {
return this.viewData && this.viewData.formConfig != null && this.viewData.formConfig !== ""
},
//是否报名人
isApplyUser() {
if (this.teamUsers) {
return this.teamUsers.every((v) => v.applyUserId === this.$store.state.user.id)
} else {
return true
}
},
//是否在活动报名时间内
inApplyTime() {
if (this.viewData) {
const now = new Date().getTime()
const start = this.$moment(this.viewData.applyStartTime).valueOf()
const end = this.$moment(this.viewData.applyEndTime).valueOf()
return now >= start && now <= end
}
return false
}
},
methods: {
init() {
if(!this.id) return
this.$axios.post("/platform/activity/culture/infoManage/activityInfo", {id: this.id})
.then((res) => {
if (res.code === 0) {
this.viewData = res.data
this.checkScope(this.viewData.groupId)
//总人数限制
if (this.viewData.userNumberLimit === 1) {
} else if (this.viewData.userNumberLimit === 2) {
//分工会人数限制
const union = this.viewData.unionUserNumberLimit.find(v => v.id === this.$store.state.user.union.id)
this.viewData.unionLimitNum = union.limitNum
}
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
if (this.viewData.formConfig) {
this.formCreateRule = formCreate.parseJson(this.viewData.formConfig.rule)
this.formCreateOption = formCreate.parseJson(this.viewData.formConfig.options)
}
}
})
},
//查询报名人员
listTeamUser() {
this.$axios.post("/platform/activity/culture/applyUser/listTeamUser", {activityId: this.id}).then((res) => {
if (res.code === 0) {
this.isSignUp = res.data.length > 0
this.teamUsers = res.data
this.defaultAddSelf()
this.customFormInit()
}
})
},
//查询报名人员
listTeamUserUnion() {
this.$axios.post("/platform/activity/culture/applyUser/listTeamUserUnion", {activityId: this.id}).then((res) => {
if (res.code === 0) {
this.isSignUp = res.data.length > 0
this.teamUsers = res.data
this.defaultAddSelf()
this.customFormInit()
}
})
},
//表单回显
customFormInit() {
if (this.teamUsers && this.teamUsers.length > 0) {
const self = this.teamUsers.find((v) => v.userId === this.$store.state.user.id)
if (self && this.isCustomForm) {
this.dynamicFormData = self.dynamicFormData
}
}
},
//组队和个人报名默认增加自己
defaultAddSelf() {
if (this.teamUsers.length === 0 && [1, 2].includes(this.viewData.signUpMethod)) {
this.teamUsers.push({
userId: this.$store.state.user.id,
userName: this.$store.state.user.username,
loginName: this.$store.state.user.loginname,
sex: this.$store.state.user.sex,
unitName: this.$store.state.user?.unit?.name,
mobile: this.$store.state.user.mobile,
applyUserId: this.$store.state.user.id
})
}
},
//提交报名
async onConfirm() {
if (this.isCustomForm && this.fapi) {
let formValid = false
try {
await this.fapi.validate()
formValid = true
} catch (e) {
formValid = false
}
if (!formValid) {
this.$toast('请填写报名信息后再提交')
return
}
}
//组队
if (this.viewData.signUpMethod === 2) {
//组队人数判断
if (this.teamUsers.length === 0) {
this.$toast("请添加队友后再提交!")
return
}
if (this.teamUsers.length < this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "您选择的人数小于" + this.viewData.teamNum + "人,请重新选择!"
})
.then(() => {
})
return
}
if (this.teamUsers.length > this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "您选择的人数大于" + this.viewData.teamNum + "人,请重新选择!"
})
.then(() => {
})
return
}
}
//分工会
if (this.viewData.signUpMethod === 3) {
if (this.teamUsers.length === 0) {
this.$dialog
.alert({
title: "提示",
message: "请添加报名人员后再提交!"
})
.then(() => {
})
return
}
if (this.viewData.teamNum && this.teamUsers.length > this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "您选择的人数大于" + this.viewData.teamNum + "人,请重新选择!"
})
.then(() => {
})
return
}
}
let formData = {
activityId: this.id
}
if (this.isCustomForm) {
formData.ext = JSON.stringify(this.fapi.formData())
}
if (this.viewData.signUpMethod === 2 || this.viewData.signUpMethod === 3) {
formData.teamUserIds = JSON.stringify(this.teamUsers.map((v) => v.userId))
}
this.$dialog
.confirm({
title: "提示",
message: "确定提交报名信息吗?"
})
.then(() => {
this.$axios.post("/platform/activity/culture/applyUser/signUp", formData).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
}
})
})
},
async onConfirmAgain() {
if (this.isCustomForm && this.fapi) {
let formValid = false
try {
await this.fapi.validate()
formValid = true
} catch (e) {
formValid = false
}
if (!formValid) return
}
//组队
if (this.viewData.signUpMethod === 2) {
//组队人数判断
if (this.teamUsers.length === 0) {
this.$dialog
.alert({
title: "提示",
message: "请添加队友后再提交!"
})
.then(() => {
})
return
}
if (this.teamUsers.length < this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "您选择的人数小于" + this.viewData.teamNum + "人,请重新选择!"
})
.then(() => {
})
return
}
if (this.teamUsers.length > this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "您选择的人数大于" + this.viewData.teamNum + "人,请重新选择!"
})
.then(() => {
})
return
}
}
//分工会
if (this.viewData.signUpMethod === 3) {
if (this.teamUsers.length === 0) {
this.$dialog
.alert({
title: "提示",
message: "请添加报名人员后再提交!"
})
.then(() => {
})
return
}
if (this.viewData.teamNum && this.teamUsers.length > this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "您选择的人数大于" + this.viewData.teamNum + "人,请重新选择!"
})
.then(() => {
})
return
}
}
let formData = {
activityId: this.id,
isAgain: true
}
if (this.isCustomForm) {
formData.ext = JSON.stringify(this.fapi.formData())
}
if (this.viewData.signUpMethod === 2 || this.viewData.signUpMethod === 3) {
formData.teamUserIds = JSON.stringify(this.teamUsers.map((v) => v.userId))
}
this.$dialog
.confirm({
title: "提示",
message: "确定重新提交报名信息吗?"
})
.then(() => {
this.$axios.post("/platform/activity/culture/applyUser/signUp", formData).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
}
})
})
},
//取消报名
onCancel() {
this.$dialog
.confirm({
title: "提示",
message: "确定取消报名吗?"
})
.then(() => {
this.$axios.post("/platform/activity/culture/applyUser/cancelSignUp", {activityId: this.id}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
this.fapi.resetFields()
}
})
})
},
//查询队友信息
queryTeammate(val) {
if (val) {
this.$axios.post("/platform/activity/culture/applyUser/queryTeammate", {
keyword: val,
tissueId: this.id,
signUpMethod: this.viewData.signUpMethod
}).then((res) => {
if (res.code === 0) {
res.data.map(v => {
v.applyUserId = this.$store.state.user.id
})
this.teammateOptions = res.data
}
})
}
},
//添加队友
addTeamUser() {
if (!this.searchTeammateUserId) {
this.$dialog
.alert({
title: "提示",
message: "请先选择后再添加!"
})
.then(() => {
})
return
}
if (this.teamUsers.some((v) => v.userId === this.searchTeammateUserId)) {
this.$dialog
.alert({
title: "提示",
message: "请勿重复添加!"
})
.then(() => {
})
return
}
if (this.viewData.teamNum && this.teamUsers.length >= this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
message: "已满员!"
})
.then(() => {
})
return
}
this.teamUsers.push(this.teammateOptions.find((v) => v.userId === this.searchTeammateUserId))
this.searchTeammateUserId = null
},
//移除队友
removeTeamUser(index) {
this.teamUsers.splice(index, 1)
},
checkScope(groupId) {
this.$axios.post('/platform/activity/basic/scope/getScopeUser', {
activityGroupId: Number(groupId)
}).then(res => {
if (res.data === 0) {
this.$dialog.alert({
title: '标题',
message: '您没有权限参加此活动',
confirmButtonText: "返回首页"
}).then(() => {
this.$pjaxReplace("/platform/home")
});
}
})
},
},
created() {
this.init()
}
})
</script>
<!--#
}
#-->