test(addon/aikefu): 测试会话管理及消息展示
This commit is contained in:
@@ -211,35 +211,35 @@
|
|||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
<form class="layui-form search-form" id="searchForm">
|
<form class="layui-form search-form" id="msg_searchForm">
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label for="conversation_id">会话ID</label>
|
<label for="conversation_id">会话ID</label>
|
||||||
<input type="text" name="conversation_id" id="conversation_id" placeholder="请输入会话ID进行过滤" value="{$conversation_id ?? ''}" class="layui-input" style="width: 250px; display: inline-block;">
|
<input type="text" name="conversation_id" id="msg_conversation_id" placeholder="请输入会话ID进行过滤" value="{$conversation_id ?? ''}" class="layui-input" style="width: 250px; display: inline-block;">
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<label for="user_id">用户ID</label>
|
<label for="user_id">用户ID</label>
|
||||||
<input type="text" name="user_id" id="user_id" placeholder="请输入用户ID进行过滤" value="{$user_id ?? ''}" class="layui-input" style="width: 200px; display: inline-block;">
|
<input type="text" name="user_id" id="msg_user_id" placeholder="请输入用户ID进行过滤" value="{$user_id ?? ''}" class="layui-input" style="width: 200px; display: inline-block;">
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<button type="button" class="layui-btn layui-btn-primary" id="searchBtn">搜索</button>
|
<button type="button" class="layui-btn layui-btn-primary" id="msg_searchBtn">搜索</button>
|
||||||
<button type="button" class="layui-btn" id="resetBtn">重置</button>
|
<button type="button" class="layui-btn" id="msg_resetBtn">重置</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 会话信息 -->
|
<!-- 会话信息 -->
|
||||||
<div id="conversationInfo" class="conversation-info">
|
<div id="msg_conversationInfo" class="conversation-info">
|
||||||
<h3>会话记录</h3>
|
<h3>会话记录</h3>
|
||||||
<p><span class="status-active">当前未选择会话,可通过会话ID进行过滤</span></p>
|
<p><span class="status-active">当前未选择会话,可通过会话ID进行过滤</span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 消息列表 -->
|
<!-- 消息列表 -->
|
||||||
<div class="message-list" id="messageList">
|
<div class="message-list" id="msg_messageList">
|
||||||
<!-- 消息列表将通过JavaScript动态加载 -->
|
<!-- 消息列表将通过JavaScript动态加载 -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<div class="layui-fixbar" id="pagination"></div>
|
<div class="layui-fixbar" id="msg_pagination"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -251,13 +251,13 @@
|
|||||||
var page = 1;
|
var page = 1;
|
||||||
var limit = 50;
|
var limit = 50;
|
||||||
var total = 0;
|
var total = 0;
|
||||||
var conversation_id = $('#conversation_id').val();
|
var conversation_id = $('#msg_conversation_id').val();
|
||||||
var user_id = $('#user_id').val();
|
var user_id = $('#msg_user_id').val();
|
||||||
|
|
||||||
// 加载会话信息(当指定会话ID时显示)
|
// 加载会话信息(当指定会话ID时显示)
|
||||||
function loadConversationInfo() {
|
function loadConversationInfo() {
|
||||||
if (!conversation_id) {
|
if (!conversation_id) {
|
||||||
$('#conversationInfo').html('<h3>会话记录</h3><p><span class="status-active">当前未选择会话,可通过会话ID进行过滤</span></p>');
|
$('#msg_conversationInfo').html('<h3>会话记录</h3><p><span class="status-active">当前未选择会话,可通过会话ID进行过滤</span></p>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,13 +278,13 @@
|
|||||||
html += '<p><strong>状态:</strong>' + (info.status === 1 ? '<span class="status-active">活跃</span>' : '<span class="status-inactive">已结束</span>') + '</p>';
|
html += '<p><strong>状态:</strong>' + (info.status === 1 ? '<span class="status-active">活跃</span>' : '<span class="status-inactive">已结束</span>') + '</p>';
|
||||||
html += '<p><strong>创建时间:</strong>' + info.create_time + '</p>';
|
html += '<p><strong>创建时间:</strong>' + info.create_time + '</p>';
|
||||||
html += '<p><strong>更新时间:</strong>' + info.update_time + '</p>';
|
html += '<p><strong>更新时间:</strong>' + info.update_time + '</p>';
|
||||||
$('#conversationInfo').html(html);
|
$('#msg_conversationInfo').html(html);
|
||||||
} else {
|
} else {
|
||||||
$('#conversationInfo').html('<h3>会话详情</h3><p>未找到该会话的详细信息</p>');
|
$('#msg_conversationInfo').html('<h3>会话详情</h3><p>未找到该会话的详细信息</p>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
$('#conversationInfo').html('<h3>会话详情</h3><p>加载会话信息失败</p>');
|
$('#msg_conversationInfo').html('<h3>会话详情</h3><p>加载会话信息失败</p>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -345,9 +345,9 @@
|
|||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#messageList').html(html);
|
$('#msg_messageList').html(html);
|
||||||
// 滚动到底部
|
// 滚动到底部
|
||||||
$('#messageList').scrollTop($('#messageList')[0].scrollHeight);
|
$('#msg_messageList').scrollTop($('#msg_messageList')[0].scrollHeight);
|
||||||
// 渲染分页
|
// 渲染分页
|
||||||
renderPagination();
|
renderPagination();
|
||||||
} else {
|
} else {
|
||||||
@@ -363,12 +363,12 @@
|
|||||||
// 渲染分页
|
// 渲染分页
|
||||||
function renderPagination() {
|
function renderPagination() {
|
||||||
if (total <= limit) {
|
if (total <= limit) {
|
||||||
$('#pagination').html('');
|
$('#msg_pagination').html('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
laypage.render({
|
laypage.render({
|
||||||
elem: 'pagination',
|
elem: 'msg_pagination',
|
||||||
count: total,
|
count: total,
|
||||||
limit: limit,
|
limit: limit,
|
||||||
curr: page,
|
curr: page,
|
||||||
@@ -383,18 +383,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 搜索按钮点击事件
|
// 搜索按钮点击事件
|
||||||
$('#searchBtn').click(function() {
|
$('#msg_searchBtn').click(function() {
|
||||||
conversation_id = $('#conversation_id').val().trim();
|
conversation_id = $('#msg_conversation_id').val().trim();
|
||||||
user_id = $('#user_id').val().trim();
|
user_id = $('#msg_user_id').val().trim();
|
||||||
page = 1;
|
page = 1;
|
||||||
loadConversationInfo();
|
loadConversationInfo();
|
||||||
loadMessageList();
|
loadMessageList();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重置按钮点击事件
|
// 重置按钮点击事件
|
||||||
$('#resetBtn').click(function() {
|
$('#msg_resetBtn').click(function() {
|
||||||
$('#conversation_id').val('');
|
$('#msg_conversation_id').val('');
|
||||||
$('#user_id').val('');
|
$('#msg_user_id').val('');
|
||||||
conversation_id = '';
|
conversation_id = '';
|
||||||
user_id = '';
|
user_id = '';
|
||||||
page = 1;
|
page = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user