shuishen
2023-07-07 c5ff93f67775f4a2bc0ffabd6c24cb46e5226df0
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
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-04-04 16:24:42
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-07-07 15:09:44
 * @FilePath: \srs-police-affairs\src\components\warningSelect\index.vue
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
-->
<template>
    <div class="container" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.5)">
        <div v-for="(item, index) in imageUrls" :key="index" @click.stop="curImgClick(item)">
            <div class="content">
                <el-tooltip class="item" effect="dark" :content="item.title" placement="top">
                    <img :src="item.url" alt />
                </el-tooltip>
            </div>
        </div>
    </div>
</template>
 
<script>
import { getIconsAll } from "@/api/icons/index"
export default {
    name: 'WarningSelect',
 
    data () {
        return {
            imageUrls: [],
            loading: false
        }
    },
 
    created () {
        this.requireImage()
    },
 
    methods: {
        requireImage () {
            this.imageUrls = [
                {
                    url: '/warnings/防范区1.png',
                    title: '防范区1',
                },
                {
                    url: '/warnings/防范区2.png',
                    title: '防范区2',
                },
                {
                    url: '/warnings/防范区3.png',
                    title: '防范区3',
                },
                {
                    url: '/warnings/核心区1.png',
                    title: '核心区1',
                },
            ]
 
 
            // getIconsAll().then(res => {
            //     res.data.data.forEach(item => {
            //         let imgArr = item.split('/')
 
            //         let title = imgArr[imgArr.length - 1].split('.')[0]
 
            //         this.imageUrls.push({
            //             url: item,
            //             title
            //         })
            //     })
            //     this.loading = false
            // })
        },
 
        curImgClick (item) {
            this.$emit('curClick', item.url, 2)
        }
    },
}
</script>
 
<style lang="scss" scoped>
.container {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 999999;
    display: flex;
    flex-wrap: wrap;
 
    min-width: 420px;
    max-height: 360px;
    overflow-x: hidden;
    overflow-y: auto;
    background: $el-dialog-bg-color;
    border-radius: 10px;
 
    &>div {
        padding: 6px;
        margin: 10px;
        width: 400px;
        height: 80px;
        cursor: pointer;
        border: 1px solid #fff;
        border-radius: 8px;
        box-sizing: content-box;
 
        &:hover {
            color: #409eff;
            border-color: #409eff;
        }
 
        .content {
            position: relative;
            height: 80px;
 
            img {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                margin: auto;
                width: 400px;
                height: 80px;
            }
        }
    }
}
</style>