This commit is contained in:
@jyuhsin
2025-05-29 10:31:17 +08:00
parent ef3138ebaf
commit 554a7b9b67
10 changed files with 1020 additions and 196 deletions
@@ -3,6 +3,12 @@ layout("/mobile/platform.html"){
#-->
<style>
.container {
height: calc(100vh - 46px - 50px - 60px);
overflow-y: auto;
position: relative;
}
.container img {
background-size: contain;
width: 100%;
@@ -17,7 +23,11 @@ layout("/mobile/platform.html"){
.content {
line-height: 26px;
padding: 0px 20px 56px 20px;
padding: 0px 10px 56px 10px;
}
.backTop {
display: none !important;
}
.title {
@@ -46,21 +56,25 @@ layout("/mobile/platform.html"){
}
.footer {
background-color: white;
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
display: flex;
justify-content: space-evenly;
align-items: center;
left: 0;
}
.footer .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
margin: 0 10px;
}
.submitButton .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
margin: 0 10px;
}
.family_join {
@@ -81,7 +95,7 @@ layout("/mobile/platform.html"){
.join_content {
padding: 20px;
height: calc(100% - 40px - 46px - 60px);
height: calc(100% - 40px - 46px);
overflow-y: auto;
}
@@ -140,7 +154,7 @@ layout("/mobile/platform.html"){
.top_icon {
position: fixed;
bottom: 80px;
bottom: 130px;
right: 20px;
}
@@ -155,7 +169,7 @@ layout("/mobile/platform.html"){
.companionList_empty_text {
text-align: center;
padding: 10px 0px;
font-size: 14px;
font-size: 16px;
color: grey;
}
@@ -185,16 +199,60 @@ layout("/mobile/platform.html"){
align-items: center;
}
.submitButton .van-button {
height: 34px;
border-radius: 6px;
width: 90% !important;
}
.van-image-preview img {
background-color: white;
}
select-checkbox {
position: absolute;
right: 0;
}
.select-popup-footer {
margin-top: 10px;
padding: 10px;
display: flex;
justify-content: space-between;
}
.btn {
display: flex;
justify-content: space-between;
background-color: #fff;
}
.cancle {
font-size: 18px;
}
.confirm {
font-size: 18px;
}
.van-tag {
color: white !important;
}
.cal_middle {
color: #ee0a24;
background-color: #FDE6E9;
}
.cal_end {
color: #fff;
background-color: #ee0a24;
border-radius: 0 4px 4px 0;
}
.van-calendar__day--middle::after {
background-color: transparent;
}
.pdf_div {
padding-bottom: 12px;
height: calc(100vh - 46px - 178px - 24px - 60px - 70px);
}
</style>
<div id="app" v-cloak>
@@ -234,14 +292,9 @@ layout("/mobile/platform.html"){
</div>
</div>
</div>
<van-divider></van-divider>
<div v-if="baseData.content" v-html="baseData.content" class="content"></div>
<div v-else v-html="configData.notice" class="content"></div>
<!--<van-empty
v-else class="custom-image"
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
description="暂无详细信息"
></van-empty>-->
<van-divider :style="{ color: 'orange', fontSize: '12px' }">上下滑动翻页,单击查看,再单击返回</van-divider>
<div v-if="isPdf" v-html="baseData.content" class="content"></div>
<div v-else id="demo" class="pdf_div"></div>
</div>
</van-skeleton>
@@ -251,15 +304,22 @@ layout("/mobile/platform.html"){
class="top_icon"></image>
<!--底部报名按钮-->
<div class="footer" v-if="fromUrlByMy != 'edit'">
<div class="footer" v-if="fromUrlByMy == 'find'">
<van-button @click="join"
class="join">我的填报信息
</van-button>
</div>
<div class="footer" v-else>
<template v-if="baseData.isNormal==0&&baseData.isNormalFalse>0">
<van-button @click="join"
class="join">我要报名
</van-button>
<van-button @click="join" class="join">我要报名</van-button>
</template>
<template v-else>
<van-button v-if="moment().unix() <= moment(baseData.signUpEndTime).unix()" @click="join" class="join">我要报名
</van-button>
<van-button
v-if="moment().unix() <= moment(baseData.signUpEndTime).unix() && ${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}"
@click="helpJoin" class="join">替他人报名
</van-button>
<van-button v-if="moment().unix() > moment(baseData.signUpEndTime).unix()" class="join">报名结束</van-button>
</template>
</div>
@@ -268,9 +328,7 @@ layout("/mobile/platform.html"){
<van-popup v-model:show="joinPopup" position="right" class="joinPopup">
<van-nav-bar @click-left="joinPopup = false" fixed left-arrow placeholder title="疗休养报名"></van-nav-bar>
<div class="join_content">
<van-form @submit="joinSubmit">
<van-form :disabled="fromUrlByMy == 'find'" @submit="joinSubmit">
<!--基础信息-->
<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
@@ -278,14 +336,25 @@ layout("/mobile/platform.html"){
基础信息
</div>
<div class="van-card-body">
<van-field label="姓名" readonly v-model="formData.userName"></van-field>
<van-field label="一卡通号" readonly v-model="formData.loginName"></van-field>
<van-field label="身份证件" name="idCard" :rules="[{ required: true }]"
placeholder="请填写身份证号、护照、台胞证等" v-model="formData.idCard"></van-field>
<van-field v-if="isHelpJoin" label="姓名" readonly v-model="formData.userName"></van-field>
<van-field v-else="!isHelpJoin" label="姓名"
:rules="[{ required: true }]"
placeholder="请输入工号或姓名进行查询" required
@click="show = true"
v-model="formData.userName"></van-field>
<van-field label="工号" readonly v-model="formData.loginName"></van-field>
<van-field label="身份证号" name="idCard" :rules="[{ required: true }]"
placeholder="请填写身份证号" v-model="formData.idCard"></van-field>
<van-field label="手机号" name="mobile" :rules="[{ required: true }]"
placeholder="请填写手机号" v-model="formData.mobile"></van-field>
<van-field label="所属工会" readonly v-model="formData.unionName"></van-field>
<van-field label="报名酒店" readonly v-model="formData.baseName"></van-field>
<van-field label="活动时间" readonly @click="if(fromUrlByMy != 'find')timeVisible = true"
:rules="[{ required: true }]" placeholder="请选择活动时间" required
is-link v-model="formData.specificTime" name="specificTime"></van-field>
</div>
</div>
@@ -293,13 +362,14 @@ layout("/mobile/platform.html"){
<div class="van-doc-card" style="margin-bottom: 16px">
<div></div>
<div class="van-card-header">
床位信息
床位信息(一位教职工一间)
</div>
<div class="van-card-body">
<van-field @click="self = true; roomVisible = true" readonly is-link label="房间" name="bedType"
<van-field @click="if(fromUrlByMy != 'find'){self = true; roomVisible = true}" readonly is-link
label="房间" name="bedType"
placeholder="请选择房间" v-model="formData.bedInfo.bedType"
:rules="[{ required: true }]"></van-field>
<van-field v-if="formData.bedInfo.bedType == '标准间'" @click="self = true; bedVisible = true"
<!--<van-field v-if="formData.bedInfo.bedType == '标准间'" @click="self = true; bedVisible = true"
readonly is-link label="床位"
name="bedNum" placeholder="请选择床位" v-model="formData.bedInfo.bedNum"
:rules="[{ required: true }]"></van-field>
@@ -311,11 +381,11 @@ layout("/mobile/platform.html"){
<van-radio :name="false" shape="square">否</van-radio>
</van-radio-group>
</template>
</van-field>
<van-field v-if="formData.bedInfo.bedType == '标准间' && formData.bedInfo.isSleepTogether == true"
label="意向拼房人" name="otherSleepUser" placeholder="多个拼房人请用,隔开"
</van-field>-->
<!--<van-field v-if="formData.bedInfo.bedType == '标准间' && formData.bedInfo.isSleepTogether == true"
label="意向拼房人" name="otherSleepUser" placeholder="若无拼房人,填写“无”即可"
v-model="formData.bedInfo.otherSleepUser"
:rules="[{ required: true }]"></van-field>
:rules="[{ required: true }]"></van-field>-->
</div>
</div>
@@ -325,7 +395,7 @@ layout("/mobile/platform.html"){
<div class="van-card-header"
style="display: flex; justify-content: space-between; align-items: center">
<span style="float:left;">随行人信息</span>
<div>
<div v-if="fromUrlByMy != 'find'">
<van-tag @click="delCompanion" size="large" type="primary" color="lightgrey">删除随行人</van-tag>
<van-tag @click="addCompanion" size="large" type="primary" color="#1867b0">添加随行人</van-tag>
</div>
@@ -335,9 +405,9 @@ layout("/mobile/platform.html"){
<van-tab v-for="item, index in formData.companionList" :title="'随行人' + (index + 1)">
<van-field label="姓名" name="userName" placeholder="请填写姓名" v-model="item.userName"
:rules="[{ required: true }]"></van-field>
<!--<van-field label="一卡通号" name="loginName" placeholder="若没有工号,请忽略此项" v-model="item.loginName"></van-field>-->
<van-field label="年龄" name="age" placeholder="请填写年龄" v-model="item.age"
type="digit" :rules="[{ required: true }]"></van-field>
<!--<van-field label="号" name="loginName" placeholder="若没有工号,请忽略此项" v-model="item.loginName"></van-field>-->
<van-field label="年龄" name="age" placeholder="请填写年龄" v-model="item.age" type="digit"
:rules="[{ required: true }]"></van-field>
<van-field :rules="[{ required: true, message: '请选择性别' }]" label="性别" name="validator">
<template #input>
<van-radio-group direction="horizontal" v-model="item.sex">
@@ -346,24 +416,27 @@ layout("/mobile/platform.html"){
</van-radio-group>
</template>
</van-field>
<van-field label="身份证" name="idCard" placeholder="请填写身份证号、护照、台胞证等"
:rules="[{ required: true }]" type="digit"
<van-field label="身份证" name="idCard" placeholder="请填写身份证号"
:rules="[{ required: true }]"
v-model="item.idCard"></van-field>
<van-field label="手机号" name="mobile" placeholder="请填写手机号"
:rules="[{ required: true }]" type="digit"
v-model="item.mobile"></van-field>
<van-field @click="companionVisible = true" readonly is-link label="与本人关系"
<van-field @click="if(fromUrlByMy != 'find')companionVisible = true" readonly is-link
label="与本人关系"
name="relation"
placeholder="随行人与本人关系" v-model="item.relation"
:rules="[{ required: true }]"></van-field>
<van-field @click="self = false; roomVisible = true" readonly is-link label="房间"
<van-field @click="if(fromUrlByMy != 'find'){self = false; roomVisible = true}" readonly
is-link label="房间"
name="bedType" placeholder="请选择房间"
v-model="item.bedInfo.bedType"></van-field>
<div style="font-size: 8px; color:orangered; padding-left: 16px; padding-bottom: 4px">
提醒:如果跟报名人员同一房间,无须选择!
</div>
<van-field v-if="item.bedInfo.bedType == '标准间'" @click="self = false; bedVisible = true"
<van-field v-if="item.bedInfo.bedType == '标准间'"
@click="if(fromUrlByMy != 'find'){self = false; bedVisible = true}"
readonly is-link label="床位"
name="bedNum" placeholder="请选择床位" v-model="item.bedInfo.bedNum"></van-field>
<van-field v-if="item.bedInfo.bedType == '标准间'"
@@ -376,7 +449,7 @@ layout("/mobile/platform.html"){
</template>
</van-field>
<van-field v-if="item.bedInfo.bedType == '标准间' && item.bedInfo.isSleepTogether == true"
label="意向拼房人" name="otherSleepUser" placeholder="多个拼房人请用,隔开"
label="意向拼房人" name="otherSleepUser" placeholder="若无拼房人,填写“无”即可"
v-model="item.bedInfo.otherSleepUser"></van-field>
</van-tab>
</van-tabs>
@@ -387,15 +460,11 @@ layout("/mobile/platform.html"){
</span>
</div>
</div>
<div class="submitButton">
<div v-if="fromUrlByMy != 'find'" class="submitButton">
<van-button class="join join_submit">提交报名</van-button>
</div>
</van-form>
</div>
</van-popup>
<!--房间类型弹出框-->
@@ -403,6 +472,7 @@ layout("/mobile/platform.html"){
<van-picker
title="入住房间" show-toolbar
:columns="roomColumns"
:default-index="defaultIndex"
@confirm="roomConfirm"
@cancel="roomCancel">
</van-picker>
@@ -419,7 +489,7 @@ layout("/mobile/platform.html"){
</van-popup>
<!--随行人关系弹出框-->
<van-popup position="bottom" round v-model="companionVisible">
<van-popup position="bottom" round v-model="companionVisible" popup-style="bottom: 60px;">
<van-picker
title="与本人关系" show-toolbar
:columns="companionColumns"
@@ -428,6 +498,50 @@ layout("/mobile/platform.html"){
</van-picker>
</van-popup>
<!--时间弹出框-->
<!--<van-popup position="bottom" round v-model="timeVisible">
<van-picker
title="具体时间" show-toolbar
:columns="timeArray"
@confirm="(value, index) => {formData.specificTime = value; timeVisible = false}"
@cancel="timeVisible = false">
</van-picker>
</van-popup>-->
<van-calendar type="range" v-model="timeVisible"
ref="cal" @confirm="calConfirm"
:min-date="minDate" :max-date="maxDate"
:first-day-of-week="1" :formatter="formatter"
@select="daySelect"
:max-range="lotValue" :style="{ height: '660px' }"></van-calendar>
<van-popup position="bottom" round v-model="show" :style="{ height: '60%' }" closeable>
<van-search v-model="result" show-action style="padding: 10px;margin-top: 45px" placeholder="请输入工号或姓名搜索"
@input="delaySearch">
</van-search>
<van-cell-group>
<div>
<van-checkbox-group style="text-align: center">
<van-cell-group>
<van-cell v-for="(item, index) in userList" :key="item.index" clickable
:title="item.name"
@click="toResult(item.loginname)">
</van-cell>
</van-cell-group>
</van-checkbox-group>
</div>
</van-cell-group>
</van-popup>
<div>
<van-tabbar v-model="tarBarActive">
<van-tabbar-item icon="home-o" replace url="/platform/mobile/theRapyRecuperation/index">疗休养报名
</van-tabbar-item>
<van-tabbar-item icon="manager-o" replace url="/platform/mobile/theRapyRecuperation/myRecuperation">我的疗休养
</van-tabbar-item>
</van-tabbar>
</div>
</div>
<script>
function getQueryString(name) {
@@ -437,14 +551,23 @@ layout("/mobile/platform.html"){
return null;
}
let pdfh5 = null
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
isPdf: false,
lotValue: 0,
minDate: new Date(2010, 0, 1),
maxDate: new Date(2010, 0, 31),
holidays: [],
timeVisible: false,
active: 0,
tarBarActive: 0,
roomColumns: ['大床房', '标准间'],
bedColumns: ['1', '2'],
//companionColumns: ['亲属', '朋友'],
companionColumns: ['配偶', '子女'],
bedVisible: false,
roomVisible: false,
@@ -471,10 +594,76 @@ layout("/mobile/platform.html"){
scrollTop: 0,
fromUrlByMy: '',
enrollId: '',
configData: {},
timeArray: [],
defaultIndex: 0,
isHelpJoin: false,
userList: [],
show: false,
result: '',
helpUser: 1,
weekList: {
0: '周日',
1: '周一',
2: '周二',
3: '周三',
4: '周四',
5: '周五',
6: '周六',
},
chooseDate: [],
}
},
methods: {
calConfirm(date) {
const start = moment(date[0]).format('MM月DD日')
const end = moment(date[1]).format('MM月DD日')
this.formData.specificTime = start + '-' + end
this.timeVisible = false
},
daySelect(day) {
this.chooseDate = []
const date = moment(day[0])
for (let i = 1; i <= this.lotValue - 1; i++) {
const afterDate = date.clone().add(i, 'days')
const afterDateStr = moment(afterDate).format('YYYY-MM-DD')
if(this.holidays.includes(afterDateStr)) {
this.$toast(afterDateStr + '是节假日或前一天,不能选择')
this.$refs.cal.reset(null)
break
}
this.chooseDate.push(afterDateStr)
if(i === (this.lotValue - 1)) {
const afterDate = date.clone().add(this.lotValue - 1, 'days')
const afterDateStr = moment(afterDate).format('YYYY-MM-DD')
day[1] = new Date(afterDateStr)
this.$refs.cal.reset(day)
}
}
this.$forceUpdate()
},
formatter(day) {
const date = moment(day.date).format('YYYY-MM-DD')
if(this.timeArray.indexOf(date) === -1) {
day.type = 'disabled'
}
if(this.chooseDate.length > 0 && this.chooseDate.includes(date)) {
day.className = 'cal_middle'
if(date === this.chooseDate[this.chooseDate.length - 1]) {
day.className = 'cal_end'
day.bottomInfo = '离店';
}
}
if (day.type === 'start') {
day.bottomInfo = '入住';
} else if (day.type === 'end') {
day.bottomInfo = '离店';
}
return day
},
roomCancel() {
if (!this.self) {
this.formData.companionList[this.active].bedInfo.bedType = ''
@@ -484,6 +673,14 @@ layout("/mobile/platform.html"){
roomConfirm(value, index) {
if (this.self) {
this.formData.bedInfo.bedType = value
if (value === '大床房') {
this.formData.bedInfo.bedNum = 1
this.formData.bedInfo.isSleepTogether = false
this.formData.bedInfo.otherSleepUser = ''
} else {
this.formData.bedInfo.bedNum = 2
this.formData.bedInfo.isSleepTogether = true
}
} else {
this.formData.companionList[this.active].bedInfo.bedType = value
}
@@ -501,12 +698,15 @@ layout("/mobile/platform.html"){
return value != null
},
async joinSubmit() {
const toast = vant.Toast.loading({
duration: 0,
forbidClick: true,
overlay: true,
message: '努力提交中',
})
let toast = null
if (!this.enrollId) {
toast = vant.Toast.loading({
duration: 0,
forbidClick: true,
overlay: true,
message: '努力提交中',
})
}
const cloneData = clone(this.formData)
cloneData.companionList.forEach((item, index) => {
if (item.userName === '') {
@@ -516,21 +716,38 @@ layout("/mobile/platform.html"){
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doSignUpForBaseManagement', {
enroll: JSON.stringify(cloneData),
})
setTimeout(() => {
if (this.enrollId) {
if (resp.code === 0) {
toast.message = '提交成功'
toast.type = 'success'
vant.Dialog.alert({
title: '温馨提示',
message: '修改成功,请务必联系并告知旅行社',
}).then(() => {
if (this.helpUser === 1) {
location.href = '/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index
}
})
} else {
toast.message = resp.msg
toast.type = 'fail'
vant.Toast(resp.msg)
}
} else {
setTimeout(() => {
toast.clear()
}, 500)
if (resp.code === 0) {
location.href = '/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index
}
}, 1000)
if (resp.code === 0) {
toast.message = '提交成功'
toast.type = 'success'
} else {
toast.message = resp.msg
toast.type = 'fail'
}
setTimeout(() => {
toast.clear()
}, 500)
if (resp.code === 0 && this.helpUser === 1) {
location.href = '/platform/mobile/theRapyRecuperation/myRecuperation?index=' + this.index
} else {
this.helpJoin();
}
}, 1000)
}
},
addCompanion() {
this.formData.companionList.push({userName: '', loginName: '', sex: '', relation: '', bedInfo: {}})
@@ -538,31 +755,78 @@ layout("/mobile/platform.html"){
delCompanion() {
this.formData.companionList.splice(this.active, 1)
},
async join() {
const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: this.baseData.id,
isNormal: this.baseData.isNormal,
id: this.enrollId
}),
})
if (re.code !== 0) {
vant.Toast(re.msg)
return
async helpJoin() {
this.formData = {
userName: "",
loginName: "",
unionName: "",
idCard: "",
mobile: "",
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
bedInfo: {},
}
if (this.fromUrlByMy !== 'editDo') {
this.formData = {
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
idCard: "${@shiro.getPrincipalProperty('idcard')}",
mobile: "${@shiro.getPrincipalProperty('mobile')}",
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
bedInfo: {},
this.helpUser = 0;
if(this.index == 3) {
await this.getTimeArray()
}
this.joinPopup = true
},
async join() {
this.helpUser = 1
if (this.fromUrlByMy !== 'find') {
const re = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: this.baseData.id,
isNormal: this.baseData.isNormal,
id: this.enrollId
}),
})
if (re.code !== 0) {
vant.Toast(re.msg)
return
}
if (this.fromUrlByMy !== 'editDo') {
this.formData = {
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
idCard: "${@shiro.getPrincipalProperty('idcard')}",
mobile: "${@shiro.getPrincipalProperty('mobile')}",
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
bedInfo: {},
}
this.formData.bedInfo.bedType = '大床房'
this.defaultIndex = this.formData.bedInfo.bedType === '标准间' ? "1" : "0"
this.formData.bedInfo.bedNum = 2
this.formData.bedInfo.isSleepTogether = true
}
//不是查看,是修改
const now_date = moment()//当前时间
let start = this.formData.specificTime ? this.formData.specificTime.split('-')[0] : '01月01日'
start = new Date().getFullYear() + '-' + start.replaceAll('月', '-').replaceAll('日', '')
const targetDate = new Date(start);
const previousThursdayDate = this.getPreviousThursday(targetDate);
const previousStr = previousThursdayDate.toISOString().split('T')[0]
let start_date = moment(previousStr) // 时间区间开始日期
//1.已经报名,2.当前时间大于活动开始时间(只要大于活动开始时间就表示错过了某个时间段)
if (this.enrollId && now_date >= start_date && this.formData.isTakePartIn === false) {
vant.Dialog.alert({
title: '温馨提示',
message: '您报的时间段已过,请联系管理员修改后方可修改',
})
return
}
if(this.index == 3) {
await this.getTimeArray()
}
this.$set(this.formData.bedInfo, 'bedType', '大床房')
}
this.joinPopup = true
},
@@ -574,8 +838,66 @@ layout("/mobile/platform.html"){
this.baseData = res.data
this.formData.baseName = this.baseData.baseName
this.skeLoading = false
//如果是四晚五天,就获取周一到周五
/*if (this.baseData.lotName === '四晚五天') {
this.timeArray = this.getTimeByLot1()
} else if (this.baseData.lotName === '两晚三天') {
this.timeArray = this.getTimeByLot2()
}*/
}
},
async getTimeArray() {
const res = await $.post('/platform/theRapyRecuperation/baseManagement/getTimeArray', {
id: this.id
})
this.timeArray = res.data.days
this.holidays = res.data.holidays
this.lotValue = Number(res.data.lotValue)
this.minDate = new Date(res.data.minDate)
this.maxDate = new Date(res.data.maxDate)
},
getTimeByLot1() {
let timeArray = []
let now_date = moment()//当前时间
let start_date = moment(this.baseData.activityStartTime) // 时间区间开始日期
let end_date = moment(this.baseData.activityEndTime) // 时间区间结束日期
while (start_date <= end_date) {
if (start_date.day() === 1) {
const week_start = start_date.format('MM月DD日')
const week_end = start_date.clone().add(4, 'day')
if (week_end <= end_date && now_date < start_date) {
timeArray.push(week_start + '-' + week_end.format('MM月DD日'))
}
start_date.add(7, 'day')
} else {
start_date.add(1, 'day')
}
}
return timeArray
},
getTimeByLot2() {
let timeArray = []
let now_date = moment()//当前时间
let start_date = moment(this.baseData.activityStartTime) // 时间区间开始日期
let end_date = moment(this.baseData.activityEndTime) // 时间区间结束日期
while (start_date <= end_date) {
if (start_date.day() === 5) {
const week_start = start_date.format('MM月DD日')
const week_end = start_date.clone().add(2, 'day')
if (week_end <= end_date && now_date < start_date) {
timeArray.push(week_start + '-' + week_end.format('MM月DD日'))
}
start_date.add(7, 'day')
} else {
start_date.add(1, 'day')
}
}
timeArray = timeArray.filter(v => {
return v !== '09月29日-10月01日' && v !== '10月06日-10月08日' && v !== '09月15日-09月17日'
})
return timeArray
},
// 点击图片回到顶部方法,加计时器是为了过渡顺滑
backTop() {
const that = this
@@ -611,31 +933,126 @@ layout("/mobile/platform.html"){
this.$forceUpdate()
}
},
async getConfigData() {
const resp = await $.get('/platform/theRapyRecuperation/TheRapyConfig/findOne')
this.configData = resp.data
getPreviousThursday(date) {
// 将输入日期转换为Date对象
const inputDate = new Date(date);
// 获取输入日期的星期几(0表示星期日,1表示星期一,以此类推)
const dayOfWeek = inputDate.getDay();
// 计算距离上一个周四还有多少天(0表示当前为周四)
const daysUntilPreviousThursday = (dayOfWeek + 7 - 4) % 7;
// 计算上一个周四的日期
const previousThursday = new Date(inputDate);
previousThursday.setDate(inputDate.getDate() - daysUntilPreviousThursday);
return previousThursday;
},
fn() {
this.show = true;
},
async delaySearch(query) {
if (query) {
const {data} = await $.get("/platform/fw/condolence/apply/queryUser", {query})
data.forEach(v => {
v.name = v.username + '(' + v.loginname + ')'
return v
})
this.userList = data
}
},
async toResult(loginname) {
const res = await $.post('/platform/theRapyRecuperation/line/enroll/validSignUpInfo', {
enroll: JSON.stringify({
takePartInBaseManagementId: this.baseData.id,
isNormal: true,
id: this.enrollId
}),
loginName: loginname
})
if (res.code !== 0) {
vant.Toast(res.msg)
return
}
const resp = await $.post('/platform/theRapyRecuperation/baseManagement/getUserByLoginName', {loginName: loginname})
if (resp.code === 0) {
const o = resp.data
this.formData = {
userName: o.username,
loginName: o.loginname,
unionName: o.unionname,
idCard: o.idcard,
mobile: o.mobile,
baseName: this.baseData.baseName,
takePartInBaseManagementId: this.baseData.id,
companionList: [],
bedInfo: {},
}
}
this.show = false
},
},
async created() {
this.id = getQueryString('id') ? getQueryString('id') : ''
this.enrollId = getQueryString('enrollId') ? getQueryString('enrollId') : ''
this.index = getQueryString('index') ? getQueryString('index') : ''
await this.getConfigData()
//编辑传出来的参数
this.fromUrlByMy = getQueryString('fromUrlByMy') ? getQueryString('fromUrlByMy') : ''
if (this.enrollId) {
await this.findSignUpInfoById()
}
this.getData()
await this.getData()
try {
const parser = new DOMParser();
const doc = parser.parseFromString(this.baseData.content, 'text/html');
const link = doc.querySelector('a');
const href = link.getAttribute('href');
this.$nextTick(() => {
pdfh5 = new Pdfh5('#demo', {
pdfurl: href,
});
})
}catch (e) {
this.isPdf = true
document.addEventListener('click', function (event) {
// 打印被点击的元素标签名和 class
if (event.target.tagName === 'IMG' && event.target.className !== 'top_icon') {
vant.ImagePreview({
images: [event.target.src],
closeable: true,
})
}
})
}
this.$nextTick(() => {
pdfh5.on("complete", function () {
const imgDoc = document.querySelectorAll('img')
let array = []
let classArray = []
imgDoc.forEach(o => {
if(o.getAttribute('class') !== 'top_icon') {
classArray.push(o.getAttribute('class'))
array.push(o.getAttribute('src'))
}
})
document.addEventListener('click', function (event) {
// 打印被点击的元素标签名和 class
if (event.target.tagName === 'IMG' && event.target.className !== 'top_icon') {
const index = classArray.indexOf(event.target.className)
if(index !== -1) {
vant.ImagePreview({
images: array,
startPosition: index,
closeable: true,
})
}
}
})
})
})
},
mounted() {
window.addEventListener('scroll', this.scrollToTop)
document.addEventListener('click', function (event) {
// 打印被点击的元素标签名和 class
if (event.target.tagName === 'IMG') {
vant.ImagePreview([event.target.src])
}
})
},
destroyed() {
window.removeEventListener('scroll', this.scrollToTop)