公告管理
This commit is contained in:
1 parent
374ce74e2d
commit
c0621ff48b
15 files changed
+4641
No files matched your search
@@ -0,0 +1,62 @@
|
|||||||
|
const Service = require('egg').Service;
|
||||||
|
const validateUtil = require('@jianghujs/jianghu/app/common/validateUtil');
|
||||||
|
const { BizError, errorInfoEnum } = require('../constant/error');
|
||||||
|
const _ = require('lodash');
|
||||||
|
const idGenerateUtil = require("@jianghujs/jianghu/app/common/idGenerateUtil");
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
|
||||||
|
class NoticeService extends Service {
|
||||||
|
|
||||||
|
async insertAffiche() {
|
||||||
|
const { jianghuKnex } = this.app;
|
||||||
|
const { actionData } = this.ctx.request.body.appData;
|
||||||
|
const { afficheId, afficheMemberIdList, afficheStatus } = actionData
|
||||||
|
|
||||||
|
let noticeInsertData = null
|
||||||
|
|
||||||
|
if (afficheStatus === "已发送") {
|
||||||
|
// TODO:待完善
|
||||||
|
noticeInsertData = {
|
||||||
|
noticeId: await idGenerateUtil.uuid(),
|
||||||
|
noticeName: "通知-公告-" + afficheId,
|
||||||
|
noticeContent: afficheMemberIdList,
|
||||||
|
pushContent: '{}',
|
||||||
|
pushStatus: "success",
|
||||||
|
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await jianghuKnex.transaction(async trx => {
|
||||||
|
await trx("affiche", this.ctx).jhInsert(actionData);
|
||||||
|
|
||||||
|
if (noticeInsertData) await trx("notice_push", this.ctx).jhInsert(noticeInsertData);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async updateAffiche() {
|
||||||
|
const { jianghuKnex } = this.app;
|
||||||
|
const { actionData } = this.ctx.request.body.appData;
|
||||||
|
const { afficheId, afficheMemberIdList, afficheStatus } = actionData
|
||||||
|
|
||||||
|
let noticeInsertData = null
|
||||||
|
|
||||||
|
if (afficheStatus === "已发送") {
|
||||||
|
// TODO:待完善
|
||||||
|
noticeInsertData = {
|
||||||
|
noticeId: await idGenerateUtil.uuid(),
|
||||||
|
noticeName: "通知-公告-" + afficheId,
|
||||||
|
noticeContent: afficheMemberIdList,
|
||||||
|
pushContent: '{}',
|
||||||
|
pushStatus: "success",
|
||||||
|
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('appData_+_+_+_+', actionData);
|
||||||
|
await jianghuKnex.transaction(async trx => {
|
||||||
|
await trx("affiche", this.ctx).jhUpdate(actionData);
|
||||||
|
if (noticeInsertData) await trx("notice_push", this.ctx).jhInsert(noticeInsertData);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = NoticeService;
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,336 @@
|
|||||||
|
<style>
|
||||||
|
/* doc sidebar */
|
||||||
|
.jianghu-doc-sidebar{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: var(--vp-z-index-sidebar);
|
||||||
|
padding: 0 32px 96px;
|
||||||
|
width: calc(100vw - 64px);
|
||||||
|
max-width: var(--vp-sidebar-width-mobile);
|
||||||
|
opacity: 0;
|
||||||
|
background-color: var(--vt-c-bg);
|
||||||
|
box-shadow: var(--vt-c-shadow-3);
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
transform: translate(-100%);
|
||||||
|
transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-webkit-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-moz-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-ms-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-o-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar::-webkit-scrollbar {
|
||||||
|
display: none; /* Chrome Safari */
|
||||||
|
scrollbar-width: none; /* firefox */
|
||||||
|
-ms-overflow-style: none; /* IE 10+ */
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar.open{
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
transform: translate(0);
|
||||||
|
transition: background-color .5s,opacity .25s,transform .5s cubic-bezier(.19,1,.22,1);
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-nav{
|
||||||
|
padding-top: 24px;
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group+.jianghu-doc-sidebar-group{
|
||||||
|
padding-top: 24px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group+.jianghu-doc-sidebar-group.no-group{
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-title{
|
||||||
|
padding: 6px 0;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-title-text{
|
||||||
|
line-height: 20px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--vt-c-text-1);
|
||||||
|
transition: color .5s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-link{
|
||||||
|
display: block;
|
||||||
|
padding: 6px 0;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-link-text{
|
||||||
|
line-height: 20px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--vt-c-text-2);
|
||||||
|
transition: color .5s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-link-active .jianghu-doc-sidebar-group-link-text{
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
transition: color .25s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-link:hover .jianghu-doc-sidebar-group-link-text{
|
||||||
|
color: var(--vt-c-text-light-1);
|
||||||
|
transition: color .25s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-link-active:hover .jianghu-doc-sidebar-group-link-text{
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
}
|
||||||
|
@media (min-width: 960px){
|
||||||
|
.jianghu-doc-sidebar {
|
||||||
|
/* top: calc(var(--vt-nav-height) + var(--vt-banner-height, 0px)); */
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
border-right: 1px solid var(--vt-c-divider-light);
|
||||||
|
width: var(--vp-sidebar-width-small);
|
||||||
|
max-width: 100%;
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
box-shadow: none;
|
||||||
|
transform: translate(0);
|
||||||
|
transition: border-color .5s,background-color .5s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group+.jianghu-doc-sidebar-group{
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-title{
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
.jianghu-doc-sidebar-group-link{
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1440px){
|
||||||
|
.jianghu-doc-sidebar {
|
||||||
|
padding: 0 32px 96px calc((100% - var(--vp-screen-max-width)) / 2);
|
||||||
|
width: calc((100% - var(--vp-screen-max-width)) / 2 + var(--vp-sidebar-width-small));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* doc content */
|
||||||
|
.jianghu-doc-contentDoc {
|
||||||
|
padding: 32px 24px 96px;
|
||||||
|
min-height: calc(100vh - var(--vt-nav-height));
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside {
|
||||||
|
position: relative;
|
||||||
|
display: none;
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding-left: 64px;
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-container {
|
||||||
|
position: sticky;
|
||||||
|
width: 224px;
|
||||||
|
/* top: calc(var(--vt-nav-height) + var(--vt-banner-height, 0px) + 24px); */
|
||||||
|
top: 24px;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline-title{
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 11px;
|
||||||
|
letter-spacing: .4px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline-link{
|
||||||
|
color: var(--vt-c-text-2) !important;
|
||||||
|
line-height: 28px !important;
|
||||||
|
display: block !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
text-overflow: ellipsis !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
padding: 0 8px !important;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline-link:before{
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
background-color: var(--vt-c-green);
|
||||||
|
border-radius: 4px;
|
||||||
|
width: 4px;
|
||||||
|
height: 20px;
|
||||||
|
opacity: 0;
|
||||||
|
top: 5px;
|
||||||
|
left: 0;
|
||||||
|
z-index: 0;
|
||||||
|
transition: top .25s cubic-bezier(0,1,.5,1),opacity .3s,background-color .5s;
|
||||||
|
-webkit-transition: top .25s cubic-bezier(0,1,.5,1),opacity .3s,background-color .5s;
|
||||||
|
-moz-transition: top .25s cubic-bezier(0,1,.5,1),opacity .3s,background-color .5s;
|
||||||
|
-ms-transition: top .25s cubic-bezier(0,1,.5,1),opacity .3s,background-color .5s;
|
||||||
|
-o-transition: top .25s cubic-bezier(0,1,.5,1),opacity .3s,background-color .5s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline-link.active{
|
||||||
|
border-left: none !important;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline-link.active:before{
|
||||||
|
opacity: 1;
|
||||||
|
transition: top .25s cubic-bezier(0,1,.5,1),opacity .25s,background-color .5s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-outline-link:hover, .jianghu-doc-contentDoc-aside-outline-link.active{
|
||||||
|
color: var(--vt-c-text-1) !important;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside-menu .nav-item{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-content {
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: 750px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-main-doc{
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.7;
|
||||||
|
--vt-doc-code-font-size: 14px;
|
||||||
|
--vt-doc-code-line-height: 1.5;
|
||||||
|
margin-bottom: 54px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-main-edit-links{
|
||||||
|
margin: 0 0 32px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-main-edit-icon{
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 8px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-main-edit-link{
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
font-weight: 500;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-main-edit-link:hover{
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-main-update-time{
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--vt-c-text-2);
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer {
|
||||||
|
border-top: 1px solid var(--vt-c-divider-light);
|
||||||
|
padding-top: 1rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer-link {
|
||||||
|
display: inline-block;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 16px;
|
||||||
|
max-width: 48%;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer-link .jianghu-doc-contentDoc-footer-next-link {
|
||||||
|
margin-left: auto;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer-desc {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--vt-c-text-2);
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer-title {
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
transition: color .25s;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer-icon{
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: -2px;
|
||||||
|
margin-left: 4px;
|
||||||
|
width: 11px;
|
||||||
|
height: 11px;
|
||||||
|
fill: var(--vt-c-text-3);
|
||||||
|
transition: fill .25s;
|
||||||
|
margin: -2px 0 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-footer-link:hover .jianghu-doc-contentDoc-footer-title {
|
||||||
|
color: var(--vt-c-brand-highlight);
|
||||||
|
}
|
||||||
|
@media (min-width: 768px){
|
||||||
|
.jianghu-doc-contentDoc {
|
||||||
|
padding: 48px 32px 96px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 960px){
|
||||||
|
.jianghu-doc-content{
|
||||||
|
/* padding-top: var(--vt-nav-height); */
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jianghu-doc-contentDoc {
|
||||||
|
padding: 64px 64px 96px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1280px){
|
||||||
|
.jianghu-doc-contentDoc {
|
||||||
|
padding: 64px 0 96px 64px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside {
|
||||||
|
display: block;
|
||||||
|
order: 2;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-content {
|
||||||
|
min-width: 750px;
|
||||||
|
margin: 0;
|
||||||
|
order: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 1440px){
|
||||||
|
|
||||||
|
.jianghu-doc-contentDoc {
|
||||||
|
padding: 64px 0 96px 96px;
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside {
|
||||||
|
padding-left: 96px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 960px){
|
||||||
|
.jianghu-doc-contentDoc-aside{
|
||||||
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: var(--vp-z-index-sidebar);
|
||||||
|
padding: 0 32px 96px;
|
||||||
|
width: calc(100vw - 64px);
|
||||||
|
max-width: var(--vp-sidebar-width-mobile);
|
||||||
|
opacity: 0;
|
||||||
|
background-color: var(--vt-c-bg);
|
||||||
|
box-shadow: var(--vt-c-shadow-3);
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
transform: translate(100%);
|
||||||
|
transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-webkit-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-moz-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-ms-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-o-transition: background-color .5s,opacity .5s,transform .3s ease;
|
||||||
|
-webkit-transform: translate(100%);
|
||||||
|
-moz-transform: translate(100%);
|
||||||
|
-ms-transform: translate(100%);
|
||||||
|
-o-transform: translate(100%);
|
||||||
|
}
|
||||||
|
.jianghu-doc-contentDoc-aside.open{
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
transform: translate(0);
|
||||||
|
transition: background-color .5s,opacity .25s,transform .5s cubic-bezier(.19,1,.22,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,286 @@
|
|||||||
|
<style>
|
||||||
|
/* docs */
|
||||||
|
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
|
||||||
|
position: relative;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.5;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.markdown-body h1 {
|
||||||
|
margin: 0 0 3rem;
|
||||||
|
font-size: 38px;
|
||||||
|
line-height: 1.4;
|
||||||
|
letter-spacing: -.02em;
|
||||||
|
}
|
||||||
|
.markdown-body h2 {
|
||||||
|
margin: 4rem 0 1.8rem;
|
||||||
|
border-top: 1px solid var(--vt-c-divider-light);
|
||||||
|
padding-top: 1.8rem;
|
||||||
|
font-size: 24px;
|
||||||
|
letter-spacing: -.02em;
|
||||||
|
}
|
||||||
|
.markdown-body h3 {
|
||||||
|
font-size: 19px;
|
||||||
|
letter-spacing: -.01em;
|
||||||
|
margin: 3rem 0 1.25rem;
|
||||||
|
}
|
||||||
|
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body summary {
|
||||||
|
margin-bottom: 1.2em;
|
||||||
|
}
|
||||||
|
.markdown-body ul {
|
||||||
|
padding-left: 1.25rem;
|
||||||
|
}
|
||||||
|
.markdown-body ul>li:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--vt-c-text-3);
|
||||||
|
transition: background-color .5s;
|
||||||
|
left: -1.25rem;
|
||||||
|
top: 0.75rem;
|
||||||
|
}
|
||||||
|
.markdown-body li {
|
||||||
|
position: relative;
|
||||||
|
margin: 1px 0;
|
||||||
|
}
|
||||||
|
.markdown-body a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
transition: color .25s;
|
||||||
|
text-decoration-style: dotted;
|
||||||
|
}
|
||||||
|
.markdown-body>blockquote {
|
||||||
|
margin: 28px 0;
|
||||||
|
padding: 20px 24px 4px 42px;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow-x: auto;
|
||||||
|
transition: color .5s,background-color .5s;
|
||||||
|
position: relative;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #0000008c;
|
||||||
|
background-color: var(--vt-c-bg-soft);
|
||||||
|
}
|
||||||
|
.markdown-body>blockquote[class="default"] {
|
||||||
|
border: 1px solid var(--vt-c-brand);
|
||||||
|
}
|
||||||
|
.markdown-body>blockquote p {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--vt-c-text-1);
|
||||||
|
transition: color .5s;
|
||||||
|
}
|
||||||
|
.markdown-body>blockquote[class="default"]:before {
|
||||||
|
color: var(--vt-c-brand);
|
||||||
|
}
|
||||||
|
.markdown-body>blockquote:before {
|
||||||
|
content: "\24d8";
|
||||||
|
position: absolute;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 15px;
|
||||||
|
top: 20px;
|
||||||
|
left: 17px;
|
||||||
|
}
|
||||||
|
.markdown-body :not(pre,h1,h2,h3,h4,h5,h6,li)>code{
|
||||||
|
font-size: var(--vt-doc-code-font-size);
|
||||||
|
}
|
||||||
|
.markdown-body :not(pre,li)>code{
|
||||||
|
background-color: var(--vt-c-bg-mute);
|
||||||
|
padding: 0.15em 0.5em;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: var(--vt-c-text-code);
|
||||||
|
transition: color .5s,background-color .5s;
|
||||||
|
}
|
||||||
|
.markdown-body pre {
|
||||||
|
position: relative;
|
||||||
|
margin: 28px -24px;
|
||||||
|
background-color: #292d3e;
|
||||||
|
overflow-x: auto;
|
||||||
|
transition: background-color .5s;
|
||||||
|
}
|
||||||
|
.markdown-body pre ol, .markdown-body pre code {
|
||||||
|
text-align: left;
|
||||||
|
white-space: pre;
|
||||||
|
word-spacing: normal;
|
||||||
|
word-break: normal;
|
||||||
|
word-wrap: normal;
|
||||||
|
-moz-tab-size: 4;
|
||||||
|
-o-tab-size: 4;
|
||||||
|
tab-size: 4;
|
||||||
|
-webkit-hyphens: none;
|
||||||
|
-moz-hyphens: none;
|
||||||
|
-ms-hyphens: none;
|
||||||
|
hyphens: none;
|
||||||
|
}
|
||||||
|
.markdown-body pre ol{
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
margin: 0;
|
||||||
|
padding: 14px 24px;
|
||||||
|
background: transparent;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
.markdown-body pre code {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0;
|
||||||
|
line-height: var(--vt-doc-code-line-height);
|
||||||
|
font-size: var(--vt-doc-code-font-size);
|
||||||
|
color: #a6accd;
|
||||||
|
transition: color .5s;
|
||||||
|
}
|
||||||
|
@media (min-width: 640px){
|
||||||
|
.markdown-body pre {
|
||||||
|
margin: 28px 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 768px){
|
||||||
|
.markdown-body :not(pre,li)>code{
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 768px){
|
||||||
|
.markdown-body h1 {
|
||||||
|
font-size: 32px;
|
||||||
|
margin-bottom: 1.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* table */
|
||||||
|
.markdown-body table {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
word-break: normal;
|
||||||
|
word-break: keep-all;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
.editormd-preview-container table thead tr, .editormd-html-preview table thead tr {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
}
|
||||||
|
.markdown-body table tr {
|
||||||
|
background-color: #fff;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
.markdown-body table th, .markdown-body table td {
|
||||||
|
padding: 6px 13px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
.markdown-body table th {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 字体颜色 */
|
||||||
|
.pln {
|
||||||
|
color: #a6accd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* plain text */
|
||||||
|
@media screen {
|
||||||
|
.str {
|
||||||
|
color: #C3E88D;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* string content */
|
||||||
|
.kwd {
|
||||||
|
color: #82AAFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a keyword */
|
||||||
|
.com {
|
||||||
|
color: #676E95;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a comment */
|
||||||
|
.typ {
|
||||||
|
color: #C792EA;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a type name */
|
||||||
|
.lit {
|
||||||
|
color: #89DDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a literal value */
|
||||||
|
/* punctuation, lisp open bracket, lisp close bracket */
|
||||||
|
.pun, .opn, .clo {
|
||||||
|
color: #FFCB6B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
color: #F07178;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a markup tag name */
|
||||||
|
.atn {
|
||||||
|
color: #C792EA;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a markup attribute name */
|
||||||
|
.atv {
|
||||||
|
color: #C3E88D;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a markup attribute value */
|
||||||
|
.dec, .var {
|
||||||
|
color: #606;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a declaration; a variable name */
|
||||||
|
.fun {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a function name */
|
||||||
|
}
|
||||||
|
/* Use higher contrast and text-weight for printable form. */
|
||||||
|
@media print, projection {
|
||||||
|
.str {
|
||||||
|
color: #C3E88D;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kwd {
|
||||||
|
color: #82AAFF;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.com {
|
||||||
|
color: #676E95;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.typ {
|
||||||
|
color: #C792EA;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lit {
|
||||||
|
color: #89DDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pun, .opn, .clo {
|
||||||
|
color: #FFCB6B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
color: #F07178;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.atn {
|
||||||
|
color: #404;
|
||||||
|
}
|
||||||
|
|
||||||
|
.atv {
|
||||||
|
color: #C3E88D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
########################################################
|
||||||
|
### 页面js ###
|
||||||
|
########################################################
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Ajax默认配置
|
||||||
|
$.ajaxSetup({
|
||||||
|
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||||
|
});
|
||||||
|
|
||||||
|
// 视频iframe域名白名单
|
||||||
|
var iframe_whitelist = '{{ iframe_whitelist }}'.split(',')
|
||||||
|
|
||||||
|
// 展开文档页左边菜单
|
||||||
|
function openDocMenu(){
|
||||||
|
$(".vt-backdrop").addClass("open");
|
||||||
|
$(".jianghu-doc-sidebar").addClass('open');
|
||||||
|
};
|
||||||
|
// 收起文档页左边菜单
|
||||||
|
function closeDocMenu(){
|
||||||
|
$(".jianghu-doc-sidebar").removeClass('open');
|
||||||
|
};
|
||||||
|
// 展开文档页大纲
|
||||||
|
function openDocAside(){
|
||||||
|
$(".vt-backdrop").addClass("open");
|
||||||
|
$(".jianghu-doc-contentDoc-aside").addClass('open');
|
||||||
|
};
|
||||||
|
// 收起文档页大纲
|
||||||
|
function closeDocAside(){
|
||||||
|
$(".jianghu-doc-contentDoc-aside").removeClass('open');
|
||||||
|
};
|
||||||
|
// 关闭遮罩
|
||||||
|
function closeBackdrop(){
|
||||||
|
$(".vt-backdrop").removeClass("open");
|
||||||
|
closeDocMenu()
|
||||||
|
closeDocAside()
|
||||||
|
};
|
||||||
|
// 展开mobile navBarMenus
|
||||||
|
function openNavBarMenus(){
|
||||||
|
closeUserCenter()
|
||||||
|
$("html").css("overflow","hidden");
|
||||||
|
$(".jianghu-toggleNavBarMenus-closeIcon").css("display","block");
|
||||||
|
$(".jianghu-toggleNavBarMenus-menuIcon").css("display","none");
|
||||||
|
$("#jianghu-header-mobile-navBarMenus").addClass('open');
|
||||||
|
$("#jianghu-mobile-toggle-navBarMenus").addClass('is-active');
|
||||||
|
};
|
||||||
|
// 收起mobile navBarMenus
|
||||||
|
function closeNavBarMenus(){
|
||||||
|
$("html").css("overflow","auto");
|
||||||
|
$(".jianghu-toggleNavBarMenus-closeIcon").css("display","none");
|
||||||
|
$(".jianghu-toggleNavBarMenus-menuIcon").css("display","block");
|
||||||
|
$("#jianghu-header-mobile-navBarMenus").removeClass('open');
|
||||||
|
$("#jianghu-mobile-toggle-navBarMenus").removeClass('is-active');
|
||||||
|
};
|
||||||
|
// 展开mobile userCenter
|
||||||
|
function openUserCenter(){
|
||||||
|
closeNavBarMenus()
|
||||||
|
$("html").css("overflow","hidden");
|
||||||
|
$(".jianghu-toggleUserCenter-closeIcon").css("display","block");
|
||||||
|
$(".jianghu-toggleUserCenter-userIcon").css("display","none");
|
||||||
|
$("#jianghu-header-mobile-userCenter").addClass('open');
|
||||||
|
$("#jianghu-mobile-toggle-userCenter").addClass('is-active');
|
||||||
|
};
|
||||||
|
// 收起mobile userCenter
|
||||||
|
function closeUserCenter(){
|
||||||
|
$("html").css("overflow","auto");
|
||||||
|
$(".jianghu-toggleUserCenter-closeIcon").css("display","none");
|
||||||
|
$(".jianghu-toggleUserCenter-userIcon").css("display","block");
|
||||||
|
$("#jianghu-header-mobile-userCenter").removeClass('open');
|
||||||
|
$("#jianghu-mobile-toggle-userCenter").removeClass('is-active');
|
||||||
|
};
|
||||||
|
// 生成文档大纲
|
||||||
|
function generateSidebar(){
|
||||||
|
// 遍历文章中的所有标题
|
||||||
|
const allHeaders = []
|
||||||
|
Array.from(document.getElementById('doc-content').children).forEach((item, i) => {
|
||||||
|
if (item.tagName.length === 2 && item.tagName !== 'HR' && item.tagName.indexOf('H') === 0) {
|
||||||
|
if(item.id){
|
||||||
|
const newId = 'links-' + i;
|
||||||
|
item.id = newId;
|
||||||
|
}
|
||||||
|
allHeaders.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 标题分组
|
||||||
|
let groupAllHeaders = []
|
||||||
|
allHeaders.forEach(h => {
|
||||||
|
if(h.localName === 'h1' || h.localName === 'h2'){
|
||||||
|
groupAllHeaders.push(h);
|
||||||
|
}else if(h.localName === 'h3'){
|
||||||
|
let parentH = groupAllHeaders[groupAllHeaders.length - 1];
|
||||||
|
if(parentH){
|
||||||
|
parentH.childH = parentH.childH ? parentH.childH.concat(h) : [h]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 生成html
|
||||||
|
var sidebar = ''
|
||||||
|
groupAllHeaders.forEach(h => {
|
||||||
|
sidebar += ' <li class="nav-item">'
|
||||||
|
sidebar += ' <a class="nav-link jianghu-doc-contentDoc-aside-outline-link" href="#' + h.id + '">' + h.innerText + '</a>'
|
||||||
|
if(h.childH){
|
||||||
|
sidebar += '<ul class="nav flex-column ps-3">'
|
||||||
|
h.childH.forEach(childH => {
|
||||||
|
sidebar += '<li class="nav-item">'
|
||||||
|
sidebar += '<a class="nav-link jianghu-doc-contentDoc-aside-outline-link" href="#' + childH.id + '">' + childH.innerText + '</a>'
|
||||||
|
sidebar += '</li>'
|
||||||
|
})
|
||||||
|
sidebar += '</ul>'
|
||||||
|
}
|
||||||
|
sidebar += ' </li>'
|
||||||
|
})
|
||||||
|
$('#jianghu-doc-contentDoc-aside-menu').empty().html(sidebar)
|
||||||
|
//body绑定的scroll事件(需大于一个标题,否则scrollspy.js会报错)
|
||||||
|
if(groupAllHeaders.length > 1){
|
||||||
|
$('body').attr('data-mdb-spy', 'scroll');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 显示success alert
|
||||||
|
function showSuccessAlert(msg){
|
||||||
|
var temp = '<div class="alert alert-success fade alert-fixed show" role="alert">'
|
||||||
|
temp += '<i class="fas fa-check-circle me-3"></i>'
|
||||||
|
temp += msg
|
||||||
|
temp += '</div>'
|
||||||
|
$('body').append(temp);
|
||||||
|
setTimeout(()=>{
|
||||||
|
$('.alert-success').remove()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
// 显示fail alert
|
||||||
|
function showFailAlert(msg){
|
||||||
|
var temp = '<div class="alert alert-danger fade alert-fixed show" role="alert">'
|
||||||
|
temp += '<i class="fas fa-times-circle me-3"></i>'
|
||||||
|
temp += msg
|
||||||
|
temp += '</div>'
|
||||||
|
$('body').append(temp);
|
||||||
|
setTimeout(()=>{
|
||||||
|
$('.alert-danger').remove()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
// 显示loading
|
||||||
|
function showLoading(){
|
||||||
|
var temp = '<div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div>'
|
||||||
|
$('body').append(temp);
|
||||||
|
$(".vt-backdrop").addClass("open light");
|
||||||
|
$(".vt-backdrop").attr("closeable", "false");
|
||||||
|
}
|
||||||
|
// 删除loading
|
||||||
|
function hideLoading(){
|
||||||
|
$('.spinner-border').remove()
|
||||||
|
$(".vt-backdrop").removeClass("open light");
|
||||||
|
$(".vt-backdrop").removeAttr("closeable");
|
||||||
|
}
|
||||||
|
$(function(){
|
||||||
|
// 生成当前网页链接
|
||||||
|
$("input[name=current_url]").val(document.URL)
|
||||||
|
// 切换侧边栏
|
||||||
|
$("#jianghu-mobile-toggle-docMenu").click(openDocMenu);
|
||||||
|
// 切换大纲
|
||||||
|
$("#jianghu-mobile-toggle-docAside").click(openDocAside);
|
||||||
|
// 切换mobile navBarMenus
|
||||||
|
$("#jianghu-mobile-toggle-navBarMenus").click(function(){
|
||||||
|
if($(this).hasClass('is-active')){
|
||||||
|
closeNavBarMenus()
|
||||||
|
}else{
|
||||||
|
openNavBarMenus()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 切换mobile userCenter
|
||||||
|
$("#jianghu-mobile-toggle-userCenter").click(function(){
|
||||||
|
if($(this).hasClass('is-active')){
|
||||||
|
closeUserCenter()
|
||||||
|
}else{
|
||||||
|
openUserCenter()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 关闭遮罩
|
||||||
|
$(".vt-backdrop").click(() => {
|
||||||
|
if($(".vt-backdrop").attr("closeable") !== "false"){
|
||||||
|
closeBackdrop()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--vt-c-white: #ffffff;
|
||||||
|
--vt-c-white-soft: #f9f9f9;
|
||||||
|
--vt-c-white-mute: #f1f1f1;
|
||||||
|
--vt-c-black: #1a1a1a;
|
||||||
|
--vt-c-black-pure: #000000;
|
||||||
|
--vt-c-black-soft: #242424;
|
||||||
|
--vt-c-black-mute: #2f2f2f;
|
||||||
|
--vt-c-indigo: #213547;
|
||||||
|
--vt-c-indigo-soft: #476582;
|
||||||
|
--vt-c-indigo-light: #aac8e4;
|
||||||
|
--vt-c-gray: #8e8e8e;
|
||||||
|
--vt-c-gray-light-1: #aeaeae;
|
||||||
|
--vt-c-gray-light-2: #c7c7c7;
|
||||||
|
--vt-c-gray-light-3: #d1d1d1;
|
||||||
|
--vt-c-gray-light-4: #e5e5e5;
|
||||||
|
--vt-c-gray-light-5: #f2f2f2;
|
||||||
|
--vt-c-gray-dark-1: #636363;
|
||||||
|
--vt-c-gray-dark-2: #484848;
|
||||||
|
--vt-c-gray-dark-3: #3a3a3a;
|
||||||
|
--vt-c-gray-dark-4: #282828;
|
||||||
|
--vt-c-gray-dark-5: #202020;
|
||||||
|
--vt-c-divider-light-1: rgba(60, 60, 60, .29);
|
||||||
|
--vt-c-divider-light-2: rgba(60, 60, 60, .12);
|
||||||
|
--vt-c-divider-light-3: #e7e7e7;
|
||||||
|
--vt-c-divider-dark-1: rgba(84, 84, 84, .65);
|
||||||
|
--vt-c-divider-dark-2: rgba(84, 84, 84, .48);
|
||||||
|
--vt-c-text-light-1: var(--vt-c-indigo);
|
||||||
|
--vt-c-text-light-2: rgba(60, 60, 60, .7);
|
||||||
|
--vt-c-text-light-3: rgba(60, 60, 60, .33);
|
||||||
|
--vt-c-text-light-4: rgba(60, 60, 60, .18);
|
||||||
|
--vt-c-text-light-code: var(--vt-c-indigo-soft);
|
||||||
|
--vt-c-text-dark-1: rgba(255, 255, 255, .87);
|
||||||
|
--vt-c-text-dark-2: rgba(235, 235, 235, .6);
|
||||||
|
--vt-c-text-dark-3: rgba(235, 235, 235, .38);
|
||||||
|
--vt-c-text-dark-4: rgba(235, 235, 235, .18);
|
||||||
|
--vt-c-text-dark-code: var(--vt-c-indigo-light);
|
||||||
|
--vt-c-green: #42b883;
|
||||||
|
--vt-c-green-light: #42d392;
|
||||||
|
--vt-c-green-lighter: #35eb9a;
|
||||||
|
--vt-c-green-dark: #33a06f;
|
||||||
|
--vt-c-green-darker: #155f3e;
|
||||||
|
--vt-c-blue: #3b8eed;
|
||||||
|
--vt-c-blue-light: #549ced;
|
||||||
|
--vt-c-blue-lighter: #50a2ff;
|
||||||
|
--vt-c-blue-dark: #3468a3;
|
||||||
|
--vt-c-blue-darker: #255489;
|
||||||
|
--vt-c-yellow: #ffc517;
|
||||||
|
--vt-c-yellow-light: #ffe417;
|
||||||
|
--vt-c-yellow-lighter: #ffff17;
|
||||||
|
--vt-c-yellow-dark: #e0ad15;
|
||||||
|
--vt-c-yellow-darker: #bc9112;
|
||||||
|
--vt-c-red: #ed3c50;
|
||||||
|
--vt-c-red-light: #f43771;
|
||||||
|
--vt-c-red-lighter: #fd1d7c;
|
||||||
|
--vt-c-red-dark: #cd2d3f;
|
||||||
|
--vt-c-red-darker: #ab2131;
|
||||||
|
--vt-c-purple: #de41e0;
|
||||||
|
--vt-c-purple-light: #e936eb;
|
||||||
|
--vt-c-purple-lighter: #f616f8;
|
||||||
|
--vt-c-purple-dark: #823c83;
|
||||||
|
--vt-c-purple-darker: #602960;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--vt-c-bg: var(--vt-c-white);
|
||||||
|
--vt-c-bg-soft: var(--vt-c-white-soft);
|
||||||
|
--vt-c-bg-mute: var(--vt-c-white-mute);
|
||||||
|
--vt-c-divider: var(--vt-c-divider-light-1);
|
||||||
|
--vt-c-divider-light: var(--vt-c-divider-light-2);
|
||||||
|
--vt-c-divider-inverse: var(--vt-c-divider-dark-1);
|
||||||
|
--vt-c-divider-inverse-light: var(--vt-c-divider-dark-2);
|
||||||
|
--vt-c-text-1: var(--vt-c-text-light-1);
|
||||||
|
--vt-c-text-2: var(--vt-c-text-light-2);
|
||||||
|
--vt-c-text-3: var(--vt-c-text-light-3);
|
||||||
|
--vt-c-text-4: var(--vt-c-text-light-4);
|
||||||
|
--vt-c-text-code: var(--vt-c-text-light-code);
|
||||||
|
--vt-c-text-inverse-1: var(--vt-c-text-dark-1);
|
||||||
|
--vt-c-text-inverse-2: var(--vt-c-text-dark-2);
|
||||||
|
--vt-c-text-inverse-3: var(--vt-c-text-dark-3);
|
||||||
|
--vt-c-text-inverse-4: var(--vt-c-text-dark-4);
|
||||||
|
--vt-c-brand: var(--vt-c-green);
|
||||||
|
--vt-c-brand-light: var(--vt-c-green-light);
|
||||||
|
--vt-c-brand-dark: var(--vt-c-green-dark);
|
||||||
|
--vt-c-brand-highlight: var(--vt-c-brand-dark);
|
||||||
|
--docsearch-searchbox-focus-background: transparent;
|
||||||
|
--docsearch-searchbox-shadow: none;
|
||||||
|
--docsearch-highlight-color: var(--vt-c-green);
|
||||||
|
--docsearch-text-color: var(--vt-c-indigo);
|
||||||
|
--docsearch-muted-color: var(--vt-c-text-light-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--vt-c-bg: var(--vt-c-black);
|
||||||
|
--vt-c-bg-soft: var(--vt-c-black-soft);
|
||||||
|
--vt-c-bg-mute: var(--vt-c-black-mute);
|
||||||
|
--vt-c-divider: var(--vt-c-divider-dark-1);
|
||||||
|
--vt-c-divider-light: var(--vt-c-divider-dark-2);
|
||||||
|
--vt-c-divider-inverse: var(--vt-c-divider-light-1);
|
||||||
|
--vt-c-divider-inverse-light: var(--vt-c-divider-light-2);
|
||||||
|
--vt-c-text-1: var(--vt-c-text-dark-1);
|
||||||
|
--vt-c-text-2: var(--vt-c-text-dark-2);
|
||||||
|
--vt-c-text-3: var(--vt-c-text-dark-3);
|
||||||
|
--vt-c-text-4: var(--vt-c-text-dark-4);
|
||||||
|
--vt-c-text-code: var(--vt-c-text-dark-code);
|
||||||
|
--vt-c-text-inverse-1: var(--vt-c-text-light-1);
|
||||||
|
--vt-c-text-inverse-2: var(--vt-c-text-light-2);
|
||||||
|
--vt-c-text-inverse-3: var(--vt-c-text-light-3);
|
||||||
|
--vt-c-text-inverse-4: var(--vt-c-text-light-4);
|
||||||
|
--vt-c-brand-highlight: var(--vt-c-brand-light);
|
||||||
|
--docsearch-text-color: var(--vt-c-indigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--vt-font-family-base: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
||||||
|
--vt-font-family-mono: Menlo, Monaco, Consolas, "Courier New", monospace
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--vt-shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06);
|
||||||
|
--vt-shadow-2: 0 3px 12px rgba(0, 0, 0, .07), 0 1px 4px rgba(0, 0, 0, .07);
|
||||||
|
--vt-shadow-3: 0 12px 32px rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .08);
|
||||||
|
--vt-shadow-4: 0 14px 44px rgba(0, 0, 0, .12), 0 3px 9px rgba(0, 0, 0, .12);
|
||||||
|
--vt-shadow-5: 0 18px 56px rgba(0, 0, 0, .16), 0 4px 12px rgba(0, 0, 0, .16)
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--vt-nav-height: 55px;
|
||||||
|
--vp-screen-max-width: 1376px;
|
||||||
|
--vp-sidebar-width-small: 272px;
|
||||||
|
--vp-z-index-sidebar: 50px;
|
||||||
|
--vp-sidebar-width-mobile: 320px;
|
||||||
|
--vp-z-index-nav: 20;
|
||||||
|
--vp-z-index-local-nav: 10;
|
||||||
|
--vp-z-index-sidebar: 99;
|
||||||
|
--vp-z-index-backdrop: 40;
|
||||||
|
--vp-z-index-loading: 99;
|
||||||
|
--docsearch-searchbox-height: 56px;
|
||||||
|
--docsearch-spacing: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, :before, :after {
|
||||||
|
box-sizing: border-box
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root body {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
width: 100vw;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
font-family: var(--vt-font-family-base);
|
||||||
|
letter-spacing: .2px;
|
||||||
|
line-height: 24px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--vt-c-text-1);
|
||||||
|
background-color: var(--vt-c-bg);
|
||||||
|
direction: ltr;
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
transition: color .5s, background-color .5s;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
/* overflow-x: hidden; */
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre {
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
a, area, button, [role=button], input, label, select, summary, textarea {
|
||||||
|
touch-action: manipulation
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
ol, ul {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, code, kbd, samp {
|
||||||
|
font-family: var(--vt-font-family-mono)
|
||||||
|
}
|
||||||
|
|
||||||
|
img, svg, video, canvas, audio, iframe, embed, object {
|
||||||
|
display: block;
|
||||||
|
vertical-align: middle
|
||||||
|
}
|
||||||
|
|
||||||
|
img, video {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto
|
||||||
|
}
|
||||||
|
|
||||||
|
button, input, optgroup, select, textarea {
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
background-image: none
|
||||||
|
}
|
||||||
|
|
||||||
|
button, [role=button] {
|
||||||
|
cursor: pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus, button:focus-visible {
|
||||||
|
outline: 1px dotted;
|
||||||
|
outline: 5px auto -webkit-focus-ring-color
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus:not(:focus-visible) {
|
||||||
|
outline: none !important
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus, textarea:focus, select:focus {
|
||||||
|
outline: none
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: transparent
|
||||||
|
}
|
||||||
|
|
||||||
|
input:-ms-input-placeholder, textarea:-ms-input-placeholder {
|
||||||
|
color: var(--vt-c-text-3)
|
||||||
|
}
|
||||||
|
|
||||||
|
input::-ms-input-placeholder, textarea::-ms-input-placeholder {
|
||||||
|
color: var(--vt-c-text-3)
|
||||||
|
}
|
||||||
|
|
||||||
|
input::placeholder, textarea::placeholder {
|
||||||
|
color: var(--vt-c-text-3)
|
||||||
|
}
|
||||||
|
|
||||||
|
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=number] {
|
||||||
|
-moz-appearance: textfield
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: vertical
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
-webkit-appearance: none
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,616 @@
|
|||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
class ArticleMarkdownEngine {
|
||||||
|
static settings = Object.assign({
|
||||||
|
gfm: true,
|
||||||
|
toc: true,
|
||||||
|
tocm: false,
|
||||||
|
tocStartLevel: 1,
|
||||||
|
tocTitle: '目录',
|
||||||
|
tocDropdown: false,
|
||||||
|
tocContainer: '',
|
||||||
|
markdown: '',
|
||||||
|
markdownSourceCode: false,
|
||||||
|
htmlDecode: false,
|
||||||
|
autoLoadKaTeX: true,
|
||||||
|
pageBreak: true,
|
||||||
|
atLink: true, // for @link
|
||||||
|
emailLink: true, // for mail address auto link
|
||||||
|
tex: false,
|
||||||
|
taskList: false, // Github Flavored Markdown task lists
|
||||||
|
emoji: false,
|
||||||
|
flowChart: false,
|
||||||
|
sequenceDiagram: false,
|
||||||
|
previewCodeHighlight: true,
|
||||||
|
}, {
|
||||||
|
// 定制配置,从前端复制
|
||||||
|
htmlDecode: 'style,script,iframe', // you can filter tags decode
|
||||||
|
// toc : false,
|
||||||
|
tocm: true, // Using [TOCM]
|
||||||
|
// tocContainer : "#custom-toc-container", // 自定义 ToC 容器层
|
||||||
|
// gfm : false,
|
||||||
|
// tocDropdown : true,
|
||||||
|
// markdownSourceCode : true, // 是否保留 Markdown 源码,即是否删除保存源码的 Textarea 标签
|
||||||
|
emoji: true,
|
||||||
|
taskList: true,
|
||||||
|
tex: true, // 默认不解析
|
||||||
|
flowChart: true, // 默认不解析
|
||||||
|
sequenceDiagram: true, // 默认不解析
|
||||||
|
});
|
||||||
|
|
||||||
|
static regexs = {
|
||||||
|
atLink: /@(\w+)/g,
|
||||||
|
email: /(\w+)@(\w+)\.(\w+)\.?(\w+)?/g,
|
||||||
|
emailLink: /(mailto:)?([\w\.\_]+)@(\w+)\.(\w+)\.?(\w+)?/g,
|
||||||
|
// mark : /==([^\s][^\<\/code\>][\s\S]*?[^\s])==(?!=)/g,
|
||||||
|
mark: /(={2})([^\<\/code\>].+?)\1/g,
|
||||||
|
emoji: /:([A-Za-z\+-]+):/g,
|
||||||
|
emojiDatetime: /(\d{2}:\d{2}:\d{2})/g,
|
||||||
|
twemoji: /:(tw-([\w]+)-?(\w+)?):/g,
|
||||||
|
fontAwesome: /:(fa-([\w]+)(-(\w+)){0,}):/g,
|
||||||
|
editormdLogo: /:(editormd-logo-?(\w+)?):/g,
|
||||||
|
pageBreak: /^\[[=]{8,}\]$/,
|
||||||
|
};
|
||||||
|
|
||||||
|
static urls = {
|
||||||
|
atLinkBase: 'https://github.com/',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Emoji graphics files url path
|
||||||
|
static emoji = {
|
||||||
|
path: 'http://www.emoji-cheat-sheet.com/graphics/emojis/',
|
||||||
|
ext: '.png',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Twitter Emoji (Twemoji) graphics files url path
|
||||||
|
static twemoji = {
|
||||||
|
path: 'http://twemoji.maxcdn.com/36x36/',
|
||||||
|
ext: '.png',
|
||||||
|
};
|
||||||
|
|
||||||
|
static classPrefix = 'editormd-';
|
||||||
|
|
||||||
|
static classNames = {
|
||||||
|
tex: ArticleMarkdownEngine.classPrefix + 'tex',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除字符串两边的空格
|
||||||
|
* Clear the space of strings both sides.
|
||||||
|
*
|
||||||
|
* @param {String} str string
|
||||||
|
* @return {String} trimed string
|
||||||
|
*/
|
||||||
|
static trim = function(str) {
|
||||||
|
return (!String.prototype.trim) ? str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '') : str.trim();
|
||||||
|
};
|
||||||
|
|
||||||
|
static filterHTMLTags(html, filters) {
|
||||||
|
|
||||||
|
const expression = filters.split('|');
|
||||||
|
const filterTags = expression[0].split(',');
|
||||||
|
|
||||||
|
for (let i = 0, len = filterTags.length; i < len; i++) {
|
||||||
|
const tag = filterTags[i];
|
||||||
|
|
||||||
|
html = html.replace(new RegExp('\<\s*' + tag + '\s*([^\>]*)\>([^\>]*)\<\s*\/' + tag + '\s*\>', 'igm'), '');
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义marked的解析器
|
||||||
|
* Custom Marked renderer rules
|
||||||
|
*
|
||||||
|
* @param {Array} markdownToC 传入用于接收TOC的数组
|
||||||
|
* @param options
|
||||||
|
* @return {Renderer} markedRenderer 返回marked的Renderer自定义对象
|
||||||
|
*/
|
||||||
|
static markedRenderer(markdownToC, options) {
|
||||||
|
const markedRenderer = new marked.Renderer();
|
||||||
|
markdownToC = markdownToC || [];
|
||||||
|
|
||||||
|
const atLinkReg = ArticleMarkdownEngine.regexs.atLink;
|
||||||
|
const markReg = ArticleMarkdownEngine.regexs.mark;
|
||||||
|
const emojiReg = ArticleMarkdownEngine.regexs.emoji;
|
||||||
|
const twemojiReg = ArticleMarkdownEngine.regexs.twemoji;
|
||||||
|
const faIconReg = ArticleMarkdownEngine.regexs.fontAwesome;
|
||||||
|
const editormdLogoReg = ArticleMarkdownEngine.regexs.editormdLogo;
|
||||||
|
const pageBreakReg = ArticleMarkdownEngine.regexs.pageBreak;
|
||||||
|
|
||||||
|
// 增加引用样式解析规则
|
||||||
|
markedRenderer.blockquote = function($quote) {
|
||||||
|
let quoteBegin = '';
|
||||||
|
|
||||||
|
const ps = $quote.match(/<p\s*?>/i);
|
||||||
|
|
||||||
|
if (ps !== null) {
|
||||||
|
quoteBegin = ps[0];
|
||||||
|
$quote = $quote.substr(3);
|
||||||
|
}
|
||||||
|
let $class = 'default';
|
||||||
|
|
||||||
|
if ($quote.indexOf('i ') === 0) {
|
||||||
|
$class = 'info';
|
||||||
|
$quote = $quote.substr(1);
|
||||||
|
} else if ($quote.indexOf('w ') === 0) {
|
||||||
|
$class = 'warning';
|
||||||
|
$quote = $quote.substr(1);
|
||||||
|
} else if ($quote.indexOf('s ') === 0) {
|
||||||
|
$class = 'success';
|
||||||
|
$quote = $quote.substr(1);
|
||||||
|
} else if ($quote.indexOf('d ') === 0) {
|
||||||
|
$class = 'danger';
|
||||||
|
$quote = $quote.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<blockquote class="' + $class + '">\n' + quoteBegin + $quote + '</blockquote>\n';
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 解析图片
|
||||||
|
markedRenderer.image = function(href, title, text) {
|
||||||
|
const attr = '';
|
||||||
|
const begin = '';
|
||||||
|
const end = '';
|
||||||
|
|
||||||
|
if (/^=(.*?)/.test(text)) {
|
||||||
|
// console.log(text)
|
||||||
|
switch (text) {
|
||||||
|
case '=video':
|
||||||
|
if (href.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)) {
|
||||||
|
return "<video src='" + href + "' controls='controls' preload width=500></video>";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '=audio':
|
||||||
|
if (href.match(/^.+.(mp3|wav|flac|m4a)$/)) {
|
||||||
|
return "<audio src='" + href + "' controls='controls'></audio>";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '=video_iframe':
|
||||||
|
const youtubeMatch = href.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/);
|
||||||
|
const youkuMatch = href.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/);
|
||||||
|
const qqMatch = href.match(/\/\/v\.qq\.com\/x\/cover\/.*\/([^\/]+)\.html\??.*/);
|
||||||
|
const coubMatch = href.match(/(?:www\.|\/\/)coub\.com\/view\/(\w+)/);
|
||||||
|
const facebookMatch = href.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/);
|
||||||
|
const dailymotionMatch = href.match(/.+dailymotion.com\/(video|hub)\/(\w+)\?/);
|
||||||
|
const bilibiliMatch = href.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/);
|
||||||
|
const tedMatch = href.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);
|
||||||
|
|
||||||
|
if (youtubeMatch && youtubeMatch[1].length === 11) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="//www.youtube.com/embed/${youtubeMatch[1] + (youtubeMatch[2] ? '?start=' + youtubeMatch[2] : '')}"></iframe>`;
|
||||||
|
} else if (youkuMatch && youkuMatch[1]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="//player.youku.com/embed/${youkuMatch[1]}"></iframe>`;
|
||||||
|
} else if (qqMatch && qqMatch[1]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="https://v.qq.com/txp/iframe/player.html?vid=${qqMatch[1]}"></iframe>`;
|
||||||
|
} else if (coubMatch && coubMatch[1]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="//coub.com/embed/${coubMatch[1]}?muted=false&autostart=false&originalSize=true&startWithHD=true"></iframe>`;
|
||||||
|
} else if (facebookMatch && facebookMatch[0]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="https://www.facebook.com/plugins/video.php?href=${encodeURIComponent(facebookMatch[0])}"></iframe>`;
|
||||||
|
} else if (dailymotionMatch && dailymotionMatch[2]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="https://www.dailymotion.com/embed/video/${dailymotionMatch[2]}"></iframe>`;
|
||||||
|
} else if (bilibiliMatch && bilibiliMatch[1]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="//player.bilibili.com/player.html?bvid=${bilibiliMatch[1]}"></iframe>`;
|
||||||
|
} else if (tedMatch && tedMatch[1]) {
|
||||||
|
return `<iframe height=400 width=500 frameborder=0 allowfullscreen src="//embed.ted.com/talks/${tedMatch[1]}"></iframe>`;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return begin + '<img src="' + href + '" title="' + title + '" alt="' + text + '" ' + attr + ' />' + end;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked emoji 解析
|
||||||
|
markedRenderer.emoji = function(text) {
|
||||||
|
|
||||||
|
text = text.replace(ArticleMarkdownEngine.regexs.emojiDatetime, function($1) {
|
||||||
|
return $1.replace(/:/g, ':');
|
||||||
|
});
|
||||||
|
|
||||||
|
const matchs = text.match(emojiReg);
|
||||||
|
|
||||||
|
if (!matchs || !ArticleMarkdownEngine.settings.emoji) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0, len = matchs.length; i < len; i++) {
|
||||||
|
if (matchs[i] === ':+1:') {
|
||||||
|
matchs[i] = ':\\+1:';
|
||||||
|
}
|
||||||
|
|
||||||
|
text = text.replace(new RegExp(matchs[i]), function($1, $2) {
|
||||||
|
const faMatchs = $1.match(faIconReg);
|
||||||
|
const name = $1.replace(/:/g, '');
|
||||||
|
|
||||||
|
if (faMatchs) {
|
||||||
|
for (let fa = 0, len1 = faMatchs.length; fa < len1; fa++) {
|
||||||
|
const faName = faMatchs[fa].replace(/:/g, '');
|
||||||
|
|
||||||
|
return '<i class="fa ' + faName + ' fa-emoji" title="' + faName.replace('fa-', '') + '"></i>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const emdlogoMathcs = $1.match(editormdLogoReg);
|
||||||
|
const twemojiMatchs = $1.match(twemojiReg);
|
||||||
|
|
||||||
|
if (emdlogoMathcs) {
|
||||||
|
for (let x = 0, len2 = emdlogoMathcs.length; x < len2; x++) {
|
||||||
|
const logoName = emdlogoMathcs[x].replace(/:/g, '');
|
||||||
|
return '<i class="' + logoName + '" title="Editor.md logo (' + logoName + ')"></i>';
|
||||||
|
}
|
||||||
|
} else if (twemojiMatchs) {
|
||||||
|
for (let t = 0, len3 = twemojiMatchs.length; t < len3; t++) {
|
||||||
|
const twe = twemojiMatchs[t].replace(/:/g, '').replace('tw-', '');
|
||||||
|
return '<img src="' + ArticleMarkdownEngine.twemoji.path + twe + ArticleMarkdownEngine.twemoji.ext + '" title="twemoji-' + twe + '" alt="twemoji-' + twe + '" class="emoji twemoji" />';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let src = (name === '+1') ? 'plus1' : name;
|
||||||
|
src = (src === 'black_large_square') ? 'black_square' : src;
|
||||||
|
src = (src === 'moon') ? 'waxing_gibbous_moon' : src;
|
||||||
|
|
||||||
|
return '<img src="' + ArticleMarkdownEngine.emoji.path + src + ArticleMarkdownEngine.emoji.ext + '" class="emoji" title=":' + name + ':" alt=":' + name + ':" />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked @ 解析
|
||||||
|
markedRenderer.atLink = function(text) {
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 高亮标记解析
|
||||||
|
markedRenderer.mark = function(text) {
|
||||||
|
if (markReg.test(text)) {
|
||||||
|
// console.log(1,text)
|
||||||
|
const mark_replace_reg = /==(.+)==/g;
|
||||||
|
text = text.replace(markReg, function(e) {
|
||||||
|
// console.log(2,e)
|
||||||
|
return '<mark>' + e.replace(mark_replace_reg, function($1, $2) { return $2; }) + '</mark>';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 链接解析
|
||||||
|
markedRenderer.link = function(href, title, text) {
|
||||||
|
if (this.options.sanitize) {
|
||||||
|
let prot;
|
||||||
|
try {
|
||||||
|
prot = decodeURIComponent(unescape(href)).replace(/[^\w:]/g, '').toLowerCase();
|
||||||
|
} catch (e) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prot.indexOf('javascript:') === 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let out = '<a href="' + href + '"';
|
||||||
|
|
||||||
|
if (atLinkReg.test(title) || atLinkReg.test(text)) {
|
||||||
|
if (title) {
|
||||||
|
out += ' title="' + title.replace(/@/g, '@');
|
||||||
|
}
|
||||||
|
|
||||||
|
return out + '">' + text.replace(/@/g, '@') + '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (title) {
|
||||||
|
out += ' title="' + title + '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
out += '>' + text + '</a>';
|
||||||
|
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 解析标题
|
||||||
|
markedRenderer.heading = function(text, level, raw) {
|
||||||
|
|
||||||
|
const linkText = text;
|
||||||
|
const hasLinkReg = /\s*\<a\s*href\=\"(.*)\"\s*([^\>]*)\>(.*)\<\/a\>\s*/;
|
||||||
|
const getLinkTextReg = /\s*\<a\s*([^\>]+)\>([^\>]*)\<\/a\>\s*/g;
|
||||||
|
|
||||||
|
if (hasLinkReg.test(text)) {
|
||||||
|
const tempText = [];
|
||||||
|
text = text.split(/\<a\s*([^\>]+)\>([^\>]*)\<\/a\>/);
|
||||||
|
|
||||||
|
for (let i = 0, len = text.length; i < len; i++) {
|
||||||
|
tempText.push(text[i].replace(/\s*href\=\"(.*)\"\s*/g, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
text = tempText.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
text = ArticleMarkdownEngine.trim(text);
|
||||||
|
|
||||||
|
const isChinese = /^[\u4e00-\u9fa5]+$/.test(text);
|
||||||
|
// var id = (isChinese) ? escape(text).replace(/\%/g, "") : text.toLowerCase().replace(/[^\w]+/g, "-");
|
||||||
|
const id = escape(text.toLowerCase().replace(' ', '')).replace(/\%/g, ''); // 生成包含中文编码的标题ID
|
||||||
|
|
||||||
|
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
||||||
|
const toc = {
|
||||||
|
text,
|
||||||
|
level,
|
||||||
|
slug: escapedText,
|
||||||
|
id: 'h' + level + '-' + this.options.headerPrefix + id,
|
||||||
|
};
|
||||||
|
|
||||||
|
markdownToC.push(toc);
|
||||||
|
|
||||||
|
let headingHTML = '<h' + level + ' id="h' + level + '-' + this.options.headerPrefix + id + '">';
|
||||||
|
|
||||||
|
// headingHTML += "<a name=\"" + text + "\" class=\"reference-link\"></a>";
|
||||||
|
headingHTML += '<a name="' + text.replace(/<[^>]*>\s?/g, '') + '" class="reference-link"></a>';
|
||||||
|
headingHTML += '<span class="header-link octicon octicon-link"></span>';
|
||||||
|
headingHTML += (hasLinkReg) ? this.atLink(this.mark(this.emoji(linkText))) : this.mark(this.emoji(text));
|
||||||
|
headingHTML += '</h' + level + '>';
|
||||||
|
// console.log(headingHTML)
|
||||||
|
return headingHTML;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 解析分页符
|
||||||
|
markedRenderer.pageBreak = function(text) {
|
||||||
|
if (pageBreakReg.test(text) && ArticleMarkdownEngine.settings.pageBreak) {
|
||||||
|
text = '<hr style="page-break-after:always;" class="page-break editormd-page-break" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
// marked 解析段落
|
||||||
|
markedRenderer.paragraph = function(text) {
|
||||||
|
const isTeXInline = /\$\$(.*)\$\$/g.test(text);
|
||||||
|
const isTeXLine = /^\$\$(.*)\$\$$/.test(text);
|
||||||
|
const isTeXAddClass = (isTeXLine) ? ' class="' + ArticleMarkdownEngine.classNames.tex + '"' : '';
|
||||||
|
const isToC = (ArticleMarkdownEngine.settings.tocm) ? /^(\[TOC\]|\[TOCM\])$/.test(text) : /^\[TOC\]$/.test(text);
|
||||||
|
const isToCMenu = /^\[TOCM\]$/.test(text);
|
||||||
|
|
||||||
|
if (!isTeXLine && isTeXInline) {
|
||||||
|
text = text.replace(/(\$\$([^\$]*)\$\$)+/g, function($1, $2) {
|
||||||
|
return '<span class="' + ArticleMarkdownEngine.classNames.tex + '">' + $2.replace(/\$/g, '') + '</span>';
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
text = (isTeXLine) ? text.replace(/\$/g, '') : text;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tocHTML = '<div class="markdown-toc editormd-markdown-toc">' + text + '</div>';
|
||||||
|
return (isToC) ? ((isToCMenu) ? '<div class="editormd-toc-menu">' + tocHTML + '</div><br/>' : tocHTML)
|
||||||
|
: ((pageBreakReg.test(text)) ? this.pageBreak(text) : '<p' + isTeXAddClass + '>' + this.atLink(this.mark(this.emoji(text))) + '</p>\n');
|
||||||
|
};
|
||||||
|
// marked 解析代码块
|
||||||
|
markedRenderer.code = function(code, lang, escaped) {
|
||||||
|
// 自定义颜色function
|
||||||
|
function custom_color(color) {
|
||||||
|
if (color === 'red') {
|
||||||
|
return 'layui-bg-red';
|
||||||
|
} else if (color === 'orange') {
|
||||||
|
return 'layui-bg-orange';
|
||||||
|
} else if (color === 'green') {
|
||||||
|
return 'layui-bg-green';
|
||||||
|
} else if (color === 'cyan') {
|
||||||
|
return 'layui-bg-cyan';
|
||||||
|
} else if (color === 'black') {
|
||||||
|
return 'layui-bg-black';
|
||||||
|
} else if (color === 'grey') {
|
||||||
|
return 'layui-bg-grey';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (lang === 'seq' || lang === 'sequence') {
|
||||||
|
return '<div class="sequence-diagram">' + code + '</div>';
|
||||||
|
} else if (lang === 'flow') {
|
||||||
|
return '<div class="flowchart">' + code + '</div>';
|
||||||
|
} else if (lang === 'math' || lang === 'latex' || lang === 'katex') {
|
||||||
|
return '<p class="' + editormd.classNames.tex + '">' + code + '</p>';
|
||||||
|
} else if (/^mindmap/i.test(lang)) { // 思维导图
|
||||||
|
const len = 9 || 32;
|
||||||
|
const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
||||||
|
const maxPos = $chars.length;
|
||||||
|
let map_id = '';
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
map_id += $chars.charAt(Math.floor(Math.random() * maxPos));
|
||||||
|
}
|
||||||
|
// var map_id = lang.split('>')[1];
|
||||||
|
// console.log(map_id)
|
||||||
|
let custom_height;
|
||||||
|
const h = lang.split('>')[1];
|
||||||
|
if (h != undefined) {
|
||||||
|
custom_height = h;
|
||||||
|
} else {
|
||||||
|
custom_height = 150;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<svg class='mindmap' style='width:100%;min-height:150px;height:" + custom_height + "px;' id='mindmap-" + map_id + "'>" + code + '</svg>';
|
||||||
|
} else if (/^echart/i.test(lang) || /^echarts/i.test(lang)) { // echart 图表
|
||||||
|
const len = 9 || 32;
|
||||||
|
const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
||||||
|
const maxPos = $chars.length;
|
||||||
|
let map_id = '';
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
map_id += $chars.charAt(Math.floor(Math.random() * maxPos));
|
||||||
|
}
|
||||||
|
// var map_id = lang.split('>')[1];
|
||||||
|
// console.log(map_id)
|
||||||
|
let custom_height;
|
||||||
|
const h = lang.split('>')[1];
|
||||||
|
if (h != undefined) {
|
||||||
|
custom_height = h;
|
||||||
|
} else {
|
||||||
|
custom_height = 150;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<div class='echart' style='width:100%;min-height:350px;height:" + custom_height + "px;' id='echart-" + map_id + "'>" + code + '</div>';
|
||||||
|
} else if (/^timeline/i.test(lang)) { // 时间线
|
||||||
|
let time_line = '<ul class="layui-timeline">';
|
||||||
|
// console.log(code)
|
||||||
|
const timeline_code = code.split(/(\r\n\t|\n|\r\t)+/);
|
||||||
|
// console.log(timeline_code)
|
||||||
|
timeline_code.forEach(function(item, index) {
|
||||||
|
// console.log(item,index)
|
||||||
|
if (item.match(/^# /)) { // 时间标题
|
||||||
|
time_line += '<li class="layui-timeline-item" style="list-style:none;">';
|
||||||
|
time_line += '<i class="layui-icon layui-timeline-axis"></i>';
|
||||||
|
time_line += '<div class="layui-timeline-content layui-text">';
|
||||||
|
time_line += '<h3 class="layui-timeline-title" style="margin-top:0px;">';
|
||||||
|
time_line += item.replace('# ', '');
|
||||||
|
time_line += '</h3>';
|
||||||
|
} else if (/^[=]{4,}$/.test(item)) {
|
||||||
|
time_line += '</div></li>';
|
||||||
|
} else {
|
||||||
|
time_line += marked(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
time_line += '</ul>';
|
||||||
|
return time_line;
|
||||||
|
} else if (/^title/i.test(lang)) { // site-title
|
||||||
|
let site_title = '<div class="site-title" style="margin:30px 0 20px;">';
|
||||||
|
// console.log(code)
|
||||||
|
const title_code = code.split(/[(\r\n)\r\n]+/);
|
||||||
|
// console.log(title_code)
|
||||||
|
title_code.forEach(function(item, index) {
|
||||||
|
// console.log(item,index)
|
||||||
|
if (item.match(/^# /)) { // 时间标题
|
||||||
|
site_title += '<fieldset style="border: none;padding: 0;border-top: 1px solid #eee;">';
|
||||||
|
site_title += '<legend style="margin-left: 20px; padding: 0 10px; font-size: 22px; font-weight: 300;">';
|
||||||
|
site_title += '<div name="default">';
|
||||||
|
site_title += item.replace('# ', '');
|
||||||
|
site_title += '</div></legend></fieldset>';
|
||||||
|
} else {
|
||||||
|
site_title += marked(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
site_title += '</div>';
|
||||||
|
return site_title;
|
||||||
|
} else if (/^tblock/i.test(lang)) { // site-title-block
|
||||||
|
let title_block = '<div class="site-text" style="position: relative;">';
|
||||||
|
// console.log(code)
|
||||||
|
const titleblock_code = code.split(/[(\r\n)\r\n]+/);
|
||||||
|
// console.log(titleblock_code)
|
||||||
|
titleblock_code.forEach(function(item, index) {
|
||||||
|
// console.log(item,index)
|
||||||
|
if (item.match(/^# /)) { // 时间标题
|
||||||
|
title_block += '<fieldset class="layui-elem-field">';
|
||||||
|
title_block += '<legend>';
|
||||||
|
title_block += item.replace('# ', '');
|
||||||
|
title_block += '</div></legend><div class="layui-field-box">';
|
||||||
|
} else {
|
||||||
|
title_block += marked(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
title_block += '</fieldset></div>';
|
||||||
|
return title_block;
|
||||||
|
} else if (/^hr/i.test(lang)) { // 分割线
|
||||||
|
const color = lang.split(' ')[1];
|
||||||
|
const ccolor = custom_color(color);
|
||||||
|
let hr = '<hr class="' + ccolor + '">';
|
||||||
|
hr += '</hr>';
|
||||||
|
return hr;
|
||||||
|
} else if (/^card/i.test(lang)) { // 卡片面板
|
||||||
|
const color = lang.split(' ')[1];
|
||||||
|
const ccolor = custom_color(color);
|
||||||
|
let card = '<div class="layui-card">';
|
||||||
|
// console.log(code)
|
||||||
|
const card_code = code.split(/[(\r\n)\r\n]+/);
|
||||||
|
// console.log(card_code)
|
||||||
|
card_code.forEach(function(item, index) {
|
||||||
|
// console.log(item,index)
|
||||||
|
if (item.match(/^# /)) { // 时间标题
|
||||||
|
card += '<div class="layui-card-header ' + ccolor + '">';
|
||||||
|
card += item.replace('# ', '');
|
||||||
|
card += '</div>';
|
||||||
|
card += '<div class="layui-card-body">';
|
||||||
|
} else {
|
||||||
|
card += marked(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
card += '</div>';
|
||||||
|
return card;
|
||||||
|
}
|
||||||
|
|
||||||
|
return marked.Renderer.prototype.code.apply(this, arguments);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 解析表格
|
||||||
|
markedRenderer.tablecell = function(content, flags) {
|
||||||
|
const type = (flags.header) ? 'th' : 'td';
|
||||||
|
const tag = (flags.align) ? '<' + type + ' style="text-align:' + flags.align + '">' : '<' + type + '>';
|
||||||
|
|
||||||
|
return tag + this.atLink(this.emoji(content)) + '</' + type + '>\n';
|
||||||
|
};
|
||||||
|
|
||||||
|
// marked 解析列表项
|
||||||
|
markedRenderer.listitem = function(text) {
|
||||||
|
if (ArticleMarkdownEngine.settings.taskList && /^\s*\[[x\s]\]\s*/.test(text)) {
|
||||||
|
text = text.replace(/^\s*\[\s\]\s*/, '<input type="checkbox" class="task-list-item-checkbox" /> ')
|
||||||
|
.replace(/^\s*\[x\]\s*/, '<input type="checkbox" class="task-list-item-checkbox" checked disabled /> ');
|
||||||
|
|
||||||
|
return '<li style="list-style: none;">' + this.atLink(this.emoji(text)) + '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<li>' + this.atLink(this.emoji(text)) + '</li>';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return markedRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static md2html(markdownDoc) {
|
||||||
|
// let markdownDoc = (ArticleMarkdownEngine.settings.markdown === '') ? saveTo.val() : ArticleMarkdownEngine.settings.markdown;
|
||||||
|
const markdownToC = [];
|
||||||
|
|
||||||
|
const rendererOptions = {
|
||||||
|
toc: ArticleMarkdownEngine.settings.toc,
|
||||||
|
tocm: ArticleMarkdownEngine.settings.tocm,
|
||||||
|
tocStartLevel: ArticleMarkdownEngine.settings.tocStartLevel,
|
||||||
|
taskList: ArticleMarkdownEngine.settings.taskList,
|
||||||
|
emoji: ArticleMarkdownEngine.settings.emoji,
|
||||||
|
tex: ArticleMarkdownEngine.settings.tex,
|
||||||
|
pageBreak: ArticleMarkdownEngine.settings.pageBreak,
|
||||||
|
atLink: ArticleMarkdownEngine.settings.atLink, // for @link
|
||||||
|
emailLink: ArticleMarkdownEngine.settings.emailLink, // for mail address auto link
|
||||||
|
flowChart: ArticleMarkdownEngine.settings.flowChart,
|
||||||
|
sequenceDiagram: ArticleMarkdownEngine.settings.sequenceDiagram,
|
||||||
|
previewCodeHighlight: ArticleMarkdownEngine.settings.previewCodeHighlight,
|
||||||
|
};
|
||||||
|
|
||||||
|
const markedOptions = {
|
||||||
|
renderer: this.markedRenderer(markdownToC, rendererOptions),
|
||||||
|
gfm: ArticleMarkdownEngine.settings.gfm,
|
||||||
|
tables: true,
|
||||||
|
breaks: true,
|
||||||
|
pedantic: false,
|
||||||
|
// MODIFY:允许 html tag,不进行转义
|
||||||
|
sanitize: false,
|
||||||
|
smartLists: true,
|
||||||
|
// MODIFY:不转义引号
|
||||||
|
smartypants: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
marked.setOptions(markedOptions);
|
||||||
|
markdownDoc = markdownDoc.replace(/ /g, ' ');
|
||||||
|
markdownDoc = markdownDoc.replace(/>/g, '>');
|
||||||
|
let markdownParsed = marked.parse(markdownDoc);
|
||||||
|
|
||||||
|
markdownParsed = this.filterHTMLTags(markdownParsed, ArticleMarkdownEngine.settings.htmlDecode);
|
||||||
|
return markdownParsed;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
<template id="article-query-template">
|
||||||
|
<v-list dense class="ma-2">
|
||||||
|
<v-list-item-group
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
<v-list-item
|
||||||
|
v-for="(item, i) in articleList"
|
||||||
|
:key="item.id"
|
||||||
|
>
|
||||||
|
<v-list-item-icon class="ma-0 mr-2 mt-2">
|
||||||
|
<span>{{i+1}}. </span>
|
||||||
|
</v-list-item-icon>
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-list-item-title v-text="item.articleTitle"></v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list-item-group>
|
||||||
|
</v-list>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
Vue.component("article-query-template", {
|
||||||
|
template: "#article-query-template",
|
||||||
|
name: "article-query-template",
|
||||||
|
props: {
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
params: {
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
handler(value, oValue) {
|
||||||
|
if(value) {
|
||||||
|
this.getArticleList(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
articleList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
console.log("created", this.params)
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async getArticleList(paramObj) {
|
||||||
|
const result = await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'home_content',
|
||||||
|
actionId: "selectItemList",
|
||||||
|
actionData: paramObj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.articleList = result.data.appData.resultData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
<script>
|
||||||
|
class JhTagEngine {
|
||||||
|
currentArticleContentSection;
|
||||||
|
articleContentText;
|
||||||
|
|
||||||
|
// 替换正则特殊符号
|
||||||
|
replaceSpecialChat(string) {
|
||||||
|
return string.replace(/\[/g, '___【___').replace(/]/g, '___】___').replace(/\//g, '___、___');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 还原正则特殊符号
|
||||||
|
restoreSpecialChat(string) {
|
||||||
|
return string.replace(/___n___/g, '\n').replace(/___【___/g, '[').replace(/___】___/g, ']').replace(/___、___/g, '/');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提取articleQueryList
|
||||||
|
async jhArticleQueryTagListHandle() {
|
||||||
|
this.currentArticleContentSection.forEach((articleItem, index) => {
|
||||||
|
articleItem.content = articleItem.content.replace(/\n/g, '___n___')
|
||||||
|
const _articleQueryList = articleItem.content.match(/\[jh-article-query.+\[\/jh-article-query\]/g);
|
||||||
|
if(_articleQueryList && _articleQueryList.length) {
|
||||||
|
articleItem.children = [];
|
||||||
|
_articleQueryList.forEach((query, qIndex) => {
|
||||||
|
// 1. 提取query的内容
|
||||||
|
let queryContent = query.replace(/(.*)\[jh-article-query]/, '').replace(/(.*)\[\/jh-article-query]/, '$1');
|
||||||
|
queryContent = queryContent.replace(/___n___/g, '');
|
||||||
|
const queryMap = JSON.parse(queryContent);
|
||||||
|
if(query === articleItem.content) {
|
||||||
|
articleItem.type = 'articleQuery';
|
||||||
|
articleItem.params = queryMap;
|
||||||
|
articleItem.children = null;
|
||||||
|
} else {
|
||||||
|
// 转化内容特殊符号
|
||||||
|
articleItem.content = this.replaceSpecialChat(articleItem.content);
|
||||||
|
// 分割内容
|
||||||
|
let resourceContent = articleItem.content;
|
||||||
|
if(articleItem.children.length) {
|
||||||
|
resourceContent = articleItem.children.pop();
|
||||||
|
}
|
||||||
|
const contentList = resourceContent.split(this.replaceSpecialChat(query));
|
||||||
|
// 把每次split的list拼接到children
|
||||||
|
articleItem.children = articleItem.children.concat(contentList)
|
||||||
|
// 同时在最后一条的位置上拼接上query类型数据
|
||||||
|
articleItem.children.splice(articleItem.children.length - 1, 0, {
|
||||||
|
type: 'articleQuery', params: queryMap
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(articleItem.children) {
|
||||||
|
articleItem.children = articleItem.children.map((content, index) => {
|
||||||
|
if (typeof content == 'string') {
|
||||||
|
return {
|
||||||
|
type: 'text', content: this.restoreSpecialChat(content)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
articleItem.content = this.restoreSpecialChat(articleItem.content);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// jhPdfViewer [jh-pdf-viewer src="/__appId__/upload\articleMaterial\30009\1668869349745_生态高尔夫与高尔夫球场环境认证_戴子云.pdf"/]
|
||||||
|
async jhPdfViewer() {
|
||||||
|
// 如存在pdf 则把 原有content index 下的 {type: 'text', src: 'xxx'} 替换为 {type: 'text', src: 'xxx'},{type: 'pdfViewer', src: 'xxx'},{type: 'text', src: 'xxx'}
|
||||||
|
// content 数组从后往前替换避免 index 变化问题
|
||||||
|
const replaceArray = [];
|
||||||
|
this.currentArticleContentSection.forEach((articleItem, index) => {
|
||||||
|
let content = articleItem.content;
|
||||||
|
const pdfObj = {
|
||||||
|
contentIndex: index,
|
||||||
|
content: []
|
||||||
|
};
|
||||||
|
const _pdfViewList = articleItem.content.match(/\[jh-pdf-viewer.+\/]/g);
|
||||||
|
if(_pdfViewList && _pdfViewList.length) {
|
||||||
|
_pdfViewList.forEach((query, qIndex) => {
|
||||||
|
pdfObj.content.pop();
|
||||||
|
// 1. 提取标签/src 的内容 {src: 'xxx'}
|
||||||
|
const params = this.extractedPdfViewer(query);
|
||||||
|
|
||||||
|
// 2. 提取 pdf-viewer 前的content text内容 和自己
|
||||||
|
const contentArr = content.split(query);
|
||||||
|
pdfObj.content.push({ type: 'text', content: contentArr[0] });
|
||||||
|
pdfObj.content.push({ type: 'pdfViewer', params });
|
||||||
|
|
||||||
|
// 3. push 暂存剩余文本至最后一个
|
||||||
|
contentArr.splice(0, 1)
|
||||||
|
content = contentArr.join(query);
|
||||||
|
pdfObj.content.push({ type: 'text', content });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(pdfObj.content.length) {
|
||||||
|
replaceArray.unshift(pdfObj);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// replaceArray [{contentIndex: 1, content: [{type: 'text', content: 'xxx'},{type: 'pdfViewer', src: 'xxx'},{type: 'text', content: 'xxx'}]}]
|
||||||
|
replaceArray.forEach((item, index) => {
|
||||||
|
this.currentArticleContentSection.splice(item.contentIndex, 1, ...item.content);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
lineToUpper(split, str) {
|
||||||
|
return str.split(split).map((e, i) => {
|
||||||
|
return i ? e.slice(0, 1).toUpperCase() + e.slice(1) : e
|
||||||
|
}).join('')
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提取toggleList
|
||||||
|
async jhTagTemplateHandler(_articleContentText) {
|
||||||
|
this.articleContentText = _articleContentText || '';
|
||||||
|
// \n会导致正则失败
|
||||||
|
this.articleContentText = this.articleContentText.replace(/\n/g, '___n___');
|
||||||
|
// 1. 提取toggle标签对
|
||||||
|
const _toggleList = this.articleContentText.match(/\[jh-toggle[\s\S]*?\[\/jh-toggle\]/g);
|
||||||
|
// [、]、/ 这些正则符号会导致替换失败,使用替代符号暂时替代
|
||||||
|
this.articleContentText = this.replaceSpecialChat(this.articleContentText);
|
||||||
|
// toggleList 未必会包含articleQueryList
|
||||||
|
if (_toggleList && _toggleList.length) {
|
||||||
|
_toggleList.forEach((item, index) => {
|
||||||
|
// 替换的正则,同上处理
|
||||||
|
const regExp = this.replaceSpecialChat(item);
|
||||||
|
// toggle标签分割内容
|
||||||
|
this.splitContent(index, regExp);
|
||||||
|
this.covertContentString2Json();
|
||||||
|
this.extractedToggle(item);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.currentArticleContentSection = [{
|
||||||
|
type: 'text', content: this.replaceSpecialChat(this.articleContentText)
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
// 提取articleQuery
|
||||||
|
this.jhArticleQueryTagListHandle();
|
||||||
|
this.jhPdfViewer();
|
||||||
|
return this.currentArticleContentSection;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分割content body数组
|
||||||
|
splitContent(index, regExp) {
|
||||||
|
if (index === 0) {
|
||||||
|
this.currentArticleContentSection = this.articleContentText.split(regExp);
|
||||||
|
} else {
|
||||||
|
const lastArticleContent = this.replaceSpecialChat(this.currentArticleContentSection.pop().content.replace(/\n/g, '___n___'));
|
||||||
|
const lastArticleContentArr = lastArticleContent.split(regExp)
|
||||||
|
this.currentArticleContentSection = this.currentArticleContentSection.concat(lastArticleContentArr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
covertContentString2Json() {
|
||||||
|
this.currentArticleContentSection = this.currentArticleContentSection.map((content, index) => {
|
||||||
|
if (typeof content == 'string') {
|
||||||
|
return {
|
||||||
|
type: 'text', content: this.restoreSpecialChat(content)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
extractedToggle(item) {
|
||||||
|
// 通toggle中提取内容
|
||||||
|
let toggleDomStr = item.split(']')[0].substring('[jh-toggle '.length);
|
||||||
|
let toggleDom = {};
|
||||||
|
|
||||||
|
const attrList = toggleDomStr.match(/['"][\s\S]*?['"]/g);
|
||||||
|
attrList.forEach(e => {
|
||||||
|
e = e.replace(/['"]/g, '');
|
||||||
|
const targetStr = e.replace(/\s/g, '');
|
||||||
|
toggleDomStr = toggleDomStr.replace(e, targetStr)
|
||||||
|
})
|
||||||
|
toggleDomStr.split(' ').forEach(e => {
|
||||||
|
toggleDom = Object.assign(toggleDom, {
|
||||||
|
[this.lineToUpper('-', e.split('=')[0])]: e.split('=')[1].replace(/"/g, '')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
let toggleContent = item.split(']').slice(1).join(']').replace(/(.*)\[\/jh-toggle]/, '$1');
|
||||||
|
// toggleContent = toggleContent.slice(toggleContent.length - 1, 1);
|
||||||
|
this.currentArticleContentSection.splice(this.currentArticleContentSection.length - 1, 0, {
|
||||||
|
type: 'toggle', content: this.restoreSpecialChat(toggleContent), params: toggleDom
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
extractedPdfViewer(item) {
|
||||||
|
// 通toggle中提取内容
|
||||||
|
let domStr = item.split('/]')[0].substring('[jh-pdf-viewer '.length);
|
||||||
|
let dom = {};
|
||||||
|
|
||||||
|
const attrList = domStr.match(/['"][\s\S]*?['"]/g);
|
||||||
|
attrList.forEach(e => {
|
||||||
|
e = e.replace(/['"]/g, '');
|
||||||
|
const targetStr = e.replace(/\s/g, '');
|
||||||
|
domStr = domStr.replace(e, targetStr)
|
||||||
|
})
|
||||||
|
domStr.split(' ').forEach(e => {
|
||||||
|
dom = Object.assign(dom, {
|
||||||
|
[this.lineToUpper('-', e.split('=')[0])]: e.split('=')[1].replace(/"/g, '')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return dom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
<!--md2html.html start-->
|
||||||
|
<script src="/<$ ctx.app.config.appId $>/public/plugins/editor.md/lib/marked.min.js"></script>
|
||||||
|
<template id="md2html">
|
||||||
|
<div>
|
||||||
|
<template v-for="(item, index) of currentArticleContentSection">
|
||||||
|
<template v-if="item.type === 'text'">
|
||||||
|
<template v-if="item.children">
|
||||||
|
<template v-for="(child, cindex) of item.children">
|
||||||
|
<template v-if="child.type === 'text'">
|
||||||
|
<div ref="artContent" class="content pa-5 markdown-body editormd-html-preview"
|
||||||
|
:id="'artContent' + Math.floor(Math.random() * 9999)" :data-content="child.content">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="child.type === 'articleQuery'">
|
||||||
|
<article-query-template :params="child.params"></article-query-template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div ref="artContent" class="content pa-5 markdown-body editormd-html-preview"
|
||||||
|
:id="'artContent' + Math.floor(Math.random() * 9999)" :data-content="item.content">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-if="item.type === 'toggle'">
|
||||||
|
<toggle-template :params="item.params" @open="renderMarkdown">
|
||||||
|
<template v-if="item.children">
|
||||||
|
<template v-for="(child, cIndex) of item.children">
|
||||||
|
<template v-if="child.type === 'text'">
|
||||||
|
<div ref="artContent" class="content pa-5 markdown-body editormd-html-preview"
|
||||||
|
:id="'artContent' + Math.floor(Math.random() * 9999)" :data-content="child.content">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="child.type === 'articleQuery'">
|
||||||
|
<article-query-template :params="child.params"></article-query-template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div ref="artContent" class="content pa-5 markdown-body editormd-html-preview"
|
||||||
|
:id="'artContent' + Math.floor(Math.random() * 9999)" :data-content="item.content">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</toggle-template>
|
||||||
|
</template>
|
||||||
|
<template v-if="item.type === 'articleQuery'">
|
||||||
|
<article-query-template :params="item.params"></article-query-template>
|
||||||
|
</template>
|
||||||
|
<template v-if="item.type === 'pdfViewer'">
|
||||||
|
<pdf-viewer :params="item.params"></pdf-viewer>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
{% include 'component/markdown2html/jhTagEngine.html' %}
|
||||||
|
{% include 'component/markdown2html/toggleTemplate.html' %}
|
||||||
|
{% include 'component/markdown2html/articleQueryTemplate.html' %}
|
||||||
|
{% include 'component/markdown2html/articleMarkdownEngine.html' %}
|
||||||
|
{% include 'component/markdown2html/pdfViewerTemplate.html' %}
|
||||||
|
<script>
|
||||||
|
Vue.component("md2html", {
|
||||||
|
vuetify: new Vuetify(),
|
||||||
|
name: 'md2html',
|
||||||
|
props: ['articleContent'],
|
||||||
|
data: () => ({
|
||||||
|
currentArticleContentSection: []
|
||||||
|
}),
|
||||||
|
created() {
|
||||||
|
this.jhTagEngine = new JhTagEngine();
|
||||||
|
if(this.articleContent) {
|
||||||
|
this.renderContent();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
articleContent: {
|
||||||
|
handler(value) {
|
||||||
|
this.clearOldContent();
|
||||||
|
if(value) {
|
||||||
|
this.renderContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearOldContent() {
|
||||||
|
const artContentRefs = this.$refs.artContent;
|
||||||
|
if (artContentRefs && artContentRefs.length) {
|
||||||
|
artContentRefs.forEach(artContent => {
|
||||||
|
artContent.innerHTML = "";
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.currentArticleContentSection = [];
|
||||||
|
},
|
||||||
|
renderMarkdown () {
|
||||||
|
const artContentRefs = this.$refs.artContent;
|
||||||
|
if (artContentRefs && artContentRefs.length) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.markdownToHTML(artContentRefs);
|
||||||
|
this.isContentLoading = false;
|
||||||
|
}, 300)
|
||||||
|
} else {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this.renderContent();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
markdownToHTML(artContentRefs) {
|
||||||
|
artContentRefs.forEach(artContent => {
|
||||||
|
const contentText = artContent.dataset.content;
|
||||||
|
artContent.innerHTML = ArticleMarkdownEngine.md2html(contentText);
|
||||||
|
})
|
||||||
|
this.$emit('complete')
|
||||||
|
},
|
||||||
|
async renderContent() {
|
||||||
|
const newArticleContent = this.articleContent.replace(/\/__appId__\/upload\//g, '/<$ ctx.app.config.appId $>/upload/')
|
||||||
|
this.currentArticleContentSection = await this.jhTagEngine.jhTagTemplateHandler(newArticleContent);
|
||||||
|
this.renderMarkdown();
|
||||||
|
},
|
||||||
|
dayjs: dayjs
|
||||||
|
},
|
||||||
|
template: '#md2html'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style scope>
|
||||||
|
.articleOtherInfoBox span:last-child {
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
.articleOtherInfoBox span {
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
.editormd-preview-container ol.linenums li, .editormd-html-preview ol.linenums li {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
.editormd-preview-container ol.linenums, .editormd-html-preview ol.linenums {
|
||||||
|
color: #999;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.markdown-body pre {
|
||||||
|
font-family: unset;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.markdown-body pre code {
|
||||||
|
background-color: unset !important;
|
||||||
|
font-family: unset !important;
|
||||||
|
max-width: 100%;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!--md2html.html end-->
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
<template id="pdf-viewer">
|
||||||
|
<div style="width: 100%; padding: 65% 0;position: relative;">
|
||||||
|
<iframe :src="'/<$ ctx.app.config.appId $>/public/pdf/web/viewer.html?file=' + src" frameborder="0" style="position: absolute;width: 100%; height: 100%; top: 0;left: 0"></iframe>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
Vue.component("pdf-viewer", {
|
||||||
|
template: "#pdf-viewer",
|
||||||
|
name: "pdf-viewer",
|
||||||
|
props: {
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
appId: '<$ ctx.app.config.appId $>',
|
||||||
|
prefix: '<$ ctx.app.config.downloadBasePath $>',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
src() {
|
||||||
|
if (this.params.src) {
|
||||||
|
// 替换appId
|
||||||
|
const src = this.params.src.replace('__appId__', this.appId);
|
||||||
|
if (src.includes('/upload/')) {
|
||||||
|
return encodeURIComponent(this.prefix + '/' + src.split('upload')[1]);
|
||||||
|
} else {
|
||||||
|
return encodeURIComponent(this.prefix + src);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
|
||||||
|
<template id="toggle-template">
|
||||||
|
<div>
|
||||||
|
<v-expansion-panels style="width: calc(100% - 20px); margin: 10px;" @change="onOpen">
|
||||||
|
<v-expansion-panel>
|
||||||
|
<v-expansion-panel-header>{{_params['title']}}</v-expansion-panel-header>
|
||||||
|
<v-expansion-panel-content>
|
||||||
|
<slot></slot>
|
||||||
|
</v-expansion-panel-content>
|
||||||
|
</v-expansion-panel>
|
||||||
|
</v-expansion-panels>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
Vue.component("toggle-template", {
|
||||||
|
template: "#toggle-template",
|
||||||
|
name: "toggle-template",
|
||||||
|
props: {
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {
|
||||||
|
title: '测试标题',
|
||||||
|
defaultOpen: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
_params() {
|
||||||
|
return this.params;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
params: {
|
||||||
|
deep: true,
|
||||||
|
handler(value, oldValue) {
|
||||||
|
// console.log('params', value, oldValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onOpen(status) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this.$emit('open', status)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,237 @@
|
|||||||
|
<template id="select-org-user-dialog">
|
||||||
|
<v-dialog v-model="show" width="80%">
|
||||||
|
<v-card>
|
||||||
|
<v-row no-gutters>
|
||||||
|
<span class="text-h7 font-weight-bold pa-4">请选择</span>
|
||||||
|
</v-row>
|
||||||
|
<v-divider class="jh-divider"></v-divider>
|
||||||
|
<v-progress-linear
|
||||||
|
indeterminate
|
||||||
|
v-if="isLoading"
|
||||||
|
color="primary"
|
||||||
|
></v-progress-linear>
|
||||||
|
<v-card-text>
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="6" style="height: 400px; overflow: auto">
|
||||||
|
<v-text-field
|
||||||
|
v-model="search"
|
||||||
|
label="搜索"
|
||||||
|
class="jh-v-input mt-4"
|
||||||
|
dense
|
||||||
|
single-line
|
||||||
|
filled
|
||||||
|
clear-icon="mdi-close-circle-outline"
|
||||||
|
></v-text-field>
|
||||||
|
|
||||||
|
<v-treeview
|
||||||
|
:items="treeData"
|
||||||
|
v-model="selectedIds"
|
||||||
|
selectable
|
||||||
|
:search="search"
|
||||||
|
activatable
|
||||||
|
open-on-click
|
||||||
|
:filter="filter"
|
||||||
|
:open.sync="open"
|
||||||
|
></v-treeview>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="6">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title>已选择的人员</v-card-title>
|
||||||
|
<v-list dense>
|
||||||
|
<div v-for="(item, index) in selectedItems" :key="index">
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-avatar>
|
||||||
|
<v-avatar color="primary" size="30">
|
||||||
|
<span class="white--text">{{ item.username[0] }}</span>
|
||||||
|
</v-avatar>
|
||||||
|
</v-list-item-avatar>
|
||||||
|
|
||||||
|
<v-list-item-title>{{ item.username }}</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
<v-divider></v-divider>
|
||||||
|
</div>
|
||||||
|
</v-list>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="primary" text @click="doUiAction('confirm')">
|
||||||
|
确定
|
||||||
|
</v-btn>
|
||||||
|
<v-btn text @click="$emit('update:show', false)"> 取消 </v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
Vue.component("select-org-user-dialog", {
|
||||||
|
template: "#select-org-user-dialog",
|
||||||
|
props: {
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
selectedIds: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
// 用于判断是否禁用
|
||||||
|
selectedOriginItems: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
// 显示类型,按组织结构显示还是直接显示,org: 按组织结构显示,user: 直接显示
|
||||||
|
showType: {
|
||||||
|
type: String,
|
||||||
|
default: "org",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: () => ({
|
||||||
|
userList: [],
|
||||||
|
treeData: [],
|
||||||
|
|
||||||
|
search: null,
|
||||||
|
open: [],
|
||||||
|
|
||||||
|
isLoading: false,
|
||||||
|
}),
|
||||||
|
created() {
|
||||||
|
this.doUiAction("getUserList");
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
filter() {
|
||||||
|
return (item, search, textKey) => item[textKey].indexOf(search) > -1;
|
||||||
|
},
|
||||||
|
selectedItems() {
|
||||||
|
const data = [];
|
||||||
|
this.selectedIds.map((id) => {
|
||||||
|
const currentUser = this.userList.find((item) => item.userId === id);
|
||||||
|
|
||||||
|
if (currentUser) {
|
||||||
|
let readonly = currentUser.readonly;
|
||||||
|
if (this.selectedOriginItems) {
|
||||||
|
const currentOriginUser = this.selectedOriginItems.find((item) => item.userId === id);
|
||||||
|
if (currentOriginUser) {
|
||||||
|
readonly = currentOriginUser.readonly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.push({
|
||||||
|
id: currentUser.id,
|
||||||
|
username: currentUser.username,
|
||||||
|
userId: currentUser.userId,
|
||||||
|
position: currentUser.position,
|
||||||
|
qiweiId: currentUser.qiweiId,
|
||||||
|
readonly,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
show(val) {
|
||||||
|
if (val) {
|
||||||
|
this.buildTreeData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async doUiAction(uiActionId, uiActionData) {
|
||||||
|
switch (uiActionId) {
|
||||||
|
case "getUserList":
|
||||||
|
await this.getUserList(uiActionData);
|
||||||
|
await this.buildTreeData();
|
||||||
|
break;
|
||||||
|
case "confirm":
|
||||||
|
this.$emit("confirm", this.selectedItems);
|
||||||
|
this.$emit("update:selectedIds", this.selectedIds);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getUserList() {
|
||||||
|
this.isLoading = true;
|
||||||
|
const rows = (
|
||||||
|
await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: "afficheManagement",
|
||||||
|
actionId: "getUserList",
|
||||||
|
actionData: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).data.appData.resultData.rows;
|
||||||
|
this.isLoading = false;
|
||||||
|
|
||||||
|
this.userList = rows;
|
||||||
|
console.log('this.userList',this.userList );
|
||||||
|
},
|
||||||
|
async buildTreeData() {
|
||||||
|
let data = [...this.userList];
|
||||||
|
if (this.selectedOriginItems) {
|
||||||
|
data = data.map((item) => {
|
||||||
|
item.disabled = false;
|
||||||
|
this.selectedOriginItems.map((user) => {
|
||||||
|
if (item.userId === user.userId) {
|
||||||
|
item.disabled = user.readonly;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.showType === "user") {
|
||||||
|
this.treeData = data.map((item) => ({
|
||||||
|
id: item.userId,
|
||||||
|
userId: item.userId,
|
||||||
|
name: item.username,
|
||||||
|
disabled: item.disabled,
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const treeData = [];
|
||||||
|
|
||||||
|
data.forEach((item, index) => {
|
||||||
|
const items = item.groupAllName || "无组织";
|
||||||
|
const parts = items.split("-");
|
||||||
|
let currentLevel = treeData;
|
||||||
|
|
||||||
|
parts.forEach((part, partIndex) => {
|
||||||
|
let existingNode = currentLevel.find((node) => node.name === part);
|
||||||
|
if (!existingNode) {
|
||||||
|
const newNode = {
|
||||||
|
id: `${index}-${partIndex}`,
|
||||||
|
name: part,
|
||||||
|
children: [],
|
||||||
|
};
|
||||||
|
currentLevel.push(newNode);
|
||||||
|
currentLevel = newNode.children;
|
||||||
|
} else {
|
||||||
|
currentLevel = existingNode.children;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
currentLevel.push({
|
||||||
|
id: item.userId,
|
||||||
|
userId: item.userId,
|
||||||
|
name: item.username,
|
||||||
|
disabled: item.disabled,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.treeData = treeData;
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
@@ -0,0 +1,725 @@
|
|||||||
|
{% extends 'template/jhTemplateV4.html'%} {% block vueTemplate %}
|
||||||
|
|
||||||
|
<script type="text/html" id="app-template">
|
||||||
|
<div>
|
||||||
|
<v-app mobile-breakpoint="sm">
|
||||||
|
<jh-menu />
|
||||||
|
<v-main class="mt-15">
|
||||||
|
<!-- 头部内容 >>>>>>>>>>>>> -->
|
||||||
|
<div class="jh-page-second-bar px-8">
|
||||||
|
<v-row class="align-center">
|
||||||
|
<v-col cols="12" xs="12" sm="12" md="4" xl="3">
|
||||||
|
<div class="py-4 text-body-1 font-weight-bold">公告管理
|
||||||
|
<!-- 帮助页按钮 -->
|
||||||
|
<span role="button" class="success--text font-weight-regular jh-font-size-13 ml-2" @click="isHelpPageDrawerShown = true">
|
||||||
|
<v-icon size="13" class="success--text">mdi-help-circle-outline</v-icon>帮助
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
<!-- <<<<<<<<<<<<< 头部内容 -->
|
||||||
|
|
||||||
|
<div class="jh-page-body-container px-8">
|
||||||
|
<!-- 页面内容 >>>>>>>>>>>>> -->
|
||||||
|
<v-card class="rounded-lg">
|
||||||
|
<v-row class="ma-0 pa-4 d-flex align-center">
|
||||||
|
<!-- 新增按钮 -->
|
||||||
|
<v-btn color="success" class="elevation-0 mr-2" @click="doUiAction('startCreateItem')" small>新建公告
|
||||||
|
</v-btn>
|
||||||
|
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
|
||||||
|
<v-col cols="12" xs="8" sm="4" md="3" class="pa-0">
|
||||||
|
<v-text-field color="success" v-model="searchInput" prefix="搜索:" class="jh-v-input" dense filled single-line></v-text-field>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<v-data-table
|
||||||
|
:headers="headers"
|
||||||
|
:items="tableData"
|
||||||
|
:search="searchInput"
|
||||||
|
:footer-props="{ itemsPerPageOptions: [20, 50, -1], itemsPerPageText: '每页', itemsPerPageAllText: '所有'}"
|
||||||
|
:items-per-page="-1"
|
||||||
|
mobile-breakpoint="0"
|
||||||
|
:loading="isTableLoading"
|
||||||
|
checkbox-color="success"
|
||||||
|
:class="{'zebraLine': isTableZebraLineShown }"
|
||||||
|
fixed-header
|
||||||
|
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
|
||||||
|
|
||||||
|
<template v-slot:item.afficheDesc="{ item }">
|
||||||
|
<div v-html="item.afficheDesc" @click="doUiAction('viewItem', { item })"></div>
|
||||||
|
</template>
|
||||||
|
<!-- 表格操作按钮 -->
|
||||||
|
<template v-slot:item.action="{ item }">
|
||||||
|
<span role="button" class="primary--text font-weight-medium font-size-2" @click="doUiAction('viewItem', { item })">
|
||||||
|
<v-icon size="16" class="primary--text">mdi-note-edit-outline</v-icon>预览
|
||||||
|
</span>
|
||||||
|
<span v-if="item.afficheStatus==='草稿'" role="button" class="primary--text font-weight-medium font-size-2" @click="doUiAction('startUpdateItem', { item })">
|
||||||
|
<v-icon size="16" class="primary--text">mdi-note-edit-outline</v-icon>修改
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<!-- <template v-slot:item.afficheTitle="{ item }">
|
||||||
|
<a @click="doUiAction('viewItem', { item })">{{item.afficheTitle}}</a>
|
||||||
|
</template> -->
|
||||||
|
<!-- 没有数据 -->
|
||||||
|
<template v-slot:loading>
|
||||||
|
<div class="jh-no-data">数据加载中</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:no-data>
|
||||||
|
<div class="jh-no-data">暂无数据</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:no-results>
|
||||||
|
<div class="jh-no-data">暂无数据</div>
|
||||||
|
</template>
|
||||||
|
<!-- 表格分页 -->
|
||||||
|
<template v-slot:footer.page-text="pagination">
|
||||||
|
<span>{{pagination.pageStart}}-{{pagination.pageStop}}</span>
|
||||||
|
<span class="ml-1">共{{pagination.itemsLength}}条</span>
|
||||||
|
</template>
|
||||||
|
</v-data-table>
|
||||||
|
</v-card>
|
||||||
|
<!-- 新增抽屉 -->
|
||||||
|
<v-navigation-drawer v-if="isCreateDrawerShown" v-model="isCreateDrawerShown" :permanent="isCreateDrawerShown" fixed temporary right width="80%" class="elevation-24">
|
||||||
|
<v-form ref="createForm" lazy-validation>
|
||||||
|
<!-- 抽屉标题 -->
|
||||||
|
<v-row no-gutters>
|
||||||
|
<span class="text-h7 font-weight-bold pa-4">新建公告</span>
|
||||||
|
</v-row>
|
||||||
|
<v-divider class="jh-divider"></v-divider>
|
||||||
|
<!-- 抽屉表单 -->
|
||||||
|
<!-- <v-text-field class="jh-v-input" dense single-line filled v-model="createItem.xxxId" :rules="validationRules.requireRules"></v-text-field> -->
|
||||||
|
<v-row class="mt-0 px-4">
|
||||||
|
<v-col cols="12" sm="12" md="4">
|
||||||
|
<span class="jh-input-label"><span class="red--text">*</span>公告名称</span>
|
||||||
|
<v-text-field :rules="validationRules.requireRules" :rules="validationRules.requireRules" class="jh-v-input" dense single-line filled v-model="createItem.afficheTitle"></v-text-field>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="12" md="4">
|
||||||
|
<span class="jh-input-label"><span class="red--text">*</span>通知范围</span>
|
||||||
|
<v-text-field
|
||||||
|
:rules="validationRules.requireRules"
|
||||||
|
multiple
|
||||||
|
class="jh-v-input"
|
||||||
|
dense single-line filled v-model="createItem.afficheMemberIdList"
|
||||||
|
readonly
|
||||||
|
@click="isDialogShown=true"
|
||||||
|
>
|
||||||
|
<template v-slot:selection="{ item, index }">
|
||||||
|
<v-chip v-if="index === 0">
|
||||||
|
<span>{{ item }}</span>
|
||||||
|
</v-chip>
|
||||||
|
<span
|
||||||
|
v-if="index === 1"
|
||||||
|
class="grey--text text-caption"
|
||||||
|
>
|
||||||
|
(+{{ createItem?.afficheMemberIdList?.length - 1 }} others)
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</v-text-field>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col cols="12" sm="12" md="12">
|
||||||
|
<span class="jh-input-label"><span class="red--text">*</span>公告内容</span>
|
||||||
|
|
||||||
|
<div id="editorMdContainer">
|
||||||
|
<textarea style="display:none;">{{ createItem.afficheContent }}</textarea>
|
||||||
|
</div>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 抽屉操作按钮 -->
|
||||||
|
<v-row class="justify-end mx-0 mt-8 px-6">
|
||||||
|
<v-btn color="success" @click="doUiAction('createItem', {afficheStatus: '已发送'})" small>发送</v-btn>
|
||||||
|
<v-btn color="success" class="ml-2" @click="doUiAction('createItem', {afficheStatus: '草稿'})" small>存为草稿</v-btn>
|
||||||
|
<v-btn class="elevation-0 ml-2" @click="isCreateDrawerShown = false" small>取消</v-btn>
|
||||||
|
</v-row>
|
||||||
|
</v-form>
|
||||||
|
<select-org-user-dialog
|
||||||
|
:show.sync="isDialogShown"
|
||||||
|
:selected-ids.sync="createItem.afficheMemberIdList"
|
||||||
|
@confirm="doUiAction('addPerson', $event)"
|
||||||
|
></select-org-user-dialog>
|
||||||
|
<!-- 抽屉关闭按钮 -->
|
||||||
|
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn" @click="isCreateDrawerShown = false">
|
||||||
|
<v-icon>mdi-close</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
|
||||||
|
<!-- 更新抽屉 -->
|
||||||
|
<v-navigation-drawer v-if="isUpdateDrawerShown" v-model="isUpdateDrawerShown" :permanent="isUpdateDrawerShown" fixed temporary right width="80%" class="elevation-24">
|
||||||
|
<v-form ref="createForm" lazy-validation>
|
||||||
|
<!-- 抽屉标题 -->
|
||||||
|
<v-row no-gutters>
|
||||||
|
<span class="text-h7 font-weight-bold pa-4">编辑公告</span>
|
||||||
|
</v-row>
|
||||||
|
<v-divider class="jh-divider"></v-divider>
|
||||||
|
<v-row class="mt-0 px-4">
|
||||||
|
<v-col cols="12" sm="12" md="4">
|
||||||
|
<span class="jh-input-label"><span class="red--text">*</span>公告名称</span>
|
||||||
|
<v-text-field :rules="validationRules.requireRules" :rules="validationRules.requireRules" class="jh-v-input" dense single-line filled v-model="updateItem.afficheTitle"></v-text-field>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="12" md="4">
|
||||||
|
<span class="jh-input-label"><span class="red--text">*</span>通知范围</span>
|
||||||
|
<v-text-field
|
||||||
|
:rules="validationRules.requireRules"
|
||||||
|
multiple
|
||||||
|
class="jh-v-input"
|
||||||
|
dense single-line filled v-model="updateItem.afficheMemberIdList"
|
||||||
|
readonly
|
||||||
|
@click="isDialogShown=true"
|
||||||
|
>
|
||||||
|
<template v-slot:selection="{ item, index }">
|
||||||
|
<v-chip v-if="index === 0">
|
||||||
|
<span>{{ item }}</span>
|
||||||
|
</v-chip>
|
||||||
|
<span
|
||||||
|
v-if="index === 1"
|
||||||
|
class="grey--text text-caption"
|
||||||
|
>
|
||||||
|
(+{{ updateItem?.afficheMemberIdList?.length - 1 }} others)
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</v-text-field>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<v-col cols="12" sm="12" md="12">
|
||||||
|
<span class="jh-input-label"><span class="red--text">*</span>公告内容</span>
|
||||||
|
|
||||||
|
<div id="editorMdContainer">
|
||||||
|
<textarea style="display:none;">{{ updateItem.afficheContent }}</textarea>
|
||||||
|
</div>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
</v-row>
|
||||||
|
|
||||||
|
<!-- 抽屉操作按钮 -->
|
||||||
|
<v-row class="justify-end mx-0 mt-8 px-6">
|
||||||
|
<v-btn color="success" @click="doUiAction('updateItem', {afficheStatus: '已发送'})" small>发送</v-btn>
|
||||||
|
<v-btn color="success" class="ml-2" @click="doUiAction('updateItem', {afficheStatus: '草稿'})" small>更新草稿</v-btn>
|
||||||
|
<v-btn class="elevation-0 ml-2" @click="isUpdateDrawerShown = false" small>取消</v-btn>
|
||||||
|
</v-row>
|
||||||
|
</v-form>
|
||||||
|
<!-- 抽屉关闭按钮 -->
|
||||||
|
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn" @click="isUpdateDrawerShown = false">
|
||||||
|
<v-icon>mdi-close</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
|
||||||
|
<select-org-user-dialog
|
||||||
|
:show.sync="isDialogShown"
|
||||||
|
:selected-ids.sync="updateItem.afficheMemberIdList"
|
||||||
|
@confirm="doUiAction('addPerson', $event)"
|
||||||
|
></select-org-user-dialog>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
|
||||||
|
<!-- 抽屉关闭按钮 -->
|
||||||
|
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn" @click="isViewDrawerShown = false">
|
||||||
|
<v-icon>mdi-close</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
<!-- <<<<<<<<<<<<< 页面内容 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 帮助页抽屉 >>>>>>>>>>>>> -->
|
||||||
|
<v-navigation-drawer v-if="isHelpPageDrawerLoaded" v-model="isHelpPageDrawerShown" :permanent="isHelpPageDrawerShown" fixed temporary right width="80%" class="elevation-24">
|
||||||
|
<iframe style="border: 0" :src="`/${appInfo.appId}/pageDoc#404.md`" width="100%" height="100%"></iframe>
|
||||||
|
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn" @click="isHelpPageDrawerShown = false">
|
||||||
|
<v-icon>mdi-close</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
<!-- <<<<<<<<<<<<< 帮助页抽屉 -->
|
||||||
|
|
||||||
|
</v-main>
|
||||||
|
</v-app>
|
||||||
|
|
||||||
|
<jh-toast />
|
||||||
|
<jh-mask />
|
||||||
|
<jh-confirm-dialog />
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="app"></div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
{% block vueScript %}
|
||||||
|
{% include 'component/select-org-user-dialog.html' %}
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/<$ ctx.app.config.appId $>/public/plugins/editor.md/css/editormd.min.css" />
|
||||||
|
<script src="/<$ ctx.app.config.appId $>/public/lib/jquery/jquery.min.js"></script>
|
||||||
|
<script src="/<$ ctx.app.config.appId $>/public/plugins/editor.md/editormd.js"></script>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
new Vue({
|
||||||
|
el: "#app",
|
||||||
|
template: "#app-template",
|
||||||
|
vuetify: new Vuetify(),
|
||||||
|
data: () => ({
|
||||||
|
// 面包屑
|
||||||
|
breadcrumbs: [
|
||||||
|
{
|
||||||
|
text: "首页",
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "通知管理",
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
isHelpPageDrawerShown: false,
|
||||||
|
isHelpPageDrawerLoaded: false,
|
||||||
|
isMobile: window.innerWidth < 500,
|
||||||
|
// 表格相关数据
|
||||||
|
isTableZebraLineShown: true,
|
||||||
|
validationRules: {
|
||||||
|
requireRules: [(v) => !!v || "必填"],
|
||||||
|
},
|
||||||
|
// 下拉选项
|
||||||
|
constantObj: {
|
||||||
|
afficheStatus: [
|
||||||
|
{ text: "草稿", value: "草稿" },
|
||||||
|
{ text: "已发送", value: "已发送" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
currentSceneId: null,
|
||||||
|
serverSearchInput: {
|
||||||
|
|
||||||
|
},
|
||||||
|
searchInput: null,
|
||||||
|
isTableLoading: true,
|
||||||
|
tableData: [],
|
||||||
|
headers: [
|
||||||
|
{ text: "公告名称", value: "afficheTitle", width: 120 },
|
||||||
|
{ text: "状态", value: "afficheStatus", width: 120 },
|
||||||
|
{ text: "通知范围", value: "afficheMemberIdList", width: 120 },
|
||||||
|
{ text: "创建时间", value: "afficheCreateAt", width: 250 },
|
||||||
|
{ text: "操作", value: "action", width: 150 },
|
||||||
|
],
|
||||||
|
|
||||||
|
isCreateDrawerShown: false,
|
||||||
|
createItem: {},
|
||||||
|
createActionData: {},
|
||||||
|
deleteItem: {},
|
||||||
|
deleteItemId: null,
|
||||||
|
|
||||||
|
isUpdateDrawerShown: false,
|
||||||
|
updateItem: {},
|
||||||
|
updateActionData: {},
|
||||||
|
|
||||||
|
userList: [],
|
||||||
|
isViewDrawerShown: false,
|
||||||
|
|
||||||
|
isMoreMenuShown: false,
|
||||||
|
|
||||||
|
isDialogShown: false,
|
||||||
|
}),
|
||||||
|
watch: {
|
||||||
|
isHelpPageDrawerShown(val) {
|
||||||
|
if (val && !this.isHelpPageDrawerLoaded) {
|
||||||
|
this.isHelpPageDrawerLoaded = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
async created() { },
|
||||||
|
mounted() {
|
||||||
|
this.doUiAction("initPageData");
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async doUiAction(uiActionId, uiActionData) {
|
||||||
|
switch (uiActionId) {
|
||||||
|
case "initPageData":
|
||||||
|
await this.getTableData();
|
||||||
|
break;
|
||||||
|
case "getTableData":
|
||||||
|
await this.getTableData();
|
||||||
|
break;
|
||||||
|
case "startCreateItem":
|
||||||
|
await this.prepareCreateFormData();
|
||||||
|
await this.openCreateDrawer();
|
||||||
|
break;
|
||||||
|
case "createItem":
|
||||||
|
await this.prepareCreateValidate();
|
||||||
|
await this.confirmCreateItemDialog();
|
||||||
|
await this.prepareDoCreateItem(uiActionData);
|
||||||
|
await this.doCreateItem();
|
||||||
|
await this.closeCreateDrawer();
|
||||||
|
await this.getTableData();
|
||||||
|
break;
|
||||||
|
case "startUpdateItem":
|
||||||
|
await this.prepareUpdateFormData(uiActionData);
|
||||||
|
await this.openUpdateDrawer();
|
||||||
|
break;
|
||||||
|
case "updateItem":
|
||||||
|
await this.prepareCreateValidate();
|
||||||
|
await this.confirmUpdateItemDialog();
|
||||||
|
await this.prepareDoUpdateItem(uiActionData);
|
||||||
|
await this.doUpdateItem();
|
||||||
|
await this.closeUpdateDrawer();
|
||||||
|
await this.getTableData();
|
||||||
|
break;
|
||||||
|
case "addPerson":
|
||||||
|
await this.addPerson(uiActionData);
|
||||||
|
break;
|
||||||
|
case "viewItem":
|
||||||
|
window.open(
|
||||||
|
`/<$ ctx.app.config.appId $>/page/afficheViewer?afficheId=${uiActionData.item.afficheId}`
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error("[doUiAction] uiActionId not find", { uiActionId });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取表格数据
|
||||||
|
*/
|
||||||
|
async getTableData() {
|
||||||
|
this.isTableLoading = true;
|
||||||
|
const whereData = _.pickBy(this.serverSearchInput, _.identity);
|
||||||
|
|
||||||
|
const rows = (
|
||||||
|
await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: "afficheManagement",
|
||||||
|
actionId: "selectItemList",
|
||||||
|
actionData: {},
|
||||||
|
where: whereData,
|
||||||
|
orderBy: [{ column: "operationAt", order: "desc" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).data.appData.resultData.rows;
|
||||||
|
rows.forEach((item) => {
|
||||||
|
item.afficheMemberIdList = (item.afficheMemberIdList || "").split(",");
|
||||||
|
});
|
||||||
|
|
||||||
|
this.tableData = rows;
|
||||||
|
this.isTableLoading = false;
|
||||||
|
},
|
||||||
|
// ---------- 新增数据 uiAction >>>>>>>>>> --------
|
||||||
|
async prepareCreateFormData() {
|
||||||
|
// Tips: 测试数据
|
||||||
|
this.createItem = {
|
||||||
|
afficheTitle: `公告${+new Date()}`,
|
||||||
|
afficheMemberIdList: [],
|
||||||
|
afficheContent: `公告${+new Date()}`,
|
||||||
|
afficheStatus: "草稿",
|
||||||
|
};
|
||||||
|
this.actionKey = "createItem";
|
||||||
|
},
|
||||||
|
|
||||||
|
async openCreateDrawer() {
|
||||||
|
this.isCreateDrawerShown = true;
|
||||||
|
|
||||||
|
this.initEditorMd(this, "afficheContent", {
|
||||||
|
image: () => {
|
||||||
|
this.openImageUploadDrawer();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async prepareCreateValidate() {
|
||||||
|
if (await this.$refs.createForm.validate()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
throw new Error("请完善表单信息");
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmCreateItemDialog() {
|
||||||
|
if (
|
||||||
|
(await window.confirmDialog({
|
||||||
|
title: "新增",
|
||||||
|
content: "确定新增吗?",
|
||||||
|
})) === false
|
||||||
|
) {
|
||||||
|
throw new Error("[confirmCreateFormDialog] 否");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
prepareDoCreateItem({ afficheStatus }) {
|
||||||
|
const { id, ...data } = this.createItem;
|
||||||
|
data.afficheMemberIdList = data.afficheMemberIdList.join(",");
|
||||||
|
data.afficheCreateAt = dayjs().format("YYYY-MM-DD hh:mm:ss");
|
||||||
|
data.afficheStatus = afficheStatus;
|
||||||
|
this.createActionData = data;
|
||||||
|
},
|
||||||
|
|
||||||
|
async doCreateItem() {
|
||||||
|
await window.vtoast.loading("新增数据");
|
||||||
|
const result = await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: "afficheManagement",
|
||||||
|
actionId: "insertItem",
|
||||||
|
actionData: this.createActionData,
|
||||||
|
bizIdGenerate: {
|
||||||
|
tableName: "affiche",
|
||||||
|
prefix: "GG",
|
||||||
|
type: "idSequence",
|
||||||
|
bizId: "afficheId",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await window.vtoast.success("新增数据成功");
|
||||||
|
},
|
||||||
|
async closeCreateDrawer() {
|
||||||
|
this.isCreateDrawerShown = false;
|
||||||
|
this.createItem = {};
|
||||||
|
this.createActionData = null;
|
||||||
|
},
|
||||||
|
// ---------- <<<<<<<<<<< 新增数据 uiAction ---------
|
||||||
|
// ---------- 更新数据 uiAction >>>>>>>>>> --------
|
||||||
|
|
||||||
|
async prepareUpdateFormData({ item }) {
|
||||||
|
this.updateItem = item;
|
||||||
|
this.actionKey = "updateItem";
|
||||||
|
},
|
||||||
|
async openUpdateDrawer() {
|
||||||
|
this.isUpdateDrawerShown = true;
|
||||||
|
this.initEditorMd(this, "afficheContent", {
|
||||||
|
image: () => {
|
||||||
|
this.openImageUploadDrawer();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirmUpdateItemDialog() {
|
||||||
|
if (
|
||||||
|
(await window.confirmDialog({
|
||||||
|
title: "更新",
|
||||||
|
content: "确定更新吗?",
|
||||||
|
})) === false
|
||||||
|
) {
|
||||||
|
throw new Error("[confirmCreateFormDialog] 否");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
prepareDoUpdateItem({ afficheStatus }) {
|
||||||
|
const {
|
||||||
|
afficheMemberIdList,
|
||||||
|
afficheContent,
|
||||||
|
afficheTitle,
|
||||||
|
afficheId
|
||||||
|
} = this.updateItem;
|
||||||
|
|
||||||
|
this.updateActionData = {
|
||||||
|
afficheId,
|
||||||
|
afficheStatus,
|
||||||
|
afficheTitle,
|
||||||
|
afficheContent,
|
||||||
|
afficheMemberIdList: afficheMemberIdList.join(","),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
async doUpdateItem() {
|
||||||
|
await window.vtoast.loading("更新草稿");
|
||||||
|
await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: "afficheManagement",
|
||||||
|
actionId: "updateItem",
|
||||||
|
actionData: this.updateActionData,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await window.vtoast.success("更新草稿成功");
|
||||||
|
},
|
||||||
|
async closeUpdateDrawer() {
|
||||||
|
this.isUpdateDrawerShown = false;
|
||||||
|
this.updateItem = {};
|
||||||
|
this.updateActionData = null;
|
||||||
|
},
|
||||||
|
|
||||||
|
// ---------- <<<<<<<<<<< 更新数据 uiAction ---------
|
||||||
|
|
||||||
|
// ---------- 初始化页面时参数处理 >>>>>>>>>>>>> ----------
|
||||||
|
|
||||||
|
// ---------- <<<<<<<<<<<<< 初始化页面时参数处理 ----------
|
||||||
|
async addPerson(selectedItems) {
|
||||||
|
this.isDialogShown = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
initEditorMd(that, key, { image: onImageUpload }) {
|
||||||
|
that.$nextTick(() => {
|
||||||
|
if (document.getElementById("editorMdContainer")) {
|
||||||
|
document.getElementById(
|
||||||
|
"editorMdContainer"
|
||||||
|
).innerHTML = `<textarea style=\"display:none;\">${that[that.actionKey][key] || ""
|
||||||
|
}</textarea>`;
|
||||||
|
that.editor = editormd("editorMdContainer", {
|
||||||
|
// width : "100%",
|
||||||
|
height: "300px",
|
||||||
|
watch: false,
|
||||||
|
saveHTMLToTextarea: true, // 保存 HTML 到 Textarea
|
||||||
|
htmlDecode: "style,script,iframe|on*",
|
||||||
|
path: "/<$ ctx.app.config.appId $>/public/plugins/editor.md/lib/",
|
||||||
|
toolbarIcons: Object.freeze([
|
||||||
|
"undo",
|
||||||
|
"redo",
|
||||||
|
"|",
|
||||||
|
"watch",
|
||||||
|
"preview",
|
||||||
|
"|",
|
||||||
|
"h1",
|
||||||
|
"h2",
|
||||||
|
"h3",
|
||||||
|
"h4",
|
||||||
|
"h5",
|
||||||
|
"bold",
|
||||||
|
"del",
|
||||||
|
"italic",
|
||||||
|
"quote",
|
||||||
|
"mark",
|
||||||
|
"imageUpload",
|
||||||
|
"list-ul",
|
||||||
|
"list-ol",
|
||||||
|
"hr",
|
||||||
|
"link",
|
||||||
|
"|",
|
||||||
|
"toggle",
|
||||||
|
"articleQuery",
|
||||||
|
]),
|
||||||
|
toolbarIconsClass: {
|
||||||
|
audioUpload: "fa-file-audio-o",
|
||||||
|
videoUpload: "fa-youtube-play",
|
||||||
|
attachmentUpload: "fa-upload",
|
||||||
|
imageUpload: "fa-image",
|
||||||
|
},
|
||||||
|
// 如果没有图标,则可以这样直接插入内容,可以是字符串或HTML标签
|
||||||
|
toolbarIconTexts: {
|
||||||
|
toggle:
|
||||||
|
"<i class='fa fa-expand' name='toggle' unselectable='on' style='display: inline-block;'></i><span class='ml-1'>收缩</span>",
|
||||||
|
articleQuery:
|
||||||
|
"<i class='fa fa-table' name='toggle' unselectable='on' style='display: inline-block;'></i><span class='ml-1'>列表</span>",
|
||||||
|
},
|
||||||
|
toolbarHandlers: {
|
||||||
|
imageUpload: function (cm, icon, cursor, selection) {
|
||||||
|
onImageUpload();
|
||||||
|
},
|
||||||
|
|
||||||
|
toggle: function (cm, icon, cursor, selection) {
|
||||||
|
cm.replaceSelection(
|
||||||
|
`\n[jh-toggle title=\"折叠容器\" default-open=\"true\"]\n折叠内容\n[/jh-toggle]\n`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
articleQuery: function (cm, icon, cursor, selection) {
|
||||||
|
cm.replaceSelection(
|
||||||
|
"\n[jh-article-query]\n" +
|
||||||
|
"{\n" +
|
||||||
|
' "where": "",\n' +
|
||||||
|
' "queryType": "order",\n' +
|
||||||
|
' "orderBy": "order by articleId asc",\n' +
|
||||||
|
' "limit": 20\n' +
|
||||||
|
"}" +
|
||||||
|
"\n[/jh-article-query]\n"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lang: {
|
||||||
|
toolbar: {
|
||||||
|
toggle: "展开收起",
|
||||||
|
column: "横向排列", // 自定义按钮的提示文本,即title属性
|
||||||
|
articleQuery: "数据列表",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onchange: function () {
|
||||||
|
that.mdChanged = true;
|
||||||
|
that[that.actionKey][key] = this.getMarkdown();
|
||||||
|
// that.createItem[`${key}ForSeo`] = this.getPreviewedHTML2();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this.initEditorMd(that, key, {
|
||||||
|
image: onImageUpload,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async openImageUploadDrawer() {
|
||||||
|
this.materialType = "image";
|
||||||
|
this.$refs.selectFileDialog.doUiAction("open");
|
||||||
|
},
|
||||||
|
|
||||||
|
editHandlerWhenUseMaterial({ filename, downloadPath }) {
|
||||||
|
if (this.materialType === "pdf") {
|
||||||
|
// pdf 操作使用通道
|
||||||
|
this.editor.insertValue(`\n[jh-pdf-viewer src="${downloadPath}"/]\n`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fileSubbfix =
|
||||||
|
filename.lastIndexOf(".") > -1
|
||||||
|
? filename.substring(filename.lastIndexOf(".") + 1).toLowerCase()
|
||||||
|
: "";
|
||||||
|
if (
|
||||||
|
[
|
||||||
|
"png",
|
||||||
|
"jpg",
|
||||||
|
"jpeg",
|
||||||
|
"bmp",
|
||||||
|
"gif",
|
||||||
|
"webp",
|
||||||
|
".psd",
|
||||||
|
"svg",
|
||||||
|
"tiff",
|
||||||
|
].indexOf(fileSubbfix) !== -1
|
||||||
|
) {
|
||||||
|
this.editor.insertValue(
|
||||||
|
`\n`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (["mp3", "wav", "wmv"].indexOf(fileSubbfix) !== -1) {
|
||||||
|
this.editor.insertValue(
|
||||||
|
`\n<audio controls="" preload="none"><source src="/<$ ctx.app.config.appId $>/upload${downloadPath}"></audio>`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
[
|
||||||
|
"avi",
|
||||||
|
"mpg",
|
||||||
|
"mpeg",
|
||||||
|
"mov",
|
||||||
|
"rm",
|
||||||
|
"ram",
|
||||||
|
"swf",
|
||||||
|
"flv",
|
||||||
|
"mp4",
|
||||||
|
"wma",
|
||||||
|
"rmvb",
|
||||||
|
"mkv",
|
||||||
|
].indexOf(fileSubbfix) !== -1
|
||||||
|
) {
|
||||||
|
this.editor.insertValue(
|
||||||
|
`\n<video controls="" preload="none"><source src="/<$ ctx.app.config.appId $>/upload${downloadPath}"></video>`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载链接
|
||||||
|
this.editor.insertValue(
|
||||||
|
`\n[${filename}](/<$ ctx.app.config.appId $>/upload${downloadPath})`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.v-btn.filter-btn:not(.v-btn--round).v-size--default {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-dialog--fullscreen .v-sheet {
|
||||||
|
height: auto;
|
||||||
|
position: relative;
|
||||||
|
background: #fff;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,269 @@
|
|||||||
|
{% extends 'template/jhTemplateV4.html'%}
|
||||||
|
|
||||||
|
{% block vueTemplate %}
|
||||||
|
|
||||||
|
<script type="text/html" id="app-template">
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<v-app mobile-breakpoint="sm">
|
||||||
|
<div class="VPLocalNav">
|
||||||
|
<button id="jianghu-mobile-toggle-docMenu" class="jianghu-nav-mobile-menu" aria-expanded="false"
|
||||||
|
aria-controls="VPSidebarNav">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24"
|
||||||
|
class="jianghu-nav-mobile-menu-icon">
|
||||||
|
<path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path>
|
||||||
|
<path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path>
|
||||||
|
<path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path>
|
||||||
|
<path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path>
|
||||||
|
</svg>
|
||||||
|
<span class="jianghu-nav-mobile-menu-text">Menu</span></button>
|
||||||
|
<button id="jianghu-mobile-toggle-docAside" class="jianghu-nav-mobile-menu" aria-expanded="false"
|
||||||
|
aria-controls="VPSidebarNav">
|
||||||
|
<span class="jianghu-nav-mobile-menu-text">On this page</span></button>
|
||||||
|
</div>
|
||||||
|
<!-- doc -->
|
||||||
|
<main>
|
||||||
|
|
||||||
|
<!-- 内容区 -->
|
||||||
|
<div class="jianghu-doc-content jianghu-doc-content-has-sidebar">
|
||||||
|
<div class="jianghu-doc-contentDoc">
|
||||||
|
<div class="jianghu-doc-contentDoc-container">
|
||||||
|
<!-- 文档大纲 -->
|
||||||
|
<div class="jianghu-doc-contentDoc-aside">
|
||||||
|
<div class="jianghu-doc-contentDoc-aside-container">
|
||||||
|
<div class="jianghu-doc-contentDoc-aside-outline">
|
||||||
|
<div class="jianghu-doc-contentDoc-aside-outline-title">On this page</div>
|
||||||
|
<div id="scrollspy" class="sticky-top">
|
||||||
|
<ul class="nav flex-column nav-pills menu-sidebar jianghu-doc-contentDoc-aside-menu"
|
||||||
|
id="jianghu-doc-contentDoc-aside-menu"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 文档正文 -->
|
||||||
|
<div class="jianghu-doc-contentDoc-content">
|
||||||
|
<v-skeleton-loader
|
||||||
|
v-bind="{
|
||||||
|
class: 'mb-6',
|
||||||
|
boilerplate: true,
|
||||||
|
elevation: 2,
|
||||||
|
}"
|
||||||
|
type="article"
|
||||||
|
v-if="isLoading"
|
||||||
|
></v-skeleton-loader>
|
||||||
|
<div class="jianghu-doc-contentDoc-main">
|
||||||
|
<div class="jianghu-doc-contentDoc-main-edit-links">
|
||||||
|
<span>
|
||||||
|
<a :href="pageUrl + 'articleEdit?articleId=' + article.articleId + '&title=' + article.articleTitle"
|
||||||
|
class="jianghu-doc-contentDoc-main-edit-link">
|
||||||
|
<i class="far fa-edit jianghu-doc-contentDoc-main-edit-icon"></i>
|
||||||
|
<$ constantUiMap.common.modify $>
|
||||||
|
</a>
|
||||||
|
<!-- <a :href="pageUrl + 'articleEdit?&title=未命名'" target="_blank"
|
||||||
|
class="jianghu-doc-contentDoc-main-edit-link">
|
||||||
|
<i class="far fa-plus-square jianghu-doc-contentDoc-main-edit-icon"></i><$ constantUiMap.common.add $></a>
|
||||||
|
<a :href="pageUrl + 'articleList?categoryId=' + article.categoryId"
|
||||||
|
class="jianghu-doc-contentDoc-main-edit-link">
|
||||||
|
<i class="fas fa-th-list jianghu-doc-contentDoc-main-edit-icon"></i><$ constantUiMap.common.manage $></a> -->
|
||||||
|
</span>
|
||||||
|
<span class="jianghu-doc-contentDoc-main-update-time"><i class="far fa-user"></i> {{
|
||||||
|
article.articleUpdateUsername }} <i class="far fa-clock" style="margin-left: 5px;"></i> {{
|
||||||
|
article.articleUpdateTime }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="jianghu-doc-contentDoc-main-doc">
|
||||||
|
<div class="markdown-body editormd-preview-container jianghu-markdown" id="doc-content">
|
||||||
|
<h1 id="links-0">{{article.taskTitle}}</h1>
|
||||||
|
<!-- 封面 -->
|
||||||
|
<template v-if="article.articleCoverImage">
|
||||||
|
<div class="items-center-box" style="margin-bottom: 20px">
|
||||||
|
<img style="width: 100%; background-color: #e0e0e0"
|
||||||
|
:src="'/upload/' + article.articleCoverImage" alt="" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 音频 -->
|
||||||
|
<template v-if="article.articleAudioUrl">
|
||||||
|
<audio :src="resourceUrl(article.articleAudioUrl)" style="width: 100%;" controls
|
||||||
|
preload="none"></audio>
|
||||||
|
</template>
|
||||||
|
<!-- 视频 -->
|
||||||
|
<template v-if="article.articleVideoUrl">
|
||||||
|
<video :src="resourceUrl(article.articleVideoUrl)" style="width: 100%; height: auto" controls
|
||||||
|
preload="none"></video>
|
||||||
|
</template>
|
||||||
|
<md2html :article-content="article.taskContent"></md2html>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</v-app>
|
||||||
|
|
||||||
|
<jh-toast />
|
||||||
|
<jh-mask />
|
||||||
|
<jh-confirm-dialog />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block vueScript %}
|
||||||
|
<!-- MDB -->
|
||||||
|
<link href="/<$ ctx.app.config.appId $>/public/articleViewer/font-awesome.min.css?v=6.0.0" rel="stylesheet" />
|
||||||
|
<link href="/<$ ctx.app.config.appId $>/public/articleViewer/roboto-font.css?family=Roboto:300,400,500,700&display=swap"
|
||||||
|
rel="stylesheet" />
|
||||||
|
<link href="/<$ ctx.app.config.appId $>/public/articleViewer/mdb.min.css" rel="stylesheet" />
|
||||||
|
<script src="/<$ ctx.app.config.appId $>/public/lib/jquery/jquery.min.js"></script>
|
||||||
|
<script src="/<$ ctx.app.config.appId $>/public/js/lib/lodash.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/<$ ctx.app.config.appId $>/public/articleViewer/mdb.min.js"></script>
|
||||||
|
|
||||||
|
<!-- css -->
|
||||||
|
{% include 'component/articleViewer/jianghuUiCss.html' %}
|
||||||
|
{% include 'component/articleViewer/jianghuCommonCss.html' %}
|
||||||
|
{% include 'component/articleViewer/jianghuDocCss.html' %}
|
||||||
|
{% include 'component/articleViewer/jianghuDocDocsCss.html' %}
|
||||||
|
{% include 'component/articleViewer/jianghuJs.html' %}
|
||||||
|
{% include 'component/markdown2html/md2html.html' %}
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
new Vue({
|
||||||
|
el: '#app',
|
||||||
|
template: '#app-template',
|
||||||
|
vuetify: new Vuetify(),
|
||||||
|
data: () => ({
|
||||||
|
articleId: null,
|
||||||
|
article: {},
|
||||||
|
pageUrl: "/" + window.appInfo.appId + "/page/",
|
||||||
|
|
||||||
|
isLoading: true,
|
||||||
|
}),
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
article: {
|
||||||
|
deep: true,
|
||||||
|
handler(value) {
|
||||||
|
this.$forceUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
await this.doUiAction("setLocationParams");
|
||||||
|
await this.doUiAction("getArticleDetail");
|
||||||
|
await this.doUiAction("initDomJs");
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async doUiAction(actionId, actionData) {
|
||||||
|
switch (actionId) {
|
||||||
|
case 'setLocationParams':
|
||||||
|
await this.setLocationParams();
|
||||||
|
break;
|
||||||
|
case 'getArticleDetail':
|
||||||
|
await this.getArticleDetail();
|
||||||
|
break;
|
||||||
|
case 'initDomJs':
|
||||||
|
await this.initDomJs();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setLocationParams() {
|
||||||
|
const urlParams = new URLSearchParams(location.search);
|
||||||
|
const taskId = urlParams.get('taskId');
|
||||||
|
if (taskId) {
|
||||||
|
this.taskId = taskId;
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.vtoast.fail('页面路径缺少参数');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getArticleDetail() {
|
||||||
|
this.isLoading = true
|
||||||
|
const result = await window.jianghuAxios({
|
||||||
|
data: {
|
||||||
|
appData: {
|
||||||
|
pageId: 'afficheViewer',
|
||||||
|
actionId: 'selectItemList',
|
||||||
|
where: {
|
||||||
|
taskId: this.taskId
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.isLoading = false
|
||||||
|
const article = result.data.appData.resultData.rows[0] || {}
|
||||||
|
|
||||||
|
// article.taskContent = article.taskContent.replaceAll('__appId__', '<$ ctx.app.config.appId $>')
|
||||||
|
this.article = article;
|
||||||
|
},
|
||||||
|
resourceUrl(path) {
|
||||||
|
if (!path) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (path.includes('http')) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
return '/<$ ctx.app.config.appId $>/upload' + path
|
||||||
|
},
|
||||||
|
initDomJs() {
|
||||||
|
generateSidebar();
|
||||||
|
// 点击大纲关闭遮罩
|
||||||
|
$(".jianghu-doc-contentDoc-aside-outline-link").on("click", function () {
|
||||||
|
closeBackdrop();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.hiddenHeader header {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hiddenHeader .v-main {
|
||||||
|
padding-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hiddenHeader .v-main__wrap>.d-flex.px-12:first-child {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullScreen {
|
||||||
|
min-height: 90vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
body .v-application a {
|
||||||
|
color: var(--vt-c-green) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme--light.v-data-table>.v-data-table__wrapper>table>tbody>tr>td:not(.v-data-table__mobile-row) {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
max-width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme--light.v-data-table>.v-data-table__wrapper>table>tbody>tr {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.theme--light.v-application code {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
Reference in new issue
Block a user