Skip to content

Commit

Permalink
登录和主页改完aspx页面
Browse files Browse the repository at this point in the history
  • Loading branch information
tengge1 committed May 28, 2017
1 parent f2f7f1d commit 9ea541d
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 130 deletions.
2 changes: 1 addition & 1 deletion ExtApp/ExtApp.BLL/App/LoginBLL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public LoginResult Login(LoginModel model)
HttpContext.Current.Response.Cookies.Add(cookie);

// 验证权限后将获得的用户信息写入Session
HttpContext.Current.Items.Add("__userID", user.ID.ToString());
HttpContext.Current.Session["__userID"] = user.ID.ToString();
LogHelper.Info("用户" + model.Username + "登录成功!", type: LogType.User);
return new LoginResult(200, "登录成功!", user, cookie.Value);
}
Expand Down
2 changes: 1 addition & 1 deletion ExtApp/ExtApp.Helpers/AdminHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static User Admin
{
get
{
var userID = HttpContext.Current.Items["__userID"];
var userID = HttpContext.Current.Session["__userID"];
if (userID == null)
{
return null;
Expand Down
49 changes: 40 additions & 9 deletions ExtApp/ExtApp.Web/Default.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,47 @@

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ExtJs权限管理系统</title>
<link href="<%=theme %>" rel="stylesheet" />
<link href="packages/extjs/icon.css" rel="stylesheet" />
<link href="css/common.css" rel="stylesheet" />
<script src="packages/extjs/ext-all-debug.js"></script>
<script src="packages/extjs/locale/locale-zh_CN.js"></script>
<script src="app/App.js"></script>
<script>
Ext.require('App.app.desktop.Index');
Ext.onReady(function () {
var cls = App.getQueryString('cls');
var p = null;
if (cls == null) {
if ('<%=style %>' == 'Desktop') {
new App.app.desktop.Index();
return;
} else {
p = Ext.create('App.app.accordion.Index');
}
} else {
p = Ext.create(cls, {
header: false,
border: false
});
}
if (p != null) {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
listeners: {
beforerender: function (sender) {
sender.add(p);
}
}
});
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>
17 changes: 17 additions & 0 deletions ExtApp/ExtApp.Web/Default.aspx.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
Expand All @@ -9,9 +10,25 @@ namespace ExtApp.Web
{
public partial class Default : System.Web.UI.Page
{
protected string style = "";
protected string theme = "";

protected void Page_Load(object sender, EventArgs e)
{
if (AdminHelper.Admin == null)
{
Response.Redirect("Login.aspx");
}
if (!IsPostBack)
{
init();
}
}

private void init()
{
style = ConfigurationManager.AppSettings["Style"];
theme = ConfigurationManager.AppSettings["Theme"];
}
}
}
27 changes: 8 additions & 19 deletions ExtApp/ExtApp.Web/Default.aspx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions ExtApp/ExtApp.Web/ExtApp.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@
<Content Include="app\work\store\Message.js" />
<Content Include="app\work\store\MessageReceive.js" />
<Content Include="Default.aspx" />
<Content Include="desktop.html" />
<Content Include="index.html" />
<Content Include="Login.aspx" />
<Content Include="packages\jquery\jquery.js" />
<Content Include="packages\jquery\jquery.min.js" />
Expand Down
4 changes: 1 addition & 3 deletions ExtApp/ExtApp.Web/Login.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
Ext.onReady(function () {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: Ext.create('App.app.Login', {
style: '<%=style %>'
})
items: Ext.create('App.app.Login')
});
});
</script>
Expand Down
7 changes: 5 additions & 2 deletions ExtApp/ExtApp.Web/Login.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ namespace ExtApp.Web
{
public partial class Login : System.Web.UI.Page
{
protected string style = "";
protected string theme = "";

protected void Page_Load(object sender, EventArgs e)
{
if (AdminHelper.Admin != null)
{
Response.Redirect("Default.aspx");
return;
}
if (!IsPostBack)
{
init();
Expand All @@ -24,7 +28,6 @@ protected void Page_Load(object sender, EventArgs e)

private void init()
{
style = ConfigurationManager.AppSettings["Style"];
theme = ConfigurationManager.AppSettings["Theme"];
}
}
Expand Down
3 changes: 3 additions & 0 deletions ExtApp/ExtApp.Web/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

<!-- 主题路径 -->
<add key="Theme" value="packages/extjs/themes/theme-classic/theme-classic-all.css" />

<!-- 禁用BrowserLink -->
<add key="vs:EnableBrowserLink" value="false"/>
</appSettings>

<!-- Hibernate配置 -->
Expand Down
14 changes: 4 additions & 10 deletions ExtApp/ExtApp.Web/app/app/LoginController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Ext.define('App.app.LoginController', {
extend: 'Ext.app.ViewController',
alias: 'controller.login',

requires: [
'App.util.Config'
],

init: function () {
var me = this;
Ext.getBody().on('keypress', function (e) {
Expand All @@ -17,7 +13,8 @@ Ext.define('App.app.LoginController', {
},

onLoginClick: function () {
var form = this.getView().up('viewport').down('form').getForm();
var view = this.getView();
var form = view.down('form').getForm();
if (!form.isValid()) {
return;
}
Expand All @@ -35,17 +32,14 @@ Ext.define('App.app.LoginController', {
mask.hide();
var obj = JSON.parse(r);
if (obj.Code == 200) {
//var config = Ext.create('util.config');
//config.setState('login');
//window.location.reload();
window.location = window.location.origin + window.location.pathname;
window.location = 'Default.aspx';
} else {
App.alert('消息', obj.Msg);
}
});
},

onResetClick: function () {
this.getView().up('viewport').down('form').getForm().reset();
this.getView().down('form').getForm().reset();
}
});
41 changes: 0 additions & 41 deletions ExtApp/ExtApp.Web/desktop.html

This file was deleted.

42 changes: 0 additions & 42 deletions ExtApp/ExtApp.Web/index.html

This file was deleted.

0 comments on commit 9ea541d

Please sign in to comment.