优化代码

This commit is contained in:
wuxw 2022-10-15 03:33:40 +08:00
parent 55547d1089
commit f3dedb3b4e
10 changed files with 104 additions and 0 deletions

6
public/js/marked.min.js vendored Normal file

File diff suppressed because one or more lines are too long

25
public/markdown.html Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>文档</title>
<script src="/js/bootstrap/jquery-3.3.1.min.js"></script>
<script src="/vcCore/vc-lang.js"></script>
<script src="/js/marked.min.js"></script>
<script src="/js/vue/vue.min.js"></script>
<script src="/js/vue/vue-resource.min.js"></script>
</head>
<body>
<div id="component">
<vc:create path="/pages/frame/markdown"></vc:create>
</div>
<script src="/vcCore/vcFramework.js"></script>
</body>
</html>

View File

@ -0,0 +1,3 @@
<div>
<div v-html="markdownInfo.page"></div>
</div>

View File

@ -0,0 +1,47 @@
(function (vc) {
vc.extends({
data: {
markdownInfo: {
url: '',
page:'',
}
},
_initMethod: function () {
$that.markdownInfo.url = vc.getParam('url');
$that._loadMarkdown();
},
_initEvent: function () {
},
methods: {
_loadMarkdown: function () {
let xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHttp');
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
let _content = xmlhttp.responseText;
$that._dealImgPath(_content);
}
}
// 向服务器发送请求
xmlhttp.open('GET', $that.markdownInfo.url, true);
xmlhttp.send();
},
_dealImgPath:function(_content){
let _currentPath = $that.markdownInfo.url.replace('/docs/readme.md','');
_content = _content.replaceAll("(img/","("+_currentPath+"/docs/img/");
$that.markdownInfo.page = marked.parse(_content);
}
}
});
})(window.vc);

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1,9 @@
## 报修操作文档
### 1.0 流程
![测试](img/WechatIMG102.png)
![测试](img/WechatIMG102.png)
![测试](img/WechatIMG102.png)

View File

@ -56,6 +56,9 @@
<span><vc:i18n name="报修设置" namespace="repairSettingManage"></vc:i18n></span>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-white btn-sm" v-on:click="vc.showMarkdown('/pages/property/repairSettingManage')">
<span><vc:i18n name="文档" namespace="repairSettingManage"></vc:i18n></span>
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddRepairSettingModal()">
<i class="fa fa-plus"></i>
<span><vc:i18n name="添加" namespace="repairSettingManage"></vc:i18n></span>

View File

@ -2989,4 +2989,15 @@
return age;
}
}
})(window.vcFramework);
/**
* 文档
*/
(function(vcFramework) {
vcFramework.showMarkdown = function(_url) {
let _docUrl = _url+ "/docs/readme.md";
window.open('/markdown.html?url='+_docUrl);
}
})(window.vcFramework);