Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
王水玲
7 years ago
Commit
175d074d0c16ade3f7e1f865a6174da37e40620f
2 parents
d50247b1
44c6a6bb
Merge branch 'release/0704' of git.yoho.cn:fe/yohobuywap-node into release/0704
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
apps/3party/controllers/question.js
public/js/3party/question-detail.page.js
apps/3party/controllers/question.js
View file @
175d074
...
...
@@ -5,6 +5,7 @@ const semver = require('semver');
const
questionModel
=
require
(
'../models/question'
);
const
headerModel
=
require
(
'../../../doraemon/models/header'
);
// 头部model
const
geetest
=
require
(
'../../passport/controllers/geetest'
);
const
cleanHtml
=
require
(
'../../../utils/cleanHtml'
);
exports
.
list
=
(
req
,
res
,
next
)
=>
{
let
canShare
=
false
;
...
...
@@ -92,6 +93,15 @@ exports.submit = (req, res, next) => {
params
.
sourceType
=
'PC'
;
}
let
frontAnswers
=
JSON
.
parse
(
params
.
frontAnswers
||
'[]'
)
||
[];
_
.
each
(
frontAnswers
,
item
=>
{
if
(
item
.
addon
)
{
item
.
addon
=
cleanHtml
.
htmlEncode
(
item
.
addon
);
}
});
params
.
frontAnswers
=
JSON
.
stringify
(
frontAnswers
);
req
.
ctx
(
questionModel
).
submitQuestion
(
params
).
then
(
result
=>
{
res
.
send
(
result
);
}).
catch
(
next
);
...
...
public/js/3party/question-detail.page.js
View file @
175d074
...
...
@@ -110,11 +110,24 @@ let question = {
}
$wrap
.
slideDown
();
},
_validationPartten
:
function
(
val
)
{
let
validationPartten
=
/
[
'"<>&
\|]
|--/g
,
matchChars
,
errText
;
if
(
validationPartten
.
test
(
val
))
{
matchChars
=
val
.
match
(
validationPartten
).
join
(
' '
);
errText
=
'不可以输入 '
+
matchChars
+
' 哦!'
;
}
return
errText
;
},
packAnswersInfo
:
function
()
{
let
that
=
this
;
let
answer
=
[];
let
$errDom
;
this
.
$item
.
each
(
function
()
{
let
$this
=
$
(
this
);
...
...
@@ -136,13 +149,12 @@ let question = {
answerIndex
:
ans
.
length
,
addon
:
val
});
errText
=
that
.
_validationPartten
(
val
);
}
if
(
val
.
length
>
400
)
{
errText
=
'输入内容过长'
;
}
});
}
else
{
$this
.
find
(
'.on'
).
each
(
function
()
{
...
...
@@ -155,6 +167,7 @@ let question = {
if
(
$input
&&
$input
.
length
)
{
a
.
addon
=
$input
.
val
();
errText
=
that
.
_validationPartten
(
a
.
addon
);
}
ans
.
push
(
a
);
...
...
Please
register
or
login
to post a comment