调整阅读文件页面基础代码逻辑

This commit is contained in:
liu.xiaofeng@ebiz-digits.com
2023-10-23 17:03:31 +08:00
parent c6948a98ca
commit c2e1e6b3c7
3 changed files with 76 additions and 138 deletions

View File

@@ -29,29 +29,29 @@ function getSearchString (key) {
} }
return obj[key] return obj[key]
} }
let apiVersion = 'v2' let apiVersion = 'v1'
var ua = window.navigator.userAgent.toLowerCase() // var ua = window.navigator.userAgent.toLowerCase()
//通过正则表达式匹配ua中是否含有MicroMessenger字符串, 在微信 // //通过正则表达式匹配ua中是否含有MicroMessenger字符串, 在微信
if (localStorage.getItem('apiVersion')) { // if (localStorage.getItem('apiVersion')) {
apiVersion = localStorage.getItem('apiVersion') // apiVersion = localStorage.getItem('apiVersion')
} else { // } else {
if (ua.match(/MicroMessenger/i) == 'micromessenger') { // if (ua.match(/MicroMessenger/i) == 'micromessenger') {
//report/reportList数据报表页面在浏览器可以打开了但在微信或企业微信中打开不了,接口请求不需要token // //report/reportList数据报表页面在浏览器可以打开了但在微信或企业微信中打开不了,接口请求不需要token
if (window.location.href.indexOf('apiVersion') > 0) { // if (window.location.href.indexOf('apiVersion') > 0) {
apiVersion = getSearchString('apiVersion') == 'V3' ? 'v3' : 'v2';//url中apiVersion没有时为v2 // apiVersion = getSearchString('apiVersion') == 'V3' ? 'v3' : 'v2';//url中apiVersion没有时为v2
} else { // } else {
apiVersion = 'v3' // apiVersion = 'v3'
} // }
} else { // } else {
// 在app // // 在app
if (navigator.userAgent.indexOf('JZG_') > 0) { // if (navigator.userAgent.indexOf('JZG_') > 0) {
apiVersion = navigator.userAgent.split('JZG_')[1].split('/')[0].split('_')[1] == 'V3' ? 'v3' : 'v2' // apiVersion = navigator.userAgent.split('JZG_')[1].split('/')[0].split('_')[1] == 'V3' ? 'v3' : 'v2'
} // }
} // }
window.localStorage.setItem('apiVersion', apiVersion) // window.localStorage.setItem('apiVersion', apiVersion)
} // }
// 可以多个接口域名,按需添加 // // 可以多个接口域名,按需添加
console.log('环境:', process.env.VUE_APP_FLAG) // console.log('环境:', process.env.VUE_APP_FLAG)
switch (process.env.VUE_APP_FLAG) { switch (process.env.VUE_APP_FLAG) {
case 'dev': case 'dev':
apiDomain = 'https://iagentsales-test2.e-guofu.com:5200/api/' + apiVersion // 国富api ///api/v1 apiDomain = 'https://iagentsales-test2.e-guofu.com:5200/api/' + apiVersion // 国富api ///api/v1

View File

@@ -859,6 +859,7 @@ export default {
// 手机号鉴权 --通过 // 手机号鉴权 --通过
let res = await this.realPeopleCheckMobile('appnt') let res = await this.realPeopleCheckMobile('appnt')
if (res && res.result == '0') { if (res && res.result == '0') {
debugger
that.goUrl() that.goUrl()
return return
} }
@@ -872,6 +873,9 @@ export default {
if (res.result === '0') { if (res.result === '0') {
// 在白名单内 // 在白名单内
if (res.content && res.content.length) { if (res.content && res.content.length) {
console.log(this.appntSign)
console.log(this.insuredSign)
debugger
this.goUrl() this.goUrl()
return return
} }

View File

@@ -1,64 +1,46 @@
<template> <template>
<div class='insuranceInformation-container pb50 redRadioCheckbox'> <div class='insuranceInformation-container redRadioCheckbox'>
<van-notice-bar :scrollable='false' v-if='!Time' class='notice'> <van-notice-bar :scrollable='false' v-if='!Time' class='notice'>
{{ `提示:阅读时长需在${this.Time ? this.time : this.number}秒以上` }} {{ `提示:阅读时长需在${this.Time ? this.time : this.number}秒以上` }}
</van-notice-bar> </van-notice-bar>
<div id="pdf" style="height: 70vh;overflow: scroll;background: #eee;"> <div style="height: 5vh;">
顶部导航
</div>
<div id="pdf" style="height: 75vh;overflow: scroll;background: #eee;">
<div id="pdfH5ID"></div> <div id="pdfH5ID"></div>
</div> </div>
<van-radio-group v-model='radio' class='pb10 pt20 pl30 fs14'> <div style="height: 20vh;">
<van-radio name='1' @click='click'> <van-radio-group v-model='radio' class='pb10 pt20 pl30 fs14'>
本人确认已阅读<span>国富人寿保险股份有限公司委托代理合同</span> <van-radio name='1' @click='click'>
</van-radio> 本人确认已阅读<span>国富人寿保险股份有限公司委托代理合同</span>
</van-radio-group> </van-radio>
<div class='pt30 pl30 flex align-items-c'> </van-radio-group>
<span class='mr10'>代理人签名 :</span> <div class='bg-white bottom-btn'>
<van-button type='danger' size='small' :disabled="signBtnDisable" @click="sign" v-no-more-click='1000'> <van-button type='danger' size='large' :disabled='isDisabledComplite' @click='goNext' v-no-more-click='1000'>提交
{{signInfo.status == '1' ? '签名' : '已签名' }} </van-button>
</van-button>
<img v-if="signH5Img" :src="signImgUrl" style="height: 34px;margin-left: 20px;width: auto;"/>
</div>
<div class='bg-white bottom-btn'>
<van-button type='danger' size='large' :disabled='isDisabledComplite' @click='goNext' v-no-more-click='1000'>提交
</van-button>
</div>
<van-popup v-model="signSuccessShow" :close-on-click-overlay="false" round>
<div style="width: 300px;height: 150px;text-align: center;">
<div style="margin-top: 30px;font-size: 20px;">提交结果</div>
<div style="margin-top: 30px;font-size: 16px;display: flex;justify-content: center;align-items: center;">
<img src="@/assets/images/ebiz/radio-active.png" style="width: 25px;height: 25px;"/>
<span style="margin-left: 15px;">签署成功</span>
</div>
</div> </div>
</van-popup> </div>
</div> </div>
</template> </template>
<script> <script>
import { RadioGroup, Radio, Dialog, NoticeBar } from 'vant' import { RadioGroup, Radio, Dialog, NoticeBar } from 'vant'
import config from '@/config'
import { generateAgreementYB, putContractInfo } from '@/api/ebiz/YB_agentSign/YB_agentSign'
import Pdfh5 from "pdfh5"; import Pdfh5 from "pdfh5";
import {
getOrderDetail
} from '@/api/ebiz/sale/sale'
export default { export default {
data() { data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
return { return {
time:'10', time:'10',
radio: '', radio: '',
number: '', number: '',
src: location.origin + '/pdfjs/web/viewer.html?file=', src: location.origin + '/pdfjs/web/viewer.html?file=',
pdfUrl: '', pdfUrl: '',
signVal: '2',
base64: '',
signBtnDisable: true,
isDisabledComplite:true, isDisabledComplite:true,
isOver: false, isOver: false,
signInfo: { signInfo: {
status: '1' status: '1'
}, },
signSuccessShow:false,
signImgUrl:'data:image/gif;base64,',
signH5Val: '',
signH5Img: '',
pdfh5: null pdfh5: null
} }
}, },
@@ -73,45 +55,30 @@
}, },
mounted() { mounted() {
document.body.style.backgroundColor = '#fff' document.body.style.backgroundColor = '#fff'
this.$toast.loading({ this.pdfh5 = new Pdfh5("#pdfH5ID", {
duration: 0, // 持续展示 toast // pdfurl: config.assetsUpUrl + res.content.rgssUrl,
forbidClick: true, // 禁用背景点击 pdfurl: 'https://iagentsales-test2.e-guofu.com/opt/ebiz/webapps/ebiz-epolicy/pdf/2023/08/09/1000001078372351/1000001078372351.pdf',
loadingType: 'spinner', lazy:false,
message: '加载中……' scale:1
}) }).on("complete", function (status, msg, time) { //监听完成事件
let dataParams = { console.log("状态:" + status + ",信息:" + msg + ",耗时:" + time + "毫秒,总页数:" + this.totalNum)
idType:'0',
idNo:this.$store.getters.getYBidNo,
name:this.$store.getters.getYBname
}
generateAgreementYB(dataParams).then(res=>{
this.$toast.clear()
if(res.result == 0){
window.sessionStorage.setItem('signName',this.$store.getters.getYBname)
// this.pdfUrl = config.assetsUpUrl + res.content.rgssUrl
//实例化
this.pdfh5 = new Pdfh5("#pdfH5ID", {
pdfurl: config.assetsUpUrl + res.content.rgssUrl,
// pdfurl: 'https://iagentsales-test2.e-guofu.com/opt/ebiz/webapps/ebiz-epolicy/pdf/2023/08/09/1000001078372351/1000001078372351.pdf',
lazy:false,
scale:1
}).on("complete", function (status, msg, time) { //监听完成事件
console.log("状态:" + status + ",信息:" + msg + ",耗时:" + time + "毫秒,总页数:" + this.totalNum)
})
this.signH5Img = sessionStorage.getItem('signH5Img')
if(this.signH5Img){
this.$set(this.signInfo, 'status', '2')
this.radio = '1'
this.Time = true
this.isOver = true
this.signImgUrl = this.signImgUrl + this.signH5Img
}
}else{
this.$toast(res.resultMessage)
}
}) })
this.getOrderDetail()
}, },
methods: { methods: {
getOrderDetail(){
let params = {
orderNo: this.$route.query.orderNo,
getOtherType: 'RID'
}
getOrderDetail(params).then(res=>{
if(res.result == 0){
}else{
this.$toast(res.resultMessage)
}
})
},
// 点击阅读时 // 点击阅读时
click() { click() {
let that = this let that = this
@@ -135,81 +102,45 @@
if (time <= 0) { if (time <= 0) {
time = 0 time = 0
clearInterval(timer) clearInterval(timer)
that.Time = true that.Time = true
that.isOver = true that.isOver = true
// window.localStorage.setItem('step', '1')
} }
that.number = `${time}` that.number = `${time}`
}, 1000) }, 1000)
}, },
sign() {
window.location.href = 'http://'+window.location.host + '/signH5/1.html'
},
goNext(){ goNext(){
// this.signSuccessShow = true
// window.localStorage.removeItem('signInfo')
let params = {
uuid:this.$store.getters.getYBuuid,
signInfo: window.sessionStorage.getItem('signH5Val')
}
putContractInfo(params).then(res=>{
if(res.result == 0){
this.signSuccessShow = true
window.localStorage.removeItem('signInfo')
}else{
this.$toast(res.resultMessage)
}
})
} }
}, },
computed: { computed: {
listenChange() { listenChange() {
const { isOver, radio, signInfo } = this const { isOver, radio } = this
return { isOver, radio, signInfo } return { isOver, radio }
} }
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
window.sessionStorage.removeItem('signH5Val')
document.body.style.backgroundColor = '' document.body.style.backgroundColor = ''
next() next()
}, },
watch: { watch: {
listenChange(val) { listenChange(val) {
let that = this let that = this
if (that.signVal == '0' || that.signVal == '2') { if (val.isOver == true && val.radio != '') {
if (val.isOver == true && val.radio != '') { that.isDisabledComplite = false
that.signBtnDisable = false } else {
} else { that.isDisabledComplite = true
that.signBtnDisable = true
}
if (that.radio == '1' && val.signInfo.status == '2') {
that.isDisabledComplite = false
} else {
that.isDisabledComplite = true
}
} }
} }
} }
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
img {
width: 100%;
height: 100%;
}
.notice { .notice {
width: 100%; width: 100%;
position: fixed; position: fixed;
top: 0; top: 0;
z-index: 20; z-index: 20;
} }
.iframe {
width: 100vw;
height: 70vh;
}
#pdfH5ID{ #pdfH5ID{
width: 100vw; width: 100vw;
} }
@@ -227,4 +158,7 @@
width: 96vw; width: 96vw;
} }
} }
/deep/ .pinch-zoom-container{
height: 600px!important;
}
</style> </style>