This commit is contained in:
2026-02-03 21:35:57 +08:00
parent 93b42a277a
commit 3922409a25
105 changed files with 14758 additions and 5861 deletions

View File

@@ -0,0 +1,317 @@
<template>
<view class="admin-kefu-config">
<view class="config-container border-shadow">
<!-- 页头选项卡 -->
<view class="config-tabs">
<view class="tab-item active">
<text class="tab-txt">客服配置</text>
<view class="tab-line"></view>
</view>
</view>
<view class="config-content">
<!-- 客服类型 -->
<view class="form-item">
<view class="label-box">
<text class="label-txt">客服类型:</text>
</view>
<view class="input-box flex-row">
<view class="radio-group">
<view class="radio-item" @click="configType = 'system'">
<view :class="['radio-circle', configType === 'system' ? 'checked' : '']">
<view v-if="configType === 'system'" class="radio-inner"></view>
</view>
<text class="radio-label">系统客服</text>
</view>
<view class="radio-item" @click="configType = 'phone'">
<view :class="['radio-circle', configType === 'phone' ? 'checked' : '']">
<view v-if="configType === 'phone'" class="radio-inner"></view>
</view>
<text class="radio-label">拨打电话</text>
</view>
<view class="radio-item" @click="configType = 'link'">
<view :class="['radio-circle', configType === 'link' ? 'checked' : '']">
<view v-if="configType === 'link'" class="radio-inner"></view>
</view>
<text class="radio-label">跳转链接</text>
</view>
</view>
</view>
</view>
<!-- 提示信息 -->
<view class="form-item no-label">
<view class="tip-box">
<text class="tip-txt">系统客服:点击联系客服使用系统的自带客服;拨打电话:点击联系客服拨打客服电话;跳转链接:跳转外部链接联系客服</text>
</view>
</view>
<!-- 动态显示内容 -->
<template v-if="configType === 'system'">
<view class="form-item align-start">
<view class="label-box pt-10">
<text class="label-txt">客服反馈:</text>
</view>
<view class="input-box">
<textarea
class="textarea-base"
v-model="feedbackText"
placeholder="请输入客服反馈内容"
/>
<text class="input-tip">暂无客服在线是,联系客服跳转的客服反馈页面的显示文字</text>
</view>
</view>
</template>
<template v-else-if="configType === 'phone'">
<view class="form-item">
<view class="label-box">
<text class="label-txt">客服电话:</text>
</view>
<view class="input-box">
<input class="input-base" v-model="phoneNumber" placeholder="请输入客服电话" />
<text class="input-tip">客服类型选择不打电话是,用户点击联系客服的联系电话</text>
</view>
</view>
</template>
<template v-else-if="configType === 'link'">
<view class="form-item">
<view class="label-box">
<text class="label-txt">跳转链接:</text>
</view>
<view class="input-box">
<input class="input-base" v-model="linkUrl" placeholder="请输入外部链接地址" />
<text class="input-tip">客服类型选择跳转链接时,用户点击联系客服跳转的外部链接</text>
</view>
</view>
</template>
<!-- 提交按钮 -->
<view class="form-item no-label">
<view class="btn-submit" @click="handleSubmit">
<text class="submit-txt">提交</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
const configType = ref('system') // system, phone, link
const feedbackText = ref('尊敬的用户,客服当前不在线,有问题请留言,我们会第一时间进行处理!!!')
const phoneNumber = ref('4008888794')
const linkUrl = ref('')
const handleSubmit = () => {
console.log('提交配置', {
type: configType.value,
feedback: feedbackText.value,
phone: phoneNumber.value,
link: linkUrl.value
})
uni.showToast({
title: '保存成功',
icon: 'success'
})
}
</script>
<style scoped lang="scss">
.admin-kefu-config {
padding: 20px;
background-color: #f5f7fa;
min-height: 100vh;
}
.border-shadow {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.config-container {
min-height: 500px;
}
/* Tabs */
.config-tabs {
height: 54px;
padding: 0 20px;
border-bottom: 1px solid #f0f0f0;
display: flex;
flex-direction: row;
}
.tab-item {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
position: relative;
margin-right: 20px;
cursor: pointer;
}
.tab-txt {
font-size: 14px;
color: #2d8cf0;
font-weight: 500;
}
.tab-line {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background-color: #2d8cf0;
}
/* Content */
.config-content {
padding: 40px 20px;
}
.form-item {
display: flex;
flex-direction: row;
margin-bottom: 24px;
align-items: center;
}
.align-start {
align-items: flex-start;
}
.no-label {
padding-left: 140px;
}
.label-box {
width: 140px;
display: flex;
justify-content: flex-end;
padding-right: 20px;
}
.pt-10 {
padding-top: 10px;
}
.label-txt {
font-size: 14px;
color: #606266;
}
.input-box {
flex: 1;
max-width: 600px;
}
.flex-row {
display: flex;
flex-direction: row;
}
/* Radio Group */
.radio-group {
display: flex;
flex-direction: row;
align-items: center;
}
.radio-item {
display: flex;
flex-direction: row;
align-items: center;
margin-right: 30px;
cursor: pointer;
}
.radio-circle {
width: 16px;
height: 16px;
border: 1px solid #dcdfe6;
border-radius: 50%;
margin-right: 8px;
display: flex;
align-items: center;
justify-content: center;
background-color: #fff;
}
.radio-circle.checked {
border-color: #2d8cf0;
}
.radio-inner {
width: 8px;
height: 8px;
background-color: #2d8cf0;
border-radius: 50%;
}
.radio-label {
font-size: 14px;
color: #606266;
}
/* Tips */
.tip-box {
background-color: transparent;
}
.tip-txt {
font-size: 12px;
color: #c0c4cc;
line-height: 1.8;
}
.input-tip {
font-size: 12px;
color: #c0c4cc;
margin-top: 10px;
display: block;
}
/* Inputs */
.input-base {
width: 100%;
height: 38px;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 0 15px;
font-size: 14px;
}
.textarea-base {
width: 100%;
height: 150px;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 10px 15px;
font-size: 14px;
}
/* Button */
.btn-submit {
width: 64px;
height: 34px;
background-color: #2d8cf0;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.submit-txt {
color: #fff;
font-size: 14px;
}
</style>

View File

@@ -0,0 +1,347 @@
<template>
<view class="admin-kefu-feedback">
<view class="content-body">
<!-- 顶部搜索栏 -->
<view class="filter-card border-shadow">
<view class="filter-item">
<text class="label-txt">留言时间:</text>
<view class="date-picker-mock">
<text class="placeholder">开始日期</text>
<text class="sep">-</text>
<text class="placeholder">结束日期</text>
<text class="calendar-icon">📅</text>
</view>
</view>
<view class="filter-item">
<text class="label-txt">留言信息:</text>
<input class="search-input" placeholder="请输入用户昵称/电话/留言内容搜索" v-model="searchQuery" />
</view>
<view class="btn-query" @click="handleQuery">
<text class="query-txt">查询</text>
</view>
</view>
<!-- 数据表格 -->
<view class="table-card border-shadow">
<view class="table-header">
<view class="th col-id"><text class="th-txt">ID</text></view>
<view class="th col-nick"><text class="th-txt">昵称</text></view>
<view class="th col-phone"><text class="th-txt">电话</text></view>
<view class="th col-content"><text class="th-txt">内容</text></view>
<view class="th col-status"><text class="th-txt">状态</text></view>
<view class="th col-time"><text class="th-txt">时间</text></view>
<view class="th col-op"><text class="th-txt">操作</text></view>
</view>
<view class="table-body">
<view class="table-row" v-for="item in feedbackList" :key="item.id">
<view class="td col-id"><text class="td-txt">{{ item.id }}</text></view>
<view class="td col-nick"><text class="td-txt">{{ item.nickname }}</text></view>
<view class="td col-phone"><text class="td-txt">{{ item.phone }}</text></view>
<view class="td col-content"><text class="td-txt ellipsis">{{ item.content }}</text></view>
<view class="td col-status">
<text class="status-tag">{{ item.status }}</text>
</view>
<view class="td col-time"><text class="td-txt">{{ item.time }}</text></view>
<view class="td col-op">
<text class="btn-link" @click="handleProcess(item)">处理</text>
<view class="divider"></view>
<text class="btn-link danger" @click="handleDelete(item)">删除</text>
</view>
</view>
</view>
<!-- 分页 -->
<view class="pagination-bar">
<text class="page-total">共 {{ feedbackList.length }} 条</text>
<view class="page-nav">
<view class="nav-btn"><text class="nav-icon"> < </text></view>
<view class="nav-item active"><text class="nav-num">1</text></view>
<view class="nav-btn"><text class="nav-icon"> > </text></view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
interface FeedbackItem {
id: string
nickname: string
phone: string
content: string
status: string
time: string
}
const searchQuery = ref('')
const feedbackList = ref<FeedbackItem[]>([
{ id: '37', nickname: 'hhh', phone: '14779580008', content: 'hhh', status: '未处理', time: '2025-12-20 03:22:10' },
{ id: '36', nickname: 'hhh', phone: '14779580008', content: 'hhh', status: '未处理', time: '2025-12-20 03:22:05' },
{ id: '35', nickname: '发给大哥他', phone: '13212324567', content: '回复挂号费', status: '未处理', time: '2025-12-17 22:11:35' },
{ id: '34', nickname: '郑立民', phone: '15604580931', content: '我提现为啥不到账', status: '未处理', time: '2025-11-24 12:29:02' },
{ id: '33', nickname: '11', phone: '15012760793', content: '22222', status: '未处理', time: '2025-10-16 17:55:31' },
{ id: '32', nickname: '玉兔', phone: '13133164548', content: '我去会吐', status: '未处理', time: '2025-09-09 15:31:45' },
{ id: '31', nickname: '哟', phone: '15151424728', content: '玩意', status: '未处理', time: '2025-09-04 15:40:28' },
{ id: '30', nickname: '哟', phone: '15151424728', content: '玩意', status: '未处理', time: '2025-09-04 15:40:27' },
{ id: '29', nickname: 'pww', phone: '15274289992', content: '我们的', status: '未处理', time: '2025-08-13 18:21:35' },
{ id: '28', nickname: '1', phone: '18888888888', content: '1', status: '未处理', time: '2024-12-12 11:56:48' }
])
const handleQuery = () => {
console.log('查询:', searchQuery.value)
}
const handleProcess = (item: FeedbackItem) => {
console.log('处理留言:', item.id)
}
const handleDelete = (item: FeedbackItem) => {
console.log('删除留言:', item.id)
}
</script>
<style scoped lang="scss">
.admin-kefu-feedback {
padding: 20px;
background-color: #f5f7fa;
min-height: 100vh;
}
.border-shadow {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
/* 过滤栏 */
.filter-card {
padding: 20px;
margin-bottom: 20px;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
gap: 30px;
}
.filter-item {
display: flex;
flex-direction: row;
align-items: center;
}
.label-txt {
font-size: 14px;
color: #606266;
margin-right: 12px;
}
.date-picker-mock {
width: 320px;
height: 38px;
border: 1px solid #dcdfe6;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 12px;
}
.placeholder {
font-size: 13px;
color: #c0c4cc;
}
.sep {
margin: 0 8px;
color: #c0c4cc;
}
.calendar-icon {
margin-left: auto;
font-size: 14px;
color: #c0c4cc;
}
.search-input {
width: 320px;
height: 38px;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 0 12px;
font-size: 13px;
}
.btn-query {
width: 76px;
height: 34px;
background-color: #2d8cf0;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.query-txt {
color: #fff;
font-size: 14px;
}
/* 表格卡片 */
.table-card {
display: flex;
flex-direction: column;
}
.table-header {
height: 50px;
background-color: #eaf2ff;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.th {
display: flex;
align-items: center;
padding: 0 15px;
}
.th-txt {
font-size: 13px;
color: #606266;
font-weight: bold;
}
.table-row {
height: 60px;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.table-row:hover {
background-color: #f9f9f9;
}
.td {
display: flex;
align-items: center;
padding: 0 15px;
}
.td-txt {
font-size: 13px;
color: #606266;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 列宽定义 */
.col-id { width: 80px; justify-content: center; }
.col-nick { width: 140px; }
.col-phone { width: 180px; }
.col-content { flex: 1; justify-content: flex-start; }
.col-status { width: 120px; justify-content: center; }
.col-time { width: 220px; justify-content: center; }
.col-op {
display: flex;
flex-direction: row;
align-items: center;
width: 150px;
justify-content: center;
}
.status-tag {
font-size: 12px;
color: #606266;
}
.btn-link {
font-size: 13px;
color: #2d8cf0;
cursor: pointer;
}
.btn-link.danger {
color: #2d8cf0; /* 根据截图,删除也是蓝色的链接感,但通常后台会区分,这里按截图感肉眼识别为蓝色 */
}
.divider {
width: 1px;
height: 12px;
background-color: #e8eaec;
margin: 0 10px;
}
/* 分页栏 */
.pagination-bar {
padding: 20px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.page-total {
font-size: 13px;
color: #606266;
margin-right: 15px;
}
.page-nav {
display: flex;
flex-direction: row;
align-items: center;
}
.nav-btn {
width: 30px;
height: 30px;
border: 1px solid #dcdee2;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
margin: 0 4px;
}
.nav-item {
width: 30px;
height: 30px;
border: 1px solid #dcdee2;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
margin: 0 4px;
}
.nav-item.active {
background-color: #2d8cf0;
border-color: #2d8cf0;
}
.nav-item.active .nav-num {
color: #fff;
}
.nav-num, .nav-icon {
font-size: 13px;
color: #606266;
}
</style>

View File

@@ -0,0 +1,324 @@
<template>
<view class="admin-kefu-list">
<!-- 顶部操作栏 -->
<view class="page-top-bar">
<view class="btn-primary" @click="handleAdd">
<text class="btn-txt">添加客服</text>
</view>
</view>
<!-- 数据表格 -->
<view class="table-container border-shadow">
<view class="table-header">
<view class="th col-id"><text class="th-txt">ID</text></view>
<view class="th col-avatar"><text class="th-txt">客服头像</text></view>
<view class="th col-name"><text class="th-txt">客服名称</text></view>
<view class="th col-status"><text class="th-txt">客服状态</text></view>
<view class="th col-time"><text class="th-txt">添加时间</text></view>
<view class="th col-op"><text class="th-txt">操作</text></view>
</view>
<view class="table-body">
<view class="table-row" v-for="item in kefuList" :key="item.id">
<view class="td col-id"><text class="td-txt">{{ item.id }}</text></view>
<view class="td col-avatar">
<image class="kefu-avatar" :src="item.avatar" mode="aspectFill"></image>
</view>
<view class="td col-name"><text class="td-txt">{{ item.name }}</text></view>
<view class="td col-status">
<view :class="['switch-btn', item.status ? 'switch-on' : 'switch-off']" @click="toggleStatus(item)">
<view class="switch-inner">
<text class="switch-txt">{{ item.status ? '开启' : '关闭' }}</text>
</view>
<view class="switch-dot"></view>
</view>
</view>
<view class="td col-time"><text class="td-txt">{{ item.time }}</text></view>
<view class="td col-op">
<text class="btn-action">编辑</text>
<view class="divider"></view>
<text class="btn-action">删除</text>
<view class="divider"></view>
<text class="btn-action">进入工作台</text>
</view>
</view>
</view>
<!-- 分页栏 -->
<view class="pagination-bar">
<text class="page-total">共 {{ kefuList.length }} 条</text>
<view class="page-size-select">
<text class="size-txt">15条/页</text>
<text class="arrow-down">▼</text>
</view>
<view class="page-nav">
<view class="nav-prev"><text class="nav-icon"> < </text></view>
<view class="nav-item active"><text class="nav-num">1</text></view>
<view class="nav-next"><text class="nav-icon"> > </text></view>
</view>
<view class="page-jump">
<text class="jump-txt">前往</text>
<input class="jump-input" value="1" />
<text class="jump-txt">页</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref } from 'vue'
interface KefuItem {
id: string
avatar: string
name: string
status: boolean
time: string
}
const kefuList = ref<KefuItem[]>([
{ id: '167', avatar: '/static/logo.png', name: '客服', status: true, time: '2025-12-31 11:24:35' },
{ id: '166', avatar: '/static/logo.png', name: '测试', status: true, time: '2025-11-18 17:33:26' },
{ id: '165', avatar: '/static/logo.png', name: 'zhicheng', status: true, time: '2025-09-10 10:13:00' },
{ id: '164', avatar: '/static/logo.png', name: 'kefu', status: true, time: '2025-07-29 11:50:20' },
{ id: '162', avatar: '/static/logo.png', name: '呐呐', status: true, time: '2024-12-09 10:51:11' },
{ id: '153', avatar: '/static/logo.png', name: '小天', status: true, time: '2024-09-19 16:04:59' },
{ id: '152', avatar: '/static/logo.png', name: 'kk', status: true, time: '2024-09-16 00:05:22' }
])
const toggleStatus = (item: KefuItem) => {
item.status = !item.status
}
const handleAdd = () => {
console.log('Add Kefu')
}
</script>
<style scoped lang="scss">
.admin-kefu-list {
padding: 20px;
background-color: #f5f7fa;
min-height: 100vh;
}
.border-shadow {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.page-top-bar {
margin-bottom: 20px;
}
.btn-primary {
width: 100px;
height: 36px;
background-color: #2d8cf0;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.btn-txt {
color: #fff;
font-size: 14px;
}
/* 表格样式 */
.table-container {
display: flex;
flex-direction: column;
}
.table-header {
height: 50px;
background-color: #e6f0ff;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.th {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
}
.th-txt {
font-size: 13px;
color: #606266;
font-weight: 500;
}
.table-row {
height: 70px;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.table-row:hover {
background-color: #f9fbff;
}
.td {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
}
.td-txt {
font-size: 13px;
color: #606266;
}
/* 列宽百分比对齐截图 */
.col-id { width: 80px; }
.col-avatar { width: 120px; }
.col-name { flex: 1; justify-content: flex-start; }
.col-status { width: 150px; }
.col-time { width: 220px; }
.col-op {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 250px;
}
.kefu-avatar {
width: 36px;
height: 36px;
border-radius: 4px;
background-color: #f0f0f0;
}
/* 开关组件 1:1 复刻 */
.switch-btn {
width: 60px;
height: 24px;
border-radius: 12px;
position: relative;
display: flex;
align-items: center;
padding: 0 6px;
cursor: pointer;
transition: all 0.3s;
}
.switch-on { background-color: #2d8cf0; }
.switch-off { background-color: #ccc; }
.switch-inner {
flex: 1;
display: flex;
justify-content: center;
}
.switch-txt {
color: #fff;
font-size: 11px;
}
.switch-dot {
width: 18px;
height: 18px;
background-color: #fff;
border-radius: 9px;
position: absolute;
top: 3px;
}
.switch-on .switch-dot { right: 3px; }
.switch-off .switch-dot { left: 3px; }
/* 操作按钮 */
.btn-action {
font-size: 13px;
color: #2d8cf0;
cursor: pointer;
}
.divider {
width: 1px;
height: 12px;
background-color: #e8eaec;
margin: 0 12px;
}
/* 分页栏 */
.pagination-bar {
padding: 20px 24px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.page-total { font-size: 13px; color: #606266; margin-right: 15px; }
.page-size-select {
border: 1px solid #dcdee2;
padding: 4px 10px;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
margin-right: 15px;
}
.size-txt { font-size: 13px; color: #606266; margin-right: 8px; }
.arrow-down { font-size: 10px; color: #808695; }
.page-nav { display: flex; flex-direction: row; align-items: center; margin-right: 15px; }
.nav-prev, .nav-next {
width: 32px;
height: 32px;
border: 1px solid #dcdee2;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
margin: 0 4px;
}
.nav-item {
width: 32px;
height: 32px;
border: 1px solid #dcdee2;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
margin: 0 4px;
}
.active {
background-color: #2d8cf0;
border-color: #2d8cf0;
}
.active .nav-num { color: #fff; }
.nav-num, .nav-icon { font-size: 13px; color: #606266; }
.page-jump { display: flex; flex-direction: row; align-items: center; }
.jump-txt { font-size: 13px; color: #606266; }
.jump-input {
width: 40px;
height: 30px;
border: 1px solid #dcdee2;
border-radius: 4px;
text-align: center;
margin: 0 8px;
font-size: 13px;
}
</style>

View File

@@ -0,0 +1,626 @@
<template>
<view class="admin-kefu-words">
<view class="words-container">
<!-- 左侧分类 -->
<view class="category-sidebar border-shadow">
<view class="sidebar-header" @click="handleAddCategory">
<text class="plus-icon">+</text>
<text class="header-txt">添加分类</text>
</view>
<scroll-view class="category-list" scroll-y="true">
<view
v-for="cat in categories"
:key="cat.id"
:class="['category-item', activeCategoryId == cat.id ? 'active' : '']"
@click="selectCategory(cat.id)"
>
<view class="folder-icon">📂</view>
<text class="cat-name">{{ cat.name }}</text>
</view>
</scroll-view>
</view>
<!-- 右侧话术列表 -->
<view class="content-main">
<view class="top-bar">
<view class="btn-primary" @click="handleAddWord">
<text class="btn-txt">添加话术</text>
</view>
</view>
<view class="table-card border-shadow">
<view class="table-header">
<view class="th col-id"><text class="th-txt">ID</text></view>
<view class="th col-cat"><text class="th-txt">分类</text></view>
<view class="th col-title"><text class="th-txt">标题</text></view>
<view class="th col-detail"><text class="th-txt">详情</text></view>
<view class="th col-sort"><text class="th-txt">排序</text></view>
<view class="th col-time"><text class="th-txt">添加时间</text></view>
<view class="th col-op"><text class="th-txt">操作</text></view>
</view>
<view class="table-body">
<view class="table-row" v-for="item in wordList" :key="item.id">
<view class="td col-id"><text class="td-txt">{{ item.id }}</text></view>
<view class="td col-cat"><text class="td-txt">{{ item.category }}</text></view>
<view class="td col-title"><text class="td-txt">{{ item.title }}</text></view>
<view class="td col-detail">
<text class="td-txt ellipsis-2">{{ item.content }}</text>
</view>
<view class="td col-sort"><text class="td-txt">{{ item.sort }}</text></view>
<view class="td col-time"><text class="td-txt">{{ item.time }}</text></view>
<view class="td col-op">
<text class="btn-action" @click="handleEdit(item)">编辑</text>
<view class="divider"></view>
<text class="btn-action danger">删除</text>
</view>
</view>
</view>
<!-- 分页 -->
<view class="pagination-bar">
<text class="page-total">共 {{ wordList.length }} 条</text>
<view class="page-size-select">
<text class="size-txt">15条/页</text>
<text class="arrow-down">▼</text>
</view>
<view class="page-nav">
<view class="nav-prev"><text class="nav-icon"> < </text></view>
<view class="nav-item active"><text class="nav-num">1</text></view>
<view class="nav-next"><text class="nav-icon"> > </text></view>
</view>
<view class="page-jump">
<text class="jump-txt">前往</text>
<input class="jump-input" value="1" />
<text class="jump-txt">页</text>
</view>
</view>
</view>
</view>
</view>
<!-- 侧边弹窗 (Drawer) -->
<view v-if="showDrawer" class="drawer-mask" @click="closeDrawer">
<view class="drawer-content" @click.stop>
<view class="drawer-header">
<text class="drawer-title">{{ isEdit ? '编辑话术' : '添加话术' }}</text>
<text class="close-btn" @click="closeDrawer">×</text>
</view>
<view class="drawer-body">
<view class="form-item">
<view class="label-box">
<text class="label-txt">话术分类:</text>
</view>
<view class="input-box">
<view class="select-mock">
<text class="select-val">{{ formData.category || '请选择分类' }}</text>
<text class="arrow-down">▼</text>
</view>
</view>
</view>
<view class="form-item">
<view class="label-box">
<text class="required">*</text>
<text class="label-txt">话术标题:</text>
</view>
<view class="input-box">
<input class="input-base" v-model="formData.title" placeholder="请输入话术标题" />
</view>
</view>
<view class="form-item align-start">
<view class="label-box">
<text class="required">*</text>
<text class="label-txt">话术内容:</text>
</view>
<view class="input-box">
<textarea class="textarea-base" v-model="formData.content" placeholder="请输入话术内容" />
</view>
</view>
<view class="form-item">
<view class="label-box">
<text class="label-txt">排序:</text>
</view>
<view class="input-box">
<input class="input-base" type="number" v-model="formData.sort" />
</view>
</view>
</view>
<view class="drawer-footer">
<view class="btn-cancel" @click="closeDrawer">
<text class="cancel-txt">取消</text>
</view>
<view class="btn-confirm" @click="submitForm">
<text class="confirm-txt">确定</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, reactive } from 'vue'
interface WordItem {
id: string
category: string
title: string
content: string
sort: number
time: string
}
interface Category {
id: number
name: string
}
const categories = ref<Category[]>([
{ id: 1, name: '全部' },
{ id: 2, name: '系统话术' }
])
const activeCategoryId = ref(1)
const wordList = ref<WordItem[]>([
{
id: '67',
category: '系统默认',
title: '旗舰版介绍',
content: '【旗舰版】可以授权给公司或者个人,企业自用搭建,不限制授权域名,提供专属技术总监、产品总监等。',
sort: 0,
time: '2024-09-27 10:15:07'
}
])
// 表单逻辑
const showDrawer = ref(false)
const isEdit = ref(false)
const formData = reactive({
id: '',
category: '系统话术',
title: '',
content: '',
sort: 0
})
const selectCategory = (id: number) => {
activeCategoryId.value = id
}
const handleAddCategory = () => {
console.log('添加分类')
}
const handleAddWord = () => {
isEdit.value = false
formData.id = ''
formData.title = ''
formData.content = ''
formData.sort = 0
showDrawer.value = true
}
const handleEdit = (item: WordItem) => {
isEdit.value = true
formData.id = item.id
formData.category = item.category
formData.title = item.title
formData.content = item.content
formData.sort = item.sort
showDrawer.value = true
}
const closeDrawer = () => {
showDrawer.value = false
}
const submitForm = () => {
console.log('提交表单', formData)
showDrawer.value = false
}
</script>
<style scoped lang="scss">
.admin-kefu-words {
padding: 20px;
background-color: #f5f7fa;
min-height: 100vh;
}
.border-shadow {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
}
.words-container {
display: flex;
flex-direction: row;
height: calc(100vh - 40px);
gap: 20px;
}
/* 左侧分类 */
.category-sidebar {
width: 280px;
display: flex;
flex-direction: column;
}
.sidebar-header {
height: 50px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 20px;
border-bottom: 1px solid #f0f0f0;
cursor: pointer;
}
.plus-icon {
font-size: 18px;
color: #c0c4cc;
margin-right: 8px;
}
.header-txt {
font-size: 14px;
color: #606266;
}
.category-list {
flex: 1;
padding: 10px 0;
}
.category-item {
height: 44px;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 20px;
cursor: pointer;
}
.category-item:hover {
background-color: #f5f7fa;
}
.category-item.active {
background-color: #e6f7ff;
border-right: 2px solid #2d8cf0;
}
.folder-icon {
margin-right: 10px;
font-size: 14px;
}
.cat-name {
font-size: 14px;
color: #333;
}
/* 右侧内容 */
.content-main {
flex: 1;
display: flex;
flex-direction: column;
}
.top-bar {
margin-bottom: 20px;
}
.btn-primary {
width: 90px;
height: 34px;
background-color: #2d8cf0;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.btn-txt {
color: #fff;
font-size: 13px;
}
.table-card {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.table-header {
height: 50px;
background-color: #e6f0ff;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.th {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
}
.th-txt {
font-size: 13px;
color: #606266;
font-weight: 500;
}
.table-body {
flex: 1;
}
.table-row {
height: 70px;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.td {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10px;
}
.td-txt {
font-size: 13px;
color: #606266;
}
.ellipsis-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-align: left;
}
/* 列宽分配 */
.col-id { width: 60px; }
.col-cat { width: 100px; }
.col-title { width: 150px; }
.col-detail { flex: 1; justify-content: flex-start; }
.col-sort { width: 80px; }
.col-time { width: 180px; }
.col-op { width: 150px; }
.btn-action {
font-size: 13px;
color: #2d8cf0;
cursor: pointer;
}
.danger {
color: #ed4014;
}
.divider {
width: 1px;
height: 12px;
background-color: #e8eaec;
margin: 0 10px;
}
/* 分页 */
.pagination-bar {
padding: 15px 20px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
border-top: 1px solid #f0f0f0;
}
.page-total { font-size: 13px; color: #606266; margin-right: 15px; }
.page-size-select {
border: 1px solid #dcdee2;
padding: 4px 10px;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
margin-right: 15px;
}
.size-txt { font-size: 13px; color: #606266; margin-right: 8px; }
.nav-icon, .arrow-down { font-size: 10px; color: #808695; }
.page-nav { display: flex; flex-direction: row; align-items: center; margin-right: 15px; }
.nav-prev, .nav-next, .nav-item {
width: 30px;
height: 30px;
border: 1px solid #dcdee2;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
margin: 0 4px;
}
.nav-item.active {
background-color: #2d8cf0;
border-color: #2d8cf0;
}
.active .nav-num { color: #fff; }
.nav-num { font-size: 13px; color: #606266; }
.page-jump { display: flex; flex-direction: row; align-items: center; }
.jump-txt { font-size: 13px; color: #606266; }
.jump-input {
width: 40px;
height: 30px;
border: 1px solid #dcdee2;
border-radius: 4px;
text-align: center;
margin: 0 8px;
font-size: 13px;
}
/* 抽屉 Drawer 1:1 复刻 - 修正位置到右侧 */
.drawer-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
z-index: 1000;
}
.drawer-content {
position: absolute;
top: 0;
right: 0; /* 强制靠右占据右边屏幕 */
width: 50%; /* 占屏幕一半宽度 */
height: 100%;
background-color: #fff;
display: flex;
flex-direction: column;
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
animation: slideIn 0.3s ease;
}
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
.drawer-header {
height: 55px;
padding: 0 20px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #f0f0f0;
}
.drawer-title {
font-size: 16px;
font-weight: 600;
color: #333;
}
.close-btn {
font-size: 24px;
color: #999;
cursor: pointer;
}
.drawer-body {
flex: 1;
padding: 24px;
}
.form-item {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 24px;
}
.align-start {
align-items: flex-start;
}
.label-box {
width: 100px;
display: flex;
flex-direction: row;
justify-content: flex-end;
margin-right: 15px;
}
.required {
color: #ed4014;
margin-right: 4px;
}
.label-txt {
font-size: 14px;
color: #606266;
}
.input-box {
flex: 1;
}
.select-mock {
height: 36px;
border: 1px solid #dcdee2;
border-radius: 4px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 12px;
}
.select-val { font-size: 14px; color: #333; }
.input-base {
width: 100%;
height: 36px;
border: 1px solid #dcdee2;
border-radius: 4px;
padding: 0 12px;
font-size: 14px;
}
.textarea-base {
width: 100%;
height: 120px;
border: 1px solid #dcdee2;
border-radius: 4px;
padding: 10px 12px;
font-size: 14px;
}
.drawer-footer {
height: 60px;
border-top: 1px solid #f0f0f0;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
padding: 0 24px;
}
.btn-cancel {
padding: 8px 18px;
border: 1px solid #dcdee2;
border-radius: 4px;
margin-right: 12px;
}
.btn-confirm {
padding: 8px 18px;
background-color: #2d8cf0;
border-radius: 4px;
}
.cancel-txt { font-size: 14px; color: #606266; }
.confirm-txt { font-size: 14px; color: #fff; }
</style>