Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
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
钟尚武
sun
Commits
ba55ba85
Commit
ba55ba85
authored
Jan 07, 2019
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加排序和pick
parent
05aa8f11
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
22 deletions
+47
-22
pick.py
api/pick.py
+2
-2
topic.py
api/topic.py
+7
-1
index.vue
vu/src/components/Pagination/index.vue
+1
-0
PickDetail.vue
vu/src/views/pick/components/PickDetail.vue
+14
-13
list.vue
vu/src/views/pick/list.vue
+1
-1
list.vue
vu/src/views/topic/list.vue
+22
-5
No files found.
api/pick.py
View file @
ba55ba85
...
...
@@ -54,7 +54,7 @@ class UpdateOrCreateView(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
pick_group_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'pick_group'
,
'[]'
)))))
c
ity_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'cit
y'
,
'[]'
)))))
c
ountry_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'countr
y'
,
'[]'
)))))
position
=
request
.
POST
.
get
(
'position'
)
gender
=
request
.
POST
.
get
(
'gender'
)
pick_type
=
request
.
POST
.
get
(
'pick_type'
)
...
...
@@ -84,7 +84,7 @@ class UpdateOrCreateView(APIView):
'name'
:
request
.
POST
.
get
(
'name'
),
'desc'
:
request
.
POST
.
get
(
'desc'
),
'gender'
:
data_dict
[
'gender'
]
if
id
else
gender
,
'
region'
:
cit
y_ids
,
'
country_ids'
:
countr
y_ids
,
'pick_type'
:
data_dict
[
'pick_type'
]
if
id
else
pick_type
,
'pick_group'
:
pick_group_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
)),
...
...
api/topic.py
View file @
ba55ba85
...
...
@@ -15,12 +15,18 @@ class TopicListView(APIView):
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
sort_params
=
request
.
GET
.
getlist
(
'sort[]'
)
if
user_id
:
filter
.
update
({
'user_id'
:
user_id
})
if
group_id
:
filter
.
update
({
'group_id'
:
group_id
})
try
:
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
,
sort_params
=
sort_params
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取帖子列表失败
%
s'
,
e
)
raise
...
...
vu/src/components/Pagination/index.vue
View file @
ba55ba85
...
...
@@ -6,6 +6,7 @@
:page-size
.
sync=
"pageSize"
:layout=
"layout"
:total=
"total"
:pageSizes=
"pageSizes"
v-bind=
"$attrs"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
/>
...
...
vu/src/views/pick/components/PickDetail.vue
View file @
ba55ba85
...
...
@@ -90,11 +90,11 @@
</el-row>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label-width=
"45px"
label=
"
城市:"
class=
"postInfo-container-item"
prop=
"cit
y"
>
<el-select
v-model=
"c
ity"
:remote-method=
"getRemoteCit
yList"
filterable
remote
multiple
<el-form-item
label-width=
"45px"
label=
"
国家:"
class=
"postInfo-container-item"
prop=
"countr
y"
>
<el-select
v-model=
"c
ountry"
:remote-method=
"getRemoteCountr
yList"
filterable
remote
multiple
value-key=
"id"
placeholder=
"搜索
地区
"
style=
"width: 100%"
>
<el-option
v-for=
"(item,index) in
region
ListOptions"
:key=
"item+index"
:label=
"item"
placeholder=
"搜索
国家
"
style=
"width: 100%"
>
<el-option
v-for=
"(item,index) in
country
ListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
...
...
@@ -306,7 +306,7 @@
delPickTopic
,
delPickCelebrity
}
from
'@/api/pick'
import
{
groupSearch
,
citySearch
,
celebritySearch
,
topicSearch
}
from
'@/api/remoteSearch'
import
{
groupSearch
,
citySearch
,
celebritySearch
,
topicSearch
,
countrySearch
}
from
'@/api/remoteSearch'
import
{
isInArray
,
removeByvale
}
from
"@/utils"
;
const
defaultForm
=
{
...
...
@@ -315,6 +315,7 @@
desc
:
''
,
gender
:
''
,
city
:
[],
country
:
[],
pick_group
:
[],
pick_type
:
''
,
position
:
''
,
...
...
@@ -347,6 +348,7 @@
postForm
:
Object
.
assign
({},
defaultForm
),
loading
:
false
,
city
:
[],
country
:
[],
pick_group
:
[],
...
...
@@ -355,7 +357,7 @@
celebrity_id
:
''
,
topic_id
:
''
,
del_list
:
[],
region
ListOptions
:
[],
country
ListOptions
:
[],
groupListOptions
:
[],
celebrityListOptions
:
[],
topicListOptions
:
[],
...
...
@@ -433,10 +435,8 @@
for
(
let
i
=
0
;
i
<
rep
.
pick_group
.
length
;
i
++
)
{
this
.
pick_group
.
push
(
rep
.
pick_group
[
i
][
'id'
]
+
':'
+
rep
.
pick_group
[
i
][
'name'
])
}
for
(
let
i
=
0
;
i
<
rep
.
region
.
length
;
i
++
)
{
this
.
city
.
push
(
rep
.
region
[
i
][
'id'
]
+
':'
+
rep
.
region
[
i
][
'name'
])
for
(
let
i
=
0
;
i
<
rep
.
country
.
length
;
i
++
)
{
this
.
country
.
push
(
rep
.
country
[
i
][
'id'
]
+
':'
+
rep
.
country
[
i
][
'name'
])
}
this
.
postForm
=
rep
...
...
@@ -451,6 +451,7 @@
this
.
loading
=
true
;
this
.
postForm
.
city
=
JSON
.
stringify
(
this
.
city
);
this
.
postForm
.
country
=
JSON
.
stringify
(
this
.
country
)
this
.
postForm
.
pick_group
=
JSON
.
stringify
(
this
.
pick_group
);
CreatePick
(
this
.
postForm
).
then
(
response
=>
{
...
...
@@ -482,10 +483,10 @@
}
})
},
getRemoteC
ityList
(
query
)
{
c
itySearch
(
query
).
then
(
response
=>
{
getRemoteC
ountryList
(
query
)
{
c
ountrySearch
(
query
).
then
(
response
=>
{
if
(
!
response
.
data
.
data
.
data
)
return
this
.
region
ListOptions
=
response
.
data
.
data
.
data
this
.
country
ListOptions
=
response
.
data
.
data
.
data
})
},
getRemoteGroupList
(
query
)
{
...
...
vu/src/views/pick/list.vue
View file @
ba55ba85
...
...
@@ -55,7 +55,7 @@
<el-table-column
align=
"center"
label=
"地区"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
region
}}
</span>
<span>
{{
scope
.
row
.
country
}}
</span>
</
template
>
</el-table-column>
...
...
vu/src/views/topic/list.vue
View file @
ba55ba85
...
...
@@ -24,9 +24,9 @@
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleOfflineOrOnline('offline')"
>
下线
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleOfflineOrOnline('online')"
>
上线
</el-button>
</div>
<el-table
v-loading=
"listLoading"
:data=
"list"
border
fit
highlight-current-row
style=
"width: 100%"
ref=
"multipleTable"
@
selection-change=
"handleSelectionChange"
>
<el-table
v-loading=
"listLoading"
:data=
"list"
border
fit
highlight-current-row
style=
"width: 100%"
ref=
"multipleTable"
@
selection-change=
"handleSelectionChange"
@
sort-change=
"sortChange"
>
<el-table-column
type=
"selection"
align=
"center"
></el-table-column>
<el-table-column
align=
"center"
label=
"帖子ID "
>
<el-table-column
align=
"center"
label=
"帖子ID "
sortable=
"custom"
min-width=
"85px"
prop=
"id"
>
<template
slot-scope=
"scope"
>
<router-link
:to=
"'/topic/edit/'+scope.row.id"
class=
"link-type"
>
<span>
{{
scope
.
row
.
id
}}
</span>
...
...
@@ -40,7 +40,7 @@
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"帖子详情"
>
<el-table-column
align=
"center"
label=
"帖子详情"
min-width=
"300px;"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
content
}}
</span>
</
template
>
...
...
@@ -85,7 +85,7 @@
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"listQuery.page"
:limit
.
sync=
"listQuery.limit"
style=
"margin-left: 150px;"
@
pagination=
"getList"
/>
<pagination
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"listQuery.page"
:
pageSizes=
"pageSize"
:
limit
.
sync=
"listQuery.limit"
style=
"margin-left: 150px;"
@
pagination=
"getList"
/>
</div>
</template>
...
...
@@ -120,6 +120,7 @@ export default {
return
{
list
:
null
,
total
:
0
,
pageSize
:
[
10
,
30
,
50
,
100
,
250
],
listLoading
:
true
,
multipleSelection
:
[],
del_list
:
[],
...
...
@@ -134,6 +135,7 @@ export default {
user__is_puppet
:
''
,
content_level
:
''
},
sort
:
[
'-id'
,
]
},
BooleanTypeOptions
:
[
{
'key'
:
1
,
'display_name'
:
'是'
},
...
...
@@ -167,7 +169,6 @@ export default {
this
.
listQuery
.
user_id
=
this
.
$route
.
query
.
user_id
||
''
this
.
listQuery
.
group_id
=
this
.
$route
.
query
.
group_id
||
''
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
console
.
log
(
response
.
data
.
data
)
this
.
list
=
response
.
data
.
data
.
data
this
.
total
=
response
.
data
.
data
.
total
this
.
listLoading
=
false
...
...
@@ -208,6 +209,22 @@ export default {
},
handleCreate
()
{
this
.
$router
.
push
(
'/topic/create'
)
},
sortChange
(
data
){
const
{
prop
,
order
}
=
data
if
(
prop
===
'id'
){
this
.
sortByID
(
order
)
}
},
sortByID
(
order
){
if
(
order
===
'ascending'
){
this
.
listQuery
.
sort
.
shift
()
this
.
listQuery
.
sort
.
push
(...[
'id'
])
}
else
{
this
.
listQuery
.
sort
.
shift
()
this
.
listQuery
.
sort
.
push
(...[
'-id'
])
}
this
.
handleFilter
()
}
}
}
...
...
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