界面优化,markdown渲染优化

This commit is contained in:
sswiki
2024-12-09 22:14:51 +08:00
parent 4ad463845e
commit d6bcfc5492
68 changed files with 1885 additions and 1203 deletions

View File

@@ -1,5 +1,5 @@
import Qs from 'qs'
import request from './request'
import Qs from 'qs';
import request from './request';
export default {
getUserBaseInfo: (data) => {

View File

@@ -1,5 +1,5 @@
import Qs from 'qs'
import request from './request'
import Qs from 'qs';
import request from './request';
export default {
pageUpdate: (data) => request({url: '/zyplayer-doc-wiki/page/update', method: 'post', data: Qs.stringify(data)}),

View File

@@ -1,54 +1,54 @@
import axios from 'axios'
import {ElMessageBox, ElMessage} from 'element-plus'
import axios from 'axios';
import {ElMessageBox, ElMessage} from 'element-plus';
const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API, // url = base url + request url process.env.APP_BASE_API
timeout: 10000,
headers: {'Content-type': 'application/x-www-form-urlencoded'},
withCredentials: true,
})
});
// 增加不需要验证结果的标记
const noValidate = {
'/zyplayer-doc-db/executor/execute': true,
}
service.interceptors.request.use((config) => {
config.needValidateResult = true
config.needValidateResult = true;
// 增加不需要验证结果的标记
if (noValidate[config.url]) {
config.needValidateResult = false
config.needValidateResult = false;
}
return config
return config;
}, (error) => {
console.log(error)
return Promise.reject(error)
console.log(error);
return Promise.reject(error);
}
)
);
let lastToastLoginTime = new Date().getTime();
service.interceptors.response.use(
(response) => {
if (!!response.message) {
ElMessage.error('请求错误:' + response.message)
ElMessage.error('请求错误:' + response.message);
} else {
if (!response.config.needValidateResult || response.data.errCode === 200) {
return response.data
return response.data;
} else if (response.data.errCode === 400) {
// 两秒钟只提示一次
if (new Date().getTime() - lastToastLoginTime > 2000) {
ElMessage.warning('请先登录');
lastToastLoginTime = new Date().getTime();
}
let href = encodeURIComponent(window.location.href)
window.location = import.meta.env.VITE_APP_BASE_API + '#/user/login?redirect=' + href
let href = encodeURIComponent(window.location.href);
window.location = import.meta.env.VITE_APP_BASE_API + '#/user/login?redirect=' + href;
} else if (response.data.errCode !== 200) {
ElMessage.error(response.data.errMsg || '未知错误')
ElMessage.error(response.data.errMsg || '未知错误');
}
}
return Promise.reject('请求错误')
return Promise.reject('请求错误');
}, (error) => {
console.log('err' + error)
ElMessage.info('请求错误:' + error.message)
return Promise.reject(error)
console.log('err' + error);
ElMessage.info('请求错误:' + error.message);
return Promise.reject(error);
}
)
);
export default service

View File

@@ -1,5 +1,5 @@
import Qs from 'qs'
import request from './request'
import Qs from 'qs';
import request from './request';
export default {
systemUpgradeInfo: (data) => request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)}),

View File

@@ -1,5 +1,5 @@
import Qs from 'qs'
import request from './request'
import Qs from 'qs';
import request from './request';
export default {
userLogin: (data) => request({url: '/login', method: 'post', data: Qs.stringify(data)}),

View File

@@ -1,25 +1,25 @@
export default {
createNavigationHeading() {
let headArr = []
let headNode = document.querySelector('.wiki-page-content')
let headArr = [];
let headNode = document.querySelector('.wiki-page-content');
if (null === headNode){
return headArr
return headArr;
}
let headNodeArr = headNode.querySelectorAll('h1,h2,h3,h4,h5,h6')
let headNodeArr = headNode.querySelectorAll('h1,h2,h3,h4,h5,h6');
if (headNodeArr.length <= 0) {
return []
return [];
}
headNodeArr.forEach((node) => {
let text = node.innerHTML
.replace(/^\s+/g, '')
.replace(/\s+$/g, '')
.replace(/<\/?[^>]+(>|$)/g, '')
.replace(/<\/?[^>]+(>|$)/g, '');
headArr.push({
node: node,
level: parseInt(node.tagName.replace(/[h]/i, ''), 10),
text: text,
})
})
return headArr
});
});
return headArr;
},
}

View File

@@ -3,7 +3,7 @@ export default {
if (!fileSize) {
return '-'
}
let size = ''
let size = '';
if (fileSize < 0.1 * 1024) {
size = fileSize.toFixed(2) + 'B'
} else if (fileSize < 0.1 * 1024 * 1024) {
@@ -14,11 +14,11 @@ export default {
size = (fileSize / (1024 * 1024 * 1024)).toFixed(2) + 'GB'
}
let sizeStr = size + ''
let index = sizeStr.indexOf('.')
let dou = sizeStr.substr(index + 1, 2)
let index = sizeStr.indexOf('.');
let dou = sizeStr.substr(index + 1, 2);
if (dou == '00') {
return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2)
return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2);
}
return size
return size;
},
}

View File

@@ -1,46 +0,0 @@
/**展示内容的样式*/
.wang-editor-body {
font-size: 14px;
padding: 6px;
overflow-y: auto;
}
.wang-editor-body table {
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
}
.wang-editor-body table td, .wang-editor-body table th {
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc;
padding: 3px 5px;
}
.wang-editor-body table th {
border-bottom: 2px solid #ccc;
text-align: center;
}
.wang-editor-body blockquote {
display: block;
border-left: 8px solid #d0e5f2;
padding: 5px 10px;
margin: 10px 0;
line-height: 1.4;
font-size: 100%;
background-color: #f1f1f1;
}
.wang-editor-body code {
display: inline-block;
*display: inline;
*zoom: 1;
background-color: #f1f1f1;
border-radius: 3px;
padding: 3px 5px;
margin: 0 3px;
}
.wang-editor-body pre code {
display: block;
}

View File

@@ -1,21 +1,3 @@
.i-icon {
vertical-align: middle;
}
// 样式覆盖
ul {
list-style-type: disc;
ul {
list-style-type: circle;
ul {
list-style-type: square;
}
}
}
ol {
list-style-type: decimal;
padding-left: 1em;
}

View File

@@ -0,0 +1,66 @@
// https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.10.0/build/styles/github-dark.min.css
.hljs {
color: #c9d1d9;
background: #0d1117;
}
.hljs-doctag, .hljs-keyword, .hljs-meta .hljs-keyword, .hljs-template-tag, .hljs-template-variable, .hljs-type, .hljs-variable.language_ {
color: #ff7b72;
}
.hljs-title, .hljs-title.class_, .hljs-title.class_.inherited__, .hljs-title.function_ {
color: #d2a8ff;
}
.hljs-attr, .hljs-attribute, .hljs-literal, .hljs-meta, .hljs-number, .hljs-operator, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-id, .hljs-variable {
color: #79c0ff;
}
.hljs-meta .hljs-string, .hljs-regexp, .hljs-string {
color: #a5d6ff;
}
.hljs-built_in, .hljs-symbol {
color: #ffa657;
}
.hljs-code, .hljs-comment, .hljs-formula {
color: #8b949e;
}
.hljs-name, .hljs-quote, .hljs-selector-pseudo, .hljs-selector-tag {
color: #7ee787;
}
.hljs-subst {
color: #c9d1d9;
}
.hljs-section {
color: #1f6feb;
font-weight: 700;
}
.hljs-bullet {
color: #f2cc60;
}
.hljs-emphasis {
color: #c9d1d9;
font-style: italic;
}
.hljs-strong {
color: #c9d1d9;
font-weight: 700;
}
.hljs-addition {
color: #aff5b4;
background-color: #033a16;
}
.hljs-deletion {
color: #ffdcd7;
background-color: #67060c;
}

View File

@@ -0,0 +1,269 @@
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
color: #24292e;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Segoe UI, Arial, Roboto, "PingFang SC", "miui", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
word-wrap: break-word;
.pl-c {
color: #6a737d;
}
.pl-ent {
color: #22863a;
}
.pl-k {
color: #d73a49;
}
.pl-bu {
color: #b31d28;
}
.pl-ii {
color: #fafbfc;
background-color: #b31d28;
}
.pl-c2 {
color: #fafbfc;
background-color: #d73a49;
&::before {
content: "^M";
}
}
.pl-sr {
.pl-cce {
font-weight: 700;
color: #22863a;
}
}
.pl-ml {
color: #735c0f;
}
.pl-mi {
font-style: italic;
color: #24292e;
}
.pl-mb {
font-weight: 700;
color: #24292e;
}
.pl-md {
color: #b31d28;
background-color: #ffeef0;
}
.pl-mi1 {
color: #22863a;
background-color: #f0fff4;
}
.pl-mc {
color: #e36209;
background-color: #ffebda;
}
.pl-mi2 {
color: #f6f8fa;
background-color: #005cc5;
}
.pl-mdr {
font-weight: 700;
color: #6f42c1;
}
.pl-ba {
color: #586069;
}
.pl-sg {
color: #959da5;
}
.pl-corl {
text-decoration: underline;
color: #032f62;
}
.octicon {
display: inline-block;
fill: currentColor;
vertical-align: text-bottom;
}
svg {
&:not(:root) {
overflow: hidden;
}
}
input {
font: inherit;
margin: 0;
overflow: visible;
line-height: inherit;
}
[type=checkbox] {
box-sizing: border-box;
padding: 0;
}
dd {
margin-left: 0;
}
.pl-0 {
padding-left: 0 !important;
}
.pl-1 {
padding-left: 4px !important;
}
.pl-2 {
padding-left: 8px !important;
}
.pl-3 {
padding-left: 16px !important;
}
.pl-4 {
padding-left: 24px !important;
}
.pl-5 {
padding-left: 32px !important;
}
.pl-6 {
padding-left: 40px !important;
}
&::before {
display: table;
content: "";
}
&::after {
display: table;
clear: both;
content: "";
}
& > :first-child {
margin-top: 0 !important;
}
& > :last-child {
margin-bottom: 0 !important;
}
.anchor {
float: left;
padding-right: 4px;
margin-left: -20px;
line-height: 1;
&:focus {
outline: 0;
}
}
kbd {
line-height: 10px;
display: inline-block;
padding: 3px 5px;
font: 11px SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #444d56;
vertical-align: middle;
background-color: #fafbfc;
border: solid 1px #d1d5da;
border-bottom-color: #c6cbd1;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #c6cbd1;
}
dl {
padding: 0;
dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: 600;
}
dd {
padding: 0 16px;
margin-bottom: 16px;
}
}
.full-commit {
.btn-outline {
&:not(:disabled):hover {
color: #005cc5;
border-color: #005cc5;
}
}
}
:checked {
& + .radio-label {
position: relative;
z-index: 1;
border-color: #0366d6;
}
}
.task-list-item {
list-style-type: none;
& + .task-list-item {
margin-top: 3px;
}
input {
margin: 0 .2em .25em 0;
vertical-align: middle;
}
}
.pl-c1, .pl-s .pl-v {
color: #005cc5;
}
.pl-e, .pl-en {
color: #6f42c1;
}
.pl-s .pl-s1, .pl-smi {
color: #24292e;
}
.pl-pds, .pl-s, .pl-s .pl-pse .pl-s1, .pl-sr, .pl-sr .pl-cce, .pl-sr .pl-sra, .pl-sr .pl-sre {
color: #032f62;
}
.pl-smw, .pl-v {
color: #e36209;
}
.pl-mh, .pl-mh .pl-en, .pl-ms {
font-weight: 700;
color: #005cc5;
}
}

View File

@@ -0,0 +1,294 @@
/**展示内容的样式*/
.wang-editor-body {
font-size: 14px;
padding: 6px;
overflow-y: auto;
table {
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
td, th {
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc;
padding: 3px 5px;
}
th {
border-bottom: 2px solid #ccc;
text-align: center;
}
blockquote {
display: block;
border-left: 8px solid #d0e5f2;
padding: 5px 10px;
margin: 10px 0;
line-height: 1.4;
font-size: 100%;
background-color: #f1f1f1;
}
code {
display: inline-block;
*display: inline;
*zoom: 1;
background-color: #f1f1f1;
border-radius: 3px;
padding: 3px 5px;
margin: 0 3px;
}
pre {
code {
display: block;
}
}
}
}
.page-view-content {
word-wrap: break-word;
strong {
font-weight: bolder;
}
.hljs-center {
text-align: center;
}
.hljs-right {
text-align: right;
}
.hljs-left {
text-align: left;
}
table {
overflow: auto;
width: 100%;
max-width: 100%;
border-spacing: 0;
border-collapse: collapse;
word-break: break-all;
}
table th {
font-weight: 600;
}
table td, table th {
padding: 6px 13px;
border: 1px solid #dfe2e5;
}
table tr {
background-color: #fff;
border-top: 1px solid #c6cbd1;
}
table tr:nth-child(2n) {
background-color: #f6f8fa;
}
blockquote {
display: block;
border-left: 2px solid #bac0c3;
padding: 8px 10px;
margin: 10px 0;
line-height: 1.4;
font-size: 100%;
background-color: #f6f6f6;
& > :first-child {
margin-top: 0;
}
& > :last-child {
margin-bottom: 0;
}
}
/*样式覆盖*/
ol {
list-style-type: decimal;
padding-left: 1em;
}
ul {
list-style-type: disc;
padding-left: 1em;
}
code {
font-size: 1em;
padding: .15em .5em;
border-radius: 4px;
background-color: #eee;
color: #444;
}
pre {
padding: 0;
tab-size: 4;
font-size: 100% !important;
position: relative;
background-color: #292d3e !important;
border-radius: 10px !important;
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
code {
background-color: transparent;
padding: 16px 10px !important;
font-size: 100% !important;
color: #fff;
display: inline-block !important;
line-height: 24px !important;
font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
max-width: unset;
margin: 0;
overflow: visible;
word-wrap: normal;
border: 0;
}
}
.katex .katex-mathml {
display: none;
}
iframe {
border: none;
}
a {
font-weight: 500;
color: #3eaf7c;
text-decoration: none;
overflow-wrap: break-word;
&:hover {
text-decoration: underline;
}
&:not([href]) {
color: inherit;
text-decoration: none;
}
span {
vertical-align: middle;
}
}
img {
cursor: pointer;
max-width: 100%;
box-sizing: content-box;
background-color: #fff;
}
// 样式覆盖
ul {
list-style-type: disc;
ul {
list-style-type: circle;
ul {
list-style-type: square;
}
}
}
audio {
width: 100%;
}
video {
max-width: 100%;
}
video[width="0"] {
width: auto;
}
video[height="0"] {
height: auto;
}
.video-js {
border-radius: 8px;
overflow: hidden;
}
//----------------------
h1, h2, h3, h4, h5, h6 {
margin: 0.5em 0;
font-weight: bolder;
}
h1 {
padding-bottom: .3em;
font-size: 1.6em;
border-bottom: 1px solid #eaecef;
}
h2 {
padding-bottom: .3em;
font-size: 1.5em;
border-bottom: 1px solid #eaecef;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.3em;
}
h5 {
font-size: 1.2em;
}
h6 {
font-size: 1.1em;
}
img, audio, video {
max-width: 100%;
}
blockquote, dl, ol, p, pre, table, ul {
margin-top: 0;
margin-bottom: 16px;
}
table {
p {
margin-bottom: 0;
}
p + p {
margin-top: 16px;
}
}
hr {
box-sizing: content-box;
overflow: hidden;
height: 0;
padding: 0;
border: 0;
border-bottom: 2px solid #eee;
margin: 24px 0;
}
mark {
padding: 0;
background-color: #ffff00;
}
}