ann0707
2018-08-16 c9bc8ec61cff4076132f6396d99d383a2cdf5a03
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
<template>
    <div>
        <div class="weui-mask" v-show="show"></div>
        <div class="f-dialog" v-show="show">
            <!--<img v-if="dialogImgUrl" :src="dialogImgUrl" alt="弹窗提示">-->
            <div class="f-dialog-img">
                <img src="../../assets/img/collect_result_bg.png" alt="">
            </div>
            <h3 class="f-dialog-header" v-if="title">{{ title }}</h3>
            <!--内容在插槽中写-->
            <p class="f-dialog-content">
                <slot></slot>
            </p>
            <div class="f-dialog-footer dialog-single-footer"
                 v-if="type === 'confirm'"
                 @click="handleClickConfirm"
            >{{ confirmText }}</div>
            <div class="f-dialog-footer" v-if="type === 'dialog'">
                <span  @click="handleClickConfirm">{{ confirmText }}</span>
                <span  @click="handleClickCancel">{{ cancelText }}</span>
            </div>
        </div>
    </div>
 
</template>
 
<script>
    /**
     * Created by c.y on 2018/3/16.
     * 组件的命名 项目名(F---filean) + 组件的描述(区别与框架的组件)
     * 全局的对话框
     */
    export default {
        name: 'f-confirm',
        methods: {
            // 点击确认事件
            handleClickConfirm () {
                this.$emit('on-click-confirm');
            },
            // 点击取消事件
            handleClickCancel () {
                this.$emit('on-click-cancel');
            }
        },
        model: {
            prop: 'show',
        },
        props: {
            show: {
                type: Boolean,
                default: false
            },
            // 弹窗的图标
            dialogImgUrl: String,
            // title
            title: String,
            // 确认文字
            confirmText: String,
            // 取消文字
            cancelText: String,
            // type为两个,一个为confirm即底部只有一个按钮,dialog是有两个按钮
            type: {
                type: String,
                default: 'confirm'
            }
        }
    }
</script>
 
<style lang="less">
    @import "../../style/mixin";
    .f-dialog {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
        width: 280px;
        min-height: 128px;
        text-align: center;
        border-radius: @border-radius-normal-size;
        background: @color-white;
        z-index: 1000;
        .f-dialog-img {
          position: relative;
          height: 40px;
            img {
                position: absolute;
                left: 50%;
                top: -32px;
                width: 64px;
                height: 64px;
                transform: translate(-50%,0);
                border-radius: 50%;
            }
        }
        .f-dialog-header {
            padding-top: 9px;
            font-size: @font-size-large;
            line-height: 2.14;
            font-weight: normal;
            color: @color-text-primary;
        }
        .f-dialog-content {
            font-size: @font-size-medium;
            line-height: 1.6;
            color: @color-text-secondary;
            padding-bottom: 14px;
        }
        .f-dialog-footer {
            position: relative;
            width: 100%;
            height: 44px;
            line-height: 44px;
            font-size: @font-size-primary;
            color: @color-text-third;
            text-align: center;
            .flexLayout();
            span {
                flex: 1;
                &:last-child {
                    position: relative;
                    color: @color-primary;
                    &:before {
                        .setLeftLine(@color-divider-regular);
                    }
                }
            }
            &:before {
                .setTopLine(@color-divider-regular);
            }
        }
        .dialog-single-footer {
            display: block;
            color: @color-primary;
        }
    }
</style>