Browse Source

commit

main
mac 3 months ago
parent
commit
b5a78a5fa9
  1. 3
      .env
  2. 7
      env-temp
  3. 2
      package.json
  4. 1
      src/components/layout/Slider.tsx
  5. 2
      src/http/api.ts
  6. 2
      src/pages/record/bonus/index.tsx
  7. 18
      src/pages/transfer/index.tsx
  8. 97
      src/router/index.tsx
  9. 6
      src/store/index.ts
  10. 5
      src/types/index.ts

3
.env

@ -1,4 +1,3 @@
SKIP_PREFLIGHT_CHECK=true SKIP_PREFLIGHT_CHECK=true
GENERATE_SOURCEMAP=false GENERATE_SOURCEMAP=false
REACT_APP_BASEURL='https://matontrading.com'
REACT_APP_ORIGIN='https://matontrading.com'
REACT_APP_BASEURL='https://matontrading.com'

7
env-temp

@ -1,5 +1,4 @@
// prod
REACT_APP_BASEURL='https://matontrading.com' REACT_APP_BASEURL='https://matontrading.com'
REACT_APP_ORIGIN='https://matontrading.com'
REACT_APP_BASEURL='http://203.161.61.234:8082'
REACT_APP_ORIGIN='http://162.254.37.253:8086'
// dev
REACT_APP_BASEURL='http://203.161.61.234:8082'

2
package.json

@ -32,7 +32,7 @@
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"deploy": "npm run build && scp -r ./build/* dcfilefast_prod:/data/wwwroot/tarder",
"deploy:dev": "npm run build && scp -r ./build/* dcfilefast_prod:/data/wwwroot/tarder",
"deploy:prod": "npm run build && scp -r ./build/* metatrader_prod:/data/wwwroot/matontrading.com" "deploy:prod": "npm run build && scp -r ./build/* metatrader_prod:/data/wwwroot/matontrading.com"
}, },
"eslintConfig": { "eslintConfig": {

1
src/components/layout/Slider.tsx

@ -66,6 +66,7 @@ const Slider = () => {
<img src="https://cfile.uworkcrm.com/static/images/avtar.jpg" className="avatar" alt="" /> <img src="https://cfile.uworkcrm.com/static/images/avtar.jpg" className="avatar" alt="" />
</div> </div>
<div className="tac text-white mt-2">{userInfo.email}</div> <div className="tac text-white mt-2">{userInfo.email}</div>
<div className="text-white tac mt-1">[{userInfo.level}]</div>
<div className="row-center mt-1"> <div className="row-center mt-1">
<Button className="balance-button"> <Button className="balance-button">
<div> <div>

2
src/http/api.ts

@ -47,3 +47,5 @@ export const http_transferDeposit = (data: HttpRequestPs.TransferDeposit) => req
export const http_submit = (data: HttpRequestPs.Submit) => request({ url: '/v1/submitData', data }) export const http_submit = (data: HttpRequestPs.Submit) => request({ url: '/v1/submitData', data })
export const http_notify = () => request({ url: '/v1/message' })

2
src/pages/record/bonus/index.tsx

@ -28,7 +28,7 @@ const BonusRecords = () => {
{ label: '盈利分红', value: 2 }, { label: '盈利分红', value: 2 },
{ label: '超级奖励', value: 3 }, { label: '超级奖励', value: 3 },
{ label: '交易佣金', value: 4 }, { label: '交易佣金', value: 4 },
{ label: '星奖励', value: 5 },
{ label: '星奖励', value: 5 },
] ]
const searchConfigList = [ const searchConfigList = [

18
src/pages/transfer/index.tsx

@ -27,6 +27,7 @@ const Transfer = () => {
type type
}) })
if (res.code === 0) { if (res.code === 0) {
store.getUserInfo()
form.resetFields() form.resetFields()
notification.success({ notification.success({
message: '提交成功' message: '提交成功'
@ -56,10 +57,19 @@ const Transfer = () => {
> >
<Form.Item label={<span className='fz-wb-550'></span>}> <Form.Item label={<span className='fz-wb-550'></span>}>
<Select style={{ height: 50 }} placeholder="请选择操作类型..." options={options} onSelect={onSelect} /> <Select style={{ height: 50 }} placeholder="请选择操作类型..." options={options} onSelect={onSelect} />
<div>
<span className='fz-12 text-primary'></span>
<span className='fz-12 text-success'>${userInfo.account_balance}</span>
</div>
{
type < 3 ? (
<div>
<span className='fz-12 text-primary'></span>
<span className='fz-12 text-success'>${userInfo.balance}</span>
</div>
) : (
<div>
<span className='fz-12 text-primary'></span>
<span className='fz-12 text-success'>${userInfo.account_balance}</span>
</div>
)
}
</Form.Item> </Form.Item>
{ {

97
src/router/index.tsx

@ -5,14 +5,18 @@ import '../styles/app.scss'
import { useRouter } from "../hooks/useRouter"; import { useRouter } from "../hooks/useRouter";
import Slider from "../components/layout/Slider"; import Slider from "../components/layout/Slider";
import Header from "../components/layout/Header"; import Header from "../components/layout/Header";
import { useEffect, useRef } from "react";
import { useEffect, useRef, useState } from "react";
import { unLoginPath } from "./routes"; import { unLoginPath } from "./routes";
import { Divider, Modal } from "antd";
import { NotifyStatus_Type } from "../types";
import { http_notify } from "../http/api";
const LayoutRouter = () => { const LayoutRouter = () => {
const { push, location } = useRouter() const { push, location } = useRouter()
const [visible, setVisible] = useState(false)
const { token, screenWidth } = store.state const { token, screenWidth } = store.state
const [notifys, setNotifys] = useState([] as any)
// //
useEffect(() => { useEffect(() => {
@ -36,45 +40,78 @@ const LayoutRouter = () => {
} }
}, [location.pathname, token]) }, [location.pathname, token])
const isShowNotifyModal = async () => {
try {
const res: any = await http_notify()
if (res.code === 0) {
console.log(res);
setNotifys(res.data)
const type = window.localStorage.getItem('NotifyStatus') || NotifyStatus_Type.show
if (type === NotifyStatus_Type.show && res.data && res.data.length > 0) {
setVisible(true)
window.localStorage.setItem('NotifyStatus', NotifyStatus_Type.hidden)
}
}
} catch (error) {
}
}
useEffect(() => { useEffect(() => {
token && store.getUserInfo() token && store.getUserInfo()
token && store.getReceiveAccount() token && store.getReceiveAccount()
!token && store.resetUserInfo() !token && store.resetUserInfo()
!token && store.resetReceiveAccount() !token && store.resetReceiveAccount()
}, [token])
useEffect(() => {
window.addEventListener('message', (res) => {
if (res.origin === process.env.REACT_APP_ORIGIN) {
if (res && res.data && res.data.token) {
store.setToken(res.data.token)
if (!window.sessionStorage.getItem('first_render')) {
window.location.reload()
}
window.sessionStorage.setItem('first_render', 'true')
}
}
})
}, [])
if (token) {
isShowNotifyModal()
}
}, [token])
return ( return (
!token ? (
<RenderRouter />
) : (
<div className="layout">
<div className="container-header"></div>
<div className="container-aplication">
<>
{
!token ? (
<RenderRouter />
) : (
<div className="layout">
<div className="container-header"></div>
<div className="container-aplication">
{
screenWidth > 1000 && <Slider />
}
<div style={{ paddingLeft: screenWidth > 1000 ? 40 : 0, flex: 1 }}>
<Header />
<div className="divider"></div>
<RenderRouter />
</div>
</div>
</div>
)
}
<Modal
open={visible}
onCancel={() => setVisible(false)}
footer={() => null}
width={screenWidth > 1000 ? '60%' : '90%'}
title="平台公告"
>
<div style={{ minHeight: 300 }}>
{ {
screenWidth > 1000 && <Slider />
notifys.map((item: any) => (
<div key={item.id} className="mt-2">
<div className="fz-wb-550">{item.title}</div>
<div dangerouslySetInnerHTML={{ __html: item.content }} className="mt-1"></div>
<Divider />
</div>
))
} }
<div style={{ paddingLeft: screenWidth > 1000 ? 40 : 0, flex: 1 }}>
<Header />
<div className="divider"></div>
<RenderRouter />
</div>
</div> </div>
</div>
)
</Modal>
</>
) )
} }

6
src/store/index.ts

@ -1,5 +1,5 @@
import { makeAutoObservable } from "mobx"; import { makeAutoObservable } from "mobx";
import { Store } from "../types";
import { NotifyStatus_Type, Store } from "../types";
import { http_account, http_receiveAccount } from "../http/api"; import { http_account, http_receiveAccount } from "../http/api";
class AppStore { class AppStore {
@ -29,6 +29,10 @@ class AppStore {
setToken(_token: string) { setToken(_token: string) {
this.state.token = _token; this.state.token = _token;
window.localStorage.setItem('Tarder_Token', _token) window.localStorage.setItem('Tarder_Token', _token)
if (!_token) {
window.localStorage.setItem('NotifyStatus', NotifyStatus_Type.show)
}
} }
setScreenWidth(_width: number) { setScreenWidth(_width: number) {

5
src/types/index.ts

@ -14,6 +14,7 @@ export namespace Store {
name: string; name: string;
total_assets: string; total_assets: string;
total_income: string; total_income: string;
level: string
} }
export interface ReceiveAccount { export interface ReceiveAccount {
@ -25,3 +26,7 @@ export namespace Store {
} }
} }
export enum NotifyStatus_Type {
hidden = 'hidden',
show = 'show'
}
Loading…
Cancel
Save