Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-site
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
张冬
web-site
Commits
5642c073
Commit
5642c073
authored
Sep 18, 2020
by
吴冠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播图
parent
c007dd8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
21 deletions
+49
-21
list.js
common/list.js
+9
-0
index.vue
pages/index/index.vue
+15
-2
news.vue
pages/index/message/news.vue
+25
-19
No files found.
common/list.js
View file @
5642c073
...
@@ -157,4 +157,12 @@ export function getChangeDetails(id){
...
@@ -157,4 +157,12 @@ export function getChangeDetails(id){
url
:
`/notice/change/
${
id
}
`
,
url
:
`/notice/change/
${
id
}
`
,
method
:
'get'
,
method
:
'get'
,
})
})
}
//轮播图
export
function
getLoopPic
(
params
){
return
request
({
url
:
'/banner/list'
,
method
:
'get'
,
params
:
params
})
}
}
\ No newline at end of file
pages/index/index.vue
View file @
5642c073
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
<div
class=
"content flex"
>
<div
class=
"content flex"
>
<div
class=
"banner"
>
<div
class=
"banner"
>
<el-carousel
trigger=
"click"
height=
"5.41rem"
>
<el-carousel
trigger=
"click"
height=
"5.41rem"
>
<el-carousel-item
v-for=
"(item,index) in
4
"
:key=
"index"
>
<el-carousel-item
v-for=
"(item,index) in
picArr
"
:key=
"index"
>
<h3
class=
"small"
>
{{
item
}}
</h3>
<h3
class=
"small"
>
{{
item
.
picUrl
}}
</h3>
</el-carousel-item>
</el-carousel-item>
</el-carousel>
</el-carousel>
</div>
</div>
...
@@ -50,9 +50,22 @@
...
@@ -50,9 +50,22 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getLoopPic
}
from
'@/common/list.js'
export
default
{
export
default
{
created
(){
this
.
getLoopPic
()
},
methods
:{
async
getLoopPic
(){
let
message
=
{}
message
.
status
=
1
const
{
data
}
=
await
getLoopPic
(
message
)
this
.
picArr
=
data
}
},
data
()
{
data
()
{
return
{
return
{
picArr
:[],
messageList
:
[{
messageList
:
[{
head
:
"基地直供专区"
,
head
:
"基地直供专区"
,
src
:
"../assets/head/home-fill.png"
,
src
:
"../assets/head/home-fill.png"
,
...
...
pages/index/message/news.vue
View file @
5642c073
<
template
>
<
template
>
<div
class=
"message "
>
<div
class=
"message "
>
<div
class=
'sidebar'
>
<div
class=
'sidebar'
>
<div
class=
"sidebar-title"
>
信息公告
</div>
<div
class=
"sidebar-title"
>
信息公告
</div>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
...
@@ -12,16 +12,15 @@
...
@@ -12,16 +12,15 @@
</el-menu>
</el-menu>
</el-col>
</el-col>
</div>
</div>
<ul>
<ul
v-if=
"isList"
>
<li
v-for=
"item in messageList"
:key=
"item.id"
>
<li
v-for=
"item in messageList"
:key=
"item.id"
@
click=
"urlChage"
>
<!-- 怎么自动生成路由 并且实现组件跳转 -->
<nuxt-link
:to=
"`/messsage/news/newsdetails?id=$
{item.id}`" class="flex-between">
<nuxt-link
:to=
"`/notice/news/details?id=$
{item.id}`" class="flex-between">
<div
class=
"t2"
>
{{
item
.
title
}}
</div>
<div
class=
"t2"
>
{{
item
.
title
}}
</div>
<div
class=
"t1"
>
发布时间:
{{
item
.
createTime
}}
</div>
<div
class=
"t1"
>
发布时间:
{{
item
.
createTime
}}
</div>
</nuxt-link>
</nuxt-link>
</li>
</li>
</ul>
</ul>
<div
class=
"pagination flex-center"
>
<div
class=
"pagination flex-center"
v-if=
"isList"
>
<el-pagination
<el-pagination
@
size-change=
"handleSizeChange"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
...
@@ -31,6 +30,14 @@
...
@@ -31,6 +30,14 @@
:total=
"total"
>
:total=
"total"
>
</el-pagination
style="postion:relative;transform:translateX(-50%)"
>
</el-pagination
style="postion:relative;transform:translateX(-50%)"
>
</div>
</div>
<div
v-for=
"item in contentList"
:key=
"item.id"
class=
"content"
v-if=
"!isList"
>
<h1>
{{
item
.
title
}}
</h1>
<div
class=
"flex"
>
<span>
发布时间:
{{
createTime
}}
</span>
<span>
作者:
{{
item
.
author
}}
</span>
</div>
<div>
{{
item
.
content
}}
</div>
</div>
</div>
</div>
...
@@ -46,6 +53,10 @@ import {
...
@@ -46,6 +53,10 @@ import {
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
contentList
:
''
,
isList
:
true
,
activeName
:
'1'
,
conText
:
""
,
activeIndex
:
'1'
,
activeIndex
:
'1'
,
size
:
10
,
size
:
10
,
total
:
0
,
total
:
0
,
...
@@ -73,17 +84,17 @@ import {
...
@@ -73,17 +84,17 @@ import {
message
.
size
=
1
message
.
size
=
1
this
.
getListContent
(
message
)
this
.
getListContent
(
message
)
this
.
getCategoryList
()
this
.
getCategoryList
()
this
.
getCateList
()
this
.
getList
()
},
},
methods
:{
methods
:{
urlChage
(){
this
.
isList
=
!
this
.
isList
},
handleSelect
(
key
,
keyPath
)
{
handleSelect
(
key
,
keyPath
)
{
console
.
log
(
key
,
keyPath
)
console
.
log
(
key
,
keyPath
)
let
keyValue
=
key
.
slice
(
4
)
let
keyValue
=
key
.
slice
(
4
)
console
.
log
(
keyValue
)
console
.
log
(
keyValue
)
let
message
=
{}
let
message
=
{}
message
.
cateId
=
keyValue
message
.
cateId
=
keyValue
/* console.log(message,'-----------------------') */
this
.
getListContent
(
message
)
this
.
getListContent
(
message
)
},
},
//分类列表
//分类列表
...
@@ -93,18 +104,10 @@ import {
...
@@ -93,18 +104,10 @@ import {
},
},
//文章列表
//文章列表
async
getListContent
(
params
){
async
getListContent
(
params
){
const
{
data
}
=
await
getListContent
(
params
)
const
{
data
,
title
}
=
await
getListContent
(
params
)
this
.
messageList
=
data
this
.
messageList
=
data
this
.
contentList
=
data
},
},
/* //分类()
async getCateList(){
const {data} = await getCateList()
}, */
/* //查看文章
async getList(){
const {data} = await getList()
console.log(data)
}, */
handleSizeChange
(
val
)
{
handleSizeChange
(
val
)
{
this
.
getListContent
(
this
.
currentPage
,
val
)
this
.
getListContent
(
this
.
currentPage
,
val
)
},
},
...
@@ -162,6 +165,9 @@ import {
...
@@ -162,6 +165,9 @@ import {
.el-col-12
{
.el-col-12
{
width
:
100%
;
width
:
100%
;
}
}
.content
{
width
:
925px
}
</
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