Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redirect by UA #194

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 62 additions & 55 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)?',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该是竖屏吗

success: (res) => {
if (res.confirm) {
// redirect to https://hinghwa.cn
mob2pc();
}
},
});
}
}
this.globalData.platform = e.platform;
this.globalData.StatusBar = e.statusBarHeight;
Expand Down Expand Up @@ -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;
}
</style>