品牌活动

This commit is contained in:
Paidax
2025-05-27 17:29:48 +08:00
parent 4818e5bcfe
commit d2412c998c
6 changed files with 603 additions and 374 deletions
@@ -6,6 +6,7 @@ import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm; import io.v.nutz.base.query.PageForm;
import io.v.nutz.sys.models.Sys_dict; import io.v.nutz.sys.models.Sys_dict;
import io.v.nutz.sys.services.SysDictService; import io.v.nutz.sys.services.SysDictService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity; import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivity;
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivityCourse; import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpActivityCourse;
import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpType; import io.v.nutz.zhgh.trainSignUp.models.TrainSignUpType;
@@ -83,6 +84,7 @@ public class TrainSignUpActivityApplyController {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
tsuc.id, tsuc.id,
tsuc.assort,
tsuc.activityId, tsuc.activityId,
tsuc.courseName, tsuc.courseName,
tsuc.coursePeopleNumber, tsuc.coursePeopleNumber,
@@ -99,6 +101,7 @@ public class TrainSignUpActivityApplyController {
tsuc.isReceiveGift, tsuc.isReceiveGift,
tsuc.giftType, tsuc.giftType,
tsuc.reserveMode, tsuc.reserveMode,
tsuc.remarks,
type.lxname type.lxname
FROM FROM
`train_sign_up_course` tsuc `train_sign_up_course` tsuc
@@ -108,22 +111,27 @@ public class TrainSignUpActivityApplyController {
CndPlus cnd = CndPlus.create(); CndPlus cnd = CndPlus.create();
cnd.andEX("type.id","=",courseTypeId); cnd.andEX("type.id","=",courseTypeId);
cnd.and("tsuc.activityId","=",activityId); cnd.and("tsuc.activityId","=",activityId);
cnd.asc("type.code"); cnd.asc("tsuc.orderNum");
sql.setCondition(cnd); sql.setCondition(cnd);
Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql); Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> courseList = pagination.getList(); List<NutMap> courseList = pagination.getList();
List<TrainSignUpActivityCourse> activityCourseList = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activityId));
Map<String, List<TrainSignUpActivityCourse>> map = activityCourseList.stream().collect(Collectors.groupingBy(TrainSignUpActivityCourse::getCourseId));
courseList.forEach(c -> { courseList.forEach(c -> {
List<TrainSignUpActivityCourse> list = map.get(c.getString("id"));
c.put("courseList", list);
TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, c.getString("courseType")); TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, c.getString("courseType"));
// trainSignUpActivityService.dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime")); // trainSignUpActivityService.dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
//已报人数 //已报人数
AtomicInteger hasRegisterNum = new AtomicInteger(); AtomicInteger hasRegisterNum = new AtomicInteger();
List<TrainSignUpUser> signUpUsers = trainSignUpActivityService.dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getString("id"))); List<TrainSignUpUser> signUpUsers = trainSignUpActivityService.dao().query(TrainSignUpUser.class, Cnd.where("courseId", "=", c.getString("id")));
signUpUsers.forEach(item -> { signUpUsers.forEach(item -> {
if(type.getSelfAddFamily()) { hasRegisterNum.getAndIncrement();
hasRegisterNum.getAndIncrement();
}
if(type.getIsBringFamily() && type.getIsAddFamily()) { if(type.getIsBringFamily() && type.getIsAddFamily()) {
List<NutMap> mapList = item.getMobileColumnsValue(); List<NutMap> mapList = item.getMobileColumnsValue();
if(Lang.isNotEmpty(mapList)) { if(Lang.isNotEmpty(mapList)) {
@@ -136,7 +144,7 @@ public class TrainSignUpActivityApplyController {
}); });
c.put("hasRegisterNum",hasRegisterNum.get()); c.put("hasRegisterNum",hasRegisterNum.get());
//当前用户是否报过 //当前用户是否报过
c.put("isSign",trainSignUpActivityService.isSignCourseByUser(c.getString("id"), (String) io.v.nutz.web.commons.utils.ShiroUtil.getPrincipalProperty("id"))); c.put("isSign",trainSignUpActivityService.isSignCourseByUser(c.getString("id"), (String) ShiroUtil.getPrincipalProperty("id")));
}); });
return pagination; return pagination;
} }
@@ -98,7 +98,7 @@ public class MTrainSignUpActivityController {
@Ok("json:full") @Ok("json:full")
@POST @POST
@RequiresAuthentication @RequiresAuthentication
public Object doSignUp(TrainSignUpUser trainSignUpUser) { public synchronized Object doSignUp(TrainSignUpUser trainSignUpUser) {
try { try {
lock.lock(); lock.lock();
boolean courseByUser = trainSignUpActivityService.isSignCourseByUser(trainSignUpUser.getCourseId(), ShiroUtil.getPlatformUid()); boolean courseByUser = trainSignUpActivityService.isSignCourseByUser(trainSignUpUser.getCourseId(), ShiroUtil.getPlatformUid());
@@ -216,7 +216,7 @@ public class MTrainSignUpActivityController {
@POST @POST
@ViReturn @ViReturn
@RequiresAuthentication @RequiresAuthentication
public Object validateSignUp(String courseId, public synchronized Object validateSignUp(String courseId,
@Param(value = "cndId", required = false) String cndId, @Param(value = "cndId", required = false) String cndId,
@Param(value = "currentFamilyNumber", required = false) Integer currentFamilyNumber) { @Param(value = "currentFamilyNumber", required = false) Integer currentFamilyNumber) {
try { try {
@@ -137,4 +137,11 @@ public class TrainSignUpCourse extends BaseModel implements Serializable {
@Comment("分类标识") @Comment("分类标识")
@ColDefine(type = ColType.VARCHAR, width = 30) @ColDefine(type = ColType.VARCHAR, width = 30)
private String assort; private String assort;
@Column
@Comment("详细内容备注")
@ColDefine(type = ColType.TEXT)
private String remarks;
private String courseTimeName;
} }
@@ -125,7 +125,7 @@ layout("/mobile/platform.html"){
} }
.van-card-body { .van-card-body {
padding: 0px 10px 0px 10px padding: 0px 10px 0px 10px;
} }
.van-doc-card-two { .van-doc-card-two {
@@ -136,7 +136,6 @@ layout("/mobile/platform.html"){
font-size: 12px; font-size: 12px;
} }
.footer .van-button { .footer .van-button {
border-radius: 6px; border-radius: 6px;
} }
@@ -152,27 +151,32 @@ layout("/mobile/platform.html"){
.van-tabs__nav--complete { .van-tabs__nav--complete {
padding: 0; padding: 0;
} }
</style> </style>
<div id="app" v-cloak> <div id="app" v-cloak>
<van-sticky> <van-sticky>
<van-nav-bar :title="trainType + '列表'" left-arrow <van-nav-bar
@click-left="location.replace('/platform/mobile/trainSignUpActivity/trainList?type=' + type)"></van-nav-bar> :title="trainType + '列表'"
left-arrow
@click-left="location.replace('/platform/mobile/trainSignUpActivity/trainList?type=' + type)"
></van-nav-bar>
</van-sticky> </van-sticky>
<van-sticky> <van-sticky>
<van-dropdown-menu active-color="#1867b0"> <van-dropdown-menu active-color="#1867b0">
<van-dropdown-item @change="tabChange" v-model="activityStatus" <van-dropdown-item @change="tabChange" v-model="activityStatus" :options="activityOptions"></van-dropdown-item>
:options="activityOptions"></van-dropdown-item>
<van-dropdown-item @change="courseChange" v-model="courseType" :options="courseOptions"></van-dropdown-item> <van-dropdown-item @change="courseChange" v-model="courseType" :options="courseOptions"></van-dropdown-item>
</van-dropdown-menu> </van-dropdown-menu>
</van-sticky> </van-sticky>
<van-tabs v-if="activityStatus != '1' && assortList.length > 0" v-model="assort" type="card" color="#1867B0" <van-tabs
style="margin-top: 10px" @click="tabClick"> v-if="activityStatus != '1' && assortList.length > 0"
<van-tab v-for="item in assortList" :name="item" :title="item"> v-model="assort"
type="card"
</van-tab> color="#1867B0"
style="margin-top: 10px"
@click="tabClick"
>
<van-tab v-for="item in assortList" :name="item" :title="item"></van-tab>
</van-tabs> </van-tabs>
<!--<van-notice-bar <!--<van-notice-bar
@@ -182,14 +186,10 @@ layout("/mobile/platform.html"){
<template> <template>
<div id="parentDiv" v-model="loading" v-if="tableData.courseList && tableData.courseList.length>0"> <div id="parentDiv" v-model="loading" v-if="tableData.courseList && tableData.courseList.length>0">
<template v-for="o in tableData.courseList"> <template v-for="o in tableData.courseList">
<div style="position: relative" <div style="position: relative" :class="activityStatus !== '1' ? 'van-doc-card' : 'van-doc-card-my'">
:class="activityStatus !== '1' ? 'van-doc-card' : 'van-doc-card-my'">
<div> <div>
<van-tag type="primary" size="medium"> <van-tag type="primary" size="medium">{{getCourseTypeName(o)}}</van-tag>
{{getCourseTypeName(o)}}
</van-tag>
<span style="font-weight: bold; font-size: 14px"> <span style="font-weight: bold; font-size: 14px">
{{o.courseName}} {{o.courseName}}
<span v-if="activityStatus !== '1'"> <span v-if="activityStatus !== '1'">
@@ -211,39 +211,68 @@ layout("/mobile/platform.html"){
</div> </div>
<div> <div>
<span class="train-title">活动时间:</span> <span class="train-title">活动时间:</span>
<span v-if="o.courseTimeList && o.courseTimeList.length > 1" @click="trainClick(o)" <span v-if="o.courseTimeList && o.courseTimeList.length > 1" @click="trainClick(o)" style="color: #1867b0">点我查看</span>
style="color: #1867b0">点我查看</span> <span @click="trainClick(o)" v-if="o.courseTimeList && o.courseTimeList.length === 1" style="color: #1867b0">
<span @click="trainClick(o)" v-if="o.courseTimeList && o.courseTimeList.length === 1"
style="color: #1867b0">
{{o.courseTimeList[0].courseStartTime.substring(11, 19) + ' ~ ' + o.courseTimeList[0].courseEndTime.substring(11, 19)}} {{o.courseTimeList[0].courseStartTime.substring(11, 19) + ' ~ ' + o.courseTimeList[0].courseEndTime.substring(11, 19)}}
</span> </span>
</div> </div>
<div> <div>
<span @click.stop="showPic(FILE_DOMAIN + '/fileStreamPreview?id=' + tableData.wechat.id)" <span
v-if="o.isSign === true && tableData.wechat" @click.stop="showPic(FILE_DOMAIN + '/fileStreamPreview?id=' + tableData.wechat.id)"
style="color: #dd6363">点我查看微信群二维码</span> v-if="o.isSign === true && tableData.wechat"
style="color: #dd6363"
>
点我查看微信群二维码
</span>
</div> </div>
<van-button type="primary" color="#1867b0" round size="mini" <van-button
v-if="activityStatus !== '1' && o.isSign === false" type="primary"
style="position: absolute; left: 74%; bottom: 10%; width: 74px; height: 28px" color="#1867b0"
@click.stop="signUp(o)"> round
size="mini"
v-if="activityStatus !== '1' && o.isSign === false"
style="position: absolute; left: 74%; bottom: 10%; width: 74px; height: 28px"
@click.stop="signUp(o)"
>
我要报名 我要报名
</van-button> </van-button>
<van-button type="primary" color="#dd6363" round size="mini" <van-button
v-if="o.isSign === true && moment().valueOf() < moment(activity.activitySignUpEndTime).valueOf()" type="primary"
style="position: absolute; left: 74%; bottom: 10%; width: 74px; height: 28px" color="#dd6363"
@click.stop="cancel(o)"> round
size="mini"
v-if="o.isSign === true && moment().valueOf() < moment(activity.activitySignUpEndTime).valueOf()"
style="position: absolute; left: 74%; bottom: 10%; width: 74px; height: 28px"
@click.stop="cancel(o)"
>
取消报名 取消报名
</van-button> </van-button>
<image v-if="activityStatus !== '1' && o.isSign === true && moment().valueOf() >= moment(activity.activitySignUpEndTime).valueOf()" <image
style="position: absolute; left: 77%; top: 58%;" v-if="activityStatus !== '1' && o.isSign === true && moment().valueOf() >= moment(activity.activitySignUpEndTime).valueOf()"
src="/assets/mobile/svg/train/sign_up.svg"></image> style="position: absolute; left: 77%; top: 58%"
src="/assets/mobile/svg/train/sign_up.svg"
></image>
<div @click="trainClick(o)" v-if="activityStatus === '1' && o.isMobileSign" <div
style="text-align: center; line-height: 40px; width: 40px; height: 40px;display: inline-block; font-size: 14px; @click="trainClick(o)"
position: absolute; right: -10px; top: 8%; background-color: #00c698; border-radius: 7px; color: white"> v-if="activityStatus === '1' && o.isMobileSign"
style="
text-align: center;
line-height: 40px;
width: 40px;
height: 40px;
display: inline-block;
font-size: 14px;
position: absolute;
right: -10px;
top: 8%;
background-color: #00c698;
border-radius: 7px;
color: white;
"
>
签到 签到
</div> </div>
</div> </div>
@@ -256,47 +285,66 @@ layout("/mobile/platform.html"){
<!--<div @click="vant.Dialog.alert({message: '上课前30分钟,下课前30分钟。',theme: 'round-button',confirmButtonColor: '#1867b0'})" <!--<div @click="vant.Dialog.alert({message: '上课前30分钟,下课前30分钟。',theme: 'round-button',confirmButtonColor: '#1867b0'})"
style="font-size: 12px; color: grey; text-align: right; position: relative; top: 8px; right: 6px; z-index: 2;">签到规则 ></div>--> style="font-size: 12px; color: grey; text-align: right; position: relative; top: 8px; right: 6px; z-index: 2;">签到规则 ></div>-->
<div id="map" v-if="course.isMobileSign === true && course.signType === 3" <div id="map" v-if="course.isMobileSign === true && course.signType === 3" style="width: 100%; height: 250px"></div>
style="width: 100%; height: 250px"></div>
<van-card <van-card
:title="item.courseStartTime.substring(0, 10) + '(' + :title="item.courseStartTime.substring(0, 10) + '(' +
getWeek(item.courseStartTime.substring(0, 10)) + ')'" v-for="(item,index) in qdArray" getWeek(item.courseStartTime.substring(0, 10)) + ')'"
thumb="/assets/mobile/svg/train/qd1.svg"> v-for="(item,index) in qdArray"
thumb="/assets/mobile/svg/train/qd1.svg"
>
<template #desc> <template #desc>
<div style="margin-top: 7px"> <div style="margin-top: 7px">{{item.courseStartTime.substring(11, 19) + ' ~ ' + item.courseEndTime.substring(11, 19)}}</div>
{{item.courseStartTime.substring(11, 19) + ' ~ ' + item.courseEndTime.substring(11, 19)}}
</div>
<div v-if="item.courseLocationCoordinates && item.isMobileSign === true && activityStatus === '1'"> <div v-if="item.courseLocationCoordinates && item.isMobileSign === true && activityStatus === '1'">
<van-button type="primary" color="#1867b0" round size="mini" @click.stop="showQRCode(item, 2)" <van-button
v-if="(item.isAttend === true && course.giftType === 1 && item.state === 1) type="primary"
color="#1867b0"
round
size="mini"
@click.stop="showQRCode(item, 2)"
v-if="(item.isAttend === true && course.giftType === 1 && item.state === 1)
|| (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === true && course.giftType === 1)" || (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === true && course.giftType === 1)"
style="position: absolute; right: 65px; top: 25%; width: 60px; height: 25px"> style="position: absolute; right: 65px; top: 25%; width: 60px; height: 25px"
>
礼品码 礼品码
</van-button> </van-button>
<van-button type="primary" color="#e1e1e1" round size="mini" <van-button
v-if="(item.isAttend === false && findTime(item) === false && item.state === 1) type="primary"
color="#e1e1e1"
round
size="mini"
v-if="(item.isAttend === false && findTime(item) === false && item.state === 1)
|| (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === false)" || (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === false)"
style="position: absolute; right: 0; top: 25%; width: 60px; height: 25px"> style="position: absolute; right: 0; top: 25%; width: 60px; height: 25px"
>
未签到 未签到
</van-button> </van-button>
<van-button type="primary" color="#1867b0" round size="mini" <van-button
v-if="(item.isAttend === false && findTime(item) === true && item.state === 1) type="primary"
color="#1867b0"
round
size="mini"
v-if="(item.isAttend === false && findTime(item) === true && item.state === 1)
|| (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === false)" || (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === false)"
style="position: absolute; right: 0; top: 25%; width: 60px; height: 25px" style="position: absolute; right: 0; top: 25%; width: 60px; height: 25px"
@click.stop="signIn(item)"> @click.stop="signIn(item)"
>
签 到 签 到
</van-button> </van-button>
<van-button type="primary" color="#61ce98" round size="mini" <van-button
v-if="(item.isAttend === true && item.state === 1) type="primary"
color="#61ce98"
round
size="mini"
v-if="(item.isAttend === true && item.state === 1)
|| (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === true)" || (moment().unix() > moment(item.courseEndTime).unix() && item.state === 3 && item.isAttend === true)"
style="position: absolute; right: 0; top: 25%; width: 60px; height: 25px"> style="position: absolute; right: 0; top: 25%; width: 60px; height: 25px"
>
已签到 已签到
</van-button> </van-button>
</div> </div>
</template> </template>
</van-card> </van-card>
</van-popup> </van-popup>
<van-popup class="joinPopup" position="right" v-model:show="joinPopup"> <van-popup class="joinPopup" position="right" v-model:show="joinPopup">
@@ -305,17 +353,20 @@ layout("/mobile/platform.html"){
<van-form @submit="joinSubmit" :show-error-message="false"> <van-form @submit="joinSubmit" :show-error-message="false">
<div class="van-doc-card-two" style="margin-bottom: 16px"> <div class="van-doc-card-two" style="margin-bottom: 16px">
<div></div> <div></div>
<div class="van-card-header"> <div class="van-card-header">基础信息</div>
基础信息
</div>
<div class="van-card-body"> <div class="van-card-body">
<van-field label="姓名" readonly v-model="formData.userName"></van-field> <van-field label="姓名" readonly v-model="formData.userName"></van-field>
<van-field label="工号" readonly v-model="formData.loginName"></van-field> <van-field label="工号" readonly v-model="formData.loginName"></van-field>
<van-field label="所在单位" readonly v-model="formData.unitName"></van-field> <van-field label="所在单位" readonly v-model="formData.unitName"></van-field>
<van-field label="所属工会" readonly v-model="formData.unionName"></van-field> <van-field label="所属工会" readonly v-model="formData.unionName"></van-field>
<van-field label="性别" readonly v-model="formData.sex"></van-field> <van-field label="性别" readonly v-model="formData.sex"></van-field>
<van-field label="联系方式" required :rules="[{ required: true, message: '请填写联系方式' }]" <van-field
placeholder="请填写联系方式" v-model="formData.mobile"></van-field> label="联系方式"
required
:rules="[{ required: true, message: '请填写联系方式' }]"
placeholder="请填写联系方式"
v-model="formData.mobile"
></van-field>
<train-dynamic-form v-model="dynamicColumnsData" ref="trainDynamicForm"></train-dynamic-form> <train-dynamic-form v-model="dynamicColumnsData" ref="trainDynamicForm"></train-dynamic-form>
</div> </div>
</div> </div>
@@ -328,75 +379,85 @@ layout("/mobile/platform.html"){
</div> </div>
<script> <script>
let pointArray = [] let pointArray = []
let locations = null let locations = null
let map = null let map = null
let geolocation = null let geolocation = null
const vue = new Vue({ const vue = new Vue({
el: '#app', el: "#app",
mixins: [mobileMixins], mixins: [mobileMixins],
data() { data() {
return { return {
assort: '', assort: "",
assortList: [], assortList: [],
allColumnsData: [], allColumnsData: [],
dynamicColumnsData: [], dynamicColumnsData: [],
trainType: '培训班', trainType: "培训班",
trainTypeList: [], trainTypeList: [],
actionShow: false, actionShow: false,
timeList: [], timeList: [],
activityId: '', activityId: "",
activityStatus: '0', activityStatus: "0",
joinPopup: false, joinPopup: false,
popupShow: false, popupShow: false,
courseText: '', courseText: "",
qdInfoList: [], qdInfoList: [],
course: [], course: [],
qdArray: [], qdArray: [],
activityOptions: [{text: '全部', value: '0'}, {text: '我报名的', value: '1'}], activityOptions: [
{ text: "全部", value: "0" },
{ text: "我报名的", value: "1" }
],
courseOptions: [], courseOptions: [],
courseType: '0', courseType: "0",
tempArray: [], tempArray: [],
activitySignUpStartTime: null, activitySignUpStartTime: null,
choose: {}, choose: {},
activity: '', activity: ""
} }
}, },
components: { components: {
'train-dynamic-form': httpVueLoader('/components/mobile/common/TrainDynamicForm.vue') "train-dynamic-form": httpVueLoader("/components/mobile/common/TrainDynamicForm.vue")
}, },
methods: { methods: {
tabClick(name, title) { tabClick(name, title) {
if(this.courseType === '0' && this.activityStatus !== '1') { if (this.courseType === "0" && this.activityStatus !== "1") {
this.tableData.courseList = this.tempArray.courseList.filter(o => o.assort === title) this.tableData.courseList = this.tempArray.courseList.filter((o) => o.assort === title)
} else { } else {
this.tableData.courseList = this.tempArray.courseList.filter(o => o.assort === title && o.courseType === this.courseType) this.tableData.courseList = this.tempArray.courseList.filter((o) => o.assort === title && o.courseType === this.courseType)
} }
}, },
calcSignUpCount(o) { calcSignUpCount(o) {
if(o.reserveMode === 2) { if (o.reserveMode === 2) {
let lave = 0 let lave = 0
let lave2 = 0 let lave2 = 0
if(o.hasRegisterNum < o.coursePeopleNumber) { if (o.hasRegisterNum < o.coursePeopleNumber) {
lave = o.coursePeopleNumber - o.hasRegisterNum lave = o.coursePeopleNumber - o.hasRegisterNum
lave2 = o.courseReservedNumber lave2 = o.courseReservedNumber
} else { } else {
lave = 0 lave = 0
lave2 = (o.coursePeopleNumber + o.courseReservedNumber) - o.hasRegisterNum lave2 = o.coursePeopleNumber + o.courseReservedNumber - o.hasRegisterNum
} }
let str = "(<span style='color: red'>余" + lave +"</span>/" + o.coursePeopleNumber + "人" let str =
+ ",<span style='color: red'>候补余" + lave2 + "</span>/" + o.courseReservedNumber + "人)" "(<span style='color: red'>余" +
lave +
"</span>/" +
o.coursePeopleNumber +
"人" +
",<span style='color: red'>候补余" +
lave2 +
"</span>/" +
o.courseReservedNumber +
"人)"
return str return str
} else { } else {
let lave = o.coursePeopleNumber - (o.hasRegisterNum + o.courseReservedNumber) let lave = o.coursePeopleNumber - (o.hasRegisterNum + o.courseReservedNumber)
return "(<span style='color: red'>余" + lave +"</span>/" + o.coursePeopleNumber + "人)" return "(<span style='color: red'>余" + lave + "</span>/" + o.coursePeopleNumber + "人)"
} }
}, },
getCourseTypeName(o) { getCourseTypeName(o) {
const b = this.courseOptions.find(item => item.value === o.courseType) const b = this.courseOptions.find((item) => item.value === o.courseType)
return b ? b.text : '' return b ? b.text : ""
}, },
//二维码 //二维码
showQRCode(item, type) { showQRCode(item, type) {
@@ -409,7 +470,7 @@ layout("/mobile/platform.html"){
signType: item.signType, signType: item.signType,
isReceiveGift: item.isReceiveGift, isReceiveGift: item.isReceiveGift,
giftType: item.giftType, giftType: item.giftType,
type: type, type: type
} }
// 生成二维码的 base64 编码 // 生成二维码的 base64 编码
const content = jrQrcode.getQrBase64(JSON.stringify(o)) const content = jrQrcode.getQrBase64(JSON.stringify(o))
@@ -419,12 +480,12 @@ layout("/mobile/platform.html"){
vant.ImagePreview([url]) vant.ImagePreview([url])
}, },
findTime(o) { findTime(o) {
const today = moment().format('YYYY-MM-DD') const today = moment().format("YYYY-MM-DD")
return o.courseStartTime.substr(0, 10) === today return o.courseStartTime.substr(0, 10) === today
}, },
findQd() { findQd() {
const today = moment().format('YYYY-MM-DD') const today = moment().format("YYYY-MM-DD")
const day = this.qdInfoList.find(item => { const day = this.qdInfoList.find((item) => {
return item.courseStartTime.substr(0, 10) === today return item.courseStartTime.substr(0, 10) === today
}) })
if (day === undefined) { if (day === undefined) {
@@ -435,28 +496,31 @@ layout("/mobile/platform.html"){
}, },
async signIn(o) { async signIn(o) {
if (o.signType === 1) { if (o.signType === 1) {
vant.Dialog.alert({message: '功能马上推出,敬请期待!'}) vant.Dialog.alert({ message: "功能马上推出,敬请期待!" })
return return
//调相机扫一扫 //调相机扫一扫
wxScannerQrCode.scanner().then(async res => { wxScannerQrCode
if (res) { .scanner()
const course = JSON.parse(res) .then(async (res) => {
const resp = await $.post('/platform/mobile/trainSignUpActivity/codeSign', { if (res) {
codeCourseId: course.courseId, const course = JSON.parse(res)
clickCourseId: o.courseId, const resp = await $.post("/platform/mobile/trainSignUpActivity/codeSign", {
id: o.id, codeCourseId: course.courseId,
}) clickCourseId: o.courseId,
if(resp.code === 0) { id: o.id
vant.Dialog.alert({message: '签到成功'}) })
await this.pageData() if (resp.code === 0) {
o.isAttend = true vant.Dialog.alert({ message: "签到成功" })
} else { await this.pageData()
vant.Dialog.alert({message: resp.msg}) o.isAttend = true
} else {
vant.Dialog.alert({ message: resp.msg })
}
} }
} })
}).catch(err => { .catch((err) => {
vant.Dialog.alert({message: err}) vant.Dialog.alert({ message: err })
}) })
} }
if (o.signType === 2) { if (o.signType === 2) {
this.showQRCode(o, 1) this.showQRCode(o, 1)
@@ -464,8 +528,8 @@ layout("/mobile/platform.html"){
if (o.signType === 3) { if (o.signType === 3) {
//获取当前时间,年月日 //获取当前时间,年月日
const date = new Date() const date = new Date()
const today = moment().format('YYYY-MM-DD') const today = moment().format("YYYY-MM-DD")
const time = moment().format('YYYY-MM-DD hh:mm:ss') const time = moment().format("YYYY-MM-DD hh:mm:ss")
const start = new Date(o.courseStartTime).getTime() - 1000 * 60 * 30 const start = new Date(o.courseStartTime).getTime() - 1000 * 60 * 30
//const end = new Date(o.courseStartTime).getTime() + 1000 * 60 * 30 //const end = new Date(o.courseStartTime).getTime() + 1000 * 60 * 30
@@ -473,12 +537,12 @@ layout("/mobile/platform.html"){
const now = new Date().getTime() const now = new Date().getTime()
if (now < start || now > end) { if (now < start || now > end) {
vant.Toast('请在规定时间签到') vant.Toast("请在规定时间签到")
return return
} }
const that = this const that = this
geolocation.getCurrentPosition(async function (status, result) { geolocation.getCurrentPosition(async function (status, result) {
if (status === 'complete') { if (status === "complete") {
locations = [result.position.getLng(), result.position.getLat()] locations = [result.position.getLng(), result.position.getLat()]
//用户当前位置 //用户当前位置
const userPoint = new AMap.LngLat(result.position.getLng(), result.position.getLat()) const userPoint = new AMap.LngLat(result.position.getLng(), result.position.getLat())
@@ -486,14 +550,14 @@ layout("/mobile/platform.html"){
const coursePoint = new AMap.LngLat(that.course.courseLocationCoordinates[0], that.course.courseLocationCoordinates[1]) const coursePoint = new AMap.LngLat(that.course.courseLocationCoordinates[0], that.course.courseLocationCoordinates[1])
const distance = Math.round(userPoint.distance(coursePoint)) const distance = Math.round(userPoint.distance(coursePoint))
if (distance > 250) { if (distance > 250) {
vant.Toast('请在250米内签到') vant.Toast("请在250米内签到")
return return
} }
const array = [result.position.getLng(), result.position.getLat()] const array = [result.position.getLng(), result.position.getLat()]
const resp = await $.post('/platform/mobile/trainSignUpActivity/doQd', { const resp = await $.post("/platform/mobile/trainSignUpActivity/doQd", {
id: o.id, id: o.id,
courseId: that.course.id, courseId: that.course.id,
point: JSON.stringify(array), point: JSON.stringify(array)
}) })
if (resp.code === 0) { if (resp.code === 0) {
await that.pageData() await that.pageData()
@@ -502,7 +566,7 @@ layout("/mobile/platform.html"){
that.popupShow = false that.popupShow = false
} else { } else {
} }
}); })
} }
}, },
//获取当前坐标点 //获取当前坐标点
@@ -517,45 +581,46 @@ layout("/mobile/platform.html"){
reject([]) reject([])
}) })
})*/ })*/
geolocation.getCurrentPosition(function(status,result){ geolocation.getCurrentPosition(function (status, result) {
if(status === 'complete'){ if (status === "complete") {
//alert(result.position) //alert(result.position)
locations = result.position locations = result.position
}else{ } else {
} }
}); })
}, },
cancel(o) { cancel(o) {
vant.Dialog.confirm({ vant.Dialog.confirm({
title: '温馨提示', title: "温馨提示",
message: "您确定要<span style='color: red'>取消【" + o.courseName + "】</span>吗?\n一旦确认,可不能反悔了哟!", message: "您确定要<span style='color: red'>取消【" + o.courseName + "】</span>吗?\n一旦确认,可不能反悔了哟!",
confirmButtonColor: '#1867b0', confirmButtonColor: "#1867b0"
}).then(async () => { })
const resp = await $.post('/platform/mobile/trainSignUpActivity/cancelSignUp', { .then(async () => {
activityId: o.activityId, const resp = await $.post("/platform/mobile/trainSignUpActivity/cancelSignUp", {
courseId: o.id activityId: o.activityId,
courseId: o.id
})
vant.Toast(resp.msg)
if (resp.code === 0) {
this.pageData()
}
}) })
vant.Toast(resp.msg) .catch(() => {})
if (resp.code === 0) {
this.pageData()
}
}).catch(() => {
});
}, },
async signUp(o) { async signUp(o) {
this.choose = o this.choose = o
const res = await $.post('/platform/mobile/trainSignUpActivity/validateSignUp', { const res = await $.post("/platform/mobile/trainSignUpActivity/validateSignUp", {
cndId: o.conditionStructureId, cndId: o.conditionStructureId,
courseId: o.id, courseId: o.id
}) })
if(res.code !== 0) { if (res.code !== 0) {
vant.Dialog.alert({ vant.Dialog.alert({
title: '提示', title: "提示",
message: res.msg, message: res.msg,
confirmButtonColor: '#1867b0' confirmButtonColor: "#1867b0"
}) })
if(res.code !== 3) { if (res.code !== 3) {
return return
} }
} }
@@ -567,15 +632,15 @@ layout("/mobile/platform.html"){
sex: "${@shiro.getPrincipalProperty('sex')}", sex: "${@shiro.getPrincipalProperty('sex')}",
birthday: "${@shiro.getPrincipalProperty('birthday')}", birthday: "${@shiro.getPrincipalProperty('birthday')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}", unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
unitName: "${@shiro.getPrincipalProperty('unit').getName()}", unitName: "${@shiro.getPrincipalProperty('unit').getName()}"
} }
this.$set(this.formData, "activityId", o.activityId) this.$set(this.formData, "activityId", o.activityId)
this.$set(this.formData, "courseId", o.id) this.$set(this.formData, "courseId", o.id)
const column = this.allColumnsData.find(x => x.id === o.courseType) const column = this.allColumnsData.find((x) => x.id === o.courseType)
this.dynamicColumnsData = column ? column.trainMobileSignColumnList : [] this.dynamicColumnsData = column ? column.trainMobileSignColumnList : []
this.dynamicColumnsData.forEach(item => { this.dynamicColumnsData.forEach((item) => {
item.columnValue = '' item.columnValue = ""
}) })
this.joinPopup = true this.joinPopup = true
}, },
@@ -590,61 +655,65 @@ layout("/mobile/platform.html"){
if (!valid) return if (!valid) return
//获取家属是多少人 //获取家属是多少人
let per = 0 let per = 0
this.dynamicColumnsData.forEach(item => { this.dynamicColumnsData.forEach((item) => {
if(item.columnCode === 'xdqsrs') { if (item.columnCode === "xdqsrs") {
per += Number(item.columnValue) per += Number(item.columnValue)
} }
}) })
const res = await $.post('/platform/mobile/trainSignUpActivity/validateSignUp', { const res = await $.post("/platform/mobile/trainSignUpActivity/validateSignUp", {
cndId: this.choose.conditionStructureId, cndId: this.choose.conditionStructureId,
courseId: this.choose.id, courseId: this.choose.id,
currentFamilyNumber: per, currentFamilyNumber: per
}) })
if(res.code !== 0) { if (res.code !== 0) {
vant.Dialog.alert({ vant.Dialog.alert({
title: '提示', title: "提示",
message: res.msg, message: res.msg,
confirmButtonColor: '#1867b0' confirmButtonColor: "#1867b0"
}) })
return return
} }
vant.Dialog.confirm({ vant.Dialog.confirm({
title: '温馨提示', title: "温馨提示",
message: '您选择了【' + this.choose.courseName + '】\n一旦确认,可不能反悔了哟', message: "您选择了【" + this.choose.courseName + "】\n一旦确认,可不能反悔了哟",
confirmButtonColor: '#1867b0', confirmButtonColor: "#1867b0"
}).then(async () => { })
const toast = vant.Toast.loading({ .then(async () => {
duration: 0, const toast = vant.Toast.loading({
forbidClick: true, duration: 0,
overlay: true, forbidClick: true,
message: '努力提交中', overlay: true,
}) message: "努力提交中"
const mobileColumnsValue = this.dynamicColumnsData.map(v => { })
return { const mobileColumnsValue = this.dynamicColumnsData.map((v) => {
columnName: v.columnName, return {
columnValue: v.columnValue, columnName: v.columnName,
columnCode: v.columnCode, columnValue: v.columnValue,
columnFormType: v.columnFormType columnCode: v.columnCode,
columnFormType: v.columnFormType
}
})
this.formData.mobileColumnsValue = JSON.stringify(mobileColumnsValue)
const resp = await $.post("/platform/mobile/trainSignUpActivity/doSignUp", this.formData)
vant.Toast(resp.msg)
if (resp.code === 0) {
await this.pageData()
this.joinPopup = false
} }
toast.clear()
}) })
this.formData.mobileColumnsValue = JSON.stringify(mobileColumnsValue) .catch(() => {})
const resp = await $.post('/platform/mobile/trainSignUpActivity/doSignUp', this.formData)
vant.Toast(resp.msg)
if (resp.code === 0) {
await this.pageData()
this.joinPopup = false
}
toast.clear()
}).catch(() => {
});
}, },
trainClick(o) { trainClick(o) {
this.timeList = o.courseTimeList this.timeList = o.courseTimeList
this.course = o this.course = o
this.qdArray = this.activityStatus === '0' ? o.courseTimeList : this.qdInfoList.filter(item => { this.qdArray =
return item.courseId === o.id this.activityStatus === "0"
}) ? o.courseTimeList
: this.qdInfoList.filter((item) => {
return item.courseId === o.id
})
if (o.signType === 3) { if (o.signType === 3) {
this.initMap(o) this.initMap(o)
} }
@@ -656,14 +725,14 @@ layout("/mobile/platform.html"){
} }
this.$nextTick(async () => { this.$nextTick(async () => {
// 地图初始化应该在地图容器div已经添加到DOM树之后 // 地图初始化应该在地图容器div已经添加到DOM树之后
map = new AMap.Map('map', { map = new AMap.Map("map", {
zoom: 12, zoom: 12,
center: o.courseLocationCoordinates, center: o.courseLocationCoordinates,
resizeEnable: true, resizeEnable: true,
scrollWheel: true, scrollWheel: true
}) })
AMap.plugin('AMap.Geolocation', function() { AMap.plugin("AMap.Geolocation", function () {
geolocation = new AMap.Geolocation({ geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认:true // 是否使用高精度定位,默认:true
enableHighAccuracy: true, enableHighAccuracy: true,
@@ -674,73 +743,73 @@ layout("/mobile/platform.html"){
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
//zoomToAccuracy: true, //zoomToAccuracy: true,
// 定位按钮的排放位置, RB表示右下 // 定位按钮的排放位置, RB表示右下
buttonPosition: 'RB', buttonPosition: "RB",
showCircle: false, showCircle: false
//showButton: false, //showButton: false,
}) })
map.addControl(geolocation); map.addControl(geolocation)
}) })
// 创建一个 Marker 实例: // 创建一个 Marker 实例:
var marker = new AMap.Marker({ var marker = new AMap.Marker({
position: new AMap.LngLat(o.courseLocationCoordinates[0], o.courseLocationCoordinates[1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9] position: new AMap.LngLat(o.courseLocationCoordinates[0], o.courseLocationCoordinates[1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title: '签到点' title: "签到点"
}); })
//获取当前坐标点 //获取当前坐标点
await this.getPoint() await this.getPoint()
var circle = new AMap.Circle({ var circle = new AMap.Circle({
center: new AMap.LngLat(o.courseLocationCoordinates[0], o.courseLocationCoordinates[1]), // 圆心位置 center: new AMap.LngLat(o.courseLocationCoordinates[0], o.courseLocationCoordinates[1]), // 圆心位置
radius: 250, // 圆半径 radius: 250, // 圆半径
borderWeight: 1, borderWeight: 1,
strokeOpacity: 1, strokeOpacity: 1,
fillOpacity: 0.4, fillOpacity: 0.4
}); })
map.add(circle); map.add(circle)
// 缩放地图到合适的视野级别 // 缩放地图到合适的视野级别
map.setFitView([circle]) map.setFitView([circle])
// 多个点实例组成的数组 // 多个点实例组成的数组
var markerList = [marker]; var markerList = [marker]
map.add(markerList); map.add(markerList)
}) })
}, },
async pageData() { async pageData() {
const resp = await $.get('/platform/mobile/trainSignUpActivity/findOne', { const resp = await $.get("/platform/mobile/trainSignUpActivity/findOne", {
id: this.activityId, id: this.activityId,
tabIndex: this.activityStatus tabIndex: this.activityStatus
}) })
if (resp.code === 0) { if (resp.code === 0) {
this.tableData = resp.data this.tableData = resp.data
this.assortList = Array.from(new Set(this.tableData.courseList.map(o => o.assort).filter(o => o !== '' && o !== undefined))) this.assortList = Array.from(new Set(this.tableData.courseList.map((o) => o.assort).filter((o) => o !== "" && o !== undefined)))
this.tempArray = clone(this.tableData) this.tempArray = clone(this.tableData)
if(this.assortList.length > 0 && this.activityStatus !== '1') { if (this.assortList.length > 0 && this.activityStatus !== "1") {
this.tableData.courseList = this.tableData.courseList.filter(o => o.assort === this.assortList[0]) this.tableData.courseList = this.tableData.courseList.filter((o) => o.assort === this.assortList[0])
} }
const type = this.trainTypeList.find(o => o.code === this.tableData.trainType) const type = this.trainTypeList.find((o) => o.code === this.tableData.trainType)
this.trainType = type ? type.name : '培训班' this.trainType = type ? type.name : "培训班"
} else { } else {
this.tableData = [] this.tableData = []
this.loading = false this.loading = false
} }
await this.getQdInfoList() await this.getQdInfoList()
this.courseChange(this.courseType, 1) this.courseChange(this.courseType, 1)
this.loading = false; this.loading = false
}, },
async getQdInfoList() { async getQdInfoList() {
const resp = await $.get('/platform/mobile/trainSignUpActivity/getQdInfoList', { const resp = await $.get("/platform/mobile/trainSignUpActivity/getQdInfoList", {
activityId: this.activityId, activityId: this.activityId
}) })
if (resp.code === 0) { if (resp.code === 0) {
this.qdInfoList = resp.data this.qdInfoList = resp.data
} }
}, },
getWeek(dateString) { getWeek(dateString) {
var dateArray = dateString.split("-"); var dateArray = dateString.split("-")
const date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]); const date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2])
return "周" + "日一二三四五六".charAt(date.getDay()); return "周" + "日一二三四五六".charAt(date.getDay())
}, },
tabChange(val) { tabChange(val) {
this.tabName = val this.tabName = val
@@ -750,19 +819,19 @@ layout("/mobile/platform.html"){
this.closeLoading() this.closeLoading()
}, },
async getAllType() { async getAllType() {
const resp = await $.post('/platform/trainSingUp/manage/type/getAllType', {}) const resp = await $.post("/platform/trainSingUp/manage/type/getAllType", {})
this.allColumnsData = resp.data this.allColumnsData = resp.data
return resp.data return resp.data
}, },
async getCourseText() { async getCourseText() {
const courseArray = await this.getAllType() const courseArray = await this.getAllType()
this.courseOptions = [] this.courseOptions = []
this.courseOptions.push({text: '全部类型', value: '0'}) this.courseOptions.push({ text: "全部类型", value: "0" })
for (const item of courseArray) { for (const item of courseArray) {
if (item.personMaxRegisterNum > 0) { if (item.personMaxRegisterNum > 0) {
this.courseText += item.value + '报名最多选' + item.personMaxRegisterNum + '项,' this.courseText += item.value + "报名最多选" + item.personMaxRegisterNum + "项,"
} }
this.courseOptions.push({text: item.lxname, value: item.id}) this.courseOptions.push({ text: item.lxname, value: item.id })
} }
this.courseText = this.courseText.substr(0, this.courseText.length - 1) this.courseText = this.courseText.substr(0, this.courseText.length - 1)
}, },
@@ -771,19 +840,22 @@ layout("/mobile/platform.html"){
this.tableData.courseList = [] this.tableData.courseList = []
this.startLoading() this.startLoading()
} }
if(this.assortList.length > 0 && this.activityStatus !== '1') { if (this.assortList.length > 0 && this.activityStatus !== "1") {
if(value === '0') { if (value === "0") {
this.tableData.courseList = this.tempArray.courseList.filter(o => o.assort === this.assort) this.tableData.courseList = this.tempArray.courseList.filter((o) => o.assort === this.assort)
} else { } else {
this.tableData.courseList = this.tempArray.courseList.filter(item => item.courseType === value && item.assort === this.assort) this.tableData.courseList = this.tempArray.courseList.filter(
(item) => item.courseType === value && item.assort === this.assort
)
} }
} else { } else {
this.tableData.courseList = value === '0' ? this.tempArray.courseList : this.tempArray.courseList.filter(item => item.courseType === value) this.tableData.courseList =
value === "0" ? this.tempArray.courseList : this.tempArray.courseList.filter((item) => item.courseType === value)
} }
this.closeLoading() this.closeLoading()
}, },
async getActivity() { async getActivity() {
const resp = await $.get('/platform/mobile/trainSignUpActivity/findOne', { const resp = await $.get("/platform/mobile/trainSignUpActivity/findOne", {
id: this.activityId, id: this.activityId,
tabIndex: 0 tabIndex: 0
}) })
@@ -794,26 +866,27 @@ layout("/mobile/platform.html"){
}, },
async created() { async created() {
this.trainTypeList = await getDictOptions("trainSignUpType") this.trainTypeList = await getDictOptions("trainSignUpType")
this.activityId = GetQueryString('activityId') this.activityId = GetQueryString("activityId")
this.type = GetQueryString('type') this.type = GetQueryString("type")
const time = GetQueryString('endTime') const time = GetQueryString("endTime")
if (this.type === 'my') { if (this.type === "my") {
this.activityOptions = [{text: '我报名的', value: '1'}] this.activityOptions = [{ text: "我报名的", value: "1" }]
this.activityStatus = '1' this.activityStatus = "1"
} else { } else {
this.activityOptions = [{text: '全部', value: '0'}, {text: '我报名的', value: '1'}] this.activityOptions = [
this.activityStatus = new Date().getTime() > new Date(time).getTime() ? '1' : '0' { text: "全部", value: "0" },
{ text: "我报名的", value: "1" }
]
this.activityStatus = new Date().getTime() > new Date(time).getTime() ? "1" : "0"
} }
this.activitySignUpStartTime = GetQueryString('activitySignUpStartTime') this.activitySignUpStartTime = GetQueryString("activitySignUpStartTime")
vant.Toast.setDefaultOptions({duration: 2000}); vant.Toast.setDefaultOptions({ duration: 2000 })
this.startLoading() this.startLoading()
this.pageData() this.pageData()
this.getCourseText() this.getCourseText()
this.getActivity() this.getActivity()
this.closeLoading() this.closeLoading()
}
//await wxScannerQrCode.initWxConfig(window.location.href)
},
}) })
</script> </script>
<!--# <!--#
@@ -166,6 +166,15 @@ layout("/mobile/platform.html"){
</van-list> </van-list>
<van-empty v-else description="暂无数据"></van-empty> <van-empty v-else description="暂无数据"></van-empty>
</div> </div>
<div>
<van-tabbar v-model="tarBarActive">
<van-tabbar-item icon="home-o" replace @click="pjaxReplace('/platform/mobile/trainSignUpActivity/trainList')">活动报名</van-tabbar-item>
<van-tabbar-item icon="manager-o" replace @click="pjaxReplace('/platform/mobile/trainSignUpActivity/trainList?type=my')">
我的活动
</van-tabbar-item>
</van-tabbar>
</div>
</div> </div>
<script> <script>
@@ -208,18 +217,38 @@ layout("/mobile/platform.html"){
return return
} }
if (this.type === "my") { if (this.type === "my") {
window.location.href = // window.location.href =
// "/platform/mobile/trainSignUpActivity/trainInfo" +
// "?activityId=" +
// o.id +
// "&endTime=" +
// o.activitySignUpEndTime +
// "&type=my" +
// "&startTime=" +
// o.activitySignUpStartTime
pjaxReplace(
"/platform/mobile/trainSignUpActivity/trainInfo" + "/platform/mobile/trainSignUpActivity/trainInfo" +
"?activityId=" + "?activityId=" +
o.id + o.id +
"&endTime=" + "&endTime=" +
o.activitySignUpEndTime + o.activitySignUpEndTime +
"&type=my" + "&type=my" +
"&startTime=" + "&startTime=" +
o.activitySignUpStartTime o.activitySignUpStartTime
)
} else { } else {
window.location.href = const scopeUser = await getScopeUser(o.activityGroupId)
"/platform/mobile/trainSignUpActivity/activityInfo?activityId=" + o.id + "&endTime=" + o.activitySignUpEndTime if (scopeUser === 0) {
vant.Dialog.alert({
title: "提示",
message: "您不在报名人员范围内",
confirmButtonColor: "#1867b0"
})
return
}
// window.location.href =
// "/platform/mobile/trainSignUpActivity/activityInfo?activityId=" + o.id + "&endTime=" + o.activitySignUpEndTime
pjaxReplace("/platform/mobile/trainSignUpActivity/trainInfo?activityId=" + o.id + "&endTime=" + o.activitySignUpEndTime)
} }
}, },
async pageData() { async pageData() {
@@ -182,18 +182,17 @@ layout("/layouts/platform.html"){
<el-col v-for="item in activityList.slice((index-1)*4,index*4)" :span="6"> <el-col v-for="item in activityList.slice((index-1)*4,index*4)" :span="6">
<el-card :class="'box-card '+(item.id===pageForm.activityId?'activeCard':'')" style="border-radius: 10px"> <el-card :class="'box-card '+(item.id===pageForm.activityId?'activeCard':'')" style="border-radius: 10px">
<div slot="header" class="clearfix" style="font-size: 16px; padding: 5px 0" @click="openApply(item)"> <div slot="header" class="clearfix" style="font-size: 16px; padding: 5px 0" @click="openApply(item)">
<div <el-tooltip class="item" effect="dark" :content="item.activityName" placement="top-start">
style="width: 88%; white-space: nowrap; overflow: hidden; display: inline-block; text-overflow: ellipsis" <span v-if="item.activityName.length<=10">{{item.activityName}}</span>
> <span v-else>{{item.activityName.substr(0,10)}}...</span>
{{item.activityName}} </el-tooltip>
</div> <el-button @click="openApply(item)" class="reserve_btn" type="text">请选择活动报名</el-button>
<el-button @click="openApply(item)" class="reserve_btn" type="text">报名</el-button>
</div> </div>
<div @click="openApply(item)"> <div @click="openApply(item)">
<div class="text e-item"> <div class="text e-item">
<span style="color: gray">活动类型:</span> <span style="color: gray">活动类型:</span>
<span>{{item.activityMode == 1 ? '校工会' : '基层工会'}}</span> <span>{{item.activityMode == 1 ? '校工会' : '分工会'}}</span>
<el-tag <el-tag
type="danger" type="danger"
effect="dark" effect="dark"
@@ -225,13 +224,15 @@ layout("/layouts/platform.html"){
</div> </div>
<div class="text e-item"> <div class="text e-item">
<span style="color: gray">报名时间:</span> <span style="color: gray">报名时间:</span>
{{moment(item.activitySignUpStartTime).format('YYYY/MM/DD HH:mm')}} 至 {{moment(item.activitySignUpStartTime).format('MM/DD HH:mm')}} 至
{{moment(item.activitySignUpEndTime).format('YYYY/MM/DD HH:mm')}} {{moment(item.activitySignUpEndTime).format('MM/DD HH:mm')}}
</div> </div>
<div class="text item"> <div class="text item">
<span style="color: gray">活动时间:</span> <span style="color: gray">活动时间:</span>
{{moment(item.activityStartTime).format('YYYY/MM/DD HH:mm')}} 至 <span>
{{moment(item.activityEndTime).format('YYYY/MM/DD HH:mm')}} {{moment(item.activityStartTime).format('MM/DD HH:mm')}} 至
{{moment(item.activityEndTime).format('MM/DD HH:mm')}}
</span>
</div> </div>
</div> </div>
</el-card> </el-card>
@@ -239,7 +240,7 @@ layout("/layouts/platform.html"){
</el-row> </el-row>
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
<el-empty description="暂无数据" v-else></el-empty> <el-empty v-else description="暂无数据"></el-empty>
</el-row> </el-row>
<el-card shadow="never" class="mt10"> <el-card shadow="never" class="mt10">
@@ -248,7 +249,7 @@ layout("/layouts/platform.html"){
<div class="search-item-option"> <div class="search-item-option">
<el-select <el-select
v-model="pageForm.courseTypeId" v-model="pageForm.courseTypeId"
:placeholder="'请选择' + trainType" :placeholder="'请选择' + trainType + '类型'"
filterable filterable
clearable clearable
style="width: 100%; margin-bottom: 5px; margin-left: 10px" style="width: 100%; margin-bottom: 5px; margin-left: 10px"
@@ -277,6 +278,7 @@ layout("/layouts/platform.html"){
:key="column.prop" :key="column.prop"
:label="column.label" :label="column.label"
:prop="column.prop" :prop="column.prop"
:width="column.width"
:sortable="column.sortable" :sortable="column.sortable"
show-overflow-tooltip show-overflow-tooltip
> >
@@ -287,7 +289,20 @@ layout("/layouts/platform.html"){
</template> </template>
<template scope="{row}" v-else-if="column.prop=='courseTime'"> <template scope="{row}" v-else-if="column.prop=='courseTime'">
<el-button style="padding: 0" @click="openViewCourseTime(row.id)" type="text">点击查看{{trainType}}时间</el-button> <template v-if="row.courseName.includes('时间待定')">
<span style="color: #e5a15e">活动时间另行通知</span>
</template>
<template v-else>
<el-button v-if="row.courseList && row.courseList.length == 1" type="text" style="padding: 0">
<span>
{{moment(row.courseList[0].courseStartTime).format('MM-DD HH:mm')}}
至{{moment(row.courseList[0].courseEndTime).format('MM-DD HH:mm')}}
</span>
</el-button>
<el-button v-else style="padding: 0" @click="openViewCourseTime(row)" type="text">
点击查看{{trainType}}时间
</el-button>
</template>
</template> </template>
<template scope="{row}" v-else-if="column.prop=='applyNum'"> <template scope="{row}" v-else-if="column.prop=='applyNum'">
@@ -295,6 +310,12 @@ layout("/layouts/platform.html"){
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="详细信息" prop="remarks">
<template scope="{row}">
<el-button type="text" @click="openViewRemark(row)">点我查看详情</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="150px"> <el-table-column align="center" label="操作" width="150px">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-button type="primary" size="small">查看信息</el-button>--> <!-- <el-button type="primary" size="small">查看信息</el-button>-->
@@ -307,94 +328,6 @@ layout("/layouts/platform.html"){
</el-card> </el-card>
</template> </template>
<template #edit>
<el-form :model="formData" ref="form" label-width="120px">
<el-row>
<el-col span="24">
<el-form-item label="姓名" prop="username">
<el-input readonly v-model="formData.username"></el-input>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="工号" prop="loginname">
<el-input readonly v-model="formData.loginname"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="24">
<el-form-item label="所在单位" prop="unitName">
<el-input readonly v-model="formData.unitName"></el-input>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="所属工会" prop="unionName">
<el-input readonly v-model="formData.unionName"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="24">
<el-form-item label="性别" prop="sex">
<el-input readonly v-model="formData.sex"></el-input>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="联系方式" prop="mobile">
<el-input v-model="formData.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="24">
<el-form-item
v-for="(column, index) in formData.trainMobileSignColumnList"
:prop="'trainMobileSignColumnList.' + index + '.columnValue'"
:label="column.columnName"
:key="column.columnCode"
:rules="{ required: column.isRequired,
message: (['SELECT', 'FILE'].includes(column.columnFormType) ? '请选择' : '请填写') + column.columnName,
trigger: 'blur'}"
>
<!--文本框-->
<template v-if="!['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-input
v-model="column.columnValue"
:placeholder="'请填写' + column.columnName"
:type="['INT'].includes(column.columnType) ? 'number' : ''"
></el-input>
</template>
<!--选择框-->
<template v-else-if="['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-select v-model="column.columnValue" clearable :placeholder="'请选择' + column.columnName" style="width: 100%">
<el-option v-for="item in column.selectValues" :key="item" :label="item" :value="item"></el-option>
</el-select>
</template>
<!--时间框-->
<template v-else-if="['DATE', 'DATETIME'].includes(column.columnType)">
<el-date-picker
style="width: 100%"
v-model="column.columnValue"
:type="column.columnType === 'DATE' ? 'date' : 'datetime'"
:placeholder="'请选择' + column.columnName"
:value-format="column.columnType === 'DATE' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss'"
></el-date-picker>
</template>
<!--文件-->
<template v-else-if="['JSON'].includes(column.columnType)">
<file-upload :files.sync="column.columnValue" :max="column.fileNumber" :type="column.fileType"></file-upload>
</template>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row type="flex" justify="end">
<el-button type="primary" @click="doSubmit">提交</el-button>
</el-row>
</template>
<el-dialog :visible.sync="courseTimeListDialog" :title="trainType + '时间'" width="60%" append-to-body> <el-dialog :visible.sync="courseTimeListDialog" :title="trainType + '时间'" width="60%" append-to-body>
<el-table :data="courseTimeList"> <el-table :data="courseTimeList">
<el-table-column label="日期" prop="courseDate"> <el-table-column label="日期" prop="courseDate">
@@ -413,6 +346,129 @@ layout("/layouts/platform.html"){
<div id="viewMap" style="width: 100%; height: 500px"></div> <div id="viewMap" style="width: 100%; height: 500px"></div>
</el-dialog> </el-dialog>
</guava> </guava>
<el-dialog :visible.sync="applyDialog" :title="trainType + '报名'" width="50%" append-to-body>
<el-form :model="formData" ref="form" label-width="90px">
<el-row>
<el-col span="24">
<el-form-item label="姓名" prop="username">
<el-input readonly v-model="formData.username"></el-input>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="工号" prop="loginname">
<el-input readonly v-model="formData.loginname"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="24">
<el-form-item label="所在单位" prop="unitName">
<el-input readonly v-model="formData.unitName"></el-input>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="所属工会" prop="unionName">
<el-input readonly v-model="formData.unionName"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="24">
<el-form-item label="性别" prop="sex">
<el-input readonly v-model="formData.sex"></el-input>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="联系方式" prop="mobile">
<el-input v-model="formData.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="24">
<el-form-item
v-for="(column, index) in formData.trainMobileSignColumnList"
:prop="'trainMobileSignColumnList.' + index + '.columnValue'"
:label="column.columnName"
:key="column.columnCode"
:rules="{ required: column.isRequired,
message: (['SELECT', 'FILE'].includes(column.columnFormType) ? '请选择' : '请填写') + column.columnName,
trigger: 'blur'}"
>
<!--文本框-->
<template v-if="!['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-input
v-model="column.columnValue"
:placeholder="'请填写' + column.columnName"
:type="['INT'].includes(column.columnType) ? 'number' : ''"
></el-input>
</template>
<!--选择框-->
<template v-else-if="['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-select v-model="column.columnValue" :placeholder="'请选择' + column.columnName" style="width: 100%">
<el-option v-for="item in column.selectValues" :key="item" :label="item" :value="item"></el-option>
</el-select>
</template>
<!--时间框-->
<template v-else-if="['DATE', 'DATETIME'].includes(column.columnType)">
<el-date-picker
style="width: 100%"
v-model="column.columnValue"
:type="column.columnType === 'DATE' ? 'date' : 'datetime'"
:placeholder="'请选择' + column.columnName"
:value-format="column.columnType === 'DATE' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss'"
></el-date-picker>
</template>
<!--文件-->
<template v-else-if="['JSON'].includes(column.columnType)">
<file-upload :files.sync="column.columnValue" :max="column.fileNumber" :type="column.fileType"></file-upload>
</template>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row type="flex" justify="end">
<el-button type="primary" @click="doSubmit">提 交</el-button>
</el-row>
</el-dialog>
<el-dialog :visible.sync="remarkShow" :title="courseRemark.courseName" width="50%" append-to-body top="2%">
<el-tabs v-model="remarkActive" type="border-card" @tab-click="remarkActiveClick">
<el-tab-pane label="详细信息" name="first">
<div class="text-center" v-html="courseRemark.remarks" style="height: 600px; overflow-y: auto"></div>
</el-tab-pane>
<el-tab-pane label="报名人员" name="second">
<div class="btn-group tool-button mt5">
<el-input v-model="registerForm.searchKeyword" placeholder="请输入姓名查询" size="small"></el-input>
</div>
<div class="btn-group tool-button mt5">
<el-select v-model="registerForm.unionId" clearable filterable placeholder="请选择院级工会" size="small">
<el-option v-for="item in unionList" :key="item.id" :label="item.unionname" :value="item.id"></el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-select v-model="registerForm.sex" clearable filterable placeholder="请选择性别" size="small">
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button icon="el-icon-search" type="primary" @click="getSignUsers" size="small"></el-button>
</div>
<el-table :data="signUsers" max-height="500" size="small">
<el-table-column prop="username" label="姓名" header-align="center" align="center"></el-table-column>
<el-table-column prop="sex" label="性别" header-align="center" align="center"></el-table-column>
<el-table-column prop="unionname" label="所属工会" header-align="center" align="center"></el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-row type="flex" justify="end" style="margin-top: 20px">
<el-button type="primary" @click="remarkShow = false">关 闭</el-button>
</el-row>
</el-dialog>
</div> </div>
<script> <script>
@@ -423,6 +479,8 @@ layout("/layouts/platform.html"){
data() { data() {
const self = this const self = this
return { return {
remarkActive: "first",
signUsers: [],
trainSignUpActivity: {}, trainSignUpActivity: {},
pageForm: { pageForm: {
year: moment().format("YYYY"), year: moment().format("YYYY"),
@@ -431,7 +489,6 @@ layout("/layouts/platform.html"){
activityList: [], activityList: [],
courseTypeList: [], courseTypeList: [],
tableColumns: [ tableColumns: [
/* {prop: 'name', label: '活动名称'},*/
{ prop: "courseName", label: "名称" }, { prop: "courseName", label: "名称" },
{ prop: "lxname", label: "类型" }, { prop: "lxname", label: "类型" },
{ prop: "coursePeopleNumber", label: "总人数" }, { prop: "coursePeopleNumber", label: "总人数" },
@@ -448,22 +505,62 @@ layout("/layouts/platform.html"){
mobile: [{ required: true, message: "必填", trigger: ["blur", "change"] }] mobile: [{ required: true, message: "必填", trigger: ["blur", "change"] }]
}, },
choose: {}, choose: {},
trainType: "培训班" trainType: "培训班",
applyDialog: false,
remarkShow: false,
courseRemark: {},
registerForm: {
searchKeyword: "",
searchName: "u.username",
unionId: ""
},
unionList: []
} }
}, },
methods: { methods: {
async doCancel(row) { async remarkActiveClick(tab) {
const resp = await $.post("/platform/mobile/trainSignUpActivity/cancelSignUp", { if (tab.name === "second") {
activityId: row.activityId, //获取报名人员
courseId: row.id await this.getSignUsers()
})
if (resp.code === 0) {
await this.pageData()
this.$message.success(resp.msg)
} else {
this.$message.warning(resp.msg)
} }
}, },
async getSignUsers() {
this.registerForm.courseId = this.courseRemark.id
const { data } = await $.get("/platform/trainSingUp/manage/userAdjust/registerUserList", this.registerForm)
this.signUsers = data
},
openViewRemark(row) {
this.remarkActive = "first"
this.signUsers = []
if (!row.remarks) {
this.$message.warning("暂无详细信息")
return
}
this.courseRemark = row
this.remarkShow = true
},
async doCancel(row) {
const msg = "您确认要取消" + row.courseName + "的报名吗?"
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
const resp = await $.post("/platform/mobile/trainSignUpActivity/cancelSignUp", {
activityId: row.activityId,
courseId: row.id
})
if (resp.code === 0) {
await this.pageData()
this.$message.success(resp.msg)
} else {
this.$message.warning(resp.msg)
}
})
},
calcSignUpCount(o) { calcSignUpCount(o) {
if (o.reserveMode === 2) { if (o.reserveMode === 2) {
let lave = 0 let lave = 0
@@ -488,8 +585,12 @@ layout("/layouts/platform.html"){
"人)" "人)"
return str return str
} else { } else {
let lave = o.coursePeopleNumber - (o.hasRegisterNum + o.courseReservedNumber) if (Number(o.coursePeopleNumber) >= 1000) {
return "(<span style='color: red'>余" + lave + "</span>/" + o.coursePeopleNumber + "人)" return "(<span style='color: #ff8400'>无名额限制</span>/已报<span style='color: red'>" + o.hasRegisterNum + "</span>人)"
} else {
let lave = o.coursePeopleNumber - (o.hasRegisterNum + o.courseReservedNumber)
return "(<span style='color: red'>余" + lave + "</span>/" + o.coursePeopleNumber + "人)"
}
} }
}, },
async doSubmit() { async doSubmit() {
@@ -511,7 +612,8 @@ layout("/layouts/platform.html"){
} }
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.$confirm("您确定要提交吗?", "提示", { const msg = "您确认要提交" + this.choose.courseName + "的报名吗?"
this.$confirm(msg, "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
@@ -529,7 +631,7 @@ layout("/layouts/platform.html"){
if (resp.code === 0) { if (resp.code === 0) {
await this.pageData() await this.pageData()
this.$message.success(resp.msg) this.$message.success(resp.msg)
this.$refs.guava.index() this.applyDialog = false
} else { } else {
this.$message.warning(resp.msg) this.$message.warning(resp.msg)
} }
@@ -538,17 +640,22 @@ layout("/layouts/platform.html"){
}) })
}, },
async doApply(row) { async doApply(row) {
if (row.courseName.includes("时间待定")) {
this.$message.warning("活动报名尚未开始哦,请报名其他活动吧")
return
}
this.choose = row this.choose = row
const o = this.courseTypeList.find((v) => v.id === row.courseType) const o = this.courseTypeList.find((v) => v.id === row.courseType)
const data = this.trainSignUpActivity const data = this.trainSignUpActivity
const now = moment().valueOf() const now = moment().valueOf()
if (now < moment(data.activitySignUpStartTime).valueOf() || now > moment(data.activitySignUpEndTime).valueOf()) { if (now < moment(data.activitySignUpStartTime).valueOf() || now > moment(data.activitySignUpEndTime).valueOf()) {
this.$message.warning("报名已结束,请致电校工会咨询,联系电话:85913629") this.$message.warning("此活动不在报名时间内")
return return
} }
const scopeUser = await getScopeUser(data.activityGroupId) const scopeUser = await getScopeUser(data.activityGroupId)
if (scopeUser === 0) { if (scopeUser === 0) {
this.$message.warning("您不在活动报名范围内") this.$message.warning("您不在报名人员范围内")
return return
} }
const res = await $.post("/platform/mobile/trainSignUpActivity/validateSignUp", { const res = await $.post("/platform/mobile/trainSignUpActivity/validateSignUp", {
@@ -575,9 +682,9 @@ layout("/layouts/platform.html"){
this.formData.trainMobileSignColumnList.forEach((item) => { this.formData.trainMobileSignColumnList.forEach((item) => {
item.columnValue = "" item.columnValue = ""
}) })
this.$refs.form.clearValidate()
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.guava.edit() this.applyDialog = true
// this.$refs.guava.edit()
}) })
}, },
openViewMap(point) { openViewMap(point) {
@@ -636,13 +743,18 @@ layout("/layouts/platform.html"){
this.$message.warning(resp.msg) this.$message.warning(resp.msg)
} }
}, },
async openViewCourseTime(id) { async openViewCourseTime(row) {
const resp = await $.get(loc() + "/getCourseTime", { id: id }) if (row.courseList && row.courseList.length > 0) {
this.courseTimeList = resp.data this.courseTimeList = row.courseList
} else {
const resp = await $.get(loc() + "/getCourseTime", { id: row.id })
this.courseTimeList = resp.data
}
this.courseTimeListDialog = true this.courseTimeListDialog = true
} }
}, },
async created() { async created() {
this.unionList = await getUnion()
await this.activityData() await this.activityData()
await this.getCourseTypeList() await this.getCourseTypeList()
} }