mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 10:07:24 +00:00
Test (#4701)
* fix utmparams * add utmparams * fix * fix * Optimized the JsonImportModal shutdown logic to ensure that UTM parameters and workflows are removed when closing. * remove some import
This commit is contained in:
@@ -55,13 +55,16 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
|
|||||||
|
|
||||||
const utmParams = getUtmParams();
|
const utmParams = getUtmParams();
|
||||||
if (utmParams.shortUrlContent) setValue('name', utmParams.shortUrlContent);
|
if (utmParams.shortUrlContent) setValue('name', utmParams.shortUrlContent);
|
||||||
|
|
||||||
removeUtmWorkflow();
|
|
||||||
removeUtmParams();
|
|
||||||
},
|
},
|
||||||
{ manual: false }
|
{ manual: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleCloseJsonImportModal = () => {
|
||||||
|
onClose();
|
||||||
|
removeUtmParams();
|
||||||
|
removeUtmWorkflow();
|
||||||
|
};
|
||||||
|
|
||||||
const avatar = watch('avatar');
|
const avatar = watch('avatar');
|
||||||
const {
|
const {
|
||||||
File,
|
File,
|
||||||
@@ -132,6 +135,8 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
|
|||||||
router.push(`/app/detail?appId=${id}`);
|
router.push(`/app/detail?appId=${id}`);
|
||||||
loadMyApps();
|
loadMyApps();
|
||||||
onClose();
|
onClose();
|
||||||
|
removeUtmParams();
|
||||||
|
removeUtmWorkflow();
|
||||||
},
|
},
|
||||||
successToast: t('common:common.Create Success')
|
successToast: t('common:common.Create Success')
|
||||||
}
|
}
|
||||||
@@ -141,7 +146,6 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
|
|||||||
<>
|
<>
|
||||||
<MyModal
|
<MyModal
|
||||||
isOpen
|
isOpen
|
||||||
onClose={onClose}
|
|
||||||
isLoading={isCreating || isFetching}
|
isLoading={isCreating || isFetching}
|
||||||
title={t('app:type.Import from json')}
|
title={t('app:type.Import from json')}
|
||||||
iconSrc="common/importLight"
|
iconSrc="common/importLight"
|
||||||
@@ -182,7 +186,7 @@ const JsonImportModal = ({ onClose }: { onClose: () => void }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter gap={4}>
|
<ModalFooter gap={4}>
|
||||||
<Button variant={'whiteBase'} onClick={onClose}>
|
<Button variant={'whiteBase'} onClick={handleCloseJsonImportModal}>
|
||||||
{t('common:common.Cancel')}
|
{t('common:common.Cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSubmit(onSubmit)}>{t('common:common.Confirm')}</Button>
|
<Button onClick={handleSubmit(onSubmit)}>{t('common:common.Confirm')}</Button>
|
||||||
|
@@ -128,7 +128,9 @@ export const useInitApp = () => {
|
|||||||
...(utm_medium && { shortUrlMedium: utm_medium }),
|
...(utm_medium && { shortUrlMedium: utm_medium }),
|
||||||
...(utm_content && { shortUrlContent: utm_content })
|
...(utm_content && { shortUrlContent: utm_content })
|
||||||
};
|
};
|
||||||
|
if (utm_workflow) {
|
||||||
setUtmParams(utmParams);
|
setUtmParams(utmParams);
|
||||||
|
}
|
||||||
setFastGPTSem({ keyword: k, ...utmParams });
|
setFastGPTSem({ keyword: k, ...utmParams });
|
||||||
|
|
||||||
const newPath = getPathWithoutMarketingParams();
|
const newPath = getPathWithoutMarketingParams();
|
||||||
|
@@ -20,14 +20,14 @@ export const setBdVId = (bdVid?: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getUtmWorkflow = () => {
|
export const getUtmWorkflow = () => {
|
||||||
return sessionStorage.getItem('utm_workflow') || undefined;
|
return localStorage.getItem('utm_workflow') || undefined;
|
||||||
};
|
};
|
||||||
export const setUtmWorkflow = (utmWorkflow?: string) => {
|
export const setUtmWorkflow = (utmWorkflow?: string) => {
|
||||||
if (!utmWorkflow) return;
|
if (!utmWorkflow) return;
|
||||||
sessionStorage.setItem('utm_workflow', utmWorkflow);
|
localStorage.setItem('utm_workflow', utmWorkflow);
|
||||||
};
|
};
|
||||||
export const removeUtmWorkflow = () => {
|
export const removeUtmWorkflow = () => {
|
||||||
sessionStorage.removeItem('utm_workflow');
|
localStorage.removeItem('utm_workflow');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUtmParams = () => {
|
export const getUtmParams = () => {
|
||||||
|
Reference in New Issue
Block a user