import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { // btci: 1, ethi: 1, troni: 1, // 临时存放的 noBackupWalletInfo: uni.getStorageSync("noBackupWalletInfo") || { walletPassword: '', wallet: {}, }, // 正式的值 walletInfo: uni.getStorageSync("walletInfo") || { walletPassword: '', walletList: [] }, // 查询是否激活 isActivation: uni.getStorageSync("isActivation") || false, // 下载地址 installAddress: uni.getStorageSync('installAddress') || 'baidu.com', // 更新提示内容 updateTipContent: uni.getStorageSync('updateTipContent') || '版本更新', // 中英化 language: uni.getStorageSync("language") || 'en_US', // 是否需要更新 isUpdate: false // 所有的余额 // balance: uni.getStorageSync("balance") || { // bmsBalance: 0, // bmdtBalance: 0, // ercBalance: 0, // ethBalance: 0, // ethUsdt: 0, //汇率 // trcBalance: 0, // trxBalance: 0, // trxUsdt: 0, //汇率 // }, // // BMS交易记录 // bmsTransactionList: [ // ], // // BMDT交易记录 // bmdtTransactionList: [ // ], // // 公募记录 // publicOfferingRecords: [], }, mutations: { addBtci(state, num) { var a = uni.getStorageSync('btci') console.log(a, 2224) if (a == '') { uni.setStorageSync('btci', state.btci) console.log(state.btci, 2224) } else { state.btci = uni.getStorageSync('btci') state.btci = state.btci + num uni.setStorageSync('btci', state.btci) console.log(state.btci, 4444) } }, addEthi(state, num) { var a = uni.getStorageSync('ethi') if (a == '') { uni.setStorageSync('ethi', state.ethi) console.log(state.ethi, 2224) } else { state.ethi = uni.getStorageSync('ethi') state.ethi = state.ethi + num uni.setStorageSync('ethi', state.ethi) console.log(state.ethi, 4444) } }, addTroni(state, num) { var a = uni.getStorageSync('troni') if (a == '') { uni.setStorageSync('troni', state.troni) } else { state.troni = uni.getStorageSync('troni') state.troni = state.troni + num uni.setStorageSync('troni', state.troni) } }, // 设置选中的钱包 setSelectWallet: (state, selected) => { const obj = state obj.selected = selected }, // 设置是否已激活 setIsActivation: (state, isActivation) => { const obj = state obj.isActivation = isActivation }, // 设置下载地址 setInstallAddress: (state, installAddress) => { const obj = state obj.installAddress = installAddress }, // 设置版本更新内容 setUpdateTipContent: (state, updateTipContent) => { const obj = state obj.updateTipContent = updateTipContent }, // 设置中英文 setLanguage: (state, language) => { const obj = state obj.language = language uni.setStorageSync("language", language) }, // 设置是否需要更新 setIsUpdate: (state, isUpdate) => { const obj = state obj.isUpdate = isUpdate } }, }) export default store