index.vue
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!--
* @Date: 2022-06-30 17:48:46
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-30 18:11:08
* @FilePath: /tswj/src/components/NoticeOverlayTest/index.vue
* @Description: 文件描述
-->
<template>
<van-overlay :show="showNotice" z-index="1000">
<div class="wrapper" @click.stop>
<div class="block">
<div style="position: absolute; top: -2rem; right: 1rem; font-size: 1.5rem;">
<van-icon name="close" color="#FFFFFF" @click="handleClose" />
</div>
<div>
<van-image width="100" height="100" :src="icon_notice" />
<p style="margin: 1rem; font-size: 1.15rem; font-weight: bold; color: #222222;">温馨提示</p>
</div>
<div style="color: #333333;">
<div v-html="noticeHtml" />
</div>
<div style="margin: 3rem 0;">
<my-button type="primary" @on-click="handleSubmit">{{ noticeText }}</my-button>
</div>
</div>
</div>
</van-overlay>
</template>
<script setup>
import MyButton from '@/components/MyButton/index.vue'
import icon_notice from '@images/que-tishi@2x.png'
import { USER_STATUS } from '@/constant'
const props = defineProps({
show: Boolean,
type: {
type: Number,
default: -1,
}
})
const emit = defineEmits(['on-close', 'on-submit']);
const handleClose = () => { // 关闭提示框回调
showNotice.value = false
emit('on-close', false)
}
// 底部按钮
const handleSubmit = () => {
emit('on-submit', false)
}
const noticeText = ref('')
const noticeHtml = ref('')
const showNotice = ref(false)
// 监听弹出框
watch(() => props.show, (v) => {
showNotice.value = v;
if (props.type === USER_STATUS.NON_VERIFIED) {
noticeText.value = '前往认证'
noticeHtml.value = `
<p>您还没有实名认证</p>
<p>请前往个人中心进行实名认证</p>
`
} else if (props.type === USER_STATUS.NON_DEFAULT_CHILD) {
noticeText.value = '前往新增'
noticeHtml.value = `
<p>您还没有新增儿童</p>
<p>请前往个人中心进行新增</p>
`
}
})
</script>
<style lang="less" scoped>
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: auto;
text-align: center;
}
.block {
width: 80%;
// height: 25rem;
background-color: #fff;
border-radius: 10px;
padding: 1rem;
position: relative;
margin-top: 1rem;
margin-bottom: 5rem;
}
</style>