Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds-frontM
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
云深项目组
beyond-clouds-frontM
Commits
1346d1a5
Commit
1346d1a5
authored
Mar 21, 2020
by
xuebiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成项目列表接口
parent
ed91c69d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
47 deletions
+129
-47
pages/answer/index.vue
+40
-36
pages/project/index.vue
+89
-11
No files found.
pages/answer/index.vue
View file @
1346d1a5
...
...
@@ -2,68 +2,72 @@
<yun-div>
<Nav
:path=
"path"
:nav-list=
"navList"
></Nav>
<answer-card></answer-card>
<answer-card></answer-card>
<answer-card></answer-card>
<answer-card></answer-card>
<answer-card></answer-card>
</yun-div>
</
template
>
<
script
>
import
Nav
from
"../../components/moblie/nav"
;
import
AnswerCard
from
"../../components/moblie/answerCard"
;
import
ScrollLoading
from
'../../components/moblie/scrollLoading'
;
import
config
from
"../../action/config"
;
export
default
{
components
:
{
AnswerCard
,
Nav
},
components
:
{
AnswerCard
,
Nav
,
ScrollLoading
},
async
asyncData
({
$axios
}){
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
QuestionCategory
.
list
);
return
{
typeList
:
typeList
.
data
}
},
data
()
{
return
{
path
:
'/answer'
,
navList
:
[
navList
:
[],
navList1
:
[
{
label
:
'全部问答'
,
id
:
'all'
},
],
navList2
:
[
{
label
:
'讨论'
,
id
:
'10'
},
{
label
:
'项目讨论'
,
id
:
'11'
},
{
label
:
'问题求助'
,
id
:
'12'
},
{
label
:
'技术交流'
,
id
:
'13'
},
{
label
:
'前端技术交流'
,
id
:
'14'
},
{
label
:
'前技术交流端'
,
id
:
'15'
label
:
'热门问答'
,
id
:
'hot'
},
{
label
:
'吃土少女技术交流'
,
id
:
'16'
}
]
],
}
},
created
()
{
if
(
this
.
$route
.
query
.
type
)
{
return
if
(
this
.
$route
.
query
.
type
===
'hot'
){
this
.
navList
=
this
.
navList2
;
this
.
$router
.
replace
({
path
:
'/blog'
,
query
:
{
type
:
'hot'
}
});
}
if
(
this
.
$route
.
query
.
type
){
this
.
navList
=
this
.
navList1
}
else
{
this
.
navList
=
this
.
navList1
;
this
.
$router
.
replace
({
path
:
'/answer
'
,
path
:
'/blog
'
,
query
:
{
type
:
'all'
}
});
}
this
.
dataGetQuestionCategory
()
},
methods
:{
dataGetQuestionCategory
(){
this
.
typeList
.
map
((
val
,
index
)
=>
{
this
.
navList1
.
push
({
label
:
val
.
category
,
id
:
val
.
categoryId
})
})
},
}
}
</
script
>
...
...
pages/project/index.vue
View file @
1346d1a5
<
template
>
<yun-div>
<Nav
:path=
"path"
:nav-list=
"navList"
></Nav>
<project-card
></project-card>
<project-card
></project-card>
<project-card
></project-card>
<project-card
></project-card>
<project-card
></project-card>
<project-card
v-for=
"(val,index) in projectList"
:info=
"val"
:key=
"val.projectId"
></project-card>
<scroll-loading
ref=
"pagination"
:pages=
"pages"
v-on:changePage=
"changePage"
></scroll-loading>
</yun-div>
</
template
>
...
...
@@ -16,6 +13,7 @@ import ScrollLoading from '../../components/moblie/scrollLoading';
import
config
from
"../../action/config"
;
export
default
{
components
:
{
ProjectCard
,
Nav
,
ScrollLoading
},
async
asyncData
({
$axios
}){
let
typeList
=
await
$axios
.
$get
(
config
.
api
.
get
.
ProjectCategory
.
list
);
return
{
typeList
:
typeList
.
data
}
...
...
@@ -23,34 +21,58 @@ export default {
data
()
{
return
{
path
:
'/project'
,
navList
:
[
navList
:
[],
navList1
:
[
{
label
:
'全部项目'
,
id
:
'all'
},
],
navList2
:
[
{
label
:
'热门项目'
,
id
:
'hot'
},
],
projectList
:[],
pages
:
1
,
}
},
watch
:{
$route
(){
},
$route
(
val
){
if
(
val
.
query
.
type
===
'hot'
){
this
.
navList
=
this
.
navList2
}
else
{
this
.
navList
=
this
.
navList1
}
this
.
restartPagination
();
}
},
created
()
{
if
(
this
.
$route
.
query
.
type
){
if
(
this
.
$route
.
query
.
type
===
'hot'
){
this
.
navList
=
this
.
navList2
;
this
.
$router
.
replace
({
path
:
'/project'
,
query
:
{
type
:
'hot'
}
});
}
if
(
this
.
$route
.
query
.
type
){
this
.
navList
=
this
.
navList1
}
else
{
this
.
navList
=
this
.
navList1
;
this
.
$router
.
replace
({
path
:
'/project'
,
query
:
{
type
:
'all'
}
});
}
this
.
dataGetProjectCategory
()
...
...
@@ -67,6 +89,62 @@ export default {
})
},
restartPagination
(){
if
(
process
.
browser
){
this
.
projectList
=
[];
this
.
pages
=
1
;
this
.
$refs
.
pagination
.
setCurrentPage
(
1
)
}
},
handleResponse
(
currentPage
,
response
){
if
(
currentPage
===
1
){
this
.
projectList
=
response
.
data
.
dataList
;
this
.
pages
=
response
.
data
.
totalPage
;
}
else
{
response
.
data
.
dataList
.
map
((
val
,
index
)
=>
{
this
.
projectList
.
push
(
val
)
});
this
.
pages
=
response
.
data
.
totalPage
;
}
},
dataGetProjectList
(
currentPage
){
let
params
=
{
page
:
currentPage
,
size
:
12
};
if
(
this
.
$route
.
query
.
type
&&
this
.
$route
.
query
.
type
===
'hot'
){
this
.
$axios
.
$get
(
config
.
api
.
get
.
Project
.
hotList
,{
params
:
params
}).
then
((
response
)
=>
{
this
.
handleResponse
(
currentPage
,
response
)
})
}
else
if
(
this
.
$route
.
query
.
type
&&
this
.
$route
.
query
.
type
===
'all'
){
this
.
$axios
.
$get
(
config
.
api
.
get
.
Project
.
list
,
{
params
:
params
})
.
then
((
response
)
=>
{
this
.
handleResponse
(
currentPage
,
response
)
})
}
else
if
(
this
.
$route
.
query
.
type
&&
this
.
$route
.
query
.
type
!==
'all'
){
params
.
categoryId
=
this
.
$route
.
query
.
type
;
this
.
$axios
.
$get
(
config
.
api
.
get
.
Project
.
list
,
{
params
:
params
})
.
then
((
response
)
=>
{
this
.
handleResponse
(
currentPage
,
response
)
})
}
},
changePage
(
currentPage
){
//返回页数 请求新的数据
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