Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
solo-1
Commits
e59c3495
Unverified
Commit
e59c3495
authored
Mar 04, 2019
by
Van
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
♻
#12669
parent
7a81c585
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
35 deletions
+24
-35
src/main/webapp/js/admin/article.js
src/main/webapp/js/admin/article.js
+24
-35
No files found.
src/main/webapp/js/admin/article.js
View file @
e59c3495
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
*
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.6.0.
3, Feb 15
, 2019
* @version 1.6.0.
4, Mar 4
, 2019
*/
*/
admin
.
article
=
{
admin
.
article
=
{
// 当发文章,取消发布,更新文章时设置为 false。不需在离开编辑器时进行提示。
// 当发文章,取消发布,更新文章时设置为 false。不需在离开编辑器时进行提示。
...
@@ -28,7 +28,6 @@ admin.article = {
...
@@ -28,7 +28,6 @@ admin.article = {
status
:
{
status
:
{
id
:
undefined
,
id
:
undefined
,
isArticle
:
undefined
,
isArticle
:
undefined
,
articleHadBeenPublished
:
undefined
,
},
},
content
:
''
,
content
:
''
,
// 自动保存草稿定时器
// 自动保存草稿定时器
...
@@ -65,7 +64,6 @@ admin.article = {
...
@@ -65,7 +64,6 @@ admin.article = {
// set default value for article.
// set default value for article.
$
(
'
#title
'
).
val
(
result
.
article
.
articleTitle
)
$
(
'
#title
'
).
val
(
result
.
article
.
articleTitle
)
admin
.
article
.
status
.
articleHadBeenPublished
=
result
.
article
.
articleHadBeenPublished
admin
.
editors
.
articleEditor
.
setContent
(
result
.
article
.
articleContent
)
admin
.
editors
.
articleEditor
.
setContent
(
result
.
article
.
articleContent
)
admin
.
editors
.
abstractEditor
.
setContent
(
result
.
article
.
articleAbstract
)
admin
.
editors
.
abstractEditor
.
setContent
(
result
.
article
.
articleAbstract
)
admin
.
article
.
content
=
admin
.
editors
.
articleEditor
.
getContent
()
admin
.
article
.
content
=
admin
.
editors
.
articleEditor
.
getContent
()
...
@@ -134,10 +132,10 @@ admin.article = {
...
@@ -134,10 +132,10 @@ admin.article = {
},
},
/**
/**
* @@description 添加文章
* @@description 添加文章
* @param {Boolean} article
IsPublished 文章是否发布过
* @param {Boolean} article
Status 0:已发布,1:草稿
* @param {Boolean} isAuto 是否为自动保存
* @param {Boolean} isAuto 是否为自动保存
*/
*/
add
:
function
(
article
IsPublished
,
isAuto
)
{
add
:
function
(
article
Status
,
isAuto
)
{
if
(
admin
.
article
.
validate
())
{
if
(
admin
.
article
.
validate
())
{
var
that
=
this
var
that
=
this
that
.
_addDisabled
()
that
.
_addDisabled
()
...
@@ -156,7 +154,9 @@ admin.article = {
...
@@ -156,7 +154,9 @@ admin.article = {
if
(
$
(
'
#articleThumbnail
'
).
prop
(
'
checked
'
))
{
if
(
$
(
'
#articleThumbnail
'
).
prop
(
'
checked
'
))
{
var
bgImage
=
$
(
'
.thumbnail__img
'
).
css
(
'
background-image
'
)
var
bgImage
=
$
(
'
.thumbnail__img
'
).
css
(
'
background-image
'
)
articleContent
=
'
.
replace
(
'
w/768
'
,
'
w/960
'
).
replace
(
'
h/432
'
,
'
h/540
'
)
+
articleContent
=
'
.
replace
(
'
w/768
'
,
'
w/960
'
).
replace
(
'
h/432
'
,
'
h/540
'
)
+
'
)
\n\n
'
+
articleContent
'
)
\n\n
'
+
articleContent
}
}
...
@@ -167,7 +167,7 @@ admin.article = {
...
@@ -167,7 +167,7 @@ admin.article = {
'
articleAbstract
'
:
articleAbstract
,
'
articleAbstract
'
:
articleAbstract
,
'
articleTags
'
:
this
.
trimUniqueArray
(
$
(
'
#tag
'
).
val
()).
toString
(),
'
articleTags
'
:
this
.
trimUniqueArray
(
$
(
'
#tag
'
).
val
()).
toString
(),
'
articlePermalink
'
:
$
(
'
#permalink
'
).
val
(),
'
articlePermalink
'
:
$
(
'
#permalink
'
).
val
(),
'
article
IsPublished
'
:
articleIsPublished
,
'
article
Status
'
:
articleStatus
,
'
articleSignId
'
:
signId
,
'
articleSignId
'
:
signId
,
'
postToCommunity
'
:
$
(
'
#postToCommunity
'
).
prop
(
'
checked
'
),
'
postToCommunity
'
:
$
(
'
#postToCommunity
'
).
prop
(
'
checked
'
),
'
articleCommentable
'
:
$
(
'
#articleCommentable
'
).
prop
(
'
checked
'
),
'
articleCommentable
'
:
$
(
'
#articleCommentable
'
).
prop
(
'
checked
'
),
...
@@ -192,7 +192,7 @@ admin.article = {
...
@@ -192,7 +192,7 @@ admin.article = {
return
return
}
}
if
(
article
IsPublished
)
{
if
(
article
Status
===
0
)
{
admin
.
article
.
status
.
id
=
undefined
admin
.
article
.
status
.
id
=
undefined
admin
.
selectTab
(
'
article/article-list
'
)
admin
.
selectTab
(
'
article/article-list
'
)
}
else
{
}
else
{
...
@@ -201,23 +201,19 @@ admin.article = {
...
@@ -201,23 +201,19 @@ admin.article = {
admin
.
article
.
isConfirm
=
false
admin
.
article
.
isConfirm
=
false
},
},
complete
:
function
(
jqXHR
,
textStatus
)
{
complete
:
function
()
{
that
.
_removeDisabled
()
that
.
_removeDisabled
()
$
(
'
#loadMsg
'
).
text
(
''
)
$
(
'
#loadMsg
'
).
text
(
''
)
if
(
jqXHR
.
status
===
403
)
{
$
.
get
(
'
/admin-index.do
'
)
that
.
add
(
articleIsPublished
)
}
},
},
})
})
}
}
},
},
/**
/**
* @description 更新文章
* @description 更新文章
* @param {Boolean} article
IsPublished 文章是否发布过
* @param {Boolean} article
Status 0:已发布,1:草稿
* @param {Boolean} isAuto 是否为自动保存
* @param {Boolean} isAuto 是否为自动保存
*/
*/
update
:
function
(
article
IsPublished
,
isAuto
)
{
update
:
function
(
article
Status
,
isAuto
)
{
if
(
admin
.
article
.
validate
())
{
if
(
admin
.
article
.
validate
())
{
var
that
=
this
var
that
=
this
that
.
_addDisabled
()
that
.
_addDisabled
()
...
@@ -235,7 +231,9 @@ admin.article = {
...
@@ -235,7 +231,9 @@ admin.article = {
articleAbstract
=
admin
.
editors
.
abstractEditor
.
getContent
()
articleAbstract
=
admin
.
editors
.
abstractEditor
.
getContent
()
if
(
$
(
'
#articleThumbnail
'
).
prop
(
'
checked
'
))
{
if
(
$
(
'
#articleThumbnail
'
).
prop
(
'
checked
'
))
{
var
bgImage
=
$
(
'
.thumbnail__img
'
).
css
(
'
background-image
'
)
var
bgImage
=
$
(
'
.thumbnail__img
'
).
css
(
'
background-image
'
)
articleContent
=
'
.
replace
(
'
w/768
'
,
'
w/960
'
).
replace
(
'
h/432
'
,
'
h/540
'
)
+
articleContent
=
'
.
replace
(
'
w/768
'
,
'
w/960
'
).
replace
(
'
h/432
'
,
'
h/540
'
)
+
'
)
\n\n
'
+
articleContent
'
)
\n\n
'
+
articleContent
}
}
var
requestJSONObject
=
{
var
requestJSONObject
=
{
...
@@ -246,7 +244,7 @@ admin.article = {
...
@@ -246,7 +244,7 @@ admin.article = {
'
articleAbstract
'
:
articleAbstract
,
'
articleAbstract
'
:
articleAbstract
,
'
articleTags
'
:
this
.
trimUniqueArray
(
$
(
'
#tag
'
).
val
()).
toString
(),
'
articleTags
'
:
this
.
trimUniqueArray
(
$
(
'
#tag
'
).
val
()).
toString
(),
'
articlePermalink
'
:
$
(
'
#permalink
'
).
val
(),
'
articlePermalink
'
:
$
(
'
#permalink
'
).
val
(),
'
article
IsPublished
'
:
articleIsPublished
,
'
article
Status
'
:
articleStatus
,
'
articleSignId
'
:
signId
,
'
articleSignId
'
:
signId
,
'
articleCommentable
'
:
$
(
'
#articleCommentable
'
).
prop
(
'
checked
'
),
'
articleCommentable
'
:
$
(
'
#articleCommentable
'
).
prop
(
'
checked
'
),
'
articleViewPwd
'
:
$
(
'
#viewPwd
'
).
val
(),
'
articleViewPwd
'
:
$
(
'
#viewPwd
'
).
val
(),
...
@@ -270,7 +268,7 @@ admin.article = {
...
@@ -270,7 +268,7 @@ admin.article = {
return
return
}
}
if
(
article
IsPublished
)
{
if
(
article
Status
===
0
)
{
admin
.
selectTab
(
'
article/article-list
'
)
admin
.
selectTab
(
'
article/article-list
'
)
}
else
{
}
else
{
admin
.
selectTab
(
'
article/draft-list
'
)
admin
.
selectTab
(
'
article/draft-list
'
)
...
@@ -284,10 +282,6 @@ admin.article = {
...
@@ -284,10 +282,6 @@ admin.article = {
complete
:
function
(
jqXHR
,
textStatus
)
{
complete
:
function
(
jqXHR
,
textStatus
)
{
that
.
_removeDisabled
()
that
.
_removeDisabled
()
$
(
'
#loadMsg
'
).
text
(
''
)
$
(
'
#loadMsg
'
).
text
(
''
)
if
(
jqXHR
.
status
===
403
)
{
$
.
get
(
'
/admin-index.do
'
)
that
.
update
(
articleIsPublished
)
}
},
},
})
})
}
}
...
@@ -348,7 +342,6 @@ admin.article = {
...
@@ -348,7 +342,6 @@ admin.article = {
this
.
status
=
{
this
.
status
=
{
id
:
undefined
,
id
:
undefined
,
isArticle
:
undefined
,
isArticle
:
undefined
,
articleHadBeenPublished
:
undefined
,
}
}
this
.
setStatus
()
this
.
setStatus
()
...
@@ -422,17 +415,17 @@ admin.article = {
...
@@ -422,17 +415,17 @@ admin.article = {
// submit action
// submit action
$
(
'
#submitArticle
'
).
click
(
function
()
{
$
(
'
#submitArticle
'
).
click
(
function
()
{
if
(
admin
.
article
.
status
.
id
)
{
if
(
admin
.
article
.
status
.
id
)
{
admin
.
article
.
update
(
true
)
admin
.
article
.
update
(
0
)
}
else
{
}
else
{
admin
.
article
.
add
(
true
)
admin
.
article
.
add
(
0
)
}
}
})
})
$
(
'
#saveArticle
'
).
click
(
function
()
{
$
(
'
#saveArticle
'
).
click
(
function
()
{
if
(
admin
.
article
.
status
.
id
)
{
if
(
admin
.
article
.
status
.
id
)
{
admin
.
article
.
update
(
admin
.
article
.
status
.
isArticle
)
admin
.
article
.
update
(
admin
.
article
.
status
.
isArticle
?
0
:
1
)
}
else
{
}
else
{
admin
.
article
.
add
(
false
)
admin
.
article
.
add
(
1
)
}
}
})
})
...
@@ -442,14 +435,14 @@ admin.article = {
...
@@ -442,14 +435,14 @@ admin.article = {
height
:
500
,
height
:
500
,
fun
:
fun
,
fun
:
fun
,
previewShow
:
true
,
previewShow
:
true
,
resize
:
false
resize
:
false
,
})
})
admin
.
editors
.
abstractEditor
=
new
SoloEditor
({
admin
.
editors
.
abstractEditor
=
new
SoloEditor
({
id
:
'
abstract
'
,
id
:
'
abstract
'
,
height
:
200
,
height
:
200
,
previewShow
:
false
,
previewShow
:
false
,
resize
:
true
resize
:
true
,
})
})
admin
.
article
.
clearDraftTimer
()
admin
.
article
.
clearDraftTimer
()
...
@@ -486,10 +479,10 @@ admin.article = {
...
@@ -486,10 +479,10 @@ admin.article = {
}
}
if
(
admin
.
article
.
status
.
id
)
{
if
(
admin
.
article
.
status
.
id
)
{
if
(
!
admin
.
article
.
status
.
isArticle
)
{
if
(
!
admin
.
article
.
status
.
isArticle
)
{
admin
.
article
.
update
(
false
,
true
)
admin
.
article
.
update
(
1
,
true
)
}
}
}
else
{
}
else
{
admin
.
article
.
add
(
false
,
true
)
admin
.
article
.
add
(
1
,
true
)
admin
.
article
.
status
.
isArticle
=
false
admin
.
article
.
status
.
isArticle
=
false
}
}
},
},
...
@@ -548,10 +541,6 @@ admin.article = {
...
@@ -548,10 +541,6 @@ admin.article = {
complete
:
function
(
jqXHR
,
textStatus
)
{
complete
:
function
(
jqXHR
,
textStatus
)
{
that
.
_removeDisabled
()
that
.
_removeDisabled
()
$
(
'
#loadMsg
'
).
text
(
''
)
$
(
'
#loadMsg
'
).
text
(
''
)
if
(
jqXHR
.
status
===
403
)
{
$
.
get
(
'
/admin-index.do
'
)
that
.
unPublish
()
}
},
},
})
})
},
},
...
...
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