From b62ce368757906cbd80005ed20c159f1818d98ec Mon Sep 17 00:00:00 2001 From: ciaochaos <1272777550@qq.com> Date: Tue, 19 May 2020 15:13:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=8C=89=E9=92=AE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Qrcode.css | 76 ++++++++++++++++++++++++++-- src/containers/app/InputText.js | 88 ++++++++++++++++++--------------- 2 files changed, 121 insertions(+), 43 deletions(-) diff --git a/src/components/Qrcode.css b/src/components/Qrcode.css index 554cdaa..c56ba93 100644 --- a/src/components/Qrcode.css +++ b/src/components/Qrcode.css @@ -200,13 +200,20 @@ td { padding: 0 0 12px 0; } -.big-input { - font-size: calc(10px + 2vmin); +.Qr-input-upload { + display: flex; margin-top: calc((10px + 2vmin) * 2); margin-bottom: calc((10px + 2vmin) * 2); - border: rgba(0,0,0,0.12) solid 2px; - width: 20em; max-width: calc(100vw - 46px); + width: 20em; +} + +.big-input { + height: calc(2em + 6px); + font-size: calc(10px + 2vmin); + border: rgba(0,0,0,0.12) solid 2px; + margin-right: 10px; + flex: 1; } @media (min-width: 500px) { @@ -215,6 +222,67 @@ td { } } +.Qr-upload { + color: rgba(102,102,102,1); + font-size: calc(10px + 2vmin); + border: rgba(0,0,0,0.12) solid 2px; + width: calc(2em + 6px)!important; + height: calc(2em + 6px); + cursor: pointer; + line-height: 2em; + border-radius: 3em; + outline: none; + padding: 0; + box-sizing: border-box; + -webkit-transition-timing-function: ease-in-out; + -moz-transition-timing-function: ease-in-out; + transition-timing-function: ease-in-out; + -webkit-transition-duration: 0.2s; /* Safari */ + -moz-animation-duration: 0.2s; + transition-duration: 0.2s; + -webkit-appearance: none; + -webkit-text-size-adjust: 100%; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -moz-appearance: none; + -moz-text-size-adjust: 100%; + background: white; + font-family: 'Futura', sans-serif; + display: flex; + justify-content: center; + align-items: center; +} + +@media (min-width: 500px) { + .Qr-upload { + border: rgba(0,0,0,0.12) solid 3px; + } +} + +.Qr-upload:hover { + border-color: #44D7B6; + color: #44D7B6; +} + +.Qr-upload:active { + -webkit-transition-duration: 0s; /* Safari */ + transition-duration: 0s; + -moz-transition-duration: 0s; + border-color: #3BBC9F; + color: #3BBC9F; +} + +.Qr-upload-svg { + height: 60%; +} + +.st0 { + fill:none; + stroke: currentColor; + stroke-width:4; + stroke-linecap:round; + stroke-linejoin:round; +} + .small-input { margin: 0; font-size: 0.9em; diff --git a/src/containers/app/InputText.js b/src/containers/app/InputText.js index 1184a67..5f0eb43 100644 --- a/src/containers/app/InputText.js +++ b/src/containers/app/InputText.js @@ -9,46 +9,56 @@ const InputText = ({dispatch}) => { return ( - dispatch(genQRInfo(e.target.value))} - onKeyPress={(e) => { - if (e.key === 'Enter') { - dispatch(genQRInfo(e.target.value)); - e.target.blur(); - } - }} - /> - - e.target.value = null} - onChange={(e) => { - if (e.target.files.length > 0) { - const file = e.target.files[0]; - if (isPicture(file)) { - decodeData(file).then((res) => { - if (res) { - textRef.current.value = res.data; - console.log(res.data) - dispatch(genQRInfo(res.data)) - } - }).catch(console.err); +
+ dispatch(genQRInfo(e.target.value))} + onKeyPress={(e) => { + if (e.key === 'Enter') { + dispatch(genQRInfo(e.target.value)); + e.target.blur(); } - } - }} - /> + }} + /> + + e.target.value = null} + onChange={(e) => { + if (e.target.files.length > 0) { + const file = e.target.files[0]; + if (isPicture(file)) { + decodeData(file).then((res) => { + if (res) { + textRef.current.value = res.data; + console.log(res.data) + dispatch(genQRInfo(res.data)) + } + }).catch(console.err); + } + } + }} + /> +
); }