web-base-pc/src/components/mustAgreeMent.vue

96 lines
2.1 KiB
Vue
Raw Normal View History

2025-03-23 09:23:38 +08:00
<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2023-04-27 15:54:20
-->
<template>
<el-dialog :visible.sync="centerDialogVisible"
width="30%"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
center>
<span>
<div class="xieyi">
<div v-for="(item, index) in agreementList.waresExtList"
:key="index"
v-show="item.isForcedRead == 0">
<div style="text-align: center; color: #333">
{{ item.title }}
</div>
<div v-html="item.content"></div>
</div>
</div>
</span>
<span slot="footer"
class="dialog-footer">
<el-button v-if="readTime > 0"
type="info"
2025-04-01 19:23:51 +08:00
disabled>{{'我已阅读以上协议'}}({{ readTime }})s</el-button>
2025-03-23 09:23:38 +08:00
<el-button type="primary" class="redBtn"
v-else
2025-04-01 19:23:51 +08:00
@click="toAgree">{{'我已阅读以上协议'}}</el-button>
2025-03-23 09:23:38 +08:00
</span>
</el-dialog>
</template>
<script>
import * as api from '@/api/register.js'
export default {
data() {
return {
centerDialogVisible: false,
agreementList: {},
readTime: 0,
// SP00014
}
},
watch: {
waresCodeList: {
deep: true,
handler(n) {
this.getAgreeMent(n)
},
},
},
props: {
waresCodeList: [],
},
methods: {
toAgree() {
this.centerDialogVisible = false
},
getAgreeMent(arr) {
api
.waresAgreement({
waresCodeList: arr,
})
.then((res) => {
this.agreementList = res.data
this.readTime = res.data.alertTime
if (this.readTime > 0) {
this.centerDialogVisible = true
this.timeInterval()
}
})
},
timeInterval() {
this.hasQyj = 0
let that = this
setInterval(() => {
if (that.readTime > 0) {
that.readTime--
}
}, 1000)
},
},
}
</script>
<style lang="scss" scoped>
.redBtn{
2025-04-29 10:44:04 +08:00
background: var(--primary-color);
border-color: var(--primary-color);
2025-03-23 09:23:38 +08:00
}
</style>