加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lyear_pages_doc.html 31.65 KB
一键复制 编辑 原始数据 按行查看 历史
笔下光年 提交于 2020-09-17 16:33 . 增加代码示例
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>文档列表 - 光年(Light Year Admin V4)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V4是一个后台管理系统的HTML模板,基于Bootstrap v4.4.1。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="js/jquery-confirm/jquery-confirm.min.css" rel="stylesheet">
<link href="css/animate.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-toolbar d-flex flex-column flex-md-row">
<div class="toolbar-btn-action">
<a class="btn btn-primary m-r-5" href="#!"><i class="mdi mdi-plus"></i> 新增</a>
<a class="btn btn-success m-r-5 ajax-post confirm" href="http://www.lyear.com/doc_test.php" target-form="ids"><i class="mdi mdi-check"></i> 启用</a>
<a class="btn btn-warning m-r-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>
<a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a>
</div>
<form class="search-bar ml-md-auto" method="get" action="#!" role="form">
<input type="hidden" name="search_field" id="search-field" value="title" />
<div class="input-group ml-md-auto">
<div class="input-group-prepend">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="search-btn">标题</button>
<div class="dropdown-menu" style="">
<a class="dropdown-item" href="#!" data-field="title">标题</a>
<a class="dropdown-item" href="#!" data-field="cat_name">栏目</a>
</div>
</div>
<input type="text" class="form-control" name="keyword" placeholder="请输入名称">
</div>
</form>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="check-all">
<label class="custom-control-label" for="check-all"></label>
</div>
</th>
<th>编号</th>
<th>标题</th>
<th>书籍</th>
<th>作者</th>
<th>阅读量</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="1" id="ids-1">
<label class="custom-control-label" for="ids-1"></label>
</div>
</td>
<td>1</td>
<td>第01章 天涯思君不可忘</td>
<td>《倚天屠龙记》</td>
<td>金庸</td>
<td>36</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default ajax-get confirm" href="http://www.lyear.com/doc_test.php?id=1" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="2" id="ids-2">
<label class="custom-control-label" for="ids-2"></label>
</div>
</td>
<td>2</td>
<td>第01章 古道腾驹惊白发,危峦快剑识青翎</td>
<td>《书剑恩仇录》</td>
<td>金庸</td>
<td>44</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="3" id="ids-3">
<label class="custom-control-label" for="ids-3"></label>
</div>
</td>
<td>3</td>
<td>一个戴水獭皮帽子的朋友</td>
<td>《湘行散记》</td>
<td>沈从文</td>
<td>39</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="4" id="ids-4">
<label class="custom-control-label" for="ids-4"></label>
</div>
</td>
<td>4</td>
<td>你是要灼灼容颜,还是要宜其室家</td>
<td>《诗三百:思无邪》</td>
<td>安意如</td>
<td>36</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="5" id="ids-5">
<label class="custom-control-label" for="ids-5"></label>
</div>
</td>
<td>5</td>
<td>海上的消息</td>
<td>《打开心内的窗》</td>
<td>林清玄</td>
<td>32</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="6" id="ids-6">
<label class="custom-control-label" for="ids-6"></label>
</div>
</td>
<td>6</td>
<td>楔子 一阕词来 南国清秋魂梦绕 十年人散 绣房红烛剑光寒</td>
<td>《七剑下天山》</td>
<td>梁羽生</td>
<td>42</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="7" id="ids-7">
<label class="custom-control-label" for="ids-7"></label>
</div>
</td>
<td>7</td>
<td>祝福</td>
<td>《彷徨》</td>
<td>鲁迅</td>
<td>40</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="8" id="ids-8">
<label class="custom-control-label" for="ids-8"></label>
</div>
</td>
<td>8</td>
<td>一个女长年的故事</td>
<td>《莫泊桑短篇小说集》</td>
<td>莫泊桑</td>
<td>36</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="9" id="ids-9">
<label class="custom-control-label" for="ids-9"></label>
</div>
</td>
<td>9</td>
<td>第一回 赈民饥包公奉旨 图谋害庞相施计</td>
<td>《五虎征西》</td>
<td>李雨堂</td>
<td>35</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input ids" name="ids[]" value="10" id="ids-10">
<label class="custom-control-label" for="ids-10"></label>
</div>
</td>
<td>10</td>
<td>第一回 于按察山东赴任 邹其仁赴路登程</td>
<td>《于公案》</td>
<td>佚名</td>
<td>37</td>
<td><font class="text-success">正常</font></td>
<td>
<div class="btn-group">
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
<a class="btn btn-xs btn-default" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<ul class="pagination">
<li class="page-item disabled"><span class="page-link">上一页</span></li>
<li class="page-item active"><span class="page-link">1</span></li>
<li class="page-item"><a class="page-link" href="#1">2</a></li>
<li class="page-item"><a class="page-link" href="#1">3</a></li>
<li class="page-item"><a class="page-link" href="#1">4</a></li>
<li class="page-item"><a class="page-link" href="#1">5</a></li>
<li class="page-item disabled"><span class="page-link">...</span></li>
<li class="page-item"><a class="page-link" href="#!">14452</a></li>
<li class="page-item"><a class="page-link" href="#!">14453</a></li>
<li class="page-item"><a class="page-link" href="#!">下一页</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-12">
<div class="card">
<header class="card-header"><div class="card-title">页面说明</div></header>
<div class="card-body">
<div class="callout callout-warning mb-3">当前页面提供了通用的ajax提交方法(处理方法参考DolphinPHP),如果你需要使用,请仔细阅读该说明。</div>
<p>方法采用直接绑定的形式,只需你在需要用到的按钮或者 <code>a</code> 元素上增加类 <code>ajax-post</code> 或者 <code>ajax-get</code></p>
<h6><code>ajax-post</code> 提交</h6>
<p>1、首先你需要在当前的元素 <code>class</code> 上增加 <code>ajax-post</code></p>
<p>2、如果你使用的是 <code>a</code> 标签,则采用 <code>href</code> 指定你要提交到的地址。如果你使用的是按钮,则采用 <code>data-url</code> 指定你要提交到的地址。如果你采用表单,你也可以将地址写在 <code>form</code> 元素的 <code>action</code> 内。</p>
<p>3、还有重要的一点,是你需要指定 <code>ajax</code> 需要处理的表单元素,可以单独是 <code>input</code> <code>textarea</code> <code>select</code> 或者 <code>form</code>,采用 <code>target-form</code> 指定它的 <code>name</code> 值,也可以是唯一的 <code>class</code> 名称。</p>
<p>4、如果你需要在提交前,有弹窗提示,可以在当前元素 <code>class</code> 上增加 <code>confirm</code>,然后 使用 <code>data-tips</code> 指定对对话框的提示语。</p>
<div class="callout callout-danger mb-3">
需要注意的是,这里做的演示,并没有实际提交到后端,提交后端的代码已经注释,需要您使用时自己打开,这里可以按f12,在console中查看打印输出的信息。
<br/>后端返回的数据这里约定格式为:<code>{"code":200,"msg":"处理成功","url":""}</code>
</div>
<p>示例一</p>
<pre>&lt;a class="btn btn-success m-r-5 ajax-post confirm" href="http://www.lyear.com/doc_test.php" target-form="ids"&gt;&lt;i class="mdi mdi-check"&gt;&lt;/i&gt; 启用&lt;/a&gt;</pre>
<p>该示例是页面中启用 <code>a</code> 标签的示例,<code>target-form</code> 的值是复选框的 <code>name</code> 名称。</p>
<p>示例二</p>
<div class="border-example">
<form name="testForm-1" action="http://www.lyear.com/doc_test.php">
<input type="hidden" name="test" value="1">
<button class="btn btn-success ajax-post confirm" type="submit" data-tips="测试一下" target-form="testForm-1">示例二</button>
</form>
</div>
<pre>&lt;form name="testForm" action="http://www.lyear.com/doc_test.php"&gt;
&lt;input type="hidden" name="test" value="2"&gt;
&lt;button class="btn btn-success ajax-post confirm" type="submit" data-tips="测试一下" target-form="testForm-1"&gt;示例二&lt;/button&gt;
&lt;/form&gt;</pre>
<p>示例三</p>
<div class="border-example">
<form name="testForm-2"><input type="hidden" name="test" value="2"></form>
<button class="btn btn-success ajax-post confirm" type="submit" data-url="http://www.lyear.com/doc_test.php" target-form="testForm-2">示例三</button>
</div>
<pre>&lt;form name="testForm-2"&gt;&lt;input type="hidden" name="test" value="2"&gt;&lt;/form&gt;
&lt;button class="btn btn-success ajax-post confirm" type="submit" data-url="http://www.lyear.com/doc_test.php" target-form="testForm-2"&gt;示例三&lt;/button&gt;</pre>
<h6><code>ajax-get</code> 提交</h6>
<p><code>get</code> 提交,这里不需要指定 <code>target-form</code>,因为要提交的数据内容都在 <code>url</code> 地址里面。</p>
<p>示例一</p>
<pre>&lt;a class="btn btn-xs btn-default ajax-get confirm" href="http://www.lyear.com/doc_test.php?id=1" title="" data-toggle="tooltip" data-original-title="删除"&gt;
&lt;i class="mdi mdi-window-close"&gt;&lt;/i&gt;
&lt;/a&gt;</pre>
<p>该示例是页面中第一条数据的删除按钮。</p>
<p>示例二</p>
<div class="border-example">
<a class="btn btn-success ajax-get" data-url="http://www.lyear.com/doc_test.php?id=1">变更数据</a>
</div>
<pre>&lt;a class="btn btn-success ajax-get" data-url="http://www.lyear.com/doc_test.php?id=1"&gt;变更数据&lt;/a&gt;</pre>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/lyear-loading.js"></script>
<script type="text/javascript" src="js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="js/jquery-confirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript">
$(function(){
$('.search-bar .dropdown-menu a').click(function() {
var field = $(this).data('field') || '';
$('#search-field').val(field);
$('#search-btn').html($(this).text());
});
// 通用ajax post请求
jQuery(document).delegate('.ajax-post', 'click', function(){
var self = jQuery(this), tips = self.data('tips'), ajax_url = self.attr("href") || self.data("url");
var target_form = self.attr('target-form');
var text = self.data('tips');
var form = jQuery('form[name="'+ target_form +'"]');
if (form.length == 0) {
form = jQuery('.' + target_form);
}
var form_data = form.serialize();
if ('submit' == self.attr('type') || ajax_url) {
if (void 0 == form.get(0)) return false;
// 如果节点是FORM表单
if ('FORM' == form.get(0).nodeName) {
ajax_url = ajax_url || form.get(0).action;
// 确认提交
if (self.hasClass('confirm')) {
$.confirm({
title: '',
content: tips || '确认要执行该操作吗?',
type: 'orange',
typeAnimated: true,
buttons: {
confirm: {
text: '确认',
btnClass: 'btn-blue',
action: function() {
var loader = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
self.attr('autocomplete', 'off').prop('disabled', true);
ajaxPostFun(self, ajax_url, form_data, loader);
}
},
cancel: {
text: '取消',
action: function() {}
}
}
});
return false;
} else {
self.attr("autocomplete", "off").prop("disabled", true);
}
} else if ('INPUT' == form.get(0).nodeName || 'SELECT' == form.get(0).nodeName || 'TEXTAREA' == form.get(0).nodeName) {
// 复选框判断是否有选择项
if (form.get(0).type == 'checkbox' && form_data == '') {
showNotify('请选择您要操作的数据', 'danger');
return false;
}
if (self.hasClass('confirm')) {
$.confirm({
title: '',
content: tips || '确认要执行该操作吗?',
type: 'orange',
typeAnimated: true,
buttons: {
confirm: {
text: '确认',
btnClass: 'btn-blue',
action: function() {
var loader = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
self.attr('autocomplete', 'off').prop('disabled', true);
ajaxPostFun(self, ajax_url, form_data, loader);
}
},
cancel: {
text: '取消',
action: function() {}
}
}
});
return false;
} else {
self.attr("autocomplete", "off").prop("disabled", true);
}
} else {
if (self.hasClass('confirm')) {
$.confirm({
title: '',
content: tips || '确认要执行该操作吗?',
type: 'orange',
typeAnimated: true,
buttons: {
confirm: {
text: '确认',
btnClass: 'btn-blue',
action: function() {
var loader = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
self.attr('autocomplete', 'off').prop('disabled', true);
ajaxPostFun(self, ajax_url, form_data, loader);
}
},
cancel: {
text: '取消',
action: function() {}
}
}
});
return false;
} else {
form_data = form.find("input,select,textarea").serialize();
self.attr("autocomplete", "off").prop("disabled", true);
}
}
var loader = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
ajaxPostFun(self, ajax_url, form_data, loader);
return false;
}
});
// 通用ajax get请求
jQuery(document).delegate('.ajax-get', 'click', function(){
var self = $(this), tips = self.data('tips'), ajax_url = self.attr("href") || self.data("url");
if (self.hasClass('confirm')) {
$.confirm({
title: '',
content: tips || '确认要执行该操作吗?',
type: 'orange',
typeAnimated: true,
buttons: {
confirm: {
text: '确认',
btnClass: 'btn-blue',
action: function() {
var loader = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
self.attr('autocomplete', 'off').prop('disabled', true);
ajaxGetFun(self, ajax_url, loader);
}
},
cancel: {
text: '取消',
action: function() {}
}
}
});
return false;
} else {
var loader = $('body').lyearloading({
opacity: 0.2,
spinnerSize: 'lg'
});
self.attr('autocomplete', 'off').prop('disabled', true);
ajaxGetFun(self, ajax_url, loader);
}
return false;
});
// POST提交处理
function ajaxPostFun(selfObj, ajax_url, form_data, loader) {
console.log('url==>'+ajax_url);
console.log('form_data==>'+form_data);
setTimeout(function() {
loader.destroy();
showNotify('修改成功,页面即将自动跳转~', 'success', 1000);
selfObj.attr("autocomplete", "on").prop("disabled", false);
}, 1e3);
// 这里屏蔽get提交,js模拟返回成功,正常使用时请删除上面的内容,打开下面的注释代码
/*
jQuery.post(ajax_url, form_data).done(function(res) {
loader.destroy();
var res = eval('(' + res + ')');
var msg = res.msg;
if (200 == res.code) {
if (res.url && !selfObj.hasClass('no-refresh')) {
msg += '页面即将自动跳转';
}
showNotify(msg, 'info');
setTimeout(function () {
selfObj.attr("autocomplete", "on").prop("disabled", false);
return selfObj.hasClass("no-refresh") ? false : (res.url ? location.href = res.url : location.reload());
}, 1500);
} else {
showNotify(msg, 'danger');
selfObj.attr("autocomplete", "on").prop("disabled", false);
}
}).fail(function () {
loader.destroy();
showNotify('服务器发生错误,请稍后再试', 'danger');
selfObj.attr("autocomplete", "on").prop("disabled", false);
});
*/
}
// GET提交处理
function ajaxGetFun(selfObj, ajax_url, loader) {
console.log(ajax_url);
setTimeout(function() {
loader.destroy();
showNotify('修改成功,页面即将自动跳转~', 'success', 1000);
selfObj.attr("autocomplete", "on").prop("disabled", false);
}, 1e3);
// 这里屏蔽get提交,js模拟返回成功,正常使用时请删除上面的内容,打开下面的注释代码
/*
jQuery.get(ajax_url).done(function(res) {
loader.destroy();
var res = eval('(' + res + ')');
var msg = res.msg;
if (200 == res.code) {
if (res.url && !selfObj.hasClass('no-refresh')) {
msg += '页面即将自动跳转';
}
showNotify(msg, 'info');
setTimeout(function () {
selfObj.attr("autocomplete", "on").prop("disabled", false);
return selfObj.hasClass("no-refresh") ? false : (res.url ? location.href = res.url : location.reload());
}, 1500);
} else {
showNotify(msg, 'danger');
selfObj.attr("autocomplete", "on").prop("disabled", false);
}
}).fail(function () {
loader.destroy();
showNotify('服务器发生错误,请稍后再试', 'danger');
selfObj.attr("autocomplete", "on").prop("disabled", false);
});
*/
}
/*
* 提取通用的通知消息方法
* 这里只采用简单的用法,如果想要使用回调或者更多的用法,请查看lyear_js_notify.html页面
* @param $msg 提示信息
* @param $type 提示类型:'info', 'success', 'warning', 'danger'
* @param $delay 毫秒数,例如:1000
* @param $icon 图标,例如:'fa fa-user' 或 'glyphicon glyphicon-warning-sign'
* @param $from 'top' 或 'bottom' 消息出现的位置
* @param $align 'left', 'right', 'center' 消息出现的位置
*/
function showNotify($msg, $type, $delay, $icon, $from, $align) {
$type = $type || 'info';
$delay = $delay || 1000;
$from = $from || 'top';
$align = $align || 'right';
$enter = $type == 'danger' ? 'animated shake' : 'animated fadeInUp';
jQuery.notify({
icon: $icon,
message: $msg
},
{
element: 'body',
type: $type,
allow_dismiss: true,
newest_on_top: true,
showProgressbar: false,
placement: {
from: $from,
align: $align
},
offset: 20,
spacing: 10,
z_index: 10800,
delay: $delay,
animate: {
enter: $enter,
exit: 'animated fadeOutDown'
}
});
}
});
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化