Ejemplo n.º 1
0
Archivo: game.js Proyecto: kk-tem/dash
        gotoPage: function(pageIndex) {
            if (pageIndex == "next") {
                pageIndex = this.currentPageIndex + 1;
            } else if (pageIndex == "prev") {
                pageIndex = this.currentPageIndex - 1;
            } else if (typeof pageIndex != "number") {
                return ;
            }

            var self = this;
            dLoading.show();
            gameModel.getGroups({
                // pageIndex: pageIndex,
                // pageSize: 20,
                type:  this.stage,
                status: $("#gameStatus").val()? $("#gameStatus").val() : 1
            }, function(resp) {
                dLoading.hide();
                var gameList = resp.data;
                self.setGroups(gameList);
                // var pages = resp.data.pages;
                // self.setPageIndex(pages.current, pages.total);
            }, function(resp) {
                dLoading.hide();
                // console.log("get page " + pageIndex + " error");
            });
        },
Ejemplo n.º 2
0
Archivo: login.js Proyecto: kk-tem/dash
 onLog: function () {
     var username = $('#uname').val();
     var password = $('#password').val();
     if (!username || username === '') {
         swal("登录失败", "请正确填写用户名", "error");
         return;
     }
     if (!password || password === '') {
         swal("登录失败", "请正确填写密码", "error");
         return;
     }
     var params = {
         username: username,
         password: password
     }
     dLoading.show();
     net('post', 'user.login', params, function (resp) {
         dLoading.hide();
         localStorage.setItem('islog', true);
         var userinfo = JSON.stringify(resp.data);
         localStorage.setItem('sid', resp.data.sid);
         localStorage.setItem('userinfo', userinfo);
         swal("登录成功", "欢迎" + username, "success");
         location.href = '#!/dash/home';
     }, function (resp) {
         dLoading.hide();
         swal("登录失败", resp? resp.msg : "登录失败", "error");
     });
 }
Ejemplo n.º 3
0
		confirmRemove: function(idNo) {
			dLoading.show(this.elId);
			var self = this;
			userInfoBoxModel.removeUser({
	        	id_no: idNo
	        }, function(resp) {
	        	dLoading.hide();
	        	self.hide();
	        	toastr.success('删除成功!');
	        	self.removeUserCallback && self.removeUserCallback();
	        }, function() {
	        	dLoading.hide();
	        	toastr.error('删除失败!');
	        });
		},
Ejemplo n.º 4
0
	show: function(elId, memberNo, removeUserCallback) {
		if (!boxEl) {
			dLoading.show(elId);
			userInfoBoxModel.getUserInfo({
	        	username: memberNo
	        }, function(resp) {
	        	dLoading.hide();
	        	boxEl = new UserInfoBox().$mount().$appendTo("#" + elId);
	        	boxEl.userInfo = resp.data;
	        	boxEl.userInfo.create_time = getLocalTime(boxEl.userInfo.create_time);
	        	boxEl.userInfo.sex = boxEl.userInfo.sex == 0? "女" : "男";
	        	boxEl.userInfo.type = boxEl.userInfo.type == 0? "普通会员" : "内部员工";
	        	boxEl.elId = elId;
	        	boxEl.removeUserCallback = removeUserCallback;
	        }, function() {
	        	dLoading.hide();
	        });
		}
	},
Ejemplo n.º 5
0
        save: function () {
            if (this.result.max_layer_per_game < 1 || this.result.max_layer_per_game>3 ) {
                swal("设置失败", "层数必须在 1 到 3 之间", "error");
                return;
            }

            if (this.result.max_layer_per_game < 1 || this.result.max_layer_per_game>3) {
                swal("设置失败", "节点数必须在 1 到 3 之间", "error");
                return;
            }

            if (this.result.time_limit_per_game < 1 || this.result.time_limit_per_game > 73) {
                swal("设置失败", "每局的最大时限(小时)在 1 到 72 之间", "error");
                return;
            }

            if (this.result.max_gamecnt_per_hour < 1 || this.result.max_gamecnt_per_hour > 7) {
                swal("设置失败", "每小时最大开局数量在 1 到 6 之间", "error");
                return;
            }

            if (this.result.time_limit_session < 1 || this.result.time_limit_session > 61) {
                swal("设置失败", "会话过期时间(分钟)在1 到 60之间", "error");
                return;
            }

            if(!this.result.level_1_earn){
                swal("设置失败", "请填写每1级盈利", "error");
                return;
            }

            if(!this.result.level_2_earn){
                swal("设置失败", "请填写每2级盈利", "error");
                return;
            }

            if(!this.result.level_3_earn){
                swal("设置失败", "请填写每3级盈利", "error");
                return;
            }

            if(!this.result.level_4_earn){
                swal("设置失败", "请填写每4级盈利", "error");
                return;
            }

            if(!this.result.capital_amount){
                swal("设置失败", "请填写交纳的本金", "error");
                return;
            }

            if(!this.result.level_1){
                swal("设置失败", "请填写级别1的显示名称", "error");
                return;
            }

            if(!this.result.level_2){
                swal("设置失败", "请填写级别2的显示名称", "error");
                return;
            }

            if(!this.result.level_3){
                swal("设置失败", "请填写级别3的显示名称", "error");
                return;
            }

            if(!this.result.level_4){
                swal("设置失败", "请填写级别4的显示名称", "error");
                return;
            }

            if(!this.result.level_5){
                swal("设置失败", "请填写级别5的显示名称", "error");
                return;
            }

            if(!this.result.level_6){
                swal("设置失败", "请填写级别6的显示名称", "error");
                return;
            }

            if(!this.result.level_5_earn){
                swal("设置失败", "请填写第5级盈利", "error");
                return;
            }

            if(!this.result.level_6_earn){
                swal("设置失败", "请填写第6级盈利", "error");
                return;
            }

            var options = this.result;

            var self = this;
            dLoading.show();
            settingModel.add(options, function() {
                dLoading.hide();
                swal("成功", "设置成功", "success");
            }, function() {
                $("#setting").form("clear");
                dLoading.hide();
                toastr.error('设置失败!');
            })
        }