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
1c2e953f
Commit
1c2e953f
authored
6 years ago
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善小组
parent
72407245
master
dev
like-pre/r01
quick-reply
refactor
test
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
41 deletions
+30
-41
group.py
api/group.py
+6
-4
GroupDetail.vue
vu/src/views/group/components/GroupDetail.vue
+24
-37
No files found.
api/group.py
View file @
1c2e953f
...
...
@@ -54,14 +54,16 @@ class GroupUpdateOrCreate(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
star_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))))
group_user_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'group_users'
,
'[]'
))))
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
'creator_id'
:
request
.
POST
.
get
(
'user
_id'
,
''
)
,
'celebrity_ids'
:
json
.
loads
(
request
.
POST
.
get
(
'star'
,
''
))
,
'creator_id'
:
request
.
POST
.
get
(
'user
'
,
''
)
.
split
(
':'
)[
0
]
,
'celebrity_ids'
:
star_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
,
0
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'group_user_ids'
:
json
.
loads
(
request
.
POST
.
get
(
'user_ids'
,
''
))
,
'group_user_ids'
:
group_user_ids
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
)[:
-
2
]
}
try
:
...
...
@@ -88,7 +90,7 @@ class GroupRelatedUser(APIView):
class
GroupRelatedUserGET
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
id
=
request
.
GET
.
get
(
'id'
,
''
)
.
split
(
':'
)[
0
]
try
:
data
=
self
.
rpc
[
'venus/sun/group/user/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/group/components/GroupDetail.vue
View file @
1c2e953f
...
...
@@ -27,27 +27,28 @@
<el-col
:span=
"8"
>
<el-form-item
label-width=
"75px"
label=
"明星称号:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"
postForm.
star"
v-model=
"star"
:remote-method=
"getRemoteStarList"
filterable
remote
multiple
clearable
reserve-keyword
value-key=
"id"
placeholder=
"搜索明星"
style=
"width: 100%"
>
<el-option
v-for=
"(item,index) in starListOptions"
:key=
"item+index"
:label=
"item
.name
"
:value=
"item
.id
"
/>
<el-option
v-for=
"(item,index) in starListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"8"
>
<el-form-item
label-width=
"75px"
label=
"小组组长:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"
postForm.user_id"
:remote-method=
"getRemoteUserList"
filterable
remot
e
<el-select
v-model=
"
user"
:remote-method=
"getRemoteUserList"
filterable
remote
clearabl
e
value-key=
"id"
placeholder=
"搜索用户"
style=
"width: 100%"
>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item
.name
"
:value=
"item
.id
"
/>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
</el-col>
...
...
@@ -109,7 +110,7 @@
<el-select
v-model=
"temp_user_ids"
:remote-method=
"getRemoteUserList"
filterable
remote
value-key=
"id"
placeholder=
"用户"
style=
"width: 220px"
>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item
.id + ':' + item.name"
:value=
"item.id
"
/>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item
"
:value=
"item
"
/>
</el-select>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"appendUser"
>
添加
...
...
@@ -199,12 +200,13 @@
description
:
''
,
// 小组简介
id
:
undefined
,
user_nums
:
0
,
user_id
:
''
,
user
:
''
,
star
:
[],
icon
:
''
,
is_online
:
0
,
is_recommend
:
0
,
user_id
s
:
[],
group_user
s
:
[],
}
export
default
{
...
...
@@ -236,9 +238,13 @@
title
:
[{
validator
:
validateRequire
}],
content
:
[{
validator
:
validateRequire
}],
},
tempRoute
:
{},
user
:
''
,
star
:
[],
temp_user_ids
:
''
,
user_ids
:
[],
group_users
:
[],
tempRoute
:
{},
uploadType
:
98
,
starListOptions
:
[],
userListOptions
:
[],
...
...
@@ -246,11 +252,6 @@
// 小组相关
list
:
null
,
tableData
:
[],
temp
:{
user_id
:
''
,
user_name
:
''
,
star_ids
:
[],
},
del_list
:
[],
total
:
0
,
listLoading
:
true
,
...
...
@@ -299,19 +300,12 @@
fetchData
(
id
)
{
GroupDetail
(
id
).
then
(
response
=>
{
let
rep
=
response
.
data
.
data
let
temp_star_list
=
[]
this
.
postForm
=
response
.
data
.
data
this
.
temp
.
user_id
=
rep
.
creator
.
id
this
.
postForm
.
user_id
=
this
.
temp
.
user_name
=
rep
.
creator
.
name
// TODO
this
.
user
=
rep
.
creator
.
id
+
':'
+
rep
.
creator
.
name
for
(
let
i
=
0
;
i
<
rep
.
star
.
length
;
i
++
){
temp_star_list
.
push
(
rep
.
star
[
i
][
'name'
])
this
.
temp
.
star_ids
.
push
(
rep
.
star
[
i
])
this
.
star
.
push
(
rep
.
star
[
i
][
'id'
]
+
':'
+
rep
.
star
[
i
][
'name'
])
}
this
.
postForm
.
star
=
temp_star_list
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
...
...
@@ -320,16 +314,10 @@
this
.
$refs
.
postForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loading
=
true
if
(
this
.
postForm
.
user_id
===
this
.
temp
.
user_name
){
this
.
postForm
.
user_id
=
this
.
temp
.
user_id
}
if
(
this
.
isEdit
){
this
.
postForm
.
star
=
Assembledata
(
this
.
temp
.
star_ids
,
this
.
postForm
.
star
)
}
else
{
this
.
postForm
.
star
=
JSON
.
stringify
(
this
.
postForm
.
star
)
}
this
.
postForm
.
user_ids
=
JSON
.
stringify
(
this
.
user_ids
);
this
.
postForm
.
user
=
this
.
user
this
.
postForm
.
star
=
JSON
.
stringify
(
this
.
star
)
this
.
postForm
.
group_users
=
JSON
.
stringify
(
this
.
group_users
);
createGroup
(
this
.
postForm
).
then
(
response
=>
{
this
.
$notify
({
title
:
'成功'
,
...
...
@@ -338,8 +326,7 @@
duration
:
2000
})
setTimeout
(()
=>
{
// this.$router.push('/group/list')
this
.
$router
.
go
(
0
)
this
.
$router
.
push
(
'/group/list'
)
},
1000
)
}).
catch
(
err
=>
{
...
...
@@ -386,7 +373,7 @@
}
this
.
tableData
.
push
(...
response
.
data
.
data
)
this
.
total
=
this
.
tableData
.
length
this
.
user_id
s
.
push
(
this
.
temp_user_ids
)
this
.
group_user
s
.
push
(
this
.
temp_user_ids
)
this
.
temp_user_ids
=
''
})
...
...
This diff is collapsed.
Click to expand it.
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