UNPKG

lixin-web

Version:

vue and bootstrap

59 lines (54 loc) 1.29 kB
/** * 数据工厂 */ import {Route} from './control' var isLogin = false; // 是否登录 var mainAccount; // 主账户 var lotteryAccount; // 彩票账户 var baccaratAccount; // 百家乐账户 var info; // 信息 var msgCount; var init = function(options,callback) { if (!options) { options = {}; } options.url = Route.PATH + Route.WebAjax.PATH + Route.WebAjax.INIT_PAGE; options.async = false; options.success = function(response) { if (response.error == 0) { var data = response.data; isLogin = data.isLogin; if (isLogin) { mainAccount = data.main; lotteryAccount = data.lottery; info = data.info; msgCount = data.msgCount; // callback() } } }; HttpRequest(options); }; const AppData = { init: init, isLogin: function() { return isLogin; }, getMainAccount: function() { return mainAccount; }, getLotteryAccount: function() { return lotteryAccount; }, getBaccaratAccount: function() { return baccaratAccount; }, getInfo: function() { return info; }, getMsgCount: function() { return msgCount; } } window.AppData = AppData export default AppData