diff --git a/main.js b/main.js index 25a2344..b5d5420 100644 --- a/main.js +++ b/main.js @@ -14,7 +14,6 @@ import util from 'ethereumjs-util' import store from './store' import walletUtil from './utils/WalletUtil.js' -import dataUtil from './utils/DataUtil.js' Vue.prototype.$store = store Vue.prototype.tronweb = tronweb Vue.prototype.bip32 = bip32 @@ -24,7 +23,6 @@ Vue.prototype.bitcoin = bitcoin Vue.prototype.ethers = ethers Vue.prototype.$axios = axios Vue.prototype.$walletUtil = walletUtil -Vue.prototype.$dataUtil = dataUtil // 自定义底部导航栏 import tabBar from 'components/tabBar/tabBar.vue' @@ -56,10 +54,13 @@ import TokenUtil from './utils/TokenUtil.js' import EthUtil from './utils/EthUtil.js' import TronUtil from './utils/TronUtil.js' import api from './utils/api.js' +import SystemConfiguration from './utils/SystemConfiguration.js' + Vue.prototype.$Token = TokenUtil Vue.prototype.$EthUtil = EthUtil Vue.prototype.$TronUtil = TronUtil Vue.prototype.$api = api +Vue.prototype.$SystemConfiguration = SystemConfiguration Vue.prototype.$_i18n = i18n // Vue.prototype.$showDialog = true App.mpType = 'app' diff --git a/pages/menu/market/index.vue b/pages/menu/market/index.vue index 440260e..7b7b577 100644 --- a/pages/menu/market/index.vue +++ b/pages/menu/market/index.vue @@ -15,23 +15,20 @@ - {{item.name}}/USDT + {{item.symbol}}/USDT - ${{item.current_price_usd}} + ${{item.last}} - {{item.current_price}} + {{item.priceCny}} - - {{item.change_percent>0?'+':''}}{{item.change_percent}}% + + {{item.rose>0?'+':''}}{{item.rose}}% @@ -50,53 +47,55 @@ export default { data() { return { - recordInfo: [], - isStop: false + recordInfo: [] } }, - onUnload: function() { - this.isStop = true - }, + computed: { - i18n() { - return this.$t('index') - }, - }, + i18n() { + return this.$t('index') + }, + }, methods: { - getHomeSlideFunc() { - - var _self = this; - uni.request({ - url: 'https://dncapi.fxhapp.com/api/coin/web-coinrank?page=1&type=0&pagesize=10', //请求接口 - header: { - 'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息 - }, - success: (res) => { - this.recordInfo = res.data.data - setTimeout(function() { - console.log(_self.isStop) - if (!_self.isStop) { - _self.getHomeSlideFunc() - } - - }, 2000) - this.$forceUpdate() - - - } - }); - + async getHomeSlideFunc() { + const response = await this.$api.getCoinTickerList() + // this.collectinInfo=response.data + this.recordInfo = response.data.value }, }, onLoad() { - - this.getHomeSlideFunc() - - - + this.getHomeSlideFunc(); + let that=this + uni.onSocketOpen(function (res) { + + }); + uni.connectSocket({ + url: that.$SystemConfiguration.constant.coinTickerWs + }); + + + + uni.sendSocketMessage({ + data: '{"type":"add_ticker"}' + }); + uni.onSocketMessage(function(res) { + let data=JSON.parse(res.data); + console.log(data,11111) + that.recordInfo = data.value + + }); + },onUnload: function() { + + uni.onSocketClose(function (res) { + console.log('WebSocket 已关闭!'); + }); + },onHide:function(){ + uni.onSocketClose(function (res) { + console.log('WebSocket 已关闭!'); + }); } }; diff --git a/pages/menu/profile/index.css b/pages/menu/profile/index.css index a17787a..024359a 100644 --- a/pages/menu/profile/index.css +++ b/pages/menu/profile/index.css @@ -30,7 +30,7 @@ padding-bottom: 350rpx; height: 72rpx; } .main_con .item .text1{ - font-size: 32rpx; + font-size: 28rpx; margin-left: 24rpx; } .main_con .item .img2{ diff --git a/pages/menu/profile/index.vue b/pages/menu/profile/index.vue index 66f08f7..d070f2c 100644 --- a/pages/menu/profile/index.vue +++ b/pages/menu/profile/index.vue @@ -2,77 +2,77 @@ - {{i18n.protit}} + {{i18n.protit}} - - - {{i18n.apps}} - - - - - {{i18n.magew}} + + + {{i18n.apps}} + + + + + {{i18n.magew}} + + + + + + + {{i18n.addBook}} + + + + + + + {{i18n.Settings}} + + + + + + + {{i18n.helpcen}} + + + + + + + {{i18n.aboutus}} + + + - - - - - - {{i18n.addBook}} - - - - - - - {{i18n.Settings}} - - - - - - - {{i18n.helpcen}} - - - - - - - {{i18n.aboutus}} - - - - - - - - - {{i18n.Hardware}} - - - - - {{i18n.math}} + + + + + {{i18n.Hardware}} + + + + + {{i18n.math}} - - - - - - - - - - + + + + + + + - + + + + @@ -83,49 +83,50 @@ export default { data() { return { - + } }, - + methods: { - goMatching(){ + goMatching() { uni.showToast({ title: 'Not yet open', icon: 'none', duration: 1500 }) }, - goAbout(){ - uni.navigateTo({ - url:'/pages/menu/about/index' - }) - }, - goHelp(){ + goAbout() { + uni.navigateTo({ + url: '/pages/menu/about/index' + }) + }, + goHelp() { uni.showToast({ title: 'Not yet open', icon: 'none', duration: 1500 }) }, - goSettings(){ + goSettings() { uni.navigateTo({ - url:'/pages/menu/setting/index' - }) + url: '/pages/menu/setting/index' + }) + }, + goMan() { + uni.navigateTo({ + url: '/pages/menu/wallet/mwallet/index' + }) + }, + goAddress() { + uni.setStorageSync('sourcePage', '/pages/menu/profile/index'); + uni.navigateTo({ + url: '/pages/menu/sendToken/address/index' + }) }, - goMan(){ - uni.navigateTo({ - url:'/pages/menu/wallet/mwallet/index' - }) - }, - goAddress(){ - uni.navigateTo({ - url:'/pages/menu/sendToken/address/index' - }) - }, }, onLoad() { - + }, computed: { i18n() { @@ -135,9 +136,9 @@ }; diff --git a/pages/menu/sendToken/index.css b/pages/menu/sendToken/index.css index 1e5b5e7..4ffd938 100644 --- a/pages/menu/sendToken/index.css +++ b/pages/menu/sendToken/index.css @@ -43,7 +43,7 @@ font-size: 32rpx; } .title{ - font-size: 36rpx; + font-size: 32rpx; text-align: center; font-weight: 700; margin-top: 15rpx; @@ -65,7 +65,7 @@ } .main .text2{ color: #000; - font-size: 30rpx; + font-size: 28rpx; margin-top: 52rpx; background-color: #FAFAFA; border-radius: 10rpx; diff --git a/pages/menu/sendToken/transfer/index.vue b/pages/menu/sendToken/transfer/index.vue index 110044d..69d9e4f 100644 --- a/pages/menu/sendToken/transfer/index.vue +++ b/pages/menu/sendToken/transfer/index.vue @@ -21,14 +21,14 @@ {{i18n.Receivingaddress}} - {{i18n.AdressBook}} + {{i18n.AddressBook}} - + @@ -438,12 +438,12 @@ this.show = true; let that = this if (this.coin.type === 'ETH') { + this.$EthUtil.getGas().then((res) => { + console.log(res, 'ETH') this.$EthUtil.getGas().then((res) => { - console.log(res,'ETH') - this.$EthUtil.getGas().then((res) => { - that.transInfoPass.fee = res*61000/ Math.pow(10,6) - }) + that.transInfoPass.fee = res * 61000 / Math.pow(10, 6) }) + }) } else if (this.coin.type === 'TRX') { this.$TronUtil.getTransaction(this.transInfoPass.fromAddress, @@ -453,7 +453,7 @@ that.transaction = res; uni.setStorageSync('transaction', that.transaction) console.log(JSON.stringify(that.transaction)) - let size = JSON.stringify(that.transaction).replace(/[^x00-xFF]/g,'**').length; + let size = JSON.stringify(that.transaction).replace(/[^x00-xFF]/g, '**').length; console.log(size, "size") console.log(size.toString().length, "size") that.transInfoPass.fee = Number(size) * (size.toString().length + 1) * 1000 / Math.pow(10, @@ -472,6 +472,16 @@ } }, + scanCode() { + var _this = this + uni.scanCode({ + success: function(res) { + console.log('扫码内容', res.result) + + _this.transInfoPass.toAddress = res.result; + } + }); + }, // 取消指纹识别 printCancel() { @@ -601,7 +611,7 @@ goAddress(text) { - console.log(text) + uni.navigateTo({ url: '../address/index?item=' + text }) @@ -624,7 +634,7 @@ if (uni.getStorageSync('fingerPass')) { this.passShow = uni.getStorageSync('fingerPass') } - + } }; diff --git a/pages/menu/token/btc/index.vue b/pages/menu/token/btc/index.vue index 6b208fa..898624f 100644 --- a/pages/menu/token/btc/index.vue +++ b/pages/menu/token/btc/index.vue @@ -45,8 +45,9 @@ - + + @@ -63,15 +64,15 @@ {{item.address}} - {{item.time}} + {{item.transactionTime}} - + - - - {{item.value}} + + + - + {{item.amount}} {{item.network}} @@ -116,14 +117,15 @@ data() { return { // 拿账单的address - trxs:{}, + trxs: [], coin: {}, + isNoData:false, showInfo: false, list: [{ name: this.$t('index').All, }, { - name: this.$t('index').Send, + name: this.$t('index').Send, }, { name: this.$t('index').Receive, @@ -144,10 +146,10 @@ } }, computed: { - i18n() { - return this.$t('index') - }, - }, + i18n() { + return this.$t('index') + }, + }, methods: { goSend() { uni.navigateTo({ @@ -178,35 +180,52 @@ this.type = 'receive' } this.current = index; - console.log(this.current) + this.pageNum = 1; + this.trxs=[]; this.getWalletInfo(); + this.isNoData=false; }, + onReachBottom() { + if(!this.isNoData){ + this.pageNum=this.pageNum+1; + this.getWalletInfo(); + } + + }, + async getWalletInfo() { + let params = { + address: this.coin.address, + chainName: this.coin.type, + contract: this.coin.contractAddress, + pageNum: this.pageNum, + pageSize: this.pageSize + } + if (this.type === 'send') { + params.fromAddress = this.coin.address; + } else if (this.type === 'receive') { + params.toAddress = this.coin.address + } + const response = await this.$api.getChainDataList(params) + if (response.data.rows.length == 0 ) { + this.isNoData=true; + if(this.pageNum == 1){ + this.showInfo = true; + } + + } else { + this.showInfo = false; + } + + this.trxs=this.trxs.concat(response.data.rows); + - getWalletInfo() { - var that = this - this.$dataUtil.transactionData(this.coin.type, this.type, this.coin.address, this.coin.contractAddress, - this.pageNum, this.pageSize, - function(data) { - console.log(data, 121211212112121) - if (data.length == 0) { - that.showInfo = true; - } else { - that.showInfo = false; - } - that.trxs = data - - }) } }, onLoad() { this.coin = uni.getStorageSync('coin'); this.change(0); - }, - - onReachBottom() { - this.pageSize += 5; - this.getWalletInfo() } + };