feat:群代发默认选项修改 + 加群卡片

This commit is contained in:
chashaobao
2025-07-02 23:36:34 +08:00
parent de2f380cd9
commit de7f0e14fe
8 changed files with 129 additions and 14 deletions

View File

@ -156,14 +156,18 @@ export const getCityCodes = (): string[] => {
return !cachedValue || !Array.isArray(cachedValue) ? [] : cachedValue;
};
export const setCityCodes = (cityCode: string[]) => Taro.setStorageSync(CacheKey.CITY_CODES, cityCode);
export const checkCityCode = (cityCode: string): boolean => {
export const validCityCode = (cityCode: string) => {
const cachedCityCodes = getCityCodes();
const isNewCityCode = cachedCityCodes.indexOf(cityCode) === -1;
if (cachedCityCodes.length === 2 && isNewCityCode) {
return !(cachedCityCodes.length === 2 && isNewCityCode);
};
export const checkCityCode = (cityCode: string): boolean => {
if (!validCityCode(cityCode)) {
Toast.info('最多只能进入2个城市');
return false;
}
if (isNewCityCode) {
const cachedCityCodes = getCityCodes();
if (cachedCityCodes.indexOf(cityCode) === -1) {
setCityCodes([...cachedCityCodes, cityCode]);
}
return true;