Commit f4bdeb04 authored by wangxuelai's avatar wangxuelai

'最新代码提交'

parent 585967c2
......@@ -37,7 +37,7 @@ export default {
uploadTaskList: [],
taskListQueryParams: {
page: 1,
perPage: 20,
perPage: 10,
},
uploadTaskTotal: 0,
countdown: 60,
......@@ -293,13 +293,14 @@ export default {
payload: {
signature,
files,
uploaderLoading,
},
});
}
},
* uploadexcel({ payload }, { call, put }) {
const {
signature, files,
signature, files, uploaderLoading,
} = payload;
const file = files ? files[0] : null;
const filename = `${signature.dir}${getRandomFilename(file.name)}`;
......@@ -313,10 +314,11 @@ export default {
};
const uploadExcel = yield call(uploader.uploadImg, params);
const fileName = `https://shangjiadao.oss-cn-hangzhou.aliyuncs.com/${filename}`;
console.log(file, 'file');
document.getElementById('uploadexcel').value = '';
yield put({
type: 'uploadStudents',
payload: {
uploaderLoading,
file_name: fileName,
file_info: JSON.stringify({
name: file.name || '',
......@@ -327,7 +329,7 @@ export default {
});
},
* uploadStudents({ payload }, { call, put, select }) {
const { file_name, file_info } = payload;
const { file_name, file_info, uploaderLoading } = payload;
const { sid } = yield select(state => state.webapp);
const importData = yield call(crmAjax.uploadStudents, {
file_name,
......@@ -335,8 +337,10 @@ export default {
school_id: sid,
type: 1,
});
setTimeout(uploaderLoading);
const { code, data } = importData;
if (code == 200) {
message.success('导入学员成功');
yield put({
type: 'queryUploadTasks',
payload: {
......
......@@ -17,6 +17,7 @@ import {
Pagination,
Tooltip, DatePicker,
Divider,
Popover,
} from 'antd';
import moment from 'moment';
import { routerRedux } from 'dva/router';
......@@ -53,6 +54,14 @@ class ClueImport extends React.Component {
upload,
refresh,
} = this.props;
const PopoverContent = (props) => {
const { error_message } = props.content;
return (
<div style={{ maxHeight: 200, overflowY: 'auto' }}>
{error_message.data.map(ele => <div><div style={{ fontWeight: 700, fontSize: 16 }}>{ele.mobile}:</div>{ele.msg.map(msg => <div>{msg}</div>)}</div>)}
</div>
);
};
const columns = [
{
title: '文件名',
......@@ -66,7 +75,7 @@ class ClueImport extends React.Component {
fileInfo = {};
}
return (
<span className="hreflink">{fileInfo.name || record.file_name}</span>
<span>{fileInfo.name || record.file_name}</span>
);
},
},
......@@ -91,11 +100,33 @@ class ClueImport extends React.Component {
key: 'status',
render: (text, record) => {
return (
<span>
{record.status == 1 && '正在上传'}
<div>
{/* {record.status == 1 && '正在上传'}
{record.status == 2 && '上传成功'}
{record.status == 3 && '上传失败'}
</span>
{record.status == 3 && '上传失败'} */}
<div className={pageStyle.uploadStatus}>
<div className={`${pageStyle.dot} ${pageStyle.totaldot}`} />
<div className={pageStyle.totalcounttext}>总共{record.total}</div>
</div>
<div className={pageStyle.uploadStatus}>
<div className={`${pageStyle.dot} ${pageStyle.successdot}`} />
<div className={pageStyle.successcounttext}>成功{record.success_total}</div>
</div>
{record.failed_total == 0 &&
<div className={pageStyle.uploadStatus}>
<div className={`${pageStyle.dot} ${pageStyle.faildot}`} />
<div className={pageStyle.failcounttext}>失败{record.failed_total}</div>
</div>
}
{record.failed_total > 0 &&
<Popover content={<PopoverContent content={record} />} trigger="hover">
<div className={pageStyle.uploadStatus}>
<div className={`${pageStyle.dot} ${pageStyle.faildot}`} />
<div className={pageStyle.failcounttext}>失败{record.failed_total}<span style={{ fontSize: 12 }}>(悬浮鼠标查看失败原因)</span></div>
</div>
</Popover>
}
</div>
);
},
},
......@@ -117,17 +148,17 @@ class ClueImport extends React.Component {
<div style={{ marginBottom: 20, display: 'flex', justifyContent: 'space-between' }} >
<div>
<Button size="small" type="primary" style={{ marginRight: 20 }} onClick={goBindSjdAccount}>关联商家岛账号</Button>
<Button size="small" type="primary" style={{ marginRight: 20, position: 'relative' }}><input onChange={upload} type="file" className={pageStyle.uploadExcel} accept=".xls, .xlsx" />上传表格</Button>
<Button size="small" type="primary" style={{ marginRight: 20, position: 'relative' }}><input id="uploadexcel" onChange={upload} type="file" className={pageStyle.uploadExcel} accept=".xls, .xlsx" />上传表格</Button>
<Button size="small" type="primary"style={{ marginRight: 5 }} onClick={this.downLoadExcelTemp}>下载模板</Button>
<Tooltip placement="top" title="下载规定模板,按照顺序要求填写潜在学员信息,即可上传">
<Icon type="question-circle" theme="filled" style={{ opacity: 0.5, fontSize: 18, cursor: 'pointer' }} />
</Tooltip>
</div>
<div>
{/* <div>
<Tooltip placement="top" title="点击更新文件上传进度">
<Icon type="sync" style={{ marginLeft: 150, fontSize: 18, cursor: 'pointer' }} onClick={refresh} />
</Tooltip>
</div>
</div> */}
</div>
<Table
rowKey="id"
......
......@@ -38,4 +38,32 @@
left: 0;
top: 0;
opacity: 0;
}
.uploadStatus {
display: flex;
align-items: center;
.totalcounttext {
color: #1890ff;
}
.successcounttext {
color: #52c41a;
}
.failcounttext {
color: red;
}
.dot {
width: 5px;
height: 5px;
border-radius: 50%;
margin-right: 5px;
&.totaldot {
background-color: #1890ff;
}
&.faildot {
background-color: red;
}
&.successdot {
background-color: #52c41a;
}
}
}
\ No newline at end of file
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