|
@@ -16,15 +16,19 @@
|
|
|
<a-spin :size="32" />
|
|
<a-spin :size="32" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <!-- <template v-if="api_status === 3">
|
|
|
|
|
- <HistoryList
|
|
|
|
|
|
|
+ <template v-if="api_status === 3 && list_history.length === 0">
|
|
|
|
|
+ <div class="infomations-container">
|
|
|
|
|
+ <a-empty> {{ $t('conversation.history_empty') }} </a-empty>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- <HistoryList
|
|
|
v-if="list_history.length !== 0"
|
|
v-if="list_history.length !== 0"
|
|
|
:list="list_history"
|
|
:list="list_history"
|
|
|
:can_loadmore="can_loadmore"
|
|
:can_loadmore="can_loadmore"
|
|
|
@loadmore="handleListLoadMore"
|
|
@loadmore="handleListLoadMore"
|
|
|
@active="handleListItemActive"
|
|
@active="handleListItemActive"
|
|
|
- />
|
|
|
|
|
- </template> -->
|
|
|
|
|
|
|
+ /> -->
|
|
|
|
|
+ </template>
|
|
|
<template v-if="api_status === 4">
|
|
<template v-if="api_status === 4">
|
|
|
<div class="infomations-container">
|
|
<div class="infomations-container">
|
|
|
<a-result status="warning" :title="api_message"> </a-result>
|
|
<a-result status="warning" :title="api_message"> </a-result>
|
|
@@ -58,8 +62,8 @@ const search_text = ref(''); // 搜索字符串
|
|
|
const can_loadmore = ref(true); // 是否可以加载更多
|
|
const can_loadmore = ref(true); // 是否可以加载更多
|
|
|
|
|
|
|
|
// api请求的状态
|
|
// api请求的状态
|
|
|
-const api_status = ref(1); // api状态
|
|
|
|
|
-const api_message = ref(''); // 请求消息
|
|
|
|
|
|
|
+const api_status = ref(1); // api状态 1 请求未启动 2 请求进心中 3 请求已成功 4 请求失败(网络成功,但是code不等于200) 5 请求出错
|
|
|
|
|
+const api_message = ref(''); // 请求消息 与 api_status 对应的 message 消息内容
|
|
|
|
|
|
|
|
// 历史记录列表数据
|
|
// 历史记录列表数据
|
|
|
const list_history = ref([]); // 历史记录的列表数据
|
|
const list_history = ref([]); // 历史记录的列表数据
|
|
@@ -68,15 +72,16 @@ const count_today = ref(0); // 记录今天的数据量
|
|
|
const count_month = ref(0); // 记录本月的数据量
|
|
const count_month = ref(0); // 记录本月的数据量
|
|
|
const count_earlier = ref(0); // 记录更早的数据量
|
|
const count_earlier = ref(0); // 记录更早的数据量
|
|
|
|
|
|
|
|
-// 今天的数据
|
|
|
|
|
-// 这个月的数据
|
|
|
|
|
-// 这个月以前的数据
|
|
|
|
|
const today_zero = getTodayZeroTimestamp(); // 今天零点
|
|
const today_zero = getTodayZeroTimestamp(); // 今天零点
|
|
|
const yesterday_zero = today_zero - ONE_DAY; // 昨天零点
|
|
const yesterday_zero = today_zero - ONE_DAY; // 昨天零点
|
|
|
-const last_month_zero = yesterday_zero - ONE_MONTH; // 上个月零点
|
|
|
|
|
|
|
+const last_month_zero = yesterday_zero - ONE_MONTH; // 上个月(30天之前的)零点
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 将数据进行分类
|
|
* 将数据进行分类
|
|
|
|
|
+ * 依据时间戳,将列表数据分成三中类型:今天、本月、更早
|
|
|
|
|
+ * 今天:从今天零点开始到现在
|
|
|
|
|
+ * 本月:从今天零点之前,往前推30天
|
|
|
|
|
+ * 更早:在30天之前的数据
|
|
|
* @param res_list
|
|
* @param res_list
|
|
|
*/
|
|
*/
|
|
|
function dropListByType(res_list) {
|
|
function dropListByType(res_list) {
|
|
@@ -90,8 +95,9 @@ function dropListByType(res_list) {
|
|
|
// 今天的数据
|
|
// 今天的数据
|
|
|
list_history.value.push({
|
|
list_history.value.push({
|
|
|
client_field_content_type: 'label',
|
|
client_field_content_type: 'label',
|
|
|
- client_field_timestamp_type: 'today',
|
|
|
|
|
- content: '今天'
|
|
|
|
|
|
|
+ client_field_timestamp_type: 'today'
|
|
|
|
|
+ // content: '今天'
|
|
|
|
|
+ // content: t('conversation.history_today')
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -108,8 +114,9 @@ function dropListByType(res_list) {
|
|
|
if (count_month.value === 0) {
|
|
if (count_month.value === 0) {
|
|
|
list_history.value.push({
|
|
list_history.value.push({
|
|
|
client_field_content_type: 'label',
|
|
client_field_content_type: 'label',
|
|
|
- client_field_timestamp_type: 'month',
|
|
|
|
|
- content: '本月'
|
|
|
|
|
|
|
+ client_field_timestamp_type: 'month'
|
|
|
|
|
+ // content: '本月'
|
|
|
|
|
+ // content: t('conversation.history_month')
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -123,8 +130,9 @@ function dropListByType(res_list) {
|
|
|
if (count_earlier.value === 0) {
|
|
if (count_earlier.value === 0) {
|
|
|
list_history.value.push({
|
|
list_history.value.push({
|
|
|
client_field_content_type: 'label',
|
|
client_field_content_type: 'label',
|
|
|
- client_field_timestamp_type: 'earlier',
|
|
|
|
|
- content: '更早以前'
|
|
|
|
|
|
|
+ client_field_timestamp_type: 'earlier'
|
|
|
|
|
+ // content: '更早以前'
|
|
|
|
|
+ // content: t('conversation.history_earlier')
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -174,16 +182,18 @@ const handleApiRequest = () => {
|
|
|
dropListByType(res_list);
|
|
dropListByType(res_list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // api请求成功
|
|
|
api_status.value = 3;
|
|
api_status.value = 3;
|
|
|
api_message.value = 'success';
|
|
api_message.value = 'success';
|
|
|
} else {
|
|
} else {
|
|
|
- // 失败
|
|
|
|
|
|
|
+ // api请求成功,但是业务失败
|
|
|
api_status.value = 4;
|
|
api_status.value = 4;
|
|
|
api_message.value = res.msg;
|
|
api_message.value = res.msg;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
|
console.log(err);
|
|
console.log(err);
|
|
|
|
|
+ // api请求出错
|
|
|
api_status.value = 5;
|
|
api_status.value = 5;
|
|
|
api_message.value = err.msg;
|
|
api_message.value = err.msg;
|
|
|
});
|
|
});
|
|
@@ -215,8 +225,6 @@ const handleListItemActive = (history_id) => {};
|
|
|
* @param value
|
|
* @param value
|
|
|
*/
|
|
*/
|
|
|
const handleHistorySearch = (value) => {
|
|
const handleHistorySearch = (value) => {
|
|
|
- console.log(value, '开始搜索');
|
|
|
|
|
-
|
|
|
|
|
search_text.value = value; // 搜索字符串
|
|
search_text.value = value; // 搜索字符串
|
|
|
page_no.value = 1; // 页码归位
|
|
page_no.value = 1; // 页码归位
|
|
|
|
|
|