Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Community-Mining-Admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mining
Community-Mining-Admin
Commits
a854cd25
Commit
a854cd25
authored
Dec 21, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:移动端适配
parent
beaf62d3
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
145 additions
and
16 deletions
+145
-16
Header.vue
src/layout/Header.vue
+39
-8
Nav.vue
src/layout/Nav.vue
+43
-3
index.vue
src/layout/index.vue
+31
-4
main.ts
src/main.ts
+2
-1
element.css
src/style/element.css
+8
-0
utils.ts
src/utils/utils.ts
+11
-0
Home.vue
src/views/Home.vue
+11
-0
No files found.
src/layout/Header.vue
View file @
a854cd25
<
template
>
<
template
>
<div
class=
"header"
>
<div
class=
"header"
>
<div
class=
"header-bar"
>
<div
class=
"header-bar"
>
<div
class=
"header-l"
>
票池管理后台
</div>
<div
class=
"header-l"
>
<i
class=
"el-icon-s-fold show-icon"
@
click=
"$emit('update:show', !show)"
/>
<span
class=
"show-title"
>
票池管理后台
</span>
</div>
<div
class=
"header-r"
>
<div
class=
"header-r"
>
<el-popover
<el-popover
placement=
"bottom"
placement=
"bottom"
...
@@ -28,6 +31,11 @@ export default Vue.extend({
...
@@ -28,6 +31,11 @@ export default Vue.extend({
admin
:
''
admin
:
''
}
}
},
},
props
:
{
show
:
{
type
:
Boolean
}
},
methods
:
{
methods
:
{
logout
()
{
logout
()
{
// logout().then(res => {
// logout().then(res => {
...
@@ -46,11 +54,33 @@ export default Vue.extend({
...
@@ -46,11 +54,33 @@ export default Vue.extend({
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.header
{
@media
screen
and
(
min-width
:
769px
)
{
.header-bar
{
min-width
:
1200px
;
}
.show-icon
{
display
:
none
;
}
.show-title
{
display
:
block
;
}
}
@media
screen
and
(
max-width
:
768px
)
{
.header-bar
{
width
:
100%
;
}
.show-icon
{
display
:
block
;
font-size
:
22px
;
}
.show-title
{
display
:
none
;
}
}
.header
{
width
:
100%
;
width
:
100%
;
height
:
var
(
--
headerHeight
);
height
:
var
(
--
headerHeight
);
.header-bar
{
.header-bar
{
min-width
:
1200px
;
height
:
100%
;
height
:
100%
;
margin
:
auto
;
margin
:
auto
;
padding
:
0
35px
;
padding
:
0
35px
;
...
@@ -67,19 +97,19 @@ export default Vue.extend({
...
@@ -67,19 +97,19 @@ export default Vue.extend({
margin-right
:
12px
;
margin-right
:
12px
;
}
}
}
}
}
}
.popup-item
{
.popup-item
{
cursor
:
pointer
;
cursor
:
pointer
;
&
:hover
{
&
:hover
{
color
:
#4d7afa
;
color
:
#4d7afa
;
}
}
}
}
.right-item
{
.right-item
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
cursor
:
pointer
;
cursor
:
pointer
;
&
>
p
{
&
>
p
{
margin-left
:
12px
;
margin-left
:
12px
;
}
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/layout/Nav.vue
View file @
a854cd25
<
template
>
<
template
>
<div
class=
"menu"
>
<transition
name=
"slide"
>
<div
class=
"menu"
:class=
"
{ 'mobile-menu' :isMobile }" v-show="show">
<el-menu
<el-menu
class=
"el-menu-vertical-demo"
class=
"el-menu-vertical-demo"
background-color=
"#333B54"
background-color=
"#333B54"
text-color=
"#fff"
text-color=
"#fff"
active-text-color=
"#409EFF"
active-text-color=
"#409EFF"
router
router
:default-active=
"defaultActive"
>
:default-active=
"defaultActive"
@
select=
"handleSelect"
>
<template
v-for=
"(items, index) in menu"
>
<template
v-for=
"(items, index) in menu"
>
<el-submenu
:index=
"items.url"
v-if=
"items.list"
:key=
"index"
>
<el-submenu
:index=
"items.url"
v-if=
"items.list"
:key=
"index"
>
<template
slot=
"title"
>
<template
slot=
"title"
>
...
@@ -36,13 +38,21 @@
...
@@ -36,13 +38,21 @@
</template>
</template>
</el-menu>
</el-menu>
</div>
</div>
</transition>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
Vue
from
'vue'
import
menu
from
'@/utils/menu'
import
menu
from
'@/utils/menu'
import
{
getStorage
}
from
'@/utils/storage'
import
{
getStorage
}
from
'@/utils/storage'
import
{
judgeUserAgent
}
from
'@/utils/utils'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
props
:
{
show
:
{
type
:
Boolean
,
default
:
true
}
},
data
()
{
data
()
{
return
{
return
{
menu
:
[]
as
any
,
menu
:
[]
as
any
,
...
@@ -50,6 +60,19 @@ export default Vue.extend({
...
@@ -50,6 +60,19 @@ export default Vue.extend({
type
:
1
type
:
1
}
}
},
},
computed
:
{
isMobile
()
{
return
judgeUserAgent
()
}
},
methods
:
{
handleSelect
()
{
const
isTriggle
=
judgeUserAgent
()
if
(
isTriggle
)
{
this
.
$emit
(
'update:show'
,
!
this
.
show
)
}
}
},
created
()
{
created
()
{
const
name
=
JSON
.
parse
(
getStorage
(
'user'
)
as
string
)?.
name
const
name
=
JSON
.
parse
(
getStorage
(
'user'
)
as
string
)?.
name
this
.
defaultActive
=
this
.
$route
.
path
as
string
this
.
defaultActive
=
this
.
$route
.
path
as
string
...
@@ -65,9 +88,25 @@ export default Vue.extend({
...
@@ -65,9 +88,25 @@ export default Vue.extend({
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
background
:
#333B54
;
background
:
#333B54
;
flex-shrink
:
0
;
flex-shrink
:
0
;
text-align
:
left
text-align
:
left
;
}
}
/
deep
/
.el-menu
{
/
deep
/
.el-menu
{
border-right
:
none
;
border-right
:
none
;
}
}
.mobile-menu
{
position
:
absolute
;
z-index
:
100
;
}
.slide-enter-active
,
.slide-leave-active
{
transition
:
0
.5s
;
transform
:
translate3d
(
0
,
0
,
0
);
}
.slide-enter
,
.slide-leave-to
/*
.slide-leave-active
below
version
2
.1.8
*/
{
// opacity: 0;
transform
:
translate3d
(
-200px
,
0
,
0
);
}
</
style
>
</
style
>
\ No newline at end of file
src/layout/index.vue
View file @
a854cd25
<
template
>
<
template
>
<div
class=
"layout"
>
<div
class=
"layout"
>
<Header
/>
<Header
:show
.
sync=
"showMenu"
/>
<div
class=
"content"
>
<div
class=
"content"
>
<Nav
/>
<Nav
:show
.
sync=
"showMenu"
/>
<div
class=
"content-r"
>
<div
class=
"content-r"
>
<Breadcrumb
/>
<Breadcrumb
/>
<router-view></router-view>
<router-view></router-view>
...
@@ -16,22 +16,31 @@ import Vue from 'vue'
...
@@ -16,22 +16,31 @@ import Vue from 'vue'
import
Header
from
'./Header.vue'
import
Header
from
'./Header.vue'
import
Nav
from
'./Nav.vue'
import
Nav
from
'./Nav.vue'
import
Breadcrumb
from
'@/components/Breadcrumb.vue'
import
Breadcrumb
from
'@/components/Breadcrumb.vue'
import
{
judgeUserAgent
}
from
'@/utils/utils'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
components
:
{
components
:
{
Header
,
Header
,
Nav
,
Nav
,
Breadcrumb
Breadcrumb
},
},
data
()
{
return
{
showMenu
:
true
}
},
created
()
{
this
.
showMenu
=
!
judgeUserAgent
()
}
})
})
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@media
screen
and
(
min-width
:
769px
)
{
.content
{
.content
{
min-width
:
1200px
;
min-width
:
1200px
;
display
:
flex
;
display
:
flex
;
.content-r
{
.content-r
{
width
:
calc
(
100%
-
200px
);
width
:
calc
(
100%
-
var
(
--
navWidth
)
);
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
padding
:
20px
40px
;
padding
:
20px
40px
;
overflow-x
:
hidden
;
overflow-x
:
hidden
;
...
@@ -40,4 +49,21 @@ export default Vue.extend({
...
@@ -40,4 +49,21 @@ export default Vue.extend({
flex-direction
:
column
;
flex-direction
:
column
;
}
}
}
}
}
@media
screen
and
(
max-width
:
768px
)
{
.content
{
width
:
100%
;
display
:
flex
;
.content-r
{
width
:
100%
;
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
padding
:
20px
14px
;
overflow-x
:
hidden
;
font-size
:
14px
;
display
:
flex
;
flex-direction
:
column
;
}
}
}
</
style
>
</
style
>
\ No newline at end of file
src/main.ts
View file @
a854cd25
...
@@ -4,8 +4,9 @@ import './registerServiceWorker'
...
@@ -4,8 +4,9 @@ import './registerServiceWorker'
import
router
from
'./router'
import
router
from
'./router'
import
store
from
'./store'
import
store
from
'./store'
import
'@/style/common.css'
import
'@/style/common.css'
import
'@/utils/element'
import
'element-ui/lib/theme-chalk/index.css'
;
import
'element-ui/lib/theme-chalk/index.css'
;
import
'@/style/element.css'
import
'@/utils/element'
Vue
.
config
.
productionTip
=
false
Vue
.
config
.
productionTip
=
false
...
...
src/style/element.css
0 → 100644
View file @
a854cd25
.el-dialog
{
min-width
:
360px
;
}
.el-pagination
{
white-space
:
break-spaces
;
}
\ No newline at end of file
src/utils/utils.ts
View file @
a854cd25
...
@@ -5,3 +5,13 @@ export const getDateTime = function(s: string) {
...
@@ -5,3 +5,13 @@ export const getDateTime = function(s: string) {
const
str
=
Number
(
s
+
'000'
)
const
str
=
Number
(
s
+
'000'
)
return
dayjs
(
str
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
return
dayjs
(
str
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
}
/**
* false: PC, true: mobile
* @returns
*/
export
const
judgeUserAgent
=
():
boolean
=>
{
const
{
userAgent
}
=
window
.
navigator
const
REGEXP
=
/IOS|Mac|OS|iPhone|Android/g
return
REGEXP
.
test
(
userAgent
)
}
\ No newline at end of file
src/views/Home.vue
View file @
a854cd25
...
@@ -81,4 +81,15 @@ export default Vue.extend({
...
@@ -81,4 +81,15 @@ export default Vue.extend({
}
}
}
}
}
}
@media
screen
and
(
max-width
:
768px
)
{
.statics-line
{
flex-direction
:
column
;
.statics-block
{
margin-bottom
:
55px
;
&
:last-of-type
{
margin-bottom
:
0
;
}
}
}
}
</
style
>
</
style
>
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