feat(staff): WhatsApp nickname → chat timeline
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
import { computed, onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { getAccounts, getCustomers } from '@/api'
|
import { getAccounts, getCustomers, getMessages } from '@/api'
|
||||||
import type { Account, Channel } from '@/api/types'
|
import type { Account, Channel } from '@/api/types'
|
||||||
import YkStaffDetailModal from '@/components/YkStaffDetailModal.vue'
|
import YkStaffDetailModal from '@/components/YkStaffDetailModal.vue'
|
||||||
import { useChannelStore } from '@/stores/channel'
|
import { useChannelStore } from '@/stores/channel'
|
||||||
@@ -193,6 +193,25 @@ function viewGroups(row: Account): void {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function viewChat(row: Account) {
|
||||||
|
// 取该账号最近一条会话,跳 ChatTimeline(降级:云客是会话列表,我们跳最近一条)
|
||||||
|
const res = await getMessages({
|
||||||
|
channel: row.channel,
|
||||||
|
owner_account_id: row.account_id,
|
||||||
|
page: 1,
|
||||||
|
page_size: 1,
|
||||||
|
})
|
||||||
|
const m = res.items[0]
|
||||||
|
if (!m) {
|
||||||
|
ElMessage.info('该账号暂无聊天记录')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const path = m.room_id
|
||||||
|
? `/group/${row.channel}/${row.account_id}/${m.room_id}`
|
||||||
|
: `/chat/${row.channel}/${row.account_id}/${m.talker_id}`
|
||||||
|
router.push(path)
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Detail modal (stat-number click → 明细) — reused for 添加人数 / 沟通人数.
|
// Detail modal (stat-number click → 明细) — reused for 添加人数 / 沟通人数.
|
||||||
// fetcher is set by open*Modal; the modal triggers it on open.
|
// fetcher is set by open*Modal; the modal triggers it on open.
|
||||||
@@ -555,9 +574,13 @@ onMounted(() => {
|
|||||||
<div class="yk-staffinfo">
|
<div class="yk-staffinfo">
|
||||||
<el-avatar :size="36" shape="circle">{{ initials(row) }}</el-avatar>
|
<el-avatar :size="36" shape="circle">{{ initials(row) }}</el-avatar>
|
||||||
<div class="yk-staffinfo__meta">
|
<div class="yk-staffinfo__meta">
|
||||||
<div class="yk-staffinfo__nick" :title="cellText(row, 'nickName')">
|
<span
|
||||||
|
class="yk-staffinfo__nick yk-link"
|
||||||
|
:title="cellText(row, 'nickName')"
|
||||||
|
@click.stop="viewChat(row)"
|
||||||
|
>
|
||||||
{{ cellText(row, 'nickName') }}
|
{{ cellText(row, 'nickName') }}
|
||||||
</div>
|
</span>
|
||||||
<div class="yk-staffinfo__muted">{{ cellText(row, 'phone') }}</div>
|
<div class="yk-staffinfo__muted">{{ cellText(row, 'phone') }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -779,6 +802,15 @@ onMounted(() => {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.yk-link {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yk-link:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
.yk-staffinfo__pair {
|
.yk-staffinfo__pair {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
|
|||||||
Reference in New Issue
Block a user