chengkun
2025-05-12 b6bc92ec11e1e280185ce7682d17589cb45c20f3
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
        <script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
        <script src="{yun:}$config.sy_weburl{/yun}/js/layui/custom_layer.js?v={yun:}$config.cachecode{/yun}"></script>
        <link href="{yun:}$config.sy_weburl{/yun}/app/template/chat/custom/custom.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
    </head>
    <body style="background:#f8f8f8">
        <div class="pc_kf_box">
            <div class="pc_kf_name">在线客服</div>
            <div  id="custom" class="pc_kefu_chat_cont">
                <div id="chat_content" class="pc_kefu_chat_cont_p">
                    <template v-for="(item, ck1) in logList" :key="ck1">
                        <!--聊天-->
                        <div class="pc_kefu_chat_time" v-if="item.timeval">{{item.timeval}}</div>
                        <!--左-->
                        <div class="pc_kefu_chat_pleft" v-if="item.auid != 0">
                            <img :src="item.avatar" width="50" height="50" class="pc_kefu_chat_pic">
                            <div class="pc_kefu_chat_p" v-html="item.content"></div>
                        </div>
                        <!--右-->
                        <div class="pc_kefu_chat_prightbox" v-else>
                            <div class="pc_kefu_chat_pright"> 
                                <img :src="item.avatar" width="50" height="50" class="pc_kefu_chat_pic">
                                <div class="pc_kefu_chat_p" v-html="item.content"></div>
                            </div>
                        </div>
                        <!--聊天-->
                    </template>
                </div>
            </div>
            <!--输入框-->
            <div class="pc_kefu_chat_textareabox">
                <div class="pc_kefu_chat_cz">
                    <iframe id="cs_iframe" name="cs_iframe"></iframe>
                    <form id="imgform" target="cs_iframe" method="post" enctype="multipart/form-data" action="{yun:}$config.sy_weburl{/yun}/index.php?m=chat&c=uploadImage">
                        <div class="pc_kefu_chat_cz_bq_box">
                            <i id="face" title="笑脸" class="pc_kefu_chat_cz_icon sendbq_i"></i>
                            <div id="commonly" class="showbq none"></div>
                        </div>
                        <span class="pc_kefu_chat_tp_icon">
                            <input type="file" name="file" accept="image/*" onchange="upImage(this)" value="" class="chat_footer_czk_tj_bth">
                        </span>
                    </form>
                </div>
                <div class="pc_kefu_chat_textarea">
                    <textarea id="send_content"></textarea>
                </div>
                <div class="pc_kefu_chat_textarea_p"> 按Enter发送
                    <input id="send" type="submit" value="发送" class="chat_footer_bth disclick">
                </div>
            </div>
        </div>
        <script type="text/javascript">
            var isAdmin = false,
                socketUrl = "{yun:}$config.sy_chat_weburl{/yun}",
                weburl = "{yun:}$config.sy_weburl{/yun}",
                toid = "{yun:}$custom_id{/yun}",
                totype = 0,
                pickid = "{yun:}$pickid{/yun}",
                page = 1;
        </script>
        <script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
        <script src="{yun:}$config.sy_weburl{/yun}/app/template/chat/custom/socket.js?v={yun:}$config.cachecode{/yun}"></script>
        <script src="{yun:}$config.sy_weburl{/yun}/app/template/wap/js/vue.min.js?v={yun:}$config.cachecode{/yun}"></script>
        <script>
            var app = new Vue({
                    el: '#custom',
                    data: {
                        logList: []
                    },
                    created() {
                        this.cslog();
                    },
                    methods:{
                        // 查询聊天记录
                        cslog(){
                            $.ajax({
                                url: weburl + "/index.php?m=chat&c=cslog",
                                data: {page: page},
                                type: 'POST',
                                dataType: 'json',
                                success:function(res){
                                    page++;
                                    if(res.list.length > 0){
                                        for (let i = 0; i < res.list.length; i++){
                                            res.list[i].content = rexContent(res.list[i].content);
                                        }
                                        app.$data.logList = app.$data.logList.concat(res.list);
                                        setTimeout(function(){
                                            var scroll = document.getElementById('chat_content').scrollHeight;
                                            chatScrollTo(scroll);
                                        },100);
                                    }
                                    ismore = res.ismore;
                                }
                            })
                        }
                    }
                });
        </script>
    </body>
</html>