upup

parent 25249cdf
...@@ -15,6 +15,18 @@ class App extends Component { ...@@ -15,6 +15,18 @@ class App extends Component {
requestDuration: -100, requestDuration: -100,
startText:'', startText:'',
endText:'', endText:'',
value:0,
getValue:0,
}
inputChange=(e)=>{
this.setState({
value:e.target.value
})
}
getInput=()=>{
this.setState({
getValue:this.state.value
})
} }
componentDidMount(){ componentDidMount(){
let that = this let that = this
...@@ -56,7 +68,8 @@ class App extends Component { ...@@ -56,7 +68,8 @@ class App extends Component {
that.initChart(resData) that.initChart(resData)
if(!that.interval){ if(!that.interval){
that.interval = setInterval(() => { that.interval = setInterval(() => {
fetch(`/api/graph_by_height_and_duration?height=0&duration=${that.state.requestDuration}`,{ // fetch(`/api/graph_by_height_and_duration?height=0&duration=${that.state.requestDuration}`,{
fetch(`/api/graph_by_height_and_duration?height=${this.state.getValue}&duration=${that.state.requestDuration}`,{
method:'GET', method:'GET',
headers:{ headers:{
'Content-Type':'application/json;charset=UTF-8' 'Content-Type':'application/json;charset=UTF-8'
...@@ -84,6 +97,7 @@ class App extends Component { ...@@ -84,6 +97,7 @@ class App extends Component {
} }
var chartDom = document.getElementById('main'); var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom); var myChart = echarts.init(chartDom);
myChart.on('datazoom', function(params){ myChart.on('datazoom', function(params){
clearInterval(that.interval) clearInterval(that.interval)
var options = myChart.getOption(); var options = myChart.getOption();
...@@ -604,13 +618,22 @@ class App extends Component { ...@@ -604,13 +618,22 @@ class App extends Component {
render() { render() {
const {startText,endText}=this.state const {startText,endText}=this.state
return ( return (
<div> // <div>
<div id="main" className="container" style={{position:'relative', padding: '50px', boxSizing:'border-box', width: '100%', height: 900 }}> // <div id="main" className="container" style={{position:'relative', padding: '50px', boxSizing:'border-box', width: '100%', height: 900 }}>
</div> // </div>
<div style={{position:'absolute',left:'1%',top:'70%',fontSize:'12px',color:'#80828a'}}>{startText}</div> // <div style={{position:'absolute',left:'1%',top:'70%',fontSize:'12px',color:'#80828a'}}>{startText}</div>
<div style={{position:'absolute',right:'5%',top:'70%',fontSize:'12px',color:'#80828a'}}>{endText}</div> // <div style={{position:'absolute',right:'5%',top:'70%',fontSize:'12px',color:'#80828a'}}>{endText}</div>
</div> // </div>
<div>
<div>
<div id="main" className="container" style={{position:'relative', padding: '50px', boxSizing:'border-box', width: '100%', height: 900 }}> </div>
<div style={{position:'absolute',left:'1%',top:'70%',fontSize:'12px',color:'#80828a'}}>{startText}</div>
<div style={{position:'absolute',right:'5%',top:'70%',fontSize:'12px',color:'#80828a'}}>{endText}</div>
</div>
<input value={this.state.value} onChange={this.inputChange} style={{width:'10%',marginLeft:'5%'}}/>
<button onClick={this.getInput}>Click</button>
</div>
); );
} }
} }
......
...@@ -6,9 +6,10 @@ import reportWebVitals from './reportWebVitals'; ...@@ -6,9 +6,10 @@ import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root')); const root = ReactDOM.createRoot(document.getElementById('root'));
root.render( root.render(
<React.StrictMode> // <React.StrictMode>
<App /> // <App />
</React.StrictMode> // </React.StrictMode>
<App />
); );
// If you want to start measuring performance in your app, pass a function // If you want to start measuring performance in your app, pass a function
......
...@@ -2,7 +2,8 @@ const { createProxyMiddleware } = require('http-proxy-middleware'); ...@@ -2,7 +2,8 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) { module.exports = function (app) {
app.use(createProxyMiddleware('/api', app.use(createProxyMiddleware('/api',
{ {
"target": "http://54.168.125.67:26657", // "target": "http://54.168.125.67:26657",
"target":'http://15.161.127.241:30001',
// "target": "http://3.9.177.160:50080", // "target": "http://3.9.177.160:50080",
"changeOrigin": true, "changeOrigin": true,
"pathRewrite": { "pathRewrite": {
......
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