This commit is contained in:
@jyuhsin
2025-09-15 18:10:47 +08:00
parent 39595080f0
commit 5aeb59d282
7 changed files with 178 additions and 26 deletions
@@ -123,27 +123,8 @@ public class FamilyActivityApplyController {
@Param(value = "dataType") String dataType) {
Sql sql = Sqls.create("""
SELECT
tsuc.id,
tsuc.activityId,
tsuc.courseName,
tsuc.coursePeopleNumber,
tsuc.courseLocation,
tsuc.courseType,
tsuc.courseLocationCoordinates,
tsuc.courseReservedNumber,
tsuc.courseInstructor,
tsuc.campus,
tsuc.unionLimit,
tsuc.isMobileSign,
tsuc.signType,
tsuc.isReceiveGift,
tsuc.giftType,
tsuc.reserveMode,
tsuc.waitingNum,
tsuc.assort,
tsuc.introduce,
type.typeName,
tsuc.courseIsLimitApply
tsuc.*,
type.typeName
FROM
`family_course` tsuc
LEFT JOIN family_type type ON type.id = tsuc.courseType
@@ -94,6 +94,7 @@ public class FamilyCourse extends BaseModel implements Serializable {
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签到")
@Default("0")
private boolean isMobileSign;
@Column
@@ -104,6 +105,7 @@ public class FamilyCourse extends BaseModel implements Serializable {
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签收礼品")
@Default("0")
private boolean isReceiveGift;
@Column
@@ -142,6 +144,33 @@ public class FamilyCourse extends BaseModel implements Serializable {
@Comment("候补名额数")
private Integer waitingNum;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否限制年龄")
@Default("0")
private boolean familyAgeLimit;
@Column
@ColDefine(type = ColType.INT)
@Comment("最小年龄")
private Integer minAge;
@Column
@ColDefine(type = ColType.INT)
@Comment("最大年龄")
private Integer maxAge;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否限制性别")
@Default("0")
private boolean familySexLimit;
@Column
@ColDefine(type = ColType.VARCHAR)
@Comment("限制性别")
private String familySex;
private Integer hasWaitingNum;
private String courseTimeName;
private Integer hasRegisterNum;
@@ -32,7 +32,6 @@ module.exports = {
methods: {
init() {
try {
debugger
const parser = new DOMParser();
const doc = parser.parseFromString(this.content, 'text/html');
const link = doc.querySelector('a');
@@ -317,7 +317,17 @@ const basicForm = {
formData: {
notice: false,
courseList: [
{ orderNum: 1, courseName: "", courseTimeList: [], isMobileSign: false, isReceiveGift: false, reserveMode: 1, courseIsLimitApply: false },
{
orderNum: 1,
courseName: "",
courseTimeList: [],
isMobileSign: false,
isReceiveGift: false,
reserveMode: 1,
courseIsLimitApply: false,
familyAgeLimit: false,
familySexLimit: false,
},
],
conditionStructure: {
method: "AND",
@@ -516,6 +526,18 @@ const basicForm = {
this.$message.warning("第" + (i + 1) + "行签到方式填写有误,请核查")
return true
}
if(v.familyAgeLimit === true && !v.minAge) {
this.$message.warning("第" + (i + 1) + "行最小年龄不能为空,请核查")
return true
}
if(v.familyAgeLimit === true && !v.maxAge) {
this.$message.warning("第" + (i + 1) + "行最大年龄不能为空,请核查")
return true
}
if(v.familySexLimit === true && !v.familySex) {
this.$message.warning("第" + (i + 1) + "行性别不能为空,请核查")
return true
}
return false
})
if (courseValid) return
@@ -50,6 +50,69 @@ const customForm = {
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否限制年龄</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].familyAgeLimit" size="small">
<el-radio border :label="true">限制</el-radio>
<el-radio border :label="false">不限制</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].familyAgeLimit === true">
<el-col :span="4">
<span>最小年龄</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
step-strictly
placeholder="请输入最小年龄"
v-model="formData.courseList[moreInfoIndex].minAge"></el-input-number>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].familyAgeLimit === true">
<el-col :span="4">
<span>最大年龄</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
step-strictly
placeholder="请输入最大年龄"
v-model="formData.courseList[moreInfoIndex].maxAge"></el-input-number>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否限制性别</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].familySexLimit" size="small">
<el-radio border :label="true">限制</el-radio>
<el-radio border :label="false">不限制</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].familySexLimit === true">
<el-col :span="4">
<span>限制性别</span>
</el-col>
<el-col :span="20">
<el-select v-model="formData.courseList[moreInfoIndex].familySex" placeholder="请选择性别"
style="width: 100%" clearable>
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否签到</span>
@@ -132,7 +195,7 @@ const customForm = {
<span>候补数量</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" size="small" style="width: 100%"
<el-input-number :controls="false" style="width: 100%"
:max="100"
:min="0"
:precision="0"
@@ -205,10 +205,68 @@ const applyForm = {
return false;
}
}
if(col.validRule === 'idCard' && this.row.familyAgeLimit) {
const parseCard = this.parseIdCard(value)
if(this.row.minAge && parseCard.age < this.row.minAge) {
const message = '限制报名最小年龄为' + this.row.minAge;
showAlert(message);
return false;
}
if(this.row.maxAge && parseCard.age > this.row.maxAge) {
const message = '限制报名最大年龄为' + this.row.maxAge;
showAlert(message);
return false;
}
}
if(col.validRule === 'idCard' && this.row.familySexLimit) {
const parseCard = this.parseIdCard(value)
if(this.row.familySex && parseCard.sex !== this.row.familySex) {
const message = '限制报名性别为' + this.row.familySex;
showAlert(message);
return false;
}
}
}
}
return true;
},
parseIdCard(idCard) {
if (!idCard || (idCard.length !== 18 && idCard.length !== 15)) {
return null;
}
let birthStr = '';
let sexCode = '';
if (idCard.length === 15) {
birthStr = '19' + idCard.substring(6, 12);
sexCode = idCard.substring(14, 15); // 15位:第15位是性别
} else {
birthStr = idCard.substring(6, 14);
sexCode = idCard.substring(16, 17); // 18位:第17位是性别
}
const birthYear = parseInt(birthStr.substring(0, 4), 10);
const birthMonth = parseInt(birthStr.substring(4, 6), 10) - 1;
const birthDay = parseInt(birthStr.substring(6, 8), 10);
const birthDate = new Date(birthYear, birthMonth, birthDay);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
const dayDiff = today.getDate() - birthDate.getDate();
if (monthDiff < 0 || (monthDiff === 0 && dayDiff < 0)) {
age--;
}
const sex = parseInt(sexCode, 10) % 2 === 1 ? '男' : '女';
return { age, sex, };
},
async validateSignUp() {
// 获取家属人数
const res = await this.$axios.post("/platform/family/apply/validateSignUp", {
@@ -40,8 +40,8 @@ layout("/layouts/platform_h5.html"){
<table-column label="地点">{{row.courseLocation}}</table-column>
<table-column label="联系人">{{row.courseInstructor}}</table-column>
<table-column label="时间">
<span v-if="row.courseTimes && row.courseTimes.length === 1">
{{ $moment(row.courseTimes[0].courseStartTime).format('HH:mm') + '~' + $moment(row.courseTimes[0].courseEndTime).format('HH:mm') }}
<span v-if="row.courseTimes && row.courseTimes.length === 1" class="primary-color" @click="onTime(row)">
{{ $moment(row.courseTimes[0].courseStartTime).format('MM月DD日 HH:mm') + '~' + $moment(row.courseTimes[0].courseEndTime).format('HH:mm') }}
</span>
<span v-else @click="onTime(row)" class="primary-color">点我查看</span>
</table-column>