Commit e0cfb985 by end

优化bug

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