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:
@@ -2,11 +2,11 @@ import type { ProjectWorkResult, WorkResult } from '@/types/api';
|
||||
import { apiRequest } from './api';
|
||||
|
||||
const params = (projectCode: string, workDate?: string, pageNum?: number, pageSize?: number) => {
|
||||
const query = new URLSearchParams({ projectCode });
|
||||
if (workDate) query.set('workDate', workDate);
|
||||
if (pageNum) query.set('pageNum', String(pageNum));
|
||||
if (pageSize) query.set('pageSize', String(pageSize));
|
||||
return query.toString();
|
||||
const query = [`projectCode=${encodeURIComponent(projectCode)}`];
|
||||
if (workDate) query.push(`workDate=${encodeURIComponent(workDate)}`);
|
||||
if (pageNum) query.push(`pageNum=${pageNum}`);
|
||||
if (pageSize) query.push(`pageSize=${pageSize}`);
|
||||
return query.join('&');
|
||||
};
|
||||
|
||||
export const generateMyWorkResult = (projectCode: string, workDate?: string) =>
|
||||
|
||||
Reference in New Issue
Block a user