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
1
Merge Requests
1
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
alpha
sun
Commits
ba219b88
Commit
ba219b88
authored
Nov 21, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成明星相关
parent
a7b59391
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
122 additions
and
72 deletions
+122
-72
group.py
api/group.py
+4
-16
search.py
api/search.py
+16
-7
star.py
api/star.py
+24
-9
urls.py
api/urls.py
+2
-0
remoteSearch.js
vu/src/api/remoteSearch.js
+8
-0
index.js
vu/src/utils/index.js
+13
-0
StarDetail.vue
vu/src/views/star/components/StarDetail.vue
+47
-31
list.vue
vu/src/views/star/list.vue
+8
-9
No files found.
api/group.py
View file @
ba219b88
...
...
@@ -40,23 +40,10 @@ class GroupUpdateOrCreate(APIView):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'venus/
community/group/detail
'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun/group/get
'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
data
=
[{
'id'
:
1
,
'name'
:
'我是一个小组名称'
,
'description'
:
'小组简介简介'
,
'user_nums'
:
22
,
'topic_nums'
:
32
,
'user'
:
{
'id'
:
22
,
'name'
:
'真好'
,
}
},]
return
{
'total'
:
20
,
'data'
:
data
}
raise
e
return
[
data
]
def
post
(
self
,
request
):
pass
\ No newline at end of file
api/search.py
View file @
ba219b88
...
...
@@ -10,7 +10,7 @@ class GroupSearchView(APIView):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/
community
/group/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun
/group/search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
...
...
@@ -21,7 +21,7 @@ class RegionSearchView(APIView):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/
community
/country/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun
/country/search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
data
}
...
...
@@ -31,7 +31,7 @@ class UserSearchView(APIView):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/
community
/user/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun
/user/search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
data
}
...
...
@@ -41,7 +41,7 @@ class TagSearchView(APIView):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/
community
/tag/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun
/tag/search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
data
}
...
...
@@ -51,7 +51,17 @@ class StarSearchView(APIView):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/
community
/star/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun
/star/search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
data
}
\ No newline at end of file
return
{
'data'
:
data
}
class
CitySearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/sun/city/search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
data
}
api/star.py
View file @
ba219b88
...
...
@@ -9,11 +9,11 @@ from utils.base import APIView
class
StarListView
(
APIView
):
def
get
(
self
,
request
):
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
page
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
try
:
data
=
self
.
rpc
[
'venus/
community/star/ge
t'
](
offset
=
page
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun/star/lis
t'
](
offset
=
page
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
data
...
...
@@ -23,25 +23,41 @@ class StarUpdateOrCreate(APIView):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'venus/
community/star/detail
'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/
sun/star/get
'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
data
}
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
),
'gender'
:
request
.
POST
.
get
(
'gender'
),
'
region'
:
request
.
POST
.
get
(
'region
'
),
'is_online'
:
request
.
POST
.
get
(
'is_online'
),
'
city_id'
:
request
.
POST
.
get
(
'city
'
),
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
)
),
'description'
:
request
.
POST
.
get
(
'description'
),
'
avatar'
:
request
.
POST
.
get
(
'avatar'
)[:
-
2
]
,
'
icon'
:
request
.
POST
.
get
(
'avatar'
)
,
'group_ids'
:
list
(
set
(
json
.
loads
(
request
.
POST
.
get
(
'group_ids'
,
[])))),
}
print
(
json
.
loads
(
request
.
POST
.
get
(
'group_ids'
,
[])))
try
:
self
.
rpc
[
'venus/
community/star/create'
](
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/
sun/star/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'message'
:
'更新成功'
}
\ No newline at end of file
}
class
StarRelatedGroup
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
count
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
{
'star_id'
:
id
}
try
:
data
=
self
.
rpc
[
'venus/sun/group/list'
](
filters
=
filters
,
offset
=
offset
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
data
api/urls.py
View file @
ba219b88
...
...
@@ -43,6 +43,7 @@ urlpatterns = [
url
(
r'star/list$'
,
StarListView
.
as_view
()),
url
(
r'star/create'
,
StarUpdateOrCreate
.
as_view
()),
url
(
r'star/detail'
,
StarUpdateOrCreate
.
as_view
()),
url
(
r'star/star_related_group_info'
,
StarRelatedGroup
.
as_view
()),
# push相关
url
(
r'push/list$'
,
PushListView
.
as_view
()),
...
...
@@ -68,6 +69,7 @@ search_urlpatterns = [
url
(
r'search/user'
,
UserSearchView
.
as_view
()),
url
(
r'search/tag'
,
TagSearchView
.
as_view
()),
url
(
r'search/star'
,
StarSearchView
.
as_view
()),
url
(
r'search/city'
,
CitySearchView
.
as_view
()),
]
common_urlpatterns
=
[
...
...
vu/src/api/remoteSearch.js
View file @
ba219b88
...
...
@@ -39,3 +39,11 @@ export function starSearch(name) {
params
:
{
name
}
})
}
export
function
citySearch
(
name
)
{
return
request
({
url
:
'/api/search/city'
,
method
:
'get'
,
params
:
{
name
}
})
}
vu/src/utils/index.js
View file @
ba219b88
...
...
@@ -324,3 +324,16 @@ export function removeByvale(arr, val) {
}
}
}
export
function
Assembledata
(
target
,
source
)
{
var
region_data
=
[]
for
(
var
i
=
0
;
i
<
target
.
length
;
i
++
){
if
(
isInArray
(
source
,
target
[
i
][
'name'
])){
region_data
.
push
(
target
[
i
][
'id'
])
console
.
log
(
region_data
)
removeByvale
(
source
,
target
[
i
][
'name'
]);
}
}
region_data
.
push
(...
source
)
return
region_data
.
join
(
','
)
}
vu/src/views/star/components/StarDetail.vue
View file @
ba219b88
...
...
@@ -24,7 +24,7 @@
<el-row>
<el-col
:span=
"12"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"75px"
label=
"明星ID:"
v-if=
"isEdit"
>
<el-input
v-model=
"postForm.
ID"
type=
"text"
placeholder=
"请输入内容"
style=
"width: 230px;"
readonly
/>
<el-input
v-model=
"postForm.
id"
type=
"text"
style=
"width: 230px;"
readonly
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
...
...
@@ -37,13 +37,13 @@
<el-row>
<el-col
:span=
"12"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"
45px"
label=
"用户:"
prop=
"desc
"
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"
75px"
label=
"用户数:
"
v-if=
"isEdit"
>
<el-input
v-model=
"postForm.user_nums"
type=
"number"
style=
"width: 220px;"
readonly
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"
45px"
label=
"帖子:"
prop=
"desc
"
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"
75px"
label=
"帖子数:
"
v-if=
"isEdit"
>
<el-input
v-model=
"postForm.topic_nums"
type=
"number"
style=
"width: 220px;"
readonly
/>
</el-form-item>
...
...
@@ -51,7 +51,7 @@
</el-row>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"
45px"
label=
"小组
:"
v-if=
"isEdit"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"
75px"
label=
"小组数
:"
v-if=
"isEdit"
>
<el-input
v-model=
"postForm.group_nums"
type=
"number"
style=
"width: 220px;"
readonly
/>
</el-form-item>
</el-col>
...
...
@@ -63,7 +63,7 @@
</div>
</el-col>
</div>
<el-form-item
label-width=
"
4
5px"
label=
"性别:"
style=
"margin-left: 10px"
>
<el-form-item
label-width=
"
7
5px"
label=
"性别:"
style=
"margin-left: 10px"
>
<el-select
v-model=
"postForm.gender"
:placeholder=
"'性别:'"
clearable
class=
"postInfo-container-item"
style=
"width: 220px"
>
...
...
@@ -71,14 +71,14 @@
:value=
"item.key"
/>
</el-select>
</el-form-item>
<el-form-item
label-width=
"
45px"
label=
"地区
:"
style=
"margin-left: 10px"
>
<el-select
v-model=
"postForm.
region"
:remote-method=
"getRemoteRegion
List"
filterable
remote
<el-form-item
label-width=
"
75px"
label=
"城市
:"
style=
"margin-left: 10px"
>
<el-select
v-model=
"postForm.
city"
:remote-method=
"getRemoteCity
List"
filterable
remote
value-key=
"id"
placeholder=
"搜索地区"
style=
"width: 220px"
>
<el-option
v-for=
"(item,index) in regionListOptions"
:key=
"item+index"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
style=
"margin-bottom: 20px;margin-left: 10px"
label-width=
"
4
5px"
label=
"下线:"
>
<el-form-item
style=
"margin-bottom: 20px;margin-left: 10px"
label-width=
"
7
5px"
label=
"下线:"
>
<el-radio-group
v-model=
"postForm.is_online"
>
<el-radio
:label=
"1"
>
是
</el-radio>
<el-radio
:label=
"0"
>
否
</el-radio>
...
...
@@ -149,7 +149,7 @@
</el-table-column>
<el-table-column
align=
"center"
label=
"组长"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
user
.
name
}}
</span>
<span>
{{
scope
.
row
.
creator_
name
}}
</span>
</
template
>
</el-table-column>
...
...
@@ -173,17 +173,18 @@
import
Pagination
from
'@/components/Pagination'
import
{
starCreate
,
starDetail
,
fetchStarRelatedGroup
}
from
'@/api/star'
import
{
GroupDetail
}
from
'@/api/group'
import
{
regionSearch
,
groupSearch
}
from
'@/api/remoteSearch'
import
{
citySearch
,
groupSearch
}
from
'@/api/remoteSearch'
import
{
isInArray
}
from
"@/utils"
;
const
defaultForm
=
{
status
:
'draft'
,
name
:
''
,
id
:
''
,
gender
:
''
,
region
:
''
,
city
:
''
,
is_online
:
undefined
,
description
:
''
,
avatar
:
''
,
group_ids
:
[],
}
export
default
{
...
...
@@ -212,7 +213,8 @@
postForm
:
Object
.
assign
({},
defaultForm
),
loading
:
false
,
groupListOptions
:
[],
temp_group_ids
:
[],
temp_group_ids
:
''
,
group_ids
:
[],
rules
:
{
content
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}]
},
...
...
@@ -233,6 +235,8 @@
page
:
0
,
limit
:
10
,
},
temp_city_id
:
''
,
temp_city_name
:
''
,
}
},
computed
:
{
...
...
@@ -270,12 +274,11 @@
},
methods
:
{
fetchData
(
id
)
{
fetchArticle
(
id
).
then
(
response
=>
{
this
.
postForm
=
response
.
data
// Just for test
this
.
postForm
.
title
+=
` Article Id:
${
this
.
postForm
.
id
}
`
this
.
postForm
.
content_short
+=
` Article Id:
${
this
.
postForm
.
id
}
`
starDetail
(
id
).
then
(
response
=>
{
let
rep
=
response
.
data
.
data
.
data
this
.
postForm
=
rep
this
.
temp_city_id
=
response
.
data
.
data
.
data
.
city
.
id
this
.
postForm
.
city
=
this
.
temp_city_name
=
rep
.
city
.
name
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
...
...
@@ -284,7 +287,11 @@
this
.
$refs
.
postForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loading
=
true
this
.
postForm
.
group_ids
=
JSON
.
stringify
(
this
.
postForm
.
group_ids
)
this
.
postForm
.
group_ids
=
JSON
.
stringify
(
this
.
group_ids
);
// 处理未修改标签
if
(
this
.
temp_city_name
===
this
.
postForm
.
city
){
this
.
postForm
.
city
=
this
.
temp_city_id
;
}
starCreate
(
this
.
postForm
).
then
(
response
=>
{
this
.
$notify
({
title
:
'成功'
,
...
...
@@ -320,25 +327,30 @@
this
.
groupListOptions
=
response
.
data
.
data
.
data
})
},
getRemote
Region
List
(
query
)
{
region
Search
(
query
).
then
(
response
=>
{
getRemote
City
List
(
query
)
{
city
Search
(
query
).
then
(
response
=>
{
if
(
!
response
.
data
.
data
.
data
)
return
this
.
regionListOptions
=
response
.
data
.
data
.
data
})
},
appendUser
()
{
if
(
isInArray
(
this
.
group_ids
,
this
.
temp_group_ids
)){
this
.
$message
({
message
:
'数据添加重复'
,
type
:
'error'
})
return
false
;
}
GroupDetail
(
this
.
temp_group_ids
).
then
(
response
=>
{
if
(
!
response
.
data
.
data
.
data
)
return
this
.
tableData
.
push
(...
response
.
data
.
data
.
data
)
this
.
total
=
response
.
data
.
data
.
total
if
(
!
response
.
data
.
data
)
return
this
.
tableData
.
push
(...
response
.
data
.
data
)
this
.
total
=
this
.
tableData
.
length
})
this
.
postForm
.
group_ids
.
push
(
this
.
temp_group_ids
)
this
.
group_ids
.
push
(
this
.
temp_group_ids
)
this
.
temp_group_ids
=
''
},
delUser
()
{
const
lenth
=
this
.
multipleSelection
.
length
;
this
.
del_list
=
this
.
del_list
.
concat
(
this
.
multipleSelection
);
console
.
log
(
this
.
del_list
)
this
.
postForm
.
group_ids
.
push
(...
this
.
multipleSelection
)
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
...
...
@@ -354,8 +366,12 @@
getList
(
id
)
{
this
.
listLoading
=
true
fetchStarRelatedGroup
(
id
).
then
(
response
=>
{
this
.
list
=
[]
this
.
total
=
100
let
rep
=
response
.
data
.
data
.
data
;
for
(
let
i
=
0
;
i
<
rep
.
length
;
i
++
){
this
.
group_ids
.
push
(
rep
[
i
].
id
)
}
this
.
tableData
=
response
.
data
.
data
.
data
this
.
total
=
response
.
data
.
data
.
total
this
.
listLoading
=
false
})
},
...
...
vu/src/views/star/list.vue
View file @
ba219b88
...
...
@@ -20,7 +20,7 @@
<el-table-column
type=
"selection"
align=
"center"
></el-table-column>
<el-table-column
align=
"center"
label=
"明星ID"
width=
"80"
>
<template
slot-scope=
"scope"
>
<router-link
:to=
"'/
pick
/edit/'+scope.row.id"
class=
"link-type"
>
<router-link
:to=
"'/
star
/edit/'+scope.row.id"
class=
"link-type"
>
<span>
{{
scope
.
row
.
id
}}
</span>
</router-link>
</
template
>
...
...
@@ -38,16 +38,16 @@
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"
地区
"
>
<el-table-column
align=
"center"
label=
"
城市
"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
region
}}
</span>
<span>
{{
scope
.
row
.
city
.
name
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"小组数量"
>
<
template
slot-scope=
"scope"
>
<router-link
:to=
"'/
pick
/edit/'+scope.row.id"
class=
"link-type"
>
<span>
{{
scope
.
row
.
group_
count
s
}}
</span>
<router-link
:to=
"'/
group
/edit/'+scope.row.id"
class=
"link-type"
>
<span>
{{
scope
.
row
.
group_
num
s
}}
</span>
</router-link>
</
template
>
</el-table-column>
...
...
@@ -60,7 +60,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
=
"listQuery.page"
:limit
=
"listQuery.limit"
style=
"margin-left: 150px;"
@
pagination=
"getList"
/>
</div>
</template>
...
...
@@ -99,7 +99,7 @@ export default {
multipleSelection
:
[],
del_list
:
[],
listQuery
:
{
page
:
1
,
page
:
0
,
limit
:
10
,
filter
:
{
value
:
''
,
...
...
@@ -158,12 +158,11 @@ export default {
}
OffLineOrOnLine
({
type
:
val
,
ids
:
str
}).
then
(
response
=>
{
this
.
multipleSelection
=
[];
response
.
data
.
data
.
message
this
.
$message
.
success
(
response
.
data
.
data
.
message
);
})
},
handleFilter
()
{
this
.
listQuery
.
page
=
1
this
.
listQuery
.
page
=
0
this
.
getList
()
},
handleCreate
()
{
...
...
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