Skip to content

Commit

Permalink
Merge pull request #131 from Ashuaidehao/dev-back
Browse files Browse the repository at this point in the history
fix transfer
  • Loading branch information
Ashuaidehao committed Aug 10, 2021
2 parents 7ab1ecd + 8b6065d commit d5a2cb6
Show file tree
Hide file tree
Showing 9 changed files with 566 additions and 628 deletions.
170 changes: 71 additions & 99 deletions neo3-gui/neo3-gui/ClientApp/src/components/Chain/asset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import {
Layout,
Expand All @@ -11,104 +11,76 @@ import {
Avatar,
} from "antd";
import Sync from "../sync";
import { withTranslation } from "react-i18next";
import { post } from "../../core/request";
import { withTranslation, useTranslation } from "react-i18next";
import { postAsync } from "../../core/request";
import "../../static/css/chain.css";

const { Content } = Layout;
export default function ChainAsset() {
const { Content } = Layout;
const { t } = useTranslation();
const [assetlist, setAssetList] = useState([]);

@withTranslation()
class Chainasset extends React.Component {
constructor(props) {
super(props);
this.state = {
assetlist: [],
};
}
componentDidMount() {
this.getAllblock();
}
getAllblock = () => {
var _this = this;
const { t } = this.props;
post("GetAllAssets", {})
.then((res) => {
var _data = res.data;
if (_data.msgType === -1) {
message.error(t("alert msg.no find"));
return;
}
_this.setState({ assetlist: _data.result });
})
.catch(function (error) {
console.log(error);
console.log("error");
});
};
render() {
const { t } = this.props;
const { assetlist } = this.state;
return (
<Layout className="gui-container">
<Sync />
<Content className="mt2 mb1">
<Row gutter={[30, 0]} style={{ minHeight: "calc( 100vh - 120px )" }}>
<Col span={24} className="bg-white pv4">
<PageHeader title={t("blockchain.assets")}></PageHeader>
<div>
<List
header={
<div>
<span>{t("blockchain.asset info")}</span>
<span className="float-r w-time ml3">
{t("blockchain.initial time")}
</span>
<span className="float-r">{t("blockchain.total")}</span>
</div>
}
itemLayout="horizontal"
dataSource={assetlist}
className="font-s"
renderItem={(item) => (
<List.Item>
<List.Item.Meta
avatar={
<Avatar
src={
"https://neo.org/images/gui/" +
item.asset +
".png"
}
/>
}
title={
<Link
className="asset-link w500 ellipsis"
to={"/chain/asset:" + item.asset}
title={t("show detail")}
>
<span className="w-symbol mr3">{item.symbol}</span>
{item.asset}
</Link>
}
/>
<Typography className="w-total">
{item.totalSupply ? item.totalSupply : "--"}
</Typography>
<Typography className="w-time ml3">
{item.createTime.substr(0, 10)}
</Typography>
</List.Item>
)}
/>
</div>
</Col>
</Row>
<div className="pv1"></div>
</Content>
</Layout>
);
}
}

export default Chainasset;
useEffect(() => {
postAsync("GetAllAssets", {}).then((data) => {
if (data.msgType < 0) {
message.error(t("alert msg.no find"));
return;
}
setAssetList(data.result);
}).catch(function (error) {
console.log(error);
});
});
return (
<Layout className="gui-container">
<Sync />
<Content className="mt2 mb1">
<Row gutter={[30, 0]} style={{ minHeight: "calc( 100vh - 120px )" }}>
<Col span={24} className="bg-white pv4">
<PageHeader title={t("blockchain.assets")}></PageHeader>
<div>
<List
header={
<div>
<span>{t("blockchain.asset info")}</span>
<span className="float-r w-time ml3">
{t("blockchain.initial time")}
</span>
<span className="float-r">{t("blockchain.total")}</span>
</div>
}
itemLayout="horizontal"
dataSource={assetlist}
className="font-s"
renderItem={(item) => (
<List.Item>
<List.Item.Meta
avatar={<Avatar src={"https://neo.org/images/gui/" + item.asset + ".png"} />}
title={
<Link
className="asset-link w500 ellipsis"
to={"/chain/asset:" + item.asset}
title={t("show detail")}
>
<span className="w-symbol mr3">{item.symbol}</span>
{item.asset}
</Link>
}
/>
<Typography className="w-total">
{item.totalSupply ? item.totalSupply : "--"}
</Typography>
<Typography className="w-time ml3">
{item.createTime.substr(0, 10)}
</Typography>
</List.Item>
)}
/>
</div>
</Col>
</Row>
<div className="pv1"></div>
</Content>
</Layout>
);
}
Loading

0 comments on commit d5a2cb6

Please sign in to comment.