modal结合art-template
内容div
<div id="modal-cont"></div>
模板tpl
<script id="modal-tpl" type="text/template">
<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×
</button>
<h4 class="modal-title" id="myModalLabel">
查看申请
</h4>
</div>
<div class="modal-body">
<table class="table table-striped">
<thead>
<tr>
<th>uid</th>
<th>姓名</th>
<th>手机号</th>
<th>状态</th>
<th>申请时间</th>
<th>更新时间</th>
<th>操作</th>
</tr>
</thead>
<tbody id="modal_tbody">
{{ each data }}
<tr>
<td>{{ $value.uid }}</td>
<td>{{ $value.name }}</td>
<td>{{ $value.telephone }}</td>
<td id="apply_status_{{ $value.id }}">
{{ if $value.apply_status == 0 }}
申请中
{{ else if $value.apply_status == 1 }}
已同意
{{ else if $value.apply_status == 2 }}
已拒绝
{{ /if }}
</td>
<td>{{ $value.create_time }}</td>
<td>{{ $value.update_time }}</td>
<td id="apply_opt_{{ $value.id }}">
{{ if $value.apply_status == 0 }}
<a href="javascript:;" data-id="{{ $value.id }}" data-student_id="{{ $value.student_id }}" class="audit-apply">审核</a>
{{ /if }}
</td>
</tr>
{{ /each }}
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">关闭
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</script>
获取数据
$(".info_apply").on('click',function () {
let student_id = $(this).parent().data('id');
// 获取申请信息
$.ajax({
type:'POST',
url:'ajax_get_apply',
data: {student_id: student_id},
dataType:'json',
success:function(data){
if(data.errno == 0){
let html = template('modal-tpl', {data:data.data});
$('#modal-cont').html(html);
$("#myModal").modal("show");
}else{
alert(data.errdesc);
return false;
}
}
});
});
操作审核,异步处理
// 页面加载好之后,添加点击事件
$(document).on("click",".audit-apply",function(){
let apply_id = $(this).data('id');
let student_id = $(this).data('student_id');
layer.confirm('是否审核通过?', {
btn: ['通过','不通过'] //按钮
}, function(){
// ajax设置通过
$.ajax({
type:'POST',
url:'ajax_audit_apply',
data: {apply_id: apply_id,pass:1},
dataType:'json',
success:function(obj){
layer.msg(obj.errdesc);
$("#apply_status_"+apply_id).text('已同意');
$("#apply_opt_"+apply_id).text('');
$("#student_help_status_"+student_id).html('<span class="text-success">已帮助</span>');
layer.close();
}
});
}, function(){
// ajax设置通过
$.ajax({
type:'POST',
url:'ajax_audit_apply',
data: {apply_id: apply_id,pass:2},
dataType:'json',
success:function(obj){
layer.msg(obj.errdesc);
$("#apply_status_"+apply_id).text('已拒绝');
$("#apply_opt_"+apply_id).text('');
$("#student_help_status_"+student_id).html('<span class="text-primary">未帮助</span>');
layer.close();
}
});
});
})
modal结合art-template的更多相关文章
- art template前端模板引擎
偶然看到后台有一段代码 采用的是art template的模板引擎 地址为 http://aui.github.io/artTemplate/ 这段代码很简洁 var html = template( ...
- art.template 循环里面分组。
后台提供给我们一个数组,我们要用模版实现上面的格式输出怎么版呢? 下面就是解决方案: <h2>循环4个一组</h2> <script type="text/ht ...
- 利用art.template模仿VUE 一次渲染多个模版
TypeScript代码 import template = require('art-template/lib/template-web'); interface TemplateBindConfi ...
- 利用art.template模仿VUE
首先先看一下Typescript代码: import template = require('art-template/lib/template-web'); interface TemplateBi ...
- js 模板引擎 -Art Template
一个例子涵盖所有: <!doctype html> <html> <head> <meta charset="UTF-8"> < ...
- vue 实现modal
本文只是作为练习弹出框,弹框内部的东西需要进行自定义添加,主要对更新,删除,新建 ,提示四种弹框进行实现,例子中只是简单的组件应用 Modal.vue文件 <template> <d ...
- VUE实现Studio管理后台(完结):标签式输入、名值对输入、对话框(modal dialog)
一周的时间,几乎每天都要工作十几个小时,敲代码+写作文,界面原型算是完成了,下一步是写内核的HTML处理引擎,纯JS实现.本次实战展示告一段落,等RXEditor下一个版本完成,再继续分享吧.剩下的功 ...
- 6个强大的AngularJS扩展应用
本文链接:http://www.codeceo.com/article/6-angularjs-extension.html本文作者:码农网 – 小峰 AngularJS现在非常热门,是Google推 ...
- 一步步编写avalon组件01:弹出层组件
avalon2已经稳定下来,是时候教大家如何使用组件这个高级功能了. 组件是我们实现叠积木开发的关键. avalon2实现一个组件非常轻松,并且如何操作这个组件也比以前的avalon2,还是react ...
- AngularJS进阶(六)AngularJS+BootStrap实现弹出对话框
AngularJS+BootStrap实现弹出对话框 参考资料: http://angular-ui.github.io/bootstrap/#/modal https://www.zybuluo.c ...
随机推荐
- js中使用0 “” null undefined {}需要注意
注意:在js中0为空(false) ,代表空的还有“”,null ,undefined: 如果做判断if(!上面的四种值):返回均为false console.log(!null);// true c ...
- js 简易时钟
html部分 <div id="clock"> </div> css部分 #clock{ width:600px ; text-align: center; ...
- php_study progress(1)
PHP是一种语法简单.功能强大的网络编程语言.在语法格式上,PHP借鉴了广泛流行的C.Java和Perl等编程语言的特点,非常类似于C语言,但比C语言更简单,易学和易用,因此特别适合于学习过C语言,有 ...
- 每日linux命令学习-xargs命令
xargs命令 xargs是给命令传递参数的一个过滤器,也是组合多个命令的一个工具.它把一个数据流分割为一些足够小的块,以方便过滤器和命令进行处理.通常情况下,xargs从管道或者stdin中读取数据 ...
- 那些不错的 [ Html5 + CSS3 + Canvas ] 效果!
apng制作工具:http://isparta.github.io/how.html apng制作文章:http://isux.tencent.com/introduction-of-apng.htm ...
- mysql导入导出表
导入 source ***(路径+文件) 导出 mysqldump -uroot -plizhenghua 数据库名 表名 > 你要保存的sql文件(加位置)
- ldap集成rabbitmq
rabbitmq版本: 3.7.4 rabbitmq支持ldap需要开启插件: rabbitmq-plugins enable rabbitmq_auth_backend_ldap rab ...
- Junit的异常测试
方式1: @Test(expected = IndexOutOfBoundsException.class) public void empty() { new ArrayList<Object ...
- Junit中AssertTrue的使用
assertTrue public static void assertTrue(String message, boolean condition) Asserts that a condition ...
- 我为什么选择Go语言(Golang)
作为一个以开发为生的程序员,在我心目中编程语言如同战士手里的武器,好与不好主要看使用的人是否趁手.是否适合,没有绝对的高低之分. 从2013年起,学习并使用Golang已经有4年时间了,我想叙述一下我 ...