commit
This commit is contained in:
@@ -17,7 +17,9 @@ layout("/mobile/platform.html"){
|
||||
|
||||
.content {
|
||||
line-height: 26px;
|
||||
padding: 0px 20px 56px 20px;
|
||||
padding: 0 20px 56px 20px;
|
||||
max-height: calc(100vh - 46px - 210px - 60px - 24px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.title {
|
||||
@@ -159,9 +161,9 @@ layout("/mobile/platform.html"){
|
||||
color: grey;
|
||||
}
|
||||
|
||||
.header div span {
|
||||
color: grey;
|
||||
}
|
||||
/*.header div span {*/
|
||||
/* color: grey;*/
|
||||
/*}*/
|
||||
|
||||
.header :last-child {
|
||||
font-size: 14px;
|
||||
@@ -195,6 +197,11 @@ layout("/mobile/platform.html"){
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.pdf_div {
|
||||
padding-bottom: 70px;
|
||||
height: calc(100vh - 46px - 170px - 60px - 24px);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
@@ -235,8 +242,11 @@ layout("/mobile/platform.html"){
|
||||
</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>
|
||||
<!-- <div v-if="baseData.content" v-html="baseData.content" class="content"></div>-->
|
||||
<!-- <div v-else v-html="configData.notice" class="content"></div>-->
|
||||
<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>
|
||||
<!--<van-empty
|
||||
v-else class="custom-image"
|
||||
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
|
||||
@@ -254,11 +264,13 @@ layout("/mobile/platform.html"){
|
||||
<div class="footer" v-if="fromUrlByMy != 'edit'">
|
||||
<template v-if="baseData.isNormal==0&&baseData.isNormalFalse>0">
|
||||
<van-button @click="join"
|
||||
class="join">我要报名
|
||||
class="join">
|
||||
{{ (fromUrlByMy == 'editDo') ? '修改报名' : '我要报名' }}
|
||||
</van-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<van-button v-if="moment().unix() <= moment(baseData.signUpEndTime).unix()" @click="join" class="join">我要报名
|
||||
<van-button v-if="moment().unix() <= moment(baseData.signUpEndTime).unix()" @click="join" class="join">
|
||||
{{ (fromUrlByMy == 'editDo') ? '修改报名' : '我要报名' }}
|
||||
</van-button>
|
||||
<van-button v-if="moment().unix() > moment(baseData.signUpEndTime).unix()" class="join">报名结束</van-button>
|
||||
</template>
|
||||
@@ -280,8 +292,8 @@ layout("/mobile/platform.html"){
|
||||
<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 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>
|
||||
@@ -293,13 +305,24 @@ 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 :rules="[{ required: true, message: '请选择是否包房' }]" label="是否包房" name="bedType">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="formData.bedInfo.bedType">
|
||||
<van-radio name="包房" shape="square">包房</van-radio>
|
||||
<van-radio name="不包房" shape="square">不包房</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<div>
|
||||
<span style="color: red;margin-left: 14px;font-size: 14px">包房需自费;不包房两位老师一间且随机分配</span>
|
||||
</div>
|
||||
<!--<van-field @click="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"
|
||||
:rules="[{ required: true }]"></van-field>-->
|
||||
<!--<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>
|
||||
@@ -315,12 +338,12 @@ layout("/mobile/platform.html"){
|
||||
<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>
|
||||
|
||||
<!--随行人信息-->
|
||||
<div class="van-doc-card" style="margin-bottom: 16px">
|
||||
<div v-if="index != 2" class="van-doc-card" style="margin-bottom: 16px">
|
||||
<div></div>
|
||||
<div class="van-card-header"
|
||||
style="display: flex; justify-content: space-between; align-items: center">
|
||||
@@ -330,62 +353,73 @@ layout("/mobile/platform.html"){
|
||||
<van-tag @click="addCompanion" size="large" type="primary" color="#1867b0">添加随行人</van-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="formData.companionList.length > 0" class="van-card-body">
|
||||
<van-tabs v-model="active" type="card" color="#0e78c5" animated>
|
||||
<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 :rules="[{ required: true, message: '请选择性别' }]" label="性别" name="validator">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="item.sex">
|
||||
<van-radio name="男" shape="square">男</van-radio>
|
||||
<van-radio name="女" shape="square">女</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field label="身份证号" name="idCard" placeholder="请填写身份证号"
|
||||
:rules="[{ required: true }]" type="digit"
|
||||
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="与本人关系"
|
||||
name="relation"
|
||||
placeholder="随行人与本人关系" v-model="item.relation"
|
||||
:rules="[{ required: true }]"></van-field>
|
||||
|
||||
<van-field @click="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"
|
||||
readonly is-link label="床位"
|
||||
name="bedNum" placeholder="请选择床位" v-model="item.bedInfo.bedNum"></van-field>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间'"
|
||||
:rules="[{ validator, message: '请选择是否拼房' }]" label="是否拼房">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="item.bedInfo.isSleepTogether">
|
||||
<van-radio :name="true" shape="square">是</van-radio>
|
||||
<van-radio :name="false" shape="square">否</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间' && item.bedInfo.isSleepTogether == true"
|
||||
label="意向拼房人" name="otherSleepUser" placeholder="多个拼房人请用,隔开"
|
||||
v-model="item.bedInfo.otherSleepUser"></van-field>
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</div>
|
||||
<div v-if="formData.companionList.length == 0" class="companionList_empty_text">
|
||||
<template v-if="configData.familyInfo === 2">
|
||||
<div>
|
||||
<span style="color: red;margin-left: 20px;font-size: 14px">限填写3岁以上70岁以下随行人</span>
|
||||
</div>
|
||||
<div v-if="formData.companionList.length > 0" class="van-card-body">
|
||||
<van-tabs v-model="active" type="card" color="#0e78c5" animated>
|
||||
<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 :rules="[{ required: true, message: '请选择性别' }]" label="性别" name="validator">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="item.sex">
|
||||
<van-radio name="男" shape="square">男</van-radio>
|
||||
<van-radio name="女" shape="square">女</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field label="身份证件" name="idCard" placeholder="请填写身份证号"
|
||||
:rules="[{ required: true }]" maxlength="18"
|
||||
@input="getAgeAndSex(item)" 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="与本人关系"
|
||||
name="relation"
|
||||
placeholder="随行人与本人关系" v-model="item.relation"
|
||||
:rules="[{ required: true }]"></van-field>
|
||||
|
||||
<!--<van-field @click="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"
|
||||
readonly is-link label="床位"
|
||||
name="bedNum" placeholder="请选择床位" v-model="item.bedInfo.bedNum"></van-field>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间'"
|
||||
:rules="[{ validator, message: '请选择是否拼房' }]" label="是否拼房">
|
||||
<template #input>
|
||||
<van-radio-group direction="horizontal" v-model="item.bedInfo.isSleepTogether">
|
||||
<van-radio :name="true" shape="square">是</van-radio>
|
||||
<van-radio :name="false" shape="square">否</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field v-if="item.bedInfo.bedType == '标准间' && item.bedInfo.isSleepTogether == true"
|
||||
label="意向拼房人" name="otherSleepUser" placeholder="多个拼房人请用,隔开"
|
||||
v-model="item.bedInfo.otherSleepUser"></van-field>-->
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</div>
|
||||
<div v-if="formData.companionList.length == 0" class="companionList_empty_text">
|
||||
<span>
|
||||
如有随行人出行,请添加随行人
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<van-field label="家属数量" name="familyNumber" placeholder="请填写家属数量" v-model="formData.familyNumber"
|
||||
type="digit" :rules="[{ required: true }]"></van-field>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="submitButton">
|
||||
@@ -401,7 +435,7 @@ layout("/mobile/platform.html"){
|
||||
<!--房间类型弹出框-->
|
||||
<van-popup position="bottom" round v-model="roomVisible">
|
||||
<van-picker
|
||||
title="入住房间" show-toolbar
|
||||
title="房间信息" show-toolbar
|
||||
:columns="roomColumns"
|
||||
@confirm="roomConfirm"
|
||||
@cancel="roomCancel">
|
||||
@@ -436,16 +470,17 @@ layout("/mobile/platform.html"){
|
||||
if (r != null) return decodeURI(r[2]);
|
||||
return null;
|
||||
}
|
||||
|
||||
let pdfh5 = null
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins],
|
||||
data() {
|
||||
return {
|
||||
isPdf: false,
|
||||
active: 0,
|
||||
roomColumns: ['大床房', '标准间'],
|
||||
roomColumns: ['包房', '默认房间'],
|
||||
bedColumns: ['1', '2'],
|
||||
companionColumns: ['亲属', '朋友'],
|
||||
companionColumns: ['配偶', '子女', '亲属', '其他'],
|
||||
bedVisible: false,
|
||||
roomVisible: false,
|
||||
companionVisible: false,
|
||||
@@ -475,6 +510,18 @@ layout("/mobile/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getAgeAndSex(item){
|
||||
try {
|
||||
const value = item.idCard
|
||||
const age = this.calculateAgeFromIdCard(value)
|
||||
this.$set(item, "age", age)
|
||||
|
||||
const sex = this.getGenderFromIdCard(value)
|
||||
this.$set(item, "sex", sex)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
roomCancel() {
|
||||
if (!this.self) {
|
||||
this.formData.companionList[this.active].bedInfo.bedType = ''
|
||||
@@ -501,18 +548,43 @@ layout("/mobile/platform.html"){
|
||||
return value != null
|
||||
},
|
||||
async joinSubmit() {
|
||||
const toast = vant.Toast.loading({
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
overlay: true,
|
||||
message: '努力提交中',
|
||||
})
|
||||
const cloneData = clone(this.formData)
|
||||
cloneData.companionList.forEach((item, index) => {
|
||||
if (item.userName === '') {
|
||||
cloneData.companionList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
|
||||
if (cloneData.companionList) {
|
||||
for (let i = 0; i < cloneData.companionList.length; i++) {
|
||||
const companion = cloneData.companionList[i];
|
||||
// 检查每个字段是否为空
|
||||
if (!companion.userName || !companion.idCard || !companion.mobile || !companion.relation) {
|
||||
this.$toast('请填写完整随行人信息')
|
||||
return
|
||||
}
|
||||
|
||||
// 填了身份证,校验是否正确
|
||||
if (companion.idCard) {
|
||||
if (!this.validateIdCard(companion.idCard)) {
|
||||
this.$toast('随行人'+ (i+1) +'的身份证不正确')
|
||||
return
|
||||
} else {
|
||||
// 判断companion.age,是不是在3到70岁之间,不是就提示
|
||||
if (companion.age < 3 || companion.age > 70) {
|
||||
this.$toast('随行人'+ (i+1) +'的年龄超出限制,请天添加其他联系人')
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const toast = vant.Toast.loading({
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
overlay: true,
|
||||
message: '努力提交中',
|
||||
})
|
||||
const resp = await $.post('/platform/theRapyRecuperation/line/enroll/doSignUpForBaseManagement', {
|
||||
enroll: JSON.stringify(cloneData),
|
||||
})
|
||||
@@ -547,7 +619,10 @@ layout("/mobile/platform.html"){
|
||||
}),
|
||||
})
|
||||
if (re.code !== 0) {
|
||||
vant.Toast(re.msg)
|
||||
vant.Dialog.alert({
|
||||
title: '温馨提示',
|
||||
message: re.msg,
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.fromUrlByMy !== 'editDo') {
|
||||
@@ -615,6 +690,105 @@ layout("/mobile/platform.html"){
|
||||
const resp = await $.get('/platform/theRapyRecuperation/TheRapyConfig/findOne')
|
||||
this.configData = resp.data
|
||||
},
|
||||
calculateAgeFromIdCard(idCard) {
|
||||
// 检查身份证号码是否合法
|
||||
if (!idCard) {
|
||||
throw new Error("Invalid ID card format")
|
||||
}
|
||||
|
||||
let birthDateStr
|
||||
let birthYear, birthMonth, birthDay
|
||||
|
||||
// 处理18位身份证号码
|
||||
if (idCard.length === 18) {
|
||||
birthDateStr = idCard.substring(6, 14)
|
||||
birthYear = parseInt(birthDateStr.substring(0, 4), 10)
|
||||
birthMonth = parseInt(birthDateStr.substring(4, 6), 10) - 1 // 月份从0开始
|
||||
birthDay = parseInt(birthDateStr.substring(6, 8), 10)
|
||||
}
|
||||
// 处理15位身份证号码
|
||||
else if (idCard.length === 15) {
|
||||
birthDateStr = idCard.substring(6, 12)
|
||||
birthYear = parseInt("19" + birthDateStr.substring(0, 2), 10) // 使用字符串拼接
|
||||
birthMonth = parseInt(birthDateStr.substring(2, 4), 10) - 1 // 月份从0开始
|
||||
birthDay = parseInt(birthDateStr.substring(4, 6), 10)
|
||||
} else {
|
||||
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
|
||||
}
|
||||
|
||||
// 获取当前日期
|
||||
const currentDate = new Date()
|
||||
|
||||
// 计算年龄
|
||||
let age = currentDate.getFullYear() - birthYear
|
||||
|
||||
// 如果当前日期还没过生日,则年龄减1
|
||||
if (currentDate.getMonth() < birthMonth || (currentDate.getMonth() === birthMonth && currentDate.getDate() < birthDay)) {
|
||||
age -= 1
|
||||
}
|
||||
|
||||
return age
|
||||
},
|
||||
getGenderFromIdCard(idCard) {
|
||||
// 检查身份证号码是否合法
|
||||
if (!idCard) {
|
||||
throw new Error("Invalid ID card format")
|
||||
}
|
||||
|
||||
let genderDigit
|
||||
|
||||
// 处理18位身份证号码
|
||||
if (idCard.length === 18) {
|
||||
genderDigit = parseInt(idCard.charAt(16), 10) // 第17位
|
||||
}
|
||||
// 处理15位身份证号码
|
||||
else if (idCard.length === 15) {
|
||||
genderDigit = parseInt(idCard.charAt(14), 10) // 第15位
|
||||
} else {
|
||||
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
|
||||
}
|
||||
|
||||
// 判断性别
|
||||
if (genderDigit % 2 === 0) {
|
||||
return "女"
|
||||
} else {
|
||||
return "男"
|
||||
}
|
||||
},
|
||||
validateIdCard(idCard) {
|
||||
if (!idCard) {
|
||||
return false
|
||||
}
|
||||
|
||||
// 18位身份证号码校验
|
||||
if (idCard.length === 18) {
|
||||
const idCardRegex = /^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/
|
||||
if (!idCardRegex.test(idCard)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// 校验码计算
|
||||
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
|
||||
const checksums = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]
|
||||
let sum = 0
|
||||
for (let i = 0; i < 17; i++) {
|
||||
sum += idCard[i] * weights[i]
|
||||
}
|
||||
const checksum = checksums[sum % 11]
|
||||
return checksum === idCard[17].toUpperCase()
|
||||
}
|
||||
|
||||
// 15位身份证号码校验
|
||||
else if (idCard.length === 15) {
|
||||
const idCardRegex = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/
|
||||
return idCardRegex.test(idCard)
|
||||
}
|
||||
|
||||
// 外国人或其他情况
|
||||
else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.id = getQueryString('id') ? getQueryString('id') : ''
|
||||
@@ -626,7 +800,58 @@ layout("/mobile/platform.html"){
|
||||
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');
|
||||
console.log(this.baseData)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user