From 3f5b8ac05dd3d3bff7ebe38ca2abfb188b298f28 Mon Sep 17 00:00:00 2001 From: CareyWong Date: Sat, 28 Mar 2020 21:45:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AEUA=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=EF=BC=8C=E7=9F=AD=E9=93=BE=E6=8E=A5=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=90=8E=E8=87=AA=E5=8A=A8=E5=A4=8D=E5=88=B6=E5=88=B0?= =?UTF-8?q?=E5=89=AA=E8=B4=B4=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/favicon.ico | Bin 0 -> 1150 bytes public/index-m.html | 105 -------------------------------------------- public/index.html | 59 ++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 112 deletions(-) create mode 100644 public/favicon.ico delete mode 100644 public/index-m.html diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..062c4cec7d728f38089b9188e13aec9ef46dc8b3 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYI*xFHzK2NM5B0dXPl?;mmM zaH{(E|KG3gKv`6CetdlW|4@7Q{{zi||Mxfg{ohyb4a7eG_tt@EAa3yezq{J~|M|Ja z|34g>^Z)t6wExc+XZ?S*uKNGqA78+>9c&BxzdV@l|JFQ{|Jw@9fqK3E?<{xtzoXdt z|JHod|J#c!|8L6F{eNX`@Bcp!PW*q=Vf+8-%!vPge|`n)2f5+wyz>7CTZ8{!UEA~j z(u&sqXJ!}wKQ$x&|Cw1u|IaO`1oOA#82-PwqV4~a6=nZF9$N_UDKuRE{`&EMPqo|s z4aqA1w-uQG-;!+rrnlvr{oh__0e08cT%-R7+r$1pIkN+-_a9X6zrTOL{I_?`{lBqk zGSIG~|7+vq{)6lTnFG?dI!gTi#ifl9eIWJN;sYx7`^VS+M| - - - - - - MyUrls - - - - - - - - -
- - - -
- - - - - -
-
-
-
- - - - - - - \ No newline at end of file diff --git a/public/index.html b/public/index.html index c1b76b9..893f627 100644 --- a/public/index.html +++ b/public/index.html @@ -10,6 +10,7 @@ + @@ -17,13 +18,15 @@ -
+
- + + + + -
@@ -37,11 +40,19 @@ el: "#app", data() { return { + isPc: true, + loading: false, longUrl: '', shortUrl: '' } }, + created() { + const os = this.getOS() + if (os.isPc !== true) { + this.isPc = false + } + }, mounted() { this.$refs.long.focus() }, @@ -53,7 +64,7 @@ let re = new RegExp('http(s*)://[^\s]*') if (re.exec(this.longUrl) === null) { this.$message.warning('请输入正确格式的长链接') - return + return } this.loading = true @@ -68,6 +79,8 @@ .then(res => { if (res.data.Code === 1 && res.data.ShortUrl !== "") { this.shortUrl = res.data.ShortUrl; + this.$copyText(this.shortUrl) + this.$message.success("短链接已复制到剪贴板"); } else { this.$message.error("短链接获取失败:" + res.data.Message); } @@ -81,7 +94,31 @@ }, goToGayHub() { window.open(repo) - } + }, + getOS() { + let ua = navigator.userAgent, + isWindowsPhone = /(?:Windows Phone)/.test(ua), + isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone, + isAndroid = /(?:Android)/.test(ua), + isFireFox = /(?:Firefox)/.test(ua), + isChrome = /(?:Chrome|CriOS)/.test(ua), + isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)), + isPhone = /(?:iPhone)/.test(ua) && !isTablet, + isPc = !isPhone && !isAndroid && !isSymbian; + + return { + isTablet: isTablet, + isPhone: isPhone, + isAndroid: isAndroid, + isPc: isPc + }; + }, + getBodyClass() { + return this.isPc ? 'body-center body-width-pc' : 'body-center' + }, + onCopy() { + this.$message.success("Copied!"); + }, }, }) @@ -91,11 +128,19 @@ width: 40%; position: absolute; left: 50%; - top: 40%; + top: 30%; transform: translate(-50%, -50%); text-align: center; } + .body-width-pc { + width: 40%; + } + + .body-width-mb { + width: 90%; + } + .el-input { margin-top: 20px; }