mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-24 12:32:53 +08:00
121 lines
3.1 KiB
Vue
121 lines
3.1 KiB
Vue
<template>
|
||
<div class="loading-content flex justify-content-c align-items-c">
|
||
<div class="context-core text-center line-height">
|
||
正在跳转培训中心,请稍候...
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { Image, Lazyload, Grid, GridItem, Toast } from 'vant'
|
||
import { trainHomeUrl } from '@/api/ebiz/train/train.js'
|
||
|
||
export default {
|
||
components: {
|
||
[Toast.name]: Toast,
|
||
[Image.name]: Image,
|
||
[Grid.name]: Grid,
|
||
[GridItem.name]: GridItem,
|
||
[Lazyload.name]: Lazyload
|
||
},
|
||
data() {
|
||
return {
|
||
trainHomeUrl: '',
|
||
time: 9,
|
||
requestRes: '',
|
||
clickFlag: false
|
||
}
|
||
},
|
||
mounted() {
|
||
Toast.loading({
|
||
message: '加载中...',
|
||
forbidClick: true,
|
||
duration: 0,
|
||
loadingType: 'spinner'
|
||
})
|
||
setTimeout(() => {
|
||
this.initThisPage()
|
||
}, 1000)
|
||
},
|
||
methods: {
|
||
// 初始化页面
|
||
async initThisPage() {
|
||
let that = this
|
||
// eslint-disable-next-line no-undef
|
||
const response = await EWebBridge.webCallAppInJs('getDeviceInfo', {
|
||
secretKey: 'trainSecretKey'
|
||
})
|
||
|
||
// const response = await new Promise((resolve, reject) => {
|
||
// setTimeout(() => {
|
||
// resolve(JSON.stringify({ uuid: '232432413212' }))
|
||
// }, 2000)
|
||
// })
|
||
let jsonResponse = JSON.parse(response)
|
||
if (jsonResponse.uuid && jsonResponse.uuid != '') {
|
||
const res = await trainHomeUrl({ deviceCode: jsonResponse.uuid })
|
||
if (res.result == 0) {
|
||
window.location.href = res.homeUrlDTO.fullPath
|
||
} else {
|
||
this.$toast(res.resultMessage)
|
||
}
|
||
} else {
|
||
this.$toast(jsonResponse.errorMessage)
|
||
}
|
||
},
|
||
// 定时器
|
||
timeOut() {
|
||
let timer = setInterval(() => {
|
||
this.time--
|
||
if (this.time <= 0) {
|
||
this.time = 0
|
||
clearInterval(timer)
|
||
this.time = '-'
|
||
if (!this.clickFlag) {
|
||
window.location.href = this.trainHomeUrl
|
||
}
|
||
}
|
||
}, 1000)
|
||
},
|
||
// 点击跳转
|
||
async nextStep() {
|
||
this.clickFlag = true
|
||
if (!(this.trainHomeUrl && this.trainHomeUrl != '')) {
|
||
// eslint-disable-next-line no-undef
|
||
const response = await EWebBridge.webCallAppInJs('getDeviceInfo', {
|
||
secretKey: 'trainSecretKey'
|
||
})
|
||
let jsonResponse = JSON.parse(response)
|
||
if (jsonResponse.uuid && jsonResponse.uuid != '') {
|
||
trainHomeUrl({ deviceCode: jsonResponse.uuid }).then(res => {
|
||
console.log(res)
|
||
if (res.result == 0) {
|
||
this.trainHomeUrl = res.homeUrlDTO.fullPath
|
||
window.location.href = this.trainHomeUrl
|
||
} else {
|
||
this.$toast(res.resultMessage)
|
||
}
|
||
})
|
||
} else {
|
||
this.$toast(jsonResponse.errorMessage)
|
||
}
|
||
} else {
|
||
window.location.href = this.trainHomeUrl
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.loading-content {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
flex-direction: column;
|
||
}
|
||
.next-step {
|
||
text-decoration: underline;
|
||
color: #5ca5ea;
|
||
}
|
||
</style>
|