<template>
    <div class="container">
        <van-search class="search-item"
            v-model="value"
            show-action
            placeholder="请输入搜索关键词"
            @search="onSearch"
        >
            <template #left-icon>
                <svg-icon class="search-icon" name="search" />
            </template>
            <template #action>
                <van-button type="default" class="action-btn">搜索</van-button>
            </template>
        </van-search>
        <div class="content">
            <div class="list-ul">
                <div class="list-li" v-for="(item,index) in 10">
                    <van-image class="li-img" round src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"/>
                    <div class="li-cont" :class="{ 'no-border': index === 9 }">聊天群群名</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { useWalletStore } from "@/stores/modules/walletStore";
import { groupList } from "@/api/path/im.api";
const walletStore = useWalletStore();


const value = ref('');
const onSearch = () => {
    
}
const getgroupList = async () => {
    const res = await groupList(walletStore.account);
    console.log(res)
}
onMounted(() => {
    getgroupList();
});
</script>

<style lang="less" scoped>
.container{
    height: 100%;
    :deep(.van-search){
        padding: 4px 16px !important;
    }
    :deep(.van-field__control){
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 15px;
        color: #95A9ED;
    }
    .search-item{
        :deep(.van-search__action){
            padding: 0 0 0 12px !important;
            box-sizing: border-box !important;
            line-height: initial !important;
        }
        :deep(.van-search__content){
            background: #F7F8FA !important;
            border-radius: 22px !important;
            padding-left: 10px !important;
            padding-right: 10px;
        }
        :deep(.van-field__left-icon){
            margin-right: 0 !important;
            height: 24px;
        }
        :deep(.van-search__field){
            padding:4px 0 !important;
            line-height: initial !important;
            box-sizing: border-box;
        }
        :deep(.van-field__value){
            height: 24px !important;
            line-height: 26px !important;
        }
        .search-icon{
            height: 24px;
            width: 24px;
            margin-right: 10px;
            color: #95A9ED;
        }
        .action-btn{
            padding:0 22px;
            height: 34px;
            box-sizing: border-box;
            background: #4765DD;
            border-radius: 22px;
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            font-size: 15px;
            color: #FFFFFF;
            border:none !important;
        }
    }
    .search-item :deep(input::placeholder) {
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 15px;
        color: #95A9ED;
    }
    .content{
        margin:16px;
        .list-ul{
            background: #fff;
            border-radius: 12px;
            padding: 0 16px;
            .list-li{
                display: flex;
                align-items: center;
                border-bottom: 1px solid #F2F2F2;
                padding: 10px 0;
                .li-img{
                    width: 32px;
                    height: 32px;
                    flex-shrink: 0;
                    margin-right: 12px;
                }
                .li-cont{
                    flex: 1;
                    display: flex;
                    align-items: center;
                    font-family: PingFang SC, PingFang SC;
                    font-weight: 400;
                    font-size: 15px;
                    color: #8D8D8D;
                }
                .no-border {
                    border-bottom: none;
                }
            }
        }
    }
}
</style>