Loading [MathJax]/jax/output/CommonHTML/config.js
部署DeepSeek模型,进群交流最in玩法!
立即加群
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >bootstrap模态框之加载页面至modal-boby

bootstrap模态框之加载页面至modal-boby

作者头像
week
发布于 2018-08-27 01:35:32
发布于 2018-08-27 01:35:32
4.6K00
代码可运行
举报
文章被收录于专栏:用户画像用户画像
运行总次数:0
代码可运行

一、效果图

思路:使用$("#reserveForm").html(result); result为Ajax请求controller所返回的页面

二、预订会话框Modal

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<button id="reserveDialog" class="btn btn-primary btn-large" href="#reserveDialogModal"  data-toggle="modal">预订</button>
<div class="modal fade"  style="width:auto;" id="reserveDialogModal" tabindex="-1" style="display: none"  aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="myModalLabel">场地预定</h4>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
                <div class="reserve_top_line">

                </div>
                <div class="modal-body form-horizontal" id="reserveForm">
                    <!--预定表单-->
                    <!--end 预定表单-->
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" id="closeBtn" class="btn btn-default btn-flat md-close" data-dismiss="modal">
                    取消
                </button>
                <button type="button" id="saveBtn" class="btn btn-primary btn-flat">确定</button>
            </div>
        </div>
    </div>
</div>

三、会话框的主体内容:reserveForm.jsp

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<form id="reserveFormBean" class="form-horizontal">
    <input type="hidden" name="token" value="${token}"/>
    <input type="hidden" name="project.id" value="${reserveField.reserveProject.id}"/>

    <div class="content text-justify" style="text-align: center;vertical-align: middle;">
        <div class="row">
            <div class="col-lg-6  reserve_mid_line">
                <div class="row">
                    <div class="form-group">
                        <label for="reserveFieldName" class="col-sm-2 control-label"> 场地:</label>
                        <div class="col-lg-4">
                            <input readonly="readonly" id="reserveFieldName" class="form-control"
                                   value="${reserveField.name}"/>
                            <input type="hidden" id="consDate" name="consDate"
                                   value="${date}"/>
                            <input type="hidden" name="projectId" value="${reserveField.reserveProject.id}"/>
                            <input type="hidden" name="reserveVenue.id" value="${venueId}"/>
                            <input type="hidden" id="fieldId" name="venueConsList[0].reserveField.id"
                                   value="${reserveField.id}"/>
                            <input type="hidden" name="venueConsList[0].reserveVenue.id"
                                   value="${reserveField.reserveVenue.id}"/>
                            <input type="hidden" name="venueConsList[0].consPrice" value="${reserveField.actualPrice}"/>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label for="startTime" class="col-sm-2 control-label">时间:</label>
                        <div class="col-sm-4">
                            <select id="startTime" class="form-control input-sm" name="venueConsList[0].startTime">
                                <c:forEach items="${times}" var="t">
                                    <option
                                            <j:if test="${t eq startTime}">selected="selected"</j:if>
                                            value="${t}">${t}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <label for="endTime" class="col-lg-2 control-label" style="text-align: center"></label>
                        <div class="col-sm-4">
                            <select class="form-control input-sm" id="endTime" name="venueConsList[0].endTime">
                                <c:forEach items="${times}" var="t">
                                    <option
                                            <j:if test="${t eq endTime}">selected="selected"</j:if>
                                            value="${t}">${t}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label for="frequency" class="col-sm-2 control-label">频率:</label>
                        <div class="col-sm-4">
                            <select class=" form-control input-sm" id="frequency" name="frequency" class="select2">
                                <option value="1">单次</option>
                                <option value="2">每天</option>
                                <option value="3">每周</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <label for="halfCourt" class="control-label">类型:</label>
                        </div>
                        <div class="col-lg-2">
                            <input type="radio" id="halfCourt" name="halfCourt" value="1" class="icheck"/>半场
                        </div>
                        <div class="col-lg-2">
                            <input type="radio" id="allCourt" name="halfCourt" value="0" class="icheck" checked="checked"/>全场
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group">
                        <label for="tutorId" class="col-sm-2 control-label">教练:</label>
                        <div class="col-sm-4">
                            <select id="tutorId" name="tutor.id" class="form-control input-sm">
                                <option value="">请选择</option>

                                <c:forEach items="${tutors}" var="t">
                                    <option data-price="${t.price}" value="${t.id}" onclick="">${t.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <label for="tutor_price" class="control-label">价格:</label>
                        </div>
                        <div class="col-lg-4">
                            <input readonly="readonly" id="tutor_price" class="form-control"
                                   value="0元/小时"/>
                        </span>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label for="tutorId" class="control-label col-sm-2">备注:</label>
                        <div class="col-sm-9">
                            <textarea id="remarks" name="remarks" class="form-control"></textarea>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-lg-6">
                <div class="row">
                    <div class="form-group">
                        <label for="isMember" class="control-label col-lg-3">顾客类型:</label>
                        <div class="col-lg-3">
                            <input type="radio" id="isMember" class="icheck" value="1" checked="checked"
                                   name="memberType"/>会员
                        </div>
                        <div class="col-lg-3">
                            <input type="radio" class="icheck" value="0" name="memberType"/>非会员
                        </div>
                    </div>
                </div>
                <div class="row" id="memberSelect">
                    <div class="form-group">
                        <label for="memberId" class="control-label col-lg-3">会员姓名:</label>
                        <div class="col-sm-6">
                            <select class="form-control" id="memberId" name="member.id">
                                <option value="">--请选择--</option>
                                <c:forEach items="${memberList}" var="m">
                                    <option value="${m.id}">${m.mobile}-${m.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label for="userName" class="control-label col-lg-3">姓名:</label>
                        <div class="col-lg-6"><input id="userName" name="userName"
                                                     type="text" readonly="readonly"
                                                     class="form-control input-sm"/></div>
                    </div>
                </div>
                <div class="row" id="deposit" style="display: none">
                    <div class="form-group">
                        <label for="consPrice" class="control-label col-lg-3">押金:</label>
                        <div class="col-lg-6">
                            <input type="text" id="consPrice" name="consPrice"
                                   class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label for="consMobile" class="control-label col-lg-3">手机:</label>
                        <div class="col-lg-6"><input id="consMobile" name="consMobile"
                                                     type="text" readonly="readonly"
                                                     class="form-control"/></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function () {
        $("#reserveDialogModal").draggable({
            handle: ".modal-header"
        });
        $("input[name='memberType']").click(function(){
            var memberType=$(this).val();
            if(memberType=="1"){
                $("#deposit").hide();
                $("#userName").attr("readonly", "true");
                $("#consMobile").attr("readonly", "true");
                $("#memberSelect").show();
            }
            if(memberType=="0"){
                $("#deposit").show();
                $("#userName").removeAttr("readonly");
                $("#consMobile").removeAttr("readonly");
                $("#memberSelect").hide();
            }
        })
        $("#memberId").on('change', function () {
            var mid = $(this).attr("value");
            var text = $(this).find("option:selected").text();
            var mobile = text.split('-')[0];
            var username = text.split('-')[1];
            $("#userName").attr("value", username);
            $("#consMobile").attr("value", mobile);
        });

        $("#startTime").on('change', function () {
            var startTime = $("#startTime").attr("value");
            var endTime = $("#endTime").attr("value");
        });

        $("#endTime").on('change', function () {
            var startTime = $("#startTime").attr("value");
            var endTime = $("#endTime").attr("value");
        });

        //频率
        $("#frequency").on('change', function () {
            var frequency = $(this).val();
            if ('1' != frequency) {
                $("#date_div").show();
            } else {
                $("#date_div").hide();
            }
        });

        //教练
        $("#tutorId").on('change', function () {
            var price = $(this).find("option:selected").attr("data-price");
            if (price == undefined || price == '') {
                $("#tutor_price").val("0元/小时");
            } else {
                $("#tutor_price").val(price+"元/小时");
            }
        });
    });

</script>

三、JS

核心代码: $("#reserveForm").html(result);

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$(document).ready(function () {
    //-------预定---------
    $(".table-chang tbody td").on('dblclick', function () {
        if (!$(this).hasClass("access")) {
            return;
        }
        var fieldId = $(this).attr("data-field");
        var time = $(this).attr("data-time");
        var price = $(this).attr("data-price");
        var isHalfCourt = $(this).attr("data-isHalfCourt");
        if (price == null || price == "" || price == undefined) {
            errorLoding("抱歉,该时间段价格尚未设定");
            return;
        }
        var date = consDate;//日期
        jQuery.postItems({
            url: ctx + '/reserve/field/reserveForm?math='+Math.random(),
            data: {fieldId: fieldId, time: time, date: date, venueId: venueId, isHalfCourt: isHalfCourt},
            success: function (result) {
                if (result) {
                    $("#reserveForm").html(result);
                    $("#reserveDialog").click();
                    $("#reserveForm .select2").select2({
                        width: '100%'
                    });
                    $('#reserveForm .icheck').iCheck({
                        checkboxClass: 'icheckbox_square-blue checkbox',
                        radioClass: 'iradio_square-blue'
                    });
                }
            }
        });
    });
})
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2016年03月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
【错】urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
http://stackoverflow.com/questions/27835619/ssl-certificate-verify-failed-error
静默加载
2020/05/29
1.6K0
Python爬虫 带你一键爬取王者荣耀英雄皮肤壁纸
王者荣耀这款手游,想必大家都玩过或听过,游戏里英雄有各式各样的皮肤,制作得很精美,有些拿来做电脑壁纸它不香吗。本文带你利用Python爬虫一键下载王者荣耀英雄皮肤壁纸。
叶庭云
2020/10/26
1.5K0
Python爬虫  带你一键爬取王者荣耀英雄皮肤壁纸
[820]fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached
fake_useragent中存储的UserAgent列表发生了变动,而本地UserAgent的列表未更新所导致的,在更新fake_useragent后报错就消失了。
周小董
2020/06/01
2.2K0
Error Downloading MNIST解决方案
下载mnist-original.mat并且保存到 ~/scikit_learn_data/mldata/(scikit data home dir)下面即可
zeekling
2022/06/17
3660
Python Requests:prox
推荐阅读:https://blog.csdn.net/wangzuxi/article/details/40377467  
py3study
2020/01/07
1.4K0
requests模块报错:Use body.encode('utf-8') if you want to send it encoded in UTF-8.
在做 企业向微信用户个人付款  功能时,调用第三方sdk,在 进行 requests 的post请求时,
用户1558882
2018/10/11
2.3K0
开源项目 requests 的 stars 为啥比 python 还多 3.7k?
结合上一篇文章《一次算法读图超时引起的urllib3源码分析》,我们学习了 urllib3 的基本语法、常见姿势和请求管理模式,以及PoolManager、HTTPConnectionPool、HTTPConnection等模块部分源码。对于学习 Python 的小伙伴来说,urllib3 强大的功能几乎能实现所有 HTTP 请求场景,但这就足够了吗?
程序员荒生
2022/03/15
7840
开源项目 requests 的 stars 为啥比 python 还多 3.7k?
CentOS7 升级 python3 过
(<http://blog.csdn.net/qq_25560423/article/details/62055497>;)
py3study
2020/01/06
1.2K0
Centos下升级Python
另一篇文章 Centos7安装Python3.7(兼容Python2.7)https://blog.51cto.com/leyex/2163465
py3study
2020/01/07
2K1
我为什么不建议你使用Python3.7.3?
之前使用Python的环境一直是Python3.7.3的,一直使用的很正常,没有什么毛病,直到最近做一个图片下载器的时候发现了问题。
云爬虫技术研究笔记
2019/11/05
2.2K0
我为什么不建议你使用Python3.7.3?
探索eventlet通信机制
该方法对某些系统模块进行全局打补丁,使其对Greenthread友好。关键字参数用于指定哪些模块需要打补丁,如果未提供关键字参数,则会对所有默认的模块(如代码所示)打补丁,例如: monkey_patch(socket = True,select = True) 仅对socket和select模块打补丁。大多数参数都是对同名的单个模块进行打补丁,比如操作系统,时间,选择。但是socket例外,它也会对ssl模块(如果存在)打补丁,thread用于对threading、thread、Queue打补丁。说明:多次调用monkey_patch是安全的。
tunsuy
2022/10/27
6000
使用 openssl 生成证书(含openssl详解)
openssl 是目前最流行的 SSL 密码库工具,其提供了一个通用、健壮、功能完备的工具套件,用以支持SSL/TLS 协议的实现。 官网:https://www.openssl.org/source/
菲宇
2019/06/12
17K0
使用 openssl 生成证书(含openssl详解)
Saltstack_使用指南18_API
1. 主机规划 salt 版本 1 [root@salt100 ~]# salt --version 2 salt 2018.3.3 (Oxygen) 3 [root@salt100 ~]# salt
踏歌行
2020/10/15
6980
Saltstack_使用指南18_API
python使用requests时报错requests.exceptions.SSLError: HTTPSConnectionPool
分析:由于报错SSL证书验证失败,所以这次的访问应该是https协议.但是我们明明使用的是http,所以,猜测访问该网站后,被重定向到了https://www.baidu.com/
用户1214487
2018/08/01
5.6K0
python使用requests时报错requests.exceptions.SSLError: HTTPSConnectionPool
编译Python3.7并配置ssl库为LibreSSL
下载源码,手动编译:./configure --prefix=/opt/python/,安装: make && make install。
the5fire
2019/03/01
4.2K0
OpenSSL 常用命令
雨落秋垣
2024/10/30
1300
教师妹学python之十:共享代码
PyPi 是 Python Package Index 的首字母简写,其实表示的是 Python 的 Packag 索引,这个也是 Python 的官方索引。
互联网金融打杂
2022/08/01
4430
教师妹学python之十:共享代码
centos7 install python3.7 with problem and how to fix it.
<!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} -->
超蛋lhy
2018/08/31
6770
centos7 install python3.7 with problem and how to fix it.
npc_gzip笔记 - plus studio
npc_gzip 的论文名叫做 "Low-Resource" Text Classification: A Parameter-Free Classification Method with Compressors ,意为不需要参数,使用压缩器的文本分类方法。论文的代码也只有仅仅的十四行,就在部分数据集上取得了超越 bert 的效果。
plus sign
2024/02/29
1610
npc_gzip笔记 - plus studio
在Linux下如何根据域名自签发OpenSSL证书与常用证书转换 修改openssl.cnf配置文件创建根证书自签发泛域名证书将crt转pem格式生成 p12 格式的
当然上述的公钥制作方式需要交互式输入信息,如果不想频繁输入,那么可以使用如下命令:
踏歌行
2020/10/27
9.2K0
在Linux下如何根据域名自签发OpenSSL证书与常用证书转换
    




        修改openssl.cnf配置文件创建根证书自签发泛域名证书将crt转pem格式生成 p12 格式的
推荐阅读
相关推荐
【错】urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验