refactor(views): 移除测试页面并清理模拟数据

移除不再使用的缓存测试页面 CacheTest.vue
清理 MemberDetails.vue 中的模拟录音数据,准备接入真实API
This commit is contained in:
2025-09-15 11:29:37 +08:00
parent 62a4eb0319
commit 2447985cb2
2 changed files with 1 additions and 202 deletions

View File

@@ -228,35 +228,7 @@ const formatAmount = (amount) => {
// 获取成员录音列表 // 获取成员录音列表
const getRecordingsForMember = (member) => { const getRecordingsForMember = (member) => {
// 模拟录音数据实际项目中应该从API获取 // 模拟录音数据实际项目中应该从API获取
const recordings = [ const recordings = []
{
id: 1,
title: '客户咨询 - 张先生',
date: '2024-01-15 14:30',
duration: '12:35',
type: 'consultation',
typeLabel: '咨询',
fileUrl: '/recordings/test_recording.m4a' // 使用测试文件
},
{
id: 2,
title: '跟进回访 - 李女士',
date: '2024-01-15 10:15',
duration: '8:42',
type: 'followup',
typeLabel: '回访',
fileUrl: '/recordings/test_recording.m4a' // 使用测试文件
},
{
id: 3,
title: '成交确认 - 王总',
date: '2024-01-14 16:20',
duration: '15:18',
type: 'deal',
typeLabel: '成交',
fileUrl: '/recordings/test_recording.m4a' // 使用测试文件
}
]
// 根据成员ID返回对应的录音这里简化处理 // 根据成员ID返回对应的录音这里简化处理
return recordings.slice(0, Math.min(3, member?.calls || 0)) return recordings.slice(0, Math.min(3, member?.calls || 0))

View File

@@ -1,173 +0,0 @@
<template>
<div class="cache-test">
<h1>缓存系统测试页面</h1>
<div class="test-section">
<h2>缓存统计信息</h2>
<div class="cache-stats">
<p>总缓存数量: {{ cacheStats.totalCount }}</p>
<p>有效缓存数量: {{ cacheStats.validCount }}</p>
<p>过期缓存数量: {{ cacheStats.expiredCount }}</p>
<p>缓存时长: {{ cacheStats.duration }}</p>
</div>
</div>
<div class="test-section">
<h2>缓存操作</h2>
<div class="cache-actions">
<button @click="refreshStats" class="btn primary">刷新统计</button>
<button @click="clearAllCache" class="btn secondary">清除所有缓存</button>
<button @click="clearExpiredCache" class="btn secondary">清除过期缓存</button>
</div>
</div>
<div class="test-section">
<h2>缓存详情</h2>
<div class="cache-details">
<div v-if="cacheStats.validCaches && cacheStats.validCaches.length > 0">
<h3>有效缓存列表:</h3>
<ul>
<li v-for="cache in cacheStats.validCaches" :key="cache.key">
<strong>{{ cache.key }}</strong> - 存活时间: {{ cache.age }}
</li>
</ul>
</div>
<div v-else>
<p>暂无有效缓存</p>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useCacheStore } from '@/stores/cache'
// 缓存store
const cacheStore = useCacheStore()
// 缓存统计信息
const cacheStats = ref({
totalCount: 0,
validCount: 0,
expiredCount: 0,
duration: '30分钟',
validCaches: []
})
// 刷新统计信息
const refreshStats = () => {
const stats = cacheStore.getCacheStats()
cacheStats.value = stats
console.log('缓存统计信息:', stats)
}
// 清除所有缓存
const clearAllCache = () => {
cacheStore.clearCache()
refreshStats()
console.log('已清除所有缓存')
}
// 清除过期缓存
const clearExpiredCache = () => {
const info = cacheStore.clearExpiredCache()
refreshStats()
console.log('清除过期缓存结果:', info)
}
// 页面加载时获取统计信息
onMounted(() => {
refreshStats()
})
</script>
<style lang="scss" scoped>
.cache-test {
padding: 2rem;
max-width: 800px;
margin: 0 auto;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.test-section {
margin-bottom: 2rem;
padding: 1.5rem;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #f8fafc;
}
.cache-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
p {
margin: 0;
padding: 0.75rem;
background: white;
border-radius: 4px;
border-left: 4px solid #3b82f6;
}
}
.cache-actions {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
&.primary {
background: #3b82f6;
color: white;
&:hover {
background: #2563eb;
}
}
&.secondary {
background: #6b7280;
color: white;
&:hover {
background: #4b5563;
}
}
}
.cache-details {
ul {
list-style: none;
padding: 0;
li {
padding: 0.5rem;
margin-bottom: 0.5rem;
background: white;
border-radius: 4px;
border-left: 3px solid #10b981;
}
}
}
h1, h2, h3 {
color: #1f2937;
margin-top: 0;
}
h1 {
text-align: center;
margin-bottom: 2rem;
}
</style>