1) 增加复制key
This commit is contained in:
parent
25f60dfecd
commit
ee0647d821
|
@ -14,6 +14,7 @@ import {
|
|||
RadioButton,
|
||||
RadioGroup,
|
||||
Notify,
|
||||
Checkbox,
|
||||
} from "zent";
|
||||
import Ipt from "../../components/input/main";
|
||||
import Form from "../../components/form/main";
|
||||
|
@ -267,6 +268,11 @@ function reducerPlanKey(state, action) {
|
|||
...state,
|
||||
white_visible: action.payload,
|
||||
};
|
||||
case "batch_name":
|
||||
return {
|
||||
...state,
|
||||
batch_name: action.payload,
|
||||
};
|
||||
default:
|
||||
throw new Error();
|
||||
}
|
||||
|
@ -280,6 +286,12 @@ const UsePlanCardStep02 = forwardRef((props, ref) => {
|
|||
};
|
||||
|
||||
const [model, dispatch] = useReducer(reducerPlanKey, initPlanKey); // form 表单数据
|
||||
const [checkedList, setCheckedList] = useState([]);
|
||||
const form2 = useRef(null);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
submit: submit,
|
||||
}));
|
||||
|
||||
const onStyleChange = (e) => {
|
||||
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 (
|
||||
<div className="step02">
|
||||
<Form model={model} rules={rules}>
|
||||
<Form model={model} rules={rules} ref={form2}>
|
||||
<FormItem labelname=" key样式" prop="style" id="style">
|
||||
<RadioGroup
|
||||
onChange={(e) => {
|
||||
|
@ -339,6 +366,38 @@ const UsePlanCardStep02 = forwardRef((props, ref) => {
|
|||
</RadioButton>
|
||||
</RadioGroup>
|
||||
</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>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -64,7 +64,7 @@ const UseOneCopy = () => {
|
|||
const [direct_reseller_id, setDirect_reseller_id] = useState(0);
|
||||
const [whiteStyle, setWhiteStyle] = useState(false);
|
||||
const step1 = useRef(null);
|
||||
const step2 = useRef(null);
|
||||
const step2 = useRef([]);
|
||||
const step3 = useRef(null);
|
||||
|
||||
/*** 👇👇👇👇👇👇👇 step 01 👇👇👇👇👇👇👇 ***/
|
||||
|
@ -93,6 +93,12 @@ const UseOneCopy = () => {
|
|||
let res = step1.current.submit();
|
||||
if (res === true) {
|
||||
}
|
||||
let arr1 = [];
|
||||
keys.forEach((item) => {
|
||||
let val = step2.current[item].submit();
|
||||
arr1.push(val);
|
||||
});
|
||||
console.log("step 2 =>", arr1);
|
||||
};
|
||||
// 返回
|
||||
const onReturn = () => {};
|
||||
|
@ -175,13 +181,12 @@ const UseOneCopy = () => {
|
|||
}
|
||||
>
|
||||
<UsePlanCardStep02
|
||||
ref={(f) => {
|
||||
step2.current[item] = f;
|
||||
}}
|
||||
name={index}
|
||||
addNewkey={() => {
|
||||
addNewkey();
|
||||
}}
|
||||
onStyleChange={() => {
|
||||
onStyleChange();
|
||||
}}
|
||||
addNewkey={addNewkey}
|
||||
onStyleChange={onStyleChange}
|
||||
keyStyle={keyStyle}
|
||||
isload={isload}
|
||||
direct_reseller_id={direct_reseller_id}
|
||||
|
|
Loading…
Reference in New Issue