Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds-front
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
beyond-clouds-front
Commits
3fde1fac
Commit
3fde1fac
authored
Feb 16, 2020
by
高浩杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
话题页面对接完成
parent
6b7935ba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
9 deletions
+64
-9
action/config.js
+1
-1
components/pc/alertsMessage/alertsCard.vue
+1
-1
pages/topic/index.vue
+62
-7
No files found.
action/config.js
View file @
3fde1fac
...
...
@@ -77,7 +77,7 @@ export default {
search
:
'/api/topic/search'
,
//检索话题
list
:
'/api/topics'
,
//话题列表
postList
:
'/api/topic/'
,
//获取话题下的所有动态 +{topicName}/posts
hotList
:
'/api/topic/hots'
,
//获取热门
动态
hotList
:
'/api/topic/hots'
,
//获取热门
话题
hotSearch
:
'/api/topic/hotSearch'
,
//获取热搜话题
recommendsPost
:
'/api/topic/'
,
//获取话题下的推荐动态 +{topicName}/post/recommends
contributes
:
'/api/topic/'
,
//话题贡献榜 +{topicId}/contributes
...
...
components/pc/alertsMessage/alertsCard.vue
View file @
3fde1fac
...
...
@@ -15,7 +15,7 @@
v-if="reload"
>
</alerts-content>
</div>
<div
class=
"alerts-card__footer"
v-if=
"false"
>
<div
class=
"alerts-card__footer"
>
<nuxt-link
to=
"/personal-center/message"
>
查看全部 (
{{
unread
}}
)
</nuxt-link>
</div>
</div>
...
...
pages/topic/index.vue
View file @
3fde1fac
...
...
@@ -12,10 +12,12 @@
width=
"816px"
:title=
"labelTitle"
>
<!--
<empty-card
v-if=
"topicList.length === 0"
height=
"556px"
></empty-card>
-->
<topic-card
v-for=
"(val,index) in topicList"
:key=
"val.topicId"
:info=
"val"
></topic-card>
</card-container>
<div
class=
"pagination"
>
<pagination
style=
"margin: 0 auto;"
:pages=
"pages"
v-on:listenPageChange=
"changePage"
></pagination>
<pagination
style=
"margin: 0 auto;"
ref=
"pagination"
:pages=
"pages"
v-on:listenPageChange=
"changePage"
></pagination>
</div>
</div>
<div
class=
"topic-container__right"
>
...
...
@@ -42,9 +44,10 @@ import CardContainer from "../../components/pc/cardContainer";
import
Pagination
from
"../../components/pc/pagination"
;
import
TopicCard
from
"../../components/pc/topicCard"
;
import
config
from
'../../action/config'
;
import
EmptyCard
from
"../../components/pc/emptyCard"
;
export
default
{
components
:
{
TopicCard
,
Pagination
,
CardContainer
,
NavWrap
},
components
:
{
EmptyCard
,
TopicCard
,
Pagination
,
CardContainer
,
NavWrap
},
data
(){
return
{
list
:
[
...
...
@@ -70,7 +73,6 @@ export default {
}
],
topicList
:[],
currentPage
:
1
,
pages
:
1
,
hotTopicList
:[],
}
...
...
@@ -84,19 +86,20 @@ export default {
});
this
.
dataGetHotTopic
();
},
computed
:
{
labelTitle
:
function
()
{
return
this
.
$route
.
query
.
type
+
'话题'
}
},
mounted
(){
watch
:
{
$route
:
function
(
val
)
{
this
.
restartPagination
();
}
},
methods
:{
// 最新的话题列表
dataGetTopicList
(
currentPage
){
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
list
,{
params
:{
page
:
currentPage
,
...
...
@@ -108,6 +111,45 @@ export default {
})
},
// 推荐话题
dataGetRecommendTopicList
(
currentPage
){
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
hotSearch
,{
params
:{
page
:
currentPage
,
size
:
10
}
}).
then
((
response
)
=>
{
this
.
topicList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
})
},
// 关注的话题
dataGetFollowedTopicList
(
currentPage
)
{
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
myfollowedList
,{
params
:{
page
:
currentPage
,
size
:
10
}
}).
then
((
response
)
=>
{
this
.
topicList
=
response
.
data
.
records
;
this
.
topicList
.
forEach
(
item
=>
{
item
.
followedTopic
=
item
.
userId
!==
this
.
$store
.
state
.
userProfile
.
userId
;
});
this
.
pages
=
response
.
data
.
pages
;
})
},
// 热门话题
dataGetHotTopicList
(
currentPage
)
{
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
hotList
,{
params
:{
page
:
currentPage
,
size
:
10
}
}).
then
((
response
)
=>
{
this
.
topicList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
})
},
dataGetHotTopic
(){
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
hotSearch
,{
...
...
@@ -119,9 +161,22 @@ export default {
this
.
hotTopicList
=
response
.
data
.
dataList
;
})
},
restartPagination
(){
if
(
process
.
browser
){
this
.
$refs
.
pagination
.
setCurrentPage
(
1
)
}
},
changePage
(
currentPage
){
//返回页数 请求新的数据
if
(
this
.
$route
.
query
.
type
===
'最新'
)
{
this
.
dataGetTopicList
(
currentPage
);
}
else
if
(
this
.
$route
.
query
.
type
===
'热门'
)
{
this
.
dataGetHotTopicList
(
currentPage
);
}
else
if
(
this
.
$route
.
query
.
type
===
'关注'
)
{
this
.
dataGetFollowedTopicList
(
currentPage
);
}
else
if
(
this
.
$route
.
query
.
type
===
'推荐'
)
{
this
.
dataGetRecommendTopicList
(
currentPage
);
}
}
},
}
...
...
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