Commit e0cfb985 by end

优化bug

parent 8cb706f3
No preview for this file type
import React, { Component } from "react";
import styles from "./style/index.less";
import {
Row,
Col,
Divider,
Select,
Card,
Icon,
Statistic,
Form,
Radio,
} from "antd";
import { connect } from "react-redux";
import * as actions from "./redux/actions";
import moment from "moment";
import { Link, withRouter } from "react-router-dom";
import { withRouter } from "react-router-dom";
import ReactEcharts from "echarts-for-react";
import img1 from "./imgs/1.png";
import img2 from "./imgs/2.png";
import img3 from "./imgs/3.png";
import img4 from "./imgs/4.png";
import img5 from "./imgs/5.png";
import img6 from "./imgs/6.png";
import img7 from "./imgs/7.png";
import img8 from "./imgs/8.png";
import img9 from "./imgs/9.png";
import img10 from "./imgs/10.png";
import img11 from "./imgs/11.png";
......@@ -32,23 +20,11 @@ import down from "./imgs/down.png";
import up from "./imgs/up.png";
const createForm = Form.create;
const FormItem = Form.Item;
const { Countdown } = Statistic;
const { Option } = Select;
const { Meta } = Card;
const companyCode = location.pathname.split("/")[1];
const siteCode = location.pathname.split("/")[2];
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate() > 10 ? date.getDate() : `0${date.getDate()}`;
const itemStyle = {
normal: {
opacity: 1,
borderWidth: 2,
borderColor: "#ffffff",
},
};
const color = ["#30d987", "#51cbff", "#f64e60", "#ffa800", "#8675ff"];
class homePage extends Component {
constructor(props) {
......@@ -70,6 +46,8 @@ class homePage extends Component {
tgId: "",
currentPeriod: '今日', // 登录量添加周期状态
oldCurrentPeriod: '昨日', // 登录量添加对比周期状态
lllcurrentPeriod: '今日', // 浏览量添加周期状态
oldLllCurrentPeriod: '昨日', // 浏览量添加对比周期状态
hdlcurrentPeriod: '今日', // 互动量添加周期状态
oldHdlCurrentPeriod: '昨日', // 互动量添加对比周期状态
};
......@@ -183,9 +161,21 @@ class homePage extends Component {
};
// 浏览量
lllChange = e => {
this.setState({ lllTime: e }, () => {
this.getLllRes();
});
if (e == 1) {
this.setState({ lllTime: e, lllcurrentPeriod: "今年", oldLllCurrentPeriod: "去年" }, () => {
this.getLllRes();
});
}
if (e == 2) {
this.setState({ lllTime: e, lllcurrentPeriod: "本月", oldLllCurrentPeriod: "上月" }, () => {
this.getLllRes();
});
}
if (e == 3) {
this.setState({ lllTime: e, lllcurrentPeriod: "今日", oldLllCurrentPeriod: "昨日", }, () => {
this.getLllRes();
});
}
};
getLllRes = () => {
this.props.getLllData({
......@@ -196,9 +186,21 @@ class homePage extends Component {
// 互动量
hdlChange = (type, e) => {
if (type == 1) {
this.setState({ hdlTime: e }, () => {
if (e == 1) {
this.setState({ hdlTime: e, hdlcurrentPeriod: "今年", oldHdlCurrentPeriod: "去年" }, () => {
this.getHdlRes();
});
}
if (e == 2) {
this.setState({ hdlTime: e, hdlcurrentPeriod: "本月", oldHdlCurrentPeriod: "上月" }, () => {
this.getHdlRes();
});
}
if (e == 3) {
this.setState({ hdlTime: e, hdlcurrentPeriod: "今日", oldHdlCurrentPeriod: "昨日", }, () => {
this.getHdlRes();
});
}
} else if (type == 2) {
this.setState({ hdlType: e }, () => {
this.getHdlRes();
......@@ -708,7 +710,6 @@ class homePage extends Component {
y.push(param);
});
console.log(x, y, z);
return {
grid: {
top: "12%",
......@@ -807,12 +808,17 @@ class homePage extends Component {
pbhChartList,
lllData,
hdlMenu,
hdlData,
zllData,
wjData,
level2Menu,
tgrData,
tgrData1,
examList
examList,
lllNumTotal,
lllPreNumTotal,
hdlNumTotal,
hdlPreNumTotal,
} = this.props;
const loginChange = () => {
return dllData.num - dllData.preNum > 0 ? (
......@@ -836,41 +842,41 @@ class homePage extends Component {
);
};
const readChange = () => {
return actionList?.readNum - actionList?.readPreNum > 0 ? (
return lllNumTotal - lllPreNumTotal > 0 ? (
<>
昨日上升
{this.state.oldLllCurrentPeriod}上升
<img className={styles.icon} src={up} alt="" />
<span style={{ color: "#d26f64" }}>
{actionList?.readNum - actionList?.readPreNum}
{lllNumTotal - lllPreNumTotal}
</span>
</>
) : actionList?.readNum - actionList?.readPreNum < 0 ? (
) : lllNumTotal - lllPreNumTotal < 0 ? (
<>
昨日下降
{this.state.oldLllCurrentPeriod}下降
<img className={styles.icon} src={down} alt="" />
<span style={{ color: "#70bb74" }}>
{actionList?.readPreNum - actionList?.readNum}
{lllNumTotal - lllPreNumTotal}
</span>
</>
) : (
<>昨日不变</>
<>{this.state.oldLllCurrentPeriod}不变</>
);
};
const admireChange = () => {
return actionList?.admireNum - actionList?.admirePreNum > 0 ? (
return hdlNumTotal - hdlPreNumTotal > 0 ? (
<>
{this.state.oldHdlCurrentPeriod}上升
<img className={styles.icon} src={up} alt="" />
<span style={{ color: "#d26f64" }}>
{actionList?.admireNum - actionList?.admirePreNum}
{hdlNumTotal - hdlPreNumTotal}
</span>
</>
) : actionList?.admireNum - actionList?.admirePreNum < 0 ? (
) : hdlNumTotal - hdlPreNumTotal < 0 ? (
<>
{this.state.oldHdlCurrentPeriod}下降
<img className={styles.icon} src={down} alt="" />
<span style={{ color: "#70bb74" }}>
{actionList?.admirePreNum - actionList?.admireNum}
{hdlNumTotal - hdlPreNumTotal}
</span>
</>
) : (
......@@ -934,16 +940,16 @@ class homePage extends Component {
</p>
</div>
<div className={styles.card2}>
<p>今日浏览量(人)</p>
<p>{this.state.lllcurrentPeriod}浏览量(人)</p>
<p>
<span>{actionList?.readNum} </span>
<span>{lllNumTotal} </span>
{readChange()}
</p>
</div>
<div className={styles.card3}>
<p>{this.state.hdlcurrentPeriod}互动量(人)</p>
<p>
<span>{actionList?.admireNum} </span>
<span>{hdlNumTotal} </span>
{admireChange()}
</p>
</div>
......@@ -1039,7 +1045,7 @@ class homePage extends Component {
))}
</div>
</div>
{/* 收藏量 */}
{/* 互动量 */}
<div className={styles.chart3}>
<div className={styles.chartTop}>
<div>
......@@ -1245,7 +1251,7 @@ class homePage extends Component {
<div>
<div className={styles.chartList}>
<p>年度测试总数及参加人数</p>
<div className={styles.chartBottom} style={ {height: "360px"} }>
<div className={styles.chartBottom} style={{ height: "360px" }}>
<ReactEcharts
style={{ height: "100%", width: "100%" }}
option={this.zlrChart1()}
......@@ -1257,7 +1263,7 @@ class homePage extends Component {
</div>
<div className={styles.chartList} >
<p>年度测试合格率</p>
<div className={styles.chartBottom} style={ {height: "360px"} }>
<div className={styles.chartBottom} style={{ height: "360px" }}>
<ReactEcharts
style={{ height: "100%", width: "100%" }}
option={this.zlrChart2()}
......
......@@ -44,7 +44,15 @@ export function getDllData(data) {
url,
data,
}).then(res => {
dispatch({ type: Types.DLL_DATA, data: res.data });
const processedData = {
...res.data,
fifthNum: res.data.fifthNum === "" ? 0 : res.data.fifthNum,
fourtNum: res.data.fourtNum === "" ? 0 : res.data.fourtNum,
thirdNum: res.data.thirdNum === "" ? 0 : res.data.thirdNum,
preNum: res.data.preNum === "" ? 0 : res.data.preNum,
num: res.data.num === "" ? 0 : res.data.num
};
dispatch({ type: Types.DLL_DATA, data: processedData });
});
};
}
......@@ -69,8 +77,14 @@ export function getHdlMenu(data) {
}).then(res => {
let list = [];
if (res.data.length > 0) {
list = res.data.filter(item => item.id != 0);
list = res.data.filter(item => item.id != 0 &&
item.name !== "国学经典" &&
item.name !== "心理讲堂");
}
// list.unshift({
// id: "",
// name: "全部"
// });
dispatch({ type: Types.HDL_MENU, data: list });
});
};
......
......@@ -34,6 +34,8 @@ function homePage(state = initialState, action) {
case Types.LLL_DATA:
return Object.assign({}, state, {
lllData: action.data,
lllNumTotal: action.data[0].numTotal,
lllPreNumTotal: action.data[0].preNumTotal,
});
case Types.HDL_MENU:
return Object.assign({}, state, {
......@@ -42,6 +44,8 @@ function homePage(state = initialState, action) {
case Types.HDL_DATA:
return Object.assign({}, state, {
hdlData: action.data,
hdlNumTotal: action.data[0].numTotal,
hdlPreNumTotal: action.data[0].preNumTotal,
});
case Types.ZLL_DATA:
return Object.assign({}, state, {
......
import React from "react";
import { Tree, Form, Input, Select, Table, message } from "antd";
import { Table, message, Popconfirm } from "antd";
import Head from "./head";
import func from "@/common/commonFunc";
import Breadcrumb from "@/common/Breadcrumb";
......@@ -8,7 +8,6 @@ import { connect } from "react-redux";
import {
postReleases,
postUnReleases,
// postInsert,
postUpdata,
getApprove,
getUnapprove,
......@@ -16,14 +15,11 @@ import {
getSearch,
getList,
menu,
getDelete,
} from "./redux/action";
import { getIficationList } from "../Information/redux/action";
import moment from "moment";
import Styles from "./style.less";
const TreeNode = Tree.TreeNode;
const FormItem = Form.Item;
const Option = Select.Option;
const { TextArea } = Input;
class Atricle extends React.Component {
constructor(props) {
......@@ -164,6 +160,28 @@ class Atricle extends React.Component {
this.setState({ visible: true, type: type });
});
}
//删除
onDelete = id => {
let _this = this;
const { page, pagesize, inputValue } = this.state;
const { getDelete, getList } = this.props;
getDelete({ id }, () => {
getList(
_this.filterParams({
pageNo: page,
pageSize: pagesize,
...inputValue,
}),
() => {
message.success("删除成功");
_this.setState({
record: _this.props.tableList,
total: _this.props.tableList.total,
});
}
);
});
};
handleCancel = () => {
this.setState({ visible: false });
};
......@@ -487,6 +505,12 @@ class Atricle extends React.Component {
>
查看
</a>
<Popconfirm
title="是否删除?"
onConfirm={() => this.onDelete(record.id)}
>
<a className={Styles.marr10}>删除</a>
</Popconfirm>
</div>
)}
{record.state == "4" && (
......@@ -519,6 +543,12 @@ class Atricle extends React.Component {
>
查看
</a>
<Popconfirm
title="是否删除?"
onConfirm={() => this.onDelete(record.id)}
>
<a className={Styles.marr10}>删除</a>
</Popconfirm>
</div>
)}
</div>
......@@ -579,6 +609,7 @@ function mapDispatchToProps(dispatch) {
menu: (obj, callback) => dispatch(menu(obj, callback)),
getIficationList: (obj, callback) =>
dispatch(getIficationList(obj, callback)),
getDelete: (obj, callback) => dispatch(getDelete(obj, callback)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Atricle);
......@@ -12,6 +12,7 @@ const {
getSeeEditApi,
searchApi,
listApi,
deleteApi,
menuApi,
} = apis;
......@@ -41,6 +42,19 @@ export function getList(data, callback) {
});
};
}
//删除
export function getDelete(data, callback) {
return dispatch => {
return request({
url: deleteApi,
data: data,
}).then(res => {
if (callback) {
callback();
}
});
};
}
//查看
export function getSeeEdit(data, callback) {
return dispatch => {
......
......@@ -10,4 +10,5 @@ export default {
searchApi: `GET ${services.webManage}/site/classify/publication/listbyName`, //?name=''&siteId
listApi: `POST ${services.webManage}/site/classify/publication/list`,
menuApi: `GET ${services.base}/system/dictionary/child/list`,
deleteApi: `POST ${services.webManage}/site/classify/publication/delete`, //id
};
import React from "react";
import {
Row,
Col,
Tree,
Form,
Modal,
Input,
Select,
Steps,
Icon,
Table,
Button,
message,
Popconfirm
} from "antd";
import Head from "./head";
import func from "@/common/commonFunc";
......@@ -314,7 +309,27 @@ class Mailbox extends React.Component {
onEditor = editor => {
this.setState({ editor });
};
onDelete = (id) => {
let _this = this;
const { page, pagesize, inputValue } = this.state;
const { getDelete, getList } = this.props;
getDelete({ id }, () => {
getList(
_this.filterParams({
pageNo: page,
pageSize: pagesize,
...inputValue,
}),
() => {
message.success("删除成功");
_this.setState({
record: _this.props.tableList,
total: _this.props.tableList.total,
});
}
);
});
};
saveFormRef = formRef => {
this.formRef = formRef;
};
......@@ -413,12 +428,12 @@ class Mailbox extends React.Component {
查看
</a>
</div>
{/* <Popconfirm
<Popconfirm
title="是否删除?"
onConfirm={() => this.onDelete(record.id)}
>
<a className={Styles.marr10}>删除</a>
</Popconfirm> */}
</Popconfirm>
</div>
);
},
......@@ -463,21 +478,12 @@ function mapStateToProps(state, ownProps) {
}
function mapDispatchToProps(dispatch) {
return {
// postReleases: (obj, callback) => dispatch(postReleases(obj, callback)),
// postUnReleases: (obj, callback) => dispatch(postUnReleases(obj, callback)),
// postInsert: (obj, callback) => dispatch(postInsert(obj, callback)),
// postUpdata: (obj, callback) => dispatch(postUpdata(obj, callback)),
// postReleases: (obj, callback) => dispatch(postReleases(obj, callback)),
// getUnapprove: (obj, callback) => dispatch(getUnapprove(obj, callback)),
// getSearch: (obj, callback) => dispatch(getSearch(obj, callback)),
getList: (obj, callback) => dispatch(getList(obj, callback)),
getSeeEdit: (obj, callback) => dispatch(getSeeEdit(obj, callback)),
getDelete: (obj, callback) => dispatch(getDelete(obj, callback)),
getUpdateState: (obj, callback) => dispatch(getUpdateState(obj, callback)),
getUpdateState1: (obj, callback) =>
dispatch(getUpdateState1(obj, callback)),
// getApprove: (obj, callback) => dispatch(getApprove(obj, callback)),
// menu: (obj, callback) => dispatch(menu(obj, callback)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Mailbox);
import React from "react";
import {
Row,
Col,
Tree,
Form,
Modal,
Input,
Select,
Steps,
Icon,
Table,
Button,
message,
} from "antd";
import { Tree, Form, Input, Select, Table, Popconfirm, message } from "antd";
import Head from "./head";
import func from "@/common/commonFunc";
import Breadcrumb from "@/common/Breadcrumb";
......@@ -29,7 +16,6 @@ import {
getDelete,
getUpdateState,
getList,
menu,
} from "./redux/action";
import moment from "moment";
import Styles from "./style.less";
......@@ -186,6 +172,28 @@ class Message extends React.Component {
}
return params;
}
// 删除
delect = id => {
let _this = this;
const { page, pagesize, inputValue } = this.state;
const { getDelete, getList } = this.props;
getDelete({ id }, () => {
getList(
_this.filterParams({
pageNo: page,
pageSize: pagesize,
...inputValue,
}),
() => {
message.success("删除成功");
_this.setState({
record: _this.props.tableList,
total: _this.props.tableList.total,
});
}
);
});
};
//审核
approve = (id, type) => {
let _this = this;
......@@ -430,6 +438,14 @@ class Message extends React.Component {
查看
</a>
</div>
<div style={{ display: "inline" }}>
<Popconfirm
title="是否删除?"
onConfirm={() => this.delect(record.id)}
>
<a className={Styles.marr10}>删除</a>
</Popconfirm>
</div>
</div>
);
},
......
......@@ -79,7 +79,6 @@ class Base extends Component {
this.handleCancel = this.handleCancel.bind(this);
this.getUser = this.getUser.bind(this);
this.selectStudent = this.selectStudent.bind(this);
this.closeSelectStudent = this.closeSelectStudent.bind(this);
this.handlePageChange = this.handlePageChange.bind(this);
this.handlePageSizeChange = this.handlePageSizeChange.bind(this);
this.searchValue = this.searchValue.bind(this);
......@@ -155,12 +154,6 @@ class Base extends Component {
}
}
closeSelectStudent() {
this.setState({
selectStudentVisible: false,
});
}
RadioChange(e) {
// console.log('radio checked', e.target.value);
this.setState({
......@@ -366,7 +359,7 @@ class Base extends Component {
rule,
value,
callback,
"请输少于100字的投票名称",
"请输少于20字的投票名称",
100
);
},
......@@ -375,6 +368,7 @@ class Base extends Component {
})(
<Input
placeholder="请输入投票名称"
maxLength={20}
style={{ display: "inline-block" }}
/>
)}
......@@ -608,7 +602,6 @@ class Base extends Component {
title=""
width={1160}
visible={this.state.selectStudentVisible}
onCancel={this.closeSelectStudent}
onOk={this.saveHomeworkViewRange}
onCancel={this.onHideModal}
>
......
......@@ -8,7 +8,7 @@ import {
Button,
DatePicker,
Table,
Pagination,
Popconfirm,
Modal,
Select,
} from "antd";
......@@ -23,6 +23,7 @@ import {
editTestFetch,
insertTestFetch,
updateFetch,
getDelete,
} from "../redux/actions";
// import Remind from '../../../../common/remind'
import TestModal from "../Create/TestModal";
......@@ -55,8 +56,6 @@ class Details extends Component {
canEdit: true,
};
this.showModal = this.showModal.bind(this);
this.handlePageChange = this.handlePageChange.bind(this);
this.handlePageSizeChange = this.handlePageSizeChange.bind(this);
this.handleOk = this.handleOk.bind(this);
this.handleCancel = this.handleCancel.bind(this);
this.id = "";
......@@ -92,26 +91,9 @@ class Details extends Component {
visible: true,
});
}
handlePageChange(page, pageSize) {
this.setState({
pageNo: page,
});
this.props.getlist({
researchId: this.id,
pageNo: page,
pageSize: pageSize,
});
}
handlePageSizeChange(current, size) {
this.props.getlist({
researchId: this.id,
pageNo: this.state.pageNo,
pageSize: size,
});
}
onDelete = id => {
this.props.getDelete({ questionId: id, researchId: this.id });
};
selectStudent = () => {
this.setState({
selectStudentVisible: true,
......@@ -367,6 +349,12 @@ class Details extends Component {
{this.state.isupdata == 2 && (
<a onClick={() => this.handleTestView1(record)}>查看</a>
)}
<Popconfirm
title="是否删除?"
onConfirm={() => this.onDelete(record.id)}
>
<a style={{ marginLeft: "10px" }}>删除</a>
</Popconfirm>
</div>
),
},
......@@ -591,6 +579,7 @@ function mapDispatchToProps(dispatch) {
update: (obj, callback) => dispatch(updateFetch(obj, callback)),
edit: (obj, id, no, size) => dispatch(editTestFetch(obj, id, no, size)),
insert: (obj, no, size) => dispatch(insertTestFetch(obj, no, size)),
getDelete: (obj, callback) => dispatch(getDelete(obj, callback)),
};
}
......
......@@ -34,6 +34,32 @@ export function delsur(param, callback) {
});
};
}
//删除调研
export function getDelete(param, callback) {
// console.log(param)
let url = api.getDelete;
return dispatch => {
return request({
url: url,
data: param,
}).then(res => {
if (res.code === "1000") {
message.success("删除成功");
dispatch(
getTestListFetch({
researchId: param.researchId,
pageNo: 1, pageSize: 20
})
);
if (callback) {
callback(res);
}
} else {
message.error(res.subMsg);
}
});
};
}
//获取列表数据
export function getListFetch(param) {
......
......@@ -2,6 +2,8 @@ import services from "@/services/serve";
export default {
delsur: `POST ${services.webManage}/research/delete`,
getDelete: `GET ${services.webManage}/researchQuestion/delete`,
getList: `GET ${services.webManage}/research/page/list`,
......
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