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
9c8f0cca
Commit
9c8f0cca
authored
Nov 30, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成pick添加
parent
6e82e2ba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
43 deletions
+85
-43
group.py
api/group.py
+0
-1
pick.py
api/pick.py
+14
-9
urls.py
api/urls.py
+2
-0
pick.js
vu/src/api/pick.js
+22
-6
PickDetail.vue
vu/src/views/pick/components/PickDetail.vue
+47
-27
No files found.
api/group.py
View file @
9c8f0cca
...
...
@@ -75,7 +75,6 @@ class GroupUpdateOrCreate(APIView):
class
GroupRelatedUser
(
APIView
):
def
get
(
self
,
request
):
print
(
request
.
GET
)
id
=
request
.
GET
.
get
(
'id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
count
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
...
...
api/pick.py
View file @
9c8f0cca
...
...
@@ -3,6 +3,7 @@
# __author__ = "chenwei"
# Date: 2018/11/15
import
json
from
utils.base
import
APIView
from
alpha_types.venus
import
PICK_TYPE
...
...
@@ -101,20 +102,24 @@ class PickUserListView(APIView):
class
PickTopicView
(
APIView
):
def
get
(
self
,
request
):
topic_id
=
request
.
GET
.
get
(
'id'
)
def
post
(
self
,
request
):
topic_id
=
request
.
POST
.
get
(
'topic_id'
)
pick_id
=
request
.
POST
.
get
(
'pick_id'
)
del_ids
=
json
.
loads
(
request
.
POST
.
get
(
'del_ids'
,
'""'
))
try
:
data
=
self
.
rpc
[
'venus/sun/
topic/pick_topic'
](
id
=
topic_id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/
pick/pick_topic'
](
topic_id
=
topic_id
,
pick_id
=
pick_id
,
del_ids
=
del_ids
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
[
data
,
]
return
data
class
PickCelebrityListView
(
APIView
):
def
get
(
self
,
request
):
celebrity_id
=
request
.
GET
.
get
(
'id'
)
def
post
(
self
,
request
):
celebrity_id
=
request
.
POST
.
get
(
'celebrity_id'
)
pick_id
=
request
.
POST
.
get
(
'pick_id'
)
del_ids
=
json
.
loads
(
request
.
POST
.
get
(
'del_ids'
,
'""'
))
try
:
data
=
self
.
rpc
[
'venus/sun/pick/pick_celebrity'
](
id
=
celebrity_id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/pick/pick_celebrity'
](
celebrity_id
=
celebrity_id
,
pick_id
=
pick_id
,
del_ids
=
del_ids
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
[
data
,
]
\ No newline at end of file
return
data
\ No newline at end of file
api/urls.py
View file @
9c8f0cca
...
...
@@ -72,6 +72,8 @@ urlpatterns = [
url
(
r'^pick/add_fake_pick_nums$'
,
PickUserListView
.
as_view
()),
url
(
r'^pick/topic'
,
PickTopicView
.
as_view
()),
url
(
r'^pick/celebrity'
,
PickCelebrityListView
.
as_view
()),
url
(
r'^pick/del_celebrity'
,
PickCelebrityListView
.
as_view
()),
url
(
r'^pick/del_topic'
,
PickTopicView
.
as_view
()),
# 标签相关
url
(
r'^tag/list$'
,
TagListView
.
as_view
()),
...
...
vu/src/api/pick.js
View file @
9c8f0cca
...
...
@@ -49,18 +49,34 @@ export function AddFakePickNums(data) {
})
}
export
function
PickTopicDetail
(
id
)
{
export
function
PickTopicDetail
(
data
)
{
return
request
({
url
:
'/api/pick/topic'
,
method
:
'
ge
t'
,
params
:
{
id
}
method
:
'
pos
t'
,
data
})
}
export
function
PickCelebrityDetail
(
id
)
{
export
function
PickCelebrityDetail
(
data
)
{
return
request
({
url
:
'/api/pick/celebrity'
,
method
:
'get'
,
params
:
{
id
}
method
:
'post'
,
data
})
}
export
function
delPickCelebrity
(
data
)
{
return
request
({
url
:
'/api/pick/del_celebrity'
,
method
:
'post'
,
data
})
}
export
function
delPickTopic
(
data
)
{
return
request
({
url
:
'/api/pick/del_topic'
,
method
:
'post'
,
data
})
}
vu/src/views/pick/components/PickDetail.vue
View file @
9c8f0cca
...
...
@@ -300,7 +300,9 @@
fetchPickUserList
,
AddFakePickNums
,
PickTopicDetail
,
PickCelebrityDetail
PickCelebrityDetail
,
delPickTopic
,
delPickCelebrity
}
from
'@/api/pick'
import
{
groupSearch
,
citySearch
,
celebritySearch
,
topicSearch
}
from
'@/api/remoteSearch'
import
{
isInArray
,
removeByvale
}
from
"@/utils"
;
...
...
@@ -396,6 +398,9 @@
origin_len
:
0
,
topic_ids
:
[],
celebrity_ids
:
[],
new_ids
:
[],
del_ids
:
[],
}
},
computed
:
{
...
...
@@ -565,13 +570,17 @@
this
.
topic_id
=
''
return
false
}
PickTopicDetail
(
this
.
topic_id
).
then
(
response
=>
{
if
(
!
response
.
data
.
data
)
return
this
.
list
.
unshift
(...
response
.
data
.
data
)
this
.
total
=
this
.
list
.
length
let
data
=
{
topic_id
:
this
.
topic_id
,
pick_id
:
this
.
postForm
.
id
,
}
PickTopicDetail
(
data
).
then
(
response
=>
{
this
.
$message
.
info
(
response
.
data
.
data
.
message
)
})
// this.user_ids.push(this.temp_user_ids)
this
.
topic_id
=
''
setTimeout
(()
=>
{
this
.
$router
.
go
(
0
)
},
1300
)
}
else
if
(
this
.
postForm
.
pick_type_origin
==
1
)
{
if
(
this
.
celebrity_id
==
""
)
{
...
...
@@ -579,50 +588,61 @@
this
.
celebrity_id
=
''
return
false
;
}
else
{
PickCelebrityDetail
(
this
.
celebrity_id
).
then
(
response
=>
{
if
(
!
response
.
data
.
data
)
return
this
.
list
.
unshift
(...
response
.
data
.
data
)
this
.
total
=
this
.
list
.
length
let
data
=
{
celebrity_id
:
this
.
celebrity_id
,
pick_id
:
this
.
postForm
.
id
,
}
PickCelebrityDetail
(
data
).
then
(
response
=>
{
this
.
$message
.
info
(
response
.
data
.
data
.
message
)
})
// this.user_ids.push(this.temp_user_ids)
this
.
celebrity_id
=
''
setTimeout
(()
=>
{
this
.
$router
.
go
(
0
)
},
1300
)
}
}
},
del
()
{
this
.
topic_ids
=
left__ids
;
this
.
total
=
this
.
origin_len
-
this
.
del_list
.
length
let
origin__ids
=
[];
var
left__ids
=
[];
let
select__ids
=
[]
this
.
del_list
.
push
(...
this
.
multipleSelection
)
if
(
this
.
postForm
.
pick_type_origin
==
0
)
{
for
(
let
i
=
0
;
i
<
this
.
list
.
length
;
i
++
)
{
origin__ids
.
push
(
this
.
list
[
i
].
topic_id
)
}
for
(
let
i
=
0
;
i
<
this
.
multipleSelection
.
length
;
i
++
)
{
select__ids
.
push
(
this
.
multipleSelection
[
i
].
topic_id
)
}
}
else
{
for
(
let
i
=
0
;
i
<
this
.
list
.
length
;
i
++
)
{
origin__ids
.
push
(
this
.
list
[
i
].
celebrity_id
)
let
data
=
{
del_ids
:
JSON
.
stringify
(
select__ids
),
pick_id
:
this
.
postForm
.
id
,
}
delPickTopic
(
data
).
then
(
response
=>
{
this
.
$message
.
success
(
'操作成功'
)
setTimeout
(()
=>
{
this
.
$router
.
go
(
0
)
},
1300
)
})
}
else
{
for
(
let
i
=
0
;
i
<
this
.
multipleSelection
.
length
;
i
++
)
{
select__ids
.
push
(
this
.
multipleSelection
[
i
].
celebrity_id
)
}
}
for
(
let
i
=
0
;
i
<
origin__ids
.
length
;
i
++
)
{
if
(
!
isInArray
(
select__ids
,
origin__ids
[
i
]))
{
left__ids
.
push
(
origin__ids
[
i
])
let
data
=
{
del_ids
:
JSON
.
stringify
(
select__ids
),
pick_id
:
this
.
postForm
.
id
,
}
delPickCelebrity
(
data
).
then
(
response
=>
{
this
.
$message
.
success
(
'操作成功'
)
setTimeout
(()
=>
{
this
.
$router
.
go
(
0
)
},
1300
)
})
}
},
}
}
...
...
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