|
@@ -119,20 +119,15 @@ onMounted(async () => {
|
|
|
loading.value = false
|
|
|
})
|
|
|
const search = async () => {
|
|
|
- searchList({ skip, limit })
|
|
|
+ searchList()
|
|
|
if (id.value) {
|
|
|
let res = await store.fetch(id.value)
|
|
|
if (res.errcode == '0') info.value = res.data
|
|
|
searchChat({ skip, limit })
|
|
|
}
|
|
|
}
|
|
|
-const searchList = async (query = { skip: 0, limit }) => {
|
|
|
- const info = {
|
|
|
- skip: query.skip,
|
|
|
- limit: query.limit,
|
|
|
- ...searchForm.value
|
|
|
- }
|
|
|
- const res = await chatstore.chat(info)
|
|
|
+const searchList = async () => {
|
|
|
+ const res = await chatstore.chat()
|
|
|
if (res.errcode == '0') chatList.value = res.data
|
|
|
}
|
|
|
const toView = async (item) => {
|
|
@@ -148,7 +143,8 @@ const searchChat = async (query = { skip: 0, limit }) => {
|
|
|
...searchForm.value
|
|
|
}
|
|
|
const res = await chatstore.query(data)
|
|
|
- if (res.errcode == '0') list.value = res.data
|
|
|
+ if (res.errcode == '0' && res.data.length > 0) list.value = res.data
|
|
|
+ else chatList.value.unshift(info.value)
|
|
|
}
|
|
|
const toSend = async () => {
|
|
|
const data = {
|
|
@@ -161,7 +157,7 @@ const toSend = async () => {
|
|
|
const res = await chatstore.create(data)
|
|
|
if (res.errcode === 0) {
|
|
|
textarea.value = ''
|
|
|
- searchChat()
|
|
|
+ await searchChat({ skip, limit })
|
|
|
}
|
|
|
}
|
|
|
// provide
|