Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-ui
Commits
7210f85a
Commit
7210f85a
authored
Oct 29, 2020
by
徐一鸣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发文档fixed
parent
d7e9ff18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
44 deletions
+49
-44
src/components/doc-width-nav.vue
src/components/doc-width-nav.vue
+47
-44
src/pages/technical-support/doc-manage/list.vue
src/pages/technical-support/doc-manage/list.vue
+2
-0
No files found.
src/components/doc-width-nav.vue
View file @
7210f85a
...
...
@@ -65,57 +65,60 @@ export default {
},
methods
:
{
translate
()
{
let
content
=
this
.
richText
;
let
titles
=
content
.
match
(
/<h1
(([\s\S])
*
?)
<
\/
h1>|<h2
(([\s\S])
*
?)
<
\/
h2>|<h3
(([\s\S])
*
?)
<
\/
h3>/g
)
||
[];
let
time
=
new
Date
().
getTime
();
let
pre_h1_index
=
0
;
let
pre_h2_index
=
0
;
let
pre_h3_index
=
0
;
let
newTitles
=
titles
.
map
((
title
,
index
)
=>
{
let
newTitle
=
title
;
let
level
=
0
;
let
id
=
""
;
let
content
=
this
.
richText
||
""
;
if
(
title
.
match
(
/<h1
(([\s\S])
*
?)
<
\/
h1>/g
))
{
pre_h1_index
++
;
pre_h2_index
=
0
;
pre_h3_index
=
0
;
level
=
1
;
id
=
`nav_
${
pre_h1_index
}
`
+
"
_
"
+
time
;
if
(
content
)
{
let
titles
=
content
.
match
(
/<h1
(([\s\S])
*
?)
<
\/
h1>|<h2
(([\s\S])
*
?)
<
\/
h2>|<h3
(([\s\S])
*
?)
<
\/
h3>/g
)
||
[];
let
time
=
new
Date
().
getTime
();
let
pre_h1_index
=
0
;
let
pre_h2_index
=
0
;
let
pre_h3_index
=
0
;
let
newTitles
=
titles
.
map
((
title
,
index
)
=>
{
let
newTitle
=
title
;
let
level
=
0
;
let
id
=
""
;
newTitle
=
title
.
replace
(
/<h1/g
,
`<h1 id="
${
id
}
"`
);
}
else
if
(
title
.
match
(
/<h2
(([\s\S])
*
?)
<
\/
h2>/g
))
{
pre_h2_index
++
;
pre_h3_index
=
0
;
level
=
2
;
id
=
`nav_
${
pre_h1_index
}
_
${
pre_h2
_index
}
`
+
"
_
"
+
time
;
if
(
title
.
match
(
/<h1
(([\s\S])
*
?)
<
\/
h1>/g
))
{
pre_h1_index
++
;
pre_h2_index
=
0
;
pre_h3_index
=
0
;
level
=
1
;
id
=
`nav_
${
pre_h1
_index
}
`
+
"
_
"
+
time
;
newTitle
=
title
.
replace
(
/<h2/g
,
`<h2 id="
${
id
}
"`
);
}
else
if
(
title
.
match
(
/<h3
(([\s\S])
*
?)
<
\/
h3>/g
))
{
pre_h3_index
++
;
level
=
3
;
id
=
`nav_
${
pre_h1_index
}
_
${
pre_h2_index
}
_
${
pre_h3_index
}
`
;
newTitle
=
title
.
replace
(
/<h1/g
,
`<h1 id="
${
id
}
"`
);
}
else
if
(
title
.
match
(
/<h2
(([\s\S])
*
?)
<
\/
h2>/g
))
{
pre_h2_index
++
;
pre_h3_index
=
0
;
level
=
2
;
id
=
`nav_
${
pre_h1_index
}
_
${
pre_h2_index
}
`
+
"
_
"
+
time
;
newTitle
=
title
.
replace
(
/<h3/g
,
`<h3 id="
${
id
}
"`
)
+
"
_
"
+
time
;
}
newTitle
=
title
.
replace
(
/<h2/g
,
`<h2 id="
${
id
}
"`
);
}
else
if
(
title
.
match
(
/<h3
(([\s\S])
*
?)
<
\/
h3>/g
))
{
pre_h3_index
++
;
level
=
3
;
id
=
`nav_
${
pre_h1_index
}
_
${
pre_h2_index
}
_
${
pre_h3_index
}
`
;
content
=
content
.
replace
(
new
RegExp
(
title
),
newTitle
);
newTitle
=
title
.
replace
(
/<h3/g
,
`<h3 id="
${
id
}
"`
)
+
"
_
"
+
time
;
}
return
{
level
,
id
,
title
:
title
.
replace
(
/<
\/?
.+
?
>/g
,
""
),
};
})
.
filter
((
item
)
=>
item
.
title
);
content
=
content
.
replace
(
new
RegExp
(
title
),
newTitle
);
this
.
content
=
content
;
this
.
navTree
=
newTitles
;
this
.
curNav
=
(
newTitles
[
0
]
&&
newTitles
[
0
].
id
)
||
""
;
return
{
level
,
id
,
title
:
title
.
replace
(
/<
\/?
.+
?
>/g
,
""
),
};
})
.
filter
((
item
)
=>
item
.
title
);
this
.
content
=
content
;
this
.
navTree
=
newTitles
;
this
.
curNav
=
(
newTitles
[
0
]
&&
newTitles
[
0
].
id
)
||
""
;
}
},
clickNav
(
item
)
{
let
target
=
document
.
querySelector
(
`#
${
item
.
id
}
`
);
...
...
src/pages/technical-support/doc-manage/list.vue
View file @
7210f85a
...
...
@@ -272,6 +272,7 @@ export default {
this
.
$http
.
get
(
"
/apaas/support/document/list
"
,
{
params
:
{
search
:
fullFilter
.
name
,
style
:
fullFilter
.
type
,
start
:
fullFilter
.
time
&&
fullFilter
.
time
[
0
],
end
:
fullFilter
.
time
&&
fullFilter
.
time
[
1
],
...
...
@@ -350,6 +351,7 @@ export default {
style
:
0
,
title
:
""
,
};
this
.
$refs
.
addForm
&&
this
.
$refs
.
addForm
.
clearValidate
();
this
.
$refs
.
addDialog
.
show
();
},
AddCancelAction
()
{
...
...
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