feat:打包使用绝对地址,清理不使用模块
This commit is contained in:
parent
bb123ae514
commit
e24e50f68e
craco.config.jsmain.jspackage.json
src
components/HistoryRecord
echarts
pages
routes
utils/Api
|
@ -1,5 +1,6 @@
|
|||
const CracoLessPlugin = require('craco-less');
|
||||
|
||||
const HtmlWebpackPlugin=require('html-webpack-plugin')
|
||||
const path = require('path');
|
||||
module.exports = {
|
||||
plugins: [
|
||||
{
|
||||
|
@ -14,4 +15,15 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
webpack: {
|
||||
configure: (webpackConfig, { env, paths }) => {
|
||||
// 修改output.publicPath为'./'
|
||||
// webpackConfig.output.publicPath = './';
|
||||
webpackConfig.output.path = path.join(__dirname,);
|
||||
webpackConfig.output.publicPath = path.join(__dirname,path.sep);
|
||||
return webpackConfig;
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
|
4
main.js
4
main.js
|
@ -16,8 +16,8 @@ const createWindow = () => {
|
|||
}
|
||||
})
|
||||
// 加载 index.html
|
||||
// win.loadFile('./public/index.html')
|
||||
win.loadURL('http://localhost:3000')
|
||||
win.loadFile('./index.html')
|
||||
// win.loadURL('http://localhost:3000')
|
||||
// 打开开发工具
|
||||
win.webContents.openDevTools()
|
||||
// let okPush =false
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
"concurrently": "^4.1.1",
|
||||
"craco-less": "^2.0.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"echarts": "^5.4.1",
|
||||
"echarts-for-react": "^3.0.2",
|
||||
"electron": "^22.1.0",
|
||||
"formik": "^2.2.9",
|
||||
"lexical": "^0.12.6",
|
||||
|
@ -48,6 +46,8 @@
|
|||
"scripts": {
|
||||
"dev": "concurrently \"wait-on http://localhost:3000 && electron-forge start\" \"cross-env BROWSER=none npm start\"",
|
||||
"start": "craco start",
|
||||
"build": "craco build",
|
||||
"startel": "electron .",
|
||||
"package": "electron-forge package",
|
||||
"make": "electron-forge make"
|
||||
},
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Button, Dropdown, Space, Tag, message } from 'antd';
|
||||
import { useRef, useState } from 'react';
|
||||
import { assemblyRequest } from '../../utils/Assembly';
|
||||
import { useSelector, useDispatch } from 'react-redux'
|
||||
import { historyRecordSearch } from '../../redux/historyRecord_reducer';
|
||||
import { getHistoryRecord1 } from '../../utils/Api/Ticai';
|
||||
const columns = [
|
||||
{
|
||||
title: '期号',
|
||||
dataIndex: 'issue',
|
||||
},
|
||||
{
|
||||
title: '开奖日期',
|
||||
key: 'showTime',
|
||||
dataIndex: 'openTime',
|
||||
valueType: 'date',
|
||||
sorter: true,
|
||||
defaultSortOrder: 'descend',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
disable: true,
|
||||
title: '前区',
|
||||
dataIndex: 'frontWinningNum',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
disable: true,
|
||||
title: '后区',
|
||||
dataIndex: 'backWinningNum',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
disable: true,
|
||||
title: '原始前区',
|
||||
dataIndex: 'seqFrontWinningNum',
|
||||
search: false,
|
||||
|
||||
},
|
||||
{
|
||||
disable: true,
|
||||
title: '原始后区',
|
||||
dataIndex: 'seqBackWinningNum',
|
||||
search: false,
|
||||
}
|
||||
];
|
||||
// 数据存入redux中,同步成功后更新redux中数据,默认增加条数和内容。
|
||||
const HistoryReocrd = () => {
|
||||
const actionRef = useRef();
|
||||
const [pageSize, setPageSize] = useState(5);
|
||||
// const historyRecordData = useSelector(state => state.historyRecord.data)
|
||||
// const dispatch = useDispatch()
|
||||
// console.log("useSelector(state => state.history.data)", historyRecordData)
|
||||
// if (historyRecordData && historyRecordData.length > 0) {
|
||||
// // actionRef.current.reload()
|
||||
// }
|
||||
return (
|
||||
<ProTable
|
||||
columns={columns}
|
||||
actionRef={actionRef}
|
||||
cardBordered
|
||||
request={async (params, sort, filter) => {
|
||||
const data = assemblyRequest(sort, filter, params)
|
||||
return getHistoryRecord1(data).then((response) => {
|
||||
console.log('respond', response)
|
||||
response = response.data
|
||||
// response 响应体数据
|
||||
if (response.status.code === 200) {
|
||||
// dispatch(historyRecordSearch(response.data.content))
|
||||
return {
|
||||
data: response.data.content,
|
||||
// success 请返回 true,
|
||||
// 不然 table 会停止解析数据,即使有数据
|
||||
success: true,
|
||||
// 不传会使用 data 的长度,如果是分页一定要传
|
||||
total: response.data.totalElements,
|
||||
}
|
||||
} else {
|
||||
message.error(response.status.message)
|
||||
}
|
||||
}).catch( (error)=> {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
editable={{
|
||||
type: 'multiple',
|
||||
}}
|
||||
// columnsState={{
|
||||
// persistenceKey: 'pro-table-singe-demos',
|
||||
// persistenceType: 'localStorage',
|
||||
// onChange(value) {
|
||||
// console.log('value123: ', value);
|
||||
// },
|
||||
// }}
|
||||
rowKey="id"
|
||||
search={{
|
||||
labelWidth: 'auto',
|
||||
}}
|
||||
options={{
|
||||
setting: {
|
||||
listsHeight: 400,
|
||||
},
|
||||
}}
|
||||
form={{
|
||||
// 由于配置了 transform,提交的参与与定义的不同这里需要转化一下
|
||||
syncToUrl: (values, type) => {
|
||||
if (type === 'get') {
|
||||
return {
|
||||
...values,
|
||||
created_at: [values.startTime, values.endTime],
|
||||
};
|
||||
}
|
||||
return values;
|
||||
},
|
||||
}}
|
||||
pagination={{
|
||||
pageSize,
|
||||
onChange: (page) => setPageSize(page.pageSize),
|
||||
}}
|
||||
dateFormatter="string"
|
||||
headerTitle="历史开奖"
|
||||
toolBarRender={() => [
|
||||
<Dropdown
|
||||
key="menu"
|
||||
menu={{
|
||||
items: [
|
||||
{
|
||||
label: '1st item',
|
||||
key: '3',
|
||||
},
|
||||
{
|
||||
label: '2nd item',
|
||||
key: '2',
|
||||
},
|
||||
{
|
||||
label: '3rd item',
|
||||
key: '1',
|
||||
},
|
||||
],
|
||||
}}
|
||||
>
|
||||
<Button>
|
||||
<EllipsisOutlined />
|
||||
</Button>
|
||||
</Dropdown>,
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default HistoryReocrd
|
|
@ -1,391 +0,0 @@
|
|||
import React, { useState, useEffect, Component } from 'react'
|
||||
import ReactECharts from 'echarts-for-react';
|
||||
import axios from 'axios';
|
||||
import { Button, message } from 'antd';
|
||||
|
||||
// class BackCounte extends Component {
|
||||
|
||||
// constructor(props) {
|
||||
// super(props)
|
||||
// this.state = {
|
||||
// flag: true
|
||||
|
||||
// }
|
||||
// this.echartsReact = React.createRef()
|
||||
// this.echartsReact1 = React.createRef()
|
||||
// console.log(this.echartsReact)
|
||||
// }
|
||||
|
||||
// getOption() {
|
||||
// return {
|
||||
|
||||
// color: ['#0095ff', '#33e0e0', '#4bc772', '#fcd132', '#ff607a'],
|
||||
// tooltip: {
|
||||
// trigger: 'item',
|
||||
// formatter: '{b} : {c} ({d}%)'
|
||||
// },
|
||||
|
||||
// legend: {
|
||||
// orient: 'horizontal',
|
||||
// bottom: 0,
|
||||
// itemWidth: 15,
|
||||
// itemHeight: 10
|
||||
// },
|
||||
// grid: {
|
||||
// left: '3%',
|
||||
// right: '4%',
|
||||
// bottom: '0',
|
||||
// top: '3%',
|
||||
// containLabel: true
|
||||
// },
|
||||
// // 圆中心的数字
|
||||
// graphic: {
|
||||
// elements: [
|
||||
// {
|
||||
// type: 'text',
|
||||
// left: 'center',
|
||||
// top: '46%',
|
||||
// z: 2,
|
||||
// zlevel: 100,
|
||||
// style: {
|
||||
// text: '120',
|
||||
// fill: '#1890ff',
|
||||
// width: 100,
|
||||
// height: 30,
|
||||
// font: 'bolder 28px Microsoft YaHei'
|
||||
// }
|
||||
|
||||
// }
|
||||
// ]
|
||||
|
||||
// },
|
||||
// // 圆中心的数字
|
||||
// // title: {
|
||||
// // text: '总考生数',
|
||||
// // left: 'center',
|
||||
// // top: '45%',
|
||||
// // textStyle: {
|
||||
// // color: '#031f2d',
|
||||
// // fontSize: 20,
|
||||
// // align: 'center'
|
||||
// // }
|
||||
// // },
|
||||
// series: [
|
||||
// {
|
||||
// name: '',
|
||||
// type: 'pie',
|
||||
// radius: ['50%', '70%'],
|
||||
// center: ['50%', '50%'],
|
||||
// legendHoverLink: false,
|
||||
// data: [
|
||||
// { value: 32, name: '水库' },
|
||||
// { value: 42, name: '河道断面' },
|
||||
// { value: 32, name: '水文测站' },
|
||||
// { value: 32, name: '灌区' },
|
||||
// { value: 32, name: '水土保持工程' }
|
||||
// ],
|
||||
// itemStyle: {
|
||||
// emphasis: {
|
||||
// shadowBlur: 0,
|
||||
// shadowOffsetX: 0,
|
||||
// shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
// }
|
||||
// },
|
||||
|
||||
// label: {
|
||||
// normal: {
|
||||
// show: false,
|
||||
// position: 'center'
|
||||
// },
|
||||
// emphasis: {
|
||||
// show: true,
|
||||
// textStyle: {
|
||||
// fontSize: '16',
|
||||
// fontWeight: 'bold'
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// onChartover() {
|
||||
// // 当鼠标移到扇形图上数字清空
|
||||
// this.echartsReact.props.option.graphic.elements[0].style.text = ''
|
||||
|
||||
// this.echartsReact.getEchartsInstance().setOption(this.echartsReact.props.option)
|
||||
// console.log(this.echartsReact.getEchartsInstance())
|
||||
|
||||
// }
|
||||
// onChartout() {
|
||||
// // 当鼠标移到扇形图上数字出现
|
||||
// this.echartsReact.props.option.graphic.elements[0].style.text = '120'
|
||||
// this.echartsReact.getEchartsInstance().setOption(this.echartsReact.props.option) // 重新渲染
|
||||
|
||||
// }
|
||||
|
||||
// getOptions1() {
|
||||
// const numberData = []
|
||||
// const quantityData = []
|
||||
// axios.get("/ticai/probability/back").then(response=> {
|
||||
// const result = response.data;
|
||||
// if (result.status.code === 200) {
|
||||
// result.data.forEach(numberVO => {
|
||||
// numberData.push(numberVO.number)
|
||||
// quantityData.push(numberVO.quantity)
|
||||
// })
|
||||
// console.log(".series.data[0] = 1")
|
||||
// this.echartsReact1.props.option.series.data[1] = '1'
|
||||
// this.echartsReact1.getEchartsInstance().setOption(this.echartsReact1.props.option)
|
||||
// console.log(this.echartsReact1.getEchartsInstance())
|
||||
// // this.state.option.xAxis.data=numberData
|
||||
// // this.state.option.series.data=quantityData
|
||||
// // console.log(this.echartsReact.props.option.xAxis.data)
|
||||
// //this.echartsReact.props.option.series.data = quantityData
|
||||
// // this.echartsReact.getEchartsInstance().setOption(this.echartsReact.props.option)
|
||||
// // console.log("this.echartsReact.getEchartsInstance()")
|
||||
// } else {
|
||||
// message.error(result.status.message)
|
||||
// }
|
||||
// }).catch(function (error) {
|
||||
// message.error(error)
|
||||
// })
|
||||
// }
|
||||
|
||||
// render() {
|
||||
|
||||
// const onEvents = {
|
||||
// 'mouseover': this.onChartover.bind(this),
|
||||
// 'mouseout': this.onChartout.bind(this)
|
||||
// }
|
||||
// const option = {
|
||||
// title: {
|
||||
// text: 'ECharts 入门示例'
|
||||
// },
|
||||
// toolbox: {
|
||||
// feature: {
|
||||
// saveAsImage: {},
|
||||
// dataZoom: {},
|
||||
// restore: {}
|
||||
// }
|
||||
// },
|
||||
// tooltip: {},
|
||||
// legend: {
|
||||
// data: ['销量']
|
||||
// },
|
||||
// xAxis: {
|
||||
// data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
|
||||
// },
|
||||
// yAxis: {},
|
||||
// series: [{
|
||||
// name: '销量',
|
||||
// type: 'line',
|
||||
// data: [5, 20, 36, 10, 10, 20]
|
||||
// }]
|
||||
// };
|
||||
// return (
|
||||
// <React.Fragment>
|
||||
// <ReactECharts ref={(e) => { this.echartsReact = e }}
|
||||
// option={this.getOption()}
|
||||
// onEvents={onEvents}
|
||||
|
||||
// style={{ width: '100%', height: '253px' }}
|
||||
// />
|
||||
// <Index onClick={this.getOptions1}>更新</Index>
|
||||
// <ReactECharts ref={(e) => { this.echartsReact1 = e }} option={option} style={{ height: 400 }} opts={{ locale: 'FR' }} />
|
||||
// </React.Fragment>
|
||||
|
||||
// )
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// constructor(props) {
|
||||
// super(props)
|
||||
// this.echartsReact = React.createRef()
|
||||
// console.log(this.echartsReact)
|
||||
// }
|
||||
|
||||
// componentWillMount() {
|
||||
// const numberData = []
|
||||
// const quantityData = []
|
||||
// axios.get("/ticai/probability/back").then(function (response) {
|
||||
// const result = response.data;
|
||||
// if (result.status.code === 200) {
|
||||
// result.data.forEach(numberVO => {
|
||||
// numberData.push(numberVO.number)
|
||||
// quantityData.push(numberVO.quantity)
|
||||
// })
|
||||
// console.log("wilmount", ...this.echartsReact)
|
||||
// // this.state.option.xAxis.data=numberData
|
||||
// // this.state.option.series.data=quantityData
|
||||
// // console.log(this.echartsReact.props.option.xAxis.data)
|
||||
// //this.echartsReact.props.option.series.data = quantityData
|
||||
// // this.echartsReact.getEchartsInstance().setOption(this.echartsReact.props.option)
|
||||
// // console.log("this.echartsReact.getEchartsInstance()")
|
||||
// } else {
|
||||
// message.error(result.status.message)
|
||||
// }
|
||||
// }).catch(function (error) {
|
||||
// message.error(error)
|
||||
// })
|
||||
// // console.log("end",option)
|
||||
// }
|
||||
// getOptions() {
|
||||
// console.log("this.echartsReact.current")
|
||||
// console.log(this.echartsReact)
|
||||
// console.log(this.echartsReact.current)
|
||||
// }
|
||||
|
||||
// render() {
|
||||
// const option = {
|
||||
// title: {
|
||||
// text: 'ECharts 入门示例'
|
||||
// },
|
||||
// toolbox: {
|
||||
// feature: {
|
||||
// saveAsImage: {},
|
||||
// dataZoom: {},
|
||||
// restore: {}
|
||||
// }
|
||||
// },
|
||||
// tooltip: {},
|
||||
// legend: {
|
||||
// data: ['销量']
|
||||
// },
|
||||
// xAxis: {
|
||||
// data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
|
||||
// },
|
||||
// yAxis: {},
|
||||
// series: [{
|
||||
// name: '销量',
|
||||
// type: 'line',
|
||||
// data: [5, 20, 36, 10, 10, 20]
|
||||
// }]
|
||||
// };
|
||||
// return(
|
||||
// <>
|
||||
// <Index onClick={this.getOptions}>更新</Index>
|
||||
// <ReactECharts ref={(e) => { this.echartsReact = e }} option={option} style={{ height: 400 }} opts={{ locale: 'FR' }} />
|
||||
// </>)
|
||||
|
||||
// }
|
||||
|
||||
// };
|
||||
// export default BackCounte;
|
||||
|
||||
export default class BackCounte extends Component {
|
||||
|
||||
constructor(props){
|
||||
super(props)
|
||||
// this.echartsReact = React.createRef()
|
||||
}
|
||||
|
||||
// componentWillMount(){
|
||||
// const numberData = []
|
||||
// const quantityData = []
|
||||
// axios.get("/ticai/probability/back").then(function(response){
|
||||
// const result = response.data;
|
||||
// if (result.status.code === 200) {
|
||||
// result.data.forEach(numberVO => {
|
||||
// numberData.push(numberVO.number)
|
||||
// quantityData.push(numberVO.quantity)
|
||||
// })
|
||||
// this.state.option.xAxis.data=numberData
|
||||
// this.state.option.series.data=quantityData
|
||||
// this.echartsReact.props.option.xAxis.data = numberData
|
||||
// this.echartsReact.props.option.series.data = quantityData
|
||||
// this.echartsReact.getEchartsInstance().setOption(this.echartsReact.props.option)
|
||||
// console.log("this.echartsReact.getEchartsInstance()")
|
||||
// const newMesage=[...this.state.option]
|
||||
// console.log("this.setState({option:option})",newMesage)
|
||||
// this.setState({option:newMesage})
|
||||
|
||||
// this.setState({option:{
|
||||
// grid: { top: 8, right: 8, bottom: 24, left: 36 },
|
||||
// xAxis: {
|
||||
// type: 'category',
|
||||
// data: numberData,
|
||||
// },
|
||||
// yAxis: {
|
||||
// type: 'value',
|
||||
// },
|
||||
// series: [
|
||||
// {
|
||||
// data: quantityData,
|
||||
// type: 'line',
|
||||
// smooth: true,
|
||||
// },
|
||||
// ],
|
||||
// tooltip: {
|
||||
// trigger: 'axis',
|
||||
// },
|
||||
// }})
|
||||
// return option;
|
||||
// } else {
|
||||
// message.error(result.status.message)
|
||||
// }
|
||||
// }).catch(function (error) {
|
||||
// message.error(error)
|
||||
// })
|
||||
// // console.log("end",option)
|
||||
// }
|
||||
|
||||
|
||||
getOptions=()=>{
|
||||
const numberData = []
|
||||
const quantityData = []
|
||||
axios.get("/ticai/probability/back").then(response=>{
|
||||
const result = response.data;
|
||||
if (result.status.code === 200) {
|
||||
result.data.forEach(numberVO => {
|
||||
numberData.push(numberVO.number)
|
||||
quantityData.push(numberVO.quantity)
|
||||
})
|
||||
const echartInstance = this.echartsReact.getEchartsInstance();
|
||||
echartInstance.setOption({xAxis: {
|
||||
data: numberData,
|
||||
},series:{
|
||||
data: quantityData
|
||||
}})
|
||||
} else {
|
||||
message.error(result.status.message)
|
||||
}
|
||||
}).catch(e=>{
|
||||
console.log("123",e)
|
||||
})
|
||||
return {
|
||||
grid: { top: 8, right: 8, bottom: 24, left: 36 },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [],
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [],
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
},
|
||||
],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
}
|
||||
}
|
||||
}
|
||||
render(){
|
||||
return (
|
||||
<>
|
||||
{/* <Index onClick={getOptions}>更新</Index> */}
|
||||
<h3 style={{aligen:"center"}}>大乐透后区数据往期个数展示</h3>
|
||||
<ReactECharts ref={(e) => { this.echartsReact = e }} option={this.getOptions()} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
import React, { Component } from 'react'
|
||||
import ReactECharts from 'echarts-for-react';
|
||||
import axios from 'axios';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default class FrontCounte extends Component {
|
||||
|
||||
getOptions=()=>{
|
||||
const numberData = []
|
||||
const quantityData = []
|
||||
axios.get("/ticai/probability/front").then(response=>{
|
||||
const result = response.data;
|
||||
if (result.status.code === 200) {
|
||||
result.data.forEach(numberVO => {
|
||||
numberData.push(numberVO.number)
|
||||
quantityData.push(numberVO.quantity)
|
||||
})
|
||||
const echartInstance = this.echartsReact.getEchartsInstance();
|
||||
echartInstance.setOption({xAxis: {
|
||||
data: numberData,
|
||||
},series:{
|
||||
data: quantityData
|
||||
}})
|
||||
} else {
|
||||
message.error(result.status.message)
|
||||
}
|
||||
}).catch(e=>{
|
||||
console.log("123",e)
|
||||
})
|
||||
return {
|
||||
grid: { top: 8, right: 8, bottom: 24, left: 36 },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [],
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: [],
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
},
|
||||
],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
}
|
||||
}
|
||||
}
|
||||
render(){
|
||||
return (
|
||||
<>
|
||||
<h3 style={{aligen:"center"}}>大乐透前区数据往期个数展示</h3>
|
||||
<ReactECharts ref={(e) => { this.echartsReact = e }} option={this.getOptions()} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
import React from 'react'
|
||||
import BackCount from './../../echarts/BackCount'
|
||||
import FrontCount from '../../echarts/FrontCount'
|
||||
export default function EchartsPage() {
|
||||
return (
|
||||
<>
|
||||
<FrontCount/>
|
||||
<BackCount/>
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Button, Switch, InputNumber, Spin, Space,message } from 'antd';
|
||||
import axios from 'axios';
|
||||
export default class GenerateSelf extends Component {
|
||||
state = {
|
||||
data: [{
|
||||
uuid: 1,
|
||||
frontWinningNum: '0,0,0,0,0',
|
||||
backWinningNum: '0,0',
|
||||
appendAdd: true,
|
||||
multiplyingPower: 2
|
||||
}, {
|
||||
uuid: 2,
|
||||
frontWinningNum: '0,0,0,0,0',
|
||||
backWinningNum: '0,0',
|
||||
appendAdd: true,
|
||||
multiplyingPower: 2
|
||||
}],
|
||||
}
|
||||
|
||||
generateRandom = () => {
|
||||
const key = 'GENERATE_RANDOM_LOADING';
|
||||
message.loading({content:'Loading...',key,duration:0});
|
||||
|
||||
axios.get("/ticai/generate/random")
|
||||
.then(response => {
|
||||
const result = response.data;
|
||||
if (result.status.code === 200) {
|
||||
// 只覆盖球编号
|
||||
result.data.forEach((winningNumber, index) => {
|
||||
this.state.data[index].frontWinningNum=winningNumber.frontWinningNum
|
||||
this.state.data[index].backWinningNum=winningNumber.backWinningNum
|
||||
})
|
||||
const newMesage=[...this.state.data]
|
||||
this.setState({data:newMesage})
|
||||
message.destroy(key)
|
||||
message.success({
|
||||
content: 'Loaded!',
|
||||
duration: 2,
|
||||
})
|
||||
} else {
|
||||
message.destroy(key)
|
||||
message.error(result.status.message)
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
message.destroy(key)
|
||||
message.error(error)
|
||||
})
|
||||
}
|
||||
componentDidMount() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
generateSelf = (event, uuid) => {
|
||||
const key = 'GENERATE_SELE_LOADING';
|
||||
|
||||
const requestData = this.state.data.filter(result => result.uuid === uuid)[0];
|
||||
if (requestData.frontWinningNum.split(',').filter(num => num == 0).length > 0) {
|
||||
message.error("数据有问题")
|
||||
return
|
||||
}
|
||||
message.loading({content:'Loading...',key,duration:0});
|
||||
|
||||
axios.post('/ticai/generate/self', requestData, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(response => {
|
||||
const result = response.data;
|
||||
if (result.status.code === 200) {
|
||||
message.destroy(key)
|
||||
message.success({
|
||||
content: result.data,
|
||||
duration: 2,
|
||||
})
|
||||
} else {
|
||||
message.destroy(key)
|
||||
message.error(result.status.message)
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
message.destroy(key)
|
||||
message.error(error)
|
||||
})
|
||||
}
|
||||
|
||||
changeAppendAdd = (event, uuid) => {
|
||||
this.state.data.map(result => {
|
||||
if (result.uuid === uuid) {
|
||||
result.appendAdd = event
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
changeMultiplyingPower = (event, uuid) => {
|
||||
this.state.data.map(result => {
|
||||
if (result.uuid === uuid) {
|
||||
result.multiplyingPower = event
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const {data} = this.state
|
||||
console.log(this.state)
|
||||
return (
|
||||
<div>
|
||||
<Button onClick={this.generateRandom}>随机</Button>
|
||||
<hr />
|
||||
{
|
||||
data.map(winningNumber => {
|
||||
return <div key={"div" + winningNumber.uuid}>
|
||||
<Space key={winningNumber.uuid} align='center'>
|
||||
{winningNumber.frontWinningNum.split(',').map((frontNum, index) =>
|
||||
<Button key={winningNumber.uuid + 'frontButton' + index} type="primary" shape="circle" size='large' style={{ background: "blue" }}>
|
||||
{frontNum}
|
||||
</Button>)}
|
||||
|
||||
{winningNumber.backWinningNum.split(',').map((backNum, index) =>
|
||||
<Button key={winningNumber.uuid + 'backButton' + index} type="primary" shape="circle" size='large' style={{ background: "yellow", color: "black" }}>
|
||||
{backNum}
|
||||
</Button>)}
|
||||
|
||||
是否追加:<Switch key={'Switch' + winningNumber.uuid} checkedChildren="是" unCheckedChildren="否" defaultChecked={winningNumber.appendAdd}
|
||||
name="appendAdd" onChange={(e) => this.changeAppendAdd(e, winningNumber.uuid)} />
|
||||
几倍:<InputNumber key={'InputNumber' + winningNumber.uuid} min={1} defaultValue={winningNumber.multiplyingPower}
|
||||
name="multiplyingPower" onChange={(e) => this.changeMultiplyingPower(e, winningNumber.uuid)} />
|
||||
{/* 金额:<span></span> */}
|
||||
<Button key={'Button' + winningNumber.uuid} onClick={(e) => this.generateSelf(e, winningNumber.uuid)}>选中</Button>
|
||||
</Space>
|
||||
<hr />
|
||||
</div>
|
||||
})
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ import ContextMenuPlugin from "./plugins/ContextMenuPlugin"
|
|||
import {Spin} from "antd";
|
||||
import {useState} from "react";
|
||||
function Placeholder() {
|
||||
return <div className="editor-placeholder">Enter some rich text...</div>;
|
||||
return <div className="editor-placeholder">记录一些灵感吧</div>;
|
||||
}
|
||||
|
||||
export default function Hlexical(props) {
|
||||
|
@ -53,6 +53,7 @@ export default function Hlexical(props) {
|
|||
let promise = importFile(props.filePath);
|
||||
promise.then(value => {
|
||||
if (isEmpty(value)) {
|
||||
setSpinningState(false)
|
||||
return
|
||||
}
|
||||
editorConfig={...editorConfig,editorState: () => $convertFromMarkdownString(value.toString(), TRANSFORMERS)}
|
||||
|
|
|
@ -7,6 +7,9 @@ body {
|
|||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.ant-spin-nested-loading{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.other h2 {
|
||||
font-size: 18px;
|
||||
|
|
|
@ -10,6 +10,7 @@ export default function ImportFilePlugin(props) {
|
|||
if (props.filePath) {
|
||||
importFile(props.filePath).then(value => {
|
||||
if (isEmpty(value)) {
|
||||
props.setSpinningState(false)
|
||||
return
|
||||
}
|
||||
if (props.filePath.endsWith(".md")) {
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Breadcrumb } from 'antd';
|
||||
export default class TBreadcrumb extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Breadcrumb
|
||||
style={{
|
||||
margin: '16px 0',
|
||||
}}>
|
||||
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>List</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>App</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Outlet } from 'react-router-dom'
|
||||
import { Layout } from 'antd';
|
||||
import ErrorBoundary from '../../../components/ErrorBoundary';
|
||||
const { Content } = Layout;
|
||||
class TContext extends Component {
|
||||
render() {
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<Content className="site-layout-background" style={{ padding: 24, margin: 0, minHeight: 280, }}>
|
||||
{/* 注册路由 */}
|
||||
{/* <NavLink to="/generate">generate</NavLink> */}
|
||||
{/* <Switch>
|
||||
<Route path="/generate" component={GenerateSelf} />
|
||||
<Route path="/sync" component={SyncContext} />
|
||||
<Route path="/probability" component={EchartsPage} />
|
||||
<Route path="*" component={NoMatch}/>
|
||||
</Switch> */}
|
||||
<Outlet />
|
||||
</Content>
|
||||
</ErrorBoundary>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default TContext
|
|
@ -1,9 +0,0 @@
|
|||
.loading{
|
||||
margin: 20px 0;
|
||||
margin-bottom: 20px;
|
||||
height: 100%;
|
||||
padding: 30px 50px;
|
||||
text-align: center;
|
||||
background: white;//rgba(0, 0, 0, 0.05);
|
||||
border-radius: 4px;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Layout, Menu } from 'antd';
|
||||
const { Header } = Layout;
|
||||
export default class THeader extends Component {
|
||||
|
||||
render() {
|
||||
const items1 = ['1', '2', '3'].map((key) => ({
|
||||
key,
|
||||
label: `nav ${key}`,
|
||||
}));
|
||||
return (
|
||||
|
||||
<Header className="header">
|
||||
<div className="logo" />
|
||||
<Menu theme="dark" mode="horizontal" defaultSelectedKeys={['2']} items={items1} />
|
||||
</Header>
|
||||
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
import React, { useState } from 'react'
|
||||
import { Menu, Layout } from 'antd';
|
||||
import {
|
||||
DesktopOutlined,
|
||||
DollarCircleOutlined,
|
||||
PieChartOutlined,
|
||||
TeamOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { getRoute } from '../../../utils/Api';
|
||||
import {useNavigate,useLocation } from 'react-router-dom'
|
||||
|
||||
const { Sider } = Layout;
|
||||
|
||||
function getItem(label, path, icon, children) {
|
||||
return {
|
||||
label,
|
||||
key:path,
|
||||
icon,
|
||||
children,
|
||||
};
|
||||
}
|
||||
|
||||
const items = [
|
||||
getItem('今日随机', '/show/generate', <DollarCircleOutlined />),
|
||||
getItem('历史数据', '/show/sync', <PieChartOutlined />),
|
||||
getItem('数据曲线图', '/show/probability', <DesktopOutlined />),
|
||||
// getItem('用户', 'sub1', <UserOutlined />, [
|
||||
// getItem('Tom', '3'),
|
||||
// getItem('Bill', '4'),
|
||||
// getItem('Alex', '5'),
|
||||
// ]),
|
||||
// getItem('团队', 'sub2', <TeamOutlined />, [
|
||||
// getItem('Team 1', '6'),
|
||||
// getItem('Team 2', '8')
|
||||
// ]),
|
||||
];
|
||||
const items1=getRoute()
|
||||
|
||||
function bulidRoute(routeList){
|
||||
if(routeList){
|
||||
for (let route of routeList){
|
||||
getItem(route.label, route.path, route.icon, bulidRoute(route.childMenuRouteList))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TSlide = (props) => {
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const [current, setCurrent] = useState('1');
|
||||
const navigate = useNavigate()
|
||||
let location = useLocation();
|
||||
const onClick = (e) => {
|
||||
setCurrent(e.key);
|
||||
navigate(e.key)
|
||||
};
|
||||
|
||||
items1.then(function(data){
|
||||
// bulidRoute(data.data)
|
||||
console.log('dunctiondata',data)
|
||||
console.log('dunctiondataitems',items)
|
||||
})
|
||||
return (
|
||||
<Sider collapsible collapsed={collapsed} onCollapse={(value) => setCollapsed(value)}>
|
||||
<div className="logo"></div>
|
||||
<Menu theme="dark" defaultSelectedKeys={[location.pathname]} mode="inline" onClick={onClick} items={items} >
|
||||
</Menu>
|
||||
</Sider>
|
||||
);
|
||||
};
|
||||
export default TSlide
|
|
@ -1,24 +0,0 @@
|
|||
import React, { Component } from 'react'
|
||||
import { Layout } from 'antd';
|
||||
import THeader from './THeader'
|
||||
import TSlide from './TSlide';
|
||||
import TContext from './TContext';
|
||||
import TBreadcrumb from './TBreadcrumb';
|
||||
import './index.less'
|
||||
|
||||
export default class TLayout extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Layout>
|
||||
<THeader />
|
||||
<Layout>
|
||||
<TSlide />
|
||||
<Layout style={{ padding: '0 24px 24px', }}>
|
||||
<TBreadcrumb />
|
||||
<TContext />
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
@import '~antd/dist/antd.less';
|
||||
|
||||
#components-layout-demo-top-side-2 .logo {
|
||||
float: left;
|
||||
width: 120px;
|
||||
height: 31px;
|
||||
margin: 16px 24px 16px 0;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.ant-row-rtl #components-layout-demo-top-side-2 .logo {
|
||||
float: right;
|
||||
margin: 16px 0 16px 24px;
|
||||
}
|
||||
|
||||
.site-layout-background {
|
||||
background: #fff;
|
||||
}
|
|
@ -1,31 +1,9 @@
|
|||
import {Navigate} from 'react-router-dom'
|
||||
import TLayout from '../pages/TLayout'
|
||||
import GenerateSelf from '../pages/GenerateSelf'
|
||||
import SyncContext from '../pages/SyncContext'
|
||||
import EchartsPage from '../pages/EchartsPage'
|
||||
import Login from '../pages/Login/Form'
|
||||
import GateWay from '../pages/GateWay'
|
||||
import Note from '../pages/Note'
|
||||
import Hlexical from '../pages/Note/Hlexical'
|
||||
export default [
|
||||
{
|
||||
path:'/show',
|
||||
element:<TLayout/>,
|
||||
children:[
|
||||
{
|
||||
path:'generate',
|
||||
element:<GenerateSelf/>
|
||||
},
|
||||
{
|
||||
path:'sync',
|
||||
element:<SyncContext/>,
|
||||
},
|
||||
{
|
||||
path:'probability',
|
||||
element:<EchartsPage/>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'/note',
|
||||
element:<Note/>,
|
||||
|
@ -46,7 +24,14 @@ export default [
|
|||
},
|
||||
{
|
||||
path:'/',
|
||||
element:<Navigate to="/note"/>
|
||||
// element:<Navigate to="/note"/>
|
||||
element:<Note/>,
|
||||
children:[
|
||||
{
|
||||
path:'Hlexical',
|
||||
element:<Hlexical/>
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
]
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import { requestAxios } from "./RequestAixos";
|
||||
import axios from "axios";
|
||||
export async function getHistoryRecord1(data) {
|
||||
console.log('data', data)
|
||||
return await requestAxios('/ticai/list/history/record', {
|
||||
data,
|
||||
requestType: 'json',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
export function getHistoryRecord(data) {
|
||||
console.log('data', data)
|
||||
return new Promise((resolve, reject) =>
|
||||
( res => {
|
||||
const result = requestAxios('/ticai/list/history/record', {
|
||||
data,
|
||||
requestType: 'json',
|
||||
method: 'post',
|
||||
})
|
||||
console.log('result', result.data)
|
||||
resolve(result.data)
|
||||
})).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
import { requestAxios } from "./RequestAixos";
|
||||
export function getRoute() {
|
||||
const result = requestAxios.get('/oauth/menu/list').catch(e=>console.log(e))
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
|
||||
// const getRoute=()=>{
|
||||
// return new Promise((resolve,reject)=>
|
||||
// (async res =>{
|
||||
// const result = await axios.get('/oauth/menu/list')
|
||||
// console.log('result',result.data)
|
||||
// resolve(result.data)
|
||||
// })
|
||||
// )
|
||||
// }
|
Loading…
Reference in New Issue