Browse Source

代码

master
Dread 4 years ago
parent
commit
19acff3d6e
  1. 2
      pages/menu/collection/index.vue
  2. 16
      pages/menu/sendToken/transfer/index.vue
  3. 11
      pages/menu/wallet/index.vue
  4. 6
      pages/menu/wallet/otherCoin/index.vue
  5. 322
      unpackage/dist/dev/app-plus/app-service.js
  6. 8
      utils/WalletUtil.js
  7. 3
      utils/api.js
  8. 8
      utils/axios.js

2
pages/menu/collection/index.vue

@ -124,7 +124,7 @@
}, },
goDetail2(itemm,index){ goDetail2(itemm,index){
uni.setStorageSync('proid',this.test.id) uni.setStorageSync('proid',this.test.id)
uni.setStorageSync('wallet',itemm) uni.setStorageSync('wallet',itemm)
uni.setStorageSync('walleti',itemm.address) uni.setStorageSync('walleti',itemm.address)
console.log(itemm,444) console.log(itemm,444)

16
pages/menu/sendToken/transfer/index.vue

@ -431,14 +431,14 @@
}).catch(err => { }).catch(err => {
console.log(err,'cuowu') console.log(err,'cuowu')
that.showFinger=false; that.showFinger=false;
that.showBottom=true; that.showBottom=true;
uni.showToast({ uni.showToast({
title: 'Transfer failed, please confirm the information is correct', title: 'Transfer failed, please confirm the information is correct',
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
}) })
// }else{ // }else{
// this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue,'',this.contractAddress ) // this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue,'',this.contractAddress )

11
pages/menu/wallet/index.vue

@ -120,10 +120,12 @@
methods: { methods: {
updateData() { updateData() {
let thar = this; let thar = this;
setTimeout( // setTimeout(
function() { // function() {
console.log(uni.getStorageSync('wallet'),'钱包');
thar.userObj = uni.getStorageSync('wallet'); thar.userObj = uni.getStorageSync('wallet');
thar.userObj2 = uni.getStorageSync('wallet'); thar.userObj2 = uni.getStorageSync('wallet');
// thar.userObj.address = thar.userObj.ellipsisAddress; // thar.userObj.address = thar.userObj.ellipsisAddress;
// thar.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25, // thar.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25,
@ -132,6 +134,7 @@
// thar.updateData(); // thar.updateData();
// }, 100); // }, 100);
thar.userObj.address = thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address thar.userObj.address = thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address
.substring(25, .substring(25,
thar.userObj.address.length); thar.userObj.address.length);
@ -139,7 +142,9 @@
if (!thar.isStop) { if (!thar.isStop) {
thar.updateData() thar.updateData()
} }
}, 10);
// }, 2000);
}, },

6
pages/menu/wallet/otherCoin/index.vue

@ -121,8 +121,7 @@
}; };
walletInfo[this.coinType][i].coinList.push(b) walletInfo[this.coinType][i].coinList.push(b)
console.log(walletInfo[this.coinType][i],22222) console.log(walletInfo[this.coinType][i],22222)
uni.setStorageSync('walletInfo',walletInfo) uni.setStorageSync('walletInfo',walletInfo)
uni.setStorageSync('wallet',walletInfo[this.coinType][i]) uni.setStorageSync('wallet',walletInfo[this.coinType][i])
} }
@ -137,8 +136,9 @@
// //
async getCoin(){ async getCoin(){
let params = { let params = {
chainName: this.coinType chainName: uni.getStorageSync('wallet').type
} }
console.log(params,888888888,this.coinType)
const response = await this.$api.getContractInfoList(params) const response = await this.$api.getContractInfoList(params)
this.coinInfo=response.data this.coinInfo=response.data

322
unpackage/dist/dev/app-plus/app-service.js

File diff suppressed because one or more lines are too long

8
utils/WalletUtil.js

@ -187,12 +187,13 @@ let WalletUtil = {
return walletList; return walletList;
}, },
selectWallet: function(type, address) { selectWallet: function(type, address) {
console.log('选择钱包')
uni.setStorageSync('walleti', address); uni.setStorageSync('walleti', address);
let walletInfo = uni.getStorageSync('walletInfo'); let walletInfo = uni.getStorageSync('walletInfo');
let walletList = walletInfo[type]; let walletList = walletInfo[type];
console.log() console.log()
for (var k = 0, length = walletList.length; k < length; k++) { for (var k = 0, length = walletList.length; k < length; k++) {
if (walletList[k].address === address) { if (walletList[k].address == address) {
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(25, walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(25,
address.length) address.length)
uni.setStorageSync('wallet', walletList[k]); uni.setStorageSync('wallet', walletList[k]);
@ -204,6 +205,7 @@ let WalletUtil = {
}, },
updateBalance:function() { updateBalance:function() {
const wallet = uni.getStorageSync('wallet'); const wallet = uni.getStorageSync('wallet');
console.log(wallet,'更新余额')
const walletInfo = uni.getStorageSync('walletInfo'); const walletInfo = uni.getStorageSync('walletInfo');
for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) { for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) {
if (walletInfo[wallet.type][k].address === wallet.address) { if (walletInfo[wallet.type][k].address === wallet.address) {
@ -217,6 +219,7 @@ let WalletUtil = {
that.getPrice('USDT',function(usdt){ that.getPrice('USDT',function(usdt){
switch (wallet.type) { switch (wallet.type) {
case 'BTC': case 'BTC':
console.log("进来BTC")
BtcUtil.getBalance(wallet.address,function(balance){ BtcUtil.getBalance(wallet.address,function(balance){
wallet.balance=balance; wallet.balance=balance;
wallet.balancePrice=(balance*rr).toFixed(2); wallet.balancePrice=(balance*rr).toFixed(2);
@ -226,6 +229,7 @@ let WalletUtil = {
}) })
break; break;
case 'ETH': case 'ETH':
console.log("进来ETH")
EthUtil.getBalance(wallet.address,function(balance){ EthUtil.getBalance(wallet.address,function(balance){
wallet.balance=balance; wallet.balance=balance;
wallet.balancePrice=(balance*rr).toFixed(2); wallet.balancePrice=(balance*rr).toFixed(2);
@ -243,7 +247,7 @@ let WalletUtil = {
break; break;
case 'TRX': case 'TRX':
console.log("进来TRX")
TronUtil.getTronBalance(wallet.address).then((res) => { TronUtil.getTronBalance(wallet.address).then((res) => {
wallet.balance=res; wallet.balance=res;
wallet.balancePrice=(res*rr).toFixed(2); wallet.balancePrice=(res*rr).toFixed(2);

3
utils/api.js

@ -7,8 +7,7 @@ const api = {
addNftCollection: (params) => Vue.prototype.$axios.post('/api/nft/addNftCollection', qs.stringify(params)), addNftCollection: (params) => Vue.prototype.$axios.post('/api/nft/addNftCollection', qs.stringify(params)),
getNftCollectionList: (params) => Vue.prototype.$axios.get('/api/nft/getNftCollectionList?' + qs.stringify( getNftCollectionList: (params) => Vue.prototype.$axios.get('/api/nft/getNftCollectionList?' + qs.stringify(
params)), params)),
getContractInfoList: (params) => Vue.prototype.$axios.get('/api/contract/getContractInfoList?' + qs.stringify( getContractInfoList: (params) => Vue.prototype.$axios.get('/api/contract/getContractInfoList?' + qs.stringify(params)),
params)),
//--------------------------------- free --------------------------------- //--------------------------------- free ---------------------------------
} }

8
utils/axios.js

@ -27,7 +27,8 @@ service.interceptors.request.use(
// config.url = baseURL.serverUrl + config.url // config.url = baseURL.serverUrl + config.url
// } // }
config.url = baseURL.serverUrl + config.url config.baseURL=baseURL.serverUrl
config.url = config.url
// if (token) { // if (token) {
// // config.headers['Authori-zation'] = token // // config.headers['Authori-zation'] = token
@ -76,17 +77,18 @@ axios.defaults.adapter = function(config) { //自己定义个适配器,用来
console.log(config,'我请求的') console.log(config,'我请求的')
var settle = require('axios/lib/core/settle'); var settle = require('axios/lib/core/settle');
var buildURL = require('axios/lib/helpers/buildURL'); var buildURL = require('axios/lib/helpers/buildURL');
uni.request({ uni.request({
method: config.method.toUpperCase(), method: config.method.toUpperCase(),
// url: buildURL(config.url, config.params, config.paramsSerializer),
url: config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer), url: config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer),
header: config.headers, header: config.headers,
data: config.data, data: config.data,
dataType: config.dataType, dataType: config.dataType,
responseType: config.responseType, responseType: config.responseType,
sslVerify: config.sslVerify, sslVerify: config.sslVerify,
complete: function complete(response) { complete: function complete(response) {
console.log("执行完成:",config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer),response.data) //console.log("执行完成:",config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer),response.data)
response = { response = {
data: response.data, data: response.data,
status: response.statusCode, status: response.statusCode,

Loading…
Cancel
Save