Commit 37945cb4 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 5de203ea f0c5751a
......@@ -36,7 +36,7 @@ export default defineConfig({
'process.env.SOCKET_URL': process.env.SOCKET_URL
},
esbuild: {},
// mfsu: {},
mfsu: {},
locale: {
antd: true,
// 默认情况下,当前语言环境的识别按照:localStorage 中 umi_locale 值 > 浏览器检测 > default 设置的默认语言 > 中文
......
......@@ -103,7 +103,7 @@ module.exports = {
ssh: JSON.stringify({
user: "root",
// Password optional, prompted if none given
password: "123456",
password: "SsyLingxi@test666",
host: "10.0.0.17",
port: 22,
localRoot: path.resolve('./dist/'),
......
......@@ -8,14 +8,15 @@ import { history , useLocation, Link } from 'umi';
import { BgColorsOutlined, CheckCircleOutlined, SaveOutlined } from '@ant-design/icons';
import { FormEffectHooks, createFormActions, FormPath } from '@formily/antd';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import moment from 'moment';
import moment, { Moment } from 'moment';
import { usePageStatus } from '@/hooks/usePageStatus';
import { GlobalConfig } from '@/global/config';
import schema from './schema';
import styles from './index.less';
import FormilyTemplateDrawer from '../components/TemplateDrawer/formilyTemplateDrawer';
import { getTemplateWebActivityPageGet, postTemplateWebActivityPageAdd, postTemplateWebActivityPageUpdate } from '@/services/TemplateV2Api';
import { getTemplateWebActivityPageGet, GetTemplateWebActivityPageGetResponse, postTemplateWebActivityPageAdd, postTemplateWebActivityPageUpdate } from '@/services/TemplateV2Api';
import { postManageWebShopWebAll } from '@/services/ManageV2Api';
import { WEB } from '@/constants/const/environment';
const actions = createFormActions();
......@@ -41,13 +42,29 @@ type SubmitType = {
}
}
type ValueDataType = Omit<GetTemplateWebActivityPageGetResponse, 'startTime' | 'endTime' | 'templateId' | 'templateName' | 'templatePicUrl'> & {
template: {
templateId: number,
templateName: string,
templatePicUrl: string,
}
startTime: Moment,
endTime: Moment
}
const WEB_FIXTURE_LINK = "/marketingManage/marketing/activitiesManagement/webFixtures"
const APP_FIXTURE_LINK = "/marketingManage/marketing/activitiesManagement/fixtures"
const Add = () => {
const { id, } = usePageStatus();
const { pathname } = useLocation();
const isEdit = useMemo(() => id !== '' && pathname.includes("edit"), [id]);
const isView = useMemo(() => id !== '' && pathname.includes("view"), [id]);
const [initialValue, setInitialValue] = useState<any>(null);
const [initialValue, setInitialValue] = useState<ValueDataType | null>(null);
const fixtureLink = initialValue?.environment === WEB ? WEB_FIXTURE_LINK : APP_FIXTURE_LINK;
const [loading, setLoading] = useState<boolean>(false);
const onSubmit = async (values: SubmitType) => {
......@@ -84,7 +101,8 @@ const Add = () => {
okText: '立即装修',
cancelText: '稍后',
onOk: () => {
history.push(`/marketingManage/marketing/activitiesManagement/fixtures?id=${data}`);
const jumpLink = values.environment === WEB ? WEB_FIXTURE_LINK : APP_FIXTURE_LINK;
history.push(`${jumpLink}?id=${data}`);
},
onCancel: () => {
history.goBack();
......@@ -111,7 +129,7 @@ const Add = () => {
templateName,
templatePicUrl,
},
startTime: moment(startTime),
startTime: moment(startTime) ,
endTime: moment(endTime),
});
actions.setFieldState('*(environment,template,shopId)', state => {
......@@ -131,7 +149,7 @@ const Add = () => {
FormPath.setIn(state, 'props.x-component-props', {environment: initialValue.environment});
});
async function setMall() {
const data = await fetchMallData({environment: initialValue.environment.toString(), siteId: GlobalConfig.global.siteInfo.id} as any);
const data = await fetchMallData({environment: initialValue?.environment.toString(), siteId: GlobalConfig.global.siteInfo.id} as any);
actions.setFieldState("shopId", state => {
state.props.enum = data;
});
......@@ -162,6 +180,7 @@ const Add = () => {
return "新增活动页";
};
return (
<PageHeaderWrapper
title={renderTitle()}
......@@ -172,7 +191,7 @@ const Add = () => {
<Space>
{
isEdit && (
<Link to={`/marketingManage/marketing/activitiesManagement/fixtures?id=${id}`}>
<Link to={`${fixtureLink}?id=${id}`}>
<Button icon={<BgColorsOutlined />}>活动页装修</Button>
</Link>
)
......
......@@ -76,7 +76,7 @@ const ActiveItem: React.FC<Iprops> = (props: Iprops) => {
<img className={styles.image} src={templatePicUrl} />
<div className={styles.infoContainer}>
<div className={styles.header}>
<Link to={`/marketingManage/marketing/activitiesManagement/view?id=${id}`}>{title}</Link>
<Link to={`/marketingManage/marketing/activitiesManagement/edit?id=${id}`}>{title}</Link>
<div className={styles.status}>
<StatusTag type="success" title={statusName} />
</div>
......
......@@ -54,7 +54,6 @@ const formatProps = {
const useGetSameKeys = () => {
const { pageConfig } = useSelector<any, any>(['pageConfig']);
console.log("pageConfig", pageConfig);
const sameKeys = useMemo(() => {
if (pageConfig === null || Object.keys(pageConfig).length === 0) {
return {};
......
......@@ -156,7 +156,7 @@ function useSaveData(options: Options) {
const { data, code, ...rest } = await postTemplateWebActivityPageAdorn({
id: id,
adornContent: result
adornContent: withThemeStyle
} as any, {ctlType: 'none'});
setSaving(false);
if (code === 1000) {
......
......@@ -21,7 +21,7 @@ type SettingPanelType = {
}
const formActions = createFormActions();
/** 请求口type, 请求列表接口需要带上type */
/** 请求口type, 请求列表接口需要带上type */
const ACTIVITY_MAP = {
"specialOfferItem": 1,
/** 直降促销 */
......@@ -98,9 +98,7 @@ const EditPanelForm = () => {
imageUrl: [{ name: '广告图', url: selectedInfo?.props?.imageUrl }]
},
couponItem: {
coupon: {
...selectedInfo.props
}
coupon: selectedInfo.props
},
hotItem: {
product: {
......@@ -111,6 +109,7 @@ const EditPanelForm = () => {
title: selectedInfo.props?.title,
},
};
console.log("================================", selectedInfo.props)
/** 如果是活动子集, 那么现实选择活动商品 */
if(activityListItem.includes(componentType) || componentType === 'hotItem' || componentType === 'suggestProductItem') {
setFormValue({
......@@ -120,6 +119,7 @@ const EditPanelForm = () => {
});
setSchema(activityProducts);
} else {
// 如果是 top 或者是 活动容器,那么需要修改他的容器卡片名称
const schemaMap = {
top: activityImageSchema,
couponItem: couponSchema,
......@@ -133,7 +133,7 @@ const EditPanelForm = () => {
: propsMapToValue?.[componentType];
setSchema(tempSchema);
setFormValue(tempFormValue);
setFormValue({ ...tempFormValue });
}
/** 16 种活动,请求是需要带上活动类型 */
const activityType = ACTIVITY_MAP[componentType] ? { activityType: ACTIVITY_MAP[componentType] } : {};
......
......@@ -92,6 +92,11 @@ const FormilyCoupon: React.FC<Iprops> & { isFieldComponent: boolean } = (props:
// setInnerValue(value);
// }, [value]);
const handleClose = () => {
setRadioValue(PLATFORM);
setDrawerVisible(false)
}
const onChange = (e) => {
setRadioValue(e.target.value);
const pageInfo = (ref?.current as any)?.getPaginationInfo();
......@@ -115,6 +120,7 @@ const FormilyCoupon: React.FC<Iprops> & { isFieldComponent: boolean } = (props:
// setInnerValue(selectedRow[0]);
props.mutators.change(selectedRow[0]);
setDrawerVisible(false);
setRadioValue(PLATFORM)
});
};
......@@ -166,7 +172,8 @@ const FormilyCoupon: React.FC<Iprops> & { isFieldComponent: boolean } = (props:
</div>
<CouponSelect
visible={drawerVisible}
onCancel={() => setDrawerVisible(false)}
// onCancel={() => setDrawerVisible(false)}
onCancel={handleClose}
mode="radio"
formExtra={formExtra}
ref={ref as any}
......
......@@ -101,6 +101,11 @@ const minTypeToTwo = ["fullQuantityDiscountItem", "fullMoneyDiscountItem", "give
const activityListItem = Object.keys(ACTIVITY_MAP);
const activityList = activityListItem.map((_item) => _item.substring(0, _item.length - 4));
/**
* TODO 有时间将EditPanel 合并
*/
const EditPanelForm = () => {
const { selectedInfo, pageConfig } = useSelector<SettingPanelType, STATE_PROPS>(['selectedInfo', 'pageConfig']);
const {state: visible, toggle: setVisible } = useToggle(false);
......@@ -132,9 +137,7 @@ const EditPanelForm = () => {
imageUrl: [{ name: '广告图', url: selectedInfo?.props?.imageUrl }]
},
couponItem: {
coupon: {
...selectedInfo.props
}
coupon: {...selectedInfo.props}
},
hotItem: {
product: {
......@@ -150,7 +153,8 @@ const EditPanelForm = () => {
setFormValue({
product: {
...selectedInfo.props,
}
},
uuid: Math.random()
});
setSchema(activityProducts);
} else {
......@@ -158,16 +162,16 @@ const EditPanelForm = () => {
top: activityImageSchema,
couponItem: couponSchema,
};
const isContainer = activityList.includes(componentType) || componentType === 'hot' || componentType === 'suggestProduct' || componentType === 'coupon';
/** 如果是 suggestProduct, 或者是hot 或者是活动父级,那么直接设置他的卡片名称 */
const tempSchema = activityList.includes(componentType) || componentType === 'hot' || componentType === 'suggestProduct' || componentType === 'coupon' ? cardSchema : schemaMap?.[componentType];
const tempFormValue = activityList.includes(componentType) || componentType === 'hot' || componentType === 'suggestProduct' || componentType === 'coupon'
? {
title: selectedInfo.props.title
}
const tempSchema = isContainer ? cardSchema : schemaMap?.[componentType];
const tempFormValue = isContainer
? { title: selectedInfo.props.title}
: propsMapToValue?.[componentType];
setSchema(tempSchema);
setFormValue(tempFormValue);
// 这里加uuid 是为了解决这个bug http://chandao.shushangyun.com/index.php?m=bug&f=view&bugID=19739,formily value 改变不触发更新,
setFormValue({...tempFormValue, uuid: Math.random()});
}
/** 16 种活动,请求是需要带上活动类型 */
const activityType = ACTIVITY_MAP[componentType] ? { activityType: ACTIVITY_MAP[componentType] } : {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment