ExtJS4.2學習(22)登入介面

來源:互聯網
上載者:User

標籤:extjs4.2   登入介面   tabpanel   

現在開始我們來慢慢完善這個系統,今天做一個登入介面,此套系統已經開始慢慢加入Java各種架構,或者後期我會自己定義合適的架構,讓它可以完整的跑下來。

今天做的是用window包裹panel,panel再包裹tabpanel實現的:先來看看今天做的:

650) this.width=650;" src="http://www.shuyangyang.com.cn/d/file/jishuliangongfang/qianduanjishu/20141102/38954bd0753f76eddd1088356bad128c.jpg" alt="login.jpg" width="563" height="368" style="border:none;" />

650) this.width=650;" src="http://www.shuyangyang.com.cn/d/file/jishuliangongfang/qianduanjishu/20141102/7d50e8888243b74475c0c8106f47e553.jpg" alt="about.jpg" width="602" height="389" style="border:none;" />

login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  <html>  <head>  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  <title>登入-ExtJS4.2學習之路</title>  <link href="../ExtJS4.2/resources/css/ext-all-neptune-rtl.css" rel="stylesheet">  <link href="../ExtJS4.2/css/icon.css" rel="stylesheet">  <script src="../ExtJS4.2/ext-all.js"></script>  <script src="../ExtJS4.2/locale/ext-lang-zh_CN.js"></script>  <script type="text/javascript" src="../demo/js/login.js"></script>  <style type="text/css">  .user{background: url(../ExtJS4.2/icons/user.png) no-repeat 2px 2px;}  .key{background: url(../ExtJS4.2/icons/key.png) no-repeat 2px 2px;}  .Userkey{background: url(../ExtJS4.2/icons/Userkey.png) no-repeat 2px 2px;}  .key,.user,.Userkey{              background-color: #FFFFFF;              padding-left: 20px;              font-size: 12px;          }  .bgimage {      background:url(../demo/image/logo.jpg ) no-repeat top;     position:absolute;  }  </style>  </head>  <body>      <div id="hello-tabs">          <!-- <img border="0" width="430" height="60"    src="../demo/image/logo.jpg" /> -->      </div>      <div id="aboutDiv" class="x-hidden"          style=‘color: black; padding-left: 10px; padding-top: 10px; font-size: 12px‘>      思考者日記網ExtJs學習系統 v1.0<br/><br/>      2013-2014 思考者日記網|束洋洋個人部落格(滬ICP備13005070)<br/><br/>      官方網站:<a href="http://www.shuyangyang.com.cn" target="_blank">www.shuyangyang.com.cn</a>      </div>  </body>  </html>

其中自訂了一些CSS和自己加的DIV,為了實現上面的圖片和tabpanel裡的東西,再看看關鍵的login.js

Ext.onReady(function() {      var userLoginPanel = Ext.create(‘Ext.panel.Panel‘, {          bodyCls: ‘bgimage‘,          border : false,          defaults:{              margin:‘58 0‘          },          items:{              xtype : ‘tabpanel‘,              id : ‘loginTabs‘,              activeTab : 0,              height : 180,              border : false,              items:[{                  title : "身份認證",                  xtype : ‘form‘,                  id : ‘loginForm‘,                  defaults : {                      width : 260,                      margin: ‘10 0 0 70‘                  },                  // The fields                  defaultType : ‘textfield‘,                  labelWidth : 40,                  items: [{                      fieldLabel: ‘使用者名稱‘,                      cls : ‘user‘,                      name: ‘username‘,                      labelAlign:‘right‘,                      labelWidth:65,                      maxLength : 30,                      emptyText:‘請在這裡填寫使用者名稱‘,                      maxLengthText : ‘帳號的最大長度為30個字元‘,                      blankText:"使用者名稱不可為空,請填寫!",//錯誤提示資訊,預設為This field is required!                      allowBlank: false                  },{                      fieldLabel: ‘密   碼‘,                      cls : ‘key‘,                      name: ‘password‘,                      inputType:"password",                      labelWidth:65,                      labelAlign:‘right‘,                      emptyText:‘請在這裡填寫密碼‘,                      maxLengthText :‘密碼長度不能超過20‘,                      maxLength : 20,                      blankText:"密碼不可為空,請填寫!",//錯誤提示資訊,預設為This field is required!                      allowBlank: false                  },{                      xtype:"combo",                      fieldLabel: ‘角   色‘,                      cls : ‘Userkey‘,                      name: ‘role‘,                      labelAlign:‘right‘,                      labelWidth:65,                      store:["管理員","校領導","教職工"],//資料來源為一數組                      emptyText:‘請選擇角色.‘,                      blankText:"請選擇角色!",//錯誤提示資訊,預設為This field is required!                      allowBlank: false                  }, {                      id : ‘id_reg_panel‘,                      xtype : ‘panel‘,                      border : false,                      hidden : true,                      html : ‘<br><span id=‘messageTip‘ style=‘color:red‘> </span>‘                  }]              }, {                  title : ‘關於‘,                  contentEl : ‘aboutDiv‘,                  defaults : {                      width : 230                  }              }]          }      });            Ext.create(‘Ext.window.Window‘, {          title : ‘SHUYANGYANGExtJs學習系統‘,          width : 440,          height : 300,          layout: ‘fit‘,          plain : true,          modal : true,          maximizable : false,          draggable : false,          closable : false,          resizable : false,          items: userLoginPanel,          // 重設 和 登入 按鈕.          buttons: [{              text: ‘重設‘,              iconCls : ‘Wrench‘,              handler: function() {                  Ext.Msg.alert(‘提示‘, ‘重設!‘);              }          }, {              text: ‘登入‘,              iconCls : ‘User‘,              handler: function() {                  Ext.Msg.wait("請等待", "溫馨提示", {                      text:‘正在登入……‘                  });              }          }]      }).show();  });

這裡大家可以自由發揮,加一些觸發事件來實現與後台互動,這裡我就不多寫了,後續完善的時候我會寫出來,因為現在靜態要實現的太多了,慢慢來。看到不懂的屬性或者地方,大家就去查API吧,相信學了這麼久,這個你應該會的吧?

連載中,請大家繼續關注!本文出自我的個人網站思考者日記網

論壇匯總貼:http://bbs.51cto.com/thread-1106544-1.html

本文出自 “On My Way” 部落格,請務必保留此出處http://shuyangyang.blog.51cto.com/1685768/1570902

ExtJS4.2學習(22)登入介面

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.