feat: add log
This commit is contained in:
parent
f86b4481d8
commit
744928fab7
@ -12,8 +12,8 @@ import { EmployType, EMPLOY_TYPE_TITLE_MAP, FULL_PRICE_OPTIONS, PART_PRICE_OPTIO
|
||||
import { SalaryRange } from '@/types/job';
|
||||
import { MaterialProfile } from '@/types/material';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { getCurrentCity } from '@/utils/location';
|
||||
import { isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job'
|
||||
import { getCurrentCity } from '@/utils/location';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
@ -24,7 +24,8 @@ interface IProps {
|
||||
|
||||
const PREFIX = 'fragment-profile-intention';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
|
||||
const realtimeLogger = Taro.getRealtimeLogManager();
|
||||
realtimeLogger.tag(PREFIX);
|
||||
const calcInitCityCodes = (codeString: string = '') => {
|
||||
const codes = codeString.split('、');
|
||||
return codes.filter(code => !!CITY_CODE_TO_NAME_MAP.get(code));
|
||||
@ -82,6 +83,7 @@ function ProfileIntentionFragment(props: IProps, ref) {
|
||||
const handleSelectCity = useCallback(
|
||||
data => {
|
||||
log('handleSelectCity', data);
|
||||
realtimeLogger.info('handleSelectCity', data);
|
||||
const { openSource, cityCode: code } = data;
|
||||
if (openSource !== OpenSource.AddIndentCity) {
|
||||
return;
|
||||
|
@ -11,6 +11,7 @@ import ProfileAdvantagesFragment from '@/fragments/profile/advantages';
|
||||
import ProfileBasicFragment from '@/fragments/profile/basic';
|
||||
import ProfileExperienceFragment from '@/fragments/profile/experience';
|
||||
import ProfileIntentionFragment from '@/fragments/profile/intention';
|
||||
import useLocation from '@/hooks/use-location';
|
||||
import { MaterialProfile } from '@/types/material';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
@ -18,7 +19,6 @@ import { isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job';
|
||||
import { updateProfile, subscribeMaterialMessage } from '@/utils/material';
|
||||
import { navigateBack } from '@/utils/route';
|
||||
import Toast from '@/utils/toast';
|
||||
import useLocation from '@/hooks/use-location';
|
||||
|
||||
import './index.less';
|
||||
|
||||
@ -42,12 +42,12 @@ const REQUIRE_KEYS = {
|
||||
|
||||
const CONDITIONAL_REQUIRED_KEYS = {
|
||||
[ProfileGroupType.Intention]: [
|
||||
['fullTimeMinPrice', (data) => isFullTimePriceRequired(data.employType)],
|
||||
['fullTimeMaxPrice', (data) => isFullTimePriceRequired(data.employType)],
|
||||
['partyTimeMinPrice', (data) => isPartTimePriceRequired(data.employType)],
|
||||
['partyTimeMaxPrice', (data) => isPartTimePriceRequired(data.employType)],
|
||||
['fullTimeMinPrice', data => isFullTimePriceRequired(data.employType)],
|
||||
['fullTimeMaxPrice', data => isFullTimePriceRequired(data.employType)],
|
||||
['partyTimeMinPrice', data => isPartTimePriceRequired(data.employType)],
|
||||
['partyTimeMaxPrice', data => isPartTimePriceRequired(data.employType)],
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const getNextStepGroupType = (curType: ProfileGroupType) => {
|
||||
switch (curType) {
|
||||
@ -62,15 +62,17 @@ const getNextStepGroupType = (curType: ProfileGroupType) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const isValidFormData = (type: ProfileGroupType, data: Partial<MaterialProfile>) => {
|
||||
const requireKeys = REQUIRE_KEYS[type] || [];
|
||||
const conditionalKeys = CONDITIONAL_REQUIRED_KEYS[type] || []
|
||||
const conditionalKeys = CONDITIONAL_REQUIRED_KEYS[type] || [];
|
||||
|
||||
const requiredValidator = (key: any) => typeof data[key] !== 'undefined' && data[key] !== ''
|
||||
return requireKeys.every(requiredValidator) && conditionalKeys.every(([key, validator]) => {
|
||||
return !validator(data) || requiredValidator(key)
|
||||
});
|
||||
const requiredValidator = (key: any) => typeof data[key] !== 'undefined' && data[key] !== '';
|
||||
return (
|
||||
requireKeys.every(requiredValidator) &&
|
||||
conditionalKeys.every(([key, validator]) => {
|
||||
return !validator(data) || requiredValidator(key);
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
export default function MaterialCreateProfile() {
|
||||
|
Loading…
Reference in New Issue
Block a user