Browse Source

FIX:三级页面的表单校验问题

wjj 4 years ago
parent
commit
b0fa5c80bd

+ 0 - 27
src/pages/edit/components/Step1/index.jsx

@@ -23,8 +23,6 @@ const Step1 = (props) => {
     return null;
   }
 
-  const { validateFields } = form;
-
   useEffect(() => {
     dispatch({
       type: 'editReport/getOsType',
@@ -52,31 +50,6 @@ const Step1 = (props) => {
     console.log('Failed:', errorInfo);
   };
 
-  const onValidateForm = async () => {
-    const isValid = await validateFields();
-    if (!isValid.outOfDate) {
-      //表单验证通过,开始发送请求
-      var request = new XMLHttpRequest();
-      request.open('POST', 'http://foo.com/submitform.php');
-      request.send(formData);
-      dispatch({
-        type: 'editReport/getOsTypeAction',
-        payload: { examId: 1718 },
-      });
-    }
-    // if (dispatch) {
-    //   dispatch({
-    //     type: 'editReport/saveStepFormData',
-    //     payload: values,
-    //   });
-    //   dispatch({
-    //     type: 'editReport/saveCurrentStep',
-    //     payload: 'confirm',
-    //   });
-    //
-    // }
-  };
-
   return (
     <>
       <Form

+ 2 - 2
src/pages/edit/components/Step2/const.js

@@ -1,3 +1,3 @@
-export const recurrent = ['','其他','无规律复现', '小概率复现','大概率复现','必现'];
-export const severity = ['','待定','较轻','一般','严重','紧急'];
+export const recurrent = ['其他','无规律复现', '小概率复现','大概率复现','必现'];
+export const severity = ['待定','较轻','一般','严重','紧急'];
 export const bug_categories = ['不正常退出','功能不完整','用户体验','页面布局缺陷','性能','安全','其他']

+ 7 - 1
src/pages/edit/components/Step2/index.jsx

@@ -507,7 +507,13 @@ const Step2 = (props) => {
           </Form.Item>
           <Form.Item
             label="三级页面"
-            name="pages"
+            name="page3"
+            rules={[
+              {
+                required: true,
+                message: '',
+              },
+            ]}
           >
             <Row gutter={5} className={styles.pageSelect}>
               <Col span={8}>

+ 4 - 5
src/pages/edit/model.js

@@ -217,10 +217,7 @@ const Model = {
     * goodForReport({ payload }, { call, put }) {
       const { id, report_id, user_id, action } = payload;
       let res = yield call(goodReport, id, report_id);
-      console.log('aaa')
-      yield call(recordAction, user_id, id, action);
       if (res.status === 200) {
-        console.log(res)
         yield call(recordAction, user_id, id, action);
       }
     },
@@ -232,8 +229,10 @@ const Model = {
     //todo:点踩bug报告
     * badForReport({ payload }, { call, put }) {
       const { id, report_id, user_id, action } = payload;
-      yield call(badReport, id, report_id);
-      yield call(recordAction, user_id, id, action);
+      let res = yield call(badReport, id, report_id);
+      if(res.status === 200){
+        yield call(recordAction, user_id, id, action);
+      }
     },
     //todo:取消点踩bug报告
     * cancelBadForReport({ payload }, { call, put }) {

+ 2 - 2
src/pages/edit/utils.js

@@ -4,8 +4,8 @@ export const timeToString = (time)=>{
   const Y = date.getFullYear() + '-';
   const M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
   const D = date.getDate() + ' ';
-  const h = date.getHours() + ':';
-  const m = date.getMinutes() + ':';
+  const h = date.getHours() < 10 ? ('0' + date.getHours()) : date.getHours();
+  const m = ':' + (date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes()) + ':';
   const s = date.getSeconds() < 10 ? ('0' + date.getSeconds()) : date.getSeconds();
   return Y+M+D+h+m+s;
 }