fix(mobile): replace App-Plus unsupported date and query APIs

`URLSearchParams` is absent from the App-Plus JS core, and
`toLocaleDateString('sv-SE', { timeZone: 'Asia/Shanghai' })` depends on full
ICU data that the App runtime does not ship, so the work-result pages built
either a broken query string or the device-local date.

Build query strings with `encodeURIComponent`, and centralise the business day
in `currentShanghaiDate()`, which shifts the epoch by a fixed UTC+8 offset
before slicing the ISO date. Asia/Shanghai has no DST, so the fixed offset is
exact rather than an approximation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-25 23:57:06 +08:00
co-authored by Claude Opus 5
parent 27f4cdac70
commit 3055d2bec9
7 changed files with 45 additions and 17 deletions
@@ -528,9 +528,9 @@ const markReviewed = async () => {
nextReason: nextScenarioId.value ? nextReason.value.trim() : undefined,
confirmedGrowthLevel: confirmedGrowthLevel.value || undefined
});
const params = new URLSearchParams({ id: String(detail.value.id) });
if (assignedScenario) params.set('assigned', assignedScenario);
uni.redirectTo({ url: `/pages/supervisor/review/done?${params.toString()}` });
const params = [`id=${encodeURIComponent(String(detail.value.id))}`];
if (assignedScenario) params.push(`assigned=${encodeURIComponent(assignedScenario)}`);
uni.redirectTo({ url: `/pages/supervisor/review/done?${params.join('&')}` });
} catch (error) {
handleRequestError(error, '标记失败');
} finally {
@@ -55,6 +55,7 @@ import { fetchMobileIdentity } from '@/services/position';
import { updateAssistantCaptureStatus } from '@/services/personal-assistant';
import { openProtectedSource } from '@/services/source-preview';
import { getProjectWorkResult } from '@/services/work-results';
import { currentShanghaiDate } from '@/utils/date';
import SupervisorTabBar from '@/components/SupervisorTabBar.vue';
import WorkDateSelector from '@/components/WorkDateSelector.vue';
@@ -62,8 +63,7 @@ const result = ref<ProjectWorkResult | null>(null);
const currentProject = ref<MobileProject | null>(getCurrentProject());
const message = ref('');
const loading = ref(false);
const currentDate = () => new Date().toLocaleDateString('sv-SE', { timeZone: 'Asia/Shanghai' });
const today = ref(currentDate());
const today = ref(currentShanghaiDate());
const workDate = ref(today.value);
const pageNum = ref(1);
const pageSize = 20;
@@ -116,7 +116,7 @@ const openSource = (item: WorkResultItem) => openProtectedSource(item.sourceUrl,
const sourceLabel = (value: string) => ({ TEXT: '文字来源', VOICE: '原始语音', IMAGE: '现场照片', VIDEO: '现场视频' }[value] || '原始来源');
const goBack = () => uni.navigateBack({ fail: () => uni.redirectTo({ url: '/pages/supervisor/index/index' }) });
onShow(() => {
today.value = currentDate();
today.value = currentShanghaiDate();
load();
});
</script>
@@ -73,14 +73,14 @@ import { fetchMobileIdentity } from '@/services/position';
import { updateAssistantCaptureStatus } from '@/services/personal-assistant';
import { openProtectedSource } from '@/services/source-preview';
import { generateMyWorkResult } from '@/services/work-results';
import { currentShanghaiDate } from '@/utils/date';
import WorkDateSelector from '@/components/WorkDateSelector.vue';
const result = ref<WorkResult | null>(null);
const currentProject = ref<MobileProject | null>(getCurrentProject());
const loading = ref(false);
const message = ref('');
const currentDate = () => new Date().toLocaleDateString('sv-SE', { timeZone: 'Asia/Shanghai' });
const today = ref(currentDate());
const today = ref(currentShanghaiDate());
const workDate = ref(today.value);
const isToday = computed(() => workDate.value === today.value);
const emptyTitle = computed(() => isToday.value ? '今天还没有已确认的工作记录' : '这一天没有已确认的工作记录');
@@ -147,7 +147,7 @@ const handleEmptyAction = () => isToday.value ? goAssistant() : changeWorkDate(t
const goBack = () => uni.navigateBack({ fail: () => uni.switchTab({ url: '/pages/user/today/index' }) });
onShow(() => {
today.value = currentDate();
today.value = currentShanghaiDate();
load();
});
</script>