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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user