|
|
@ -4,11 +4,11 @@ |
|
|
<div v-show="showSearch" class="mb-[10px]"> |
|
|
<div v-show="showSearch" class="mb-[10px]"> |
|
|
<el-card shadow="hover"> |
|
|
<el-card shadow="hover"> |
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true"> |
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true"> |
|
|
<el-form-item label="用户名" prop="userName"> |
|
|
<el-form-item label="客服名" prop="userName"> |
|
|
<el-input v-model="queryParams.userName" placeholder="请输入用户名" clearable @keyup.enter="handleQuery" /> |
|
|
<el-input v-model="queryParams.userName" placeholder="请输入客服名" clearable @keyup.enter="handleQuery" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="用户昵称" prop="nickName"> |
|
|
<el-form-item label="客服昵称" prop="nickName"> |
|
|
<el-input v-model="queryParams.nickName" placeholder="请输入用户昵称" clearable @keyup.enter="handleQuery" /> |
|
|
<el-input v-model="queryParams.nickName" placeholder="请输入客服昵称" clearable @keyup.enter="handleQuery" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
|
|
@ -38,10 +38,10 @@ |
|
|
</el-row> |
|
|
</el-row> |
|
|
</template> |
|
|
</template> |
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
|
|
<el-table-column label="ID" align="center" prop="id" /> |
|
|
<!-- <el-table-column label="ID" align="center" prop="id" /> --> |
|
|
<el-table-column label="用户名" align="center" prop="userName" /> |
|
|
<el-table-column label="客服名" align="center" prop="userName" width="160" /> |
|
|
<el-table-column label="用户昵称" align="center" prop="nickName" /> |
|
|
<el-table-column label="客服昵称" align="center" prop="nickName" /> |
|
|
<el-table-column label="用户头像" align="center" prop="headImageThumb" width="100"> |
|
|
<el-table-column label="客服头像" align="center" prop="headImageThumb" width="100"> |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<image-preview :src="scope.row.headImageThumb" :full-src="scope.row.headImage" :width="50" :height="50" /> |
|
|
<image-preview :src="scope.row.headImageThumb" :full-src="scope.row.headImage" :width="50" :height="50" /> |
|
|
</template> |
|
|
</template> |
|
|
@ -88,7 +88,7 @@ |
|
|
|
|
|
|
|
|
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" /> |
|
|
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" /> |
|
|
</el-card> |
|
|
</el-card> |
|
|
<!-- 添加或修改用户对话框 --> |
|
|
<!-- 添加或修改客服对话框 --> |
|
|
<el-dialog v-model="dialog.visible" :title="dialog.title" width="800px" append-to-body> |
|
|
<el-dialog v-model="dialog.visible" :title="dialog.title" width="800px" append-to-body> |
|
|
<el-form ref="userFormRef" :model="form" :rules="rules" label-width="100px"> |
|
|
<el-form ref="userFormRef" :model="form" :rules="rules" label-width="100px"> |
|
|
<el-form-item label="头像" prop="headImage"> |
|
|
<el-form-item label="头像" prop="headImage"> |
|
|
@ -98,7 +98,7 @@ |
|
|
<el-input v-model="form.userName" /> |
|
|
<el-input v-model="form.userName" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item v-if="form.id == undefined" label="密码" prop="password"> |
|
|
<el-form-item v-if="form.id == undefined" label="密码" prop="password"> |
|
|
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password /> |
|
|
<el-input v-model="form.password" placeholder="请输入客服密码" type="password" maxlength="20" show-password /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="性别" prop="sex"> |
|
|
<el-form-item label="性别" prop="sex"> |
|
|
<el-select v-model="form.sex" placeholder="请选择"> |
|
|
<el-select v-model="form.sex" placeholder="请选择"> |
|
|
@ -247,7 +247,7 @@ const submitForm = () => { |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** 查询用户列表 */ |
|
|
/** 查询客服列表 */ |
|
|
const getList = async () => { |
|
|
const getList = async () => { |
|
|
loading.value = true; |
|
|
loading.value = true; |
|
|
const res = await listUser(queryParams.value); |
|
|
const res = await listUser(queryParams.value); |
|
|
@ -264,7 +264,7 @@ const handleQuery = () => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前登录用户的 uniqueToken |
|
|
* 获取当前登录客服的 uniqueToken |
|
|
*/ |
|
|
*/ |
|
|
const fetchUniqueToken = async () => { |
|
|
const fetchUniqueToken = async () => { |
|
|
try { |
|
|
try { |
|
|
@ -374,7 +374,7 @@ const handleResetPwd = async (row: UserVO) => { |
|
|
cancelButtonText: '取消', |
|
|
cancelButtonText: '取消', |
|
|
closeOnClickModal: false, |
|
|
closeOnClickModal: false, |
|
|
inputPattern: /^.{5,20}$/, |
|
|
inputPattern: /^.{5,20}$/, |
|
|
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间', |
|
|
inputErrorMessage: '客服密码长度必须介于 5 和 20 之间', |
|
|
inputValidator: (value) => { |
|
|
inputValidator: (value) => { |
|
|
if (/<|>|"|'|\||\\/.test(value)) { |
|
|
if (/<|>|"|'|\||\\/.test(value)) { |
|
|
return '不能包含非法字符:< > " \' \\\ |'; |
|
|
return '不能包含非法字符:< > " \' \\\ |'; |
|
|
@ -420,7 +420,7 @@ const reset = () => { |
|
|
// }; |
|
|
// }; |
|
|
|
|
|
|
|
|
const banHandle = (user: any) => { |
|
|
const banHandle = (user: any) => { |
|
|
ElMessageBox.prompt('封禁原因:', '确定对该用户进行封禁?', { |
|
|
ElMessageBox.prompt('封禁原因:', '确定对该客服进行封禁?', { |
|
|
inputPattern: /\S/, |
|
|
inputPattern: /\S/, |
|
|
inputErrorMessage: '请输入封禁原因', |
|
|
inputErrorMessage: '请输入封禁原因', |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: '确定', |
|
|
@ -429,20 +429,20 @@ const banHandle = (user: any) => { |
|
|
const data = { id: user.id, reason: value }; |
|
|
const data = { id: user.id, reason: value }; |
|
|
ban(data).then(() => { |
|
|
ban(data).then(() => { |
|
|
user.isBanned = true; |
|
|
user.isBanned = true; |
|
|
ElMessage.success(`用户'${user.userName}'已被封禁`); |
|
|
ElMessage.success(`客服'${user.userName}'已被封禁`); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const unbanHandle = (user: any) => { |
|
|
const unbanHandle = (user: any) => { |
|
|
ElMessageBox.confirm('确定解除该用户的封禁状态??', '提示', { |
|
|
ElMessageBox.confirm('确定解除该客服的封禁状态??', '提示', { |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: '确定', |
|
|
cancelButtonText: '取消' |
|
|
cancelButtonText: '取消' |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
const data = { id: user.id }; |
|
|
const data = { id: user.id }; |
|
|
unban(data).then(() => { |
|
|
unban(data).then(() => { |
|
|
user.isBanned = false; |
|
|
user.isBanned = false; |
|
|
ElMessage.success(`用户'${user.userName}'解锁成功`); |
|
|
ElMessage.success(`客服'${user.userName}'解锁成功`); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|