目录
-----------------------
Easyui入门视频教程 第09集---登录完善 图标自定义
继续 完善 登录
登录 判断
<script type="text/javascript"> $(document).ready(function () { // 在这里写你的代码... //$('#btn').linkbutton('enable'); //$('#btn').linkbutton('disable'); }); function Login() { var name = $('#name').val(); var pwd = $('#Password1').val(); if (name == '') { alert('用户名为空!'); $("#show").html('用户名不能为空'); return; } $.post("./user/Login", { name: name, pwd: pwd }, function (data) { if (data == 1) { alert('登录成功!'); } else { alert('用户名或者密码不正确!'); } }); } </script>
后台 MVC action里 判断
public ActionResult Login()
{
string name = Request.Form["name"];
string pwd = Request.Form["pwd"];
//调用业务逻辑层 去判断用户 输入是否争取
//为了 把学easyui放在首位 我们 不操作数据库了 直接判断 我们就默认 name = admin pwd = 123321 为正确
int res = 1;
if (name!="admin" || pwd != "123321")
{
res = 0;
}
return Content(res.ToString());
}
自定义图标
第一步: 下载图标 最好是16px * 16px 把他放到 theme 的icons 文件夹里面
第二步: 修改icon.css
.icon-laugh{
background:url('icons/7.png') no-repeat center center;
}
第三步:使用 修改属性
data-options="modal:true,closed:false,iconCls:'icon-laugh'"