Commit a9627295 authored by wenglk's avatar wenglk

地址转小写

parent bdbe3b53
This diff is collapsed.
This diff is collapsed.
...@@ -3,92 +3,98 @@ import QRCode from "qrcode"; ...@@ -3,92 +3,98 @@ import QRCode from "qrcode";
import { getAddressTxCount } from "@/service/api"; import { getAddressTxCount } from "@/service/api";
import Rpc from "@/utils/Rpc"; import Rpc from "@/utils/Rpc";
export default Vue.extend({ export default Vue.extend({
data() { data() {
return { return {
txCount: 0, txCount: 0,
receive: 0, receive: 0,
send: 0, send: 0,
value: 0, value: 0,
}; };
},
watch: {
"$route.query.address"() {
this.getAddrOverview();
this.init();
getAddressTxCount(this.$route.query.address as string).then((ret) => {
if (ret.error === null) {
this.txCount = ret.result;
}
});
}, },
}, watch: {
mounted() { "$route.query.address"() {
this.getAddrOverview(); this.getAddrOverview();
this.init(); this.init();
getAddressTxCount(this.$route.query.address as string).then((ret) => { getAddressTxCount(
if (ret.error === null) { (this.$route.query.address as string).toLowerCase()
this.txCount = ret.result; ).then((ret) => {
} if (ret.error === null) {
}); this.txCount = ret.result;
}, }
computed: { });
tradeInTotalList(): { name: string; value: number }[] {
return [
// {
// name: this.$t("lang.address.totalReception") as string,
// value: this.receive,
// },
// {
// name: this.$t("lang.address.totalSent") as string,
// value: this.send,
// },
{
name: this.$t("lang.address.totalValue") as string,
value: this.value,
}, },
{ },
name: this.$t("lang.block.txCount") as string, mounted() {
value: this.txCount, this.getAddrOverview();
this.init();
getAddressTxCount(
(this.$route.query.address as string).toLowerCase()
).then((ret) => {
if (ret.error === null) {
this.txCount = ret.result;
}
});
},
computed: {
tradeInTotalList(): { name: string; value: number }[] {
return [
// {
// name: this.$t("lang.address.totalReception") as string,
// value: this.receive,
// },
// {
// name: this.$t("lang.address.totalSent") as string,
// value: this.send,
// },
{
name: this.$t("lang.address.totalValue") as string,
value: this.value,
},
{
name: this.$t("lang.block.txCount") as string,
value: this.txCount,
},
];
}, },
];
}, },
}, methods: {
methods: { getAddrOverview() {
getAddrOverview() { Rpc.getAddrOverview(
Rpc.getAddrOverview(this.$route.query.address as string).then((res) => { (this.$route.query.address as string).toLowerCase()
if (res.error === null) { ).then((res) => {
const balance = res.result.balance; if (res.error === null) {
const receiver = res.result.reciver; const balance = res.result.balance;
this.receive = receiver; const receiver = res.result.reciver;
this.send = receiver - balance; this.receive = receiver;
this.send = receiver - balance;
fetch("/market") fetch("/market")
.then((ret) => ret.json()) .then((ret) => ret.json())
.then((ret) => { .then((ret) => {
if (ret.msg === "succeed") { if (ret.msg === "succeed") {
const data = ret.data.data.USDT.YCC; const data = ret.data.data.USDT.YCC;
this.value = data.last * balance; this.value = data.last * balance;
} }
});
}
}); });
}
});
},
init() {
QRCode.toCanvas(
document.getElementById("qrcode"),
this.$route.query.address as string,
{
color: {
dark: "#1F3470",
light: "#0000",
},
width: 130,
margin: 0,
}, },
function (error) { init() {
if (error) console.error(error); QRCode.toCanvas(
} document.getElementById("qrcode"),
); (this.$route.query.address as string).toLowerCase(),
{
color: {
dark: "#1F3470",
light: "#0000",
},
width: 130,
margin: 0,
},
function(error) {
if (error) console.error(error);
}
);
},
}, },
},
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment