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
9176b660
Commit
9176b660
authored
6 years ago
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成pick前端编写
parent
2230190d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
114 deletions
+134
-114
group.py
api/group.py
+3
-3
pick.py
api/pick.py
+36
-6
urls.py
api/urls.py
+8
-3
account.js
vu/src/api/account.js
+1
-2
pick.js
vu/src/api/pick.js
+26
-1
list.vue
vu/src/views/group/list.vue
+2
-2
PickDetail.vue
vu/src/views/pick/components/PickDetail.vue
+58
-97
No files found.
api/group.py
View file @
9176b660
...
...
@@ -18,17 +18,17 @@ class GroupListView(APIView):
return
data
def
post
(
self
,
request
):
ids
=
request
.
POST
.
get
(
'ids'
,
''
)
.
split
()
group_
ids
=
request
.
POST
.
get
(
'ids'
,
''
)
.
split
()
type
=
request
.
POST
.
get
(
'type'
)
filters
=
{}
if
type
==
'offline'
:
filters
[
'is_online'
]
=
False
elif
type
==
'recommend'
:
filters
[
'recommend'
]
=
True
filters
[
'
is_
recommend'
]
=
True
else
:
filters
[
'is_online'
]
=
True
try
:
self
.
rpc
[
'venus/community/group/batch/update'
](
filters
=
filters
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/community/group/batch/update'
](
filters
=
filters
,
group_ids
=
group_
ids
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
...
...
This diff is collapsed.
Click to expand it.
api/pick.py
View file @
9176b660
...
...
@@ -18,20 +18,49 @@ class PickListView(APIView):
return
data
def
post
(
self
,
request
):
pass
ids
=
request
.
POST
.
get
(
'ids'
,
''
)
.
split
()
type
=
request
.
POST
.
get
(
'type'
,
''
)
try
:
self
.
rpc
[
'venus/community/pick/offline_pick'
](
type
=
type
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
"message"
:
"更新成功"
}
class
UpdateOrCreateView
(
APIView
):
def
get
(
self
,
request
):
pass
id
=
request
.
GET
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'venus/community/pick/detail'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
# raise e
data
=
{
'name'
:
1
,
'desc'
:
'hahah'
,
'gender'
:
'哈哈'
,
'region'
:
'123124312423'
,
'pick_type'
:
'www.baid.com'
,
'position'
:
22
,
'is_online'
:
1
}
return
{
'data'
:
data
}
def
post
(
self
,
request
):
ids
=
request
.
POST
.
get
(
'ids'
,
''
)
.
split
()
type
=
request
.
POST
.
get
(
'type'
,
''
)
data
=
{
'name'
:
request
.
POST
.
get
(
' name'
),
'desc'
:
request
.
POST
.
get
(
' desc'
),
'gender'
:
request
.
POST
.
get
(
' gender'
),
'region'
:
request
.
POST
.
get
(
' region'
),
'pick_type'
:
request
.
POST
.
get
(
' pick_type'
),
'position'
:
request
.
POST
.
get
(
' position'
),
'is_online'
:
request
.
POST
.
get
(
' is_online'
),
}
try
:
self
.
rpc
[
'venus/community/pick/
offline_pick'
](
type
=
type
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/community/pick/
create'
](
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
"message"
:
"更新成功"
'message'
:
'操作成功'
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
api/urls.py
View file @
9176b660
...
...
@@ -18,9 +18,10 @@ urlpatterns = [
# 登陆,注销相关
url
(
r'account/login$'
,
LoginView
.
as_view
()),
url
(
r'account/logout'
,
LogoutView
.
as_view
()),
url
(
r'account/list'
,
AccountList
.
as_view
()),
url
(
r'account/update'
,
AccountList
.
as_view
()),
url
(
r'account/get'
,
LoginView
.
as_view
()),
url
(
r'account/list'
,
AccountList
.
as_view
()),
url
(
r'account/list/update'
,
AccountList
.
as_view
()),
url
(
r'account/detail'
,
AccountUpdateOrCreateView
.
as_view
()),
url
(
r'account/create'
,
AccountUpdateOrCreateView
.
as_view
()),
# user相关
...
...
@@ -41,5 +42,8 @@ urlpatterns = [
# pick相关
url
(
r'pick/list$'
,
PickListView
.
as_view
()),
url
(
r'pick/update_or_create'
,
UpdateOrCreateView
.
as_view
()),
url
(
r'pick/list/update$'
,
PickListView
.
as_view
()),
url
(
r'pick/create'
,
UpdateOrCreateView
.
as_view
()),
url
(
r'pick/detail'
,
UpdateOrCreateView
.
as_view
()),
]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
vu/src/api/account.js
View file @
9176b660
...
...
@@ -10,7 +10,7 @@ export function fetchList(query) {
export
function
OffLineOrOnLine
(
data
)
{
return
request
({
url
:
'/api/account/update'
,
url
:
'/api/account/
list/
update'
,
method
:
'post'
,
data
})
...
...
@@ -31,4 +31,3 @@ export function fetchAccountDetail(id) {
param
:
{
id
}
})
}
This diff is collapsed.
Click to expand it.
vu/src/api/pick.js
View file @
9176b660
...
...
@@ -11,8 +11,33 @@ export function fetchList(query) {
export
function
OffLineOrOnLine
(
data
)
{
console
.
log
(
data
)
return
request
({
url
:
'/api/pick/
update_or_cre
ate'
,
url
:
'/api/pick/
list/upd
ate'
,
method
:
'post'
,
data
})
}
export
function
fetchPickDetail
(
id
)
{
return
request
({
url
:
'/api/account/detail'
,
method
:
'get'
,
param
:
{
id
}
})
}
export
function
CreatePick
(
data
)
{
return
request
({
url
:
'/api/pick/create'
,
method
:
'post'
,
data
})
}
export
function
fetchPPickDetail
(
id
)
{
return
request
({
url
:
'/api/pick/detail'
,
method
:
'get'
,
param
:
{
id
}
})
}
This diff is collapsed.
Click to expand it.
vu/src/views/group/list.vue
View file @
9176b660
...
...
@@ -54,7 +54,7 @@
<el-table-column
width=
"80px"
align=
"center"
label=
"帖子数"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
topic_num
}}
</span>
<span>
{{
scope
.
row
.
topic_num
s
}}
</span>
</
template
>
</el-table-column>
...
...
@@ -171,7 +171,7 @@ export default {
if
(
val
===
'offline'
){
this
.
multipleSelection
[
i
].
is_online
=
0
}
else
if
(
val
===
'recommend'
){
this
.
multipleSelection
[
i
].
is_recommend
=
0
this
.
multipleSelection
[
i
].
is_recommend
=
1
}
else
{
this
.
multipleSelection
[
i
].
is_online
=
1
}
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/pick/components/PickDetail.vue
View file @
9176b660
...
...
@@ -5,44 +5,41 @@
<sticky
:class-name=
"'sub-navbar '+postForm.status"
>
<el-button
v-loading=
"loading"
style=
"margin-left: 10px;"
type=
"success"
@
click=
"submitForm"
>
发布
</el-button>
<el-button
v-loading=
"loading"
type=
"warning"
@
click=
"draftForm"
>
草稿
</el-button>
</sticky>
<div
class=
"createPost-main-container"
>
<el-row>
<el-col
:span=
"24"
>
<el-form-item
style=
"margin-bottom: 40px;"
prop=
"
titl
e"
>
<MDinput
v-model=
"postForm.
titl
e"
:maxlength=
"100"
name=
"name"
required
>
标题
<el-form-item
style=
"margin-bottom: 40px;"
prop=
"
nam
e"
>
<MDinput
v-model=
"postForm.
nam
e"
:maxlength=
"100"
name=
"name"
required
>
pick名称
</MDinput>
</el-form-item>
<div
class=
"postInfo-container"
>
<el-row>
<el-col
:span=
"8"
>
<el-form-item
label-width=
"45px"
label=
"
作者:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"postForm.
author"
:remote-method=
"getRemoteUserList"
filterable
remote
placeholder=
"搜索用户"
>
<el-form-item
label-width=
"45px"
label=
"
性别:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"postForm.
gender"
:remote-method=
"getRemoteUserList"
filterable
remote
placeholder=
"搜索用户"
>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"10"
>
<el-form-item
label-width=
"80px"
label=
"发布时间:"
class=
"postInfo-container-item"
>
<el-date-picker
v-model=
"postForm.display_time"
type=
"datetime"
format=
"yyyy-MM-dd HH:mm:ss"
placeholder=
"选择日期时间"
/>
<el-col
:span=
"8"
>
<el-form-item
label-width=
"60px"
label=
"地区:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"postForm.region"
:remote-method=
"getRemoteUserList"
filterable
remote
placeholder=
"搜索用户"
>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"6"
>
<el-form-item
label-width=
"60px"
label=
"重要性:"
class=
"postInfo-container-item"
>
<el-rate
v-model=
"postForm.importance"
:max=
"3"
:colors=
"['#99A9BF', '#F7BA2A', '#FF9900']"
:low-threshold=
"1"
:high-threshold=
"3"
style=
"margin-top:8px;"
/>
<el-col
:span=
"8"
>
<el-form-item
label-width=
"60px"
label=
"属性:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"postForm.pick_type"
:remote-method=
"getRemoteUserList"
filterable
remote
placeholder=
"搜索用户"
>
<el-option
v-for=
"(item,index) in userListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
...
...
@@ -50,18 +47,22 @@
</el-col>
</el-row>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"45px"
label=
"摘要:"
>
<el-input
:rows=
"1"
v-model=
"postForm.content_short"
type=
"textarea"
class=
"article-textarea"
autosize
placeholder=
"请输入内容"
/>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"45px"
label=
"位置:"
prop=
"position"
>
<el-input
:rows=
"1"
v-model=
"postForm.position"
type=
"number"
class=
"article-textarea"
autosize
placeholder=
"请输入内容"
/>
</el-form-item>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"45px"
label=
"简介:"
prop=
"desc"
>
<el-input
:rows=
"1"
v-model=
"postForm.desc"
type=
"textarea"
class=
"article-textarea"
autosize
placeholder=
"请输入内容"
/>
<span
v-show=
"contentShortLength"
class=
"word-counter"
>
{{
contentShortLength
}}
字
</span>
</el-form-item>
<div
class=
"editor-container"
>
<Tinymce
ref=
"editor"
:height=
"400"
v-model=
"postForm.content"
/>
</div>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"45px"
label=
"下线:"
>
<el-radio-group
v-model=
"postForm.is_online"
>
<el-radio
:label=
"1"
>
是
</el-radio>
<el-radio
:label=
"0"
>
否
</el-radio>
</el-radio-group>
</el-form-item>
<div
style=
"margin-bottom: 20px;"
>
<Upload
v-model=
"postForm.image_uri"
/>
</div>
</div>
</el-form>
...
...
@@ -69,31 +70,25 @@
</
template
>
<
script
>
import
Tinymce
from
'@/components/Tinymce'
import
Upload
from
'@/components/Upload/singleImage3'
import
MDinput
from
'@/components/MDinput'
import
Sticky
from
'@/components/Sticky'
// 粘性header组件
import
{
validateURL
}
from
'@/utils/validate'
import
{
fetchArticle
}
from
'@/api/article'
import
{
fetchPickDetail
,
CreatePick
,
fetchPPickDetail
}
from
'@/api/pick'
import
{
userSearch
}
from
'@/api/remoteSearch'
const
defaultForm
=
{
status
:
'draft'
,
title
:
''
,
// 文章题目
content
:
''
,
// 文章内容
content_short
:
''
,
// 文章摘要
source_uri
:
''
,
// 文章外链
image_uri
:
''
,
// 文章图片
display_time
:
undefined
,
// 前台展示时间
id
:
undefined
,
platforms
:
[
'a-platform'
],
comment_disabled
:
false
,
importance
:
0
name
:
''
,
desc
:
''
,
gender
:
''
,
region
:
''
,
pick_type
:
''
,
position
:
''
,
is_online
:
1
,
}
export
default
{
name
:
'ArticleDetail'
,
components
:
{
Tinymce
,
MDinput
,
Upload
,
Sticky
},
components
:
{
MDinput
,
Sticky
},
props
:
{
isEdit
:
{
type
:
Boolean
,
...
...
@@ -112,40 +107,21 @@ export default {
callback
()
}
}
const
validateSourceUri
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
)
{
if
(
validateURL
(
value
))
{
callback
()
}
else
{
this
.
$message
({
message
:
'外链url填写不正确'
,
type
:
'error'
})
callback
(
new
Error
(
'外链url填写不正确'
))
}
}
else
{
callback
()
}
}
return
{
postForm
:
Object
.
assign
({},
defaultForm
),
loading
:
false
,
userListOptions
:
[],
rules
:
{
image_uri
:
[{
validator
:
validateRequire
}],
title
:
[{
validator
:
validateRequire
}],
content
:
[{
validator
:
validateRequire
}],
source_uri
:
[{
validator
:
validateSourceUri
,
trigger
:
'blur'
}]
name
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}],
desc
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}],
position
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}],
},
tempRoute
:
{}
}
},
computed
:
{
contentShortLength
()
{
return
this
.
postForm
.
content_short
.
length
},
lang
()
{
return
this
.
$store
.
getters
.
language
return
this
.
postForm
.
desc
.
length
}
},
created
()
{
...
...
@@ -156,42 +132,43 @@ export default {
this
.
postForm
=
Object
.
assign
({},
defaultForm
)
}
// Why need to make a copy of this.$route here?
// Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page
// https://github.com/PanJiaChen/vue-element-admin/issues/1221
this
.
tempRoute
=
Object
.
assign
({},
this
.
$route
)
},
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
}
`
fetchPPickDetail
(
id
).
then
(
response
=>
{
this
.
postForm
=
response
.
data
.
data
.
data
// Set tagsview title
this
.
setTagsViewTitle
()
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
setTagsViewTitle
()
{
const
title
=
this
.
lang
===
'zh'
?
'编辑文章'
:
'Edit Article'
const
route
=
Object
.
assign
({},
this
.
tempRoute
,
{
title
:
`
${
title
}
-
${
this
.
postForm
.
id
}
`
})
this
.
$store
.
dispatch
(
'updateVisitedView'
,
route
)
},
submitForm
()
{
this
.
postForm
.
display_time
=
parseInt
(
this
.
display_time
/
1000
)
console
.
log
(
this
.
postForm
)
this
.
$refs
.
postForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loading
=
true
CreatePick
(
this
.
postForm
).
then
(
response
=>
{
this
.
$notify
({
title
:
'成功'
,
message
:
'发布文章成功'
,
message
:
response
.
data
.
data
.
message
,
type
:
'success'
,
duration
:
2000
})
setTimeout
(()
=>
{
this
.
$router
.
push
(
'/pick/list'
)
},
1000
)
}).
catch
(
err
=>
{
this
.
$notify
({
title
:
'失败'
,
message
:
'操作失败'
,
type
:
'danger'
,
duration
:
2000
})
});
this
.
postForm
.
status
=
'published'
this
.
loading
=
false
}
else
{
...
...
@@ -200,22 +177,6 @@ export default {
}
})
},
draftForm
()
{
if
(
this
.
postForm
.
content
.
length
===
0
||
this
.
postForm
.
title
.
length
===
0
)
{
this
.
$message
({
message
:
'请填写必要的标题和内容'
,
type
:
'warning'
})
return
}
this
.
$message
({
message
:
'保存成功'
,
type
:
'success'
,
showClose
:
true
,
duration
:
1000
})
this
.
postForm
.
status
=
'draft'
},
getRemoteUserList
(
query
)
{
userSearch
(
query
).
then
(
response
=>
{
if
(
!
response
.
data
.
items
)
return
...
...
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