update
This commit is contained in:
+33
-21
@@ -51,8 +51,8 @@
|
||||
fetch_data: function () {
|
||||
const me = this
|
||||
const get_param = {'page': this.current_page, 'page_size': this.limit}
|
||||
if (this.get_coop_mind_name()) {
|
||||
get_param.coop_mind_name = this.get_coop_mind_name()
|
||||
if (this.get_search_coop_mind_name()) {
|
||||
get_param.coop_mind_name = this.get_search_coop_mind_name()
|
||||
}
|
||||
$.get('list', get_param, function (resp) {
|
||||
// 清空数据
|
||||
@@ -78,7 +78,7 @@
|
||||
me.auto_page_bar()
|
||||
})
|
||||
},
|
||||
get_coop_mind_name: function () {
|
||||
get_search_coop_mind_name: function () {
|
||||
return $('#mind_name').val()
|
||||
},
|
||||
// 显示分页组件
|
||||
@@ -126,17 +126,35 @@
|
||||
view.fetch_data()
|
||||
|
||||
|
||||
// 绑定事件
|
||||
// 搜索
|
||||
$('#search').click(function () {
|
||||
view.fetch_data()
|
||||
})
|
||||
// 清空
|
||||
$('#clear').click(function () {
|
||||
$('#mind_name').val('')
|
||||
view.fetch_data()
|
||||
})
|
||||
// 创建
|
||||
$('#crt_out').click(function () {
|
||||
const content_html = `<div style="margin-left: 30px;margin-top: 20px;">
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-input-inline"><input required autocomplete="off" class="layui-input" id="mind_name_crt" value="pp"></div>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="crt_inner">创建</button>
|
||||
</div>`
|
||||
layer.open({
|
||||
type: 1,
|
||||
content: $('#layer_open'), //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
|
||||
content: content_html, //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
|
||||
area: ['400px', '200px']
|
||||
});
|
||||
|
||||
// 调用后台创建脑图
|
||||
$('#crt_inner').click(crt_inner)
|
||||
//
|
||||
})
|
||||
|
||||
// 调用后台创建脑图
|
||||
$('#crt_inner').click(function () {
|
||||
function crt_inner() {
|
||||
const mind_name = $('#mind_name_crt').val()
|
||||
if (mind_name) {
|
||||
const snapshot_data = {
|
||||
@@ -158,8 +176,8 @@
|
||||
{
|
||||
id: 'open',
|
||||
topic: 'Open Source',
|
||||
direction: 'right',
|
||||
expanded: true,
|
||||
direction: 'left',
|
||||
expanded: false,
|
||||
children: [
|
||||
{id: 'open1', topic: 'on GitHub'},
|
||||
{id: 'open2', topic: 'BSD License'}
|
||||
@@ -169,6 +187,7 @@
|
||||
id: 'powerful',
|
||||
topic: 'Powerful',
|
||||
direction: 'right',
|
||||
expanded: false,
|
||||
children: [
|
||||
{id: 'powerful1', topic: 'Base on Javascript'},
|
||||
{id: 'powerful2', topic: 'Base on HTML5'},
|
||||
@@ -185,15 +204,16 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
//
|
||||
// post start
|
||||
$.post('create', {'mind_name': mind_name, 'snapshot_data': view.json2string(snapshot_data)}, function (resp) {
|
||||
layer.closeAll()
|
||||
view.fetch_data()
|
||||
})
|
||||
// post end
|
||||
} else {
|
||||
layer.msg('请输入导图名称')
|
||||
}
|
||||
})
|
||||
}
|
||||
//
|
||||
})
|
||||
</script>
|
||||
@@ -203,7 +223,8 @@
|
||||
<div class="layui-input-inline">
|
||||
<input autocomplete="off" class="layui-input" id="mind_name">
|
||||
</div>
|
||||
<button type="button" class="layui-btn">搜索</button>
|
||||
<button type="button" class="layui-btn" id="search">搜索</button>
|
||||
<button type="button" class="layui-btn" id="clear">清空</button>
|
||||
<button type="button" class="layui-btn" id="crt_out">创建导图</button>
|
||||
</div>
|
||||
<table class="layui-table" id="layui-table">
|
||||
@@ -227,14 +248,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="page_bar"></div>
|
||||
|
||||
<!-- 弹出层 start-->
|
||||
<div style="display: none;margin-left: 30px;margin-top: 20px;" id="layer_open">
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-input-inline"><input required autocomplete="off" class="layui-input" id="mind_name_crt" value="pp"></div>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="crt_inner">创建</button>
|
||||
</div>
|
||||
<!-- 弹出层 end-->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user