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
58c5970b
Commit
58c5970b
authored
Feb 14, 2020
by
yanju
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改动态分类获取
parent
dd81f5ec
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
240 additions
and
61 deletions
+240
-61
action/config.js
+1
-0
components/pc/pageHeader.vue
+1
-1
components/pc/pagination.vue
+5
-12
components/pc/socialContactCard.vue
+30
-25
pages/dynamic/index.vue
+203
-23
No files found.
action/config.js
View file @
58c5970b
...
@@ -16,6 +16,7 @@ export default {
...
@@ -16,6 +16,7 @@ export default {
myList
:
'/api/my/posts'
,
//我的动态列表
myList
:
'/api/my/posts'
,
//我的动态列表
list
:
'/api/posts'
,
//动态列表
list
:
'/api/posts'
,
//动态列表
otherList
:
'/api/user/'
,
//别人的动态列表 +{userId}/posts
otherList
:
'/api/user/'
,
//别人的动态列表 +{userId}/posts
following
:
'/api/posts/followed'
,
//获取我关注的人的动态
},
},
PostComment
:{
PostComment
:{
list
:
'/api/post/'
,
//获取动态评论 +{postId}/comments
list
:
'/api/post/'
,
//获取动态评论 +{postId}/comments
...
...
components/pc/pageHeader.vue
View file @
58c5970b
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<span
:style=
"
{color:route==='blog'?'#00AAE6':'#666'}">博客
</span>
<span
:style=
"
{color:route==='blog'?'#00AAE6':'#666'}">博客
</span>
<div
class=
"abs-line"
v-if=
"route==='blog'"
></div>
<div
class=
"abs-line"
v-if=
"route==='blog'"
></div>
</nuxt-link>
</nuxt-link>
<nuxt-link
tag=
"li"
to=
"/dynamic"
>
<nuxt-link
tag=
"li"
to=
"/dynamic
?type=new
"
>
<span
tag=
"span"
to=
"/dynamic"
:style=
"
{color:route==='dynamic'?'#00AAE6':'#666'}">动态
</span>
<span
tag=
"span"
to=
"/dynamic"
:style=
"
{color:route==='dynamic'?'#00AAE6':'#666'}">动态
</span>
<div
class=
"abs-line"
v-if=
"route==='dynamic'"
></div>
<div
class=
"abs-line"
v-if=
"route==='dynamic'"
></div>
</nuxt-link>
</nuxt-link>
...
...
components/pc/pagination.vue
View file @
58c5970b
...
@@ -50,10 +50,6 @@
...
@@ -50,10 +50,6 @@
default
:
'over'
default
:
'over'
},
},
paginationReset
:{
type
:
Boolean
,
default
:
false
}
},
},
data
(){
data
(){
return
{
return
{
...
@@ -100,7 +96,10 @@
...
@@ -100,7 +96,10 @@
methods
:{
methods
:{
setCurrentPage
(
n
){
setCurrentPage
(
n
){
this
.
currentPage
=
n
;
this
.
currentPage
=
1
;
this
.
paginationState
=
'loading'
this
.
$emit
(
config
.
event
.
listenPageChange
,
1
)
},
},
getElementToPageTop
(
el
)
{
getElementToPageTop
(
el
)
{
...
@@ -110,7 +109,6 @@
...
@@ -110,7 +109,6 @@
return
el
.
offsetTop
return
el
.
offsetTop
},
},
//
scrollToGetNext
(){
scrollToGetNext
(){
if
(
process
.
browser
){
if
(
process
.
browser
){
document
.
addEventListener
(
'scroll'
,()
=>
{
document
.
addEventListener
(
'scroll'
,()
=>
{
...
@@ -118,16 +116,11 @@
...
@@ -118,16 +116,11 @@
let
pageConTop
=
this
.
getElementToPageTop
(
this
.
$refs
.
paginationCon
);
let
pageConTop
=
this
.
getElementToPageTop
(
this
.
$refs
.
paginationCon
);
let
scrollTop
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
;
let
scrollTop
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
;
let
screenTop
=
scrollTop
+
window
.
innerHeight
;
let
screenTop
=
scrollTop
+
window
.
innerHeight
;
if
(
screenTop
>=
pageConTop
&&
this
.
paginationState
===
'over'
&&!
this
.
paginationReset
)
{
if
(
screenTop
>=
pageConTop
&&
this
.
paginationState
===
'over'
)
{
if
(
this
.
currentPage
<
this
.
pages
)
{
if
(
this
.
currentPage
<
this
.
pages
)
{
this
.
currentPage
=
this
.
currentPage
+
1
;
this
.
currentPage
=
this
.
currentPage
+
1
;
}
}
}
}
else
if
(
screenTop
>=
pageConTop
&&
this
.
paginationState
===
'over'
&&
this
.
paginationReset
)
{
if
(
this
.
pages
>
1
)
{
this
.
currentPage
=
2
;
}
}
else
{
else
{
// this.paginationState = 'complete';
// this.paginationState = 'complete';
}
}
...
...
components/pc/socialContactCard.vue
View file @
58c5970b
...
@@ -185,31 +185,36 @@
...
@@ -185,31 +185,36 @@
}
}
},
},
handledContent
(){
handledContent
(){
let
content
=
this
.
content
===
null
?
''
:
this
.
content
;
return
this
.
content
;
let
indexArr
=
[];
// let indexArr = [];
let
html
=
``
;
// let html=``;
let
reg
=
/
(
#
([^
#
]
+
?)
#
)
/
;
// for (let i = 0; i
<
content
.
length
;
i
++
)
{
// let index = content.indexOf("#",i);
for
(
let
i
=
0
;
i
<
content
.
length
;
i
++
)
{
// if(index!==-1&&index===i){
let
index
=
content
.
indexOf
(
"#"
,
i
);
// indexArr.push(index)
if
(
index
!==-
1
&&
index
===
i
){
// }
indexArr
.
push
(
index
)
// }
}
// if(indexArr.length>1){
}
// for (let i = 0; i
<
indexArr
.
length
-
1
;
i
+=
2
)
{
if
(
indexArr
.
length
>
1
){
// let firstP = i>0?indexArr[i-1]+1:0;
for
(
let
i
=
0
;
i
<
indexArr
.
length
-
1
;
i
+=
2
)
{
// html = html +`${content.substring(firstP,indexArr[i])}
<
a
href
=
"/topic/detail/${content.substring(indexArr[i]+1,indexArr[i+1])}"
>
$
{
content
.
substring
(
indexArr
[
i
],
indexArr
[
i
+
1
]
+
1
)}
<
/a>
`
let
firstP
=
i
>
0
?
indexArr
[
i
-
1
]
+
1
:
0
;
// }
html
=
html
+
`
${
content
.
substring
(
firstP
,
indexArr
[
i
])}
<a href="/topic/detail/
${
content
.
substring
(
indexArr
[
i
]
+
1
,
indexArr
[
i
+
1
])}
">
${
content
.
substring
(
indexArr
[
i
],
indexArr
[
i
+
1
]
+
1
)}
</a>`
//
}
// if(indexArr.length%2!==0){
html
=
html
+
`
${
content
.
substring
(
indexArr
[
indexArr
.
length
-
1
]
+
1
)}
`
;
// html = html + `${ content.substring(indexArr[indexArr.length-1])}`;
return
html
//
// }else{
}
// html = html + `${ content.substring(indexArr[indexArr.length-1]+1)}`;
else
{
//
return
content
;
// }
}
// return html
//
// }
// else{
// return content;
// }
...
...
pages/dynamic/index.vue
View file @
58c5970b
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
></nav-wrap>
></nav-wrap>
</div>
</div>
<div
class=
"dynamic-container__center"
>
<div
class=
"dynamic-container__center"
>
<release-card
@
listenReleaseState=
"
dataGetDynamic(1
)"
></release-card>
<release-card
@
listenReleaseState=
"
restartPagination(
)"
></release-card>
<social-card
@
listenSocialCardState=
"
dataGetDynamic(1
)"
v-for=
"(val,index) in postList"
:key=
"val.postId"
:info=
"val"
></social-card>
<social-card
@
listenSocialCardState=
"
restartPagination(
)"
v-for=
"(val,index) in postList"
:key=
"val.postId"
:info=
"val"
></social-card>
<pagination
:paginationReset=
"paginationReset
"
:paginationState=
"paginationState"
:type=
"2"
key=
"container5"
style=
"margin:20px auto;"
:pages=
"pages"
v-on:listenPageChange=
"changePage"
></pagination>
<pagination
ref=
"pagination
"
:paginationState=
"paginationState"
:type=
"2"
key=
"container5"
style=
"margin:20px auto;"
:pages=
"pages"
v-on:listenPageChange=
"changePage"
></pagination>
</div>
</div>
<div
class=
"dynamic-container__right"
>
<div
class=
"dynamic-container__right"
>
...
@@ -42,50 +42,49 @@
...
@@ -42,50 +42,49 @@
return
{
return
{
list
:
[
list
:
[
{
{
label
:
'
推荐
'
,
label
:
'
最新
'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
推荐
'
type
:
'
new
'
},
},
{
{
label
:
'热门'
,
label
:
'热门'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
热门
'
type
:
'
hot
'
},
},
{
{
label
:
'关注'
,
label
:
'关注'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
关注
'
type
:
'
following
'
},
},
{
{
label
:
'我的'
,
label
:
'我的'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
我的
'
type
:
'
my
'
},
},
{
{
label
:
'文字'
,
label
:
'文字'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
文字
'
type
:
'
word
'
},
},
{
{
label
:
'视频'
,
label
:
'视频'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
视频
'
type
:
'
video
'
},
},
{
{
label
:
'图片'
,
label
:
'图片'
,
address
:
'/dynamic'
,
address
:
'/dynamic'
,
type
:
'
图片
'
type
:
'
picture
'
}
}
],
],
postList
:[],
postList
:[],
pages
:
1
,
pages
:
1
,
paginationState
:
'complate'
,
paginationState
:
'complate'
,
paginationReset
:
true
,
topicList
:[],
topicList
:[],
}
}
},
},
...
@@ -94,18 +93,25 @@
...
@@ -94,18 +93,25 @@
},
},
created
()
{
created
()
{
this
.
$router
.
replace
({
path
:
'/dynamic'
,
query
:
{
type
:
'推荐'
}
});
this
.
dataGetHotTopic
();
this
.
dataGetHotTopic
();
},
},
watch
:{
$route
(){
this
.
restartPagination
();
}
},
methods
:{
methods
:{
dataGetDynamic
(
currentPage
){
restartPagination
(){
this
.
postList
=
[];
this
.
pages
=
1
;
if
(
process
.
browser
){
this
.
$refs
.
pagination
.
setCurrentPage
(
1
)
}
},
dataGetNewDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
list
,{
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
list
,{
...
@@ -118,19 +124,167 @@
...
@@ -118,19 +124,167 @@
if
(
currentPage
===
1
){
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
this
.
pages
=
response
.
data
.
totalPage
;
this
.
paginationReset
=
true
;
}
else
{
}
else
{
let
list
=
response
.
data
.
dataList
;
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
this
.
postList
.
push
(
list
[
i
]);
}
}
this
.
paginationReset
=
false
;
this
.
pages
=
response
.
data
.
totalPage
;
this
.
pages
=
response
.
data
.
totalPage
;
}
}
})
})
},
},
dataGetHotDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
list
,{
params
:{
page
:
currentPage
,
size
:
10
}
}).
then
((
response
)
=>
{
this
.
paginationState
=
'over'
;
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
}
this
.
pages
=
response
.
data
.
totalPage
;
}
})
},
dataGetFollowDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
following
,{
params
:{
page
:
currentPage
,
size
:
10
}
}).
then
((
response
)
=>
{
this
.
paginationState
=
'over'
;
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
}
this
.
pages
=
response
.
data
.
totalPage
;
}
})
},
dataGetMyDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
myList
,{
params
:{
page
:
currentPage
,
size
:
10
}
}).
then
((
response
)
=>
{
this
.
paginationState
=
'over'
;
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
}
this
.
pages
=
response
.
data
.
totalPage
;
}
})
},
dataGetWordDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
list
,{
params
:{
page
:
currentPage
,
size
:
10
,
type
:
0
}
}).
then
((
response
)
=>
{
this
.
paginationState
=
'over'
;
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
}
this
.
pages
=
response
.
data
.
totalPage
;
}
})
},
dataGetVideoDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
list
,{
params
:{
page
:
currentPage
,
size
:
10
,
type
:
1
}
}).
then
((
response
)
=>
{
this
.
paginationState
=
'over'
;
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
}
this
.
pages
=
response
.
data
.
totalPage
;
}
})
},
dataGetPictureDynamic
(
currentPage
){
this
.
paginationState
=
'loading'
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Post
.
list
,{
params
:{
page
:
currentPage
,
size
:
10
,
type
:
2
}
}).
then
((
response
)
=>
{
this
.
paginationState
=
'over'
;
if
(
currentPage
===
1
){
this
.
postList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
let
list
=
response
.
data
.
dataList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
){
this
.
postList
.
push
(
list
[
i
]);
}
this
.
pages
=
response
.
data
.
totalPage
;
}
})
},
dataGetHotTopic
(){
dataGetHotTopic
(){
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
hotSearch
,{
this
.
$axios
.
$get
(
config
.
api
.
get
.
Topic
.
hotSearch
,{
...
@@ -145,7 +299,33 @@
...
@@ -145,7 +299,33 @@
changePage
(
currentPage
){
changePage
(
currentPage
){
//返回页数 请求新的数据
//返回页数 请求新的数据
this
.
dataGetDynamic
(
currentPage
);
let
type
=
this
.
$route
.
query
.
type
;
if
(
type
===
'new'
){
this
.
dataGetNewDynamic
(
currentPage
);
}
if
(
type
===
'hot'
){
this
.
dataGetHotDynamic
(
currentPage
);
}
if
(
type
===
'following'
){
this
.
dataGetFollowDynamic
(
currentPage
);
}
if
(
type
===
'my'
){
this
.
dataGetMyDynamic
(
currentPage
);
}
if
(
type
===
'word'
){
this
.
dataGetWordDynamic
(
currentPage
);
}
if
(
type
===
'video'
){
this
.
dataGetPictureDynamic
(
currentPage
);
}
if
(
type
===
'picture'
){
this
.
dataGetVideoDynamic
(
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