Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
marketing
Overview
Overview
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
marketing-web
marketing
Commits
3a823290
Commit
3a823290
authored
Jul 12, 2021
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复短信营销-短信模板插入链接的bug
parent
85d51411
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
addTemp.vue
src/views/message/addTemp.vue
+32
-2
No files found.
src/views/message/addTemp.vue
View file @
3a823290
...
...
@@ -136,6 +136,31 @@ export default {
name
:
'add-temp'
,
components
:
{
linktools
}
,
data
()
{
const
valiContent
=
(
rules
,
value
,
callback
)
=>
{
// 如果是通过链接小工具生成的链接,并且链接前或者后无空格时,自动补齐空格
if
(
Array
.
isArray
(
this
.
insertLink
.
inserted
))
{
this
.
insertLink
.
inserted
.
forEach
(
el
=>
{
// 校验content中所有链接的前面或者后面都有一个空格
const
reg
=
new
RegExp
(
`${el
}
`
,
'g'
);
value
=
value
.
replace
(
reg
,
(
str
,
index
)
=>
{
if
(
value
[
index
-
1
]
!=
' '
)
{
str
=
' '
+
str
;
}
if
(
value
[
index
+
str
.
length
]
!=
' '
)
{
str
=
str
+
' '
;
}
return
str
;
}
);
}
);
}
this
.
form
.
content
=
value
;
// 如果是复制的链接,提示链接后面需要保留一个空格,如果用户不添加空格则无法保存
const
urlReg
=
/
(\s
https
?
|ftp|file
)
:
\/\/[
-A-Za-z0-9+&@#
\/
%?=~_|!:,.;
]
+
[
-A-Za-z0-9+&@#
\/
%=~_|
]\s
/g
;
if
(
!
urlReg
.
test
(
value
))
{
return
callback
(
new
Error
(
'链接前面和后面需要保留一个空格!'
));
}
callback
();
}
;
return
{
loading
:
false
,
form
:
{
...
...
@@ -150,7 +175,10 @@ export default {
rules
:
{
title
:
{
required
:
true
,
message
:
'请输入模板名称'
,
trigger
:
'blur'
}
,
type
:
{
required
:
true
,
message
:
'请选择短信类型'
,
trigger
:
'blur'
}
,
content
:
{
required
:
true
,
message
:
'请输入短信内容'
,
trigger
:
'blur'
}
,
content
:
[
{
required
:
true
,
message
:
'请输入短信内容'
,
trigger
:
'blur'
}
,
{
validator
:
valiContent
,
trigger
:
'blur'
}
],
remark
:
{
required
:
true
,
message
:
'请输入申请说明'
,
trigger
:
'blur'
}
}
,
editFlag
:
this
.
$route
.
meta
.
type
===
'edit'
,
...
...
@@ -163,7 +191,8 @@ export default {
// 插入小程序链接相关
insertLink
:
{
show
:
false
,
link
:
''
link
:
''
,
inserted
:
[]
// 已经插入到短信内容的链接,用来校验在短信文本中链接前后是否有空格
}
,
// 转换链接
transferLink
:
{
...
...
@@ -300,6 +329,7 @@ export default {
this
.
insertLink
.
show
=
false
;
this
.
reduceLink
.
show
=
false
;
this
.
transferLink
.
show
=
false
;
this
.
insertLink
.
inserted
.
push
(
this
.
insertLink
.
link
);
}
}
}
;
...
...
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