yangyin
2024-10-31 5f5609326cb7d69c6cf89e42fd0e654fa416d8b6
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
<template>
    <div class="container" :class="isHome ? 'top-[100%] mt-[8px]' : 'bottom-[100%] mb-[8px]'">
        <div class="container_header">
            <div class="title">常用语</div>
            <span class="ywifont ywicon-guanbi text-[15px] cursor-pointer text-[#767a97]" @click="closeCommonPhrases"></span>
        </div>
        <div class="container_content">
            <div class="set_phrases" :style="{ height: commonPhrases.length * 40 + 'px' }">
                <div class="w-full h-full absolute top-0">
                    <div class="py-0 mt-0 box-border h-full">
                        <div style="overflow-anchor: none" v-for="(item, index) in commonPhrases" :key="index">
                            <div class="phase_item">
                                <div class="flex flex-col">
                                    <div class="title">
                                        {{ item.title }}
                                    </div>
                                    <div class="content">
                                        {{ item.content }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="container_add">
            <span class="ywifont ywicon-jia text-[15px] cursor-pointer text-[#767a97]"></span>
        </div>
    </div>
</template>
 
<script setup lang="ts">
import { ref } from 'vue';
const commonPhrases = ref([
    {
        id: 1,
        title: '你好,请问有什么可以帮助您?',
        content: '您好,我想咨询一下关于您的订单。',
    },
    {
        id: 2,
        title: '测试1?',
        content: '我想咨询一下关于您的订单。',
    },
    {
        id: 3,
        title: '测试2?',
        content: '我想咨询一下关于您的订单。',
    },
]);
const props = defineProps(['isHome']);
const closeCommonPhrases = () => {};
</script>
<style scoped lang="scss">
.container {
    position: absolute;
    width: 100%;
    max-height: 45vh;
    padding: 0 8px 8px;
    left: 0px;
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    box-shadow: 0px 8px 25px 0px #0000000d;
    display: flex;
    flex-direction: column;
    z-index: 100;
    &_header {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 6px;
        color: #060607;
        .title {
            font-size: 14px;
            color: #060607;
            font-weight: 600;
            line-height: 20px;
            letter-spacing: 0.25px;
            flex-grow: 1;
            display: flex;
        }
    }
    &_content {
        width: 100%;
        max-height: 40vh;
        height: fit-content;
        .set_phrases {
            outline: none;
            overflow-y: auto;
            position: relative;
            transition: height 0.1s linear;
            .phase_item {
                display: flex;
                flex-direction: row;
                justify-content: space-between;
                align-items: center;
                cursor: pointer;
                padding: 6px 8px;
                flex-shrink: 0;
                background: #fff;
                border-radius: 8px;
                width: 100%;
                .title {
                    font-size: 14px;
                    color: #060607;
                    font-family: PingFang HK;
                    font-weight: 600;
                    font-style: normal;
                    white-space: nowrap;
                    text-overflow: ellipsis;
                    overflow: hidden;
                }
                .content {
                    font-size: 12px;
                    color: #5e6772;
                    font-family: PingFang SC;
                    white-space: nowrap;
                    text-overflow: ellipsis;
                    overflow: hidden;
                }
            }
        }
    }
    &_add {
        display: flex;
        flex-direction: row;
        align-items: center;
        cursor: pointer;
        padding: 6px 8px;
        background: #fff;
        border-radius: 8px;
    }
}
</style>