items.blade.php 7.1 KB
<html>
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>聊天</title>
    <style>
        * {
            margin: 0;padding: 0;
            box-sizing: border-box;
            font-family: 'Open Sans' ,sans-serif;
        }
        body {
            /*display: flex;*/
            /*justify-content: flex-start;*/
            /*align-items: center;*/
            /*min-height: 100vh;*/
            /*background: linear-gradient(#009688 0%,#009688 130px,#d9dbd5 130px,#d9dbd5 100%)*/
            background-color: #f5f5f5;
            height: 100%;
        }
        .container {
            position: relative;
            /*width: 1396px;*/
            max-width: 100%;
            /*height: 100%;*/
            /*height: calc( 100vh - 40px);*/
            background:#fff;
            /*box-shadow: 0 1px 1px 0 rgba(0,0,0,0.06),0 2px 5px 0 rgba(0,0,0,0.06);*/
            display: flex;
        }
        .container .rightside {
            position: relative;
            flex: 70%;
            background:#f5f5f5;
        }
        .container .rightside::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            /*background:url(img6-bg.jpg) ;*/
            opacity: 0.06;
        }

        .nav_icons li {
            display: flex;
            list-style: none;
            cursor: pointer;
            color: #51585c;
            font-size: 1.5em;
            margin-left: 22px;
        }

        .chatlist {
            position: relative;
            height: calc(100%-110px);
            overflow-y: auto;
            padding: 20px 50px;
        }
        .chatlist .block {
            position: relative;
            width: 100%;
            display: flex;
            align-items: center;
            padding: 15px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        }
        .chatlist .block.active{
            background: #ebebeb;
        }
        .chatlist .block:hover
        {
            background:#f5f5f5;
        }
        .chatlist .block .imgbx {
            position: relative;
            min-width: 45px;
            height: 45px;
            overflow: hidden;
            border-radius: 50%;
            margin-right: 10px;
        }
        .chatlist .block .details {
            position: relative;
            width: 100%;
        }
        .chatlist .block .details .listHead {
            display: flex;
            justify-content: space-between;
            margin-bottom: 5px;
        }
        .chatlist .block .details .listHead h4 {
            font-size: 1.1em;
            font-weight: 600;
            color: #111;
        }
        .chatlist .block .details .listHead .time {
            font-size: 0.75em;
            color: #aaa;
        }
        .chatlist .block .details .listHead .time
        {
            color: #111;
        }

        .message {
            position: relative;
            display: flex;
            width: 100%;
            margin: 10px 0;
        }
        .message p {
            position: relative;
            right: 0;
            text-align: right;
            max-width: 65%;
            padding: 12px;
            background: #89d961;
            border-radius: 10px;
            font-size: 0.9em;
        }
        .message p::before {
            content: '';
            position: absolute;
            top: 0;
            right: -12px;
            width: 20px;
            height: 20px;
            background: linear-gradient(135deg,#89d961 0%,#89d961 50%,transparent 50%,transparent);
        }
        .message p span {
            display: block;
            margin-top: 5px;
            font-size: 0.85em;
            opacity: 0.5;
        }

        .message img {
            height: 50px;
            width: 50px;
            border-radius: 5px;
        }
        .my_message {
            justify-content: flex-end;
            text-align: left;
        }

        .my_message img{
            margin-left: 10px;
        }

        .my_message p {
            text-align: left;
        }
        .frnd_message {
            justify-content: flex-start;
        }

        .frnd_message img{
            margin-right: 10px;
        }
        .frnd_message p {
            background: #fff;
            text-align: left;
        }
        .message.frnd_message p::before {
            content: '';
            position: absolute;
            top: 0;
            left: -12px;
            width: 20px;
            height: 20px;
            background: linear-gradient(225deg,#fff 0%,#fff 50%,transparent 50%,transparent);
        }
    </style>
</head>
<body>
<div class="container">
    <div class="rightside">
        <div class="chatlist">
            @if(!$list && $list->isEmpty())
                <div class="message my_message">
                    <svg t="1562312016538" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2076" width="128" height="128" style="fill: #e9e9e9;">
                        <path d="M512.8 198.5c12.2 0 22-9.8 22-22v-90c0-12.2-9.8-22-22-22s-22 9.8-22 22v90c0 12.2 9.9 22 22 22zM307 247.8c8.6 8.6 22.5 8.6 31.1 0 8.6-8.6 8.6-22.5 0-31.1L274.5 153c-8.6-8.6-22.5-8.6-31.1 0-8.6 8.6-8.6 22.5 0 31.1l63.6 63.7zM683.9 247.8c8.6 8.6 22.5 8.6 31.1 0l63.6-63.6c8.6-8.6 8.6-22.5 0-31.1-8.6-8.6-22.5-8.6-31.1 0l-63.6 63.6c-8.6 8.6-8.6 22.5 0 31.1zM927 679.9l-53.9-234.2c-2.8-9.9-4.9-20-6.9-30.1-3.7-18.2-19.9-31.9-39.2-31.9H197c-19.9 0-36.4 14.5-39.5 33.5-1 6.3-2.2 12.5-3.9 18.7L97 679.9v239.6c0 22.1 17.9 40 40 40h750c22.1 0 40-17.9 40-40V679.9z m-315-40c0 55.2-44.8 100-100 100s-100-44.8-100-100H149.6l42.5-193.3c2.4-8.5 3.8-16.7 4.8-22.9h630c2.2 11 4.5 21.8 7.6 32.7l39.8 183.5H612z" p-id="2077"></path>
                    </svg>
                </div>
            @else
                <!-- 聊天记录 begin -->
                @foreach($list as $key => $item)
                    <div class="message @if($item->user_type == 2) frnd_message @else my_message @endif">
                        <!-- AI begin -->
                        @if($item->user_type == 2)
                            <img src="/img/ai.png">
                        @endif
                        <!-- AI end -->

                        <!-- 聊天内容 begin -->
                        <p>
                            <!-- 如果是第一个提问需要带上起始语句 -->
                           {{-- @if($key === 0 && $model->start_statement){{ $model->start_statement }}@endif--}}
                            {!! nl2br($item->body) !!}  <br><span>{{$item->created_at}}</span>
                        </p>
                        <!-- 聊天内容 end -->

                        <!-- 用户 begin -->
                        @if($item->user_type == 1)
                            <img src="{{optional($item->user)->avatar}}" onerror="javascript:this.src='/img/user.png';">
                        @endif
                        <!-- 用户 end -->
                    </div>
                @endforeach
                <!-- 聊天记录 end -->
            @endif
        </div>
    </div>
</div>
</body>
</html>