Compare commits

..

No commits in common. "d5239d065496ec063b1194bd87752bc5a69aaea4" and "bf6b7f5fcb556ab3603bd01e3ad980048152cb1b" have entirely different histories.

7 changed files with 143 additions and 140 deletions

1
components.d.ts vendored
View File

@ -41,7 +41,6 @@ declare module 'vue' {
ElSelect: typeof import('element-plus/es')['ElSelect'] ElSelect: typeof import('element-plus/es')['ElSelect']
ElSelectV2: typeof import('element-plus/es')['ElSelectV2'] ElSelectV2: typeof import('element-plus/es')['ElSelectV2']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElTable: typeof import('element-plus/es')['ElTable'] ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabPane: typeof import('element-plus/es')['ElTabPane']

View File

@ -19,11 +19,10 @@ export const addApp = (data) => {
}) })
} }
export const deleteRobot = (data) => { export const deleteRobot = (id) => {
return request({ return request({
url: `admin/app/delete`, url: `admin/app/${id}`,
method: 'post', method: 'delete',
data
}) })
} }
export const editRobot = (id, data) => { export const editRobot = (id, data) => {

View File

@ -12,11 +12,11 @@
<!-- <span v-if="element.sender_id != sendeInfo.userInfo.user_id" class="robot-name">{{ sendeInfo.robotInfo.name }}</span> <!-- <span v-if="element.sender_id != sendeInfo.userInfo.user_id" class="robot-name">{{ sendeInfo.robotInfo.name }}</span>
<span v-if="element.sender_id == sendeInfo.userInfo.user_id" class="robot-name">{{ sendeInfo.userInfo.nickname }}</span> --> <span v-if="element.sender_id == sendeInfo.userInfo.user_id" class="robot-name">{{ sendeInfo.userInfo.nickname }}</span> -->
<div class="text" v-if="element.msg_type == 1"> <div class="text" v-if="element.msg_type == 1">
<pre>{{ element.content.message }}</pre> <pre>{{ element.content.messages }}</pre>
</div> </div>
<div class="image" v-if="element.msg_type == 2"> <div class="image" v-if="element.msg_type == 2">
<el-image :src="element.content.message" fit="cover" <el-image :src="element.content.messages" fit="cover"
:preview-src-list="[element.content.message]" preview-teleported> :preview-src-list="[element.content.messages]" preview-teleported>
<template #placeholder> <template #placeholder>
<div class="image-slot">Loading<span class="dot">...</span></div> <div class="image-slot">Loading<span class="dot">...</span></div>
</template> </template>

View File

@ -104,13 +104,11 @@ const formatLastMessage = (user) => {
try { try {
// JSONcontent // JSONcontent
const contentObj = { const contentObj = JSON.parse(user.content)
message: JSON.parse(user.content).message || JSON.parse(user.content).messages
}
// messages // messages
if (contentObj.message) { if (contentObj.messages) {
const content = String(contentObj.message).slice(0, 30) const content = String(contentObj.messages).slice(0, 30)
return content.length > 30 ? content + '...' : content return content.length > 30 ? content + '...' : content
} }

View File

@ -209,7 +209,7 @@ const sortMessagesByTime = (messages) => {
id: m.id || m._id || m.message_id, id: m.id || m._id || m.message_id,
send_time: m.send_time, send_time: m.send_time,
content: typeof m.content === 'object' ? content: typeof m.content === 'object' ?
(m.content.message || JSON.stringify(m.content)) : (m.content.messages || JSON.stringify(m.content)) :
String(m.content).slice(0, 20) + '...' String(m.content).slice(0, 20) + '...'
}))) })))
@ -248,13 +248,10 @@ const getMessages = async (isHistory = true, pageOverride = null) => {
const newMessages = list.map(item => { const newMessages = list.map(item => {
// ChatRecord // ChatRecord
try { try {
const text = JSON.parse(item.content) item.content = JSON.parse(item.content)
item.content = {
message: text.message || text.messages
}
} catch (e) { } catch (e) {
// //
item.content = { message: item.content } item.content = { messages: item.content }
} }
return item return item
}) })
@ -304,13 +301,13 @@ const getMessages = async (isHistory = true, pageOverride = null) => {
if (existingMsg.msg_type === 1) { if (existingMsg.msg_type === 1) {
// //
const existingContent = existingMsg._tempContent || const existingContent = existingMsg._tempContent ||
(typeof existingMsg.content === 'object' ? existingMsg.content.message : existingMsg.content) (typeof existingMsg.content === 'object' ? existingMsg.content.messages : existingMsg.content)
const newContent = typeof newMsg.content === 'object' ? newMsg.content.message : newMsg.content const newContent = typeof newMsg.content === 'object' ? newMsg.content.messages : newMsg.content
contentMatch = existingContent === newContent contentMatch = existingContent === newContent
} else if (existingMsg.msg_type === 2) { } else if (existingMsg.msg_type === 2) {
// //
if (existingMsg._tempImageFile) { if (existingMsg._tempImageFile) {
const newContent = typeof newMsg.content === 'object' ? newMsg.content.message : newMsg.content const newContent = typeof newMsg.content === 'object' ? newMsg.content.messages : newMsg.content
// //
if (typeof newContent === 'string' && newContent.includes(existingMsg._tempImageFile.name.split('.')[0])) { if (typeof newContent === 'string' && newContent.includes(existingMsg._tempImageFile.name.split('.')[0])) {
contentMatch = true contentMatch = true
@ -348,10 +345,10 @@ const getMessages = async (isHistory = true, pageOverride = null) => {
// ID使 // ID使
const existingContentStr = typeof existingMsg.content === 'object' ? const existingContentStr = typeof existingMsg.content === 'object' ?
(existingMsg.content.message || JSON.stringify(existingMsg.content)) : (existingMsg.content.messages || JSON.stringify(existingMsg.content)) :
String(existingMsg.content) String(existingMsg.content)
const newContentStr = typeof newMsg.content === 'object' ? const newContentStr = typeof newMsg.content === 'object' ?
(newMsg.content.message || JSON.stringify(newMsg.content)) : (newMsg.content.messages || JSON.stringify(newMsg.content)) :
String(newMsg.content) String(newMsg.content)
const compositeMatch = existingMsg.sender_id === newMsg.sender_id && const compositeMatch = existingMsg.sender_id === newMsg.sender_id &&
@ -366,7 +363,7 @@ const getMessages = async (isHistory = true, pageOverride = null) => {
// 3. // 3.
console.log('发现新消息:', { console.log('发现新消息:', {
id: newMsg.id || newMsg._id || newMsg.message_id, id: newMsg.id || newMsg._id || newMsg.message_id,
content: typeof newMsg.content === 'object' ? newMsg.content.message : newMsg.content content: typeof newMsg.content === 'object' ? newMsg.content.messages : newMsg.content
}) })
currentMessages.push(newMsg) currentMessages.push(newMsg)
hasUpdates = true hasUpdates = true
@ -484,7 +481,7 @@ const send = async () => {
msg.sender_id === '888888' && msg.sender_id === '888888' &&
msg.msg_type === 1 && msg.msg_type === 1 &&
typeof msg.content === 'object' && typeof msg.content === 'object' &&
msg.content.message === content && msg.content.messages === content &&
(now - (msg._timestamp || 0)) < 5000 (now - (msg._timestamp || 0)) < 5000
) )
@ -506,7 +503,7 @@ const send = async () => {
sender_id: '888888', sender_id: '888888',
sender_name: '平台', sender_name: '平台',
msg_type: 1, msg_type: 1,
content: { message: content }, content: { messages: content },
send_time: '刚刚', send_time: '刚刚',
_timestamp: now, _timestamp: now,
_tempContent: content // _tempContent: content //
@ -523,7 +520,7 @@ const send = async () => {
send_message({ send_message({
app_id: route.query.app_id, app_id: route.query.app_id,
content: JSON.stringify({ content: JSON.stringify({
message: content messages: content
}), }),
msg_type: 1, msg_type: 1,
to_user_id: activeUser.value.sender_id to_user_id: activeUser.value.sender_id
@ -593,7 +590,7 @@ const handleImageChange = (e) => {
sender_id: '888888', sender_id: '888888',
sender_name: '平台', sender_name: '平台',
msg_type: 2, msg_type: 2,
content: { message: url }, content: { messages: url },
send_time: '刚刚', send_time: '刚刚',
_timestamp: now, _timestamp: now,
_tempImageFile: file // _tempImageFile: file //
@ -618,7 +615,7 @@ const handleImageChange = (e) => {
send_message({ send_message({
app_id: route.query.app_id, app_id: route.query.app_id,
msg_type: 2, msg_type: 2,
content: JSON.stringify({ message: imageUrl }), content: JSON.stringify({ messages: imageUrl }),
to_user_id: activeUser.value.sender_id to_user_id: activeUser.value.sender_id
}).then(() => { }).then(() => {
// //

View File

@ -11,9 +11,10 @@
@selection-change="handleSelectionChange" row-key="id"> @selection-change="handleSelectionChange" row-key="id">
<template #empty> <template #empty>
<span v-if="tableLoading">加载中...</span> <span v-if="tableLoading">加载中...</span>
<span v-if="!tableLoading">暂无数据</span> <span v-if="!tableLoading && query.robot_id">暂无数据</span>
<span v-if="!query.robot_id && !tableLoading" style="font-weight: bold;">请选择一个客服</span>
</template> </template>
<!-- <el-table-column type="selection" width="55" :reserve-selection="true" /> --> <el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column prop="avatar" label="头像" align="center"> <el-table-column prop="avatar" label="头像" align="center">
<template #default="scoped"> <template #default="scoped">
<el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;" <el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;"
@ -27,20 +28,39 @@
<el-table-column prop="created_at" label="添加时间" align="center" <el-table-column prop="created_at" label="添加时间" align="center"
min-width="160"></el-table-column> min-width="160"></el-table-column>
<el-table-column prop="" label="操作" align="center" fixed="right" width="220"> <el-table-column prop="" label="操作" width="100" align="center" fixed="right">
<template #default="scoped"> <template #default="scoped">
<div class="mht-operations"> <div class="mht-operations">
<!-- <el-tooltip class="box-item" effect="dark" content="客户详情" placement="bottom">
<el-icon @click="toDetail(scoped.row)">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-xiangqingye-43"></use>
</svg>
</el-icon>
</el-tooltip>
<el-tooltip class="box-item" effect="dark" content="发送消息" placement="bottom">
<el-icon @click="handleSend(scoped.row)">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-fasong"></use>
</svg>
</el-icon>
</el-tooltip> -->
<el-tooltip class="box-item" effect="dark" content="编辑" placement="bottom">
<el-icon class="el-icon-primary" @click="handleEdit(scoped.row)">
<Edit />
</el-icon>
</el-tooltip>
<el-tooltip class="box-item" effect="dark" content="绑定小程序" placement="bottom">
<el-button type="primary" link @click="handleEdit(scoped.row)"> <el-icon class="el-icon-primary" @click="handleBindApp(scoped.row)">
编辑 <Connection />
</el-button> </el-icon>
</el-tooltip>
<el-button type="primary" link @click="handleBindApp(scoped.row)"> <el-tooltip class="box-item" effect="dark" content="删除" placement="bottom">
绑定小程序 <el-icon class="el-icon-danger" @click="handleDelete(scoped.row)">
</el-button> <Delete />
<el-button type="danger" link @click="handleDelete(scoped.row)"> </el-icon>
删除 </el-tooltip>
</el-button>
</div> </div>
</template> </template>
@ -68,8 +88,12 @@
<el-input v-model="ruleForm.nickname" placeholder="请输入客服昵称" size="large" /> <el-input v-model="ruleForm.nickname" placeholder="请输入客服昵称" size="large" />
</el-form-item> </el-form-item>
<el-form-item label="客服密码" prop="password"> <el-form-item label="客服密码" prop="password">
<el-input v-model="ruleForm.password" type="password" <el-input
:placeholder="isEdit ? '留空则不修改密码' : '请输入客服密码'" size="large" /> v-model="ruleForm.password"
type="password"
:placeholder="isEdit ? '留空则不修改密码' : '请输入客服密码'"
size="large"
/>
<div v-if="isEdit" style="font-size: 12px; color: #999; margin-top: 4px;"> <div v-if="isEdit" style="font-size: 12px; color: #999; margin-top: 4px;">
留空则不修改密码 留空则不修改密码
</div> </div>
@ -98,17 +122,16 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog v-model="dialogLog" title="绑定小程序" width="1000px" align-center :before-close="handleClose" <el-dialog v-model="dialogLog" title="绑定小程序" width="1000px" align-center :before-close="handleClose" destroy-on-close>
destroy-on-close>
<div class="dialog-box"> <div class="dialog-box">
<el-table ref="appTableRef" :data="logList" style="width: 100%" max-height="500px" row-key="id" <el-table ref="appTableRef" :data="logList" style="width: 100%" max-height="500px" row-key="id"
@selection-change="appSelectionChange" v-loading="tableLoading"> @selection-change="appSelectionChange">
<template #empty> <template #empty>
<span v-if="tableLoading">加载中...</span> <span v-if="tableLoading">加载中...</span>
<span v-if="!tableLoading">暂无数据</span> <span v-if="!tableLoading">暂无数据</span>
</template> </template>
<el-table-column type="selection" width="55" :reserve-selection="true" /> <el-table-column type="selection" width="55" :reserve-selection="true" :selectable="isSelectable" />
<el-table-column prop="avatar" label="头像" align="center"> <el-table-column prop="avatar" label="头像" align="center">
<template #default="scoped"> <template #default="scoped">
<el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;" <el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;"
@ -184,7 +207,7 @@ const getRules = () => {
trigger: 'change', trigger: 'change',
}], }],
} }
// //
if (!isEdit.value) { if (!isEdit.value) {
baseRules.password = [{ baseRules.password = [{
@ -199,7 +222,7 @@ const getRules = () => {
trigger: 'blur', trigger: 'blur',
}] }]
} }
return baseRules return baseRules
} }
@ -213,14 +236,9 @@ const query = reactive({
const total = ref(0) const total = ref(0)
const mpTable = ref([]) const mpTable = ref([])
const getTable = async () => { const getTable = async () => {
tableLoading.value = true const res = await robotList(query)
const res = await robotList(query).then(res => { robotCards.value = res.list
robotCards.value = res.list total.value = res.total
total.value = res.total
tableLoading.value = false
}).catch(() => {
tableLoading.value = false
})
} }
const listLoad = () => { const listLoad = () => {
@ -273,7 +291,7 @@ const submitRobot = async () => {
avatar: ruleForm.value.avatar, avatar: ruleForm.value.avatar,
mobile: ruleForm.value.mobile, mobile: ruleForm.value.mobile,
} }
// //
if (ruleForm.value.password && ruleForm.value.password.trim() !== '') { if (ruleForm.value.password && ruleForm.value.password.trim() !== '') {
editData.password = md5(ruleForm.value.password) editData.password = md5(ruleForm.value.password)
@ -297,7 +315,7 @@ const submitRobot = async () => {
...ruleForm.value, ...ruleForm.value,
password: md5(ruleForm.value.password) password: md5(ruleForm.value.password)
} }
const res = await addRobot(createData) const res = await addRobot(createData)
robotCards.value.push({ robotCards.value.push({
...ruleForm.value, ...ruleForm.value,
@ -333,16 +351,16 @@ const handleDelete = (item, index) => {
} }
) )
.then(async () => { .then(async () => {
await deleteRobot({
ids: String(item.id)
})
robotCards.value.splice(index, 1)
ElNotification({ ElNotification({
message: '删除成功', message: '删除中,请稍等',
type: 'success', type: 'success',
duration: 2000 duration: 2000
}) })
await deleteRobot({
ids: String(item.id)
})
// getGroups()
robotCards.value.splice(index, 1)
}) })
.catch(() => { .catch(() => {
@ -385,9 +403,10 @@ const openLog = async () => {
dialogLog.value = true dialogLog.value = true
tableLoading.value = true tableLoading.value = true
const res = await appList(logQuery) const res = await appList(logQuery)
tableLoading.value = false
logList.value = res.list logList.value = res.list
total.value = res.total total.value = res.total
// //
if (bandAppIds.value.length === 0 || logQuery.page === 1) { if (bandAppIds.value.length === 0 || logQuery.page === 1) {
const res2 = await appList({ const res2 = await appList({
@ -395,13 +414,11 @@ const openLog = async () => {
page: 1, page: 1,
page_size: 100 page_size: 100
}) })
tableLoading.value = false
bandAppIds.value = res2.list.map(item => item.id) bandAppIds.value = res2.list.map(item => item.id)
// appSelects // appSelects
appSelects = [...bandAppIds.value] appSelects = [...bandAppIds.value]
} }
// //
setSelectedApps() setSelectedApps()
} }

View File

@ -11,9 +11,10 @@
@selection-change="handleSelectionChange" row-key="user_id"> @selection-change="handleSelectionChange" row-key="user_id">
<template #empty> <template #empty>
<span v-if="tableLoading">加载中...</span> <span v-if="tableLoading">加载中...</span>
<span v-if="!tableLoading">暂无数据</span> <span v-if="!tableLoading && query.robot_id">暂无数据</span>
<span v-if="!query.robot_id && !tableLoading" style="font-weight: bold;">请选择一个小程序</span>
</template> </template>
<!-- <el-table-column type="selection" width="55" :reserve-selection="true" /> --> <el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column prop="avatar" label="头像" align="center"> <el-table-column prop="avatar" label="头像" align="center">
<template #default="scoped"> <template #default="scoped">
<el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;" <el-image style="width: 30px;display: block;margin: auto;border-radius: 4px;"
@ -25,14 +26,6 @@
<el-table-column prop="app_secret" label="AppSecret" /> <el-table-column prop="app_secret" label="AppSecret" />
<el-table-column prop="template_id" label="模版ID" /> <el-table-column prop="template_id" label="模版ID" />
<el-table-column prop="description" label="描述" /> <el-table-column prop="description" label="描述" />
<el-table-column prop="message_total" label="会话量" />
<el-table-column prop="check_status_text" label="状态">
<template #default="scoped">
<el-tag v-if="scoped.row.check_status_text"
:type="scoped.row.check_status_text === '正常' ? 'success' : 'danger'">{{
scoped.row.check_status_text }}</el-tag>
</template>
</el-table-column>
<el-table-column label="意图关键字" align="center"> <el-table-column label="意图关键字" align="center">
<template #default="scoped"> <template #default="scoped">
<div class="mht-operations"> <div class="mht-operations">
@ -43,25 +36,46 @@
<el-table-column prop="created_at" label="添加时间" align="center" <el-table-column prop="created_at" label="添加时间" align="center"
min-width="160"></el-table-column> min-width="160"></el-table-column>
<el-table-column prop="" label="操作" align="center" fixed="right" width="280"> <el-table-column prop="" label="操作" width="100" align="center" fixed="right">
<template #default="scoped"> <template #default="scoped">
<div class="mht-operations"> <div class="mht-operations">
<!-- <el-tooltip class="box-item" effect="dark" content="客户详情" placement="bottom">
<el-button type="primary" link @click="handleqr(scoped.row)"> <el-icon @click="toDetail(scoped.row)">
获取二维码 <svg class="icon" aria-hidden="true">
</el-button> <use xlink:href="#icon-xiangqingye-43"></use>
</svg>
<el-button type="primary" link @click="handleEdit(scoped.row)"> </el-icon>
编辑 </el-tooltip>
</el-button> <el-tooltip class="box-item" effect="dark" content="发送消息" placement="bottom">
<el-icon @click="handleSend(scoped.row)">
<el-button type="primary" link @click="handleDetail(scoped.row)"> <svg class="icon" aria-hidden="true">
进入会话 <use xlink:href="#icon-fasong"></use>
</el-button> </svg>
</el-icon>
<el-button type="danger" link @click="handeleDelete(scoped.row)"> </el-tooltip> -->
删除 <el-tooltip class="box-item" effect="dark" content="获取二维码" placement="bottom">
</el-button> <!-- <el-icon class="el-icon-primary" @click="handleEdit(scoped.row)">
<Edit />
</el-icon> -->
<el-icon @click="handleqr(scoped.row)">
<FullScreen />
</el-icon>
</el-tooltip>
<el-tooltip class="box-item" effect="dark" content="编辑" placement="bottom">
<el-icon class="el-icon-primary" @click="handleEdit(scoped.row)">
<Edit />
</el-icon>
</el-tooltip>
<el-tooltip class="box-item" effect="dark" content="详情" placement="bottom">
<el-icon class="el-icon-primary" @click="handleDetail(scoped.row)">
<ChatDotRound />
</el-icon>
</el-tooltip>
<el-tooltip class="box-item" effect="dark" content="删除" placement="bottom">
<el-icon class="el-icon-danger" @click="handeleDelete(scoped.row)">
<Delete />
</el-icon>
</el-tooltip>
</div> </div>
</template> </template>
@ -88,19 +102,18 @@
<el-form-item label="小程序ID" prop="app_id"> <el-form-item label="小程序ID" prop="app_id">
<el-input v-model="ruleForm.app_id" placeholder="请输入小程序ID" size="large" /> <el-input v-model="ruleForm.app_id" placeholder="请输入小程序ID" size="large" />
</el-form-item> </el-form-item>
<el-form-item label="AppSecret" prop="app_secret"> <el-form-item label="AppSecret" prop="app_secret">
<el-input v-model="ruleForm.app_secret" placeholder="请输入AppSecret" size="large" type="password" <el-input v-model="ruleForm.app_secret" placeholder="请输入AppSecret" size="large" type="password" show-password />
show-password /> </el-form-item>
</el-form-item>
<el-form-item label="模板ID" prop="template_id"> <el-form-item label="模板ID" prop="template_id">
<el-input v-model="ruleForm.template_id" placeholder="请输入模板ID" size="large" /> <el-input v-model="ruleForm.template_id" placeholder="请输入模板ID" size="large" />
</el-form-item> </el-form-item>
<el-form-item label="头像"> <el-form-item label="头像" prop="avatar">
<Upload v-model="ruleForm.avatar" type="image" accept="image/*" :action="robotHost" <Upload v-model="ruleForm.avatar" type="image" accept="image/*" :action="robotHost"
@change="changeFile" @success="uploadSuccess" @error="uploadError"></Upload> @change="changeFile" @success="uploadSuccess" @error="uploadError"></Upload>
</el-form-item> </el-form-item>
<el-form-item label="小程序描述"> <el-form-item label="小程序描述" prop="description">
<el-input type="textarea" row="3" v-model="ruleForm.description" placeholder="请输入小程序描述" <el-input type="textarea" row="3" v-model="ruleForm.description" placeholder="请输入小程序描述"
size="large" /> size="large" />
</el-form-item> </el-form-item>
@ -152,16 +165,10 @@
</template> </template>
</el-dialog> </el-dialog>
<el-dialog v-model="qrDialog" title="小程序二维码" width="610px" align-center :before-close="handleClose"> <el-dialog v-model="qrDialog" title="小程序二维码" width="500px" align-center :before-close="handleClose">
<div class="dialog-box"> <div class="dialog-box" style="text-align: center;">
<img :src="qrCode" style="width: 200px;" alt="">
<div>小程序路径</div>
<el-space style="margin: 20px 0">
<el-input v-model="qrPath" style="width: 400px;margin-right: 10px;" placeholder="请输入小程序路径" />
<el-button type="primary" @click="getQrCode">获取二维码</el-button>
</el-space>
<img :src="qrCode" style="width: 200px;margin: auto;display: block;" alt="">
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -305,14 +312,9 @@ const query = reactive({
let robtoTotal = 0 let robtoTotal = 0
const mpTable = ref([]) const mpTable = ref([])
const getTable = async () => { const getTable = async () => {
tableLoading.value = true const res = await appList(query)
const res = await appList(query).then(res => { robotCards.value = res.list
robotCards.value = res.list total.value = res.total
total.value = res.total
tableLoading.value = false
}).catch(() => {
tableLoading.value = false
})
} }
@ -413,17 +415,15 @@ const handeleDelete = (item, index) => {
} }
) )
.then(async () => { .then(async () => {
await deleteRobot({
ids: String(item.id)
})
// getGroups()
robotCards.value.splice(index, 1)
ElNotification({ ElNotification({
message: '删除成功', message: '删除中,请稍等',
type: 'success', type: 'success',
duration: 2000 duration: 2000
}) })
await deleteRobot(item.id)
// getGroups()
robotCards.value.splice(index, 1)
}) })
.catch(() => { .catch(() => {
@ -509,20 +509,13 @@ const handleDetail = (row) => {
const qrCode = ref('') const qrCode = ref('')
const qrDialog = ref(false) const qrDialog = ref(false)
const qrPath = ref('pages/contact/index')
let qrRow = {}
const handleqr = (row) => { const handleqr = (row) => {
qrCode.value = ''
qrDialog.value = true
qrRow = row
}
const getQrCode = () => {
getQr({ getQr({
"app_id": qrRow.app_id, "app_id": row.app_id,
"app_secret": qrRow.app_secret, "app_secret": row.app_secret,
"path": qrPath.value "path": "pages/contact/index"
}).then((res => { }).then((res => {
qrDialog.value = true
qrCode.value = `data:image/png;base64,${res.data}` qrCode.value = `data:image/png;base64,${res.data}`
})) }))
} }