lixin-web
Version:
vue and bootstrap
164 lines (148 loc) • 7.4 kB
JavaScript
/**
* Created by admin on 2017/1/30.
*/
'use strict';
function Console() {
this.oChangePassWord = document.querySelector('.change-pw');
if(this.oChangePassWord){
this.aChangeIsPassWord = this.oChangePassWord.querySelectorAll('.heard li');
this.aChangeUl = this.oChangePassWord.querySelectorAll('.body ul');
this.aChangeIpt = this.oChangePassWord.querySelectorAll('.body input');
this.aChangeSub = this.oChangePassWord.querySelectorAll('.body ul div');
}
this.oChangeInfoSub = document.querySelector('.information .body .ipt');
this.aChangeInfoLi = document.querySelectorAll('.information .body li');
this.aSafeWage = document.querySelectorAll('.safe-center .wage-title span');
this.aFinanceBalancd = document.querySelectorAll('.finance-center .balance span');
this.aFinanceDetails = document.querySelectorAll('.finance-center .details .row .col-md-6');
this.aRechargeTitle = document.querySelectorAll('.recharge .title .col-md-2');
this.aRechargeTitleActive = document.querySelector('.recharge .title .subscript');
this.oRechargeBody = document.querySelector('.recharge .body');
this.aManagementTitle = document.querySelectorAll('.management .title .col-md-2');
this.aManagementTitleActive = document.querySelector('.management .title .subscript');
this.oManagementBody = document.querySelector('.management .body');
this.oOverview = document.querySelector('.overview');
this.aVerticalTabTitle = document.querySelectorAll('.nav2 h4')
this.aVerticalTabTitleLogo = document.querySelectorAll('.nav2 h4 span')
this.aVerticalTabBody = document.querySelectorAll('.nav2 ul')
this.oQuestion = {};
// /*google验证*/
// this.isGoogleAuth('/api/account/prepare-update-google-auth');
// /*修改密码切换*/
// this.tabPassWord();
// /*点击提交修改密码*/
// this.changePassWordSubmit(this.aChangeSub[0], '/api/account/modify-password');
// this.changePassWordSubmit(this.aChangeSub[1], '/api/account/modify-withdraw-password');
// /*输入提示*/
// this.verification();
// /*修改用户名*/
// this.changeUserName(this.oChangeInfoSub, '/api/account/modify-nickname');
// /*写入余额 银行卡等信息*/
// this.info();
// /*资金记录表格生成*/
// this.rechargeTable();
// /*团队管理表格生成*/
// this.managementTable();
// // 团队信息
// this.overviewInfo();
//左导航效果
//this.verticalTab();
// this.randomProblem();
//this.finanTab();
}
Console.prototype.changeUserName = function (obj, url) {
if(!obj) return;
obj.onclick = function () {
Will.ajax({ nickname: this.aChangeInfoLi[0].querySelector('input').value }, url, function (res) {
Will.success('修改成功!');
})
}.bind(this)
};
Console.prototype.info = function () {
var _this = this;
if (this.aSafeWage[0]) {
this.aSafeWage[0].innerHTML = AppData.getLotteryAccount().availableBalance.toFixed(3);
Will.ajax({}, '/api/account/list-card', function (res) {
_this.aSafeWage[3].innerHTML = res.length;
})
}
if (this.aFinanceBalancd && this.aFinanceBalancd[1]) {
this.aFinanceBalancd[0].innerHTML = this.aFinanceBalancd[1].innerHTML = AppData.getLotteryAccount().availableBalance.toFixed(3);
this.aFinanceDetails[0].innerHTML = '主账户:¥' + AppData.getLotteryAccount().availableBalance.toFixed(2);
this.aFinanceDetails[2].innerHTML = '彩票:¥' + AppData.getLotteryAccount().availableBalance.toFixed(2);
}
};
Console.prototype.rechargeTable = function () {
var _this = this;
if (!this.oRechargeBody) return;
//this.oRechargeBody.innerHTML = rechargeListTable()[0].innerHTML;
this.oRechargeBody.innerHTML = '';
this.oRechargeBody.appendChild(rechargeListTable()[0])
for (var i = 0; i < this.aRechargeTitle.length; i++) {
this.aRechargeTitle[i].index = i;
this.aRechargeTitle[i].onclick = function () {
for (var i = 0; i < _this.aRechargeTitle.length; i++) {
_this.aRechargeTitle[i].className = 'col-md-2 text-center';
}
this.className = 'col-md-2 text-center active';
_this.aRechargeTitleActive.style.left = 30 + 164 * this.index + 'px';
_this.oRechargeBody.innerHTML = '';
if (this.innerHTML == '存款') {
_this.oRechargeBody.appendChild(rechargeListTable()[0]);
} else if (this.innerHTML == '提款') {
_this.oRechargeBody.appendChild(withdrawListTable()[0]);
} else if (this.innerHTML == '资金转换') {
_this.oRechargeBody.appendChild(transferListTable()[0]);
}
}
}
};
Console.prototype.managementTable = function () {
var _this = this;
if (!this.aManagementTitle || !this.oManagementBody) return;
//console.log(teamAccountTable()[0].innerHTML);
this.oManagementBody.innerHTML = '';
this.oManagementBody.appendChild(teamAccountTable()[0]);
for (var i = 0; i < this.aManagementTitle.length; i++) {
this.aManagementTitle[i].index = i;
this.aManagementTitle[i].onclick = function () {
for (var i = 0; i < _this.aManagementTitle.length; i++) {
_this.aManagementTitle[i].className = 'col-md-2 text-center';
}
this.className = 'col-md-2 text-center active';
_this.aManagementTitleActive.style.left = 30 + 168 * this.index + 'px';
_this.oManagementBody.innerHTML = '';
if (this.innerHTML == '会员管理') {
_this.oManagementBody.appendChild(teamAccountTable()[0]);
} else if (this.innerHTML == '在线会员') {
_this.oManagementBody.appendChild(onlineAccountTable()[0]);
} else if (this.innerHTML == '团队报表') {
_this.oManagementBody.appendChild(agentLotteryListTable()[0]);
} else if (this.innerHTML == '快乐彩团队报表') {
_this.oManagementBody.appendChild(agentBillListTable()[0]);
}
}
}
};
Console.prototype.verticalTab = function () {
var _this = this;
for(var i = 0; i < this.aVerticalTabTitle.length; i ++) {
(function (index) {
_this.aVerticalTabTitle[i].onclick = function () {
if(_this.aVerticalTabBody[index].style.height == '0px' || _this.aVerticalTabBody[index].style.height == null){
$(_this.aVerticalTabBody[index]).animate({'height': 40 * _this.aVerticalTabBody[index].children.length + 'px'});
$(_this.aVerticalTabTitleLogo[index]).css({'transform': 'rotate(0deg)'});
}else{
$(_this.aVerticalTabBody[index]).animate({'height': '0px'});
$(_this.aVerticalTabTitleLogo[index]).css({'transform': 'rotate(180deg)'});
}
}
})(i)
}
}
Console.prototype.randomProblem = function () {
var _this = this;
Will.ajax({}, '/api/account/get-random-security', function (res) {
_this.oQuestion = res;
})
};