Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
techbook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
front-end-dev
techbook
Commits
c6f6688b
Commit
c6f6688b
authored
Jul 08, 2020
by
zhangyanni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
试一下首页适配
parent
db90fcda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
main.js
src/main.js
+18
-8
No files found.
src/main.js
View file @
c6f6688b
...
...
@@ -20,14 +20,16 @@ Vue.use(vuePreview, {
var
u
=
navigator
.
userAgent
,
ucFlag
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Linux'
)
>
-
1
;
let
flag
=
navigator
.
userAgent
.
match
(
/
(
phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|MicroMessenger|miniProgram|webview|wechatdevtools|MacWechat NetType
)
/i
);
// 手机
if
(
window
.
innerWidth
>=
1000
){
document
.
getElementsByTagName
(
"html"
)[
0
].
style
.
minWidth
=
"1300px"
;
document
.
getElementsByTagName
(
"body"
)[
0
].
style
.
minWidth
=
"1300px"
;
}
if
(
flag
||
ucFlag
||
window
.
innerWidth
<
980
)
{
//
if(window.innerWidth>=1000){
//
document.getElementsByTagName("html")[0].style.minWidth = "1300px";
//
document.getElementsByTagName("body")[0].style.minWidth = "1300px";
//
}
if
(
flag
||
ucFlag
||
/Android|webOS|iPhone|iPod|BlackBerry/i
.
test
(
navigator
.
userAgent
)
&&
navigator
.
userAgent
.
toLowerCase
().
match
(
/MicroMessenger/i
)
==
'micromessenger'
)
{
require
(
'../public/css/phone.scss'
);
}
else
{
require
(
'../public/css/pc.scss'
)
require
(
'../public/css/pc.scss'
);
document
.
getElementsByTagName
(
"html"
)[
0
].
style
.
minWidth
=
"1300px"
;
document
.
getElementsByTagName
(
"body"
)[
0
].
style
.
minWidth
=
"1300px"
;
}
import
Element
,
{
Message
}
from
'element-ui'
import
Mintui
from
'mint-ui'
;
...
...
@@ -171,10 +173,18 @@ router.beforeEach((to, from, next) => {
if
(
i18n
.
locale
==
"zh-CN"
)
router
.
push
({
path
:
'/mobileRegisterCmpt'
,
query
:
to
.
query
});
}
if
(
to
.
name
==
"dashboard"
){
if
(
window
.
innerWidth
<=
950
)
router
.
replace
(
'/index'
);
// if(window.innerWidth<=950) router.replace('/index');
if
(
/Android|webOS|iPhone|iPod|BlackBerry/i
.
test
(
navigator
.
userAgent
)
&&
navigator
.
userAgent
.
toLowerCase
().
match
(
/MicroMessenger/i
)
==
'micromessenger'
)
router
.
replace
(
'/index'
);
else
{
alert
(
1
)
}
}
if
(
to
.
name
==
"mobileIndex"
){
if
(
window
.
innerWidth
>
950
)
router
.
push
(
'/'
);
// if(window.innerWidth>950) router.push('/');
if
(
!
(
/Android|webOS|iPhone|iPod|BlackBerry/i
.
test
(
navigator
.
userAgent
)
&&
navigator
.
userAgent
.
toLowerCase
().
match
(
/MicroMessenger/i
)
==
'micromessenger'
))
router
.
push
(
'/'
);
else
{
alert
(
2
)
}
}
if
(
to
.
name
==
"mobileLogin"
)
{
if
(
i18n
.
locale
==
"zh-CN"
)
router
.
push
({
path
:
'/loginByPhone'
,
query
:
to
.
query
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment