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
088af47b
Commit
088af47b
authored
Nov 28, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善推送
parent
4e806b9f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
15 deletions
+61
-15
push.py
api/push.py
+16
-2
urls.py
api/urls.py
+1
-0
push.js
vu/src/api/push.js
+8
-0
index.vue
vu/src/components/Sticky/index.vue
+1
-1
singleImage3.vue
vu/src/components/Upload/singleImage3.vue
+1
-1
list.vue
vu/src/views/account/list.vue
+1
-0
PushDetail.vue
vu/src/views/push/components/PushDetail.vue
+28
-11
Warning.vue
vu/src/views/push/components/Warning.vue
+5
-0
No files found.
api/push.py
View file @
088af47b
...
...
@@ -42,9 +42,22 @@ class PushUpdateOrCreateView(APIView):
'creator_id'
:
creator_id
}
try
:
self
.
rpc
[
'venus/sun/push/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
rep
=
self
.
rpc
[
'venus/sun/push/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
"message"
:
'更新成功'
"message"
:
'更新成功'
,
"id"
:
rep
[
'id'
]
}
class
EffectPushTaskView
(
APIView
):
def
get
(
self
,
request
):
push_task_id
=
request
.
GET
.
get
(
'id'
)
try
:
self
.
rpc
[
'venus/sun/push/effect_push_task'
](
id
=
push_task_id
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'message'
:
'操作成功'
}
\ No newline at end of file
api/urls.py
View file @
088af47b
...
...
@@ -60,6 +60,7 @@ urlpatterns = [
url
(
r'push/list$'
,
PushListView
.
as_view
()),
url
(
r'push/create'
,
PushUpdateOrCreateView
.
as_view
()),
url
(
r'push/detail'
,
PushUpdateOrCreateView
.
as_view
()),
url
(
r'push/effect_push'
,
EffectPushTaskView
.
as_view
()),
# pick相关
url
(
r'pick/list$'
,
PickListView
.
as_view
()),
...
...
vu/src/api/push.js
View file @
088af47b
...
...
@@ -32,3 +32,11 @@ export function fetchPushDetail(id) {
params
:
{
id
}
})
}
export
function
EffectPushTask
(
id
)
{
return
request
({
url
:
'/api/push/effect_push'
,
method
:
'get'
,
params
:
{
id
}
})
}
vu/src/components/Sticky/index.vue
View file @
088af47b
...
...
@@ -2,7 +2,7 @@
<div
:style=
"
{height:height+'px',zIndex:zIndex}">
<div
:class=
"className"
:style=
"
{top:stickyTop+'px',zIndex:zIndex,position:position,width:width,height:height+'px'}">
<slot>
<div>
sticky
</div>
<div></div>
</slot>
</div>
</div>
...
...
vu/src/components/Upload/singleImage3.vue
View file @
088af47b
...
...
@@ -21,7 +21,7 @@
<!--
</div>
-->
<div
class=
"image-preview"
>
<div
v-show=
"imageUrl.length>1"
class=
"image-preview-wrapper"
>
<img
:src=
"imageUrl"
>
<img
:src=
"imageUrl"
:disabled=
"true"
>
<div
class=
"image-preview-action"
>
<i
class=
"el-icon-delete"
@
click=
"rmImage"
/>
</div>
...
...
vu/src/views/account/list.vue
View file @
088af47b
...
...
@@ -39,6 +39,7 @@
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page=
"listQuery.page"
:limit=
"listQuery.limit"
style=
"margin-left: 150px;"
@
pagination=
"getList"
/>
...
...
vu/src/views/push/components/PushDetail.vue
View file @
088af47b
...
...
@@ -3,16 +3,16 @@
<el-form
ref=
"postForm"
:model=
"postForm"
:rules=
"rules"
class=
"form-container"
>
<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"
style=
"margin-left: 10px;"
type=
"success"
@
click=
"
effectPush"
v-if=
"isEdit && !is_effect"
>
生效
</el-button>
<
el-button
v-loading=
"loading"
style=
"margin-left: 10px;"
type=
"success"
@
click=
"submitForm"
v-if=
"!is_effect"
>
保存
<
/el-button>
</sticky>
<div
class=
"createPost-main-container"
>
<el-row>
<Warning
v-if=
"isEdit"
/>
<el-col
:span=
"24"
>
<el-form-item
style=
"margin-bottom: 40px;"
prop=
"title"
>
<MDinput
v-model=
"postForm.title"
:maxlength=
"100"
name=
"title"
required
>
<MDinput
v-model=
"postForm.title"
:maxlength=
"100"
name=
"title"
required
>
推送标题
</MDinput>
</el-form-item>
...
...
@@ -67,14 +67,14 @@
</el-row>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"75px"
label=
"推送内容:"
prop=
"content"
>
<el-input
:rows=
"1"
v-model=
"postForm.content"
type=
"textarea"
class=
"article-textarea"
autosize
placeholder=
"请输入内容"
/>
<el-input
:rows=
"1"
v-model=
"postForm.content"
type=
"textarea"
class=
"article-textarea"
autosize
placeholder=
"请输入内容"
/>
<span
v-show=
"contentShortLength"
class=
"word-counter"
>
{{
contentShortLength
}}
字
</span>
</el-form-item>
<div
style=
"margin-bottom: 20px;"
>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"75px"
label=
"推送头像:"
prop=
"icon"
>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"75px"
label=
"推送头像:"
prop=
"icon"
:disabled=
"is_effect"
>
<span
v-model=
"uploadType"
></span>
<Upload
v-model=
"postForm.icon"
:uploadType=
"uploadType"
/>
<Upload
v-model=
"postForm.icon"
:uploadType=
"uploadType"
/>
</el-form-item>
</div>
</div>
...
...
@@ -87,8 +87,9 @@
import
Upload
from
'@/components/Upload/singleImage3'
import
MDinput
from
'@/components/MDinput'
import
Sticky
from
'@/components/Sticky'
// 粘性header组件
import
Warning
from
'./Warning'
import
{
validateURL
}
from
'@/utils/validate'
import
{
fetchPushDetail
,
CreatePush
}
from
'@/api/push'
import
{
fetchPushDetail
,
CreatePush
,
EffectPushTask
}
from
'@/api/push'
const
defaultForm
=
{
status
:
'draft'
,
...
...
@@ -97,12 +98,12 @@ const defaultForm = {
icon
:
''
,
push_time
:
''
,
url
:
''
,
creator_name
:
''
creator_name
:
''
,
}
export
default
{
name
:
'PushDetail'
,
components
:
{
MDinput
,
Upload
,
Sticky
},
components
:
{
MDinput
,
Upload
,
Sticky
,
Warning
},
props
:
{
isEdit
:
{
type
:
Boolean
,
...
...
@@ -138,7 +139,8 @@ export default {
push_time
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}],
},
tempRoute
:
{},
uploadType
:
1
// 图片类型
uploadType
:
1
,
// 图片类型
is_effect
:
false
,
}
},
computed
:
{
...
...
@@ -160,6 +162,7 @@ export default {
fetchData
(
id
)
{
fetchPushDetail
(
id
).
then
(
response
=>
{
this
.
postForm
=
response
.
data
.
data
.
data
this
.
is_effect
=
Boolean
(
response
.
data
.
data
.
data
.
is_effect
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
...
...
@@ -197,6 +200,20 @@ export default {
}
})
},
effectPush
()
{
this
.
is_effect
=
Boolean
(
1
);
const
id
=
this
.
$route
.
params
&&
this
.
$route
.
params
.
id
EffectPushTask
(
id
).
then
(
response
=>
{
console
.
log
(
response
.
data
.
data
.
message
)
this
.
$message
({
message
:
response
.
data
.
data
.
message
,
type
:
'success'
})
this
.
$router
.
go
(
0
)
}).
catch
(
err
=>
{
})
}
}
}
</
script
>
...
...
vu/src/views/push/components/Warning.vue
0 → 100644
View file @
088af47b
<
template
>
<p
class=
"warn-content"
style=
"text-align: center"
>
点击生效以后,页面所有内容不可进行编辑,请谨慎操作!!
</p>
</
template
>
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