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
c351cdb7
Commit
c351cdb7
authored
Feb 22, 2020
by
yanju
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'new-func#1' into 'master'
列表页服务端渲染 See merge request pigbigbig/beyond-clouds-front!106
parents
5d9f1511
9449ed17
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
12 deletions
+64
-12
pages/answer/index.vue
+25
-5
pages/blog/index.vue
+19
-1
pages/project/index.vue
+20
-6
No files found.
pages/answer/index.vue
View file @
c351cdb7
...
@@ -70,6 +70,19 @@ import config from "../../action/config";
...
@@ -70,6 +70,19 @@ import config from "../../action/config";
import
EmptyCard
from
'../../components/pc/emptyCard'
;
import
EmptyCard
from
'../../components/pc/emptyCard'
;
import
UserCard
from
'../../components/pc/userCard2'
;
import
UserCard
from
'../../components/pc/userCard2'
;
export
default
{
export
default
{
async
asyncData
({
$axios
}){
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
QuestionCategory
.
list
);
let
params
=
{
page
:
1
,
size
:
7
};
let
articleList
=
await
$axios
.
$get
(
config
.
api
.
get
.
Question
.
list
,{
params
:
params
});
return
{
articleList
:
articleList
.
data
.
dataList
,
articlePages
:
articleList
.
data
.
totalPage
,
typeList
:
typeList
.
data
}
},
components
:
{
AnswerCard
,
Pagination
,
ProjectCard
,
CardContainer
,
NavWrap
,
UserCard
,
EmptyCard
},
components
:
{
AnswerCard
,
Pagination
,
ProjectCard
,
CardContainer
,
NavWrap
,
UserCard
,
EmptyCard
},
data
(){
data
(){
return
{
return
{
...
@@ -84,12 +97,14 @@ export default {
...
@@ -84,12 +97,14 @@ export default {
QuestionList
:[],
QuestionList
:[],
labelTitle
:
''
,
labelTitle
:
''
,
repliersList
:[],
repliersList
:[],
firstLoad
:
true
}
}
},
},
created
()
{
created
()
{
this
.
getLabelTitle
();
this
.
getLabelTitle
();
this
.
dataGetQuestionCategory
();
this
.
dataGetQuestionCategory
();
this
.
dataGetHotRepliersList
();
this
.
dataGetHotRepliersList
();
this
.
handleArticleList
();
},
},
watch
:{
watch
:{
$route
(){
$route
(){
...
@@ -99,6 +114,11 @@ export default {
...
@@ -99,6 +114,11 @@ export default {
},
},
methods
:
{
methods
:
{
handleArticleList
(){
this
.
QuestionList
=
this
.
articleList
;
this
.
pages
=
this
.
articlePages
;
},
toRelease
(){
toRelease
(){
this
.
$router
.
push
(
'/answer/release'
);
this
.
$router
.
push
(
'/answer/release'
);
},
},
...
@@ -129,18 +149,14 @@ export default {
...
@@ -129,18 +149,14 @@ export default {
this
.
repliersList
=
response
.
data
.
dataList
;
this
.
repliersList
=
response
.
data
.
dataList
;
});
});
},
},
dataGetQuestionCategory
(){
dataGetQuestionCategory
(){
this
.
$axios
.
$get
(
config
.
api
.
get
.
QuestionCategory
.
list
).
then
((
response
)
=>
{
this
.
typeList
.
map
((
val
,
index
)
=>
{
response
.
data
.
map
((
val
,
index
)
=>
{
this
.
list
.
push
({
this
.
list
.
push
({
label
:
val
.
category
,
label
:
val
.
category
,
address
:
'/answer'
,
address
:
'/answer'
,
type
:
val
.
categoryId
type
:
val
.
categoryId
})
})
})
})
})
},
},
dataGetQuestionList
(
currentPage
){
dataGetQuestionList
(
currentPage
){
let
params
=
{
let
params
=
{
...
@@ -158,8 +174,12 @@ export default {
...
@@ -158,8 +174,12 @@ export default {
changePage
(
currentPage
){
changePage
(
currentPage
){
//返回页数 请求新的数据
//返回页数 请求新的数据
if
(
this
.
firstLoad
){
this
.
firstLoad
=
false
}
else
{
this
.
dataGetQuestionList
(
currentPage
)
this
.
dataGetQuestionList
(
currentPage
)
}
}
}
}
}
...
...
pages/blog/index.vue
View file @
c351cdb7
...
@@ -61,7 +61,13 @@ export default {
...
@@ -61,7 +61,13 @@ export default {
components
:
{
UserCard
,
EmptyCard
,
Pagination
,
CardContainer
,
NavWrap
,
BlogCard
},
components
:
{
UserCard
,
EmptyCard
,
Pagination
,
CardContainer
,
NavWrap
,
BlogCard
},
async
asyncData
({
$axios
}){
async
asyncData
({
$axios
}){
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
BlogCategory
.
list
);
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
BlogCategory
.
list
);
return
{
typeList
:
typeList
.
data
}
let
params
=
{
page
:
1
,
size
:
7
};
let
articleList
=
await
$axios
.
$get
(
config
.
api
.
get
.
Blog
.
list
,{
params
:
params
});
return
{
articleList
:
articleList
.
data
.
dataList
,
articlePages
:
articleList
.
data
.
totalPage
,
typeList
:
typeList
.
data
}
},
},
data
(){
data
(){
return
{
return
{
...
@@ -81,6 +87,8 @@ export default {
...
@@ -81,6 +87,8 @@ export default {
type
:
'all'
type
:
'all'
},
},
],
],
firstLoad
:
true
}
}
},
},
created
()
{
created
()
{
...
@@ -88,6 +96,7 @@ export default {
...
@@ -88,6 +96,7 @@ export default {
this
.
getLabelTitle
();
this
.
getLabelTitle
();
this
.
dataGetHotTagsList
();
this
.
dataGetHotTagsList
();
this
.
dataGetHotBloggersList
();
this
.
dataGetHotBloggersList
();
this
.
handleArticleList
();
},
},
watch
:
{
watch
:
{
$route
:
function
()
{
$route
:
function
()
{
...
@@ -96,6 +105,11 @@ export default {
...
@@ -96,6 +105,11 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
handleArticleList
(){
this
.
blogList
=
this
.
articleList
;
this
.
pages
=
this
.
articlePages
;
},
dataGetBlogCategory
(){
dataGetBlogCategory
(){
this
.
typeList
.
map
((
val
,
index
)
=>
{
this
.
typeList
.
map
((
val
,
index
)
=>
{
this
.
list
.
push
({
this
.
list
.
push
({
...
@@ -160,9 +174,13 @@ export default {
...
@@ -160,9 +174,13 @@ export default {
},
},
changePage
(
currentPage
){
changePage
(
currentPage
){
//返回页数 请求新的数据
//返回页数 请求新的数据
if
(
this
.
firstLoad
){
this
.
firstLoad
=
false
}
else
{
this
.
dataGetBlogList
(
currentPage
)
this
.
dataGetBlogList
(
currentPage
)
}
}
}
}
}
}
}
</
script
>
</
script
>
...
...
pages/project/index.vue
View file @
c351cdb7
...
@@ -53,7 +53,13 @@ export default {
...
@@ -53,7 +53,13 @@ export default {
async
asyncData
({
$axios
}){
async
asyncData
({
$axios
}){
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
ProjectCategory
.
list
);
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
ProjectCategory
.
list
);
return
{
typeList
:
typeList
.
data
}
let
params
=
{
page
:
1
,
size
:
7
};
let
articleList
=
await
$axios
.
$get
(
config
.
api
.
get
.
Project
.
list
,{
params
:
params
});
return
{
articleList
:
articleList
.
data
.
dataList
,
articlePages
:
articleList
.
data
.
totalPage
,
typeList
:
typeList
.
data
}
},
},
data
(){
data
(){
...
@@ -78,9 +84,6 @@ export default {
...
@@ -78,9 +84,6 @@ export default {
if
(
this
.
$route
.
query
.
type
){
if
(
this
.
$route
.
query
.
type
){
this
.
dataGetProjectCategory
();
this
.
dataGetHotProjectList
();
this
.
getLabelTitle
();
}
else
{
}
else
{
this
.
$router
.
replace
({
this
.
$router
.
replace
({
path
:
'/project'
,
path
:
'/project'
,
...
@@ -88,10 +91,12 @@ export default {
...
@@ -88,10 +91,12 @@ export default {
type
:
'all'
type
:
'all'
}
}
});
});
}
this
.
handleArticleList
();
this
.
dataGetProjectCategory
();
this
.
dataGetProjectCategory
();
this
.
dataGetHotProjectList
();
this
.
dataGetHotProjectList
();
this
.
getLabelTitle
();
this
.
getLabelTitle
();
}
},
},
...
@@ -104,6 +109,11 @@ export default {
...
@@ -104,6 +109,11 @@ export default {
},
},
methods
:
{
methods
:
{
handleArticleList
(){
this
.
projectList
=
this
.
articleList
;
this
.
pages
=
this
.
articlePages
;
},
toRelease
(){
toRelease
(){
this
.
$router
.
push
(
'/project/release'
)
this
.
$router
.
push
(
'/project/release'
)
},
},
...
@@ -156,7 +166,11 @@ export default {
...
@@ -156,7 +166,11 @@ export default {
},
},
changePage
(
currentPage
){
changePage
(
currentPage
){
//返回页数 请求新的数据
//返回页数 请求新的数据
this
.
dataGetProjectList
(
currentPage
);
if
(
this
.
firstLoad
){
this
.
firstLoad
=
false
}
else
{
this
.
dataGetProjectList
(
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