sf
jiangping
2025-04-30 dcdb0231034810232f2542f3865666ebf72daf11
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
<template>
    <view class="search" v-if="show" @click="close">
        <view class="search_box" @click.stop="test">
            <view class="search_box_item" :style="{background: !search ? 'rgba(13, 30, 65, 0.70)' : search.bgType === 1 ? percentage(search.bgColor, search.bgAlpha) : 'rgba(13, 30, 65, 0.70)'}">
                <view class="icon">
                    <image src="@/static/ic_search@2x.png" mode="widthFix"></image>
                </view>
                <view class="search_box_item_right">
                    <input type="text" focus v-model="title" placeholder-class="placeholder" placeholder="请输入标题搜索" />
                    <button @click="submit">搜索</button>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import { listForH5 } from '@/apis/index.js'
    export default {
        data() {
            return {
                show: false,
                title: ''
            }
        },
        props: {
            search: {
                type: Object | null
            }
        },
        methods: {
            open() {
                this.title = ''
                this.show = true
            },
            close() {
                this.show = false
            },
            test() {
                return false
            },
            percentage(bgColor, alpha) {
                let res = +(alpha * 2.55).toFixed(0)
                return bgColor + res.toString(16)
            },
            submit() {
                this.$emit('getTitle', this.title)
                this.close()
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .search {
        position: fixed;
        z-index: 4;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        .search_box {
            width: 660px;
            height: auto;
            display: flex;
            flex-direction: column;
            .search_box_item {
                width: 100%;
                height: 72px;
                border-radius: 32px;
                display: flex;
                align-items: center;
                padding: 0 30px;
                box-sizing: border-box;
                margin-bottom: 16px;
                &:last-child {
                    margin-bottom: 0 !important;
                }
                .search_box_item_right {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    input {
                        flex: 1;
                        height: 100%;
                        font-size: 20px;
                        font-weight: 400;
                        color: #FFFFFF;
                    }
                    button {
                        flex-shrink: 0;
                        width: 100px;
                        height: 40px;
                        line-height: 40px;
                        text-align: center;
                        font-size: 16px;
                        color: #FFFFFF;
                        border-radius: 30rpx;
                        background-color: #5500ff;
                        margin-left: 30rpx;
                    }
                }
                .icon {
                    width: 20px;
                    height: 20px;
                    flex-shrink: 0;
                    margin-right: 18px;
                    image {
                        width: 100%;
                        height: 100%;
                    }
                }
                .placeholder {
                    height: 72px;
                    line-height: 72px;
                    font-size: 20px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: rgba(255,255,255,0.5);
                }
            }
        }
    }
</style>