Commit 1afb5004 authored by haiyoucuv's avatar haiyoucuv

Update DetailPage to fetch and display product information; change default...

Update DetailPage to fetch and display product information; change default page in App to DetailPage.
parent b1347c35
...@@ -30,7 +30,7 @@ class App extends Component { ...@@ -30,7 +30,7 @@ class App extends Component {
const defaultPage = { const defaultPage = {
myPrize: MyPrize, // TODO 举例子 新宿台奖品页 myPrize: MyPrize, // TODO 举例子 新宿台奖品页
index: LoadingDemo, index: LoadingDemo,
}[skinId] || RecordPage; }[skinId] || DetailPage;
PageCtrl.changePage(defaultPage); PageCtrl.changePage(defaultPage);
} }
......
...@@ -7,6 +7,7 @@ import MyPrize from '../MyPrize/MyPrize'; ...@@ -7,6 +7,7 @@ import MyPrize from '../MyPrize/MyPrize';
import { PageCtrl } from '@/core/ctrls/PageCtrl'; import { PageCtrl } from '@/core/ctrls/PageCtrl';
import { motion } from "motion/react" import { motion } from "motion/react"
import classNames from "classnames"; import classNames from "classnames";
import API from "@/api";
enum EOpType { enum EOpType {
Buy = "buy", Buy = "buy",
...@@ -17,13 +18,32 @@ enum EOpType { ...@@ -17,13 +18,32 @@ enum EOpType {
class DetailPage extends React.Component<any, any> { class DetailPage extends React.Component<any, any> {
state = { state = {
tabType: EOpType.Buy tabType: EOpType.Buy,
productName: "",
totalProfit: 0,
tranche: 0,
marketValue: 0,
yesterdayProfit: 0,
availableFunds: 0,
} }
async componentDidMount() { async componentDidMount() {
} }
async updateInfo() {
const { success, data } = await API.mncpIndex({ code: "213123", });
if (!success) return;
this.setState({
productName: data.productName,
totalProfit: data.totalProfit,
tranche: data.tranche,
marketValue: data.marketValue,
yesterdayProfit: data.yesterdayProfit,
availableFunds: data.availableFunds,
});
}
clickPrize = () => { clickPrize = () => {
PageCtrl.changePage(MyPrize); PageCtrl.changePage(MyPrize);
} }
...@@ -36,14 +56,14 @@ class DetailPage extends React.Component<any, any> { ...@@ -36,14 +56,14 @@ class DetailPage extends React.Component<any, any> {
} }
render() { render() {
const { tabType } = this.state; const { tabType, productName, totalProfit, tranche, marketValue, yesterdayProfit, availableFunds } = this.state;
const testUrl = "https://mobile.hxwm.com.cn/hxlch5/VUE/#/fund-detail-nobuy?fundcode=1912121000101&from=third"; const testUrl = "https://mobile.hxwm.com.cn/hxlch5/VUE/#/fund-detail-nobuy?fundcode=1912121000101&from=third";
const isBuy = tabType == EOpType.Buy; const isBuy = tabType == EOpType.Buy;
return <div className={styles.DetailPage}> return <div className={styles.DetailPage}>
<iframe className={styles.prodIframe} src={testUrl}/> <iframe className={styles.prodIframe} src={testUrl} />
<motion.div <motion.div
className={styles.options} className={styles.options}
...@@ -73,7 +93,7 @@ class DetailPage extends React.Component<any, any> { ...@@ -73,7 +93,7 @@ class DetailPage extends React.Component<any, any> {
> >
<div className={styles.buyInfo}> <div className={styles.buyInfo}>
<div>买入金额</div> <div>买入金额</div>
<span>可用资金:100000000</span> <span>可用资金:{availableFunds / 100}</span>
</div> </div>
<input <input
className={styles.bugInput} className={styles.bugInput}
...@@ -90,7 +110,7 @@ class DetailPage extends React.Component<any, any> { ...@@ -90,7 +110,7 @@ class DetailPage extends React.Component<any, any> {
> >
<div className={styles.sellInfo}> <div className={styles.sellInfo}>
<div>赎回份额</div> <div>赎回份额</div>
<span>持有份额:0</span> <span>持有份额:{tranche / 100}</span>
</div> </div>
<div className={styles.sellInput}> <div className={styles.sellInput}>
<input <input
......
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