fix(mobile): require employee position before user flow

This commit is contained in:
2026-07-09 17:09:26 +08:00
parent 8b92a7e9ac
commit 8f73cb0c84
13 changed files with 473 additions and 33 deletions
+14 -6
View File
@@ -4,8 +4,8 @@
<view class="mentor-hero">
<view class="hero-copy">
<text class="hero-role">生活顾问</text>
<text class="hero-title">客服管家</text>
<text class="hero-role">{{ positionProfile.value }}</text>
<text class="hero-title">{{ positionProfile.heroTitle }}</text>
<text class="hero-sub">有问题,随时问老师傅</text>
</view>
<image class="mentor-image" src="/static/mentor.png" mode="aspectFit" />
@@ -95,9 +95,9 @@
<view v-else class="empty">暂无工具入口</view>
</view>
<button class="tip-card" @click="ask('催费话术')">
<button class="tip-card" @click="ask(primaryTipQuestion)">
<text class="tip-mark">贴</text>
<text>今日小贴士:催费沟通先共情,再说明,再给方案。</text>
<text>{{ positionProfile.tip }}</text>
<text class="tip-arrow">›</text>
</button>
</view>
@@ -109,14 +109,17 @@ import { onShow } from '@dcloudio/uni-app';
import type { PracticeAssignment, RoleHome } from '@/types/api';
import { getMobileHome } from '@/services/home';
import { getPracticeAssignments } from '@/services/practice';
import { getAuth, isLoggedIn, rememberLoginRedirect } from '@/services/auth';
import { getAuth, getSelectedPositionProfile, isLoggedIn, rememberLoginRedirect } from '@/services/auth';
import { resetPageScroll } from '@/services/navigation';
import { ensureEmployeePosition } from '@/services/position';
const home = ref<RoleHome | null>(null);
const assignments = ref<PracticeAssignment[]>([]);
const message = ref('');
const loggedIn = ref(false);
const quickQuestions = ['催费话术', '投诉应对', '收费标准'];
const positionProfile = ref(getSelectedPositionProfile());
const quickQuestions = computed(() => positionProfile.value.quickQuestions);
const primaryTipQuestion = computed(() => quickQuestions.value[0] || '岗位SOP');
const pendingSopQueryKey = 'aihr_sop_pending_query';
const pendingAssignmentKey = 'aihr_pending_assignment_id';
@@ -176,12 +179,17 @@ const mentorBubbleText = computed(() =>
const loadHome = async () => {
loggedIn.value = isLoggedIn();
positionProfile.value = getSelectedPositionProfile();
message.value = '';
assignments.value = [];
if (!loggedIn.value) {
home.value = null;
return;
}
if (!(await ensureEmployeePosition('/pages/user/today/index'))) {
return;
}
positionProfile.value = getSelectedPositionProfile();
const [homeResult, assignmentResult] = await Promise.allSettled([
getMobileHome('user'),
getPracticeAssignments(true)