feat: update

This commit is contained in:
chashaobao
2025-10-20 07:58:50 +08:00
parent bc141fcf1b
commit a179654898
32 changed files with 648 additions and 271 deletions

View File

@ -7,7 +7,7 @@ import { useCallback, useState } from 'react';
import { RoleType } from '@/constants/app';
import { CacheKey } from '@/constants/cache-key';
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
import useServiceUrls from '@/hooks/use-service-urls';
import useCityOperators from '@/hooks/use-city-operators';
import { getRoleTypeWithDefault } from '@/utils/app';
import { openCustomerServiceChat } from '@/utils/common';
import { getCurrentCityCode } from '@/utils/location';
@ -24,14 +24,14 @@ const DEFAULT_GROUP = {
export function JoinGroupHint() {
const cityCode = getCurrentCityCode();
const roleType = getRoleTypeWithDefault();
const serviceUrls = useServiceUrls();
const group = serviceUrls.find(g => String(g.cityCode) === cityCode);
const cityOperators = useCityOperators();
const group = cityOperators.find(g => String(g.cityCode) === cityCode);
const [clicked, setClicked] = useState(!!Taro.getStorageSync(CacheKey.JOIN_GROUP_CARD_CLICKED));
const handleClick = useCallback(() => {
if (group && !checkCityCode(cityCode)) {
return;
}
openCustomerServiceChat(group ? group.serviceUrl : DEFAULT_GROUP.serviceUrl);
openCustomerServiceChat(group ? group.groupLink : DEFAULT_GROUP.serviceUrl);
Taro.setStorageSync(CacheKey.JOIN_GROUP_CARD_CLICKED, true);
setClicked(true);
}, [cityCode, group]);