pdf加载测试

This commit is contained in:
na.guo
2020-08-13 15:40:44 +08:00
parent b0234a0705
commit 1bd124eade
6 changed files with 129 additions and 34 deletions

View File

@@ -1,4 +1,5 @@
import request from '@/assets/js/utils/request'
import request1 from '@/assets/js/utils/request1'
import getUrl from '@/assets/js/utils/get-url'
// 保费计算
@@ -52,7 +53,13 @@ export function getOrderDetail(data) {
data
})
}
export function getOrderDetail1(data) {
return request1({
url: getUrl('/sale/order/orderDetail', 1),
method: 'post',
data
})
}
// 获取验证码
export function getAuthCode(data) {
return request({

View File

@@ -69,6 +69,7 @@ let productStore = [
'/customer/shop/getShopList', //获取商城列表/详情
'/customer/shop/getShareList' //查询分享轨迹(转发记录)
]
// 卡单
let cardList = []
let whiteList = ['/customer/agent/getCustomersList', ...proposal, ...sale, ...agentEnter, ...claims, ...survey, ...manpower, ...productStore]
@@ -83,12 +84,12 @@ service.interceptors.request.use(
config => {
let relativePath = config.url && config.url.split('v1')[1]
if (whiteList.includes(relativePath)) {
Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
// Toast.loading({
// duration: 0, // 持续展示 toast
// forbidClick: true, // 禁用背景点击
// loadingType: 'spinner',
// message: '加载中……'
// })
}
config.headers['token'] = window.localStorage.getItem('token')
@@ -105,6 +106,7 @@ service.interceptors.request.use(
service.interceptors.response.use(
response => {
const res = response.data
console.log(res, 'res')
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {

View File

@@ -0,0 +1,70 @@
import axios from 'axios'
import { Dialog, Toast } from 'vant'
let sale = ['/sale/order/orderDetail'] //在线投保
// 卡单
let cardList = []
let whiteList = [...sale]
// 创建axios实例
const service = axios.create({
timeout: 66666666 // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
config => {
let relativePath = config.url && config.url.split('v1')[1]
if (whiteList.includes(relativePath)) {
// Toast.loading({
// duration: 0, // 持续展示 toast
// forbidClick: true, // 禁用背景点击
// loadingType: 'spinner',
// message: '加载中……'
// })
}
config.headers['token'] = window.localStorage.getItem('token')
// config.headers['token'] = ``
return config
},
error => {
// Do something with request error
Promise.reject(error)
}
)
// respone拦截器
service.interceptors.response.use(
response => {
const res = response.data
console.log(res, 'res')
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return response.data.content
}
},
error => {
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
)
export default service

View File

@@ -0,0 +1,15 @@
// 全屏loading工具类
import { Toast } from 'vant'
import Vue from 'vue'
Vue.use(Toast)
export function openLoading() {
Toast.loading({
mask: true,
message: '加载中...',
duration: 0 // 持续展示 toast
})
}
export function closeLoading() {
Toast.clear()
}

View File

@@ -25,6 +25,7 @@
<script>
import { RadioGroup, Radio, Dialog, NoticeBar } from 'vant'
import { saveInformation, getOrderDetail } from '@/api/ebiz/sale/sale'
import config from '@/config'
// import axios from 'axios'
export default {
@@ -210,7 +211,17 @@ export default {
},
// 点击签名
sign(val) {
console.log('签名参数',this.saleInsuredInfo.idNo,this.saleInsuredInfo.name,this.saleInsuredInfo.idType,'keyword'+':'+ '签字日期','pageNo'+':'+ '1','index'+':'+ '1','offset'+':'+ '-150','pos'+':'+ '3')
console.log(
'签名参数',
this.saleInsuredInfo.idNo,
this.saleInsuredInfo.name,
this.saleInsuredInfo.idType,
'keyword' + ':' + '签字日期',
'pageNo' + ':' + '1',
'index' + ':' + '1',
'offset' + ':' + '-150',
'pos' + ':' + '3'
)
let that = this
this.$toast.loading({
duration: 0, // 持续展示 toast

View File

@@ -1,9 +1,7 @@
<template>
<div class="insuranceInformation-container pb50 redRadioCheckbox">
<van-notice-bar :scrollable="false" v-if="!Time" class="notice">{{ `提示阅读时长需在${this.Time ? this.time : this.number}秒以上` }}</van-notice-bar>
<iframe :src="src" class="iframe"></iframe>
<iframe :src="src + appntSign.policyUrl" class="iframe"></iframe>
<van-radio-group v-model="radio" class="pb10 pt20 pl30 fs14">
<van-radio name="1" @click="click">
本人确认已阅读
@@ -25,8 +23,8 @@
</template>
<script>
import { RadioGroup, Radio, Dialog, NoticeBar } from 'vant'
import { saveInformation, getOrderDetail } from '@/api/ebiz/sale/sale'
import { saveInformation, getOrderDetail1 } from '@/api/ebiz/sale/sale'
import { openLoading, closeLoading } from '@/assets/js/utils/toastLoading.js'
import config from '@/config'
// import axios from 'axios'
export default {
@@ -63,8 +61,7 @@ export default {
saleInsuredInfo: {},
// 是否从详情跳过来 如果为1 是
detailJump: '',
src: '',
src1: location.origin + '/pdfjs/web/viewer.html?file=',
src: location.origin + '/pdfjs/web/viewer.html?file=',
//保险产品名称
riskName: localStorage.riskName
}
@@ -79,6 +76,10 @@ export default {
let that = this
document.body.style.backgroundColor = '#fff'
setTimeout(function() {
closeLoading()
that.timeOut()
}, 5000)
},
async created() {
let that = this
@@ -138,35 +139,26 @@ export default {
} else {
console.log('````````````````````````')
console.log('第一次进入电子保单')
setTimeout(function() {
closeLoading()
this.timeOut()
}, 5000)
this.getOrderDetail()
}
} else {
setTimeout(function() {
that.timeOut()
}, 5000)
this.timeOut()
if (this.detailJump != '1') {
this.getOrderDetail()
}
}
},
methods: {
loadings() {
this.$toast.loading({
mask: true,
message: '加载中...',
duration: 2000
})
},
closeLoadings() {
this.$toast.clear()
},
timeOut() {
let that = this
let time = that.time
that.Time = false
that.number = `${time}`
let timer = setInterval(() => {
time--
if (time <= 0) {
@@ -181,13 +173,13 @@ export default {
},
// 获取签名状态
getOrderDetail() {
// showFullScreenLoading()
openLoading()
let that = this
let data = {
orderNo: window.localStorage.getItem('orderNo')
}
return new Promise((resolve, reject) => {
getOrderDetail(data).then(res => {
getOrderDetail1(data).then(res => {
if (res.result == '0') {
res.orderDTO.ebizSignDTOS.map(item => {
if (item.signType == '0' || item.signType == '2') {
@@ -198,8 +190,6 @@ export default {
}
})
that.appntSign.policyUrl = encodeURIComponent(config.imgDomain + `/returnDirectStream?imgPath=${that.appntSign.policyUrl}`)
this.src = location.origin + '/pdfjs/web/viewer.html?file=' + that.appntSign.policyUrl
console.log(location.origin + '/pdfjs/web/viewer.html?file=' + that.appntSign.policyUrl, 'that.appntSign.policyUrl')
if (that.isWeixin) {
if (res.orderDTO.ebizSignDTOS.length > 1) {
if (that.appntSign.documentStatus == '3') {