66 lines
1.4 KiB
Vue
66 lines
1.4 KiB
Vue
<template>
|
|
<u-popup :show="show" @close="close" @open="handlePopupOpen" mode="center" round="15">
|
|
<view style="height: 80vh; overflow-y: auto;width: 80vw" class="p-20">
|
|
<u-parse :content="agreement"/>
|
|
</view>
|
|
<u-button shape="circle" @click="close">关闭</u-button>
|
|
</u-popup>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: "agreement",
|
|
data() {
|
|
return {
|
|
agreement: '',
|
|
show: false,
|
|
readTimer: null,
|
|
readCompleted: false,
|
|
}
|
|
},
|
|
methods: {
|
|
open() {
|
|
this.getAgreement()
|
|
},
|
|
handlePopupOpen() {
|
|
this.startReadTimer()
|
|
},
|
|
startReadTimer() {
|
|
this.clearReadTimer()
|
|
if (this.readCompleted) return
|
|
this.readTimer = setTimeout(() => {
|
|
this.readTimer = null
|
|
this.readCompleted = true
|
|
this.$emit('read-complete')
|
|
}, 5000)
|
|
},
|
|
clearReadTimer() {
|
|
if (this.readTimer) {
|
|
clearTimeout(this.readTimer)
|
|
this.readTimer = null
|
|
}
|
|
},
|
|
close() {
|
|
this.clearReadTimer()
|
|
this.show = false
|
|
},
|
|
async getAgreement() {
|
|
const res = await vk.callFunction({
|
|
url: 'client/dict/pub/getDetail',
|
|
data: {
|
|
id: '65885d5b862066f18a4e4a36'
|
|
},
|
|
})
|
|
this.agreement = res.content
|
|
this.show = true
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
this.clearReadTimer()
|
|
},
|
|
mounted() {
|
|
|
|
},
|
|
}
|
|
</script>
|