1) 增加复制key
This commit is contained in:
parent
25f60dfecd
commit
ee0647d821
|
@ -14,6 +14,7 @@ import {
|
||||||
RadioButton,
|
RadioButton,
|
||||||
RadioGroup,
|
RadioGroup,
|
||||||
Notify,
|
Notify,
|
||||||
|
Checkbox,
|
||||||
} from "zent";
|
} from "zent";
|
||||||
import Ipt from "../../components/input/main";
|
import Ipt from "../../components/input/main";
|
||||||
import Form from "../../components/form/main";
|
import Form from "../../components/form/main";
|
||||||
|
@ -267,6 +268,11 @@ function reducerPlanKey(state, action) {
|
||||||
...state,
|
...state,
|
||||||
white_visible: action.payload,
|
white_visible: action.payload,
|
||||||
};
|
};
|
||||||
|
case "batch_name":
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
batch_name: action.payload,
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
|
@ -280,6 +286,12 @@ const UsePlanCardStep02 = forwardRef((props, ref) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const [model, dispatch] = useReducer(reducerPlanKey, initPlanKey); // form 表单数据
|
const [model, dispatch] = useReducer(reducerPlanKey, initPlanKey); // form 表单数据
|
||||||
|
const [checkedList, setCheckedList] = useState([]);
|
||||||
|
const form2 = useRef(null);
|
||||||
|
|
||||||
|
useImperativeHandle(ref, () => ({
|
||||||
|
submit: submit,
|
||||||
|
}));
|
||||||
|
|
||||||
const onStyleChange = (e) => {
|
const onStyleChange = (e) => {
|
||||||
if (props.name === 0) {
|
if (props.name === 0) {
|
||||||
|
@ -303,9 +315,24 @@ const UsePlanCardStep02 = forwardRef((props, ref) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onCheckChange = () => {};
|
||||||
|
|
||||||
|
const submit = () => {
|
||||||
|
let valide = false;
|
||||||
|
if (form2.current.validator()) {
|
||||||
|
let data = {};
|
||||||
|
data.style = model.style;
|
||||||
|
console.log("step 2 =>", data);
|
||||||
|
|
||||||
|
valide = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return valide;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="step02">
|
<div className="step02">
|
||||||
<Form model={model} rules={rules}>
|
<Form model={model} rules={rules} ref={form2}>
|
||||||
<FormItem labelname=" key样式" prop="style" id="style">
|
<FormItem labelname=" key样式" prop="style" id="style">
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
@ -339,6 +366,38 @@ const UsePlanCardStep02 = forwardRef((props, ref) => {
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem labelname="绑定类型" prop="bind_object" id="bind_object">
|
||||||
|
<Checkbox.Group
|
||||||
|
value={checkedList}
|
||||||
|
onChange={(e) => {
|
||||||
|
onCheckChange(e);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Checkbox value={1}>兑换码</Checkbox>
|
||||||
|
<Checkbox value={2} disabled>
|
||||||
|
优惠券
|
||||||
|
</Checkbox>
|
||||||
|
</Checkbox.Group>
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem labelname="key批次名称" prop="batch_name" id="batch_name">
|
||||||
|
<Ipt
|
||||||
|
onChange={(e) => {
|
||||||
|
dispatch({ type: "batch_name", payload: e });
|
||||||
|
}}
|
||||||
|
onClearItem={(e) => {
|
||||||
|
dispatch({ type: "batch_name", payload: "" });
|
||||||
|
}}
|
||||||
|
value={model.batch_name}
|
||||||
|
placeholder={"请输入"}
|
||||||
|
labelWidth={"0px"}
|
||||||
|
maxLength={12}
|
||||||
|
height={"36px"}
|
||||||
|
width={"400px"}
|
||||||
|
alignment={"left"}
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -64,7 +64,7 @@ const UseOneCopy = () => {
|
||||||
const [direct_reseller_id, setDirect_reseller_id] = useState(0);
|
const [direct_reseller_id, setDirect_reseller_id] = useState(0);
|
||||||
const [whiteStyle, setWhiteStyle] = useState(false);
|
const [whiteStyle, setWhiteStyle] = useState(false);
|
||||||
const step1 = useRef(null);
|
const step1 = useRef(null);
|
||||||
const step2 = useRef(null);
|
const step2 = useRef([]);
|
||||||
const step3 = useRef(null);
|
const step3 = useRef(null);
|
||||||
|
|
||||||
/*** 👇👇👇👇👇👇👇 step 01 👇👇👇👇👇👇👇 ***/
|
/*** 👇👇👇👇👇👇👇 step 01 👇👇👇👇👇👇👇 ***/
|
||||||
|
@ -93,6 +93,12 @@ const UseOneCopy = () => {
|
||||||
let res = step1.current.submit();
|
let res = step1.current.submit();
|
||||||
if (res === true) {
|
if (res === true) {
|
||||||
}
|
}
|
||||||
|
let arr1 = [];
|
||||||
|
keys.forEach((item) => {
|
||||||
|
let val = step2.current[item].submit();
|
||||||
|
arr1.push(val);
|
||||||
|
});
|
||||||
|
console.log("step 2 =>", arr1);
|
||||||
};
|
};
|
||||||
// 返回
|
// 返回
|
||||||
const onReturn = () => {};
|
const onReturn = () => {};
|
||||||
|
@ -175,13 +181,12 @@ const UseOneCopy = () => {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<UsePlanCardStep02
|
<UsePlanCardStep02
|
||||||
|
ref={(f) => {
|
||||||
|
step2.current[item] = f;
|
||||||
|
}}
|
||||||
name={index}
|
name={index}
|
||||||
addNewkey={() => {
|
addNewkey={addNewkey}
|
||||||
addNewkey();
|
onStyleChange={onStyleChange}
|
||||||
}}
|
|
||||||
onStyleChange={() => {
|
|
||||||
onStyleChange();
|
|
||||||
}}
|
|
||||||
keyStyle={keyStyle}
|
keyStyle={keyStyle}
|
||||||
isload={isload}
|
isload={isload}
|
||||||
direct_reseller_id={direct_reseller_id}
|
direct_reseller_id={direct_reseller_id}
|
||||||
|
|
Loading…
Reference in New Issue