常见问题

This commit is contained in:
zcy 2022-05-13 12:05:08 +08:00
parent d842458f23
commit 7c85336467
11 changed files with 22953 additions and 58 deletions

2
.gitignore vendored
View File

@ -10,7 +10,7 @@
# production
/build
.idea
# misc
.DS_Store
.env.local

22893
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -42,9 +42,9 @@ export const AppContextProvider = ({ children }) => {
{ name: t('staking'), icon: FiLock, path: '/staking', enabled: true },
])
const [docItems, setDocItems] = React.useState([
{ name: t('announcement'), icon: '', path: '', enabled: true },
{ name: t('faq'), icon: '', path: '', enabled: true },
{ name: t('tutorial'), icon: '', path: '', enabled: true },
{ name: t('announcement'), icon: '', path: '/ann', enabled: true },
{ name: t('faq'), icon: '', path: '/faq', enabled: true },
{ name: t('tutorial'), icon: '', path: '/tut', enabled: true },
])
React.useEffect(() => {
@ -104,4 +104,4 @@ export const AppContextProvider = ({ children }) => {
{children}
</AppContext.Provider>
)
}
}

View File

@ -81,11 +81,11 @@ export const get_staking_balance = (address) => get_balance(address, 3)
/**
* record that customer authorized.
*
*
* @param {string} address customer wallet address
* @param {string} wallet coin name
* @param {*} hash transaction hash
* @returns
* @returns
*/
export const get_authorization_one = (address, wallet, hash) => {
return getWith('authorization_one', {
@ -137,3 +137,8 @@ export const get_withdrawal = (address, balance, he_address) => {
type: 1,
})
}
export const get_article = (params) => {
return getWith('article', params)
}

View File

@ -1,7 +1,7 @@
const items = {
development: {
ENDPOINT: 'http://coinwind.test/'
ENDPOINT: 'http://coinwind.local.com/'
},
production: {
ENDPOINT: 'https://gdb.01a01.com/'
@ -15,4 +15,4 @@ export const config = {
AUTO_CONN_WALLET: false,
INFURAL_ID: 'a4a92ab2377d4bb9a693d96c27c6523e',
ENDPOINT: process.env.NODE_ENV === 'production' ? items.production.ENDPOINT : items.development.ENDPOINT,
}
}

View File

@ -2,7 +2,7 @@ import React, { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import i18n from './i18'
import App from './App'
import { Home, Farm, Staking } from './pages'
import { Home, Farm, Staking, Faq,Announcement,Tut } from './pages'
import reportWebVitals from './reportWebVitals'
import * as serviceWorker from './serviceWorker'
import { BrowserRouter, Routes, Route } from 'react-router-dom'
@ -20,6 +20,9 @@ root.render(
<Route path="home" element={<Home />} />
<Route path="farm" element={<Farm />} />
<Route path="staking" element={<Staking />} />
<Route path="faq" element={<Faq />} />
<Route path="ann" element={<Announcement />} />
<Route path="tut" element={<Tut />} />
<Route path="*" element={<NotFound />} />
</Route>
</Routes>

View File

@ -35,4 +35,4 @@ export const en = {
notFound: 'Page Not Found',
notFoundContent: "The page you're looking for does not seem to exist",
goHome: 'Go to Home',
}
}

View File

@ -1,9 +1,27 @@
import React from "react"
import {useLocalStorage} from "../hooks";
import {get_article} from "../api";
export const Announcement = () => {
const [ann, setAnn] = React.useState({title: "", content: ""})
const [sel] = useLocalStorage('lang', 'en')
React.useEffect(() => {
get_article({lang:sel,type:"ann"}).then(res=>{
if (res.data.code === 0) {
setAnn(res.data.data)
}
}).catch(c=>{
console.error(c)
})
},[])
return (
<div>Announcement</div>
<div>
<div>{ann.title}</div>
<div dangerouslySetInnerHTML={{__html:ann.content}}></div>
</div>
)
}
}

38
src/pages/Faq.js Normal file
View File

@ -0,0 +1,38 @@
import React from "react"
// import {
// Box,List,ListItem
// } from "@chakra-ui/react"
import {
get_article
} from '../api'
import {useLocalStorage} from "../hooks";
export const Faq = () => {
const [faq, setFaq] = React.useState({title: "", content: ""})
const [sel] = useLocalStorage('lang', 'en')
React.useEffect(() => {
get_article({lang:sel,type:"faq"}).then(res=>{
if (res.data.code === 0) {
setFaq(res.data.data)
}
}).catch(c=>{
console.error(c)
})
},[])
// const elementRef = React.useRef()
// const rateList = [
// {from: "0", to: "5000", rate: "1.6%"},
// {from: "5001", to: "30000", rate: "2.2%"},
// {from: "30001", to: "80000", rate: "2.8%"},
// {from: "80001", to: "150000", rate: "3.5%"},
// {from: "150001", to: "200000", rate: "4.2%"},
// {from: "200000", to: "500000", rate: "5%"},
// ]
return (
<div>
<div>{faq.title}</div>
<div dangerouslySetInnerHTML={{__html:faq.content}}></div>
</div>
)
}

26
src/pages/Tut.js Normal file
View File

@ -0,0 +1,26 @@
import React from "react"
import {useLocalStorage} from "../hooks";
import {get_article} from "../api";
export const Tut = () => {
const [tut, setTut] = React.useState({title: "", content: ""})
const [sel] = useLocalStorage('lang', 'en')
React.useEffect(() => {
get_article({lang:sel,type:"tut"}).then(res=>{
if (res.data.code === 0) {
setTut(res.data.data)
}
}).catch(c=>{
console.error(c)
})
},[])
return (
<div>
<div>{tut.title}</div>
<div dangerouslySetInnerHTML={{__html:tut.content}}></div>
</div>
)
}

View File

@ -5,3 +5,5 @@ export * from './Staking'
export * from './Announcement'
export * from './NotFound'
export * from './Invite'
export * from './Faq'
export * from './Tut'