修改article路由

This commit is contained in:
jmal 2020-03-12 18:03:46 +08:00
parent 0e2b0a37da
commit 51e4c85019
4 changed files with 15 additions and 7 deletions

View File

@ -126,7 +126,7 @@ export const constantRoutes = [
},
{
path: '/public/article',
path: '/public/articles/article',
component: Layout,
children: [
{

View File

@ -1422,7 +1422,7 @@ export default {
if(row.contentType.includes('text')){
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
// window.open(routeData.href, '_blank');
this.$router.push(`/public/article?mark=${row.id}`)
this.$router.push(`/public/articles/article?mark=${row.id}`)
}else{
// 打开文件
const fileIds = [row.id]

View File

@ -769,7 +769,7 @@
if(row.contentType.includes('text')){
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
// window.open(routeData.href, '_blank');
this.$router.push(`/public/article?mark=${row.id}`)
this.$router.push(`/public/articles/article?mark=${row.id}`)
}else{
// 打开文件
const fileIds = [row.id]

View File

@ -91,7 +91,9 @@
a = a.splice(a.length/2,a.length)
for (let i = 0; i < a.length; i++) {
a[i] = a[i].replace(/id="/g, 'href="#')
if (a[i].indexOf('h2') != -1) {
if (a[i].indexOf('h1') === 1) {
a[i] = '<li first>' + a[i].replace(/<h1>|<\/h1>/g, '') + '</li>'
}else if (a[i].indexOf('h2') !== -1) {
a[i] = '<li class="pl">' + a[i].replace(/<h2>|<\/h2>/g, '') + '</li>'
} else {
a[i] = '<li>' + a[i].replace(/<h1>|<\/h1>/g, '') + '</li>'
@ -115,9 +117,15 @@
let $root = $('html, body');
$('.j-titleList li').on("click", function () {
console.log(typeof($(this).attr("first"))!=="undefined")
let top = 20
if (typeof($(this).attr("first"))!=="undefined") {
// 点击第一个目录
top = 50
}
$root.animate({
scrollTop: $($.attr(this.querySelector("a"), 'href')).offset().top - 20
}, 400);
scrollTop: $($.attr(this.querySelector("a"), 'href')).offset().top - top
}, 400)
return false
});
}
@ -126,7 +134,7 @@
setTimeout(function () {
addCodeBtn();
_this.isLoading = false
},100)
},150)
})