Commit e627152c by yanglang123

增加图片上传

parent 7f2a7fad
import React, {Component} from 'react';
import {Icon} from 'antd';
import {List, Modal, SwipeAction, Toast} from 'antd-mobile';
import UploadItem from './uploadItem/upload';
import uploader from '../../util/uploader';
import fetchUtil from '../../util/fetchUtil';
import func from '../../util/commonFunc';
import urlconfig from '../../util/urlconfig';
import './uploadTllo.less';
import deleteIcon from "./image/trash-o@3x.png";
import addPicture from './image/add-picture.png';
import intl from "react-intl-universal";
var ossData = '';
export default class UploaderTools extends Component {
constructor(props) {
super(props);
this.state = {
host: '',
dir: '',
uploadVisibile: false,
fileList: [],
isInit: false,
}
this.progressId = [];
}
componentWillMount() {
func.appendJsFunction("lib/crypto1/crypto/crypto.js","upload-crypto");
func.appendJsFunction("lib/crypto1/hmac/hmac.js","upload-hmac");
func.appendJsFunction("lib/crypto1/sha1/sha1.js","upload-sha1");
func.appendJsFunction("lib/base64.js","upload-base64");
func.appendJsFunction("lib/plupload-2.1.2/js/plupload.full.min.js","upload-plupload");
}
componentDidMount(){
const { fileList } = this.props;
if(fileList && fileList.length){
fileList.forEach((item)=>{
this.progressId.push(item.id);
})
}
this.setState({
fileList: fileList
})
}
beforeUpload = (files) => {
let cache = files[0].name.split('.');
let fileas = cache[cache.length - 1].toLowerCase();
cache[cache.length - 1] = fileas
let cachName = "";
cache.map((item, index) => {
if(index == 0){
cachName = item
}else{
cachName = cachName + "." + item
}
})
files[0].name = cachName;
if(this.state.fileList.length > 9){
Toast.info("最多上传9个附件", 1);
return
}
var group = [];
var {fileList} = this.state;
var overSize = 0, falseType = 0;
for (let i = 0; i < files.length; i++) {
const fileTypeCheck= func.fileTypeCheck(files[i].type);
var tyoe=fileTypeCheck;
if (fileTypeCheck) {
if (func.fileSizeCheck(files[i].size, files[i].type)) {
var reg=/\.$/gi,str;
str=files[i].name.replace(reg,"");
console.log(str);
group.push({
id: files[i].id,
name: new Date().getTime() + cachName,
percent: 0,
statusCode:"progress",
size: files[i].size
});
console.log(group,"group");
} else {
overSize++;
}
} else {
falseType++;
}
}
if (falseType > 0) {
Toast.info(intl.get('forum19')||"请选择正确格式文件");
uploader.removeFiles();
} else if (overSize > 0) {
Toast.info(intl.get('PublishKey161')||"请选择合适大小的文件");
uploader.removeFiles();
} else {
fileList = fileList.concat(group);
this.setState({
fileList: fileList
});
this.props.getFileList(fileList);
this.beginUpload(files);
}
}
beginUpload = (files) => {
this.close("upload");
let _this = this;
for(let i=0;i<files.length;i++){
fetchUtil.get(urlconfig.ossUrl + "/upload/policy?needTranscode=true&type=2", function (data) {
ossData = JSON.parse(data.data);
ossData.id = files[i].id;
ossData.fileName = files[i].id + "." + files[i].name.split(".")[files[i].name.split(".").length - 1];
if (_this.state.host.length == 0) {
_this.setState({
host: ossData.host,
dir: ossData.dir
});
}
uploader.uploadFile(ossData);
})
}
}
uploadProgress = (file) => {
var {fileList} = this.state;
let _this = this;
if (this.progressId.indexOf(file.id) == -1) {
fileList[this.progressId.length].percent = file.percent;
fileList[this.progressId.length].statusCode = "progress";
this.progressId.push(file.id);
} else {
fileList[this.progressId.indexOf(file.id)].percent = file.percent;
fileList[this.progressId.indexOf(file.id)].statusCode = "progress";
}
this.setState({
fileList: fileList
},()=>{
_this.props.getFileList(_this.state.fileList);
});
}
completeUpload = (info, up, file) => {
if (info.status == 200) {
var ImgUrl = this.state.host + "/" + this.state.dir + "/" + file.id + '.' + file.name.split('.')[file.name.split('.').length - 1];
var {fileList} = this.state;
var tempFileList = fileList.map((item) => {
if (item.id == file.id) {
item.imgUrl = ImgUrl;
item.statusCode = file.status==5?"success":"fail";
return item;
} else {
return item;
}
});
this.setState({
fileList: tempFileList,
});
this.props.getFileList(tempFileList);
}
}
deleteFileById = (id) => {
const _this = this;
let { fileList } = this.state;
let arr = fileList.filter((item) => {
return item.id == id;
});
if (arr.length > 0 && arr[0].statusCode == "success") {
arr = fileList.filter((item) => {
return item.id != id;
});
this.setState({
fileList: arr,
randomKey: new Date().getTime()
}, ()=>_this.props.getFileList(_this.state.fileList));
} else {
Toast.info(intl.get('myHomework7')||"文件上传中,不可删除", 1);
}
}
uploadItems = () => {
const {fileList} = this.state;
const {noPreview, noDelete} = this.props;
var result = [];
if (fileList.length > 0 && !noDelete) {
result = fileList.map((item, i) => {
return <SwipeAction
key={i}
autoClose
right={
[
{
text: <img src={deleteIcon} style={{width:36}}/>,
onPress: () => this.deleteFileById(item.id),
style: {backgroundColor: '#EE6157', color: 'white', width: 140},
},
]
}
>
<List.Item>
<UploadItem item={item} noPreview={noPreview} />
</List.Item>
</SwipeAction>;
});
} else if (fileList.length > 0 && noDelete) {
result = fileList.map((item, i) => {
return <SwipeAction
key={i}
autoClose
right={[]}
>
<List.Item>
<UploadItem item={item} noPreview={noPreview} />
</List.Item>
</SwipeAction>;
});
}
return result;
}
uploadedItems = () => {
const {fileList} = this.state;
if (fileList.length > 0) {
result = fileList.map((item, i) => {
return <List.Item key={i} className={"upload-item-result-list"}>
<UploadItem isResult={true} item={item}/>
</List.Item>;
});
}
return result;
}
show = (type) => {
switch (type) {
case "upload":
this.setState({
uploadVisibile: true
});
if (!this.state.isInit) {
uploader.init("selectedFile", "upload-container", this.beforeUpload, this.uploadProgress, this.completeUpload);
this.setState({
// isInit: true
});
}
break;
}
}
clearFile = () => {
this.progressId = [];
this.setState({
fileList: []
})
}
close = (type) => {
switch (type) {
case "upload":
return this.setState({
uploadVisibile: false
});
}
}
render(){
var uploadItems = [];
uploadItems = this.uploadItems();
return(
<div className="publish-forum-upload">
{
uploadItems.length > 0 &&
<div style={{padding: "0.2rem 0"}} className="upload-list">
<List className="publish-list-list">
{uploadItems}
</List>
</div>
}
{
this.state.fileList.length > 0 && !this.props.isResult ?
<div className="forum-menu">
<span className={"menu-delete"} onClick={this.clearFile}>
<img src={deleteIcon} style={{width:28,marginTop:-10}} alt=""/> {intl.get('PublishKey164')||'全部删除'}
</span>
<div style={{clear: 'both'}}></div>
</div> : ''
}
{!this.props.isResult && this.state.fileList.length <9 ? <div className="upload-btn">
{/* <UploadBtn onClick={() => this.show('upload')} /> */}
<img style={{borderRadius: '40px'}} onClick={() => this.show('upload')} src={addPicture} alt=""/>
</div> : null}
<Modal
popup
style={{height: 176, bottom: 0, position: 'fixed', left: 0, width: "100%"}}
visible={this.state.uploadVisibile}
onClose={() => this.close('upload')}
// animationType="slide-down"
animationType="slide-up"
>
<List className="forum-upload-option">
<List.Item onClick={this.selectFile}>
<div id="upload-container">
<a id="selectedFile"> {intl.get('PublishKey57')||'本地上传'}</a>
</div>
</List.Item>
</List>
<div style={{
lineHeight: '88px',
textAlign: 'center',
width: "100%",
background: '#fff',
borderTop: '.02rem solid #eee'
}} onClick={() => this.close('upload')}> {intl.get('Cancel')||'取消'}
</div>
</Modal>
</div>
)
}
}
\ No newline at end of file
import React, { Component } from 'react';
import { Modal, Toast } from 'antd-mobile';
import { Icon, Progress } from 'antd';
import { hashHistory } from "react-router";
import './uploaditem.less';
import func from '../../../util/commonFunc';
import thumbnail from '../../../static/image/poster.jpg';
import mediaIcon from './videoIcon.png';
import intl from "react-intl-universal";
class UploadItem extends Component {
constructor(props) {
super(props);
this.state = {
fileLookVisible: false
};
this.startFileLook = this.startFileLook.bind(this);
console.log(this.props.name);
}
getItemType(title) {
let arr = title.split(".");
let type = arr[arr.length - 1];
type = type.toLocaleLowerCase();
const imageType = ["jpg", "jpeg", "png", "gif"];
const videoType = ["mp4"];
const audioType = ["mp3"];
const docType = ["ppt", "pptx", "doc", "docx", "xls", "xlsx", "pdf"];
const compressionType = ["zip"];
if (imageType.indexOf(type) != -1) {
return "image";
} else if (videoType.indexOf(type) != -1) {
return "video";
} else if (audioType.indexOf(type) != -1) {
return "audio";
} else {
return "file";
}
}
startFileLook(item,noPreview) {
if(noPreview){
return;
}
const fileType = ["jpg", "jpeg", "png","gif","mp4","mp3"];
let typeText = "";
if (item.name) {
typeText = item.name.split(".")[item.name.split(".").length - 1];
} else {
typeText = item.title.split(".")[item.title.split(".").length - 1];
}
if (fileType.indexOf(typeText) != -1) {
hashHistory.push({
pathname: func.routerBefore() + "/mediapreview",
state: item.img ? item.img : item.imgUrl
});
} else {
console.log("startFileLook-item", item)
//下载
hashHistory.push({
pathname:func.routerBefore()+"/browserdownload",
query:{
fileUrl:encodeURIComponent(item.imgUrl)
}
});
// Toast.info("该文件格式不支持手机端在线预览,请登陆PC端查看或下载", 2);
}
}
resultItemName(name) {
let nameArr = name.split(".");
let onlyNameArr = nameArr.filter((item, index) => {
return index < nameArr.length - 1;
});
let onlyNameStr = onlyNameArr.join(".");
if (onlyNameStr.length > 10) {
return onlyNameStr.slice(0, 10) + "..." + nameArr[nameArr.length - 1];
} else {
return name;
}
}
render() {
const { item,isResult,noPreview } = this.props;
// console.log("upload-render-item", item);
if (this.props.type == "feedback") {
return (
<div className="upload-item" onClick={() => this.startFileLook(item)}>
<p>{item.title}</p>
{
item.upLoadTime ?
<div className="upload-time-homework-daying">
{func.dateFormat(item.upLoadTime)}
</div> :
<div>
<span style={{
fontSize: 24,
color: "#666",
marginLeft: 20
}}>{func.sizeFormat(item.size)}</span>
</div>
}
<div className="upload-thumbnail">
{
this.getItemType(item.title) == "image" ?
<img src={item.img} alt="" />
: <img src={mediaIcon} alt={""} />
}
</div>
</div>
);
} else if (this.props.type == "makeCourse") {
return (
<div className="upload-item">
<p>{item.title}</p>
<div className="upload-thumbnail">
<img src={item.img} alt="" />
</div>
</div>
);
} else {
if (isResult) {
return <div className="upload-result-item" onClick={() => this.startFileLook(item)}>
{this.resultItemName(item.name)}
<span>
/
{func.sizeFormat(item.size)}
</span>
</div>
} else {
return (
<div className="upload-item" onClick={() => this.startFileLook(item,noPreview)}>
<p>{item.name}</p>
{
item.statusCode == "progress" ?
<Progress style={{ width: "89%", float: "left", marginTop: 3 }} percent={item.percent} />
: item.upLoadTime ?
<div className="upload-time-homework-daying">
{func.dateFormat(item.upLoadTime)}
</div> : ""
}
{
item.statusCode == "progress" ?
<div style={{ clear: "both" }}></div> : ""
}
{
item.statusCode == "success" || item.statusCode == "progress" ?
<div>
{
item.statusCode == "success" ?
<span style={{ fontSize: 24, color: "#76C482" }}>{intl.get('uploadSuccess')||'上传成功'}</span> : ""
}
<span style={{
fontSize: 24,
color: "#666",
marginLeft: item.statusCode == "success"?20:0
}}>{func.sizeFormat(item.size)}</span>
</div> :
item.statusCode == "fail" ?
<div>
<span style={{ fontSize: 24, color: "#ee6157" }}>{intl.get('homework8')||'上传失败'}</span>
</div> : ""
}
{
item.statusCode == "progress" ?
<div className="upload-item-progressText">
{intl.get('homework9')||'上传中'}
</div> : ""
}
<div className="upload-thumbnail">
{
item.statusCode == "progress" ?
<Icon type="file" style={{ fontSize: 80 }} />
: this.getItemType(item.name) == "image" ?
<img src={item.imgUrl ? item.imgUrl : thumbnail} alt="" />
: this.getItemType(item.name) == "video" || this.getItemType(item.name) == "audio" ?
<img src={mediaIcon} alt={""} /> :
<Icon type="file" style={{ fontSize: 80 }} />
}
</div>
</div>
);
}
}
}
}
export default UploadItem;
\ No newline at end of file
.upload-item {
width: 100%;
height: 107px;
font-size: 28px;
color: #4a4a4a;
padding-left: 124px;
padding-right: 50px;
position: relative;
}
.upload-item .upload-time-homework-daying {
font-size: 24px;
color: #999999;
margin-top: 10px;
}
.upload-item p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.upload-item .upload-thumbnail {
width: 100px;
height: 100px;
position: absolute;
left: 0;
top: 0;
text-align: center;
line-height: 80px;
}
.upload-item .upload-thumbnail img {
width: 100px;
height: 100px;
}
.upload-item .file-look {
width: 50px;
height: 80px;
position: absolute;
right: 0;
top: 0;
text-align: center;
line-height: 80px;
font-size: 22px;
}
.upload-item .file-look a {
color: #9b9b9b;
}
.upload-item .file-look a:hover {
color: #9b9b9b;
text-decoration: none;
}
.file-preview {
width: 100%!important;
}
.file-preview .am-modal-content {
padding: 0!important;
}
.file-preview .am-modal-body {
width: 100%;
text-align: center!important;
padding: 0!important;
}
.upload-item {
width: 100%;
height: 107px;
font-size: 28px;
color: #4a4a4a;
padding-left: 124px;
padding-right: 50px;
position: relative;
.upload-time-homework-daying{
font-size: 24px;
color: #999999;
margin-top: 10px;
}
p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-right: 10%;
}
.upload-item-progressText{
position: absolute;
top: 0;
right: 0;
height: 107px;
line-height: 105px;
font-size: 24px;
color: #76c482;
}
.upload-thumbnail {
width: 100px;
height: 100px;
position: absolute;
left: 0;
top: 0;
text-align: center;
line-height: 80px;
img {
width: 100px;
height: 100px;
}
}
.file-look {
width: 50px;
height: 80px;
position: absolute;
right: 0;
top: 0;
text-align: center;
line-height: 80px;
font-size: 22px;
a{
color: #9b9b9b;
}
a:hover{
color: #9b9b9b;
text-decoration: none;
}
}
}
.upload-result-item{
width: 100%;
height: 100px;
line-height: 98px;
font-size: 28px;
color: #666;
border-bottom:1px solid #ccc;
span{
font-size: 28px;
color: #999;
}
}
.file-preview{
width: 100%!important;
.am-modal-content{
padding: 0!important;
}
.am-modal-body{
width: 100%;
text-align: center!important;
padding: 0!important;
}
}
.publish-forum-upload{
.upload-btn {
width: 100%;
height: 100px;
text-align: left;
margin-top: 20px;
padding-bottom: 160px;
padding-left: 20px;
span {
font-size: 28px;
color: #4a4a4a;
}
}
.upload-list {
width: 100%;
padding: 30px 20px;
h5 {
font-size: 24px;
color: #4a4a4a;
}
.publish-list-list{
>div{
>div{
// margin-top: 10px;
// padding-top: 10px;
// padding-bottom: 10px;
.am-list-item{
padding-left: 20px;
padding-top: 10px;
padding-bottom: 10px;
}
}
}
}
.upload-item-list{
.am-list-line{
padding-top: 0px;
padding-bottom: 0px;
}
}
.upload-item-result-list{
height: 100px;
padding-left:0;
.am-list-line{
padding-top: 10px;
padding-bottom: 0px;
padding-right: 0;
}
}
}
.forum-menu {
width : 100%;
// height : 32px;
// line-height : 90px;
padding-left : 22px;
padding-right: 30px;
padding-top: 14px;
.menu-title {
font-size: 20px;
color : #9B9B9B;
}
.menu-delete {
float : right;
font-size: 28px;
color : #666;
}
}
}
.forum-upload-option {
.am-list-content {
text-align: center !important;
a {
width: 100%;
height: 51px;
display: block;
color: #000;
}
}
}
\ No newline at end of file
......@@ -87,6 +87,7 @@ class App extends React.Component {
componentWillMount() {
console.log("diyici");
if (navigator.userAgent.indexOf("iPhone") != -1) {
console.log('登录系统为苹果')
this.iosTouch();
}
let tab = location.hash.split("/")[location.hash.split("/").length - 1];
......
import excute from '../../util/fetchUtil';
import API from '../../util/urlconfig';
import { Toast } from "antd-mobile";
//获取投稿类型list
export function getContributeListApi(params, callback) {
const url = `${API.getContributeListApi}?id=${params.id}`;
return (dispatch) => {
return excute.get(
url,
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
//提交投稿
export function commitContributeApi(params, callback) {
return (dispatch) => {
return excute.post(
API.commitContributeApi,
params,
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
//我的投稿列表
export function getContributeMyListApi(params, callback) {
const url = `${API.getContributeMyListApi}`;
return (dispatch) => {
return excute.post(
url,
{},
(response) => {
if (callback) {
callback(response.data);
}
}
);
};
}
\ No newline at end of file
import React, { Component } from "react";
import "./style.less";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { getContributeListApi } from "./action";
import { Input, Upload, Icon, Modal } from "antd";
import UploaderTools from "./../../common/uploadTools/UploadTool";
const { TextArea } = Input;
class ContributeDetail extends Component {
constructor(props) {
super(props);
this.state = {
ossParam: {},
activeId: 0,
authValue: "",
delValue: "",
titleValue: "",
contentValue: "",
previewVisible: false,
previewImage: "",
fileList: [],
mailList: [
{ name: "意见建议", id: 1 },
{ name: "线索提供", id: 2 },
{ name: "举报", id: 3 },
],
mailListCommit: [
{ name: "意见建议", id: 1 },
{ name: "反映问题", id: 2 },
{ name: "寻求帮助", id: 3 },
],
};
document.title = "我要投稿";
}
componentDidMount() {}
handleClick = (item, index) => {
const { activeId } = this.state;
let _this = this;
if (activeId != index) {
_this.setState({
activeId: index,
});
}
};
handleTo = () => {
console.log(this.state.titleValue, "点击情况~~~~~~~~~");
// let { typeOne, typeTwo, typeThree } = this.props.location.query;
// let params = {
// id: data.id,
// };
// this.props.getContributeListApi(params, (response) => {
// console.log(response);
// });
};
getFileList = (list) => {
this.setState({
fileList: list,
});
console.log(this.state.fileList, "2222222222222");
};
render() {
const { mailList, mailListCommit, activeId } = this.state;
return (
<div className="contribute-detail-out">
<div className="contribute-detail-box">
<div className="top-tit">
来信目的 <span className="red-star">*</span>
</div>
<div className="mailBox-out">
{location.hash.indexOf("committeeMailbox") != -1
? mailListCommit.map((item, index) => {
return (
<div
key={index}
className={
activeId == index ? "active-box" : "unactive-box"
}
onClick={() => this.handleClick(item, index)}
>
{item.name}
</div>
);
})
: mailList.map((item, index) => {
return (
<div
key={index}
className={
activeId == index ? "active-box" : "unactive-box"
}
onClick={() => this.handleClick(item, index)}
>
{item.name}
</div>
);
})}
</div>
</div>
<div className="contribute-detail-box">
<div className="top-tit">
标题 <span className="red-star">*</span>
</div>
<Input
placeholder="标题需15字以内"
value={this.state.titleValue}
onChange={(event) =>
this.setState({ titleValue: event.target.value })
}
allowClear
maxLength={15}
style={{ height: "60px", lineHeight: "60px" }}
/>
</div>
<div className="contribute-detail-box">
<div className="top-tit">具体内容</div>
<TextArea
value={this.state.contentValue}
onChange={(event) =>
this.setState({ contentValue: event.target.value })
}
placeholder="请输入具体内容"
rows={8}
/>
</div>
{location.hash.indexOf("committeeMailbox") != -1 ? (
<div className="contribute-detail-box">
<div className="top-tit">期望结果</div>
<TextArea
value={this.state.contentValue}
onChange={(event) =>
this.setState({ contentValue: event.target.value })
}
placeholder="请输入期望结果"
rows={4}
/>
</div>
) : (
""
)}
<div className="contribute-detail-box">
<div className="top-tit">上传附件</div>
<UploaderTools
getFileList={this.getFileList}
fileList={this.state.fileList}
noPreview={true}
isResult={false}
/>
</div>
<div className="contribute-detail-btn">
<div className="sumbit-btn" onClick={this.handleTo}>
提交
</div>
</div>
</div>
);
}
}
const mapStateToProps = (state) => {
return {};
};
const mapDispatchToProps = (dispatch) => {
return {
getContributeListApi: bindActionCreators(getContributeListApi, dispatch),
};
};
export default connect(mapStateToProps, mapDispatchToProps)(ContributeDetail);
.mycontribute-out {
background-color: #fff;
}
.mycontribute-out .mycontribute-tit {
font-size: 40px;
font-weight: bold;
padding: 40px 25px;
margin-left: 10px;
color: #333;
}
.mycontribute-out .mycontribute-box {
background-color: #fff;
width: 92%;
margin: 0 auto;
padding: 40px 25px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.mycontribute-out .mycontribute-box .item-box {
width: 48%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background-color: #f7f7f7;
text-align: center;
font-size: 38px;
color: #454343;
}
.mycontribute-out .mycontribute-box .item-box-active {
width: 48%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background: rgba(253, 63, 52, 0.05);
border: 1px solid #f3ab9f;
border-radius: 4px;
text-align: center;
font-size: 38px;
color: #454343;
}
.mycontribute-out .mycontribute-box span {
width: 100%;
color: #e6624a;
}
.mycontribute-out .mycontribute-child-box {
background-color: #fff;
width: 92%;
margin: 0 auto;
padding: 40px 25px;
}
.mycontribute-out .mycontribute-btn {
width: 92%;
margin: 0 auto;
text-align: center;
padding: 20px 0;
background: linear-gradient(270deg, #eb6c53 0%, #d23a29);
border-radius: 5px;
color: #fff;
font-size: 36px;
}
.contribute-detail-out {
width: 92%;
margin: 30px auto;
padding-bottom: 30px;
}
.contribute-detail-out .contribute-detail-box {
padding: 40px 30px;
background-color: #fff;
margin-bottom: 30px;
}
.contribute-detail-out .contribute-detail-box .top-tit {
font-size: 40px;
font-weight: bold;
color: #000;
margin-bottom: 15px;
}
.contribute-detail-out .contribute-detail-box .top-tit .red-star {
color: red;
font-size: 40px;
}
.contribute-detail-out .contribute-detail-box .user-tit {
color: #999999;
font-size: 32px;
}
.contribute-detail-out .contribute-detail-box .userinfo-box {
display: flex;
justify-content: space-between;
align-items: center;
}
.contribute-detail-out .contribute-detail-box .userinfo-box .userinfo-name {
margin-top: 30px;
color: #666666;
font-size: 32px;
}
.contribute-detail-out .contribute-detail-box .mailBox-out {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.contribute-detail-out .contribute-detail-box .unactive-box {
width: 33%;
height: 80px;
line-height: 80px;
background-color: #f7f7f7;
text-align: center;
font-size: 36px;
color: #454343;
}
.contribute-detail-out .contribute-detail-box .active-box {
width: 33%;
height: 80px;
line-height: 80px;
background: rgba(253, 63, 52, 0.05);
border: 1px solid #f3ab9f;
border-radius: 4px;
text-align: center;
font-size: 36px;
color: #454343;
}
.contribute-detail-out .contribute-detail-box .ant-input-affix-wrapper {
border: 0 !important;
}
.contribute-detail-out .contribute-detail-box .ant-input {
border: 0 !important;
font-size: 32px !important;
}
.contribute-detail-out .contribute-detail-box .ant-input:focus {
box-shadow: none !important;
}
.contribute-detail-out .contribute-detail-box .ant-input-clear-icon {
font-size: 30px !important;
}
.contribute-detail-out .contribute-detail-box .ant-upload-list-picture-card-container {
width: 200px !important;
height: 200px !important;
}
.contribute-detail-out .contribute-detail-box .ant-upload-list-picture-card .ant-upload-list-item {
width: 200px !important;
height: 200px !important;
}
.contribute-detail-out .contribute-detail-box .ant-upload-select-picture-card {
width: 200px !important;
height: 200px !important;
}
.contribute-detail-out .contribute-detail-box .anticon {
font-size: 40px;
}
.contribute-detail-out .contribute-detail-box .ant-upload-text {
font-size: 30px;
}
.contribute-detail-out .contribute-detail-btn {
display: flex;
justify-content: space-between;
}
.contribute-detail-out .contribute-detail-btn .sumbit-btn {
width: 100%;
text-align: center;
color: #fff;
font-size: 40px;
padding: 10px 0;
border-radius: 4px;
background: linear-gradient(270deg, #eb6c53 0%, #d23a29);
}
.ant-modal-footer {
display: none !important;
}
.ant-upload-list-item-actions a {
margin-right: 35px;
}
.ant-upload-list-item-actions .anticon-delete {
margin-left: 35px;
}
.mycontribute-out {
background-color: #fff;
.mycontribute-tit {
font-size: 40px;
font-weight: bold;
padding: 40px 25px;
margin-left: 10px;
color: #333;
}
.mycontribute-box {
background-color: #fff;
width: 92%;
margin: 0 auto;
padding: 40px 25px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.item-box {
width: 48%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background-color: #f7f7f7;
text-align: center;
font-size: 38px;
color: #454343;
}
.item-box-active {
width: 48%;
margin-bottom: 30px;
height: 80px;
line-height: 80px;
background: rgba(253, 63, 52, 0.05);
border: 1px solid #f3ab9f;
border-radius: 4px;
text-align: center;
font-size: 38px;
color: #454343;
}
span {
width: 100%;
color: #e6624a;
}
}
.mycontribute-child-box {
background-color: #fff;
width: 92%;
margin: 0 auto;
padding: 40px 25px;
}
.mycontribute-btn {
width: 92%;
margin: 0 auto;
text-align: center;
padding: 20px 0;
background: linear-gradient(270deg, #eb6c53 0%, #d23a29);
border-radius: 5px;
color: #fff;
font-size: 36px;
}
}
//投稿详情
.contribute-detail-out {
width: 92%;
margin: 30px auto;
padding-bottom: 30px;
.contribute-detail-box {
padding: 40px 30px;
background-color: #fff;
margin-bottom: 30px;
.top-tit {
font-size: 40px;
font-weight: bold;
color: #000;
margin-bottom: 15px;
.red-star {
color: red;
font-size: 40px;
}
}
.user-tit {
color: #999999;
font-size: 32px;
}
.userinfo-box {
display: flex;
justify-content: space-between;
align-items: center;
.userinfo-name {
margin-top: 30px;
color: #666666;
font-size: 32px;
}
}
.mailBox-out{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.unactive-box {
width: 33%;
height: 80px;
line-height: 80px;
background-color: #f7f7f7;
text-align: center;
font-size: 36px;
color: #454343;
}
.active-box {
width: 33%;
height: 80px;
line-height: 80px;
background: rgba(253, 63, 52, 0.05);
border: 1px solid #f3ab9f;
border-radius: 4px;
text-align: center;
font-size: 36px;
color: #454343;
}
.ant-input-affix-wrapper {
border: 0 !important;
}
.ant-input {
border: 0 !important;
font-size: 32px !important;
}
.ant-input:focus {
box-shadow: none !important;
}
.ant-input-clear-icon {
font-size: 30px !important;
}
.ant-upload-list-picture-card-container {
width: 200px !important;
height: 200px !important;
}
.ant-upload-list-picture-card .ant-upload-list-item {
width: 200px !important;
height: 200px !important;
}
.ant-upload-select-picture-card {
width: 200px !important;
height: 200px !important;
}
.anticon {
font-size: 40px;
}
.ant-upload-text {
font-size: 30px;
}
}
.contribute-detail-btn {
display: flex;
justify-content: space-between;
.sumbit-btn {
width: 100%;
text-align: center;
color: #fff;
font-size: 40px;
padding: 10px 0;
border-radius: 4px;
background: linear-gradient(270deg, #eb6c53 0%, #d23a29);
}
}
}
.ant-modal-footer {
display: none !important;
}
.ant-upload-list-item-actions {
a {
margin-right: 35px;
}
.anticon-delete {
margin-left: 35px;
}
}
......@@ -33,7 +33,6 @@ class IndexComponent extends Component {
display: false,
},
taskList: [],
showNotMore: false,
};
}
......@@ -50,7 +49,6 @@ class IndexComponent extends Component {
_this.setState({
homeModuleList,
});
_this.timeoutShowNotMore();
});
let param = {
pageNo: 1,
......@@ -61,14 +59,7 @@ class IndexComponent extends Component {
level: '',
};
}
timeoutShowNotMore = () => {
let _this = this;
setTimeout(() => {
_this.setState({
showNotMore: true,
});
}, 3000);
};
renderByModuleList = () => {
const { homeModuleList } = this.state;
......@@ -160,7 +151,7 @@ class IndexComponent extends Component {
render() {
console.log(this.state.homeModuleList);
const { taskState, showNotMore } = this.state;
const { taskState } = this.state;
return (
<div
......
......@@ -147,7 +147,7 @@
justify-content: space-between;
}
.my-menu-body .header-info-box .study-record-info .study-item .study-jf {
padding: 10px 25px;
padding: 10px 15px;
background: linear-gradient(90deg, #d23a29, #eb6c53 100%);
border-radius: 40px;
color: #fff;
......
......@@ -50,11 +50,11 @@ const mapList = {
},
MyDwsjxx: {
text: "党委书记信箱",
url: "/mysurvey",
url: "/committeeMailbox",
},
MyJjxx: {
text: "纪检信箱",
url: "/mysurvey",
url: "/mailbox",
},
MyLy: {
text: "我要留言",
......@@ -325,25 +325,7 @@ class Menume extends React.Component {
<div className="my-menu-body">
<div className="header-info-box">
<div className="personal-info-main">
{this.state.isAPPEnableSign == 1 ? (
<div
className="playcard-entry"
onClick={() => {
hashHistory.push(func.routerBefore() + "/signplaycard");
}}
>
{/* <span className="playcard-icon"> */}
<IconFont
className="playcard-icon"
style={{ fontSize: 32 }}
type="icon-mine-checkin"
/>
{/* </span> */}
<span className="playcard-text">{intl.get("signCard")}</span>
</div>
) : (
""
)}
<div
className="personal-info"
onClick={() => {
......@@ -408,7 +390,7 @@ class Menume extends React.Component {
<div className="study-item">
<div style={{ display: "flex" }}>
<img
style={{ width: "45px", marginRight: "20px" }}
style={{ width: "45px", height: "45px", marginRight: "20px" }}
src={jinbi}
alt=""
/>
......
......@@ -159,7 +159,7 @@
align-items: center;
justify-content: space-between;
.study-jf {
padding: 10px 25px;
padding: 10px 15px;
background: linear-gradient(90deg, #d23a29, #eb6c53 100%);
border-radius: 40px;
color: #fff;
......
......@@ -3,16 +3,9 @@ import "./style.less";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { VoteListApi } from "./action";
import { Input, Upload, Icon, Modal, Radio } from "antd";
import { Input, Radio } from "antd";
import UploaderTools from "./../../common/uploadTools/UploadTool";
const { TextArea } = Input;
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
class MyLeaveMessage extends Component {
constructor(props) {
super(props);
......@@ -22,14 +15,7 @@ class MyLeaveMessage extends Component {
contentValue: "",
previewVisible: false,
previewImage: "",
fileList: [
{
uid: "-1",
name: "image.png",
status: "done",
url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png",
},
],
fileList: [],
activeId: 0,
mapList: [
{
......@@ -51,34 +37,14 @@ class MyLeaveMessage extends Component {
],
};
document.title = "我要留言";
this.beforeUpload = this.beforeUpload.bind(this);
this.handleChange = this.handleChange.bind(this);
}
componentDidMount() {}
handleCancel = () => this.setState({ previewVisible: false });
handlePreview = async (file) => {
console.log("111111111111111");
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
getFileList = (list) => {
this.setState({
previewImage: file.url || file.preview,
previewVisible: true,
fileList: list,
});
console.log(this.state.fileList, "2222222222222");
};
beforeUpload(file, fileList) {
console.log("file, fileList", file, fileList);
// this.setState({
// previewImage: file.url || file.preview,
// previewVisible: true,
// });
}
handleChange({ fileList }) {
this.setState({ fileList });
}
handleMessageClick(data, index) {
let _this = this;
......@@ -98,14 +64,8 @@ class MyLeaveMessage extends Component {
// });
};
render() {
const { mapList, activeId, previewVisible, previewImage, fileList } =
this.state;
const uploadButton = (
<div>
<Icon type="plus" />
<div className="ant-upload-text">上传</div>
</div>
);
const { mapList, activeId } = this.state;
return (
<div className="contribute-detail-out">
<div className="contribute-detail-box">
......@@ -157,25 +117,14 @@ class MyLeaveMessage extends Component {
</div>
<div className="contribute-detail-box">
<div className="top-tit">
图片<span>(0/6)</span>
</div>
<Upload
action={""}
listType="picture-card"
fileList={fileList}
onPreview={this.handlePreview}
beforeUpload={this.beforeUpload}
onChange={this.handleChange}
>
{fileList.length >= 6 ? null : uploadButton}
</Upload>
<Modal
visible={previewVisible}
footer={null}
onCancel={this.handleCancel}
>
<img alt="example" style={{ width: "100%" }} src={previewImage} />
</Modal>
图片<span>(0/9)</span>
</div>
<UploaderTools
getFileList={this.getFileList}
fileList={this.state.fileList}
noPreview={true}
isResult={false}
/>
<div style={{ fontSize: "30px", color: "#9E9E9E" }}>
支持.png.jepg格式,每张最大5MB
</div>
......@@ -192,7 +141,7 @@ class MyLeaveMessage extends Component {
是否匿名 <span className="red-star">*</span>
</div>
<Radio.Group
size='large'
size="large"
value={this.state.anonymousValue}
onChange={(event) =>
this.setState({ anonymousValue: event.target.value })
......
......@@ -3,16 +3,9 @@ import "./style.less";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { getContributeListApi } from "./action";
import { Input, Upload, Icon, Modal } from "antd";
import { Input, Modal } from "antd";
import UploaderTools from "./../../common/uploadTools/UploadTool";
const { TextArea } = Input;
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
class ContributeDetail extends Component {
constructor(props) {
super(props);
......@@ -24,20 +17,11 @@ class ContributeDetail extends Component {
contentValue: "",
previewVisible: false,
previewImage: "",
fileList: [
{
uid: "-1",
name: "image.png",
status: "done",
url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png",
},
],
fileList: [],
};
document.title = "我要投稿";
this.showVideoModal = this.showVideoModal.bind(this);
this.closeVideoModal = this.closeVideoModal.bind(this);
this.beforeUpload = this.beforeUpload.bind(this);
this.handleChange = this.handleChange.bind(this);
}
showVideoModal() {
this.setState({
......@@ -50,30 +34,13 @@ class ContributeDetail extends Component {
});
}
componentDidMount() {}
handleCancel = () => this.setState({ previewVisible: false });
handlePreview = async (file) => {
console.log("111111111111111");
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
getFileList = (list) => {
this.setState({
previewImage: file.url || file.preview,
previewVisible: true,
fileList: list,
});
console.log(this.state.fileList,'2222222222222')
};
beforeUpload(file, fileList) {
console.log("file, fileList", file, fileList);
// this.setState({
// previewImage: file.url || file.preview,
// previewVisible: true,
// });
}
handleChange({ fileList }) {
this.setState({ fileList });
}
handleClick = () => {
console.log(this.state.titleValue, "点击情况~~~~~~~~~");
// let { typeOne, typeTwo, typeThree } = this.props.location.query;
......@@ -85,13 +52,7 @@ class ContributeDetail extends Component {
// });
};
render() {
const { previewVisible, previewImage, fileList } = this.state;
const uploadButton = (
<div>
<Icon type="plus" />
<div className="ant-upload-text">上传</div>
</div>
);
const { fileList } = this.state;
return (
<div className="contribute-detail-out">
<div className="contribute-detail-box">
......@@ -122,23 +83,12 @@ class ContributeDetail extends Component {
</div>
<div className="contribute-detail-box">
<div className="top-tit">图片或视频上传</div>
<Upload
action={""}
listType="picture-card"
fileList={fileList}
onPreview={this.handlePreview}
beforeUpload={this.beforeUpload}
onChange={this.handleChange}
>
{fileList.length >= 20 ? null : uploadButton}
</Upload>
<Modal
visible={previewVisible}
footer={null}
onCancel={this.handleCancel}
>
<img alt="example" style={{ width: "100%" }} src={previewImage} />
</Modal>
<UploaderTools
getFileList={this.getFileList}
fileList={this.state.fileList}
noPreview={true}
isResult={false}
/>
</div>
<div className="contribute-detail-box">
<div className="user-tit">以下为公开信息,将会在稿件中显示</div>
......
......@@ -206,8 +206,10 @@ const MyLeaveMessage = LazyLoad(() =>
const MediaPreview = LazyLoad(() =>
import('./common/preview/preview')
)
//纪检信箱 党委书记信箱
const Mailbox = LazyLoad(() =>
import('./components/Mailbox')
)
// 首页组件库
const IndexComponentPage = LazyLoad(() => import('./components/indexComponent'));
......@@ -389,7 +391,10 @@ class AppRouter extends React.Component {
<Route path="/*/*/contributeMyself" component={ContributeMyself} />
{/* 我要留言 */}
<Route path="/*/*/myLeaveMessage" component={MyLeaveMessage} />
{/*empty*/}
{/* 纪检信箱 */}
<Route path="/*/*/mailbox" component={Mailbox} />
<Route path="/*/*/committeeMailbox" component={Mailbox} />
{/*empty Committee*/}
<Route path="/*/*/empty" component={Empty} />
<Route path={'/*/*/login'} component={Login} />
......
/**
* my case library action
*/
import urlconfig from '../../util/urlconfig';
import fetchUtil from '../../util/fetchUtil';
import * as types from '../../components/Mailbox/MyCaseLibraryTypes';
import func from '../../util/commonFunc';
import { call } from 'redux-saga/effects';
import { Toast } from 'antd-mobile';
import intl from 'react-intl-universal';
/**
* 我的作品列表-我的原创活动
* @param {*} requestUrl
* @param {*} requestData
*/
export function myCaseLibraryAction(requestUrl, requestData) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseLibraryAction-response", response);
let myCaseDataPageNo = requestData.pageNo;
let myCaseDataHasMore;
if (response.data.records.length != 10) {
myCaseDataHasMore = false;
} else {
myCaseDataHasMore = true;
}
dispatch({
type: types.MY_CASE_LIBRARY,
data: response.data.records,
myCaseDataPageNo: myCaseDataPageNo,
myCaseDataHasMore: myCaseDataHasMore,
})
});
}
}
export function initCaseClassify() {
return dispatch => {
dispatch({
type:types.INITCASECLASSIFY
})
}
}
export function changeLoadingState (isLoading) {
return dispatch => {
dispatch({
type: types.MY_CASE_LIBRARY_CHANGE_STATE,
isLoading: isLoading
});
}
}
/**
* 我的作品列表-我的原创活动上拉加载更多
* @param {*} requestUrl
* @param {*} requestData
*/
export function myCaseLibraryLoadMoreAction(requestUrl, requestData) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseLibraryLoadMoreAction-response", response);
if (response.code == 1000) {
let myCaseDataPageNo = requestData.pageNo;
let myCaseDataHasMore;
if (response.data.records.length != 10) {
myCaseDataHasMore = false;
} else {
myCaseDataHasMore = true;
}
dispatch({
type: types.MY_CASE_LIBRARY_LOAD_MORE,
data: response.data.records,
myCaseDataPageNo: myCaseDataPageNo,
myCaseDataHasMore: myCaseDataHasMore,
isLoading: false
})
}
});
}
}
/**
* 我的作品列表-我的作品审核任务
* @param {*} requestUrl
* @param {*} requestData
*/
export function myCaseAuditTaskAction(requestUrl, requestData) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseAuditTaskAction-response", response);
let auditTaskDataPageNo = requestData.pageNo;
let auditTaskDataHasMore;
if (response.data.records.length != 10) {
auditTaskDataHasMore = false;
} else {
auditTaskDataHasMore = true;
}
dispatch({
type: types.MY_CASE_AUDIT_TASK,
data: response.data.records,
auditTaskDataPageNo: auditTaskDataPageNo,
auditTaskDataHasMore: auditTaskDataHasMore,
})
});
}
}
/**
* 我的作品列表-我的作品审核任务加载更多
* @param {*} requestUrl
* @param {*} requestData
*/
export function myCaseAuditTaskLoadMoreAction(requestUrl, requestData) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseAuditTaskLoadMoreAction-response", response);
if (response.code == 1000) {
let auditTaskDataPageNo = requestData.pageNo;
let auditTaskDataHasMore;
if (response.data.records.length != 10) {
auditTaskDataHasMore = false;
} else {
auditTaskDataHasMore = true;
}
dispatch({
type: types.MY_CASE_AUDIT_TASK_LOAD_MORE,
data: response.data.records,
auditTaskDataPageNo: auditTaskDataPageNo,
auditTaskDataHasMore: auditTaskDataHasMore,
isLoading: false
})
}
});
}
}
/**
* 我的作品列表-我的作品评分任务
* @param {*} requestUrl
* @param {*} requestData
*/
export function myCaseMarkTaskAction(requestUrl, requestData) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseMarkTaskAction-response", response);
let markTaskDataPageNo = requestData.pageNo;
let markTaskDataHasMore;
if (response.data.records.length != 10) {
markTaskDataHasMore = false;
} else {
markTaskDataHasMore = true;
}
dispatch({
type: types.MY_CASE_MARK_TASK,
data: response.data.records,
markTaskDataPageNo: markTaskDataPageNo,
markTaskDataHasMore: markTaskDataHasMore,
})
});
}
}
/**
* 我的作品列表-我的作品评分任务加载更多
* @param {*} requestUrl
* @param {*} requestData
*/
export function myCaseMarkTaskLoadMoreAction(requestUrl, requestData) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseMarkTaskLoadMoreAction-response", response);
if (response.code == 1000) {
let markTaskDataPageNo = requestData.pageNo;
let markTaskDataHasMore;
if (response.data.records.length != 10) {
markTaskDataHasMore = false;
} else {
markTaskDataHasMore = true;
}
dispatch({
type: types.MY_CASE_MARK_TASK_LOAD_MORE,
data: response.data.records,
markTaskDataPageNo: markTaskDataPageNo,
markTaskDataHasMore: markTaskDataHasMore,
isLoading: false
})
}
});
}
}
/**
* 批量审核
* @param {*} requestUrl
* @param {*} requestData
* @param {*} callback
*/
export function caseAuditBatchAction(requestUrl, requestData, callback) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseAuditTaskAction-response", response);
let data = response.data.records;
data.forEach(item => {
item['hasSelected'] = false;
});
// dispatch({
// type: types.CASE_AUDIT_OR_MARK_BATCH,
// data: data,
// })
if (callback) {
callback(data);
}
});
}
}
/**
* 批量审核数据提交
* @param {*} submittingUrl
* @param {*} submittingData
*/
export function auditBatchSubmitting (submittingUrl, submittingData, callback) {
return dispatch => {
fetchUtil.post(submittingUrl, submittingData, (response) => {
console.log("auditBatchSubmitting-response", response);
if (response.code == 1000) {
if (callback) {
callback(true);
}
} else {
if (callback) {
callback(false);
}
}
});
}
}
/**
* 批量评分
* @param {*} requestUrl
* @param {*} requestData
* @param {*} callback
*/
export function caseMarkBatchAction(requestUrl, requestData, callback) {
return dispatch => {
fetchUtil.getNetwork(requestUrl, requestData, (response) => {
console.log("myCaseAuditTaskAction-response", response);
let data = response.data.records;
data.forEach(item => {
item['hasSelected'] = false;
});
if (callback) {
callback(data);
}
});
}
}
/**
* 批量评分提交数据
* @param {*} submittingUrl
* @param {*} submittingData
*/
export function markBatchSubmitting (submittingUrl, submittingData, callback) {
return dispatch => {
fetchUtil.post(submittingUrl, submittingData, (response) => {
console.log("markBatchSubmitting-response", response);
if (response.code == 1000) {
if (callback) {
callback(true);
}
} else {
if (callback) {
callback(false);
}
}
});
}
}
/**
* 根据作品id和type获取作品详情信息
* @param {*} requestCaseDetailUrl
* @param {*} requestCaseDetailParams
*/
export function getCaseDetailByIdAndType (requestCaseDetailUrl, requestCaseDetailParams, callback) {
return dispatch => {
fetchUtil.getNetwork(requestCaseDetailUrl, requestCaseDetailParams, (response) => {
console.log("getCaseDetailByIdAndType-response", response);
if (response.code == 1000) {
const caseDetail = response.data;
// 处理过滤只有维度没有一级的分类
const classifyListVOList = response.data.classifyListVOList;
let classifyList = [];
for (let i = 0; i < classifyListVOList.length; i ++) {
if (classifyListVOList[i].children && classifyListVOList[i].children.length > 0) {
classifyList.push(classifyListVOList[i]);
}
}
caseDetail.classifyListVOList = classifyList;
let newContent=''
const caseContent = response.data.content
let caseContentArr=[]
caseContentArr = caseContent.split('<img')
if(caseContentArr.length>0){
for(let i = 0; i < caseContentArr.length; i ++){
if(i == 0){
newContent = caseContentArr[i];
}else{
newContent = newContent + " <img style='width:100%;" + "' " + caseContentArr[i];
}
}
console.log("caseDetail.newContent", newContent)
}else{
newContent = response.data.content
}
caseDetail.content = newContent;
dispatch({
type: types.CASE_DETAIL,
data: caseDetail
});
dispatch({
type: types.CLASSIFY_LIST_VO_LIST,
classifyListVOList: classifyList,
});
if (callback) {
callback(caseDetail);
}
// 加工已选择分类数据,存储到selectedCategoryData中
let classifyListVO = response.data.classifyListVOList;
let selectedList = response.data.selectedList;
console.log("selectedList****", selectedList)
let selectedCategoryData = [];
for (let i = 0; i < selectedList.length; i ++) {
for (let k = 0; k < classifyListVO.length; k ++) {
if (selectedList[i].rootId == classifyListVO[k].id) {
if (selectedList[i].level == 1) {
for (let t = 0; t < classifyListVO[k].children.length; t ++) {
if (selectedList[i].classifyId == classifyListVO[k].children[t].id) {
let parentName = "";
if (selectedList[i].classifyParentName) {
parentName = selectedList[i].classifyParentName + "/"
}
selectedCategoryData.push({
levelIndex: k,
level: selectedList[i].level,
levelOneChildrenName: selectedList[i].classifyName,
levelOneName: selectedList[i].classifyParentName,
selectedCategoryDataIndex: t,
selectedCategoryDataName: parentName + selectedList[i].classifyName,
});
}
}
} else {
for (let j = 0; j < classifyListVO[k].children.length; j ++) {
for (let a = 0; a < classifyListVO[k].children[j].children.length; a ++) {
if (selectedList[i].classifyId == classifyListVO[k].children[j].children[a].id) {
selectedCategoryData.push({
levelIndex: k,
level: selectedList[i].level,
levelOneChildrenName: selectedList[i].classifyName,
levelOneName: selectedList[i].classifyParentName,
selectedCategoryDataIndex: j,
selectedCategoryDataName: selectedList[i].classifyParentName + "/" + selectedList[i].classifyName,
});
}
}
}
}
}
}
}
console.log("prepareStudentCaseById-selectedCategoryData", selectedCategoryData);
dispatch({
type: types.SAVE_SELECTED_CATEGORY_DATA,
data: selectedCategoryData,
});
}
});
}
}
/**
* 我的作品详情审核时如果可以重新选择分类,选择后保存改分类接口
* @param {*} saveUrl
* @param {*} saveParams
*/
export function saveReselectedClassifyData(saveUrl, saveParams, callback){
return dispatch =>{
fetchUtil.post(saveUrl, saveParams, (response)=>{
if(response.code == 1000){
if(callback){
callback(true)
}else{
callback(false)
}
}
})
}
}
/**
* 根据作品ID和endTime获取该作品提交记录列表
* @param {*} requestSubmittingRecordsUrl
* @param {*} requestSubmittingRecordsParams
*/
export function getCaseSubmittingRecordsListByIdAndEndTime (requestSubmittingRecordsUrl, requestSubmittingRecordsParams, callback) {
return dispatch => {
fetchUtil.getNetwork(requestSubmittingRecordsUrl, requestSubmittingRecordsParams, (response) => {
console.log("getCaseSubmittingRecordsListByIdAndEndTime-response", response);
if (response.code == 1000) {
dispatch({
type: types.CASE_LIBRARY_SUBMITTING_RECORDS_DATA,
data: response.data
});
if (callback) {
callback(response.data.studentCaseRecordList, response.data);
}
}
});
}
}
/**
* 作品提交记录列表-作品提交
* @param {*} uploadRecordSubmitURl
* @param {*} uploadRecordSubmitParams
*/
export function uploadRecordSubmitById (uploadRecordSubmitURl, uploadRecordSubmitParams, callback) {
return dispatch => {
fetchUtil.getNetwork(uploadRecordSubmitURl, uploadRecordSubmitParams, (response)=> {
console.log("uploadRecordSubmitById-response", response);
if (response.code == 1000) {
if (callback) {
callback(true);
}
}
});
// fetchUtil.post(uploadRecordSubmitURl, uploadRecordSubmitParams, (response)=> {
// console.log("uploadRecordSubmitById-response", response);
// if (response.code == 1000) {
// if (callback) {
// callback(true);
// }
// }
// });
}
}
/**
* 作品提交记录列表-作品撤回
* @param {*} uploadRecordRecalUrl
* @param {*} uploadRecordRecalParams
* @param {*} callback
*/
export function uploadRecordRecalById (uploadRecordRecalUrl, uploadRecordRecalParams, callback) {
return dispatch => {
fetchUtil.getNetwork(uploadRecordRecalUrl, uploadRecordRecalParams, (response) => {
console.log("uploadRecordRecalById-response", response);
if (response.code == 1000 ) {
if (callback) {
callback(true);
}
}
});
// fetchUtil.post(uploadRecordRecalUrl, uploadRecordRecalParams, (response) => {
// console.log("uploadRecordRecalById-response", response);
// if (response.code == 1000 ) {
// if (callback) {
// callback(true);
// }
// }
// });
}
}
/**
* 原创活动列表-上传作品,根据id获取该作品的部分基本信息如作品要求等
* @param {*} prepareStudentCaseUrl
* @param {*} prepareStudentCaseParams
*/
export function prepareStudentCaseById (prepareStudentCaseUrl, prepareStudentCaseParams, callback) {
return dispatch => {
fetchUtil.getNetwork(prepareStudentCaseUrl, prepareStudentCaseParams, (response) => {
console.log("prepareStudentCaseById-response", response);
if (response.code == 1000) {
const baseDetail = response.data;
// 处理过滤只有维度没有一级的分类
const classifyListVOList = response.data.classifyListVOList;
let classifyList = [];
for (let i = 0; i < classifyListVOList.length; i ++) {
console.log("prepareStudentCaseById-classifyListVOList[i].children.length", classifyListVOList[i].children.length);
if (classifyListVOList[i].children && classifyListVOList[i].children.length > 0) {
classifyList.push(classifyListVOList[i]);
}
}
baseDetail.classifyListVOList = classifyList;
console.log("prepareStudentCaseById-baseDetail", baseDetail);
console.log("prepareStudentCaseById-classifyList", classifyList);
dispatch({
type: types.UPLOAD_MY_CASE,
data: response.data,
});
dispatch({
type: types.CLASSIFY_LIST_VO_LIST,
classifyListVOList: classifyList,
});
if (callback) {
callback(baseDetail);
}
} else {
Toast.info(intl.get(response.subMsg),1);
}
});
}
}
export function saveKeyword(customKeyWordList){
return dispatch => {
dispatch({
type: types.SAVE_KEYWORD,
customKeyWordList:customKeyWordList
})
}
}
/**
* 上传作品,选择分类时,保存当期作品中填写的作品名称和内容
* @param {*} caseName
* @param {*} caseContent
*/
export function saveCaseNameAndContent (caseName, caseContent) {
return dispatch => {
dispatch({
type: types.SAVE_CASE_NAME_AND_CONTENT,
caseName: caseName,
caseContent: caseContent,
});
}
}
/**
* 上传作品时,保存选择的分类数据
* @param {*} saveData
*/
export function saveSelectedCategoryData (saveData) {
return dispatch => {
dispatch({
type: types.SAVE_SELECTED_CATEGORY_DATA,
data: saveData
});
}
}
/**
* 上传作品页面,保存或提交该新作品时调用,提交上传作品信息
* @param {*} saveOrSubmitUrl
* @param {*} saveOrSubmitParams
*/
export function saveOrSubmitUploadCase (saveOrSubmitUrl, saveOrSubmitParams) {
return dispatch => {
fetchUtil.post(saveOrSubmitUrl, saveOrSubmitParams, (response)=> {
console.log("saveOrSubmitUploadCase-response", response);
});
}
}
/**
* 根据作品id和type获取作品详情信息给caseEdit编辑页面
* @param {*} requestCaseDetailUrl
* @param {*} requestCaseDetailParams
* @param {*} callback
*/
export function getCaseDetailByIdAndTypeToCaseEdit (requestCaseEditDetailUrl, requestCaseEditDetailParams, caseEditTag, callback) {
return dispatch => {
fetchUtil.getNetwork(requestCaseEditDetailUrl, requestCaseEditDetailParams, (response) => {
console.log("getCaseDetailByIdAndTypeToCaseEdit-response", response);
if (response.code == 1000) {
const editDetail = response.data;
// 处理过滤只有维度没有一级的分类
const classifyListVOList = response.data.classifyListVOList;
let classifyList = [];
for (let i = 0; i < classifyListVOList.length; i ++) {
console.log("prepareStudentCaseById-classifyListVOList[i].children.length", classifyListVOList[i].children.length);
if (classifyListVOList[i].children && classifyListVOList[i].children.length > 0) {
classifyList.push(classifyListVOList[i]);
}
}
editDetail.classifyListVOList = classifyList;
console.log("prepareStudentCaseById-editDetail", editDetail);
console.log("prepareStudentCaseById-classifyList", classifyList);
dispatch({
type: types.CASE_EDIT_DETAIL,
data: editDetail
});
dispatch({
type: types.CLASSIFY_LIST_VO_LIST,
classifyListVOList: classifyList,
});
if (callback) {
callback(editDetail);
}
if (caseEditTag == 1) {
console.log("getCaseDetailByIdAndTypeToCaseEdit-caseEditTag11action", caseEditTag);
// 加工已选择分类数据,存储到selectedCategoryData中
let classifyListVO = response.data.classifyListVOList;
let selectedList = response.data.selectedList;
let selectedCategoryData = [];
console.log("getCaseDetailByIdAndTypeToCaseEdit-classifyList", classifyList);
console.log("getCaseDetailByIdAndTypeToCaseEdit-selectedList", selectedList);
for (let i = 0; i < selectedList.length; i ++) {
for (let k = 0; k < classifyListVO.length; k ++) {
if (selectedList[i].rootId == classifyListVO[k].id) {
if (selectedList[i].level == 1) {
for (let t = 0; t < classifyListVO[k].children.length; t ++) {
if (selectedList[i].classifyId == classifyListVO[k].children[t].id) {
let parentName = "";
if (selectedList[i].classifyParentName) {
parentName = selectedList[i].classifyParentName + "/"
}
selectedCategoryData.push({
levelIndex: k,
level: selectedList[i].level,
levelOneChildrenName: selectedList[i].classifyName,
levelOneName: selectedList[i].classifyParentName,
selectedCategoryDataIndex: t,
selectedCategoryDataName: parentName + selectedList[i].classifyName,
});
console.log("getCaseDetailByIdAndTypeToCaseEdit-selectedCategoryData", selectedCategoryData);
}
}
} else {
console.log("--------");
for (let j = 0; j < classifyListVO[k].children.length; j ++) {
for (let a = 0; a < classifyListVO[k].children[j].children.length; a ++) {
if (selectedList[i].classifyId == classifyListVO[k].children[j].children[a].id) {
console.log("getCaseDetailByIdAndTypeToCaseEdit-selectedList[i].classifyName", selectedList[i].classifyName);
console.log("getCaseDetailByIdAndTypeToCaseEdit-classifyListVOList[k].children[j]", j);
selectedCategoryData.push({
levelIndex: k,
level: selectedList[i].level,
levelOneChildrenName: selectedList[i].classifyName,
levelOneName: selectedList[i].classifyParentName,
selectedCategoryDataIndex: j,
selectedCategoryDataName: selectedList[i].classifyParentName + "/" + selectedList[i].classifyName,
});
console.log("getCaseDetailByIdAndTypeToCaseEdit-selectedCategoryData", selectedCategoryData);
}
}
}
}
}
}
}
console.log("getCaseDetailByIdAndTypeToCaseEdit-selectedCategoryData", selectedCategoryData);
dispatch({
type: types.SAVE_SELECTED_CATEGORY_DATA,
data: selectedCategoryData,
});
}
}
});
}
}
/**
* 删除提交记录列表中我的一条未提交过的提交记录
* @param {*} deleteCaseUrl
* @param {*} deleteCaseParams
*/
export function deleteCaseById (deleteCaseUrl, deleteCaseParams, callback) {
return dispatch => {
fetchUtil.getNetwork(deleteCaseUrl, deleteCaseParams, (response) => {
console.log("deleteCaseById-response", response);
if (response.code == 1000) {
if (callback) {
callback(true);
}
}
});
}
}
/**
* 更新是否从分类进入编辑页面标识信息
* @param {*} caseName
*/
export function changeCategoryFlagState (flag) {
return dispatch => {
dispatch({
type: types.FROM_CATEGORY_FLAG,
data: flag
});
}
}
/**
* 更新作品封面图state
* @param {*} caseLogoUrl
*/
export function changeLogoUrlState (caseLogoUrl) {
return dispatch => {
dispatch({
type: types.CASE_COVER_URL,
data: caseLogoUrl
});
}
}
/**
* 更新选择的作品分类
* @param {*} selectedClassifyList
*/
export function changeSelectedClassifyState (selectedClassifyList) {
return dispatch => {
dispatch({
type: types.CASE_SELECTED_CLASSIFY,
data: selectedClassifyList,
});
}
}
export function initialState () {
return dispatch => {
dispatch({
type: types.INITIAL_STATE,
});
}
}
/**
* 更新上传作品附件信息
* @param {*} attachmentList
*/
export function changeAttachmentListState (attachmentList) {
return dispatch => {
dispatch({
type: types.ATTACHEMNT_LIST,
data: attachmentList
});
}
}
/**
* 更新编辑作品附件列表信息
* @param {*} editAttachmentList
*/
export function changeEditAttachmentListState (editAttachmentList) {
console.log("changeEditAttachmentListState-editAttachmentList", editAttachmentList);
return dispatch => {
dispatch({
type: types.EDIT_ATTACHMENT_LIST,
data: editAttachmentList
});
}
}
// 判断作品编辑页面是选择分类还是推出编辑页面
export function breakOrNo(data){
return dispatch => {
dispatch({
type: types.BREAK_PAGE_OR_NO,
data
});
}
}
\ 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