Commit 4d4316e7 by zhanghaozhe

update formik

parent 192a6a2b
...@@ -2784,6 +2784,7 @@ ...@@ -2784,6 +2784,7 @@
"version": "10.0.9", "version": "10.0.9",
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.9.tgz", "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.9.tgz",
"integrity": "sha512-f7MblpE2xoimC4fCMZ9pivmsIn7hyWRIvY75owMDi8pdOSeh+w5tH3r4hBJv/LLrwiMM7cTQURqTPcYoL5pWnw==", "integrity": "sha512-f7MblpE2xoimC4fCMZ9pivmsIn7hyWRIvY75owMDi8pdOSeh+w5tH3r4hBJv/LLrwiMM7cTQURqTPcYoL5pWnw==",
"dev": true,
"requires": { "requires": {
"@emotion/sheet": "0.9.2", "@emotion/sheet": "0.9.2",
"@emotion/stylis": "0.8.3", "@emotion/stylis": "0.8.3",
...@@ -2795,6 +2796,7 @@ ...@@ -2795,6 +2796,7 @@
"version": "10.0.10", "version": "10.0.10",
"resolved": "https://registry.npmjs.org/@emotion/core/-/core-10.0.10.tgz", "resolved": "https://registry.npmjs.org/@emotion/core/-/core-10.0.10.tgz",
"integrity": "sha512-U1aE2cOWUscjc8ZJ3Cx32udOzLeRoJwGxBH93xQD850oQFpwPKZARzdUtdc9SByUOwzSFYxhDhrpXnV34FJmWg==", "integrity": "sha512-U1aE2cOWUscjc8ZJ3Cx32udOzLeRoJwGxBH93xQD850oQFpwPKZARzdUtdc9SByUOwzSFYxhDhrpXnV34FJmWg==",
"dev": true,
"requires": { "requires": {
"@emotion/cache": "^10.0.9", "@emotion/cache": "^10.0.9",
"@emotion/css": "^10.0.9", "@emotion/css": "^10.0.9",
...@@ -2807,6 +2809,7 @@ ...@@ -2807,6 +2809,7 @@
"version": "10.0.12", "version": "10.0.12",
"resolved": "https://registry.npmjs.org/@emotion/css/-/css-10.0.12.tgz", "resolved": "https://registry.npmjs.org/@emotion/css/-/css-10.0.12.tgz",
"integrity": "sha512-esET/v6AwYIw5YVo0e1L/bUik7bIMWyK32BudsC/PE5O1rLK3rjiLCOoMVv5GY6+ssuwWVzooGbz79hPvkkmsw==", "integrity": "sha512-esET/v6AwYIw5YVo0e1L/bUik7bIMWyK32BudsC/PE5O1rLK3rjiLCOoMVv5GY6+ssuwWVzooGbz79hPvkkmsw==",
"dev": true,
"requires": { "requires": {
"@emotion/serialize": "^0.11.7", "@emotion/serialize": "^0.11.7",
"@emotion/utils": "0.11.1", "@emotion/utils": "0.11.1",
...@@ -2816,7 +2819,8 @@ ...@@ -2816,7 +2819,8 @@
"@emotion/hash": { "@emotion/hash": {
"version": "0.7.1", "version": "0.7.1",
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.7.1.tgz", "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.7.1.tgz",
"integrity": "sha512-OYpa/Sg+2GDX+jibUfpZVn1YqSVRpYmTLF2eyAfrFTIJSbwyIrc+YscayoykvaOME/wV4BV0Sa0yqdMrgse6mA==" "integrity": "sha512-OYpa/Sg+2GDX+jibUfpZVn1YqSVRpYmTLF2eyAfrFTIJSbwyIrc+YscayoykvaOME/wV4BV0Sa0yqdMrgse6mA==",
"dev": true
}, },
"@emotion/is-prop-valid": { "@emotion/is-prop-valid": {
"version": "0.8.8", "version": "0.8.8",
...@@ -2838,12 +2842,14 @@ ...@@ -2838,12 +2842,14 @@
"@emotion/memoize": { "@emotion/memoize": {
"version": "0.7.1", "version": "0.7.1",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.1.tgz", "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.1.tgz",
"integrity": "sha512-Qv4LTqO11jepd5Qmlp3M1YEjBumoTHcHFdgPTQ+sFlIL5myi/7xu/POwP7IRu6odBdmLXdtIs1D6TuW6kbwbbg==" "integrity": "sha512-Qv4LTqO11jepd5Qmlp3M1YEjBumoTHcHFdgPTQ+sFlIL5myi/7xu/POwP7IRu6odBdmLXdtIs1D6TuW6kbwbbg==",
"dev": true
}, },
"@emotion/serialize": { "@emotion/serialize": {
"version": "0.11.7", "version": "0.11.7",
"resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.7.tgz", "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.7.tgz",
"integrity": "sha512-GfzJIMue9eIEPFgBL340hBbjfki11vjYkfmY2LXoCDAFPuG6S+hkOlfinRXLnPVlXnKu7WWp587cVa6/xQriNQ==", "integrity": "sha512-GfzJIMue9eIEPFgBL340hBbjfki11vjYkfmY2LXoCDAFPuG6S+hkOlfinRXLnPVlXnKu7WWp587cVa6/xQriNQ==",
"dev": true,
"requires": { "requires": {
"@emotion/hash": "0.7.1", "@emotion/hash": "0.7.1",
"@emotion/memoize": "0.7.1", "@emotion/memoize": "0.7.1",
...@@ -2855,7 +2861,8 @@ ...@@ -2855,7 +2861,8 @@
"@emotion/sheet": { "@emotion/sheet": {
"version": "0.9.2", "version": "0.9.2",
"resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.2.tgz", "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.2.tgz",
"integrity": "sha512-pVBLzIbC/QCHDKJF2E82V2H/W/B004mDFQZiyo/MSR+VC4pV5JLG0TF/zgQDFvP3fZL/5RTPGEmXlYJBMUuJ+A==" "integrity": "sha512-pVBLzIbC/QCHDKJF2E82V2H/W/B004mDFQZiyo/MSR+VC4pV5JLG0TF/zgQDFvP3fZL/5RTPGEmXlYJBMUuJ+A==",
"dev": true
}, },
"@emotion/styled": { "@emotion/styled": {
"version": "10.0.27", "version": "10.0.27",
...@@ -2984,22 +2991,26 @@ ...@@ -2984,22 +2991,26 @@
"@emotion/stylis": { "@emotion/stylis": {
"version": "0.8.3", "version": "0.8.3",
"resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.3.tgz", "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.3.tgz",
"integrity": "sha512-M3nMfJ6ndJMYloSIbYEBq6G3eqoYD41BpDOxreE8j0cb4fzz/5qvmqU9Mb2hzsXcCnIlGlWhS03PCzVGvTAe0Q==" "integrity": "sha512-M3nMfJ6ndJMYloSIbYEBq6G3eqoYD41BpDOxreE8j0cb4fzz/5qvmqU9Mb2hzsXcCnIlGlWhS03PCzVGvTAe0Q==",
"dev": true
}, },
"@emotion/unitless": { "@emotion/unitless": {
"version": "0.7.3", "version": "0.7.3",
"resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.3.tgz", "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.3.tgz",
"integrity": "sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==" "integrity": "sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg==",
"dev": true
}, },
"@emotion/utils": { "@emotion/utils": {
"version": "0.11.1", "version": "0.11.1",
"resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.1.tgz", "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.1.tgz",
"integrity": "sha512-8M3VN0hetwhsJ8dH8VkVy7xo5/1VoBsDOk/T4SJOeXwTO1c4uIqVNx2qyecLFnnUWD5vvUqHQ1gASSeUN6zcTg==" "integrity": "sha512-8M3VN0hetwhsJ8dH8VkVy7xo5/1VoBsDOk/T4SJOeXwTO1c4uIqVNx2qyecLFnnUWD5vvUqHQ1gASSeUN6zcTg==",
"dev": true
}, },
"@emotion/weak-memoize": { "@emotion/weak-memoize": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.2.tgz", "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.2.tgz",
"integrity": "sha512-n/VQ4mbfr81aqkx/XmVicOLjviMuy02eenSdJY33SVA7S2J42EU0P1H0mOogfYedb3wXA0d/LVtBrgTSm04WEA==" "integrity": "sha512-n/VQ4mbfr81aqkx/XmVicOLjviMuy02eenSdJY33SVA7S2J42EU0P1H0mOogfYedb3wXA0d/LVtBrgTSm04WEA==",
"dev": true
}, },
"@hapi/address": { "@hapi/address": {
"version": "2.1.4", "version": "2.1.4",
...@@ -7947,6 +7958,7 @@ ...@@ -7947,6 +7958,7 @@
"version": "10.0.13", "version": "10.0.13",
"resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.0.13.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.0.13.tgz",
"integrity": "sha512-w8yukWIYDw2ZUzBo7B9t5jh7wsM4NQWqvuZadW4MhVokgw5wsoBRJ59Sa1hMc3UZiatwb0iBNufmRQZVl77I5Q==", "integrity": "sha512-w8yukWIYDw2ZUzBo7B9t5jh7wsM4NQWqvuZadW4MhVokgw5wsoBRJ59Sa1hMc3UZiatwb0iBNufmRQZVl77I5Q==",
"dev": true,
"requires": { "requires": {
"@babel/helper-module-imports": "^7.0.0", "@babel/helper-module-imports": "^7.0.0",
"@emotion/hash": "0.7.1", "@emotion/hash": "0.7.1",
...@@ -7963,7 +7975,8 @@ ...@@ -7963,7 +7975,8 @@
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
} }
} }
}, },
...@@ -9303,11 +9316,6 @@ ...@@ -9303,11 +9316,6 @@
"supports-color": "^5.3.0" "supports-color": "^5.3.0"
} }
}, },
"change-emitter": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/change-emitter/-/change-emitter-0.1.6.tgz",
"integrity": "sha1-6LL+PX8at9aaMhma/5HqaTFAlRU="
},
"character-entities": { "character-entities": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.4.tgz",
...@@ -19397,13 +19405,116 @@ ...@@ -19397,13 +19405,116 @@
} }
}, },
"react-spinners": { "react-spinners": {
"version": "0.5.12", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/react-spinners/-/react-spinners-0.5.12.tgz", "resolved": "https://registry.npmjs.org/react-spinners/-/react-spinners-0.9.0.tgz",
"integrity": "sha512-A1UG87Yd+pdmPQKooJoywdmgSGPG6iPcOoMyfki+wxYDNDEYtejAepws+VxTt/GGpb/JRDnll5oNuQoh4nF9JA==", "integrity": "sha512-+x6eD8tn/aYLdxZjNW7fSR1uoAXLb9qq6TFYZR1dFweJvckcf/HfP8Pa/cy5HOvB/cvI4JgrYXTjh2Me3S6Now==",
"requires": { "requires": {
"@emotion/core": "^10.0.4", "@emotion/core": "^10.0.15"
"prop-types": "^15.5.10", },
"recompose": "0.27.1 - 0.30.0" "dependencies": {
"@emotion/cache": {
"version": "10.0.29",
"resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.29.tgz",
"integrity": "sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ==",
"requires": {
"@emotion/sheet": "0.9.4",
"@emotion/stylis": "0.8.5",
"@emotion/utils": "0.11.3",
"@emotion/weak-memoize": "0.2.5"
}
},
"@emotion/core": {
"version": "10.0.28",
"resolved": "https://registry.npmjs.org/@emotion/core/-/core-10.0.28.tgz",
"integrity": "sha512-pH8UueKYO5jgg0Iq+AmCLxBsvuGtvlmiDCOuv8fGNYn3cowFpLN98L8zO56U0H1PjDIyAlXymgL3Wu7u7v6hbA==",
"requires": {
"@babel/runtime": "^7.5.5",
"@emotion/cache": "^10.0.27",
"@emotion/css": "^10.0.27",
"@emotion/serialize": "^0.11.15",
"@emotion/sheet": "0.9.4",
"@emotion/utils": "0.11.3"
}
},
"@emotion/css": {
"version": "10.0.27",
"resolved": "https://registry.npmjs.org/@emotion/css/-/css-10.0.27.tgz",
"integrity": "sha512-6wZjsvYeBhyZQYNrGoR5yPMYbMBNEnanDrqmsqS1mzDm1cOTu12shvl2j4QHNS36UaTE0USIJawCH9C8oW34Zw==",
"requires": {
"@emotion/serialize": "^0.11.15",
"@emotion/utils": "0.11.3",
"babel-plugin-emotion": "^10.0.27"
}
},
"@emotion/hash": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz",
"integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow=="
},
"@emotion/memoize": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz",
"integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw=="
},
"@emotion/serialize": {
"version": "0.11.16",
"resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz",
"integrity": "sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==",
"requires": {
"@emotion/hash": "0.8.0",
"@emotion/memoize": "0.7.4",
"@emotion/unitless": "0.7.5",
"@emotion/utils": "0.11.3",
"csstype": "^2.5.7"
}
},
"@emotion/sheet": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.4.tgz",
"integrity": "sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA=="
},
"@emotion/stylis": {
"version": "0.8.5",
"resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz",
"integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ=="
},
"@emotion/unitless": {
"version": "0.7.5",
"resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz",
"integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg=="
},
"@emotion/utils": {
"version": "0.11.3",
"resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.3.tgz",
"integrity": "sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw=="
},
"@emotion/weak-memoize": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz",
"integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA=="
},
"babel-plugin-emotion": {
"version": "10.0.33",
"resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.0.33.tgz",
"integrity": "sha512-bxZbTTGz0AJQDHm8k6Rf3RQJ8tX2scsfsRyKVgAbiUPUNIRtlK+7JxP+TAd1kRLABFxe0CFm2VdK4ePkoA9FxQ==",
"requires": {
"@babel/helper-module-imports": "^7.0.0",
"@emotion/hash": "0.8.0",
"@emotion/memoize": "0.7.4",
"@emotion/serialize": "^0.11.16",
"babel-plugin-macros": "^2.0.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"convert-source-map": "^1.5.0",
"escape-string-regexp": "^1.0.5",
"find-root": "^1.1.0",
"source-map": "^0.5.7"
}
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
}
} }
}, },
"react-sticky": { "react-sticky": {
...@@ -19556,26 +19667,6 @@ ...@@ -19556,26 +19667,6 @@
"resolve": "^1.1.6" "resolve": "^1.1.6"
} }
}, },
"recompose": {
"version": "0.30.0",
"resolved": "https://registry.npmjs.org/recompose/-/recompose-0.30.0.tgz",
"integrity": "sha512-ZTrzzUDa9AqUIhRk4KmVFihH0rapdCSMFXjhHbNrjAWxBuUD/guYlyysMnuHjlZC/KRiOKRtB4jf96yYSkKE8w==",
"requires": {
"@babel/runtime": "^7.0.0",
"change-emitter": "^0.1.2",
"fbjs": "^0.8.1",
"hoist-non-react-statics": "^2.3.1",
"react-lifecycles-compat": "^3.0.2",
"symbol-observable": "^1.0.4"
},
"dependencies": {
"hoist-non-react-statics": {
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz",
"integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw=="
}
}
},
"recursive-readdir": { "recursive-readdir": {
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz", "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
"react-mobile-swiper": "^1.1.4", "react-mobile-swiper": "^1.1.4",
"react-redux": "^7.2.1", "react-redux": "^7.2.1",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-spinners": "^0.5.12", "react-spinners": "^0.9.0",
"react-sticky": "^6.0.3", "react-sticky": "^6.0.3",
"redux": "^4.0.5", "redux": "^4.0.5",
"redux-immutable": "^4.0.0", "redux-immutable": "^4.0.0",
......
...@@ -50,7 +50,8 @@ class App extends Component { ...@@ -50,7 +50,8 @@ class App extends Component {
firstLoad = true firstLoad = true
componentWillMount() { componentDidMount() {
let url = window.location.href let url = window.location.href
if (url.indexOf('ccode') > -1) { if (url.indexOf('ccode') > -1) {
if (!getParam('ccode').includes('%')) { if (!getParam('ccode').includes('%')) {
...@@ -61,9 +62,8 @@ class App extends Component { ...@@ -61,9 +62,8 @@ class App extends Component {
}) })
} }
} }
}
componentDidMount() {
//是否显示宝箱全局入口 //是否显示宝箱全局入口
this.isShowGlobalEntryInTime() this.isShowGlobalEntryInTime()
......
...@@ -23,7 +23,7 @@ class AddressPopup extends Component { ...@@ -23,7 +23,7 @@ class AddressPopup extends Component {
// 获取收货信息 // 获取收货信息
fetchUserAddress = () => { fetchUserAddress = () => {
const { addressInfo } = this.state; const {addressInfo} = this.state;
http.get(`${API.home}/sys/user_address_info`).then(res => { http.get(`${API.home}/sys/user_address_info`).then(res => {
const {code, data, msg} = res.data; const {code, data, msg} = res.data;
if (code === 200) { if (code === 200) {
...@@ -40,10 +40,10 @@ class AddressPopup extends Component { ...@@ -40,10 +40,10 @@ class AddressPopup extends Component {
} }
handleToSubmit = (params = {}) => { handleToSubmit = (params = {}) => {
const { successBindAddress } = this.props; const {successBindAddress} = this.props;
http.post(`${API.home}/sys/update_address`, { http.post(`${API.home}/sys/update_address`, {
act_type: 'treasure', act_type: 'treasure',
...params ...params,
}).then(res => { }).then(res => {
const {code, msg} = res.data; const {code, msg} = res.data;
if (code === 200) { if (code === 200) {
...@@ -55,7 +55,7 @@ class AddressPopup extends Component { ...@@ -55,7 +55,7 @@ class AddressPopup extends Component {
} }
render() { render() {
const { isLoading, addressInfo } = this.state; const {isLoading, addressInfo} = this.state;
const {tip, prize, skip = 'default'} = this.props; const {tip, prize, skip = 'default'} = this.props;
return ( return (
<> <>
...@@ -63,7 +63,7 @@ class AddressPopup extends Component { ...@@ -63,7 +63,7 @@ class AddressPopup extends Component {
isLoading && isLoading &&
<Formik <Formik
initialValues={{ initialValues={{
...addressInfo ...addressInfo,
}} }}
validate={({name, phone, address}) => { validate={({name, phone, address}) => {
const errors = {}; const errors = {};
...@@ -71,7 +71,7 @@ class AddressPopup extends Component { ...@@ -71,7 +71,7 @@ class AddressPopup extends Component {
if (!name) { if (!name) {
errors.name = '请输入收件人'; errors.name = '请输入收件人';
} }
if(!/^1[3-9]\d{9}$/.test(phone)) { if (!/^1[3-9]\d{9}$/.test(phone)) {
errors.phone = '请填写正确格式的手机号'; errors.phone = '请填写正确格式的手机号';
} }
if (!address) { if (!address) {
...@@ -85,7 +85,9 @@ class AddressPopup extends Component { ...@@ -85,7 +85,9 @@ class AddressPopup extends Component {
onSubmit={(values) => { onSubmit={(values) => {
this.handleToSubmit(values); this.handleToSubmit(values);
}} }}
render={({errors}) => ( >
{
({errors}) => (
<Form className="address-form" data-skip={skip}> <Form className="address-form" data-skip={skip}>
<h2 className="address-form__title">收货信息</h2> <h2 className="address-form__title">收货信息</h2>
{ {
...@@ -97,11 +99,12 @@ class AddressPopup extends Component { ...@@ -97,11 +99,12 @@ class AddressPopup extends Component {
) : (null) ) : (null)
} }
{ {
tip ? (<div className="address-form__subtitle">{tip}</div>) : (<p className="address-form__desc">请及时填写收货信息,获得实物奖品后将第一时间为您邮寄</p>) tip ? (<div className="address-form__subtitle">{tip}</div>) : (
<p className="address-form__desc">请及时填写收货信息,获得实物奖品后将第一时间为您邮寄</p>)
} }
<Field <Field
name="name" name="name"
render={({ field }) => ( render={({field}) => (
<div className="address-form__item"> <div className="address-form__item">
<input <input
{...field} {...field}
...@@ -118,7 +121,7 @@ class AddressPopup extends Component { ...@@ -118,7 +121,7 @@ class AddressPopup extends Component {
/> />
<Field <Field
name="phone" name="phone"
render={({ field }) => ( render={({field}) => (
<div className="address-form__item"> <div className="address-form__item">
<input <input
{...field} {...field}
...@@ -135,7 +138,7 @@ class AddressPopup extends Component { ...@@ -135,7 +138,7 @@ class AddressPopup extends Component {
/> />
<Field <Field
name="address" name="address"
render={({ field }) => ( render={({field}) => (
<div className="address-form__item"> <div className="address-form__item">
<input <input
{...field} {...field}
...@@ -154,10 +157,12 @@ class AddressPopup extends Component { ...@@ -154,10 +157,12 @@ class AddressPopup extends Component {
className="address-form__submit" className="address-form__submit"
data-status="do" data-status="do"
type="submit" type="submit"
>提交</button> >提交
</button>
</Form> </Form>
)} )
/> }
</Formik>
} }
</> </>
); );
......
...@@ -177,7 +177,9 @@ class BindPhone extends Component { ...@@ -177,7 +177,9 @@ class BindPhone extends Component {
}); });
this.toBindPhone(); this.toBindPhone();
}} }}
render={({values: {tel, code}, errors}) => ( >
{
({values: {tel, code}, errors}) => (
<Form className="popup-form" data-skip={skip}> <Form className="popup-form" data-skip={skip}>
<h2 className="popup-form__title">绑定手机号</h2> <h2 className="popup-form__title">绑定手机号</h2>
{ {
...@@ -238,8 +240,9 @@ class BindPhone extends Component { ...@@ -238,8 +240,9 @@ class BindPhone extends Component {
完成绑定 完成绑定
</button> </button>
</Form> </Form>
)} )
/> }
</Formik>
) )
} }
} }
......
...@@ -24,7 +24,7 @@ class AddressPopup extends Component { ...@@ -24,7 +24,7 @@ class AddressPopup extends Component {
// 获取收货信息 // 获取收货信息
fetchUserAddress = () => { fetchUserAddress = () => {
const { addressInfo } = this.state; const {addressInfo} = this.state;
http.get(`${API.home}/sys/user_address_info`).then(res => { http.get(`${API.home}/sys/user_address_info`).then(res => {
const {code, data, msg} = res.data; const {code, data, msg} = res.data;
if (code === 200) { if (code === 200) {
...@@ -41,7 +41,7 @@ class AddressPopup extends Component { ...@@ -41,7 +41,7 @@ class AddressPopup extends Component {
} }
handleToSubmit = (params = {}) => { handleToSubmit = (params = {}) => {
const { handleToHide } = this.props; const {handleToHide} = this.props;
http.post(`${API.home}/sys/collect_info`, params).then(res => { http.post(`${API.home}/sys/collect_info`, params).then(res => {
const {code, msg} = res.data; const {code, msg} = res.data;
if (code === 200) { if (code === 200) {
...@@ -53,7 +53,7 @@ class AddressPopup extends Component { ...@@ -53,7 +53,7 @@ class AddressPopup extends Component {
} }
render() { render() {
const { isLoading, addressInfo } = this.state; const {isLoading, addressInfo} = this.state;
const {tip, prize} = this.props; const {tip, prize} = this.props;
return ( return (
<> <>
...@@ -61,7 +61,7 @@ class AddressPopup extends Component { ...@@ -61,7 +61,7 @@ class AddressPopup extends Component {
isLoading && isLoading &&
<Formik <Formik
initialValues={{ initialValues={{
...addressInfo ...addressInfo,
}} }}
validate={({name, phone, address}) => { validate={({name, phone, address}) => {
const errors = {}; const errors = {};
...@@ -69,7 +69,7 @@ class AddressPopup extends Component { ...@@ -69,7 +69,7 @@ class AddressPopup extends Component {
if (!name) { if (!name) {
errors.name = '请输入收件人'; errors.name = '请输入收件人';
} }
if(!/^1[3-9]\d{9}$/.test(phone)) { if (!/^1[3-9]\d{9}$/.test(phone)) {
errors.phone = '请填写正确格式的手机号'; errors.phone = '请填写正确格式的手机号';
} }
if (!address) { if (!address) {
...@@ -83,7 +83,8 @@ class AddressPopup extends Component { ...@@ -83,7 +83,8 @@ class AddressPopup extends Component {
onSubmit={(values) => { onSubmit={(values) => {
this.handleToSubmit(values); this.handleToSubmit(values);
}} }}
render={({errors}) => ( >
{({errors}) => (
<Form className="address-form"> <Form className="address-form">
{ {
prize ? ( prize ? (
...@@ -91,11 +92,13 @@ class AddressPopup extends Component { ...@@ -91,11 +92,13 @@ class AddressPopup extends Component {
) : (null) ) : (null)
} }
{ {
tip ? (<p className="address-form__desc">{tip}</p>) : (<p className="address-form__desc">请及时填写收货信息,获得实物奖品后将第一时间为您邮寄</p>) tip ? (<p className="address-form__desc">{tip}</p>) : (
<p className="address-form__desc">请及时填写收货信息,获得实物奖品后将第一时间为您邮寄</p>)
} }
<Field <Field
name="name" name="name"
render={({ field }) => ( >
{({field}) => (
<div className="address-form__item"> <div className="address-form__item">
<input <input
{...field} {...field}
...@@ -109,10 +112,11 @@ class AddressPopup extends Component { ...@@ -109,10 +112,11 @@ class AddressPopup extends Component {
} }
</div> </div>
)} )}
/> </Field>
<Field <Field
name="phone" name="phone"
render={({ field }) => ( >
{({field}) => (
<div className="address-form__item"> <div className="address-form__item">
<input <input
{...field} {...field}
...@@ -126,10 +130,11 @@ class AddressPopup extends Component { ...@@ -126,10 +130,11 @@ class AddressPopup extends Component {
} }
</div> </div>
)} )}
/> </Field>
<Field <Field
name="address" name="address"
render={({ field }) => ( >
{({field}) => (
<div className="address-form__item"> <div className="address-form__item">
<input <input
{...field} {...field}
...@@ -143,15 +148,16 @@ class AddressPopup extends Component { ...@@ -143,15 +148,16 @@ class AddressPopup extends Component {
} }
</div> </div>
)} )}
/> </Field>
<button <button
className="address-form__submit" className="address-form__submit"
data-status="do" data-status="do"
type="submit" type="submit"
>提交</button> >提交
</button>
</Form> </Form>
)} )}
/> </Formik>
} }
</> </>
); );
......
...@@ -20,11 +20,11 @@ class BargainBindPhone extends Component { ...@@ -20,11 +20,11 @@ class BargainBindPhone extends Component {
} }
// 获取短信验证码 // 获取短信验证码
handleToSendCode = ({ mobile }) => { handleToSendCode = ({mobile}) => {
const { country: { num = 86 } } = this.props; const {country: {num = 86}} = this.props;
let { isTimer, seconds } = this.state; let {isTimer, seconds} = this.state;
if(!isTimer) { if (!isTimer) {
if(!/^\d+$/.test(mobile)){ if (!/^\d+$/.test(mobile)) {
Toast.info('请输入正确的手机号'); Toast.info('请输入正确的手机号');
return; return;
} }
...@@ -34,11 +34,11 @@ class BargainBindPhone extends Component { ...@@ -34,11 +34,11 @@ class BargainBindPhone extends Component {
`${API['passport-api']}/m/personal/bindPhoneSendCode`, `${API['passport-api']}/m/personal/bindPhoneSendCode`,
{ {
area_code: `00${num}`, area_code: `00${num}`,
phone_num: mobile phone_num: mobile,
} },
).then(res => { ).then(res => {
const { errno, msg } = res.data; const {errno, msg} = res.data;
if(errno === 200) { if (errno === 200) {
Toast.info('验证码发送成功', 2, null, false); Toast.info('验证码发送成功', 2, null, false);
// 倒计时 // 倒计时
...@@ -47,16 +47,16 @@ class BargainBindPhone extends Component { ...@@ -47,16 +47,16 @@ class BargainBindPhone extends Component {
window.clearInterval(this.timer); window.clearInterval(this.timer);
this.setState({ this.setState({
isTimer: false, isTimer: false,
seconds: 60 seconds: 60,
}); });
}else { } else {
this.setState({ this.setState({
isTimer: true, isTimer: true,
seconds: --seconds seconds: --seconds,
}); });
} }
}, 1000); }, 1000);
}else { } else {
Toast.info(msg); Toast.info(msg);
} }
}); });
...@@ -65,7 +65,7 @@ class BargainBindPhone extends Component { ...@@ -65,7 +65,7 @@ class BargainBindPhone extends Component {
// 绑定手机号 // 绑定手机号
handleToBindPhone = ({code, mobile}) => { handleToBindPhone = ({code, mobile}) => {
const { country: { num = 86}, handleToBargain, confirmBindPhone } = this.props; const {country: {num = 86}, handleToBargain, confirmBindPhone} = this.props;
if (!mobile) { if (!mobile) {
Toast.info('请填手机号码'); Toast.info('请填手机号码');
return; return;
...@@ -87,34 +87,34 @@ class BargainBindPhone extends Component { ...@@ -87,34 +87,34 @@ class BargainBindPhone extends Component {
{ {
...params, ...params,
type: 1, type: 1,
is_valid: 1 is_valid: 1,
} },
).then(res => { ).then(res => {
const { errno, data, msg } = res.data; const {errno, data, msg} = res.data;
if(errno === 200) { if (errno === 200) {
if(data.tip_info) { if (data.tip_info) {
confirmBindPhone(params, data.tip_info); confirmBindPhone(params, data.tip_info);
}else { } else {
handleToBargain(); handleToBargain();
} }
}else { } else {
Toast.info(msg); Toast.info(msg);
} }
}); });
} }
render() { render() {
const { country: { num = '86' } } = this.props; const {country: {num = '86'}} = this.props;
const { isTimer, seconds } = this.state; const {isTimer, seconds} = this.state;
return ( return (
<Formik <Formik
initialValues={{ initialValues={{
mobile: '', mobile: '',
code: '' code: '',
}} }}
validate={({mobile, code}) => { validate={({mobile, code}) => {
const errors = {}; const errors = {};
if(!/^\d+$/.test(mobile)) { if (!/^\d+$/.test(mobile)) {
errors.mobile = '请填写正确格式的手机号'; errors.mobile = '请填写正确格式的手机号';
} }
if (!/[0-9]{6}/.test(code)) { if (!/[0-9]{6}/.test(code)) {
...@@ -122,10 +122,11 @@ class BargainBindPhone extends Component { ...@@ -122,10 +122,11 @@ class BargainBindPhone extends Component {
} }
return errors; return errors;
}} }}
onSubmit={(values, { setStatus, setSubmitting }) => { onSubmit={(values, {setStatus, setSubmitting}) => {
this.handleToBindPhone(values); this.handleToBindPhone(values);
}} }}
render={({values: {mobile, code}, errors}) => ( >
{({values: {mobile, code}, errors}) => (
<Form className="bargain-bind-phone"> <Form className="bargain-bind-phone">
<h2 className="bargain-bind-phone__title">绑定手机,先砍一刀</h2> <h2 className="bargain-bind-phone__title">绑定手机,先砍一刀</h2>
<div className="bargain-bind-phone__item"> <div className="bargain-bind-phone__item">
...@@ -138,7 +139,8 @@ class BargainBindPhone extends Component { ...@@ -138,7 +139,8 @@ class BargainBindPhone extends Component {
</Link> </Link>
<Field <Field
name="mobile" name="mobile"
render={({field}) => ( >
{({field}) => (
<input <input
{...field} {...field}
className="bargain-bind-phone__ipt" className="bargain-bind-phone__ipt"
...@@ -147,12 +149,11 @@ class BargainBindPhone extends Component { ...@@ -147,12 +149,11 @@ class BargainBindPhone extends Component {
maxLength={11} maxLength={11}
/> />
)} )}
/> </Field>
</div> </div>
<div className="bargain-bind-phone__item"> <div className="bargain-bind-phone__item">
<Field <Field name="code">
name="code" {({field}) => (
render={({field}) => (
<input <input
{...field} {...field}
type="tel" type="tel"
...@@ -160,30 +161,31 @@ class BargainBindPhone extends Component { ...@@ -160,30 +161,31 @@ class BargainBindPhone extends Component {
maxLength={6} maxLength={6}
/> />
)} )}
/> </Field>
{errors.mobile} {errors.mobile}
<button <button
type="button" type="button"
className={classnames( className={classnames(
'bargain-bind-phone__button--send', 'bargain-bind-phone__button--send',
{ {
'active': mobile && errors.mobile === undefined 'active': mobile && errors.mobile === undefined,
} },
)} )}
disabled={!(mobile && errors.mobile === undefined)} disabled={!(mobile && errors.mobile === undefined)}
onClick={() => this.handleToSendCode({mobile})} onClick={() => this.handleToSendCode({mobile})}
> >
{isTimer? `重新发送${seconds}s` : '发送验证码'} {isTimer ? `重新发送${seconds}s` : '发送验证码'}
</button> </button>
</div> </div>
<button <button
type="submit" type="submit"
className="bargain-bind-phone__button--bargain" className="bargain-bind-phone__button--bargain"
disabled={!(mobile && code && JSON.stringify(errors) === '{}')} disabled={!(mobile && code && JSON.stringify(errors) === '{}')}
>先砍一刀</button> >先砍一刀
</button>
</Form> </Form>
)} )}
/> </Formik>
) )
} }
} }
......
...@@ -31,12 +31,12 @@ class RedPacket extends PureComponent { ...@@ -31,12 +31,12 @@ class RedPacket extends PureComponent {
shareInfo: { shareInfo: {
url: '', url: '',
share_code: '', share_code: '',
command: '【七月在线送你一个红包】https://www.julyedu.com/' command: '【七月在线送你一个红包】https://www.julyedu.com/',
}, },
doneInfo: { //领取后的状态,1:领取成功,2:领取超时 doneInfo: { //领取后的状态,1:领取成功,2:领取超时
status: 2, status: 2,
txt: '手机号绑定超时,红包已失效!', txt: '手机号绑定超时,红包已失效!',
desc: '' desc: '',
}, },
money: '', // 红包金额, money: '', // 红包金额,
endTime: 10, // 手机绑定时限 endTime: 10, // 手机绑定时限
...@@ -45,7 +45,7 @@ class RedPacket extends PureComponent { ...@@ -45,7 +45,7 @@ class RedPacket extends PureComponent {
accountInfo: {}, accountInfo: {},
bindInfo: {}, bindInfo: {},
country: { country: {
num: '86' num: '86',
}, },
validationData: null, validationData: null,
} }
...@@ -80,8 +80,8 @@ class RedPacket extends PureComponent { ...@@ -80,8 +80,8 @@ class RedPacket extends PureComponent {
`${API.home}/sys/redPacket/split`, `${API.home}/sys/redPacket/split`,
{ {
action: 'check', action: 'check',
share_code: data.share_code share_code: data.share_code,
} },
).then(res => { ).then(res => {
const {code, data} = res.data; const {code, data} = res.data;
if (code === 200) { if (code === 200) {
...@@ -91,7 +91,7 @@ class RedPacket extends PureComponent { ...@@ -91,7 +91,7 @@ class RedPacket extends PureComponent {
this.judgeReceiveStatus(data, 8); this.judgeReceiveStatus(data, 8);
} else { } else {
this.setState({ this.setState({
type: 3 type: 3,
}); });
} }
} }
...@@ -100,14 +100,14 @@ class RedPacket extends PureComponent { ...@@ -100,14 +100,14 @@ class RedPacket extends PureComponent {
}); });
} else { } else {
this.setState({ this.setState({
type: 1 type: 1,
}); });
window.localStorage.removeItem('redpacket-click'); window.localStorage.removeItem('redpacket-click');
} }
} else { } else {
this.setRelativeCookie() this.setRelativeCookie()
this.setState({ this.setState({
type: 1 type: 1,
}); });
} }
} }
...@@ -130,7 +130,7 @@ class RedPacket extends PureComponent { ...@@ -130,7 +130,7 @@ class RedPacket extends PureComponent {
const {code, data} = res.data; const {code, data} = res.data;
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
shareInfo: share_code ? Object.assign({}, data, {share_code}) : data shareInfo: share_code ? Object.assign({}, data, {share_code}) : data,
}); });
} }
}); });
...@@ -143,8 +143,8 @@ class RedPacket extends PureComponent { ...@@ -143,8 +143,8 @@ class RedPacket extends PureComponent {
if (share_code && share_code !== 'null') { if (share_code && share_code !== 'null') {
this.setState({ this.setState({
shareInfo: Object.assign({}, shareInfo, { shareInfo: Object.assign({}, shareInfo, {
share_code share_code,
}) }),
}); });
// 检查收否领取过 // 检查收否领取过
...@@ -152,8 +152,8 @@ class RedPacket extends PureComponent { ...@@ -152,8 +152,8 @@ class RedPacket extends PureComponent {
`${API.home}/sys/redPacket/split`, `${API.home}/sys/redPacket/split`,
{ {
action: 'check', action: 'check',
share_code share_code,
} },
).then(res => { ).then(res => {
const {code, data} = res.data; const {code, data} = res.data;
if (code === 200) { if (code === 200) {
...@@ -161,7 +161,7 @@ class RedPacket extends PureComponent { ...@@ -161,7 +161,7 @@ class RedPacket extends PureComponent {
// is_overdue 红包是否过期 0-否 1-是 // is_overdue 红包是否过期 0-否 1-是
if (data.is_overdue) { if (data.is_overdue) {
this.setState({ this.setState({
type: 7 type: 7,
}); });
} else { } else {
...@@ -170,14 +170,14 @@ class RedPacket extends PureComponent { ...@@ -170,14 +170,14 @@ class RedPacket extends PureComponent {
this.judgeReceiveStatus(data); this.judgeReceiveStatus(data);
} else { } else {
this.setState({ this.setState({
type: browser.isWeixin ? 2 : 3 type: browser.isWeixin ? 2 : 3,
}); });
} }
} }
} }
if (code === 4030 || code === 4040) { if (code === 4030 || code === 4040) {
this.setState({ this.setState({
type: browser.isWeixin ? 2 : 3 type: browser.isWeixin ? 2 : 3,
}); });
} }
}); });
...@@ -192,8 +192,8 @@ class RedPacket extends PureComponent { ...@@ -192,8 +192,8 @@ class RedPacket extends PureComponent {
this.setState({ this.setState({
country, country,
shareInfo: Object.assign({}, shareInfo, { shareInfo: Object.assign({}, shareInfo, {
share_code: country.code share_code: country.code,
}) }),
}); });
// 检查收否领取过 // 检查收否领取过
...@@ -201,8 +201,8 @@ class RedPacket extends PureComponent { ...@@ -201,8 +201,8 @@ class RedPacket extends PureComponent {
`${API.home}/sys/redPacket/split`, `${API.home}/sys/redPacket/split`,
{ {
action: 'check', action: 'check',
share_code: country.code share_code: country.code,
} },
).then(res => { ).then(res => {
console.log(res); console.log(res);
const {code, data} = res.data; const {code, data} = res.data;
...@@ -213,7 +213,7 @@ class RedPacket extends PureComponent { ...@@ -213,7 +213,7 @@ class RedPacket extends PureComponent {
this.judgeReceiveStatus(data, 8); this.judgeReceiveStatus(data, 8);
} else { } else {
this.setState({ this.setState({
type: 3 type: 3,
}); });
} }
...@@ -252,14 +252,14 @@ class RedPacket extends PureComponent { ...@@ -252,14 +252,14 @@ class RedPacket extends PureComponent {
doneInfo: { doneInfo: {
status: 1, status: 1,
txt, txt,
desc desc,
} },
}); });
} else if (data.receive_status === 2) { } else if (data.receive_status === 2) {
this.setState({ this.setState({
type: bindType, type: bindType,
money: data.amount, money: data.amount,
endTime: data.end_time endTime: data.end_time,
}); });
this.startCountDown(); this.startCountDown();
} else if (data.receive_status === 3) { } else if (data.receive_status === 3) {
...@@ -268,8 +268,8 @@ class RedPacket extends PureComponent { ...@@ -268,8 +268,8 @@ class RedPacket extends PureComponent {
doneInfo: { doneInfo: {
status: 2, status: 2,
txt: '手机号绑定超时,红包已失效!', txt: '手机号绑定超时,红包已失效!',
desc desc,
} },
}); });
} }
} }
...@@ -287,14 +287,14 @@ class RedPacket extends PureComponent { ...@@ -287,14 +287,14 @@ class RedPacket extends PureComponent {
if (time <= 0) { if (time <= 0) {
window.clearInterval(this.countdownTimer); window.clearInterval(this.countdownTimer);
this.setState({ this.setState({
endTime: 0 endTime: 0,
}); });
} }
time -= 1; time -= 1;
minutes = `${Math.floor(time / 60)}`.padStart(2, 0); minutes = `${Math.floor(time / 60)}`.padStart(2, 0);
seconds = `${(time % 60)}`.padStart(2, 0); seconds = `${(time % 60)}`.padStart(2, 0);
this.setState({ this.setState({
countdown: `${minutes}${seconds}秒` countdown: `${minutes}${seconds}秒`,
}); });
}, 1000) }, 1000)
} }
...@@ -304,7 +304,7 @@ class RedPacket extends PureComponent { ...@@ -304,7 +304,7 @@ class RedPacket extends PureComponent {
const {history, userInfo} = this.props; const {history, userInfo} = this.props;
if (browser.isWeixin) { if (browser.isWeixin) {
this.setState({ this.setState({
type: 2 type: 2,
}); });
history.push(`/detail?id=${getParam('id')}&wechat=1`); history.push(`/detail?id=${getParam('id')}&wechat=1`);
} else { } else {
...@@ -315,7 +315,7 @@ class RedPacket extends PureComponent { ...@@ -315,7 +315,7 @@ class RedPacket extends PureComponent {
if (code === 200) { if (code === 200) {
this.setState({ this.setState({
shareInfo: data, shareInfo: data,
type: 1 type: 1,
}); });
} }
}); });
...@@ -332,7 +332,7 @@ class RedPacket extends PureComponent { ...@@ -332,7 +332,7 @@ class RedPacket extends PureComponent {
// is_follow 是否关注公众号,0否,1是 // is_follow 是否关注公众号,0否,1是
if (!shareInfo.is_follow) { if (!shareInfo.is_follow) {
this.setState({ this.setState({
type: 11 type: 11,
}); });
} }
} }
...@@ -345,8 +345,8 @@ class RedPacket extends PureComponent { ...@@ -345,8 +345,8 @@ class RedPacket extends PureComponent {
`${API.home}/sys/redPacket/split`, `${API.home}/sys/redPacket/split`,
{ {
action: 'receive', action: 'receive',
share_code share_code,
} },
).then(res => { ).then(res => {
const {code, data} = res.data; const {code, data} = res.data;
if (code === 200) { if (code === 200) {
...@@ -360,7 +360,7 @@ class RedPacket extends PureComponent { ...@@ -360,7 +360,7 @@ class RedPacket extends PureComponent {
if (data.red_packet_type === 2) { if (data.red_packet_type === 2) {
this.setState({ this.setState({
type: 6, type: 6,
money: data.amount money: data.amount,
}); });
} else if (data.red_packet_type === 1) { } else if (data.red_packet_type === 1) {
...@@ -369,19 +369,19 @@ class RedPacket extends PureComponent { ...@@ -369,19 +369,19 @@ class RedPacket extends PureComponent {
if (data.red_packet_type === 1) { if (data.red_packet_type === 1) {
this.setState({ this.setState({
type: 5, type: 5,
money: data.amount money: data.amount,
}); });
} else if (data.red_packet_type === 2) { } else if (data.red_packet_type === 2) {
this.setState({ this.setState({
type: 6, type: 6,
money: data.amount money: data.amount,
}); });
} }
} else if (data.receive_status === 2) { } else if (data.receive_status === 2) {
this.setState({ this.setState({
type: 4, type: 4,
money: data.amount, money: data.amount,
endTime: data.end_time endTime: data.end_time,
}); });
this.startCountDown(); this.startCountDown();
} else if (data.receive_status === 3) { } else if (data.receive_status === 3) {
...@@ -390,8 +390,8 @@ class RedPacket extends PureComponent { ...@@ -390,8 +390,8 @@ class RedPacket extends PureComponent {
doneInfo: { doneInfo: {
status: 2, status: 2,
txt: '手机号绑定超时,红包已失效!', txt: '手机号绑定超时,红包已失效!',
desc: data.receive_type === 1 ? '越多好友领取,你所得越多!' : data.receive_type === 2 ? '每天只能帮好友领取一次哦~' : '' desc: data.receive_type === 1 ? '越多好友领取,你所得越多!' : data.receive_type === 2 ? '每天只能帮好友领取一次哦~' : '',
} },
}); });
} }
} }
...@@ -412,8 +412,8 @@ class RedPacket extends PureComponent { ...@@ -412,8 +412,8 @@ class RedPacket extends PureComponent {
`${API.home}/sys/redPacket/split`, `${API.home}/sys/redPacket/split`,
{ {
action: 'check', action: 'check',
share_code share_code,
} },
).then(res => { ).then(res => {
const {code, data} = res.data; const {code, data} = res.data;
if (code === 200) { if (code === 200) {
...@@ -423,7 +423,7 @@ class RedPacket extends PureComponent { ...@@ -423,7 +423,7 @@ class RedPacket extends PureComponent {
this.judgeReceiveStatus(data); this.judgeReceiveStatus(data);
} else { } else {
this.setState({ this.setState({
type: 3 type: 3,
}); });
} }
} }
...@@ -434,7 +434,7 @@ class RedPacket extends PureComponent { ...@@ -434,7 +434,7 @@ class RedPacket extends PureComponent {
history.push(`/detail?id=${getParam('id')}`); history.push(`/detail?id=${getParam('id')}`);
} }
this.setState({ this.setState({
type: 0 type: 0,
}); });
} }
} }
...@@ -444,21 +444,21 @@ class RedPacket extends PureComponent { ...@@ -444,21 +444,21 @@ class RedPacket extends PureComponent {
const {type} = this.state; const {type} = this.state;
if (type === 2) { if (type === 2) {
this.setState({ this.setState({
type: 0 type: 0,
}); });
} }
} }
getCaptchaInstance = instance => { getCaptchaInstance = instance => {
this.setState({ this.setState({
captchaInstance: instance captchaInstance: instance,
}); });
} }
onVerify = (data) => { onVerify = (data) => {
this.setState({ this.setState({
validate: true, validate: true,
validationData: data validationData: data,
}) })
} }
...@@ -469,7 +469,7 @@ class RedPacket extends PureComponent { ...@@ -469,7 +469,7 @@ class RedPacket extends PureComponent {
Toast.info('请重新进行滑块验证', 2, null, false); Toast.info('请重新进行滑块验证', 2, null, false);
captchaInstance.reset(); captchaInstance.reset();
this.setState({ this.setState({
isFirst: true isFirst: true,
}); });
return return
} }
...@@ -487,8 +487,8 @@ class RedPacket extends PureComponent { ...@@ -487,8 +487,8 @@ class RedPacket extends PureComponent {
{ {
area_code: `00${num}`, area_code: `00${num}`,
phone_num: tel, phone_num: tel,
...validationData ...validationData,
} },
).then(res => { ).then(res => {
const {errno, msg} = res.data; const {errno, msg} = res.data;
if (errno === 200) { if (errno === 200) {
...@@ -500,19 +500,19 @@ class RedPacket extends PureComponent { ...@@ -500,19 +500,19 @@ class RedPacket extends PureComponent {
window.clearInterval(this.timer); window.clearInterval(this.timer);
this.setState({ this.setState({
isTimer: false, isTimer: false,
seconds: 60 seconds: 60,
}); });
} else { } else {
this.setState({ this.setState({
isTimer: true, isTimer: true,
seconds: --seconds seconds: --seconds,
}); });
} }
}, 1000); }, 1000);
// 滑块 // 滑块
this.setState({ this.setState({
isFirst: false isFirst: false,
}) })
} else { } else {
Toast.info(msg, 2, null, false); Toast.info(msg, 2, null, false);
...@@ -534,19 +534,19 @@ class RedPacket extends PureComponent { ...@@ -534,19 +534,19 @@ class RedPacket extends PureComponent {
if (data.red_packet_type === 1) { if (data.red_packet_type === 1) {
this.setState({ this.setState({
type: 5, type: 5,
money: data.amount money: data.amount,
}); });
} else if (data.red_packet_type === 2) { } else if (data.red_packet_type === 2) {
this.setState({ this.setState({
type: 6, type: 6,
money: data.amount money: data.amount,
}); });
} }
} else if (data.receive_status === 2) { } else if (data.receive_status === 2) {
this.setState({ this.setState({
type: 4, type: 4,
money: data.amount, money: data.amount,
endTime: data.end_time endTime: data.end_time,
}); });
this.startCountDown(); this.startCountDown();
} else if (data.receive_status === 3) { } else if (data.receive_status === 3) {
...@@ -555,8 +555,8 @@ class RedPacket extends PureComponent { ...@@ -555,8 +555,8 @@ class RedPacket extends PureComponent {
doneInfo: { doneInfo: {
status: 2, status: 2,
txt: '手机号绑定超时,红包已失效!', txt: '手机号绑定超时,红包已失效!',
desc: data.receive_type === 1 ? '越多好友领取,你所得越多!' : data.receive_type === 2 ? '每天只能帮好友领取一次哦~' : '' desc: data.receive_type === 1 ? '越多好友领取,你所得越多!' : data.receive_type === 2 ? '每天只能帮好友领取一次哦~' : '',
} },
}); });
} }
} else { } else {
...@@ -576,8 +576,8 @@ class RedPacket extends PureComponent { ...@@ -576,8 +576,8 @@ class RedPacket extends PureComponent {
phone_num: tel, phone_num: tel,
code: code, code: code,
type: 1, type: 1,
is_valid: isValid is_valid: isValid,
} },
).then(res => { ).then(res => {
const {errno, data, msg} = res.data; const {errno, data, msg} = res.data;
if (errno === 200) { if (errno === 200) {
...@@ -585,7 +585,7 @@ class RedPacket extends PureComponent { ...@@ -585,7 +585,7 @@ class RedPacket extends PureComponent {
if (data.tip_info) { if (data.tip_info) {
this.setState({ this.setState({
type: 10, type: 10,
bindInfo: data.tip_info bindInfo: data.tip_info,
}) })
} else { } else {
this.receviceAfterBind(); this.receviceAfterBind();
...@@ -617,17 +617,17 @@ class RedPacket extends PureComponent { ...@@ -617,17 +617,17 @@ class RedPacket extends PureComponent {
seconds, seconds,
shareInfo: { shareInfo: {
command = '', command = '',
share_code = '' share_code = '',
}, },
money, money,
doneInfo, doneInfo,
countdown, countdown,
endTime, endTime,
bindInfo, bindInfo,
country country,
} = this.state; } = this.state;
const cls = classnames('popup-mask', { const cls = classnames('popup-mask', {
'popup-mask--no': type !== 2 'popup-mask--no': type !== 2,
}); });
return ( return (
<> <>
...@@ -667,7 +667,7 @@ class RedPacket extends PureComponent { ...@@ -667,7 +667,7 @@ class RedPacket extends PureComponent {
<CopyToClipboard <CopyToClipboard
text={command} text={command}
onCopy={() => this.setState({ onCopy={() => this.setState({
isCopy: true isCopy: true,
})} })}
> >
<button className="popup-password__button--copy">复制口令</button> <button className="popup-password__button--copy">复制口令</button>
...@@ -699,7 +699,7 @@ class RedPacket extends PureComponent { ...@@ -699,7 +699,7 @@ class RedPacket extends PureComponent {
history.push(`/detail?id=${getParam('id')}`); history.push(`/detail?id=${getParam('id')}`);
} else { } else {
this.setState({ this.setState({
type: 3 type: 3,
}); });
window.localStorage.setItem('redpacket-click', 'split'); window.localStorage.setItem('redpacket-click', 'split');
} }
...@@ -707,7 +707,7 @@ class RedPacket extends PureComponent { ...@@ -707,7 +707,7 @@ class RedPacket extends PureComponent {
this.handleToClose(true); this.handleToClose(true);
} }
this.setState({ this.setState({
isCopy: false isCopy: false,
}); });
}} }}
/> />
...@@ -720,7 +720,7 @@ class RedPacket extends PureComponent { ...@@ -720,7 +720,7 @@ class RedPacket extends PureComponent {
<Packet <Packet
type={3} type={3}
packetInfo={{ packetInfo={{
title: '七月在线给你发了个红包~' title: '七月在线给你发了个红包~',
}} }}
handleToClose={() => this.handleToClose(false)} handleToClose={() => this.handleToClose(false)}
...@@ -740,10 +740,10 @@ class RedPacket extends PureComponent { ...@@ -740,10 +740,10 @@ class RedPacket extends PureComponent {
txt: `立即绑定(${countdown})`, txt: `立即绑定(${countdown})`,
onClick: () => { onClick: () => {
this.setState({ this.setState({
type: 8 type: 8,
}); });
} },
} },
}} }}
handleToClose={() => this.handleToClose(false)} handleToClose={() => this.handleToClose(false)}
/> />
...@@ -761,8 +761,8 @@ class RedPacket extends PureComponent { ...@@ -761,8 +761,8 @@ class RedPacket extends PureComponent {
txt: '获取更多奖励', txt: '获取更多奖励',
onClick: () => { onClick: () => {
history.push('/ShareCourse'); history.push('/ShareCourse');
} },
} },
}} }}
handleToClose={() => { handleToClose={() => {
const isShare = getParam('share_code') ? true : false; const isShare = getParam('share_code') ? true : false;
...@@ -784,8 +784,8 @@ class RedPacket extends PureComponent { ...@@ -784,8 +784,8 @@ class RedPacket extends PureComponent {
txt: '获取更多奖励', txt: '获取更多奖励',
onClick: () => { onClick: () => {
history.push('/ShareCourse'); history.push('/ShareCourse');
} },
} },
}} }}
handleToClose={() => { handleToClose={() => {
const isShare = getParam('share_code') ? true : false; const isShare = getParam('share_code') ? true : false;
...@@ -805,8 +805,8 @@ class RedPacket extends PureComponent { ...@@ -805,8 +805,8 @@ class RedPacket extends PureComponent {
txt: '获取更多奖励', txt: '获取更多奖励',
onClick: () => { onClick: () => {
history.push('/ShareCourse') history.push('/ShareCourse')
} },
} },
}} }}
handleToClose={() => { handleToClose={() => {
const isShare = getParam('share_code') ? true : false; const isShare = getParam('share_code') ? true : false;
...@@ -822,7 +822,7 @@ class RedPacket extends PureComponent { ...@@ -822,7 +822,7 @@ class RedPacket extends PureComponent {
<Formik <Formik
initialValues={{ initialValues={{
tel: '', tel: '',
code: '' code: '',
}} }}
validate={({tel, code}) => { validate={({tel, code}) => {
const errors = {}; const errors = {};
...@@ -840,12 +840,13 @@ class RedPacket extends PureComponent { ...@@ -840,12 +840,13 @@ class RedPacket extends PureComponent {
onSubmit={(values, {setStatus, setSubmitting}) => { onSubmit={(values, {setStatus, setSubmitting}) => {
this.setState({ this.setState({
accountInfo: { accountInfo: {
...values ...values,
} },
}); });
this.toContinueBind(); this.toContinueBind();
}} }}
render={({values: {tel, code}, errors}) => ( >
{({values: {tel, code}, errors}) => (
<Form className="popup-form__content"> <Form className="popup-form__content">
<h4 className="popup-form__title">绑定手机号</h4> <h4 className="popup-form__title">绑定手机号</h4>
<div className="popup-form__item"> <div className="popup-form__item">
...@@ -857,7 +858,8 @@ class RedPacket extends PureComponent { ...@@ -857,7 +858,8 @@ class RedPacket extends PureComponent {
</Link> </Link>
<Field <Field
name="tel" name="tel"
render={({field}) => { >
{({field}) => {
return ( return (
<input <input
{...field} {...field}
...@@ -869,7 +871,7 @@ class RedPacket extends PureComponent { ...@@ -869,7 +871,7 @@ class RedPacket extends PureComponent {
/> />
); );
}} }}
/> </Field>
</div> </div>
<CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/> <CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>
{ {
...@@ -896,7 +898,8 @@ class RedPacket extends PureComponent { ...@@ -896,7 +898,8 @@ class RedPacket extends PureComponent {
<div className="popup-form__item"> <div className="popup-form__item">
<Field <Field
name="code" name="code"
render={({field}) => { >
{({field}) => {
return ( return (
<input <input
{...field} {...field}
...@@ -906,7 +909,7 @@ class RedPacket extends PureComponent { ...@@ -906,7 +909,7 @@ class RedPacket extends PureComponent {
/> />
); );
}} }}
/> </Field>
<button <button
className="popup-form__button--code" className="popup-form__button--code"
data-status={(validate && !isTimer) ? 'do' : ''} data-status={(validate && !isTimer) ? 'do' : ''}
...@@ -930,7 +933,7 @@ class RedPacket extends PureComponent { ...@@ -930,7 +933,7 @@ class RedPacket extends PureComponent {
} }
</Form> </Form>
)} )}
/> </Formik>
<i <i
className="popup-password__button--close iconfont iconiconfront-2" className="popup-password__button--close iconfont iconiconfront-2"
onClick={() => this.handleToClose(false)} onClick={() => this.handleToClose(false)}
...@@ -1055,7 +1058,7 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen}) => { ...@@ -1055,7 +1058,7 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen}) => {
'popup-packet__content--money': type === 5, 'popup-packet__content--money': type === 5,
'popup-packet__content--fragment': type === 6, 'popup-packet__content--fragment': type === 6,
'popup-packet__content--late': type === 7, 'popup-packet__content--late': type === 7,
} },
); );
const {money, tip = [], btn} = packetInfo; const {money, tip = [], btn} = packetInfo;
return ( return (
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Flex, NavBar, List, InputItem, Button, WhiteSpace, WingBlank, Toast } from 'antd-mobile'; import { InputItem, Button, WingBlank, Toast } from 'antd-mobile';
import { Formik, Field, Form, withFormik } from 'formik'; import { withFormik } from 'formik';
import {HeaderBar} from '../../common'; import {HeaderBar} from '../../common';
import { http } from "src/utils"; import { http } from "src/utils";
const InnerForm = ({ const InnerForm = ({
values, values,
errors,
touched,
setFieldValue, setFieldValue,
handleBlur,
handleSubmit, handleSubmit,
isSubmitting,
}) => ( }) => (
<form> <form>
<InputItem <InputItem
......
...@@ -27,9 +27,8 @@ class AccountLogin extends PureComponent { ...@@ -27,9 +27,8 @@ class AccountLogin extends PureComponent {
<HeaderBar arrow={true} title={'登录'}/> <HeaderBar arrow={true} title={'登录'}/>
<Header/> <Header/>
<Form className="login-info"> <Form className="login-info">
<FastField <FastField name='account'>
name='account' {({field}) => (
render={({field}) => (
<Input <Input
{...field} {...field}
type={'text'} type={'text'}
...@@ -42,10 +41,9 @@ class AccountLogin extends PureComponent { ...@@ -42,10 +41,9 @@ class AccountLogin extends PureComponent {
} }
/> />
)} )}
/> </FastField>
<FastField <FastField name='password'>
name='password' {({field}) => (
render={({field}) => (
<PasswordInput <PasswordInput
{...field} {...field}
autoComplete={'on'} autoComplete={'on'}
...@@ -55,7 +53,7 @@ class AccountLogin extends PureComponent { ...@@ -55,7 +53,7 @@ class AccountLogin extends PureComponent {
} }
/> />
)} )}
/> </FastField>
<LoginButton active={values.account && values.password && isEmpty(errors)}/> <LoginButton active={values.account && values.password && isEmpty(errors)}/>
<Link className={'forgot-password-btn'} to='/passport/forgot-password'>忘记密码</Link> <Link className={'forgot-password-btn'} to='/passport/forgot-password'>忘记密码</Link>
</Form> </Form>
......
...@@ -47,7 +47,8 @@ class BindingTel extends Component { ...@@ -47,7 +47,8 @@ class BindingTel extends Component {
<Form> <Form>
<Field <Field
name='tel' name='tel'
render={({field, form}) => { >
{({field, form}) => {
return ( return (
<ClearableInput <ClearableInput
{...field} {...field}
...@@ -59,10 +60,11 @@ class BindingTel extends Component { ...@@ -59,10 +60,11 @@ class BindingTel extends Component {
) )
}} }}
/> </Field>
<Field <Field
name='veriCode' name='veriCode'
render={({field}) => { >
{({field}) => {
return ( return (
<VeriCodeInput <VeriCodeInput
{...field} {...field}
...@@ -81,7 +83,7 @@ class BindingTel extends Component { ...@@ -81,7 +83,7 @@ class BindingTel extends Component {
) )
}} }}
/> </Field>
<CaptchaAli onVerify={this.onVerify} getInstance={this.getCaptchaInstance} mb={0}/> <CaptchaAli onVerify={this.onVerify} getInstance={this.getCaptchaInstance} mb={0}/>
<Button className={'complete-btn'} <Button className={'complete-btn'}
active={values.tel && values.veriCode && isEmpty(errors)}>完成</Button> active={values.tel && values.veriCode && isEmpty(errors)}>完成</Button>
......
...@@ -52,7 +52,8 @@ class ForgotPassword extends Component { ...@@ -52,7 +52,8 @@ class ForgotPassword extends Component {
<Form className='forgot-password-form'> <Form className='forgot-password-form'>
<Field <Field
name={'tel'} name={'tel'}
render={({field, form}) => { >
{({field, form}) => {
return ( return (
<ClearableInput <ClearableInput
{...field} {...field}
...@@ -63,12 +64,13 @@ class ForgotPassword extends Component { ...@@ -63,12 +64,13 @@ class ForgotPassword extends Component {
country={country} country={country}
/>) />)
}} }}
/> </Field>
{ {
this.state.validate && this.state.validate &&
<Field <Field
name='veriCode' name='veriCode'
render={({field}) => { >
{({field}) => {
return ( return (
<VeriCodeInput <VeriCodeInput
{...field} {...field}
...@@ -86,7 +88,7 @@ class ForgotPassword extends Component { ...@@ -86,7 +88,7 @@ class ForgotPassword extends Component {
/> />
) )
}} }}
/> </Field>
} }
<OnSubmissionError callback={this.onSubmissionError}/> <OnSubmissionError callback={this.onSubmissionError}/>
<CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/> <CaptchaAli getInstance={this.getCaptchaInstance} onVerify={this.onVerify}/>
......
...@@ -18,7 +18,7 @@ class Login extends Component { ...@@ -18,7 +18,7 @@ class Login extends Component {
state = { state = {
validate: null, validate: null,
captchaInstance: null, captchaInstance: null,
validationData: null validationData: null,
} }
loginWaysClick = method => { loginWaysClick = method => {
...@@ -29,7 +29,7 @@ class Login extends Component { ...@@ -29,7 +29,7 @@ class Login extends Component {
let from = location.state && location.state.from || { let from = location.state && location.state.from || {
pathname: '/', pathname: '/',
search: window.location.search, search: window.location.search,
hash: '' hash: '',
}; };
const referrer = document.referrer const referrer = document.referrer
const redirectURI = (!/^https?:\/\/m.julyedu.com\/?$/.test(referrer) && referrer) ? referrer : window.location.origin + from.pathname + from.search + from.hash; const redirectURI = (!/^https?:\/\/m.julyedu.com\/?$/.test(referrer) && referrer) ? referrer : window.location.origin + from.pathname + from.search + from.hash;
...@@ -52,14 +52,14 @@ class Login extends Component { ...@@ -52,14 +52,14 @@ class Login extends Component {
getCaptchaInstance = instance => { getCaptchaInstance = instance => {
this.setState({ this.setState({
captchaInstance: instance captchaInstance: instance,
}) })
} }
onVerify = (data) => { onVerify = (data) => {
this.setState({ this.setState({
validationData: data, validationData: data,
validate: true validate: true,
}) })
} }
...@@ -86,16 +86,15 @@ class Login extends Component { ...@@ -86,16 +86,15 @@ class Login extends Component {
loginWays, loginWays,
errors, errors,
values, values,
country country,
} = this.props } = this.props
return ( return (
<div className='login'> <div className='login'>
<HeaderBar title={'登录'} arrow={true}/> <HeaderBar title={'登录'} arrow={true}/>
<Header/> <Header/>
<Form className="login-info"> <Form className="login-info">
<Field <Field name='tel'>
name='tel' {({field}) => (
render={({field}) => (
<Input <Input
{...field} {...field}
type={'tel'} type={'tel'}
...@@ -105,14 +104,14 @@ class Login extends Component { ...@@ -105,14 +104,14 @@ class Login extends Component {
id={'tel'} id={'tel'}
/> />
)} )}
>
</Field> </Field>
{ {
this.state.validate && this.state.validate &&
<Field <Field
type='number' type='number'
name='veriCode' name='veriCode'
render={({field}) => ( >
{({field}) => (
<VeriCodeInput <VeriCodeInput
{...field} {...field}
className={'verification'} className={'verification'}
...@@ -127,7 +126,7 @@ class Login extends Component { ...@@ -127,7 +126,7 @@ class Login extends Component {
country={country} country={country}
/> />
)} )}
/> </Field>
} }
<CaptchaAli onVerify={this.onVerify} getInstance={this.getCaptchaInstance}/> <CaptchaAli onVerify={this.onVerify} getInstance={this.getCaptchaInstance}/>
...@@ -147,7 +146,7 @@ class Login extends Component { ...@@ -147,7 +146,7 @@ class Login extends Component {
const FormikConfig = { const FormikConfig = {
mapPropsToValues: () => ({ mapPropsToValues: () => ({
tel: '', tel: '',
veriCode: '' veriCode: '',
}), }),
handleSubmit(values, {props}) { handleSubmit(values, {props}) {
const from = props.location.state && props.location.state.from const from = props.location.state && props.location.state.from
...@@ -155,7 +154,7 @@ const FormikConfig = { ...@@ -155,7 +154,7 @@ const FormikConfig = {
phone_num: values.tel, phone_num: values.tel,
phone_code: values.veriCode, phone_code: values.veriCode,
area_code: '00' + props.country.num, area_code: '00' + props.country.num,
redirect: from && encodeURIComponent(window.location.origin + from.pathname + from.search + from.hash) redirect: from && encodeURIComponent(window.location.origin + from.pathname + from.search + from.hash),
}).then(res => { }).then(res => {
if (res.hasError) { if (res.hasError) {
Toast.info(res.msg); Toast.info(res.msg);
...@@ -176,13 +175,13 @@ const FormikConfig = { ...@@ -176,13 +175,13 @@ const FormikConfig = {
errors.veriCode = '请输入验证码' errors.veriCode = '请输入验证码'
} }
return errors return errors
} },
} }
export default compose( export default compose(
connect( connect(
state => ({country: state.country}), state => ({country: state.country}),
{quickLogin} {quickLogin},
), ),
withFormik(FormikConfig), withFormik(FormikConfig),
)(Login) )(Login)
...@@ -9,7 +9,6 @@ import { HeaderBar } from "src/common" ...@@ -9,7 +9,6 @@ import { HeaderBar } from "src/common"
import { http } from "src/utils" import { http } from "src/utils"
import { Toast } from "antd-mobile" import { Toast } from "antd-mobile"
import { encrypt } from "src/components/passport/encryption" import { encrypt } from "src/components/passport/encryption"
import { Link } from "react-router-dom"
import { isEmpty } from "lodash" import { isEmpty } from "lodash"
import { connect } from "react-redux" import { connect } from "react-redux"
import { setCurrentUser } from 'src/store/userAction' import { setCurrentUser } from 'src/store/userAction'
...@@ -20,30 +19,9 @@ class SetPassword extends Component { ...@@ -20,30 +19,9 @@ class SetPassword extends Component {
let historyUrl = window.localStorage.getItem('HistoryUrl') let historyUrl = window.localStorage.getItem('HistoryUrl')
const {history} = this.props const {history} = this.props
history.push(historyUrl) history.push(historyUrl)
// window.localStorage.removeItem('HistoryUrl')
return
} }
//
// componentDidMount() {
// const {location} = this.props
// const {action} = this.props.history
// let pathname = location.state && location.state.from && location.state.from.pathname
// let search = location.state && location.state.from && location.state.from.search
//
// console.log(location);
// console.log(location.state);
// console.log(action,pathname,search);
//
// // if(action !== 'PUSH'){
// // let historyUrl = `${pathname}${search}`
// // window.localStorage.setItem('HistoryUrl',historyUrl)
// // }
//
// }
render() { render() {
let {values, errors, location} = this.props let {values, errors, location} = this.props
let {from} = location.state || {from: {pathname: '/'}} let {from} = location.state || {from: {pathname: '/'}}
...@@ -55,7 +33,8 @@ class SetPassword extends Component { ...@@ -55,7 +33,8 @@ class SetPassword extends Component {
<Form> <Form>
<Field <Field
name='password' name='password'
render={({field}) => { >
{({field}) => {
return ( return (
<PasswordInput <PasswordInput
autoComplete={'on'} autoComplete={'on'}
...@@ -65,7 +44,7 @@ class SetPassword extends Component { ...@@ -65,7 +44,7 @@ class SetPassword extends Component {
/> />
) )
}} }}
/> </Field>
<Button className={'btn-active'} <Button className={'btn-active'}
active={values.password && values.agreement && isEmpty(errors)}>完成</Button> active={values.password && values.agreement && isEmpty(errors)}>完成</Button>
<label htmlFor="agreement" className='user-agreement'> <label htmlFor="agreement" className='user-agreement'>
......
...@@ -171,9 +171,8 @@ class StudentRoot extends PureComponent { ...@@ -171,9 +171,8 @@ class StudentRoot extends PureComponent {
const isSubmit = Object.values(props.values).join('') !== '' && props.errors.tip === undefined; const isSubmit = Object.values(props.values).join('') !== '' && props.errors.tip === undefined;
return ( return (
<Form className="student-form"> <Form className="student-form">
<Field <Field name='tel'>
name='tel' {({field}) => (
render={({field}) => (
<Input <Input
{...field} {...field}
type={'tel'} type={'tel'}
...@@ -182,7 +181,7 @@ class StudentRoot extends PureComponent { ...@@ -182,7 +181,7 @@ class StudentRoot extends PureComponent {
country={country} country={country}
/> />
)} )}
/> </Field>
<div className="student-form__item"> <div className="student-form__item">
<Field <Field
className="student-form__input" className="student-form__input"
...@@ -199,7 +198,8 @@ class StudentRoot extends PureComponent { ...@@ -199,7 +198,8 @@ class StudentRoot extends PureComponent {
<Field <Field
type='number' type='number'
name='code' name='code'
render={({field}) => ( >
{({field}) => (
<VeriCodeInput <VeriCodeInput
{...field} {...field}
className={'student-form__code'} className={'student-form__code'}
...@@ -212,7 +212,7 @@ class StudentRoot extends PureComponent { ...@@ -212,7 +212,7 @@ class StudentRoot extends PureComponent {
country={country} country={country}
/> />
)} )}
/> </Field>
} }
<div className="student-form__item"> <div className="student-form__item">
<label className="student-form__label">学校</label> <label className="student-form__label">学校</label>
......
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