feat: add project-scoped work assistant results

This commit is contained in:
2026-07-21 04:44:15 +08:00
parent 53b15e506c
commit 4536d607e3
75 changed files with 3281 additions and 507 deletions
+9 -12
View File
@@ -12,6 +12,13 @@ import {
type UserPosition
} from './auth';
export const fetchMobileIdentity = () => apiRequest<MobileIdentity>({
url: '/api/aihr/mobile/me',
method: 'GET',
timeout: 15000,
clearAuthOnUnauthorized: false
});
export const userTabPages = new Set([
'/pages/user/today/index',
'/pages/user/practice/index',
@@ -35,12 +42,7 @@ export const routeForMobileRole = (role: RoleKey, requested: string) => {
export const hydrateMobileRole = async (): Promise<RoleKey> => {
try {
const identity = await apiRequest<MobileIdentity>({
url: '/api/aihr/mobile/me',
method: 'GET',
timeout: 15000,
clearAuthOnUnauthorized: false
});
const identity = await fetchMobileIdentity();
const role = identity.role === 'supervisor' ? 'supervisor' : 'user';
uni.setStorageSync(roleKey, role);
if (role !== 'supervisor') leaveSupervisorLearnerMode();
@@ -71,12 +73,7 @@ export type OrgPositionResult =
export const fetchOrgPositionResult = async (): Promise<OrgPositionResult> => {
try {
const identity = await apiRequest<MobileIdentity>({
url: '/api/aihr/mobile/me',
method: 'GET',
timeout: 15000,
clearAuthOnUnauthorized: false
});
const identity = await fetchMobileIdentity();
const officialPosition = saveOrgPosition(identity.positionName);
if (!officialPosition) {
clearOrgPosition();