You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.2 KiB
64 lines
1.2 KiB
<template>
|
|
<view>
|
|
<web-view :src="url"></web-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { back } from '@/utils/hook.js'
|
|
import { makeSocket } from '@/utils/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
url: '',
|
|
socket: null
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
if (option) {
|
|
this.url = decodeURIComponent(option.url)
|
|
console.log(this.url, option)
|
|
} else {
|
|
uni.showToast({
|
|
title: '参数错误',
|
|
icon: 'none',
|
|
complete: () => {
|
|
setTimeout(() => {
|
|
back()
|
|
}, 1000)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
created() {
|
|
makeSocket({ pageInfo: 'page-view', retry: true }).then((res) => {
|
|
this.socket = res
|
|
this.socket.onMessage(this.getMessage)
|
|
})
|
|
},
|
|
methods: {
|
|
getMessage(data) {
|
|
// 签约成功
|
|
if (data.type == 'signSuccess') {
|
|
// go2('paper-mall-order-detail', { id: data.orderId }, true)
|
|
}
|
|
// 实名认证成功
|
|
if (data.type == 'certificatedSuccess') {
|
|
back()
|
|
}
|
|
},
|
|
destroySocket() {
|
|
if (this.socket) {
|
|
this.socket.close()
|
|
this.socket = null
|
|
}
|
|
}
|
|
},
|
|
destroyed() {
|
|
this.destroySocket()
|
|
},
|
|
onHide() {
|
|
this.destroySocket()
|
|
}
|
|
}
|
|
</script>
|