add layui

This commit is contained in:
aqu415
2022-02-12 21:21:35 +08:00
parent c1d48e4789
commit d11f9e0591
17 changed files with 710 additions and 181 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#FAFAFA;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
+101
View File
@@ -0,0 +1,101 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>测试 - layui</title>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="layui-container">
<div class="layui-progress" style="margin: 15px 0 30px;">
<div class="layui-progress-bar" lay-percent="100%"></div>
</div>
<div class="layui-btn-container">
<button class="layui-btn" test-active="test-form">一个按钮</button>
<button class="layui-btn layui-btn-normal" id="test2">当前日期</button>
</div>
<blockquote class="layui-elem-quote" style="margin-top: 30px;">
<div class="layui-text">
<ul>
<li>你当前预览的是:<span>layui-v<span id="version"></span></span></li>
<li>layui 是一套开源的 Web UI(界面)组件库。这是一个极其简洁的演示页面</li>
</ul>
</div>
</blockquote>
</div>
<!-- 引入 layui.js 的 <script> 标签最好放置在 html 末尾 -->
<script src="layui/layui.js"></script>
<script>
layui.use(function(){
var layer = layui.layer
,form = layui.form
,laypage = layui.laypage
,element = layui.element
,laydate = layui.laydate
,util = layui.util;
//欢迎信息
layer.msg('Hello World');
//输出版本号
lay('#version').html(layui.v);
//日期
laydate.render({
elem: '#test2'
,value: new Date()
,isInitValue: true
});
//触发事件
util.event('test-active', {
'test-form': function(){
layer.open({
type: 1
,resize: false
,shadeClose: true
,area: '350px'
,title: 'layer + form'
,content: ['<ul class="layui-form layui-form-pane" style="margin: 15px;">'
,'<li class="layui-form-item">'
,'<label class="layui-form-label">输入框</label>'
,'<div class="layui-input-block">'
,'<input class="layui-input" lay-verify="required" name="field1">'
,'</div>'
,'</li>'
,'<li class="layui-form-item">'
,'<label class="layui-form-label">选择框</label>'
,'<div class="layui-input-block">'
,'<select name="field2">'
,'<option value="A">A</option>'
,'<option value="B">B</option>'
,'<select>'
,'</div>'
,'</li>'
,'<li class="layui-form-item" style="text-align:center;">'
,'<button type="submit" lay-submit lay-filter="*" class="layui-btn">提交</button>'
,'</li>'
,'</ul>'].join('')
,success: function(layero, index){
layero.find('.layui-layer-content').css('overflow', 'visible');
form.render().on('submit(*)', function(data){
layer.msg(JSON.stringify(data.field), {icon: 1});
//layer.close(index); //关闭层
});
}
});
}
});
});
</script>
</body>
</html>
+46 -181
View File
@@ -1,188 +1,53 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="utf-8">
<title>Jsmind</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="shortcut icon" href="/static/favicon.ico"/> <title>导图列表</title>
<link rel="stylesheet" type="text/css" href="/static/style/jsmind.css"> <link rel="stylesheet" href="/static/layui-v2.6.8/layui/css/layui.css" media="all">
<style> <script src="/static/layui-v2.6.8/layui/layui.js"></script>
#jsmind_container {
width: 100%;
height: 800px;
}
</style>
<script src="/static/js/jquery-1.11.3.min.js"></script>
<script src="/static/js/jsmind.js"></script>
<script src="/static/js/jsmind.draggable.js"></script>
<script src="/static/js/jsmind.screenshot.js"></script>
<script src="/static/js/jsmind.menu.js"></script>
<script src="/static/js/jsmind.coop.js?d="></script>
<script> <script>
const xx = function () { //加载模块
} layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
xx.prototype = { //得到各种内置组件
randomNum: function (minNum, maxNum) { const layer = layui.layer //弹层
switch (arguments.length) { , laypage = layui.laypage //分页
case 1: , laydate = layui.laydate //日期
return parseInt(Math.random() * minNum + 1, 10); , table = layui.table //表格
case 2: , carousel = layui.carousel //轮播
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10); , upload = layui.upload //上传
default: , element = layui.element //元素操作
return 0; , slider = layui.slider //滑块
} , dropdown = layui.dropdown //下拉菜单
}, });
loadMind: function () {
// 打开已有脑图1、查询数据,组装option 2、实例化jm、show
const mind_name = $('#mind_name').val()
const me = this
if (mind_name) {
$.get('jsmind_op', {'mind_name': mind_name, 'type': 'get_mind_by_name'}, function (resp) {
me.destory_coop_if_necessary()
// todo 设置返回的 data_log_id
me.init_new_mind(mind_name, resp.msg.data)
})
}
},
newMind: function () {
$('#jsmind_container').empty()
const name = this.randomNum(1, 2222)
$('#mind_name').val(name)
if (!name) {
alert('请输入名字')
} else {
this.destory_coop_if_necessary()
this.init_new_mind(name)
}
},
// 清除定时任务等
destory_coop_if_necessary() {
if (this.jm && this.jm.coop) {
this.jm.coop.clear_timer()
}
},
init_new_mind: function (name, data) {
const mind = {
/* 元数据,定义思维导图的名称、作者、版本等信息 */
meta: {
name: name,
author: 'hizzgdev@163.com',
version: '0.2'
},
/* 数据格式声明 */
format: 'node_tree',
/* 数据内容 */
data: {
id: 'root',
topic: 'jsMind',
children: [
{
id: 'easy',
topic: 'Easy',
direction: 'left',
expanded: false,
children: [
{id: 'easy1', topic: 'Easy to show'},
{id: 'easy2', topic: 'Easy to edit'},
{id: 'easy3', topic: 'Easy to store'},
{id: 'easy4', topic: 'Easy to embed'}
]
},
{
id: 'open',
topic: 'Open Source',
direction: 'right',
expanded: true,
children: [
{id: 'open1', topic: 'on GitHub'},
{id: 'open2', topic: 'BSD License'}
]
},
{
id: 'powerful',
topic: 'Powerful',
direction: 'right',
children: [
{id: 'powerful1', topic: 'Base on Javascript'},
{id: 'powerful2', topic: 'Base on HTML5'},
{id: 'powerful3', topic: 'Depends on you'}
]
},
{
id: 'other',
topic: 'test node',
direction: 'left',
children: [
{id: 'other1', topic: "I'm from local variable"},
{id: 'other2', topic: 'I can do everything'}
]
}
]
}
}
const options = {
container: 'jsmind_container',
editable: true,
theme: 'primary',
coop_api_url: null,
menuOpts: {
showMenu: true,
injectionList: [
{
target: 'edit',
text: '编辑节点'
},
{
target: 'addChild',
text: '添加子节点'
},
{
target: 'addBrother',
text: '添加兄弟节点'
},
{
target: 'delete',
text: '删除节点'
},
{
target: 'screenshot',
text: '下载导图'
},
{
target: 'showAll',
text: '展开全部节点'
},
{
target: 'hideAll',
text: '收起全部节点'
}
]
}
}
// eslint-disable-next-line new-cap
let jsMind = window.jsMind
this.jm = new jsMind(options)
if (data) {
mind.data = data
}
this.jm.show(mind)
}
}
const xxObj = new xx()
</script> </script>
</head> </head>
<body> <body>
<div> <table class="layui-table">
<div> <colgroup>
导图名称:<input id='mind_name'> <col width="150">
<input type="button" value="新建" onclick="xxObj.newMind()"> <col width="200">
<input type="button" value="打开已有" onclick="xxObj.loadMind()"> <col>
<input type="button" value="放大" onclick="zoomIn()"> </colgroup>
<input type="button" value="缩小" onclick="zoomOut()"> <thead>
</div> <tr>
<div id="jsmind_container"/> <th>昵称</th>
<th>加入时间</th>
<th>签名</th>
</tr>
</thead>
<tbody>
<tr>
<td>贤心</td>
<td>2016-11-29</td>
<td>人生就像是一场修行</td>
</tr>
<tr>
<td>许闲心</td>
<td>2016-11-28</td>
<td>于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…</td>
</tr>
</tbody>
</table>
</body> </body>
</html> </html>