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
938e4cf3
Commit
938e4cf3
authored
Nov 16, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成pick后端接口
parent
9176b660
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
28 deletions
+12
-28
pick.py
api/pick.py
+2
-11
pick.js
vu/src/api/pick.js
+1
-10
PickDetail.vue
vu/src/views/pick/components/PickDetail.vue
+9
-7
No files found.
api/pick.py
View file @
938e4cf3
...
@@ -35,16 +35,7 @@ class UpdateOrCreateView(APIView):
...
@@ -35,16 +35,7 @@ class UpdateOrCreateView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/community/pick/detail'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/community/pick/detail'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
# raise e
raise
e
data
=
{
'name'
:
1
,
'desc'
:
'hahah'
,
'gender'
:
'哈哈'
,
'region'
:
'123124312423'
,
'pick_type'
:
'www.baid.com'
,
'position'
:
22
,
'is_online'
:
1
}
return
{
'data'
:
data
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
def
post
(
self
,
request
):
...
@@ -58,7 +49,7 @@ class UpdateOrCreateView(APIView):
...
@@ -58,7 +49,7 @@ class UpdateOrCreateView(APIView):
'is_online'
:
request
.
POST
.
get
(
' is_online'
),
'is_online'
:
request
.
POST
.
get
(
' is_online'
),
}
}
try
:
try
:
self
.
rpc
[
'venus/community/pick/create'
](
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/community/pick/
update_or_
create'
](
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
raise
e
return
{
return
{
...
...
vu/src/api/pick.js
View file @
938e4cf3
...
@@ -17,15 +17,6 @@ export function OffLineOrOnLine(data) {
...
@@ -17,15 +17,6 @@ export function OffLineOrOnLine(data) {
})
})
}
}
export
function
fetchPickDetail
(
id
)
{
return
request
({
url
:
'/api/account/detail'
,
method
:
'get'
,
param
:
{
id
}
})
}
export
function
CreatePick
(
data
)
{
export
function
CreatePick
(
data
)
{
return
request
({
return
request
({
url
:
'/api/pick/create'
,
url
:
'/api/pick/create'
,
...
@@ -34,7 +25,7 @@ export function CreatePick(data) {
...
@@ -34,7 +25,7 @@ export function CreatePick(data) {
})
})
}
}
export
function
fetchP
P
ickDetail
(
id
)
{
export
function
fetchPickDetail
(
id
)
{
return
request
({
return
request
({
url
:
'/api/pick/detail'
,
url
:
'/api/pick/detail'
,
method
:
'get'
,
method
:
'get'
,
...
...
vu/src/views/pick/components/PickDetail.vue
View file @
938e4cf3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div
class=
"createPost-container"
>
<div
class=
"createPost-container"
>
<el-form
ref=
"postForm"
:model=
"postForm"
:rules=
"rules"
class=
"form-container"
>
<el-form
ref=
"postForm"
:model=
"postForm"
:rules=
"rules"
class=
"form-container"
>
<sticky
:class-name=
"'sub-navbar
'+postForm.status
"
>
<sticky
:class-name=
"'sub-navbar
'
"
>
<el-button
v-loading=
"loading"
style=
"margin-left: 10px;"
type=
"success"
@
click=
"submitForm"
>
发布
<el-button
v-loading=
"loading"
style=
"margin-left: 10px;"
type=
"success"
@
click=
"submitForm"
>
发布
</el-button>
</el-button>
</sticky>
</sticky>
...
@@ -72,11 +72,11 @@
...
@@ -72,11 +72,11 @@
<
script
>
<
script
>
import
MDinput
from
'@/components/MDinput'
import
MDinput
from
'@/components/MDinput'
import
Sticky
from
'@/components/Sticky'
// 粘性header组件
import
Sticky
from
'@/components/Sticky'
// 粘性header组件
import
{
fetchPickDetail
,
CreatePick
,
fetchPPickDetail
}
from
'@/api/pick'
import
{
fetchPickDetail
,
CreatePick
}
from
'@/api/pick'
import
{
userSearch
}
from
'@/api/remoteSearch'
import
{
userSearch
}
from
'@/api/remoteSearch'
const
defaultForm
=
{
const
defaultForm
=
{
status
:
'draft'
,
//
status: 'draft',
name
:
''
,
name
:
''
,
desc
:
''
,
desc
:
''
,
gender
:
''
,
gender
:
''
,
...
@@ -87,7 +87,7 @@ const defaultForm = {
...
@@ -87,7 +87,7 @@ const defaultForm = {
}
}
export
default
{
export
default
{
name
:
'
Article
Detail'
,
name
:
'
Pick
Detail'
,
components
:
{
MDinput
,
Sticky
},
components
:
{
MDinput
,
Sticky
},
props
:
{
props
:
{
isEdit
:
{
isEdit
:
{
...
@@ -127,6 +127,7 @@ export default {
...
@@ -127,6 +127,7 @@ export default {
created
()
{
created
()
{
if
(
this
.
isEdit
)
{
if
(
this
.
isEdit
)
{
const
id
=
this
.
$route
.
params
&&
this
.
$route
.
params
.
id
const
id
=
this
.
$route
.
params
&&
this
.
$route
.
params
.
id
console
.
log
(
id
)
this
.
fetchData
(
id
)
this
.
fetchData
(
id
)
}
else
{
}
else
{
this
.
postForm
=
Object
.
assign
({},
defaultForm
)
this
.
postForm
=
Object
.
assign
({},
defaultForm
)
...
@@ -136,8 +137,9 @@ export default {
...
@@ -136,8 +137,9 @@ export default {
},
},
methods
:
{
methods
:
{
fetchData
(
id
)
{
fetchData
(
id
)
{
fetchPPickDetail
(
id
).
then
(
response
=>
{
fetchPickDetail
(
id
).
then
(
response
=>
{
this
.
postForm
=
response
.
data
.
data
.
data
console
.
log
(
response
.
data
.
data
.
data
)
// this.postForm = response.data.data.data
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
log
(
err
)
console
.
log
(
err
)
...
@@ -169,7 +171,7 @@ export default {
...
@@ -169,7 +171,7 @@ export default {
});
});
this
.
postForm
.
status
=
'published'
//
this.postForm.status = 'published'
this
.
loading
=
false
this
.
loading
=
false
}
else
{
}
else
{
console
.
log
(
'error submit!!'
)
console
.
log
(
'error submit!!'
)
...
...
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