目錄
-----------------------
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'"