适配微信小程序

This commit is contained in:
zhonghua.li
2026-04-17 09:41:37 +08:00
parent 18455a311d
commit 36b8784bc1
59 changed files with 650 additions and 586 deletions

View File

@@ -16,145 +16,11 @@
</uni-nav-bar>
<view class="content">
<!-- 功能分类展示 -->
<scroll-view class="content-scroll" scroll-y="true" :style="{ top: computedContentTop || contentTop, bottom: contentBottom || '96rpx' }">
<!-- 接待 -->
<view class="category-section quick-links-section">
<view class="category-header">
<text class="category-icon">🚀</text>
<text class="category-title">接待</text>
</view>
<view class="function-grid">
<view class="function-item" @click="quickJumpReceptionTab('reception')">
<view class="function-icon">🤝</view>
<text class="function-name">开始接待</text>
<text class="function-desc"></text>
</view>
<view class="function-item" @click="quickJumpReceptionTab('status')">
<view class="function-icon">📋</view>
<text class="function-name">服务中</text>
<text class="function-desc"></text>
</view>
<view class="function-item" @click="quickJumpReceptionTab('tag')">
<view class="function-icon">🏷</view>
<text class="function-name">标签管理</text>
<text class="function-desc"></text>
</view>
</view>
</view>
<!-- AI分析 -->
<view class="category-section two-column">
<view class="category-header">
<text class="category-icon">👤</text>
<text class="category-title">AI分析</text>
</view>
<view class="function-grid">
<view class="function-item" @click="quickJumpCustomerTab('customer')">
<view class="function-icon">👥</view>
<text class="function-name">客户列表</text>
<text class="function-desc"></text>
</view>
<view class="function-item" @click="quickJumpCustomerTab('service')">
<view class="function-icon">📝</view>
<text class="function-name">服务记录</text>
<text class="function-desc"></text>
</view>
</view>
</view>
<!-- 录音和接待统计 -->
<view class="category-section two-column">
<view class="category-header">
<text class="category-icon">📊</text>
<text class="category-title">录音和接待统计</text>
</view>
<view class="function-grid">
<view class="function-item" @click="navigateToPage('recording_duration')">
<view class="function-icon"></view>
<text class="function-name">录音时长</text>
<text class="function-desc"></text>
</view>
<view class="function-item" @click="navigateToPage('customer_count')">
<view class="function-icon">👥</view>
<text class="function-name">接待客户数</text>
<text class="function-desc"></text>
</view>
</view>
</view>
<!-- 质量管控 -->
<view class="category-section two-column">
<view class="category-header">
<text class="category-icon"></text>
<text class="category-title">质量管控</text>
</view>
<view class="function-grid">
<view class="function-item" @click="showQualityCoveragePopup">
<view class="function-icon">📊</view>
<text class="function-name">质检覆盖率</text>
<text class="function-desc"></text>
</view>
<view class="function-item" @click="navigateToPage('speech_rating')">
<view class="function-icon">🗣</view>
<text class="function-name">员工话术评分</text>
<text class="function-desc"></text>
</view>
</view>
</view>
<!-- 销售分析 -->
<view class="category-section sales-analysis">
<view class="category-header">
<text class="category-icon">📈</text>
<text class="category-title">销售分析</text>
</view>
<view class="function-grid">
<view class="function-item full-row-item" @click="navigateToPage('intent_level')">
<view class="function-icon">🎯</view>
<text class="function-name">客户意向分级</text>
<text class="function-desc"></text>
</view>
<view class="function-item full-row-item" @click="navigateToPage('deal_attribution')">
<view class="function-icon">💰</view>
<text class="function-name">成交归因</text>
<text class="function-desc"></text>
</view>
<view class="function-item full-row-item new-line-item" @click="navigateToPage('opening_rate')">
<view class="function-icon">🚪</view>
<text class="function-name">开口率</text>
<text class="function-desc"></text>
</view>
</view>
</view>
<!-- 风险监控 -->
<view class="category-section two-column">
<view class="category-header">
<text class="category-icon"></text>
<text class="category-title">风险监控</text>
</view>
<view class="function-grid">
<view class="function-item" @click="navigateToPage('over_commitment')">
<view class="function-icon">🚨</view>
<text class="function-name">过度承诺统计</text>
<text class="function-desc"></text>
</view>
<view class="function-item" @click="navigateToPage('red_line_touch')">
<view class="function-icon">🔴</view>
<text class="function-name">触及红线统计</text>
<text class="function-desc"></text>
</view>
</view>
</view>
</scroll-view>
<ai-analysis-dashboard-body
:content-top="computedContentTop || contentTop"
:content-bottom="contentBottom"
/>
</view>
<!-- 质检覆盖率弹出框 -->
<QualityCoveragePopup
v-if="showQualityCoverage"
:open-trigger="openQualityCoverageTrigger"
@close="onQualityCoveragePopupClose" />
</view>
</template>
@@ -162,6 +28,7 @@
// #ifdef APP
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
// #endif
import AiAnalysisDashboardBody from '@/components/ai-analysis-dashboard-body.vue';
// 注意:子包组件不使用 import 导入,而是通过 componentPlaceholder 配置
// 这样可以确保子包异步加载时组件能正确找到
@@ -206,14 +73,14 @@ function getSystemInfo() {
export default {
// #ifdef APP
components: {
statusBar
// 注意:子包组件不在这里注册,通过 componentPlaceholder 自动处理
// RecordingDurationPopup, CustomerCountPopup, QualityCoveragePopup 通过 componentPlaceholder 配置自动注册
statusBar,
AiAnalysisDashboardBody,
},
// #endif
// #ifndef APP
// 注意:子包组件不在这里注册,通过 componentPlaceholder 自动处理
// CustomerCountPopup, QualityCoveragePopup 通过 componentPlaceholder 配置自动注册
components: {
AiAnalysisDashboardBody,
},
// #endif
data() {
// 动态计算导航栏高度
@@ -228,10 +95,7 @@ export default {
return {
contentTop: totalNavbarHeight + 'rpx', // 内容区域距离顶部的距离
contentBottom: '96rpx', // 内容区域距离底部的距离(默认值,会在 onReady 中更新)
showQualityCoverage: false, // 是否显示质检覆盖率弹出框
subpackageLoaded: false, // 子包是否已加载
popupsInitialized: false, // 弹出框组件是否已初始化
openQualityCoverageTrigger: 0, // 打开质检覆盖率弹出框的触发器
}
},
computed: {
@@ -257,17 +121,6 @@ export default {
this.preloadSubpackage();
}, 100);
// #endif
// 预先创建弹出框组件(使用 v-show组件会被创建但隐藏
// 这样可以避免在访问 $refs 时出现组件未初始化的问题
// 由于使用 v-show组件会在页面加载时就被创建只是通过 CSS 隐藏
this.$nextTick(() => {
// 等待一个渲染周期,确保组件已创建
setTimeout(() => {
this.popupsInitialized = true;
console.log('[AIAnalysis] Popup components ready (using v-show)');
}, 500);
});
},
onShow() {
// 每次页面显示时都重新计算导航栏位置
@@ -377,20 +230,6 @@ export default {
}
},
// #endif
// 显示质检覆盖率弹出框
showQualityCoveragePopup() {
// 显示组件(使用 v-show组件已存在只是显示
this.showQualityCoverage = true;
// 使用触发器来通知子组件打开弹窗,避免直接访问 refs
this.$nextTick(() => {
this.openQualityCoverageTrigger++;
});
},
// 质检覆盖率弹出框关闭事件
onQualityCoveragePopupClose() {
// 弹出框关闭时隐藏组件
this.showQualityCoverage = false;
},
// 计算并更新导航栏和内容区域的位置
updateNavbarPosition() {
const systemInfo = getSystemInfo();
@@ -421,56 +260,6 @@ export default {
console.error('[AIAnalysis][goBack] 返回失败:', err);
}
});
},
navigateToPage(pageName) {
const pagePath = `pages-subpackage/ai_features/${pageName}/${pageName}`
uni.navigateTo({
url: `/${pagePath}`,
fail: (err) => {
console.error('导航失败:', err)
uni.showToast({
title: '页面跳转失败',
icon: 'none'
})
}
})
},
quickJumpReceptionTab(tabKey) {
const allowedTabs = ['status', 'reception', 'tag'];
if (!allowedTabs.includes(tabKey)) {
return;
}
try {
uni.setStorageSync('workbench-reception-tab', tabKey);
} catch (e) {
console.warn('[AIAnalysis] 写入接待tab快捷跳转参数失败:', e);
}
uni.navigateTo({
url: '/pages/furniture_reception/furniture_reception',
fail: (err) => {
console.error('[AIAnalysis] 快捷跳转接待页失败:', err);
uni.showToast({
title: '跳转失败,请稍后重试',
icon: 'none'
});
}
});
},
quickJumpCustomerTab(tabKey) {
const allowedTabs = ['service', 'customer'];
if (!allowedTabs.includes(tabKey)) {
return;
}
uni.navigateTo({
url: `/pages-subpackage/furniture_customer/furniture_customer?tab=${tabKey}`,
fail: (err) => {
console.error('[AIAnalysis] 快捷跳转客户页失败:', err);
uni.showToast({
title: '跳转失败,请稍后重试',
icon: 'none'
});
}
});
}
}
}
@@ -483,15 +272,15 @@ page {
.page {
min-height: 100vh;
background-color: #F5F5F5;
background-color: #f5f5f5;
}
.content {
padding-top: 0 !important;
margin-top: 0 !important;
position: relative;
min-height: 100vh;
/* 确保内容从顶部开始,不受占位符影响 */
width: 100%;
min-height: calc(100vh - 200rpx);
top: 0;
}
@@ -519,151 +308,4 @@ page {
display: none !important;
height: 0 !important;
}
.content-scroll {
position: absolute;
left: 0;
right: 0;
top: 0; /* 先从顶部开始 */
bottom: 0; /* 先设为0通过查询实际高度动态设置 */
/* top值通过内联样式动态设置覆盖上面的 top: 0 */
padding: 0 !important;
padding-bottom: 0 !important;
margin: 0 !important;
box-sizing: border-box;
}
/* 确保scroll-view内部没有默认间距 */
.content-scroll > view {
margin-top: 0;
padding-top: 0;
margin-bottom: 0;
padding-bottom: 0;
}
.category-section {
margin: 20rpx 30rpx;
background: #FFFFFF;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.category-section:first-child {
margin-top: 0;
}
.category-section:last-child {
margin-bottom: 0;
}
.category-header {
display: flex;
align-items: center;
padding: 30rpx;
background: #FFFFFF;
border-bottom: 1rpx solid #F0F0F0;
}
.category-icon {
font-size: 32rpx;
margin-right: 20rpx;
}
.category-title {
font-size: 32rpx;
font-weight: 500;
color: #333;
}
.function-grid {
display: flex;
flex-wrap: wrap;
padding: 10rpx;
}
.quick-links-section .function-item {
width: calc(33.333% - 10rpx);
background: #FFFFFF;
border-radius: 12rpx;
padding: 24rpx 12rpx;
margin: 5rpx;
text-align: center;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
border: 1rpx solid #F0F0F0;
box-sizing: border-box;
}
/* 两列布局的分类 */
.two-column .function-item {
flex: 1;
background: #FFFFFF;
border-radius: 12rpx;
padding: 24rpx 16rpx;
margin: 0 5rpx;
text-align: center;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
border: 1rpx solid #F0F0F0;
}
/* 三列布局的分类 */
.three-column .function-item {
width: 31%;
background: #FFFFFF;
border-radius: 12rpx;
padding: 24rpx 12rpx;
margin: 1%;
text-align: center;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
border: 1rpx solid #F0F0F0;
}
/* 销售分析所有项目统一宽度50% */
.sales-analysis .function-item.full-row-item {
flex: 1;
width: calc(50% - 10rpx);
background: #FFFFFF;
border-radius: 12rpx;
padding: 24rpx 16rpx;
margin: 0 5rpx;
text-align: center;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
border: 1rpx solid #F0F0F0;
}
/* 销售分析开口率单独一行但保持50%宽度 */
.sales-analysis .function-item.new-line-item {
flex-basis: 100%;
width: calc(50% - 10rpx);
margin-top: 10rpx;
}
.function-item:active {
transform: scale(0.95);
box-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.1);
}
.function-icon {
font-size: 48rpx;
margin-bottom: 12rpx;
}
.function-name {
display: block;
font-size: 28rpx;
font-weight: 500;
color: #333;
margin-bottom: 8rpx;
}
.function-desc {
display: block;
font-size: 24rpx;
color: #666;
line-height: 1.4;
}
</style>