From 6807a5e5692fc7d17fe865f553e5f699b670ed0f Mon Sep 17 00:00:00 2001 From: sheeplin <1270610465@qq.com> Date: Tue, 12 Dec 2023 12:30:12 +0800 Subject: [PATCH 1/2] fix: redirect by UA --- src/App.vue | 117 ++++++++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/src/App.vue b/src/App.vue index 21c7b7f6..e310e2aa 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,17 +11,23 @@ export default { uni.getSystemInfo({ success: async (e) => { // if widescreen device redirect to widescreen page - if (uni.getSystemInfoSync().uniPlatform === 'web' && e.screenWidth / e.screenHeight > 0.5625 && e.screenWidth > 400) { - uni.showModal({ - title: '提示', - content: '本页面为竖屏页面,是否跳转到 web 版本(https://hinghwa.cn)?', - success: (res) => { - if (res.confirm) { - // redirect to https://hinghwa.cn - mob2pc(); - } - }, - }); + if (uni.getSystemInfoSync().uniPlatform === 'web') { + // UA check + if (navigator.userAgent.indexOf('Mobile') === -1) { + // redirect to https://hinghwa.cn + mob2pc(); + } else if (e.screenWidth / e.screenHeight > 1.5) { + uni.showModal({ + title: '提示', + content: '本页面为横屏页面,是否跳转到 web 版本(https://hinghwa.cn)?', + success: (res) => { + if (res.confirm) { + // redirect to https://hinghwa.cn + mob2pc(); + } + }, + }); + } } this.globalData.platform = e.platform; this.globalData.StatusBar = e.statusBarHeight; @@ -66,89 +72,90 @@ export default { @import 'colorui/main.css'; @import 'colorui/icon.css'; @import '@/utils/u-parse/u-parse.css'; + page { - background-color: #f7f7f7; + background-color: #f7f7f7; } .scrollPage { - height: 100vh; + height: 100vh; } .layout-index { - position: absolute; - top: 45%; - width: 100vw; + position: absolute; + top: 45%; + width: 100vw; } .layout-index-login { - position: absolute; - top: 33%; - width: 100vw; + position: absolute; + top: 33%; + width: 100vw; } .index-card { - background-color: #ffffff; - padding: 30rpx 30rpx; - border-radius: 20rpx; - margin: 5vw; + background-color: #ffffff; + padding: 30rpx 30rpx; + border-radius: 20rpx; + margin: 5vw; } .card-name { - color: #115e83; - font-size: 36rpx; - font-weight: 700; + color: #115e83; + font-size: 36rpx; + font-weight: 700; } .card-slogan { - color: black; - margin-top: 10rpx; - font-size: 32rpx; - font-weight: 300; + color: black; + margin-top: 10rpx; + font-size: 32rpx; + font-weight: 300; } .card-btn { - position: absolute; - right: 10vw; - top: 6vh; - font-size: 26rpx; + position: absolute; + right: 10vw; + top: 6vh; + font-size: 26rpx; } .index-word { - background-color: #ffffff; - border-radius: 20rpx; - height: 25vh; - margin: 5vw; + background-color: #ffffff; + border-radius: 20rpx; + height: 25vh; + margin: 5vw; } .word-sy { - display: -webkit-box; - word-break: break-all; - -webkit-box-orient: vertical; - -webkit-line-clamp: 7; - overflow: hidden; - text-overflow: ellipsis; + display: -webkit-box; + word-break: break-all; + -webkit-box-orient: vertical; + -webkit-line-clamp: 7; + overflow: hidden; + text-overflow: ellipsis; } .index-search { - background-color: #ffffff; - border-radius: 20rpx; - margin: 5vw; + background-color: #ffffff; + border-radius: 20rpx; + margin: 5vw; } .stand-view { - height: 10vh; + height: 10vh; } .login-input { - background-color: #f2f3f7; - border-radius: 5000rpx; - display: flex; - margin: 30rpx 60rpx; - padding: 20rpx; + background-color: #f2f3f7; + border-radius: 5000rpx; + display: flex; + margin: 30rpx 60rpx; + padding: 20rpx; } .btn { - margin: 10vh auto; - background-color: white; + margin: 10vh auto; + background-color: white; } From bcc47bbeb5d908cc9995711cae8df2c68ee2989d Mon Sep 17 00:00:00 2001 From: sheeplin <1270610465@qq.com> Date: Tue, 12 Dec 2023 23:08:11 +0800 Subject: [PATCH 2/2] refactor: change tips --- src/App.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index e310e2aa..c1ec10b7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,10 +16,10 @@ export default { if (navigator.userAgent.indexOf('Mobile') === -1) { // redirect to https://hinghwa.cn mob2pc(); - } else if (e.screenWidth / e.screenHeight > 1.5) { + } else if (e.screenWidth > e.screenHeight) { uni.showModal({ title: '提示', - content: '本页面为横屏页面,是否跳转到 web 版本(https://hinghwa.cn)?', + content: '是否跳转到 web 版本(https://hinghwa.cn)?', success: (res) => { if (res.confirm) { // redirect to https://hinghwa.cn