Jackie

Jackie

3070飞吻 2017-2-17 加入 来自云南昆明

(这个人懒得留下签名)

Jackie 最近的回答

  • 2018-5-7 7:31:51不知道如何接入ASP后台数据 有教程嘛 或者请高手指点一下,愿意分享layuiadmin中回答:

    你可以参考这个网站的视频教程:
    http://www.ty502.com/
    我一开始就在这里学的
  • 2018-4-25 23:48:21求教,layui表单ajax提交无效中回答:

    @3th1nk 我的在我自己的项目中是正常的
  • 2018-4-24 23:48:39求教,layui表单ajax提交无效中回答:

    你可以参考下我的这个,可能有点low,别介意
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../css/font/iconfont.css" media="all" />
    <link rel="stylesheet" href="css/public.css" media="all" />
    </head>
    <body class="layerBody">
    <div class="admin-main">
    <form class="layui-form layui-form-pane form-item-full" name="form1" id="form1" action="" method="post">
    <div class="layui-form-item">
    <label class="layui-form-label">姓名</label>
    <div class="layui-input-block">
    <input type="text" name="user_name" id="user_name" placeholder="请输入用户姓名" class="layui-input" lay-verify="required">
    </div>
    </div>
    <div class="layui-form-item" pane="">
    <label class="layui-form-label">性别</label>
    <div class="layui-input-block">
    <input type="radio" name="user_sex" id="user_sex" value="男" title="男" lay-verify="required">
    <input type="radio" name="user_sex" id="user_sex" value="女" title="女" lay-verify="required">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">手机号码</label>
    <div class="layui-input-block">
    <input type="text" name="user_mobile" id="user_mobile" placeholder="请输入手机号码" class="layui-input" lay-verify="required">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">密码</label>
    <div class="layui-input-block">
    <input type="text" name="user_password" id="user_password" placeholder="默认密码为:123456,如无需更改请留空" class="layui-input">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">用户角色</label>
    <div class="layui-input-block">
    <select id="user_role_id" name="user_role_id" lay-verify="required" placeholder="请选择角色" lay-search>
    <option value="">请选择角色</option>
    <?php foreach($roles as $role):?>
    <option value="<?php echo $role['role_id']; ?>"><?php echo $role['role_name']; ?></option>
    <?php endforeach;?>
    </select>
    </div>
    </div>
    <div class="layui-form-item" pane="">
    <label class="layui-form-label">状  态</label>
    <div class="layui-input-block">
    <input type="checkbox" name="user_status" id="user_status" checked="checked" title="启用">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">电子邮箱</label>
    <div class="layui-input-block">
    <input type="text" name="user_email" id="user_email" placeholder="请输入电子邮箱" class="layui-input" lay-verify="required|email">
    </div>
    </div>

    <input type="hidden" id="user_operator" name="user_operator" value="<?php echo $row['user_name']; ?>">
    <input type="hidden" id="user_ip" name="user_ip" value="<?php echo $user_ip; ?>">

    <div class="layer-btn-center">
    <button type="submit" id="submit" class="layui-btn submit" id="submit" lay-submit lay-filter="submit"><i class="iconfont"></i> 提交</button>
    <button type="reset" class="layui-btn layui-btn-primary"><i class="iconfont"></i> 重置</button>
    </div>
    </form>
    </div>
    <script type="text/javascript" src="plugins/layui/layui.js"></script>
    <script type="text/javascript" src="plugins/jquery/1.9.1/jquery.min.js"></script>
    <script>
    layui.use(['jquery', 'form', 'layer'], function(){
    var $ = layui.jquery;
    var form = layui.form;
    layer = layui.layer;

    form.on('submit(submit)',function(data){

    if($('#user_status').prop('checked')){
    $('#user_status').val(1);
    } else {
    $('#user_status').val(0);
    }

    var user_name = $('#user_name').val();
    var user_sex = $('input[name="user_sex"]:checked').val();
    var user_mobile = $('#user_mobile').val();
    var user_password = $('#user_password').val();
    var user_role_id = $('#user_role_id').val();
    var user_status = $('#user_status').val();
    var user_email = $('#user_email').val();
    var user_operator = $('#user_operator').val();
    var user_ip = $('#user_ip').val();

    $.ajax({
    url: 'add_user_server.php',
    type: 'POST',
    dataType: 'json',
    data: {
    user_name : user_name,
    user_sex : user_sex,
    user_mobile : user_mobile,
    user_password : user_password,
    user_role_id : user_role_id,
    user_status : user_status,
    user_email : user_email,
    user_operator : user_operator,
    user_ip : user_ip
    },
    beforeSend: function(){

    },
    success: function(res){
    if(res.code==1){
    layer.alert('添加成功',{
    icon: 1,
    skin: 'layer-ext-moon'
    },function(){
    parent.window.location.reload();
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    parent.layer.close(index);
    });
    }else if(res.code==2){
    layer.alert('该手机号码已经存在,不能重复添加,请重试!',{
    icon: 0,
    skin: 'layer-ext-moon'
    },function(){
    window.location.reload();
    });
    }else{
    layer.alert('添加失败',{
    icon: 0,
    skin: 'layer-ext-moon'
    },function(){
    layer.getFrameIndex(window.name); //获取窗口索引
    parent.layer.load(index);
    });
    }
    }
    });
    return false;
    });
    });
    </script>
    </body>
    </html>
  • 2018-4-18 0:55:57下拉框从数据库中查询数据中回答:

    哪种编程语言
  • 2018-4-13 0:33:42弹出提示框中回答:

    @张灵甫 不客气,我也只是会点简单的,复杂的也不会
  • 2018-4-12 0:11:49弹出提示框中回答:

    你可以去掉输入框的验证属性,自己用jQuery写,然后调用layer组件
  • 2017-12-27 23:42:24HTML 生成Word文档中回答:

    参考: http://www.jq22.com/jquery-info11368
    我的实例代码如下:
                //导出为Word文件
    $("a.jquery-word-export").click(function(event) {
    layer.msg('<img src=images/loading_small.gif> 正在导出Word文件,请稍后...',{
    icon: -1,
    skin: 'layer-ext-moon',
    time: 1000,
    zIndex : 1986111400
    },function(){
    $("#form1").wordExport();
    });

    });

    if (typeof jQuery !== "undefined" && typeof saveAs !== "undefined") {
    (function($) {
    $.fn.wordExport = function(fileName) {
    fileName = typeof fileName !== 'undefined' ? fileName : "<?php echo $row['notice_title']; ?>";
    var static = {
    mhtml: {
    top: "Mime-Version: 1.0\nContent-Base: " + location.href + "\nContent-Type: Multipart/related; boundary=\"NEXT.ITEM-BOUNDARY\";type=\"text/html\"\n\n--NEXT.ITEM-BOUNDARY\nContent-Type: text/html; charset=\"utf-8\"\nContent-Location: " + location.href + "\n\n<!DOCTYPE html>\n<html>\n_html_</html>",
    head: "<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<style>\n_styles_\n</style>\n</head>\n",
    body: "<body>_body_</body>"
    }
    };
    var options = {
    maxWidth: 624
    };
    // Clone selected element before manipulating it
    var markup = $(this).clone();

    // Remove hidden elements from the output
    markup.each(function() {
    var self = $(this);
    if (self.is(':hidden'))
    self.remove();
    });

    // Embed all images using Data URLs
    var images = Array();
    var img = markup.find('img');
    for (var i = 0; i < img.length; i++) {
    // Calculate dimensions of output image
    var w = Math.min(.width, options.maxWidth);
    var h = .height * (w / .width);
    // Create canvas for converting image to data URL
    var canvas = document.createElement("CANVAS");
    canvas.width = w;
    canvas.height = h;
    // Draw image to canvas
    var context = canvas.getContext('2d');
    context.drawImage(, 0, 0, w, h);
    // Get data URL encoding of image
    var uri = canvas.toDataURL("image/png");
    $().attr("src", .src);
    .width = w;
    .height = h;
    // Save encoded image to array
    images[i] = {
    type: uri.substring(uri.indexOf(":") + 1, uri.indexOf(";")),
    encoding: uri.substring(uri.indexOf(";") + 1, uri.indexOf(",")),
    location: $().attr("src"),
    data: uri.substring(uri.indexOf(",") + 1)
    };
    }

    // Prepare bottom of mhtml file with image data
    var mhtmlBottom = "\n";
    for (var i = 0; i < images.length; i++) {
    mhtmlBottom += "--NEXT.ITEM-BOUNDARY\n";
    mhtmlBottom += "Content-Location: " + images[i].location + "\n";
    mhtmlBottom += "Content-Type: " + images[i].type + "\n";
    mhtmlBottom += "Content-Transfer-Encoding: " + images[i].encoding + "\n\n";
    mhtmlBottom += images[i].data + "\n\n";
    }
    mhtmlBottom += "--NEXT.ITEM-BOUNDARY--";

    //TODO: load css from included stylesheet
    var styles = "";

    // Aggregate parts of the file together
    var fileContent = static.mhtml.top.replace("_html_", static.mhtml.head.replace("_styles_", styles) + static.mhtml.body.replace("_body_", markup.html())) + mhtmlBottom;

    // Create a Blob with the file contents
    var blob = new Blob([fileContent], {
    type: "application/msword;charset=utf-8"
    });
    saveAs(blob, fileName + ".doc");
    };
    })(jQuery);
    } else {
    if (typeof jQuery === "undefined") {
    console.error("jQuery Word Export: missing dependency (jQuery)");
    }
    if (typeof saveAs === "undefined") {
    console.error("jQuery Word Export: missing dependency (FileSaver.js)");
    }
    }
  • 2017-12-26 21:29:19关于 layuiAdmin 的价格!!!心伤透了!!!中回答:

    怎么没看到通知,什么时候出来的
  • 2017-12-16 23:30:0基于 layui 的常用开发工具 chrome 插件 中回答:

    无法安装啊,怎么回事

  • 2017-11-21 5:45:4富文本编辑器什么时候更新???中回答:

    之前好像说3.0以后更新
  • 2017-11-1 10:46:29关于layui校验问题中回答:

    取消lay-verify="required"的验证属性就行了啊
  • 2017-10-20 19:12:39layui 一周年中回答:

    恭喜layui周岁了,希望越来越好,越来越多新功能
  • 2017-10-11 10:58:13发现thinkphp和layui是一对啊,我也撮合下中回答:

    @夏季未央 谢谢,抽空学一下
  • 2017-10-11 0:7:50发现thinkphp和layui是一对啊,我也撮合下中回答:

    试了一下,还不错,只是还是小白,没学框架的,暂时用不了,支持下
  • 2017-9-22 0:59:13前方来报,layui 荣获 “码云最有价值开源项目” GVP 认证中回答:

    恭喜贤心[good] [good]