Commit b2a1997a by end

修改投票管理bug

parent 6cd02a57
File added
......@@ -70,7 +70,7 @@ class Item extends React.Component {
render() {
let { usable, data, defaultValue, reminds, index } = this.props;
//此判断没用到
if (reminds === [] || reminds === undefined) {
if (reminds.length === 0 || reminds === undefined) {
reminds === false;
}
console.log(data.timeType, "console.log(data.timeType);");
......@@ -269,7 +269,7 @@ class MessageRemind extends React.Component {
const { getFieldDecorator, getFieldValue } = this.props.form;
let labelAlignText = labelAlign ? labelAlign : "right";
let temparr = [];
if (reminds && reminds.length > 0) {
for (let i = 0; i < reminds.length; i++) {
......@@ -435,13 +435,13 @@ export default connect(
{
/*
使用实例
使用实例
参数*******说明
relationId : 回显的当前的id
relationId : 回显的当前的id
remind: 是否提醒
relationType:功能
wrappedComponentRef={(form) => this.messageRemind = form} 提交获取本组件的参数
<MessageRemind relationId={id} newsList={newsList} remind={details.remind} relationType={3} wrappedComponentRef={(form) => this.messageRemind = form}/>
<MessageRemind relationId={id} newsList={newsList} remind={details.remind} relationType={3} wrappedComponentRef={(form) => this.messageRemind = form}/>
*/
}
......@@ -770,6 +770,7 @@ class homePage extends Component {
componentDidMount() {
let _this = this;
this.props.getActionList();
this.props.queryExamNum();
this.getPhbRes();
this.getDllRes();
this.getLllRes();
......@@ -811,6 +812,7 @@ class homePage extends Component {
level2Menu,
tgrData,
tgrData1,
examList
} = this.props;
const loginChange = () => {
return dllData.num - dllData.preNum > 0 ? (
......@@ -1243,7 +1245,7 @@ class homePage extends Component {
<div>
<div className={styles.chartList}>
<p>年度测试总数及参加人数</p>
<div className={styles.chartBottom}>
<div className={styles.chartBottom} style={ {height: "360px"} }>
<ReactEcharts
style={{ height: "100%", width: "100%" }}
option={this.zlrChart1()}
......@@ -1253,9 +1255,9 @@ class homePage extends Component {
/>
</div>
</div>
<div className={styles.chartList}>
<div className={styles.chartList} >
<p>年度测试合格率</p>
<div className={styles.chartBottom}>
<div className={styles.chartBottom} style={ {height: "360px"} }>
<ReactEcharts
style={{ height: "100%", width: "100%" }}
option={this.zlrChart2()}
......@@ -1266,6 +1268,29 @@ class homePage extends Component {
</div>
</div>
</div>
<div>
<div className={styles.exambox}>
<div className={styles.zllNum1}>
<p>
{" "}
<span className={styles.red}></span>
<span>发起总数</span>
</p>
</div>
{examList &&
examList.length > 0 &&
examList.map((item, index) => (
<div className={styles.zllNum} key={index}>
<div>{item.deptName}</div>
{item?.eventTrackTypeNumVoList &&
item?.eventTrackTypeNumVoList.length > 0 &&
item?.eventTrackTypeNumVoList.map((element, index1) => (
<p key={index1}>{element.num}</p>
))}
</div>
))}
</div>
</div>
</div>
</div>
<div className={styles.row2}>
......
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 ReactEcharts from "echarts-for-react";
import defaultLogo from "./imgs/defaultLogo.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() - 1 : `0${date.getDate() - 1}`;
const itemStyle = {
normal: {
opacity: 1,
borderWidth: 2,
borderColor: "#ffffff",
},
};
class homePage extends Component {
constructor(props) {
super(props);
this.state = {
optionValue: "1",
activeAccount: "",
status: "1", // 1为人数,2为人次
selectName: `${year}-${month}-${day}`,
a: "",
};
}
componentDidMount() {
console.log(this.props.match, "+++++++++++");
this.props.activeAccountNumber();
this.props.courseTimeNumber();
this.props.courseFinishNumber();
this.props.tpFinishNumber();
this.props.accountReadyTaskNumber();
this.props.usedFunctionsNumber();
this.props.logoSiteNumber();
this.props.accountToYesterdayNumber();
}
// 按月折线图
optionMonth = () => {
const monthLineChartList = [];
const monthLineChartListNumber = [];
const monthMobileNum = [];
const monthMobileTimes = [];
const monthPcNum = [];
const monthPcTime = [];
for (const i in this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.lineChart) {
monthLineChartList.push(i);
monthLineChartListNumber.push(
this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.lineChart[i]
);
}
monthLineChartListNumber &&
monthLineChartListNumber.map(item =>
monthMobileNum.push(item && item.mobileNum)
);
monthLineChartListNumber &&
monthLineChartListNumber.map(item =>
monthMobileTimes.push(item && item.mobileTimes)
);
monthLineChartListNumber &&
monthLineChartListNumber.map(item => monthPcNum.push(item && item.pcNum));
monthLineChartListNumber &&
monthLineChartListNumber.map(item =>
monthPcTime.push(item && item.pcTimes)
);
return {
color: ["#5793f3", "#45c86d", "#1890ff"],
tooltip: {
trigger: "none",
axisPointer: {
type: "cross",
},
},
legend: {
data: ["PC端", "移动端"],
},
grid: {
top: 70,
bottom: 50,
},
xAxis: [
{
type: "category",
axisTick: {
alignWithLabel: true,
},
axisLine: {
onZero: false,
lineStyle: {
color: "#5793f3",
},
},
axisPointer: {
label: {
formatter(params) {
return params.seriesData[1]
? `${params.seriesData[0].seriesName}访问量${params.value}${
params.seriesData.length
? `:${params.seriesData[0].data}`
: ""
}\n` +
`\n${params.seriesData[1].seriesName}访问量${
params.value
}${
params.seriesData.length
? `:${params.seriesData[1].data}`
: ""
}`
: params.seriesData[0]
? `${params.seriesData[0].seriesName}访问量${params.value}${
params.seriesData.length
? `:${params.seriesData[0].data}`
: ""
}`
: "";
},
},
},
data: monthLineChartList,
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "PC端",
type: "line",
smooth: true,
data: this.state.status === "1" ? monthPcNum : monthPcTime,
},
{
name: "移动端",
type: "line",
smooth: true,
data: this.state.status === "1" ? monthMobileNum : monthMobileTimes,
},
],
};
};
// 按周折线图
optionWeek = () => {
const weekLineChartList = [];
const weekLineChartListNumber = [];
const weekMobileNum = [];
const weekMobileTimes = [];
const weekPcNum = [];
const weekPcTime = [];
for (const i in this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.lineChart) {
weekLineChartList.push(i);
weekLineChartListNumber.push(
this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.lineChart[i]
);
}
weekLineChartListNumber &&
weekLineChartListNumber.map(item =>
weekMobileNum.push(item && item.mobileNum)
);
weekLineChartListNumber &&
weekLineChartListNumber.map(item =>
weekMobileTimes.push(item && item.mobileTimes)
);
weekLineChartListNumber &&
weekLineChartListNumber.map(item => weekPcNum.push(item && item.pcNum));
weekLineChartListNumber &&
weekLineChartListNumber.map(item =>
weekPcTime.push(item && item.pcTimes)
);
return {
color: ["#5793f3", "#45c86d", "#1890ff"],
tooltip: {
trigger: "none",
axisPointer: {
type: "cross",
},
},
legend: {
data: ["PC端", "移动端"],
},
grid: {
top: 70,
bottom: 50,
},
xAxis: [
{
type: "category",
axisTick: {
alignWithLabel: true,
},
axisLine: {
onZero: false,
lineStyle: {
color: "#5793f3",
},
},
axisPointer: {
label: {
formatter(params) {
return params.seriesData[1]
? `${params.seriesData[0].seriesName}访问量${params.value}${
params.seriesData.length
? `:${params.seriesData[0].data}`
: ""
}\n` +
`\n${params.seriesData[1].seriesName}访问量${
params.value
}${
params.seriesData.length
? `:${params.seriesData[1].data}`
: ""
}`
: params.seriesData[0]
? `${params.seriesData[0].seriesName}访问量${params.value}${
params.seriesData.length
? `:${params.seriesData[0].data}`
: ""
}`
: "";
},
},
},
data: weekLineChartList,
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "PC端",
type: "line",
smooth: true,
data: this.state.status === "1" ? weekPcNum : weekPcTime,
},
{
name: "移动端",
type: "line",
smooth: true,
data: this.state.status === "1" ? weekMobileNum : weekMobileTimes,
},
],
};
};
// 按日折线图
optionDay = () => {
const yesterdayLineChartList = [];
const yesterdayLineChartListNumber = [];
const yesterdayMobileNum = [];
const yesterdayMobileTimes = [];
const yesterdayPcNum = [];
const yesterdayPcTime = [];
for (const i in this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.lineChart) {
yesterdayLineChartList.push(i);
yesterdayLineChartListNumber.push(
this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.lineChart[i]
);
}
yesterdayLineChartListNumber &&
yesterdayLineChartListNumber.map(item =>
yesterdayMobileNum.push(item && item.mobileNum)
);
yesterdayLineChartListNumber &&
yesterdayLineChartListNumber.map(item =>
yesterdayMobileTimes.push(item && item.mobileTimes)
);
yesterdayLineChartListNumber &&
yesterdayLineChartListNumber.map(item =>
yesterdayPcNum.push(item && item.pcNum)
);
yesterdayLineChartListNumber &&
yesterdayLineChartListNumber.map(item =>
yesterdayPcTime.push(item && item.pcTimes)
);
return {
color: ["#5793f3", "#45c86d", "#1890ff"],
tooltip: {
trigger: "none",
axisPointer: {
type: "cross",
},
},
legend: {
data: ["PC端", "移动端"],
},
grid: {
top: 70,
bottom: 50,
},
xAxis: [
{
type: "category",
axisTick: {
alignWithLabel: true,
},
axisLine: {
onZero: false,
lineStyle: {
color: "#5793f3",
},
},
axisPointer: {
label: {
formatter(params) {
return params.seriesData[1]
? `${params.seriesData[0].seriesName}访问量${params.value}${
params.seriesData.length
? `:${params.seriesData[0].data}`
: ""
}\n` +
`\n${params.seriesData[1].seriesName}访问量${
params.value
}${
params.seriesData.length
? `:${params.seriesData[1].data}`
: ""
}`
: params.seriesData[0]
? `${params.seriesData[0].seriesName}访问量${params.value}${
params.seriesData.length
? `:${params.seriesData[0].data}`
: ""
}`
: "";
},
},
},
data: yesterdayLineChartList,
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "PC端",
type: "line",
smooth: true,
data: this.state.status === "1" ? yesterdayPcNum : yesterdayPcTime,
},
{
name: "移动端",
type: "line",
smooth: true,
data:
this.state.status === "1"
? yesterdayMobileNum
: yesterdayMobileTimes,
},
],
};
};
// 饼状图人数
pieNumData = (monthPieChartList, weekPieChartList, yesterdayPieChartList) => {
if (!Array.isArray(monthPieChartList)) {
return [
{ value: monthPieChartList.mixNum, name: "既登录PC端也登录移动端" },
{ value: monthPieChartList.mobileNum, name: "仅登录移动端" },
{ value: monthPieChartList.pcNum, name: "仅登录PC端" },
];
} else if (!Array.isArray(weekPieChartList)) {
return [
{ value: weekPieChartList.mixNum, name: "既登录PC端也登录移动端" },
{ value: weekPieChartList.mobileNum, name: "仅登录移动端" },
{ value: weekPieChartList.pcNum, name: "仅登录PC端" },
];
} else if (!Array.isArray(yesterdayPieChartList)) {
return [
{ value: yesterdayPieChartList.mixNum, name: "既登录PC端也登录移动端" },
{ value: yesterdayPieChartList.mobileNum, name: "仅登录移动端" },
{ value: yesterdayPieChartList.pcNum, name: "仅登录PC端" },
];
} else {
return [
{ value: 0, name: "既登录PC端也登录移动端" },
{ value: 0, name: "仅登录移动端" },
{ value: 0, name: "仅登录PC端" },
];
}
};
// 饼状图人次
pieTimeData = (
monthPieChartList,
weekPieChartList,
yesterdayPieChartList
) => {
if (!Array.isArray(monthPieChartList)) {
return [
{ value: monthPieChartList.mixTimes, name: "既登录PC端也登录移动端" },
{ value: monthPieChartList.mobileTimes, name: "仅登录移动端" },
{ value: monthPieChartList.pcTimes, name: "仅登录PC端" },
];
} else if (!Array.isArray(weekPieChartList)) {
return [
{ value: weekPieChartList.mixTimes, name: "既登录PC端也登录移动端" },
{ value: weekPieChartList.mobileTimes, name: "仅登录移动端" },
{ value: weekPieChartList.pcTimes, name: "仅登录PC端" },
];
} else if (!Array.isArray(yesterdayPieChartList)) {
return [
{
value: yesterdayPieChartList.mixTimes,
name: "既登录PC端也登录移动端",
},
{ value: yesterdayPieChartList.mobileTimes, name: "仅登录移动端" },
{ value: yesterdayPieChartList.pcTimes, name: "仅登录PC端" },
];
} else {
return [
{ value: 0, name: "既登录PC端也登录移动端" },
{ value: 0, name: "仅登录移动端" },
{ value: 0, name: "仅登录PC端" },
];
}
};
// 按登录人数饼状图
optionPeople = () => {
let monthPieChartList = [];
let weekPieChartList = [];
let yesterdayPieChartList = [];
for (var i in this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.pieChart) {
if (i == this.state.selectName) {
monthPieChartList =
this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.pieChart[i];
}
}
for (var i in this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.pieChart) {
if (i == this.state.selectName) {
weekPieChartList =
this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.pieChart[i];
}
}
for (var i in this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.pieChart) {
if (i == this.state.selectName) {
yesterdayPieChartList =
this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.pieChart[i];
}
}
return {
monthPieChartList,
weekPieChartList,
yesterdayPieChartList,
title: {
text: "登录人数",
left: "center",
},
tooltip: {
trigger: "item",
// formatter: "{a} <br/>{b} : {c} ({d}%)"
},
color: ["#4ecb73", "#36cbcb", "#3aa0ff"],
legend: {
bottom: 0,
left: "center",
data: ["仅登录PC端", "仅登录移动端", "既登录PC端也登录移动端"],
},
series: [
{
type: "pie",
radius: "65%",
center: ["50%", "50%"],
selectedMode: "single",
data: this.pieNumData(
monthPieChartList,
weekPieChartList,
yesterdayPieChartList
),
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
itemStyle,
},
],
};
};
// 按登录人次饼状图
optionNumber = () => {
let monthPieChartList = [];
let weekPieChartList = [];
let yesterdayPieChartList = [];
for (var i in this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.pieChart) {
if (i == this.state.selectName) {
monthPieChartList =
this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.pieChart[i];
}
}
for (var i in this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.pieChart) {
if (i == this.state.selectName) {
weekPieChartList =
this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.pieChart[i];
}
}
for (var i in this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.pieChart) {
if (i == this.state.selectName) {
yesterdayPieChartList =
this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.pieChart[i];
}
}
return {
monthPieChartList,
weekPieChartList,
yesterdayPieChartList,
title: {
text: "登录人次",
left: "center",
},
tooltip: {
trigger: "item",
// formatter: "{a} <br/>{b} : {c} ({d}%)"
},
color: ["#4ecb73", "#36cbcb", "#3aa0ff"],
legend: {
bottom: 0,
left: "center",
data: ["仅登录PC端", "仅登录移动端", "既登录PC端也登录移动端"],
},
series: [
{
type: "pie",
radius: "65%",
center: ["50%", "50%"],
selectedMode: "single",
data: this.pieTimeData(
monthPieChartList,
weekPieChartList,
yesterdayPieChartList
),
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
itemStyle,
},
],
};
};
// 选择登录人数/登录人次
handleChange = value => {
this.setState({
status: value,
});
};
onChangeSelect = value => {
console.log(`selected ${value}`);
this.setState({
selectName: value,
});
};
onChangeOption = e => {
console.log("2222222", e.target.value);
this.setState({ optionValue: e.target.value }, () => {
if (this.state.optionValue == 1) {
this.props.accountToYesterdayNumber(null, this.selectCallback);
} else if (this.state.optionValue == 2) {
this.props.accountToWeekNumber(null, this.selectCallback);
} else {
this.props.accountToMonthNumber(null, this.selectCallback);
}
});
};
selectCallback = res => {
if (!res.data.pieChart) return;
for (const key in res.data.pieChart) {
this.setState(
{
selectName: key,
},
() => ""
);
}
};
render() {
const { optionValue } = this.state;
const deadline =
this.props.logoSiteList.data &&
parseInt(this.props.logoSiteList.data.expiredTime);
const line =
this.props.logoSiteList.data &&
parseInt(this.props.logoSiteList.data.expiredTime) - Date.now();
const monthLineChartListMenus = [];
const weekLineChartListMenus = [];
const yesterdayLineChartListMenus = [];
for (var i in this.props.accountToMonthList.data &&
this.props.accountToMonthList.data.pieChart) {
monthLineChartListMenus.push(i);
}
for (var i in this.props.accountToWeekList.data &&
this.props.accountToWeekList.data.pieChart) {
weekLineChartListMenus.push(i);
}
for (var i in this.props.accountToYesterdayList.data &&
this.props.accountToYesterdayList.data.pieChart) {
yesterdayLineChartListMenus.push(i);
}
// console.log(
// "this.props.activeAccountList.data&&this.props.activeAccountList.data.accountActivePercentage",
// yesterdayLineChartListMenus && yesterdayLineChartListMenus[0]
// );
return (
<div>
<Row style={{ marginTop: "20px" }}>
<Col span={18}>
<Row type="flex">
<Col span={6}>
<div className={styles.homepage_header}>
<span>
<p>上周</p>
<div
className={styles.homepage_tag}
style={{ backgroundColor: "#336699" }}
>
{this.props.activeAccountList.data &&
parseFloat(this.props.activeAccountList.data.weekChain) >
0 ? (
<p style={{ marginTop: "-10px", color: "#ffffff" }}>
{this.props.activeAccountList.data &&
`+${this.props.activeAccountList.data.weekChain}`}
</p>
) : (
<p
style={{
marginTop: "-10px",
color: "#ffffff",
textAlign: "center",
}}
>
{this.props.activeAccountList.data &&
this.props.activeAccountList.data.weekChain}
</p>
)}
</div>
<div
// className="homepage-tag-must"
className={styles.homepage_tag_must}
/>
</span>
<Card
style={{ width: "100%", backgroundColor: "#ffffff" }}
bordered={false}
>
{/* bug-11956-jmy 百分比显示不全 bug-12345-jmy 百分比后的箭头显示不出来*/}
<Meta
style={{ marginRight: "-10px" }}
avatar={
<Icon
type="user"
style={{
fontSize: "48px",
marginRight: "-10px",
marginLeft: "-16px",
}}
/>
}
title={
<Statistic
value={
this.props.activeAccountList.data &&
this.props.activeAccountList.data
.accountActivePercentage == "-"
? "0.00%"
: this.props.activeAccountList.data &&
this.props.activeAccountList.data
.accountActivePercentage
? this.props.activeAccountList.data &&
this.props.activeAccountList.data
.accountActivePercentage
: "0.00%"
}
precision={0}
valueStyle={{ color: "#3f8600" }}
suffix={
this.props.activeAccountList.data &&
parseFloat(
this.props.activeAccountList.data.weekChain
) > 0 ? (
<Icon type="arrow-up" />
) : this.props.activeAccountList.data &&
parseFloat(
this.props.activeAccountList.data.weekChain
) < 0 ? (
<Icon type="arrow-down" />
) : (
false
)
}
/>
}
description="活跃用户比例"
/>
</Card>
</div>
</Col>
<Col span={6}>
<div
// className="homepage-header"
className={styles.homepage_header}
>
<span>
<p>上周</p>
<div
// className="homepage-tag"
className={styles.homepage_tag}
style={{ backgroundColor: "#009933" }}
>
{this.props.courseTimeList.data &&
parseFloat(this.props.courseTimeList.data.weekChain) >
0 ? (
<p style={{ marginTop: "-10px", color: "#ffffff" }}>
{this.props.courseTimeList.data &&
`+${this.props.courseTimeList.data.weekChain}`}
</p>
) : (
<p
style={{
marginTop: "-10px",
color: "#ffffff",
textAlign: "center",
}}
>
{this.props.courseTimeList.data &&
this.props.courseTimeList.data.weekChain}
</p>
)}
</div>
<div
// className="homepage-tag-must"
className={styles.homepage_tag_must}
/>
</span>
<Card
style={{ width: "100%", backgroundColor: "#ffffff" }}
bordered={false}
>
{/* bug-11956-jmy 百分比显示不全 bug-12345-jmy 百分比后的箭头显示不出来*/}
<Meta
style={{ marginRight: "-10px" }}
avatar={
<Icon
type="calendar"
style={{
fontSize: "48px",
marginRight: "-10px",
marginLeft: "-16px",
}}
/>
}
title={
<Statistic
valueStyle={{ fontSize: "16px" }}
value={
this.props.courseTimeList.data &&
this.props.courseTimeList.data.timeCount
}
precision={0}
valueStyle={{ color: "#3f8600" }}
suffix={
this.props.courseTimeList.data &&
parseFloat(
this.props.courseTimeList.data.weekChain
) > 0 ? (
<Icon type="arrow-up" />
) : this.props.courseTimeList.data &&
parseFloat(
this.props.courseTimeList.data.weekChain
) < 0 ? (
<Icon type="arrow-down" />
) : (
false
)
}
/>
}
description="课程学习总时长(h)"
/>
</Card>
</div>
</Col>
<Col span={6}>
<div
// className="homepage-header"
className={styles.homepage_header}
>
<span>
<p>上周</p>
<div
// className="homepage-tag"
className={styles.homepage_tag}
style={{ backgroundColor: "#993366" }}
>
{this.props.courseFinishList.data &&
parseFloat(this.props.courseFinishList.data.weekChain) >
0 ? (
<p style={{ marginTop: "-10px", color: "#ffffff" }}>
{this.props.courseFinishList.data &&
`+${this.props.courseFinishList.data.weekChain}`}
</p>
) : (
<p
style={{
marginTop: "-10px",
color: "#ffffff",
textAlign: "center",
}}
>
{this.props.courseFinishList.data &&
this.props.courseFinishList.data.weekChain}
</p>
)}
</div>
<div
// className="homepage-tag-must"
className={styles.homepage_tag_must}
/>
</span>
<Card
style={{ width: "100%", backgroundColor: "#ffffff" }}
bordered={false}
>
{/* bug-11956-jmy 百分比显示不全 bug-12345-jmy 百分比后的箭头显示不出来*/}
<Meta
style={{ marginRight: "-10px" }}
avatar={
<Icon
type="play-square"
style={{
fontSize: "48px",
marginRight: "-10px",
marginLeft: "-16px",
}}
/>
}
title={
<Statistic
value={
this.props.courseFinishList.data &&
this.props.courseFinishList.data.finishCount
}
precision={0}
valueStyle={{ color: "#3f8600" }}
suffix={
this.props.courseFinishList.data &&
parseFloat(
this.props.courseFinishList.data.weekChain
) > 0 ? (
<Icon type="arrow-up" />
) : this.props.courseFinishList.data &&
parseFloat(
this.props.courseFinishList.data.weekChain
) < 0 ? (
<Icon type="arrow-down" />
) : (
false
)
}
/>
}
description="完成课程数"
/>
</Card>
</div>
</Col>
<Col span={6}>
<div
// className="homepage-header"
className={styles.homepage_header}
>
<span>
<p>上周</p>
<div
// className="homepage-tag"
className={styles.homepage_tag}
style={{ backgroundColor: "#FFCC00" }}
>
{this.props.tpFinishList.data &&
parseFloat(this.props.tpFinishList.data.weekChain) > 0 ? (
<p style={{ marginTop: "-10px", color: "#ffffff" }}>
{this.props.tpFinishList.data &&
`+${this.props.tpFinishList.data.weekChain}`}
</p>
) : (
<p
style={{
marginTop: "-10px",
color: "#ffffff",
textAlign: "center",
}}
>
{this.props.tpFinishList.data &&
this.props.tpFinishList.data.weekChain}
</p>
)}
</div>
<div
// className="homepage-tag-must"
className={styles.homepage_tag_must}
/>
</span>
<Card
style={{ width: "100%", backgroundColor: "#ffffff" }}
bordered={false}
>
{/* bug-11956-jmy 百分比显示不全 bug-12345-jmy 百分比后的箭头显示不出来*/}
<Meta
style={{ marginRight: "-10px" }}
avatar={
<Icon
type="desktop"
style={{
fontSize: "48px",
marginRight: "-10px",
marginLeft: "-16px",
}}
/>
}
title={
<Statistic
value={
this.props.tpFinishList.data &&
this.props.tpFinishList.data.tpFinishPercentage ==
"-"
? "0.00%"
: this.props.tpFinishList.data &&
this.props.tpFinishList.data.tpFinishPercentage
? this.props.tpFinishList.data &&
this.props.tpFinishList.data.tpFinishPercentage
: "0.00%"
}
valueStyle={{ color: "#3f8600" }}
suffix={
this.props.tpFinishList.data &&
parseFloat(this.props.tpFinishList.data.weekChain) >
0 ? (
<Icon type="arrow-up" />
) : this.props.tpFinishList.data &&
parseFloat(
this.props.tpFinishList.data.weekChain
) < 0 ? (
<Icon type="arrow-down" />
) : (
false
)
}
// suffix="%"
/>
}
description="项目通过率"
/>
</Card>
</div>
</Col>
</Row>
<Row type="flex">
<div
// className="homepage-content"
className={styles.homepage_content}
>
<div>
<span
style={{
marginTop: "10px",
marginBottom: "10px",
paddingLeft: "32px",
fontWeight: "bold",
}}
>
站点全员访问分布数据
</span>
<span
style={{
float: "right",
width: "300px",
marginRight: "3%",
}}
>
<Select defaultValue="1" onChange={this.handleChange}>
<Option value="1">登录人数</Option>
<Option value="2">登录人次</Option>
</Select>
{/* </span>
<span style={{marginTop:"10px"}}> */}
<Radio.Group
// className="serch-time"
className={styles.serch_time}
defaultValue={"1"}
onChange={this.onChangeOption}
style={{ marginLeft: "2%" }}
>
<Radio.Button value="1">昨日</Radio.Button>
<Radio.Button value="2">按周</Radio.Button>
<Radio.Button value="3">按月</Radio.Button>
</Radio.Group>
{/* <a style={{marginLeft:"10px"}} onClick={()=>this.setState({optionValue:1},()=>{this.props.accountToYesterdayNumber()})}>昨日</a>
<a style={{marginLeft:"10px"}} onClick={()=>this.setState({optionValue:2},()=>{this.props.accountToWeekNumber()})}>按周</a>
<a style={{marginLeft:"10px"}} onClick={()=>this.setState({optionValue:3},()=>{this.props.accountToMonthNumber()})}>按月</a> */}
</span>
<div style={{ marginTop: "20px" }}>
{optionValue == 3 ? (
<ReactEcharts
option={this.optionMonth("line")}
notMerge
lazyUpdate
theme={"theme_name"}
/>
) : optionValue == 2 ? (
<ReactEcharts
option={this.optionWeek("line")}
notMerge
lazyUpdate
theme={"theme_name"}
/>
) : (
<ReactEcharts
option={this.optionDay("line")}
notMerge
lazyUpdate
theme={"theme_name"}
/>
)}
</div>
</div>
<div>
{/* bug-12128-jmy 样式修改 */}
<Row>
<Col span={11}>
<ReactEcharts
style={{ height: "380px" }}
option={this.optionPeople("line")}
notMerge
lazyUpdate
theme={"theme_name"}
/>
</Col>
<Col span={11}>
<ReactEcharts
style={{ height: "380px" }}
option={this.optionNumber("line")}
notMerge
lazyUpdate
theme={"theme_name"}
/>
</Col>
<Col span={2}>
<div></div>
<Select
style={{
width: "150px",
position: "absolute",
marginLeft: "-120%",
}}
value={this.state.selectName}
onChange={this.onChangeSelect}
>
{optionValue == 1
? yesterdayLineChartListMenus.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
: optionValue == 2
? weekLineChartListMenus.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
: monthLineChartListMenus.map((item, index) => {
return (
<Option value={item} key={item}>
{index}
</Option>
);
})}
</Select>
</Col>
</Row>
</div>
</div>
</Row>
</Col>
<Col span={6}>
<div
// className="homepage-right-top"
className={styles.homepage_right_top}
>
<img
// className="user-img"
className={styles.user_img}
width={30}
style={{ borderRadiu: "50%" }}
height={30}
src={
this.props.logoSiteList.data &&
this.props.logoSiteList.data.logo
? this.props.logoSiteList.data &&
this.props.logoSiteList.data.logo
: defaultLogo
}
/>
{/* bug-11957-jmy 图片盖住了文字*/}
<p
style={{
paddingTop: "40%",
fontSize: "24px",
textAlign: "center",
marginBottom: "14px",
color: "#747474",
}}
>
{this.props.logoSiteList.data &&
this.props.logoSiteList.data.name}
</p>
{/* <p style={{fontSize:"14px",textAlign:"center",color:"FFCC00"}}>{moment(window.JSON.parse(sessionStorage.userInfo).createTime-window.JSON.parse(sessionStorage.userInfo).expiredTime).format('YYYY年MM月DD天到期')}</p> */}
{/* {this.props.logoSiteList.data &&
parseInt(this.props.logoSiteList.data.expiredTime) &&
line > 0 ? (
<Countdown
valueStyle={{
fontSize: "14px",
textAlign: "center",
color: "#FCA608",
}}
value={deadline}
format="Y年D天到期"
/>
) : (
<Countdown
valueStyle={{
fontSize: "14px",
textAlign: "center",
color: "#FCA608",
}}
value={""}
format={"已过期"}
/>
)} */}
</div>
<div
// className="homepage-right-mid"
className={styles.homepage_right_mid}
>
<div
style={{
height: "41px",
position: "absolute",
zIndex: "2",
backgroundColor: "#ffffff",
width: "88%",
}}
>
<p>近期事项</p>
<Divider style={{ margin: "0px" }} />
</div>
{/* border:"2px solid red", */}
<div
style={{
overflow: "auto",
marginTop: "40px",
padding: "0 2% 0 0",
}}
>
{this.props.accountReadyTaskList.data &&
this.props.accountReadyTaskList.data.map((item, index) => (
<div key={index}>
<Row>
<Col span={4}>
<Icon
type="mobile"
style={{
fontSize: "20px",
marginTop: "20%",
marginLeft: "50%",
}}
/>
</Col>
<Col span={20}>
{item.type == 1 ? (
<Link
to={`/${companyCode}/${siteCode}/index/tool/test/check-management/check?id=${item.taskId}`}
>
<p style={{ fontSize: "normal" }}>
{item.taskName}
</p>
</Link>
) : item.type == 3 ? (
<Link
to={`/${companyCode}/${siteCode}/index/tool/live/livemanage`}
>
<p style={{ fontSize: "normal" }}>
{item.taskName}
</p>
</Link>
) : (
<Link
to={`/${companyCode}/${siteCode}/index/manager/system/taskLog`}
>
<p style={{ fontSize: "normal" }}>
{item.taskName}
</p>
</Link>
)}
{item.type == 1 ? (
<p
style={{
fontWeight: "normal",
fontSize: "12px",
color: "#cccccc",
}}
>
{item.taskName}考试结束,可以进行阅卷
</p>
) : item.type == 3 ? (
<p
style={{
fontWeight: "normal",
fontSize: "12px",
color: "#cccccc",
}}
>
{item.taskName}直播结束,可以查看直播数据
</p>
) : (
<p
style={{
fontWeight: "normal",
fontSize: "12px",
color: "#cccccc",
}}
>
你有一条新任务,请查看下载
</p>
)}
<p
style={{
fontWeight: "normal",
fontSize: "12px",
color: "red",
}}
>
{moment(item.taskEndDate).format("YYYY年MM月DD日")}
</p>
</Col>
</Row>
<Divider style={{ margin: "0px" }} />
</div>
))}
</div>
</div>
<div
// className="homepage-right-bottom"
className={styles.homepage_right_bottom}
>
<p style={{ marginLeft: "10px" }}>常用功能入口</p>
<Divider style={{ margin: "0px" }} />
<div style={{ marginTop: "10px" }}>
<Row>
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[0] ? (
<Col span={8}>
<Link
to={`/${companyCode}/${siteCode}${this.props
.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[0] &&
this.props.usedFunctionsList.data[0].url}`}
>
{/* bug-12100-jmy 图片和文字居中 */}
<Icon
type="user"
style={{
width: "100%",
textAlign: "center",
marginLeft: "0px",
}}
/>
<p
style={{
fontWeight: "normal",
width: "100%",
textAlign: "center",
}}
>
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[0] &&
this.props.usedFunctionsList.data[0].name}
</p>
</Link>
</Col>
) : null}
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[1] ? (
<Col span={8}>
<Link
to={`/${companyCode}/${siteCode}${this.props
.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[1] &&
this.props.usedFunctionsList.data[1].url}`}
>
{/* bug-12100-jmy 图片和文字居中 */}
<Icon
type="file-sync"
style={{
width: "100%",
textAlign: "center",
marginLeft: "0px",
}}
/>
<p
style={{
fontWeight: "normal",
width: "100%",
textAlign: "center",
}}
>
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[1] &&
this.props.usedFunctionsList.data[1].name}
</p>
</Link>
</Col>
) : null}
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[2] ? (
<Col span={8}>
<Link
to={`/${companyCode}/${siteCode}${this.props
.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[2] &&
this.props.usedFunctionsList.data[2].url}`}
>
{/* bug-12100-jmy 图片和文字居中 */}
<Icon
type="form"
style={{
width: "100%",
textAlign: "center",
marginLeft: "0px",
}}
/>
<p
style={{
fontWeight: "normal",
width: "100%",
textAlign: "center",
}}
>
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[2] &&
this.props.usedFunctionsList.data[2].name}
</p>
</Link>
</Col>
) : null}
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[3] ? (
<Col span={8}>
<Link
to={`/${companyCode}/${siteCode}${this.props
.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[3] &&
this.props.usedFunctionsList.data[3].url}`}
>
{/* bug-12100-jmy 图片和文字居中 */}
<Icon
type="shopping"
style={{
width: "100%",
textAlign: "center",
marginLeft: "0px",
}}
/>
<p
style={{
fontWeight: "normal",
width: "100%",
textAlign: "center",
}}
>
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[3] &&
this.props.usedFunctionsList.data[3].name}
</p>
</Link>
</Col>
) : null}
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[4] ? (
<Col span={8}>
<Link
to={`/${companyCode}/${siteCode}${this.props
.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[4] &&
this.props.usedFunctionsList.data[4].url}`}
>
{/* bug-12100-jmy 图片和文字居中 */}
<Icon
type="book"
style={{
width: "100%",
textAlign: "center",
marginLeft: "0px",
}}
/>
<p
style={{
fontWeight: "normal",
width: "100%",
textAlign: "center",
}}
>
{this.props.usedFunctionsList &&
this.props.usedFunctionsList.data &&
this.props.usedFunctionsList.data[4] &&
this.props.usedFunctionsList.data[4].name}
</p>
</Link>
</Col>
) : null}
</Row>
</div>
</div>
</Col>
</Row>
</div>
);
}
}
export default connect(state => ({ ...state.homePage }), { ...actions })(
withRouter(createForm()(homePage))
);
export const ACTION_LIST = "ACTION_LIST";
export const EXAM_LIST = "EXAM_LIST";
export const PHB_CHART = "PHB_CHART";
export const DLL_DATA = "DLL_DATA";
export const LLL_DATA = "LLL_DATA";
......
......@@ -14,6 +14,18 @@ export function getActionList() {
});
};
}
// 培训测试--按组织方统计“发起次数”列表
export function queryExamNum() {
const url = `${getUrl}/web-manage/manage/api/eventTrack/queryExamNum`;
return dispatch => {
return request({
url,
}).then(res => {
dispatch({ type: Types.EXAM_LIST, data: res.data });
});
};
}
export function getPhbChartList(data) {
const url = `${getUrl}/web-manage/manage/point/user/new/rank/list`;
return dispatch => {
......
......@@ -19,6 +19,10 @@ function homePage(state = initialState, action) {
return Object.assign({}, state, {
actionList: action.data,
});
case Types.EXAM_LIST:
return Object.assign({}, state, {
examList: action.data,
});
case Types.PHB_CHART:
return Object.assign({}, state, {
pbhChartList: action.data,
......
......@@ -424,42 +424,6 @@
.box1 .row1 {
display: flex;
justify-content: space-between;
height: 460px;
}
.box1 .row1 > div:nth-child(1) {
padding: 20px 15px;
width: 57.85%;
}
.box1 .row1 > div:nth-child(2) {
padding: 20px 15px;
width: 40.91%;
}
.box1 .row2 {
display: flex;
justify-content: space-between;
margin-top: 12px;
height: 460px;
}
.box1 .row2 > div:nth-child(1) {
padding: 20px 15px;
width: 25%;
}
.box1 .row2 > div:nth-child(2) {
width: 75%;
}
.box1 > div:nth-child(2) {
display: flex;
justify-content: space-between;
}
.box1 > div:nth-child(2) > .tgchart {
width: 45%;
}
.box1 > div:nth-child(2) > .lineData {
width: 53%;
}
.box1 .row1 {
display: flex;
justify-content: space-between;
height: 500px;
}
.box1 .row1 > div:nth-child(1) {
......@@ -740,6 +704,7 @@
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(2) > .chartList {
width: 50%;
......@@ -758,11 +723,95 @@
margin-top: -10px;
margin-bottom: -30px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) {
display: flex;
align-items: center;
justify-content: space-between;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox {
margin-top: 12px;
display: flex;
align-items: center;
justify-content: space-between;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum1 {
width: 100px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum1 .red {
background: linear-gradient(270deg, #ba4048 0%, #e22020);
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum1 > div {
background: #f5f6f7;
height: 24px;
opacity: 0.7;
line-height: 24px;
color: #4a5154;
font-size: 12px;
font-family: PingFang SC, PingFang SC-400;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 12px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum1 > p {
margin: 0;
height: 24px;
line-height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum1 > p > span:nth-child(1) {
height: 8px;
width: 8px;
border-radius: 50%;
display: block;
margin-right: 5px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum1 > p > p:nth-child(2) {
display: block;
font-size: 14px;
font-family: PingFang SC, PingFang SC-500;
font-weight: 500;
color: #4a5154;
text-align: center;
margin: 0;
height: 30px;
line-height: 30px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum {
width: 100px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum > div {
background: #f5f6f7;
height: 26px;
opacity: 0.7;
line-height: 26px;
color: #4a5154;
font-size: 12px;
font-family: PingFang SC, PingFang SC-400;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 12px;
}
.box1 .row1 > div:nth-child(2) > div:nth-child(3) > .exambox > .zllNum > p {
margin: 0;
height: 24px;
line-height: 24px;
font-size: 14px;
font-family: PingFang SC, PingFang SC-500;
font-weight: 500;
color: #4a5154;
text-align: center;
}
.box1 .row2 {
display: flex;
justify-content: space-between;
margin-top: 12px;
height: 460px;
height: 500px;
}
.box1 .row2 > div:nth-child(1) {
padding: 20px 15px;
......
......@@ -443,50 +443,6 @@
line-height: 25px !important;
}
}
& .row1 {
display: flex;
justify-content: space-between;
height: 460px;
& > div:nth-child(1) {
padding: 20px 15px;
width: 57.85%; // 将固定700px改为百分比 (700/1210)
// ... existing code ...
}
& > div:nth-child(2) {
padding: 20px 15px;
width: 40.91%; // 将固定495px改为百分比 (495/1210)
// ... existing code ...
}
}
& .row2 {
display: flex;
justify-content: space-between;
margin-top: 12px;
height: 460px;
& > div:nth-child(1) {
padding: 20px 15px;
width: 25%; // 将固定240px改为百分比 (240/1210)
// ... existing code ...
}
& > div:nth-child(2) {
width: 75%; // 将固定955px改为百分比 (955/1210)
// ... existing code ...
}
}
& > div:nth-child(2) {
display: flex;
justify-content: space-between;
& > .tgchart {
width: 45%; // 将固定380px改为百分比 (380/845)
// ... existing code ...
}
& > .lineData {
width: 53%; // 将固定580px改为百分比 (580/845)
// ... existing code ...
}
}
width: 100%;
& .row1 {
display: flex;
......@@ -770,6 +726,7 @@
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
& > .chartList {
width: 50%;
& > p {
......@@ -788,13 +745,98 @@
}
}
}
& > div:nth-child(3) {
display: flex;
align-items: center;
justify-content: space-between;
& > .exambox {
margin-top: 12px;
display: flex;
align-items: center;
justify-content: space-between;
& > .zllNum1 {
width: 100px;
& .red {
background: linear-gradient(270deg, #ba4048 0%, #e22020);
}
& > div {
background: #f5f6f7;
height: 24px;
opacity: 0.7;
line-height: 24px;
color: #4a5154;
font-size: 12px;
font-family: PingFang SC, PingFang SC-400;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 12px;
}
& > p {
margin: 0;
height: 24px;
line-height: 24px;
display: flex;
align-items: center;
justify-content: center;
& > span:nth-child(1) {
height: 8px;
width: 8px;
border-radius: 50%;
display: block;
margin-right: 5px;
}
& > p:nth-child(2) {
display: block;
font-size: 14px;
font-family: PingFang SC, PingFang SC-500;
font-weight: 500;
color: #4a5154;
text-align: center;
margin: 0;
height: 30px;
line-height: 30px;
}
}
}
& > .zllNum {
width: 100px;
& > div {
background: #f5f6f7;
height: 26px;
opacity: 0.7;
line-height: 26px;
color: #4a5154;
font-size: 12px;
font-family: PingFang SC, PingFang SC-400;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 12px;
}
& > p {
margin: 0;
height: 24px;
line-height: 24px;
font-size: 14px;
font-family: PingFang SC, PingFang SC-500;
font-weight: 500;
text-align: center;
color: #4a5154;
text-align: center;
}
}
}
}
}
}
& .row2 {
display: flex;
justify-content: space-between;
margin-top: 12px;
height: 460px;
height: 500px;
& > div:nth-child(1) {
padding: 20px 15px;
width: 18%;
......
import React, { Component } from "react";
import styles from "./index.less";
import {
Form,
Input,
Radio,
Row,
Col,
message,
} from "antd";
import { Form, Input, Radio, Row, Col, message } from "antd";
import UploadUtil from "../component/UploadUtil";
const { TextArea } = Input;
const FormItem = Form.Item;
......@@ -86,7 +79,7 @@ class TestModal extends Component {
this.setState({ keywords: tags.join() });
};
render() {
const { defaultValue } = this.props;
const { defaultValue, status } = this.props;
const { radioNum } = this.state;
const { getFieldDecorator, getFieldValue } = this.props.form;
const formItemLayout = {
......@@ -125,17 +118,29 @@ class TestModal extends Component {
message: "不能超过200个字符",
},
],
})(<TextArea rows={4} />)}
</FormItem>
<FormItem
{...formItemLayout}
style={{ marginLeft: 85, marginTop: -15 }}
>
{getFieldDecorator(
"contentAppendixUrl",
{}
)(<UploadUtil {...this.props.uploadProps} />)}
})(<TextArea rows={4} disabled={status === "look"} />)}
</FormItem>
{status === "look" && (
<div>
<img
src={defaultValue.contentAppendixUrl}
alt=""
style={{ width: "200px", height: "160px" }}
/>
</div>
)}
{status !== "look" && (
<FormItem
{...formItemLayout}
style={{ marginLeft: 85, marginTop: -15 }}
>
{getFieldDecorator(
"contentAppendixUrl",
{}
)(<UploadUtil {...this.props.uploadProps} />)}
</FormItem>
)}
<div className={styles.sur_test_option} id="dselect">
<RadioGroup style={{ width: "100%" }}>
{radioNum === 1 && (
......@@ -148,7 +153,7 @@ class TestModal extends Component {
</Row>
{keys1.map((item, k) => {
return (
<Row gutter={23}>
<Row gutter={23} key={item.no}>
<FormItem style={{ display: "none" }}>
{getFieldDecorator(`no[${item.no}]`, {
initialValue: item.no,
......@@ -169,7 +174,7 @@ class TestModal extends Component {
message: "不能超过200个字符",
},
],
})(<TextArea />)}
})(<TextArea disabled={status === "look"} />)}
</FormItem>
</Col>
</Row>
......
......@@ -239,12 +239,7 @@ class Details extends Component {
const param = {
type: values.type,
content: values.content,
//bug-9797-liyuan 附件回显
contentAppendixUrl: this.state.fileUrl
? this.state.fileUrl
: this.state.testItem.contentAppendixUrl
? this.state.testItem.contentAppendixUrl
: "",
contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : "",
needAnswer: values.needAnswer ? 1 : 0,
questionOptions: objs,
maxSelectItem: values.needAnswer2 ? values.maxSelectItem : "",
......@@ -308,6 +303,7 @@ class Details extends Component {
const { details, tlist, jumptests, surid } = this.props;
const uploadProps = {
uploadUtilName: "上传图片",
status: "look",
getUrl: (fileUrl, fileName) => {
this.setState({
fileUrl,
......@@ -445,6 +441,7 @@ class Details extends Component {
style={{ marginLeft: "170px" }}
relationId={this.id}
remind={details.remind}
usable={true}
relationType={3}
wrappedComponentRef={form => (this.messageRemind = form)}
/>
......@@ -453,6 +450,7 @@ class Details extends Component {
formItemLayout={formItemLayout}
style={{ marginLeft: "170px" }}
relationType={3}
usable={true}
wrappedComponentRef={form => (this.messageRemind = form)}
/>
)}
......@@ -565,6 +563,7 @@ class Details extends Component {
jumptests={jumptests}
ref={obj => (this.newTest = obj)}
uploadProps={uploadProps}
status={"look"}
/>
</Modal>
)}
......
......@@ -14,13 +14,15 @@ class UploadUtil extends Component {
uploadAction: {},
originalFileName: "",
fileList: [],
newFileList: [],
newFileList: "",
key: "",
processNum: 0, //进度条--liyuan
};
}
//修改一
componentDidMount() {}
componentDidMount() {
console.log(this.props.status, this.props.defaultUrl, "222222222222");
}
beforeUpload = (file, fileList) => {
// 文件大小判断 图片小于3M 文件小于200M
......@@ -59,7 +61,6 @@ class UploadUtil extends Component {
//上传
handleChange = info => {
let fileList = info.fileList;
// 限制只能上传一张图片:如果文件列表长度大于1,只保留最后一个文件
if (fileList.length > 1) {
fileList = [fileList[fileList.length - 1]];
}
......@@ -70,34 +71,18 @@ class UploadUtil extends Component {
if (info.file.status === "done") {
// 清空之前的文件列表,确保只保留一个文件
this.setState({ newFileList: [] });
this.setState({ newFileList: "" });
fileList.map(item => {
if (item.status === "done") {
// 检查 item.response.data 是否存在且不为 undefined
if (
item?.response?.data &&
this.state.newFileList.indexOf(item.response.data) === -1
) {
this.state.newFileList.push(item.response.data);
}
// 检查 item.url 是否存在且不为 undefined
if (item.url && this.state.newFileList.indexOf(item.url) === -1) {
this.state.newFileList.push(item.url);
}
this.state.newFileList = item.response.data;
}
});
message.success("上传成功");
} else if (info.file.status === "error") {
message.error("上传失败,请重新尝试");
}
if (this.props.getUrl) {
// 修改:返回字符串而不是数组,取第一个元素或空字符串
const urlString =
this.state.newFileList.length > 0 ? this.state.newFileList[0] : "";
this.props.getUrl(urlString);
}
this.props.getUrl(this.state.newFileList);
this.setState({ fileList });
};
......@@ -109,26 +94,7 @@ class UploadUtil extends Component {
};
fnRemove = e => {
if (this.props.defaultUrl) {
// 遍历 defaultUrl 数组,将每个对象的 url 合并到 newFileList 中,避免重复添加
this.props.defaultUrl.forEach(item => {
if (item.url && !this.state.newFileList.includes(item.url)) {
this.state.newFileList.push(item.url);
}
});
}
if (e.url) {
this.state.newFileList.splice(this.state.newFileList.indexOf(e.url), 1);
} else {
this.state.newFileList.splice(
this.state.newFileList.indexOf(e.response.data),
1
);
}
// 修改:返回字符串而不是数组
const urlString =
this.state.newFileList.length > 0 ? this.state.newFileList[0] : "";
this.props.getUrl(urlString);
this.props.getUrl("");
};
render() {
......@@ -136,9 +102,7 @@ class UploadUtil extends Component {
const { getFieldDecorator } = this.props.form;
return (
<Form>
<FormItem
extra={"请上传资源附件(附件格式:mp4、png、jpg、jpeg、gif)"}
>
<FormItem extra={"请上传资源附件(附件格式:png、jpg、jpeg、gif)"}>
{getFieldDecorator("upload", {
valuePropName: "fileList",
getValueFromEvent: this.normFile,
......@@ -160,15 +124,6 @@ class UploadUtil extends Component {
</Button>
</Upload>
)}
{this.state.processNum != 0 && this.state.processNum != 100 && (
<p>
<Progress
percent={this.state.processNum}
strokeWidth={5}
showInfo={false}
/>
</p>
)}
</FormItem>
</Form>
);
......
......@@ -163,13 +163,6 @@ class Survey extends Component {
message.error(data.subMsg);
console.log(key, "111111", searchValue, pageSize);
}
// console.log(key,"22222222",searchValue,pageSize)
// this.props.getlist({
// state:key,
// name:searchValue,
// pageNo:1,
// pageSize:pageSize
// })
});
}
......@@ -353,7 +346,7 @@ class Survey extends Component {
{action2}
</a>
</Popconfirm>
{key == 2 ? (
{key == 2 || key == 0 ? (
<div>
<Popconfirm
title="确定要删除吗?"
......@@ -381,13 +374,6 @@ class Survey extends Component {
>
投票明细导出
</div>
{/* <div
className={styles.survey_list_btn}
style={{ cursor: "pointer", color: "#1890FF" }}
onClick={() => this.detil(record.id, 2)}
>
投票分析导出
</div> */}
</div>
) : null}
</div>
......
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