合入主线登录和营业时段策略,对齐旧界面与 React 访问流程
This commit is contained in:
commit
42395de23a
113 files changed
+1915
-558
No files matched your search
@@ -30,6 +30,27 @@
|
||||
return date.toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
/** @param {unknown} open @param {unknown} close */
|
||||
function businessHoursError(open, close) {
|
||||
const time = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
|
||||
if (typeof open !== 'string' || typeof close !== 'string' || !time.test(open) || !time.test(close))
|
||||
return '请完整填写开始和结束时间';
|
||||
return open === close ? '开始和结束时间不能相同' : '';
|
||||
}
|
||||
|
||||
/** 将两个 time 输入转为局部更新;清空一组已设置的时间才发送 null。
|
||||
* @param {string} open @param {string} close @param {{businessOpen: string, businessClose: string}} baseline
|
||||
* @returns {{businessHours?: {open: string, close: string} | null}}
|
||||
*/
|
||||
function businessHoursPatch(open, close, baseline) {
|
||||
if (open || close) {
|
||||
const message = businessHoursError(open, close);
|
||||
if (message) throw new Error(message);
|
||||
}
|
||||
if (open === baseline.businessOpen && close === baseline.businessClose) return {};
|
||||
return { businessHours: open ? { open, close } : null };
|
||||
}
|
||||
|
||||
/** @type {Record<string,string>} */
|
||||
const prefixes = { owner: '麦麦', assistant: '助理', assistant2: '助理2' };
|
||||
/** @param {string} member */
|
||||
@@ -82,6 +103,8 @@
|
||||
positiveMg,
|
||||
validDate,
|
||||
previousDate,
|
||||
businessHoursError,
|
||||
businessHoursPatch,
|
||||
memberAccountPrefix,
|
||||
accountIdentity,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user