0
这是我的看法
Ext.define("TimeSheet.view.Tracktime", {
extend: "Ext.form.Panel",
requires: ["Ext.form.FieldSet", "Ext.field.Text", "Ext.Button","Ext.Label", "Ext.field.Email", "Ext.field.Password","Ext.MessageBox", "Ext.Img"],
alias: "widget.tracktimeview",

config:{
    id: 'entrypage',
    fullscreen: true,
    url: 'timesheet.ajatus.in/check.php',
    //standardSubmit: false,
    method: 'GET',
    layout: {
        centered: true,
    },
    defaults: {
        styleHtmlContent: true,
        //cls: 'backfield'
    },

    cls: 'panelBackground',
    items: [{
        xtype: 'fieldset',
        id: 'loginfield',
        autoComplete: true,
        scrollable: false,
        cls: 'formfield',
        items: [{
                xtype: 'image',
                src: 'tracktime.png',
                height: '60px',
                cls: 'track'

            },
            {
                xtype: 'textfield',
                name : 'name',
                label: 'tracktime/'

            },
            {
                xtype: 'textfield',
                name : 'uname',
                allowBlank:false, 
                placeHolder: "User name"
            },
            {
                xtype: 'passwordfield',
                name : 'password',
                allowBlank:false, 
                placeHolder: 'Password'
            }
        ]
    },{
        xtype: 'button',
        id: 'loginbtn',
        cls: 'enter',
        text: 'Sign in',
        ui: 'confirm',
        height: "50px",

     }],



    control: ({

        '#loginbtn': {
            tap: function() {

            }
        }
    }),
},});

这是控制器

Ext.define("TimeSheet.controller.Track", {
extend: "Ext.app.Controller",

config: {
    refs: {
        trackTimeView: "tracktimeview",
        selector: '#tracktimeview',

        addentryView: "addentryview",
        selector: '#addentryview',

        entryPage: '#entrypage',

        loginBtn: '#loginbtn'

    },
    control:{
        loginBtn: {
            tap: "onLoginBtn"
        },

        onloginbtn: {
            tap: function(btn) {
                var form = Ext.getCmp('entry');
                //var values = entry.getValues();
                entry.submit({
                    method:'POST',
                    url: 'xxxxxxxx/check.php',
                    params: values,

                    success: function(response){
                      var text = response.responseText;
                      Ext.Msg.alert('Success', text);
                 },

                    failure : function(response) {
                       Ext.Msg.alert('Error','Error while submitting the form');
                       console.log(response.responseText);
                 }
                });
            }
        },


    }
},


onLoginBtn: function() {
    console.log("onLoginBtn");
    var values = TimeSheet.views.tracktimeview.entrypage.getValues();
    TryLogin(values['uname'], values['password']);
},

launch: function () {
    this.callParent(arguments);
    console.log("launch");
},
init: function () {
    this.callParent(arguments);
    console.log("init");
}});
4

0 回答 0