1
fei.wang
2025-03-07 1b6a3e58e8d3f9a4a56810b5433e28230fe8f3bb
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<template>
    <view class="success-box">
        <tn-popup v-model="show" mode="center" length="84%" :borderRadius="20">
            <view class="pop-box">
                <view class="pop-img-box" v-if="type == 'success'">
                    <image src="../static/success.png" style="width:60px;height:60px;"></image>
                </view>
                <view class="pop-tip" v-if="type == 'success'">{{txt}}</view>
 
                <view class="pop-alert-box" v-if="type == 'error' || type == 'warning'">
                    <image class="error-icon" src="../static/error.png" v-if="type == 'error'"
                        style="width:38px;height:38px;"></image>
                    <image class="error-icon" src="../static/warning.png" v-if="type == 'warning'"
                        style="width:38px;height:38px;"></image>
                </view>
 
                <view class="pop-alert-tip" v-if="type == 'error' || type == 'warning'">{{txt}}</view>
                <view class="pop-alert-know" v-if="type == 'error' || type == 'warning'" @click="closeBox">我知道了</view>
 
            </view>
        </tn-popup>
    </view>
</template>
 
<script>
    export default {
        components: {},
        data() {
            return {
                show: false,
                type: 'success',
                txt: '提交成功!'
            }
        },
        props: {
 
        },
        methods: {
 
            showBox(obj) {
                this.type = obj.type
                this.txt = obj.txt
                this.show = true;
                if (this.type == 'success') {
                    setTimeout(() => {
                        this.show = false;
                    }, 2000)
                }
            },
            closeBox() {
                this.show = false;
            },
            confirm() {
 
            }
        }
    }
</script>
 
<style scoped lang="scss">
    .success-box {
        width: 100%;
        background-color: #fff;
        border-radius: 8px;
 
        .pop-box {
            position: relative;
 
        }
 
        .pop-img-box {
            margin-top: 25px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
 
        .pop-alert-box {
            height: 74px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
 
        .pop-tip {
            height: 22px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #000;
            font-size: 16px;
            margin-top: 20px;
            margin-bottom: 20px;
        }
 
        @keyframes print {
            from {
                opacity: 0.1;
            }
 
            /* 第二种状态 */
            to {
                opacity: 1;
            }
 
            /* 结束状态 */
        }
 
        .pop-alert-tip {
            min-height: 20px;
            padding:0 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: rgba(35, 35, 35, 0.8);
            font-size: 14px;
            padding-bottom: 15px;
            margin-bottom: 10px;
            animation-name: print;
            animation-duration: 1s;
            animation-iteration-count: 1;
        }
 
        .pop-alert-know {
            height: 46px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #000;
            font-size: 16px;
            border-top: 1px solid rgba(35, 35, 35, 0.2);
        }
 
        .error-icon {
            animation: shake-left 1s 1;
        }
 
        @keyframes shake-left {
            from {
                transform: rotate(-45deg) translateX(-10px);
            }
 
            /* 初始位置 */
            to {
                transform: rotate(0deg) translateX(0px);
            }
 
            /* 返回原位置 */
        }
 
    }
</style>