Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sass-admin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李晨
sass-admin
Commits
bfe13a01
Commit
bfe13a01
authored
Aug 28, 2025
by
end
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
投票管理bug修复
parent
3eccfa1a
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
450 additions
and
1244 deletions
+450
-1244
dist.zip
+0
-0
src/pages/TrainingTools/Survey/Create/AddTest.jsx
+1
-1
src/pages/TrainingTools/Survey/Create/TestModal.jsx
+3
-656
src/pages/TrainingTools/Survey/Create/index.jsx
+0
-26
src/pages/TrainingTools/Survey/Details/index.jsx
+36
-326
src/pages/TrainingTools/Survey/component/UploadUtil.jsx
+196
-0
src/pages/TrainingTools/Survey/component/api.js
+15
-0
src/pages/TrainingTools/Survey/component/index.less
+61
-0
src/pages/TrainingTools/Survey/component/redux/actionTypes.js
+9
-0
src/pages/TrainingTools/Survey/component/redux/actions.js
+89
-0
src/pages/TrainingTools/Survey/component/redux/reduter.js
+40
-0
src/pages/TrainingTools/Survey/redux/actions.js
+0
-235
No files found.
dist.zip
View file @
bfe13a01
No preview for this file type
src/pages/TrainingTools/Survey/Create/AddTest.jsx
View file @
bfe13a01
...
@@ -440,7 +440,7 @@ class AddTest extends Component {
...
@@ -440,7 +440,7 @@ class AddTest extends Component {
* */
* */
console
.
log
(
"xxxxxxxxxxxxaaaaa"
,
this
.
state
.
testItem
.
contentAppendixUrl
);
console
.
log
(
"xxxxxxxxxxxxaaaaa"
,
this
.
state
.
testItem
.
contentAppendixUrl
);
const
uploadProps
=
{
const
uploadProps
=
{
uploadUtilName
:
"上传图片
/音/视频
"
,
uploadUtilName
:
"上传图片"
,
getUrl
:
(
fileUrl
,
fileName
)
=>
{
getUrl
:
(
fileUrl
,
fileName
)
=>
{
this
.
setState
({
this
.
setState
({
fileUrl
,
fileUrl
,
...
...
src/pages/TrainingTools/Survey/Create/TestModal.jsx
View file @
bfe13a01
...
@@ -3,27 +3,16 @@ import styles from "./index.less";
...
@@ -3,27 +3,16 @@ import styles from "./index.less";
import
{
import
{
Form
,
Form
,
Input
,
Input
,
Select
,
Radio
,
Radio
,
Icon
,
Button
,
Checkbox
,
Row
,
Row
,
Col
,
Col
,
Divider
,
Switch
,
InputNumber
,
message
,
message
,
Modal
,
}
from
"antd"
;
}
from
"antd"
;
// import { ucfetch,gupfetch,gcbfetch} from 'ACTIONS/credential'
import
UploadUtil
from
"../component/UploadUtil"
;
import
UploadUtil
from
"@/common/UpLoad/UploadUtil"
;
import
TagGroup
from
"@/common/tags"
;
const
{
TextArea
}
=
Input
;
const
{
TextArea
}
=
Input
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
RadioGroup
=
Radio
.
Group
;
const
RadioGroup
=
Radio
.
Group
;
const
RadioButton
=
Radio
.
Button
;
const
RadioButton
=
Radio
.
Button
;
const
Option
=
Select
.
Option
;
let
uuid1
=
4
;
let
uuid1
=
4
;
let
uuid2
=
4
;
let
uuid2
=
4
;
...
@@ -40,26 +29,17 @@ class TestModal extends Component {
...
@@ -40,26 +29,17 @@ class TestModal extends Component {
uuid1
:
defaultValue
.
options
?
defaultValue
.
options
.
length
:
4
,
uuid1
:
defaultValue
.
options
?
defaultValue
.
options
.
length
:
4
,
uuid3
:
defaultValue
.
options
?
defaultValue
.
options
.
length
:
1
,
uuid3
:
defaultValue
.
options
?
defaultValue
.
options
.
length
:
1
,
other
:
"其他"
,
other
:
"其他"
,
isempty
:
false
,
ismust
:
false
,
addother
:
false
,
addother
:
false
,
keywords
:
""
,
keywords
:
""
,
};
};
// uuid1=defaultValue.options?defaultValue.options.length:4;
// uuid2=defaultValue.options?defaultValue.options.length:4;
// uuid3=defaultValue.options?defaultValue.options.length:1;
this
.
handleRadioChange
=
this
.
handleRadioChange
.
bind
(
this
);
this
.
handleRadioChange
=
this
.
handleRadioChange
.
bind
(
this
);
this
.
handleSelectChange
=
this
.
handleSelectChange
.
bind
(
this
);
this
.
handleAddRadio
=
this
.
handleAddRadio
.
bind
(
this
);
}
}
handleRadioChange
(
e
)
{
handleRadioChange
(
e
)
{
// console.log(e.target.value)
this
.
setState
({
this
.
setState
({
radioNum
:
e
.
target
.
value
,
radioNum
:
e
.
target
.
value
,
});
});
}
}
handleSelectChange
(
value
)
{}
componentWillUnmount
()
{
componentWillUnmount
()
{
uuid1
=
4
;
/* bug11197:选项数未初始化造成创建下一题时的默认项数为上一次创建修改后的值 zhouzhongyang20200630*/
uuid1
=
4
;
/* bug11197:选项数未初始化造成创建下一题时的默认项数为上一次创建修改后的值 zhouzhongyang20200630*/
uuid2
=
4
;
uuid2
=
4
;
...
@@ -77,17 +57,10 @@ class TestModal extends Component {
...
@@ -77,17 +57,10 @@ class TestModal extends Component {
if
(
defaultValue
.
hasOther
==
1
)
{
if
(
defaultValue
.
hasOther
==
1
)
{
this
.
setState
({
this
.
setState
({
addother
:
defaultValue
.
hasOther
==
1
?
true
:
false
,
addother
:
defaultValue
.
hasOther
==
1
?
true
:
false
,
ismust
:
defaultValue
.
otherOptionVo
.
required
==
1
?
true
:
false
,
isempty
:
defaultValue
.
otherOptionVo
.
editable
==
1
?
true
:
false
,
other
:
defaultValue
.
otherOptionVo
.
content
,
other
:
defaultValue
.
otherOptionVo
.
content
,
});
});
}
}
}
}
handleAddRadio
()
{
this
.
setState
({
Rnumber
:
this
.
state
.
Rnumber
++
,
});
}
remove1
=
k
=>
{
remove1
=
k
=>
{
const
{
form
}
=
this
.
props
;
const
{
form
}
=
this
.
props
;
...
@@ -100,80 +73,6 @@ class TestModal extends Component {
...
@@ -100,80 +73,6 @@ class TestModal extends Component {
keys1
:
keys1
.
filter
(
item
=>
item
.
no
!==
k
),
keys1
:
keys1
.
filter
(
item
=>
item
.
no
!==
k
),
});
});
};
};
add1
=
()
=>
{
const
{
form
}
=
this
.
props
;
const
keys1
=
form
.
getFieldValue
(
"keys1"
);
const
nextKeys
=
keys1
.
concat
({
no
:
uuid1
});
uuid1
++
;
form
.
setFieldsValue
({
keys1
:
nextKeys
,
});
};
add4
()
{}
remove2
=
k
=>
{
const
{
form
}
=
this
.
props
;
const
keys2
=
form
.
getFieldValue
(
"keys2"
);
if
(
keys2
.
length
===
1
)
{
return
;
}
form
.
setFieldsValue
({
keys2
:
keys2
.
filter
(
item
=>
item
.
no
!==
k
),
});
};
add2
=
()
=>
{
const
{
form
}
=
this
.
props
;
const
keys2
=
form
.
getFieldValue
(
"keys2"
);
const
nextKeys
=
keys2
.
concat
({
no
:
uuid2
});
uuid2
++
;
form
.
setFieldsValue
({
keys2
:
nextKeys
,
});
};
remove3
=
k
=>
{
const
{
form
}
=
this
.
props
;
const
keys3
=
form
.
getFieldValue
(
"keys3"
);
if
(
keys3
.
length
===
1
)
{
return
;
}
form
.
setFieldsValue
({
keys3
:
keys3
.
filter
(
item
=>
item
.
no
!==
k
),
});
};
add3
=
()
=>
{
const
{
form
}
=
this
.
props
;
const
keys3
=
form
.
getFieldValue
(
"keys3"
);
const
nextKeys
=
keys3
.
concat
({
no
:
uuid3
});
uuid3
++
;
form
.
setFieldsValue
({
keys3
:
nextKeys
,
});
};
isempty
()
{
this
.
setState
(
{
isempty
:
!
this
.
state
.
isempty
,
},
()
=>
{
if
(
this
.
state
.
isempty
==
false
)
{
this
.
setState
({
ismust
:
false
,
});
}
}
);
}
ismust
()
{
this
.
setState
({
ismust
:
!
this
.
state
.
ismust
,
});
}
addother
()
{
addother
()
{
if
(
this
.
state
.
addother
==
false
)
{
if
(
this
.
state
.
addother
==
false
)
{
this
.
setState
({
this
.
setState
({
...
@@ -185,82 +84,31 @@ class TestModal extends Component {
...
@@ -185,82 +84,31 @@ class TestModal extends Component {
}
}
getTags
=
tags
=>
{
getTags
=
tags
=>
{
this
.
setState
({
keywords
:
tags
.
join
()
});
this
.
setState
({
keywords
:
tags
.
join
()
});
console
.
log
(
tags
.
join
(),
"任务938"
);
};
};
render
()
{
render
()
{
const
{
defaultValue
,
jumptests
}
=
this
.
props
;
const
{
defaultValue
}
=
this
.
props
;
let
defaultTags
=
[];
console
.
log
(
defaultValue
,
11111
);
if
(
defaultValue
.
keywords
)
{
defaultTags
=
defaultValue
.
keywords
.
split
(
","
);
}
const
tagPropsNew
=
{
defaultTags
:
defaultTags
,
getTags
:
this
.
getTags
,
};
const
{
radioNum
}
=
this
.
state
;
const
{
radioNum
}
=
this
.
state
;
const
{
getFieldDecorator
,
getFieldValue
}
=
this
.
props
.
form
;
const
{
getFieldDecorator
,
getFieldValue
}
=
this
.
props
.
form
;
const
formItemLayout
=
{
const
formItemLayout
=
{
labelCol
:
{
span
:
3
},
labelCol
:
{
span
:
3
},
wrapperCol
:
{
span
:
20
},
wrapperCol
:
{
span
:
20
},
};
};
console
.
log
(
"默认回显"
,
defaultValue
);
const
children
=
[];
for
(
let
i
=
0
;
i
<
jumptests
.
length
;
i
++
)
{
children
.
push
(
<
Option
key=
{
jumptests
[
i
].
no
}
>
<
span
style=
{
{
marginRight
:
10
}
}
>
{
jumptests
[
i
].
no
}
:
</
span
>
{
jumptests
[
i
].
type
===
1
&&
<
span
>
单选题
</
span
>
}
{
jumptests
[
i
].
type
===
2
&&
<
span
>
多选题
</
span
>
}
{
jumptests
[
i
].
type
===
3
&&
<
span
>
问答题
</
span
>
}
{
jumptests
[
i
].
type
===
4
&&
<
span
>
打分题
</
span
>
}
<
p
>
{
jumptests
[
i
].
content
}
</
p
>
</
Option
>
);
}
getFieldDecorator
(
"keys1"
,
{
getFieldDecorator
(
"keys1"
,
{
initialValue
:
initialValue
:
defaultValue
.
options
&&
defaultValue
.
options
.
length
>
0
defaultValue
.
options
&&
defaultValue
.
options
.
length
>
0
?
defaultValue
.
options
?
defaultValue
.
options
:
[{
no
:
0
}],
:
[{
no
:
0
}],
});
});
getFieldDecorator
(
"keys2"
,
{
initialValue
:
defaultValue
.
options
&&
defaultValue
.
options
.
length
>
0
?
defaultValue
.
options
:
[{
no
:
0
},
{
no
:
1
},
{
no
:
2
},
{
no
:
3
}],
});
getFieldDecorator
(
"keys3"
,
{
initialValue
:
defaultValue
.
options
&&
defaultValue
.
options
.
length
>
0
?
defaultValue
.
options
:
[{
no
:
0
}],
});
const
keys1
=
getFieldValue
(
"keys1"
);
const
keys1
=
getFieldValue
(
"keys1"
);
const
keys2
=
getFieldValue
(
"keys2"
);
const
keys3
=
getFieldValue
(
"keys3"
);
return
(
return
(
<
Form
className=
{
styles
.
survey_testmodal
}
>
<
Form
className=
{
styles
.
survey_testmodal
}
>
<
FormItem
{
...
formItemLayout
}
label=
"问题类型:"
>
<
FormItem
{
...
formItemLayout
}
label=
"问题类型:"
>
{
getFieldDecorator
(
"type"
,
{
{
getFieldDecorator
(
"type"
,
{
initialValue
:
defaultValue
.
type
?
defaultValue
.
type
:
1
,
initialValue
:
defaultValue
.
type
?
defaultValue
.
type
:
1
,
rules
:
[
{
required
:
true
,
message
:
"请选择题型"
,
},
],
})(
})(
<
RadioGroup
onChange=
{
this
.
handleRadioChange
}
>
<
RadioGroup
>
<
RadioButton
value=
{
1
}
>
单选题
</
RadioButton
>
<
RadioButton
value=
{
1
}
>
单选题
</
RadioButton
>
{
/* <RadioButton value={2}>多选题</RadioButton>
<RadioButton value={3}>问答题</RadioButton>
<RadioButton value={4}>打分题</RadioButton> */
}
</
RadioGroup
>
</
RadioGroup
>
)
}
)
}
</
FormItem
>
</
FormItem
>
...
@@ -292,37 +140,13 @@ class TestModal extends Component {
...
@@ -292,37 +140,13 @@ class TestModal extends Component {
<
RadioGroup
style=
{
{
width
:
"100%"
}
}
>
<
RadioGroup
style=
{
{
width
:
"100%"
}
}
>
{
radioNum
===
1
&&
(
{
radioNum
===
1
&&
(
<
div
className=
{
styles
.
survey_testmodal_1
}
>
<
div
className=
{
styles
.
survey_testmodal_1
}
>
<
p
style=
{
{
width
:
"80px"
,
display
:
"inline-block"
,
lineHeight
:
"39px"
,
}
}
>
答题策略
</
p
>
<
FormItem
style=
{
{
marginBottom
:
-
4
,
display
:
"inline-block"
}
}
>
{
getFieldDecorator
(
`needAnswer`
,
{
valuePropName
:
"checked"
,
initialValue
:
defaultValue
.
needAnswer
?
defaultValue
.
needAnswer
!==
0
:
false
,
})(<
Checkbox
>
必答
</
Checkbox
>)
}
</
FormItem
>
<
Row
gutter=
{
23
}
>
<
Row
gutter=
{
23
}
>
<
span
style=
{
{
color
:
"red"
,
float
:
"left"
}
}
>
*
</
span
>
<
span
style=
{
{
color
:
"red"
,
float
:
"left"
}
}
>
*
</
span
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
9
}
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
9
}
>
选项内容
选项内容
</
Col
>
</
Col
>
{
/*<Col className="gutter-row" span={4}>
允许填空
</Col>
<Col className="gutter-row" span={6}>
跳题
</Col>*/
}
</
Row
>
</
Row
>
{
keys1
.
map
((
item
,
k
)
=>
{
{
keys1
.
map
((
item
,
k
)
=>
{
// console.log(item.correct?item.correct!==0:false)
return
(
return
(
<
Row
gutter=
{
23
}
>
<
Row
gutter=
{
23
}
>
<
FormItem
style=
{
{
display
:
"none"
}
}
>
<
FormItem
style=
{
{
display
:
"none"
}
}
>
...
@@ -348,492 +172,15 @@ class TestModal extends Component {
...
@@ -348,492 +172,15 @@ class TestModal extends Component {
})(<
TextArea
/>)
}
})(<
TextArea
/>)
}
</
FormItem
>
</
FormItem
>
</
Col
>
</
Col
>
{
/* <Col className="gutter-row" span={4}>
<FormItem>
{getFieldDecorator(`editable[${item.no}]`, {
valuePropName: 'checked',
initialValue:item.editable?item.editable:"",
})(
<Checkbox />
)}</FormItem>
</Col>
<Col className="gutter-row" span={6}>
<FormItem>
{getFieldDecorator(`jumpNum[${item.no}]`, {
initialValue:item.jumpNum?item.jumpNum:"",
})(
<Select onChange={this.handleSelectChange}
getPopupContainer={() => document.getElementById('dselect')}>
{children}
</Select>
)}
</FormItem>
</Col>*/
}
{
keys1
.
length
>
1
?
(
<
Icon
className=
{
styles
.
survey_delete_button
}
type=
"minus-circle-o"
disabled=
{
keys1
.
length
===
1
}
onClick=
{
()
=>
{
this
.
remove1
(
item
.
no
);
}
}
/>
)
:
null
}
</
Row
>
</
Row
>
);
);
})
}
})
}
{
/* <div style={{width:'300px'}}>
<div style={{width:'255px',border: '1px solid #ccc',borderRadius: '4px',display:'inline-block'}}>
<Input /><Checkbox />是否填空<Checkbox/>必填</div>
<div style={{display:'inline-block',marginLeft:'10px'}}>
<Icon
className="survey-delete-button"
type="minus-circle-o"
/>
</div>
</div>*/
}
{
this
.
state
.
addother
?
(
<
Row
gutter=
{
23
}
style=
{
{
paddingBottom
:
"14px"
}
}
>
<
Col
className=
"gutter-row"
span=
{
9
}
>
<
div
style=
{
{
width
:
"255px"
,
border
:
"1px solid #ccc"
,
borderRadius
:
"4px"
,
}
}
>
<
Input
value=
{
this
.
state
.
other
}
onChange=
{
e
=>
this
.
setState
({
other
:
e
.
target
.
value
})
}
/>
<
Checkbox
checked=
{
this
.
state
.
isempty
}
onChange=
{
()
=>
this
.
isempty
()
}
/>
是否填空
{
this
.
state
.
isempty
?
(
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
Checkbox
checked=
{
this
.
state
.
ismust
}
onChange=
{
()
=>
this
.
ismust
()
}
/>
必填
</
div
>
)
:
null
}
</
div
>
</
Col
>
<
Icon
onClick=
{
()
=>
this
.
setState
({
addother
:
false
,
isempty
:
false
,
ismust
:
false
,
other
:
"其他"
,
})
}
className=
"survey-delete-button"
type=
"minus-circle-o"
/>
</
Row
>
)
:
null
}
{
/* <div>
<span onClick={this.add1} ref="asdf">
<Icon type="plus" /> 添加选项
</span>
</div>
<div>
<span onClick={() => this.addother()}>
<Icon type="plus" /> 添加其他项
<Dquestion />
</span>
</div> */
}
{
/* <Divider />*/
}
</
div
>
</
div
>
)
}
)
}
</
RadioGroup
>
</
RadioGroup
>
{
radioNum
===
2
&&
(
<
div
className=
{
styles
.
survey_testmodal_1
}
>
<
p
style=
{
{
width
:
"80px"
,
display
:
"inline-block"
,
lineHeight
:
"39px"
,
}
}
>
答题策略
</
p
>
<
FormItem
style=
{
{
marginBottom
:
-
4
,
display
:
"inline-block"
}
}
>
{
getFieldDecorator
(
`needAnswer`
,
{
valuePropName
:
"checked"
,
initialValue
:
defaultValue
.
needAnswer
?
defaultValue
.
needAnswer
!==
0
:
false
,
})(<
Checkbox
>
必答
</
Checkbox
>)
}
</
FormItem
>
<
Row
gutter=
{
23
}
>
{
/* <Col span={4}/> */
}
<
span
style=
{
{
color
:
"red"
,
float
:
"left"
}
}
>
*
</
span
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
15
}
>
选项内容
</
Col
>
{
/* <Col className="gutter-row" span={4}>
允许填空
</Col>
<Col className="gutter-row" span={6}>
跳题
</Col>*/
}
</
Row
>
{
keys2
.
map
((
item
,
k
)
=>
{
return
(
<
Row
gutter=
{
23
}
>
<
FormItem
style=
{
{
display
:
"none"
}
}
>
{
getFieldDecorator
(
`no[${item.no}]`
,
{
initialValue
:
item
.
no
,
})(<
a
/>)
}
</
FormItem
>
{
/* <Col className="gutter-row" span={4}>
<FormItem>
{getFieldDecorator(`correct[${k}]`, {
valuePropName: 'checked',
initialValue:item.correct?item.correct!==0:false
})(
<Radio />
)}
</FormItem>
</Col> */
}
<
Col
className=
{
styles
.
gutter_row
}
span=
{
15
}
>
<
FormItem
>
{
getFieldDecorator
(
`cont[${item.no}]`
,
{
initialValue
:
item
.
content
?
item
.
content
:
""
,
rules
:
[
{
required
:
true
,
whitespace
:
true
,
message
:
"请输入选项内容或删除该选项"
,
},
],
})(<
TextArea
/>)
}
</
FormItem
>
</
Col
>
{
/* <Col className="gutter-row" span={4}>
<FormItem>
{getFieldDecorator(`editable[${item.no}]`, {
valuePropName: 'checked',
initialValue:item.editable?item.editable:"",
})(
<Checkbox />
)}</FormItem>
</Col>
<Col className="gutter-row" span={6}>
<FormItem>
{getFieldDecorator(`jumpNum[${item.no}]`, {
initialValue:item.jumpNum?item.jumpNum:"",
})(
<Select onChange={this.handleSelectChange}>
{children}
</Select>
)}
</FormItem>
</Col> */
}
{
keys2
.
length
>
1
?
(
<
Icon
className=
{
styles
.
survey_delete_button
}
type=
"minus-circle-o"
disabled=
{
keys2
.
length
===
1
}
onClick=
{
()
=>
{
this
.
remove2
(
item
.
no
);
}
}
/>
)
:
null
}
</
Row
>
);
})
}
{
this
.
state
.
addother
?
(
<
Row
gutter=
{
23
}
style=
{
{
paddingBottom
:
"14px"
}
}
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
9
}
>
<
div
style=
{
{
width
:
"255px"
,
border
:
"1px solid #ccc"
,
borderRadius
:
"4px"
,
}
}
>
<
Input
value=
{
this
.
state
.
other
}
onChange=
{
e
=>
this
.
setState
({
other
:
e
.
target
.
value
})
}
/>
<
Checkbox
checked=
{
this
.
state
.
isempty
}
onChange=
{
()
=>
this
.
isempty
()
}
/>
是否填空
{
this
.
state
.
isempty
?
(
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
Checkbox
checked=
{
this
.
state
.
ismust
}
onChange=
{
()
=>
this
.
ismust
()
}
/>
必填
</
div
>
)
:
null
}
</
div
>
</
Col
>
<
Icon
onClick=
{
()
=>
this
.
setState
({
addother
:
false
,
isempty
:
false
,
ismust
:
false
,
other
:
"其他"
,
})
}
className=
{
styles
.
survey_delete_button
}
type=
"minus-circle-o"
/>
</
Row
>
)
:
null
}
<
div
>
<
span
onClick=
{
this
.
add2
}
>
<
Icon
type=
"plus"
/>
添加选项
</
span
>
</
div
>
<
div
>
<
span
onClick=
{
()
=>
this
.
setState
({
addother
:
true
})
}
>
<
Icon
type=
"plus"
/>
添加其他项
</
span
>
</
div
>
{
/* <Divider />*/
}
{
/*<FormItem style={{marginBottom:-12}}>*/
}
{
/*{getFieldDecorator(`needAnswer1`, {*/
}
{
/*valuePropName: 'checked',*/
}
{
/*initialValue:defaultValue.minSelectItem?true:false,*/
}
{
/*})(*/
}
{
/*<Checkbox>至少选*/
}
{
/*<div style={{display:"inline-block"}}>*/
}
{
/*<FormItem>*/
}
{
/*{getFieldDecorator(`minSelectItem`, {*/
}
{
/*initialValue:defaultValue.minSelectItem?defaultValue.minSelectItem:"",*/
}
{
/*})(*/
}
{
/*<InputNumber min={1} style={{margin:"0 10px"}} />*/
}
{
/*// <input style={{width:30,height:20,borderTop:"none",borderLeft:"none",borderRight:"none",textAlign:"center"}} />*/
}
{
/*)}*/
}
{
/*</FormItem>*/
}
{
/*</div>项*/
}
{
/*</Checkbox>*/
}
{
/*)}*/
}
{
/*</FormItem>*/
}
{
/*<FormItem style={{marginBottom:-12}}>*/
}
{
/*{getFieldDecorator(`needAnswer2`, {*/
}
{
/*valuePropName: 'checked',*/
}
{
/*initialValue:defaultValue.maxSelectItem?true:false,*/
}
{
/*})(*/
}
{
/*<Checkbox>至多选*/
}
{
/*<div style={{display:"inline-block"}}>*/
}
{
/*<FormItem>*/
}
{
/*{getFieldDecorator(`maxSelectItem`, {*/
}
{
/*initialValue:defaultValue.maxSelectItem?defaultValue.maxSelectItem:"",*/
}
{
/*})(*/
}
{
/*<InputNumber min={1} style={{margin:"0 10px"}}/>*/
}
{
/*// <input style={{width:30,height:20,borderTop:"none",borderLeft:"none",borderRight:"none",textAlign:"center"}} />*/
}
{
/*)}*/
}
{
/*</FormItem>*/
}
{
/*</div>项*/
}
{
/*</Checkbox>*/
}
{
/*)}*/
}
{
/*</FormItem>*/
}
</
div
>
)
}
{
radioNum
===
3
&&
(
<
div
className=
{
styles
.
survey_testmodal_1
}
>
<
p
style=
{
{
width
:
"80px"
,
display
:
"inline-block"
,
lineHeight
:
"39px"
,
}
}
>
答题策略
</
p
>
<
FormItem
style=
{
{
marginBottom
:
-
4
,
display
:
"inline-block"
}
}
>
{
getFieldDecorator
(
`needAnswer`
,
{
valuePropName
:
"checked"
,
initialValue
:
defaultValue
.
needAnswer
?
defaultValue
.
needAnswer
!==
0
:
false
,
})(<
Checkbox
>
必答
</
Checkbox
>)
}
</
FormItem
>
{
/*<Divider />*/
}
</
div
>
)
}
{
radioNum
===
4
&&
(
<
div
className=
{
styles
.
survey_testmodal_1
}
>
<
p
style=
{
{
width
:
"80px"
,
display
:
"inline-block"
,
lineHeight
:
"39px"
,
}
}
>
答题策略
</
p
>
<
FormItem
style=
{
{
marginBottom
:
-
4
,
display
:
"inline-block"
}
}
>
{
getFieldDecorator
(
`needAnswer`
,
{
valuePropName
:
"checked"
,
initialValue
:
defaultValue
.
needAnswer
?
defaultValue
.
needAnswer
!==
0
:
false
,
})(<
Checkbox
>
必答
</
Checkbox
>)
}
</
FormItem
>
<
Row
gutter=
{
23
}
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
12
}
>
打分内容
</
Col
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
5
}
>
最小值
</
Col
>
<
Col
className=
"gutter-row"
span=
{
5
}
>
最大值
</
Col
>
</
Row
>
{
keys3
.
map
((
item
,
k
)
=>
{
// console.log(item)
return
(
<
Row
gutter=
{
23
}
>
<
FormItem
style=
{
{
display
:
"none"
}
}
>
{
getFieldDecorator
(
`no[${item.no}]`
,
{
initialValue
:
item
.
no
,
})(<
a
/>)
}
</
FormItem
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
12
}
>
<
FormItem
>
{
getFieldDecorator
(
`cont[${item.no}]`
,
{
initialValue
:
item
.
content
?
item
.
content
:
""
,
rules
:
[
{
required
:
true
,
message
:
"请输入选项内容或删除该选项"
,
},
],
})(<
TextArea
/>)
}
</
FormItem
>
</
Col
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
5
}
>
<
FormItem
>
{
getFieldDecorator
(
`minScore[${item.no}]`
,
{
initialValue
:
item
.
minScore
?
item
.
minScore
:
item
.
minScore
==
0
?
0
:
""
,
rules
:
[
{
required
:
true
,
message
:
"请填写最小值"
,
},
],
})(<
InputNumber
min=
{
0
}
max=
{
9
}
placeholder=
"0"
/>)
}
</
FormItem
>
</
Col
>
<
Col
className=
{
styles
.
gutter_row
}
span=
{
5
}
>
<
FormItem
>
{
getFieldDecorator
(
`maxScore[${item.no}]`
,
{
initialValue
:
item
.
maxScore
?
item
.
maxScore
:
""
,
rules
:
[
{
required
:
true
,
message
:
"请填写最大值"
,
},
],
})(<
InputNumber
min=
{
1
}
max=
{
10
}
placeholder=
"10"
/>)
}
</
FormItem
>
</
Col
>
{
keys3
.
length
>
1
?
(
<
Icon
className=
{
styles
.
survey_delete_button
}
type=
"minus-circle-o"
disabled=
{
keys3
.
length
===
1
}
onClick=
{
()
=>
{
this
.
remove3
(
item
.
no
);
}
}
/>
)
:
null
}
</
Row
>
);
})
}
<
span
onClick=
{
this
.
add3
}
>
<
Icon
type=
"plus"
/>
添加打分项
</
span
>
{
/* <Divider />*/
}
</
div
>
)
}
</
div
>
</
div
>
<
FormItem
label=
"选项关键词"
{
...
formItemLayout
}
>
{
getFieldDecorator
(
"keywords"
)(<
TagGroup
{
...
tagPropsNew
}
/>)
}
</
FormItem
>
</
Form
>
</
Form
>
);
);
}
}
}
}
//问号点击展示
class
Dquestion
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
visible
:
false
,
};
}
showModal
(
e
)
{
e
.
stopPropagation
();
this
.
setState
({
visible
:
true
,
});
}
handleOk
(
e
)
{
this
.
setState
({
visible
:
false
,
});
}
handleCancel
(
e
)
{
this
.
setState
({
visible
:
false
,
});
}
render
()
{
return
(
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
div
style=
{
{
display
:
"inline-block"
}
}
>
<
span
className=
{
styles
.
question
}
onClick=
{
this
.
showModal
.
bind
(
this
)
}
>
?
</
span
>
<
Modal
title=
"添加其它项"
visible=
{
this
.
state
.
visible
}
onOk=
{
this
.
handleOk
.
bind
(
this
)
}
onCancel=
{
this
.
handleCancel
.
bind
(
this
)
}
footer=
{
null
}
>
<
p
>
其他项指选项内容为“其他”的选项,当添加
至选项列表后,你可设置是否允许填空,让
学员填写补充说明。一道选择题可添加一个 其他项。
</
p
>
</
Modal
>
</
div
>
</
div
>
);
}
}
export
default
Form
.
create
()(
TestModal
);
export
default
Form
.
create
()(
TestModal
);
src/pages/TrainingTools/Survey/Create/index.jsx
View file @
bfe13a01
...
@@ -3,7 +3,6 @@ import Base from "./Base";
...
@@ -3,7 +3,6 @@ import Base from "./Base";
import
AddTest
from
"./AddTest"
;
import
AddTest
from
"./AddTest"
;
import
Jumpquestion
from
"./jumpquestios.js"
;
import
Jumpquestion
from
"./jumpquestios.js"
;
import
MessageRemind
from
"@/common/MessageRemind"
;
import
MessageRemind
from
"@/common/MessageRemind"
;
import
TagGroup
from
"@/common/tags"
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
{
message
}
from
"antd"
;
import
{
message
}
from
"antd"
;
import
{
Link
,
browserHistory
,
withRouter
}
from
"react-router-dom"
;
import
{
Link
,
browserHistory
,
withRouter
}
from
"react-router-dom"
;
...
@@ -220,13 +219,6 @@ class SurveyCreact extends Component {
...
@@ -220,13 +219,6 @@ class SurveyCreact extends Component {
console
.
log
(
tags
.
join
(),
"任务938"
);
console
.
log
(
tags
.
join
(),
"任务938"
);
};
};
//设置日历任务状态
changeTask
=
value
=>
{
this
.
setState
({
enableTask
:
value
,
});
};
render
()
{
render
()
{
const
{
details
,
surid
,
newsList
}
=
this
.
props
;
const
{
details
,
surid
,
newsList
}
=
this
.
props
;
...
@@ -248,12 +240,6 @@ class SurveyCreact extends Component {
...
@@ -248,12 +240,6 @@ class SurveyCreact extends Component {
if
(
details
.
keywords
)
{
if
(
details
.
keywords
)
{
defaultTags
=
details
.
keywords
.
split
(
","
);
defaultTags
=
details
.
keywords
.
split
(
","
);
}
}
const
tagPropsNew
=
{
defaultTags
:
defaultTags
,
getTags
:
this
.
getTags
,
};
// 938 结束
// 938 结束
const
remindProps
=
{
const
remindProps
=
{
defaultValue
:
details
,
defaultValue
:
details
,
...
@@ -285,13 +271,7 @@ class SurveyCreact extends Component {
...
@@ -285,13 +271,7 @@ class SurveyCreact extends Component {
type
:
"number"
,
type
:
"number"
,
})(<
InputNumber
min=
{
0
}
/>)
}
})(<
InputNumber
min=
{
0
}
/>)
}
</
FormItem
>
</
FormItem
>
<
FormItem
label=
"自定义关键词"
{
...
formItemLayout
}
>
{
getFieldDecorator
(
"keywords"
)(<
TagGroup
{
...
tagPropsNew
}
/>)
}
</
FormItem
>
</
Form
>
</
Form
>
{
/* <Remind ref={(obj) => this.remind = obj} {...remindProps} key={this.state.key} newsList={newsList}/> */
}
{
// 修改
{
// 修改
details
.
remind
!==
0
&&
details
.
remind
&&
(
details
.
remind
!==
0
&&
details
.
remind
&&
(
<
MessageRemind
<
MessageRemind
...
@@ -313,12 +293,6 @@ class SurveyCreact extends Component {
...
@@ -313,12 +293,6 @@ class SurveyCreact extends Component {
wrappedComponentRef=
{
form
=>
(
this
.
messageRemind
=
form
)
}
wrappedComponentRef=
{
form
=>
(
this
.
messageRemind
=
form
)
}
/>
/>
)
}
)
}
<
Task
taskValue=
{
details
.
enableTask
}
type=
{
0
}
getFieldDecorator=
{
getFieldDecorator
}
changeTask=
{
this
.
changeTask
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
),
),
...
...
src/pages/TrainingTools/Survey/Details/index.jsx
View file @
bfe13a01
...
@@ -20,21 +20,16 @@ import {
...
@@ -20,21 +20,16 @@ import {
getTestListFetch
,
getTestListFetch
,
postNewsList
,
postNewsList
,
getNewsListMessageRemind
,
getNewsListMessageRemind
,
jumpTestFetch
,
jumpReset
,
editTestFetch
,
editTestFetch
,
insertTestFetch
,
updateFetch
,
updateFetch
,
}
from
"../redux/actions"
;
}
from
"../redux/actions"
;
// import Remind from '../../../../common/remind'
// import Remind from '../../../../common/remind'
import
TestModal
from
"../Create/TestModal"
;
import
TestModal
from
"../Create/TestModal"
;
import
MessageRemind
from
"@/common/MessageRemind"
;
import
MessageRemind
from
"@/common/MessageRemind"
;
import
TagGroup
from
"@/common/tags"
;
import
{
connect
}
from
"react-redux"
;
import
{
connect
}
from
"react-redux"
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
*
as
api
from
"../Create/api.js"
;
import
QRCode
from
"qrcode.react"
;
import
Base
from
"../Create/Base.jsx"
;
import
Base
from
"../Create/Base.jsx"
;
import
Task
from
"@/common/task/Task"
;
const
{
TextArea
}
=
Input
;
const
{
TextArea
}
=
Input
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
RadioGroup
=
Radio
.
Group
;
const
RadioGroup
=
Radio
.
Group
;
...
@@ -49,12 +44,8 @@ class Details extends Component {
...
@@ -49,12 +44,8 @@ class Details extends Component {
confirmLoading
:
false
,
confirmLoading
:
false
,
data
:
[],
data
:
[],
pageNo
:
1
,
pageNo
:
1
,
isdanxuan
:
false
,
danxuanid
:
""
,
danxuanid
:
""
,
otherlist
:
[],
xxlist
:
[],
isupdata
:
""
,
isupdata
:
""
,
treeJson
:
[],
keywords
:
""
,
keywords
:
""
,
enableTask
:
0
,
enableTask
:
0
,
testItem
:
""
,
testItem
:
""
,
...
@@ -82,7 +73,6 @@ class Details extends Component {
...
@@ -82,7 +73,6 @@ class Details extends Component {
enableTask
:
details
.
enableTask
,
enableTask
:
details
.
enableTask
,
});
});
});
});
// this.props.postNewsList({type:3});
// 消息回显 任务805
// 消息回显 任务805
this
.
props
.
getNewsListMessageRemind
({
this
.
props
.
getNewsListMessageRemind
({
relationType
:
3
,
relationType
:
3
,
...
@@ -97,17 +87,12 @@ class Details extends Component {
...
@@ -97,17 +87,12 @@ class Details extends Component {
isupdata
:
this
.
type
,
isupdata
:
this
.
type
,
});
});
}
}
showModal
()
{
showModal
()
{
this
.
setState
({
this
.
setState
({
visible
:
true
,
visible
:
true
,
});
});
}
}
showTotal
(
total
)
{
return
`共计
${
total
}
条`
;
}
handlePageChange
(
page
,
pageSize
)
{
handlePageChange
(
page
,
pageSize
)
{
this
.
setState
({
this
.
setState
({
pageNo
:
page
,
pageNo
:
page
,
...
@@ -138,45 +123,6 @@ class Details extends Component {
...
@@ -138,45 +123,6 @@ class Details extends Component {
selectStudentVisible
:
false
,
selectStudentVisible
:
false
,
});
});
};
};
showdanxuan
(
record
)
{
var
that
=
this
;
this
.
setState
(
{
danxuanid
:
record
.
id
,
},
()
=>
{
this
.
props
.
jump
({
id
:
this
.
state
.
danxuanid
});
let
parmas
=
{
questionId
:
this
.
state
.
danxuanid
,
};
api
.
chooses
(
parmas
).
then
(
data
=>
{
if
(
data
.
code
===
"1000"
)
{
that
.
setState
(
{
xxlist
:
data
.
data
.
options
,
otherlist
:
data
.
data
.
otherOption
,
},
()
=>
{
that
.
setState
({
isdanxuan
:
true
,
});
}
);
}
});
}
);
}
sure
=
()
=>
{
this
.
setState
({
isdanxuan
:
false
,
});
};
quxiao
=
()
=>
{
this
.
setState
({
isdanxuan
:
false
,
});
};
treeJson
=
data
=>
{
treeJson
=
data
=>
{
this
.
setState
({
this
.
setState
({
trainJson
:
data
,
trainJson
:
data
,
...
@@ -184,16 +130,10 @@ class Details extends Component {
...
@@ -184,16 +130,10 @@ class Details extends Component {
};
};
dupdate
()
{
dupdate
()
{
const
component
=
this
.
first
;
const
component
=
this
.
first
;
const
dcomponent
=
this
.
remind
;
component
.
validateFields
((
errors
,
values
)
=>
{
component
.
validateFields
((
errors
,
values
)
=>
{
if
(
errors
)
{
if
(
errors
)
{
return
;
return
;
}
}
// dcomponent.validateFields((errors, vals) => {
// if (!!errors) {
// return;
// };
// 805 取出消息数据
this
.
messageRemind
.
props
.
form
.
validateFields
((
errors
,
vals
)
=>
{
this
.
messageRemind
.
props
.
form
.
validateFields
((
errors
,
vals
)
=>
{
if
(
errors
)
{
if
(
errors
)
{
return
;
return
;
...
@@ -231,7 +171,7 @@ class Details extends Component {
...
@@ -231,7 +171,7 @@ class Details extends Component {
image
:
values
.
surveyImageUrl
,
image
:
values
.
surveyImageUrl
,
keywords
:
this
.
state
.
keywords
,
keywords
:
this
.
state
.
keywords
,
enableTask
:
this
.
state
.
enableTask
,
enableTask
:
this
.
state
.
enableTask
,
voteNum
:
values
.
voteNum
voteNum
:
values
.
voteNum
,
};
};
if
(
values
.
surveyImageUrl
==
""
)
{
if
(
values
.
surveyImageUrl
==
""
)
{
delete
data
.
image
;
delete
data
.
image
;
...
@@ -252,18 +192,6 @@ class Details extends Component {
...
@@ -252,18 +192,6 @@ class Details extends Component {
});
});
});
});
}
}
// 938
getTags
=
tags
=>
{
this
.
setState
({
keywords
:
tags
.
join
()
});
console
.
log
(
tags
.
join
(),
"任务938"
);
};
//设置日历任务状态
changeTask
=
value
=>
{
this
.
setState
({
enableTask
:
value
,
});
};
handleTestView
(
item
)
{
handleTestView
(
item
)
{
// console.log(item)
// console.log(item)
this
.
setState
({
this
.
setState
({
...
@@ -273,7 +201,6 @@ class Details extends Component {
...
@@ -273,7 +201,6 @@ class Details extends Component {
editid
:
item
.
id
,
editid
:
item
.
id
,
canEdit
:
true
,
canEdit
:
true
,
});
});
this
.
props
.
jump
({
id
:
item
.
id
});
}
}
handleTestView1
(
item
)
{
handleTestView1
(
item
)
{
// console.log(item)
// console.log(item)
...
@@ -284,17 +211,10 @@ class Details extends Component {
...
@@ -284,17 +211,10 @@ class Details extends Component {
editid
:
item
.
id
,
editid
:
item
.
id
,
canEdit
:
false
,
canEdit
:
false
,
});
});
this
.
props
.
jump
({
id
:
item
.
id
});
}
}
handleOk
()
{
handleOk
()
{
const
{
surid
}
=
this
.
props
;
const
{
surid
}
=
this
.
props
;
const
{
order
,
editstate
,
editid
}
=
this
.
state
;
const
{
editstate
,
editid
}
=
this
.
state
;
console
.
log
(
11111
,
this
.
addother
.
state
);
this
.
props
.
jumpreset
();
// this.setState({
// confirmLoading: true,
// });
this
.
newTest
.
validateFields
((
errors
,
values
)
=>
{
this
.
newTest
.
validateFields
((
errors
,
values
)
=>
{
if
(
errors
)
{
if
(
errors
)
{
this
.
setState
({
this
.
setState
({
...
@@ -309,48 +229,12 @@ class Details extends Component {
...
@@ -309,48 +229,12 @@ class Details extends Component {
console
.
log
(
values
,
11111
);
console
.
log
(
values
,
11111
);
objs
.
push
({
objs
.
push
({
content
:
values
.
cont
[
i
],
content
:
values
.
cont
[
i
],
//correct:values.correct[i]?1:0,
//editable:values.editable[i]?1:0,
//jumpNum:values.jumpNum[i]?values.jumpNum[i]:"",
no
:
values
.
no
[
i
],
no
:
values
.
no
[
i
],
researchId
:
surid
,
researchId
:
surid
,
keywords
:
this
.
addother
.
state
.
keywords
,
keywords
:
this
.
addother
.
state
.
keywords
,
});
});
}
}
console
.
log
(
"单选题其他"
,
objs
);
}
}
if
(
values
.
type
===
2
)
{
for
(
let
i
=
0
;
i
<
values
.
cont
.
length
;
i
++
)
{
objs
.
push
({
content
:
values
.
cont
[
i
],
//correct:values.correct[i]?1:0,
//editable:values.editable[i]?1:0,
no
:
values
.
no
[
i
],
researchId
:
surid
,
});
}
// console.log(objs)
}
if
(
values
.
type
===
4
)
{
for
(
let
i
=
0
;
i
<
values
.
cont
.
length
;
i
++
)
{
// 最大值最小值判断
if
(
values
.
maxScore
[
i
]
<=
values
.
minScore
[
i
])
{
message
.
error
(
"最大值不能小于最小值"
);
this
.
setState
({
confirmLoading
:
false
,
});
return
;
}
objs
.
push
({
content
:
values
.
cont
[
i
],
maxScore
:
values
.
maxScore
[
i
],
minScore
:
values
.
minScore
[
i
],
no
:
values
.
no
[
i
],
researchId
:
surid
,
});
}
}
if
(
editstate
)
{
if
(
editstate
)
{
const
param
=
{
const
param
=
{
type
:
values
.
type
,
type
:
values
.
type
,
...
@@ -365,7 +249,6 @@ class Details extends Component {
...
@@ -365,7 +249,6 @@ class Details extends Component {
questionOptions
:
objs
,
questionOptions
:
objs
,
maxSelectItem
:
values
.
needAnswer2
?
values
.
maxSelectItem
:
""
,
maxSelectItem
:
values
.
needAnswer2
?
values
.
maxSelectItem
:
""
,
minSelectItem
:
values
.
needAnswer1
?
values
.
minSelectItem
:
""
,
minSelectItem
:
values
.
needAnswer1
?
values
.
minSelectItem
:
""
,
//no:this.state.testItem.no,
hasOther
:
this
.
addother
.
state
.
addother
?
1
:
0
,
hasOther
:
this
.
addother
.
state
.
addother
?
1
:
0
,
otherOption
:
{
otherOption
:
{
content
:
this
.
addother
.
state
.
other
,
content
:
this
.
addother
.
state
.
other
,
...
@@ -373,35 +256,10 @@ class Details extends Component {
...
@@ -373,35 +256,10 @@ class Details extends Component {
required
:
this
.
addother
.
state
.
ismust
?
1
:
0
,
required
:
this
.
addother
.
state
.
ismust
?
1
:
0
,
},
},
};
};
// console.log("777777777", param)
// return
// if( !(param.minSelectItem !== '' && param.minSelectItem <= param.questionOptions.length-1 && param.minSelectItem > 0)) {
// message.error('最少项错误')
// this.setState({
// confirmLoading: false,
// });
// return
// }
// // 判断最大可选
// if( param.maxSelectItem !== '' && param.maxSelectItem > param.questionOptions.length){
// message.error('最多项错误')
// this.setState({
// confirmLoading: false,
// });
// return
// }else if(param.maxSelectItem !== '' && param.minSelectItem !==''&& param.maxSelectItem < param.minSelectItem){
// message.error('最多项不能小于最少项')
// this.setState({
// confirmLoading: false,
// });
// return
// }
const
temp
=
{
const
temp
=
{
questions
:
[{
id
:
editid
,
...
param
}],
questions
:
[{
id
:
editid
,
...
param
}],
researchId
:
surid
,
researchId
:
surid
,
};
};
// console.log(temp)
this
.
props
.
edit
(
temp
,
surid
,
this
.
state
.
pageNo
,
this
.
state
.
pageSize
);
this
.
props
.
edit
(
temp
,
surid
,
this
.
state
.
pageNo
,
this
.
state
.
pageSize
);
this
.
setState
({
fileUrl
:
""
});
this
.
setState
({
fileUrl
:
""
});
}
else
{
}
else
{
...
@@ -423,15 +281,6 @@ class Details extends Component {
...
@@ -423,15 +281,6 @@ class Details extends Component {
required
:
this
.
addother
.
state
.
ismust
?
1
:
0
,
required
:
this
.
addother
.
state
.
ismust
?
1
:
0
,
},
},
};
};
// 判断最大可选
// if( param.maxSelectItem !== '' && param.maxSelectItem > param.questionOptions.length){
// message.error('最多项错误')
// this.setState({
// confirmLoading: false,
// });
// return
// }
this
.
props
.
insert
(
param
,
this
.
state
.
pageNo
,
this
.
state
.
pageSize
);
this
.
props
.
insert
(
param
,
this
.
state
.
pageNo
,
this
.
state
.
pageSize
);
this
.
setState
({
fileUrl
:
""
});
this
.
setState
({
fileUrl
:
""
});
}
}
...
@@ -451,23 +300,14 @@ class Details extends Component {
...
@@ -451,23 +300,14 @@ class Details extends Component {
confirmLoading
:
false
,
confirmLoading
:
false
,
editstate
:
false
,
editstate
:
false
,
});
});
this
.
props
.
jumpreset
();
}
}
render
()
{
render
()
{
const
{
const
{
visibleQuestion
,
testItem
,
confirmLoading
,
canEdit
}
=
this
.
state
;
visibleQuestion
,
testItem
,
confirmLoading
,
ModalText
,
canEdit
,
}
=
this
.
state
;
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
{
details
,
tlist
,
newsList
,
jumptests
,
surid
}
=
this
.
props
;
const
{
details
,
tlist
,
jumptests
,
surid
}
=
this
.
props
;
const
uploadProps
=
{
const
uploadProps
=
{
uploadUtilName
:
"上传图片
/音/视频
"
,
uploadUtilName
:
"上传图片"
,
getUrl
:
(
fileUrl
,
fileName
)
=>
{
getUrl
:
(
fileUrl
,
fileName
)
=>
{
this
.
setState
({
this
.
setState
({
fileUrl
,
fileUrl
,
...
@@ -480,22 +320,12 @@ class Details extends Component {
...
@@ -480,22 +320,12 @@ class Details extends Component {
uid
:
1
,
uid
:
1
,
status
:
"done"
,
status
:
"done"
,
url
:
this
.
state
.
testItem
.
contentAppendixUrl
,
url
:
this
.
state
.
testItem
.
contentAppendixUrl
,
name
:
this
.
state
.
testItem
.
contentAppendixUrl
.
split
(
'prefix='
)[
1
],
name
:
this
.
state
.
testItem
.
contentAppendixUrl
.
split
(
"prefix="
)[
1
],
},
},
]
]
:
[],
:
[],
};
};
const
children
=
[];
for
(
let
i
=
0
;
i
<
jumptests
.
length
;
i
++
)
{
children
.
push
(
<
Option
value=
{
jumptests
[
i
].
no
}
>
<
span
style=
{
{
marginRight
:
10
}
}
>
跳转至编号
{
jumptests
[
i
].
no
}
题目
</
span
>
</
Option
>
);
}
const
formItemLayout
=
{
const
formItemLayout
=
{
labelCol
:
{
span
:
6
},
labelCol
:
{
span
:
6
},
wrapperCol
:
{
span
:
14
},
wrapperCol
:
{
span
:
14
},
...
@@ -529,46 +359,6 @@ class Details extends Component {
...
@@ -529,46 +359,6 @@ class Details extends Component {
),
),
},
},
{
{
title
:
"跳题策略"
,
dataIndex
:
"action"
,
key
:
"action"
,
width
:
300
,
render
:
(
text
,
record
)
=>
(
<
div
>
<
div
>
<
Select
style=
{
{
width
:
"200px"
}
}
defaultValue=
{
record
.
jumpNum
?
`跳转至编号${record.jumpNum}题目`
:
record
.
jumpType
==
1
?
-
1
:
-
2
}
disabled
onChange=
{
value
=>
this
.
handleSelectChange
(
value
,
record
)
}
onDropdownVisibleChange=
{
open
=>
this
.
jump
(
open
,
record
)
}
getPopupContainer=
{
()
=>
document
.
getElementById
(
"djump"
)
}
>
<
Option
value=
{
-
2
}
>
按顺序填写下一题
</
Option
>
{
record
.
type
==
1
?
(
<
Option
value=
{
-
1
}
>
按选项跳题
</
Option
>
)
:
null
}
{
children
}
</
Select
>
{
record
.
jumpType
==
1
?
(
<
a
style=
{
{
marginLeft
:
"20px"
}
}
onClick=
{
()
=>
this
.
showdanxuan
(
record
)
}
>
查看选项跳题规则
</
a
>
)
:
null
}
</
div
>
</
div
>
),
},
{
title
:
"操作"
,
title
:
"操作"
,
dataIndex
:
"operation"
,
dataIndex
:
"operation"
,
key
:
"operation"
,
key
:
"operation"
,
...
@@ -585,33 +375,6 @@ class Details extends Component {
...
@@ -585,33 +375,6 @@ class Details extends Component {
),
),
},
},
];
];
const
remindProps
=
{
defaultValue
:
details
,
layout
:
{
labelCol
:
{
span
:
6
},
wrapperCol
:
{
span
:
14
},
},
usable
:
this
.
state
.
isupdata
==
1
?
false
:
true
,
};
const
qc
=
{
type
:
"research"
,
id
:
surid
,
};
const
code
=
JSON
.
stringify
(
qc
);
// 938
let
defaultTags
=
[];
if
(
details
.
keywords
)
{
defaultTags
=
details
.
keywords
.
split
(
","
);
}
const
tagPropsNew
=
{
defaultTags
:
defaultTags
,
getTags
:
this
.
getTags
,
};
// 938 结束
return
(
return
(
<
div
>
<
div
>
{
details
.
name
&&
(
{
details
.
name
&&
(
...
@@ -675,13 +438,6 @@ class Details extends Component {
...
@@ -675,13 +438,6 @@ class Details extends Component {
<
FormItem
{
...
formItemLayout
}
label=
"积分设置:"
>
<
FormItem
{
...
formItemLayout
}
label=
"积分设置:"
>
<
Input
defaultValue=
{
details
.
point
}
disabled
/>
<
Input
defaultValue=
{
details
.
point
}
disabled
/>
</
FormItem
>
</
FormItem
>
<
FormItem
label=
"自定义关键词"
{
...
formItemLayout
}
>
<
TagGroup
{
...
tagPropsNew
}
disabled=
{
this
.
state
.
isupdata
==
1
?
"block"
:
"none"
}
/>
</
FormItem
>
{
/* <Remind ref={(obj) => this.remind = obj} {...remindProps} newsList={newsList} /> */
}
{
// 修改
{
// 修改
details
.
remind
?
(
details
.
remind
?
(
<
MessageRemind
<
MessageRemind
...
@@ -700,14 +456,34 @@ class Details extends Component {
...
@@ -700,14 +456,34 @@ class Details extends Component {
wrappedComponentRef=
{
form
=>
(
this
.
messageRemind
=
form
)
}
wrappedComponentRef=
{
form
=>
(
this
.
messageRemind
=
form
)
}
/>
/>
)
}
)
}
<
Task
<
div
taskValue=
{
details
.
enableTask
}
style=
{
{
type=
{
0
}
display
:
"flex"
,
disabled=
{
this
.
state
.
isupdata
==
1
?
false
:
true
}
justifyContent
:
"space-between"
,
getFieldDecorator=
{
getFieldDecorator
}
alignItems
:
"center"
,
changeTask=
{
this
.
changeTask
}
marginBottom
:
16
,
/>
}
}
<
p
className=
"survey-details-title"
>
问题列表
</
p
>
>
<
p
className=
"survey-details-title"
style=
{
{
margin
:
0
}
}
>
问题列表
</
p
>
{
this
.
state
.
isupdata
==
1
&&
(
<
Button
type=
"primary"
onClick=
{
()
=>
{
this
.
setState
({
visibleQuestion
:
true
,
testItem
:
{},
editstate
:
false
,
editid
:
""
,
canEdit
:
true
,
});
}
}
>
添加问题
</
Button
>
)
}
</
div
>
<
div
>
<
div
>
<
Table
<
Table
size=
"default"
size=
"default"
...
@@ -717,15 +493,6 @@ class Details extends Component {
...
@@ -717,15 +493,6 @@ class Details extends Component {
scroll=
{
{
y
:
500
}
}
scroll=
{
{
y
:
500
}
}
pagination=
{
false
}
pagination=
{
false
}
/>
/>
{
/*<Pagination className="survey-details-pagination"
size="small" total={tlist.total}
showTotal={this.showTotal}
showSizeChanger
showQuickJumper
pageSizeOptions={["10","20","30","40"]}
onChange={this.handlePageChange}
onShowSizeChange={this.handlePageSizeChange}
/>*/
}
</
div
>
</
div
>
<
div
style=
{
{
marginTop
:
10
,
textAlign
:
"center"
}
}
>
<
div
style=
{
{
marginTop
:
10
,
textAlign
:
"center"
}
}
>
<
Link
<
Link
...
@@ -768,61 +535,6 @@ class Details extends Component {
...
@@ -768,61 +535,6 @@ class Details extends Component {
disabled=
{
1
}
disabled=
{
1
}
/>
/>
</
Modal
>
</
Modal
>
<
Modal
visible=
{
this
.
state
.
isdanxuan
}
onOk=
{
this
.
sure
}
onCancel=
{
this
.
quxiao
}
destroyOnClose=
{
true
}
>
{
this
.
state
.
xxlist
&&
this
.
state
.
xxlist
.
map
((
item
,
index
)
=>
{
return
(
<
div
style=
{
{
padding
:
"20px"
}
}
key=
{
index
}
id=
"dxjump"
>
<
Input
style=
{
{
width
:
"200px"
}
}
disabled
value=
{
item
.
content
}
/>
<
Select
style=
{
{
width
:
"200px"
,
marginLeft
:
"10px"
}
}
defaultValue=
{
item
.
jumpNum
?
`跳转至编号${item.jumpNum}题目`
:
""
}
disabled
getPopupContainer=
{
()
=>
document
.
getElementById
(
"dxjump"
)
}
onChange=
{
value
=>
this
.
djump
(
value
,
item
.
id
)
}
>
<
Option
value=
""
>
按顺序填写下一题
</
Option
>
{
children
}
</
Select
>
</
div
>
);
})
}
{
this
.
state
.
otherlist
?
(
<
div
style=
{
{
padding
:
"20px"
}
}
id=
"dxjump"
>
<
Input
style=
{
{
width
:
"200px"
}
}
disabled
value=
{
this
.
state
.
otherlist
.
content
}
/>
<
Select
style=
{
{
width
:
"200px"
,
marginLeft
:
"10px"
}
}
disabled
defaultValue=
{
this
.
state
.
otherlist
&&
this
.
state
.
otherlist
.
jumpNum
?
`跳转至编号${this.state.otherlist.jumpNum}题目`
:
""
}
getPopupContainer=
{
()
=>
document
.
getElementById
(
"dxjump"
)
}
onChange=
{
value
=>
this
.
djump
(
value
,
this
.
state
.
otherlist
.
id
)
}
>
<
Option
value=
""
>
按顺序填写下一题
</
Option
>
{
children
}
</
Select
>
</
div
>
)
:
null
}
</
Modal
>
{
visibleQuestion
&&
(
{
visibleQuestion
&&
(
<
Modal
<
Modal
title=
"添加问题"
title=
"添加问题"
...
@@ -877,11 +589,9 @@ function mapDispatchToProps(dispatch) {
...
@@ -877,11 +589,9 @@ function mapDispatchToProps(dispatch) {
getlist
:
obj
=>
dispatch
(
getTestListFetch
(
obj
)),
getlist
:
obj
=>
dispatch
(
getTestListFetch
(
obj
)),
postNewsList
:
obj
=>
dispatch
(
postNewsList
(
obj
)),
postNewsList
:
obj
=>
dispatch
(
postNewsList
(
obj
)),
getNewsListMessageRemind
:
obj
=>
dispatch
(
getNewsListMessageRemind
(
obj
)),
getNewsListMessageRemind
:
obj
=>
dispatch
(
getNewsListMessageRemind
(
obj
)),
jump
:
obj
=>
dispatch
(
jumpTestFetch
(
obj
)),
update
:
(
obj
,
callback
)
=>
dispatch
(
updateFetch
(
obj
,
callback
)),
update
:
(
obj
,
callback
)
=>
dispatch
(
updateFetch
(
obj
,
callback
)),
jumpreset
:
()
=>
dispatch
(
jumpReset
()),
edit
:
(
obj
,
id
,
no
,
size
)
=>
dispatch
(
editTestFetch
(
obj
,
id
,
no
,
size
)),
edit
:
(
obj
,
id
,
no
,
size
)
=>
dispatch
(
editTestFetch
(
obj
,
id
,
no
,
size
)),
insert
:
(
obj
,
no
,
size
)
=>
dispatch
(
insertTestFetch
(
obj
,
no
,
size
)),
};
};
}
}
...
...
src/pages/TrainingTools/Survey/component/UploadUtil.jsx
0 → 100644
View file @
bfe13a01
import
React
,
{
Component
}
from
"react"
;
import
{
connect
}
from
"react-redux"
;
import
{
Upload
,
Icon
,
Form
,
Button
,
message
,
Progress
}
from
"antd"
;
//上传阿里云action
import
{
gupList
,
gupfetch
}
from
"./redux/actions"
;
import
"./index.less"
;
import
services
from
"@/services/serve"
;
// form Item
const
FormItem
=
Form
.
Item
;
class
UploadUtil
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
uploadAction
:
{},
originalFileName
:
""
,
fileList
:
[],
newFileList
:
[],
key
:
""
,
processNum
:
0
,
//进度条--liyuan
};
}
//修改一
componentDidMount
()
{}
beforeUpload
=
(
file
,
fileList
)
=>
{
// 文件大小判断 图片小于3M 文件小于200M
if
(
file
.
type
.
indexOf
(
"image"
)
!==
-
1
)
{
if
(
file
.
size
>
10
*
1024
*
1024
)
{
message
.
info
(
"请上传小于10M的图片"
);
return
false
;
}
}
else
{
if
(
file
.
size
>
200
*
1024
*
1024
)
{
message
.
info
(
"请上传小于200M的文件"
);
return
false
;
}
}
//默认
if
(
this
.
props
.
defaultUrl
)
{
this
.
props
.
gupList
(
this
.
props
.
defaultUrl
);
}
else
{
this
.
props
.
gupList
([]);
}
let
reg
=
""
;
//正则匹配格式
this
.
props
.
extra
===
"markeCardExtra"
?
(
reg
=
/
(
mp4|png|jpg|gif|mp3|pdf|jpeg|doc|docx|pdf|PDF|wps
)
$/g
)
:
(
reg
=
/
(
png|jpg|gif|jpeg|doc|docx|pdf|PDF|xls|xlsx
)
$/g
);
if
(
!
reg
.
test
(
file
.
name
))
{
message
.
error
(
"文件类型不对"
);
return
false
;
}
this
.
setState
({
fileList
:
fileList
});
this
.
setState
({
uploadAction
:
`
${
services
.
uploadApi
}
`
,
originalFileName
:
file
.
name
,
});
};
//上传
handleChange
=
info
=>
{
let
fileList
=
info
.
fileList
;
// 限制只能上传一张图片:如果文件列表长度大于1,只保留最后一个文件
if
(
fileList
.
length
>
1
)
{
fileList
=
[
fileList
[
fileList
.
length
-
1
]];
}
this
.
setState
({
processNum
:
info
.
file
.
percent
?
info
.
file
.
percent
:
0
,
});
if
(
info
.
file
.
status
===
"done"
)
{
// 清空之前的文件列表,确保只保留一个文件
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
);
}
}
});
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
.
setState
({
fileList
});
};
normFile
=
e
=>
{
if
(
Array
.
isArray
(
e
))
{
return
e
;
}
return
e
&&
this
.
state
.
fileList
;
};
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
);
};
render
()
{
const
{
uploadAction
}
=
this
.
state
;
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
return
(
<
Form
>
<
FormItem
extra=
{
"请上传资源附件(附件格式:mp4、png、jpg、jpeg、gif)"
}
>
{
getFieldDecorator
(
"upload"
,
{
valuePropName
:
"fileList"
,
getValueFromEvent
:
this
.
normFile
,
initialValue
:
this
.
props
.
defaultUrl
,
})(
<
Upload
style=
{
{
display
:
"inline-block"
}
}
beforeUpload=
{
this
.
beforeUpload
}
action=
{
uploadAction
}
headers=
{
{
authorization
:
sessionStorage
.
getItem
(
"mgtk"
)
}
}
onChange=
{
this
.
handleChange
}
onRemove=
{
this
.
fnRemove
}
>
<
Button
type=
{
"primary"
}
>
<
Icon
type=
"upload"
/>
{
" "
}
{
!
this
.
state
.
fileList
.
length
?
this
.
props
.
uploadUtilName
:
"修改"
}
</
Button
>
</
Upload
>
)
}
{
this
.
state
.
processNum
!=
0
&&
this
.
state
.
processNum
!=
100
&&
(
<
p
>
<
Progress
percent=
{
this
.
state
.
processNum
}
strokeWidth=
{
5
}
showInfo=
{
false
}
/>
</
p
>
)
}
</
FormItem
>
</
Form
>
);
}
}
//所有状态
function
mapStateToProps
(
state
,
ownProps
)
{
return
{
param
:
state
.
uploadParam
.
param
,
list
:
state
.
materialReducer
.
list
,
details
:
state
.
materialReducer
.
details
,
type
:
state
.
materialReducer
.
type
,
};
}
function
mapDispatchToProps
(
dispatch
)
{
return
{
gupfetch
:
()
=>
dispatch
(
gupfetch
()),
gupList
:
fileList
=>
dispatch
(
gupList
(
fileList
)),
};
}
export
default
Form
.
create
()(
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Form
.
create
()(
UploadUtil
))
);
src/pages/TrainingTools/Survey/component/api.js
0 → 100644
View file @
bfe13a01
/**
* anth: 陈万军
* time: 2020-05-1
* */
import
services
from
"@/services/serve"
;
export
default
{
common
:
{
// oss 上传
ossUrl
:
`GET
${
services
.
ossUrl
}
`
,
videoUpload
:
`POST
${
services
.
ossUrl
}
/video/upload`
,
videoPlay
:
`GET
${
services
.
ossUrl
}
/video/play`
,
ossPolicy
:
`GET
${
services
.
ossUrl
}
/upload/policy`
,
},
};
src/pages/TrainingTools/Survey/component/index.less
0 → 100644
View file @
bfe13a01
.credEditLogo{
>span{
display: flex !important;
}
.ant-upload-list-item-info{
display: flex;
align-items: center;
span{
flex: 1;
//background-color: #272222;
}
}
&[data-status="newState"] {
.ant-upload-select-picture-card{
border: 1px dashed #d9d9d9;
width: 104px;
height: 104px;
border-radius: 4px;
background-color: #fafafa;
text-align: center;
cursor: pointer;
transition: border-color 0.3s ease;
vertical-align: top;
margin-right: 8px;
margin-bottom: 8px;
display: table;
}
}
&[data-status="editState"] {
.ant-upload-select-picture-card{
border:none;
width: 0;
height: 0;
border-radius: 0;
background-color: red !important;
text-align: center;
cursor: pointer;
transition: border-color 0.3s ease;
vertical-align: bottom;
display: inline-block !important;
margin-top: 60px;
}
:global { //bug-上传组件样式-liyuan
.ant-upload-select-picture-card {
background: transparent;
border: none
}
}
}
}
.ant-upload-list-item-actions{
.anticon-eye-o{
display: none;
}
.anticon-delete{
display: none;
}
}
src/pages/TrainingTools/Survey/component/redux/actionTypes.js
0 → 100644
View file @
bfe13a01
export
const
GET_UPLOAD_PARAM
=
"GET_UPLOAD_PARAM"
;
export
const
GET_UPLOAD_LIST
=
"GET_UPLOAD_LIST"
;
export
const
GET_UPVIDEO_PARAM
=
"GET_UPVIDEO_PARAM"
;
export
const
CLEARUPLOAD
=
"CLEARUPLOAD"
;
export
const
UP_INFO
=
"UP_INFO"
;
export
const
VIDEO_INFO
=
"VIDEO_INFO"
;
//UploadUtilFile 常亮
export
const
GET_FILE_NAME_ADDRESS
=
"GET_FILE_NAME_ADDRESS"
;
src/pages/TrainingTools/Survey/component/redux/actions.js
0 → 100644
View file @
bfe13a01
import
request
from
"@/util/request.js"
;
import
api
from
"../api"
;
import
*
as
Types
from
"./actionTypes"
;
const
{
common
}
=
api
;
const
{
ossUrl
,
videoUpload
,
videoPlay
}
=
common
;
export
function
gupList
(
fileList
)
{
return
dispatch
=>
{
dispatch
({
type
:
Types
.
GET_UPLOAD_LIST
,
data
:
fileList
});
};
}
//获取上传签名
export
function
gupfetch
(
data
,
callback
)
{
let
needTranscode
=
false
;
let
type
=
false
;
let
url
;
if
(
data
)
{
needTranscode
=
data
.
needTranscode
;
type
=
data
.
type
;
// url = `${ossUrl}/upload/policy?needTranscode=${needTranscode}&type=${type}&date=${new Date()}`;
url
=
`
${
ossUrl
}
/upload/policy`
;
}
else
{
// url = `${ossUrl}/upload/policy?date=${(new Date()).valueOf()}`;
url
=
`
${
ossUrl
}
/upload/policy`
;
}
// alert(url)
return
dispatch
=>
{
return
request
({
url
,
data
:
data
?
{
needTranscode
:
needTranscode
,
type
:
type
,
date
:
(
new
Date
()).
valueOf
()}
:
{
date
:
(
new
Date
()).
valueOf
()}
}).
then
(
res
=>
{
if
(
res
.
code
===
"1000"
)
{
const
temp
=
JSON
.
parse
(
res
.
data
);
dispatch
({
type
:
Types
.
GET_UPLOAD_PARAM
,
data
:
temp
});
if
(
callback
){
callback
();
}
}
return
res
;
});
};
}
//视频上传
export
function
upvideo
(
param
,
callback1
,
callback2
)
{
return
dispatch
=>
{
return
request
({
videoUpload
,
data
:
param
,
}).
then
(
res
=>
{
if
(
res
.
code
===
"1000"
)
{
dispatch
({
type
:
Types
.
UP_INFO
,
data
:
JSON
.
parse
(
res
.
data
)
});
if
(
callback1
)
{
callback1
();
}
}
});
};
}
//视频信息
export
function
videoInfo
(
param
,
callback
)
{
return
dispatch
=>
{
return
request
({
videoPlay
,
data
:
param
,
}).
then
(
res
=>
{
if
(
res
.
code
===
"1000"
)
{
dispatch
({
type
:
Types
.
VIDEO_INFO
,
data
:
res
.
data
});
if
(
callback
)
{
callback
();
}
}
});
};
}
//UploadUtil组件中 上传图片和视频得到的文件名和图片名
export
function
UploadUtilFile
(
fileAddress
)
{
return
{
type
:
Types
.
GET_FILE_NAME_ADDRESS
,
fileAddress
};
}
export
function
clearUpload
()
{
return
dispatch
=>
{
dispatch
({
type
:
Types
.
CLEARUPLOAD
,
});
};
}
src/pages/TrainingTools/Survey/component/redux/reduter.js
0 → 100644
View file @
bfe13a01
/**
* anth: 陈万军
* time: 2020-05-1
* 上传 reducer
* */
import
*
as
Types
from
"./actionTypes"
;
// 获取上传参数
const
initialState
=
{
param
:
{
accessid
:
""
,
active
:
""
,
dir
:
""
,
expire
:
""
,
host
:
""
,
policy
:
""
,
signatur
:
""
,
},
fileList
:
[],
vedioInfo
:
null
,
upInfo
:
null
,
};
function
uploadParam
(
state
=
initialState
,
action
)
{
switch
(
action
.
type
)
{
case
Types
.
GET_UPLOAD_PARAM
:
return
{
...
state
,
param
:
action
.
data
};
case
Types
.
GET_UPLOAD_LIST
:
return
{
...
state
,
fileList
:
action
.
data
};
case
Types
.
VIDEO_INFO
:
return
{
...
state
,
vedioInfo
:
action
.
data
};
case
Types
.
UP_INFO
:
return
{
...
state
,
upInfo
:
action
.
data
};
case
Types
.
CLEARUPLOAD
:
return
{
...
state
,
fileList
:
[]
};
default
:
return
state
;
}
}
export
default
uploadParam
;
src/pages/TrainingTools/Survey/redux/actions.js
View file @
bfe13a01
// import fetch from '../../util/fetch.js';
// import fetch from '../../util/fetch.js';
import
{
browserHistory
}
from
"react-router-dom"
;
import
{
message
}
from
"antd"
;
import
{
message
}
from
"antd"
;
import
{
createAction
}
from
"redux-actions"
;
import
{
createAction
}
from
"redux-actions"
;
import
moment
from
"moment"
;
// import excute from "../../../../util/commonFetch";
import
api
from
"./api"
;
import
api
from
"./api"
;
import
{
call
}
from
"redux-saga/effects"
;
import
request
from
"@/util/request.js"
;
import
request
from
"@/util/request.js"
;
// const url = surveyUrl + "/manage/research";
// const url2 = surveyUrl + "/manage/researchQuestion";
var
companyCode
=
location
.
pathname
.
split
(
"/"
)[
1
];
var
siteCode
=
location
.
pathname
.
split
(
"/"
)[
2
];
import
*
as
Types
from
"./actionTypes"
;
import
*
as
Types
from
"./actionTypes"
;
let
getSurList
=
createAction
(
Types
.
GET_SUR_LIST
);
let
getSurList0
=
createAction
(
Types
.
GET_SUR_LIST_0
);
let
getSurList1
=
createAction
(
Types
.
GET_SUR_LIST_1
);
let
getSurList2
=
createAction
(
Types
.
GET_SUR_LIST_2
);
let
addTest
=
createAction
(
Types
.
ADD_TEST
);
let
editTest
=
createAction
(
Types
.
EDIT_TEST
);
let
insertSur
=
createAction
(
Types
.
INSERT_SUR
);
let
getSurTestList
=
createAction
(
Types
.
GET_SURTEST_LIST
);
let
getjumpTestList
=
createAction
(
Types
.
GET_JUMPTEST_LIST
);
let
getSurId
=
createAction
(
Types
.
GET_SURID
);
let
getSurDetails
=
createAction
(
Types
.
GET_SUR_DETAILS
);
//获取消息模板列表
let
newsList
=
createAction
(
Types
.
NEWSLIST
);
//删除下架调研
//删除下架调研
export
function
delsur
(
param
,
callback
)
{
export
function
delsur
(
param
,
callback
)
{
// console.log(param)
// console.log(param)
...
@@ -55,22 +32,6 @@ export function delsur(param, callback) {
...
@@ -55,22 +32,6 @@ export function delsur(param, callback) {
message
.
error
(
res
.
subMsg
);
message
.
error
(
res
.
subMsg
);
}
}
});
});
// return fetch(url + `/delete`, {type: 'POST', data: {researchId:param.id}}).then((res) => {
// if (res.code === "1000") {
// message.success('删除成功');
// dispatch(getListFetch({
// state: 2,
// pageNo: param.pageNo,
// pageSize: param.pageSize
// }))
// if(callback){
// callback(res)
// }
// }else{
// message.error(res.subMsg)
// }
// })
};
};
}
}
...
@@ -112,24 +73,6 @@ export function getListFetch(param) {
...
@@ -112,24 +73,6 @@ export function getListFetch(param) {
dispatch
({
type
:
Types
.
GET_SURTEST_LIST
,
data
:
[]
});
dispatch
({
type
:
Types
.
GET_SURTEST_LIST
,
data
:
[]
});
dispatch
({
type
:
Types
.
GET_SUR_DETAILS
,
data
:
{}
});
dispatch
({
type
:
Types
.
GET_SUR_DETAILS
,
data
:
{}
});
});
});
// return fetch(url + `/page/list`, {type: 'GET', data: param}).then((res) => {
// const temp = res.data;
// switch (param.state) {
// case 0:
// dispatch({type: Types.GET_SUR_LIST_0, data: {total: temp.total, list: temp.records}})
// break;
// case 1:
// dispatch({type: Types.GET_SUR_LIST_1, data: {total: temp.total, list: temp.records}})
// break;
// case 2:
// dispatch({type: Types.GET_SUR_LIST_2, data: {total: temp.total, list: temp.records}})
// break;
// default:
// dispatch({type: Types.GET_SUR_LIST_0, data: {total: temp.total, list: temp.records}})
// }
// dispatch({type: Types.GET_SURTEST_LIST, data: []});
// dispatch({type: Types.GET_SUR_DETAILS, data: {}});
// })
};
};
}
}
...
@@ -174,33 +117,6 @@ export function upFetch(param, callback) {
...
@@ -174,33 +117,6 @@ export function upFetch(param, callback) {
message
.
error
(
"上架失败"
);
message
.
error
(
"上架失败"
);
}
}
});
});
// return fetch(url + `/putaway`, {type: 'POST', data: {id: param.id}}).then((res) => {
// if (res.code === "1000") {
// dispatch(getListFetch({
// state: 1,
// pageNo: param.pageNo,
// pageSize: param.pageSize,
// }))
// dispatch(getListFetch({
// state: 2,
// pageNo: param.pageNo,
// pageSize: param.pageSize,
// name:param.name
// }))
// dispatch(getListFetch({
// state: 0,
// pageNo: param.pageNo,
// pageSize: param.pageSize,
// name:param.name
// }))
// message.success('上架成功');
// if(callback){
// callback(res)
// }
// } else {
// message.error('上架失败');
// }
// })
};
};
}
}
...
@@ -219,20 +135,11 @@ export function reFetch(param) {
...
@@ -219,20 +135,11 @@ export function reFetch(param) {
message
.
error
(
"上架失败"
);
message
.
error
(
"上架失败"
);
}
}
});
});
// return fetch(url + `/putaway`, {type: 'POST', data: param}).then((res) => {
// if (res.code === "1000") {
// message.success('发布成功');
// } else {
// message.error('上架失败');
// }
// })
};
};
}
}
//下架
//下架
export
function
downFetch
(
param
,
callback
)
{
export
function
downFetch
(
param
,
callback
)
{
// console.log(param)
let
url
=
api
.
downFetch
;
let
url
=
api
.
downFetch
;
let
data
=
{
let
data
=
{
id
:
param
.
id
,
id
:
param
.
id
,
...
@@ -261,22 +168,6 @@ export function downFetch(param, callback) {
...
@@ -261,22 +168,6 @@ export function downFetch(param, callback) {
callback
(
res
);
callback
(
res
);
}
}
});
});
// return fetch(url + `/backout`, {type: 'POST', data: {id: param.id}}).then((res) => {
// dispatch(getListFetch({
// state: 1,
// pageNo: param.pageNo,
// pageSize: param.pageSize,
// name:param.name
// }))
// dispatch(getListFetch({
// state: 2,
// pageNo: param.pageNo,
// pageSize: param.pageSize
// }))
// if(callback){
// callback(res)
// }
// })
};
};
}
}
...
@@ -297,21 +188,6 @@ export function deleteFetch(param, temp, cb) {
...
@@ -297,21 +188,6 @@ export function deleteFetch(param, temp, cb) {
dispatch
({
type
:
Types
.
GET_SURID
,
data
:
res
.
data
.
id
});
dispatch
({
type
:
Types
.
GET_SURID
,
data
:
res
.
data
.
id
});
}
}
});
});
// return fetch(url + `/batch/delete`, {type: 'POST', data: param}).then((res) => {
// if (res.code === "1000") {
// message.success('删除成功');
// if (cb){
// cb()
// }
// // dispatch(
// // getListFetch({
// // state: 0,
// // pageNo: temp.pageNo,
// // pageSize: temp.pageSize
// // })
// dispatch({type: Types.GET_SURID, data: res.data.id});
// }
// })
};
};
}
}
...
@@ -327,9 +203,6 @@ export function insertSurFetch(param, callback) {
...
@@ -327,9 +203,6 @@ export function insertSurFetch(param, callback) {
if
(
res
.
code
===
"1000"
)
{
if
(
res
.
code
===
"1000"
)
{
if
(
callback
)
callback
(
res
);
if
(
callback
)
callback
(
res
);
console
.
log
(
res
.
data
.
id
);
console
.
log
(
res
.
data
.
id
);
// browserHistory.push(
// `/${companyCode}/${siteCode}/index/tool/survey/survey-management/create/${res.data.id}`
// );
dispatch
(
dispatch
(
getTestListFetch
({
researchId
:
res
.
data
.
id
,
pageNo
:
1
,
pageSize
:
20
})
getTestListFetch
({
researchId
:
res
.
data
.
id
,
pageNo
:
1
,
pageSize
:
20
})
);
);
...
@@ -342,19 +215,6 @@ export function insertSurFetch(param, callback) {
...
@@ -342,19 +215,6 @@ export function insertSurFetch(param, callback) {
message
.
error
(
res
.
subMsg
);
message
.
error
(
res
.
subMsg
);
}
}
});
});
// return fetch(url + `/insert`, {type: 'POST', data: param}).then((res) => {
// if(res.code === '1000'){
// if(callback) callback(res);
// console.log(res.data.id)
// browserHistory.push(`/${companyCode}/${siteCode}/index/tool/survey/survey-management/create/${res.data.id}`)
// dispatch(getTestListFetch({researchId: res.data.id, pageNo: 1, pageSize: 20}))
// dispatch({type: Types.GET_SURID, data: res.data.id});
// dispatch({type: Types.GET_SURTEST_LIST, data: {list: [], total: 0}});
// }else{
// message.error(res.subMsg);
// }
// })
};
};
}
}
...
@@ -377,10 +237,6 @@ export function getCopyListFetch(param) {
...
@@ -377,10 +237,6 @@ export function getCopyListFetch(param) {
message
.
error
(
res
.
subMsg
);
message
.
error
(
res
.
subMsg
);
}
}
});
});
// return fetch(url + `/page/list`, {type: 'GET', data: param}).then((res) => {
// const temp = res.data;
// dispatch({type: Types.GET_SUR_LIST, data: {total: temp.total, list: temp.records}})
// })
};
};
}
}
...
@@ -398,20 +254,11 @@ export function getCopySurFetch(param, cb) {
...
@@ -398,20 +254,11 @@ export function getCopySurFetch(param, cb) {
if
(
cb
)
{
if
(
cb
)
{
cb
(
res
);
cb
(
res
);
}
}
// browserHistory.push(
// `/${companyCode}/${siteCode}/index/tool/survey/survey-management/create/${res.data.id}`
// );
dispatch
({
type
:
Types
.
GET_SUR_DETAILS
,
data
:
res
.
data
});
dispatch
({
type
:
Types
.
GET_SUR_DETAILS
,
data
:
res
.
data
});
}
else
{
}
else
{
message
.
error
(
res
.
subMsg
);
message
.
error
(
res
.
subMsg
);
}
}
});
});
// return fetch(url + `/copy`, {type: 'POST', data: param}).then((res) => {
// console.log(res.data)
// browserHistory.push(`/${companyCode}/${siteCode}/index/tool/survey/survey-management/create/${res.data.id}`)
// dispatch({type: Types.GET_SUR_DETAILS, data: res.data})
// })
};
};
}
}
...
@@ -437,30 +284,12 @@ export function updateFetch(param, callback) {
...
@@ -437,30 +284,12 @@ export function updateFetch(param, callback) {
message
.
error
(
"保存失败,请重新尝试"
);
message
.
error
(
"保存失败,请重新尝试"
);
}
}
});
});
// return fetch(url + `/update`, {type: 'POST', data: param}).then((res) => {
//
// if (res.code === "1000") {
// message.success('保存成功');
// dispatch(getTestListFetch({researchId: param.id, pageNo: 1, pageSize: 20}))
// dispatch({type: Types.GET_SURID, data: param.id});
// if (callback) {
// callback(res.code);
// }
// } else {
// message.error('保存失败,请重新尝试');
// }
// })
};
};
}
}
//查看调研
//查看调研
export
function
getSurDetailsFetch
(
param
,
callback
)
{
export
function
getSurDetailsFetch
(
param
,
callback
)
{
let
url
=
api
.
getSurDetailsFetch
;
let
url
=
api
.
getSurDetailsFetch
;
console
.
log
(
url
,
param
,
"-----------getSurDetailsFetch------------"
);
return
dispatch
=>
{
return
dispatch
=>
{
return
request
({
return
request
({
url
:
url
,
url
:
url
,
...
@@ -471,13 +300,6 @@ export function getSurDetailsFetch(param, callback) {
...
@@ -471,13 +300,6 @@ export function getSurDetailsFetch(param, callback) {
callback
(
res
.
code
);
callback
(
res
.
code
);
}
}
});
});
// return fetch(url + `/view`, {type: 'GET', data: param}).then((res) => {
// console.log(res.data)
// dispatch({type: Types.GET_SUR_DETAILS, data: res.data})
// if (callback) {
// callback(res.code);
// }
// })
};
};
}
}
...
@@ -488,13 +310,6 @@ export function getTSdata(data) {
...
@@ -488,13 +310,6 @@ export function getTSdata(data) {
};
};
}
}
// export function addTest(test) {
// console.log(test);
// return dispatch => {
// dispatch({type: Types.ADD_TEST, data: test})
// };
// }
//插入问题
//插入问题
export
function
insertTestFetch
(
param
,
no
,
size
)
{
export
function
insertTestFetch
(
param
,
no
,
size
)
{
// console.log(param)
// console.log(param)
...
@@ -512,10 +327,6 @@ export function insertTestFetch(param, no, size) {
...
@@ -512,10 +327,6 @@ export function insertTestFetch(param, no, size) {
})
})
);
);
});
});
// return fetch(url2 + `/insert`, {type: 'post', data: param}).then((res) => {
//
// dispatch(getTestListFetch({researchId: param.reseachId, pageNo: no, pageSize: size}))
// })
};
};
}
}
...
@@ -534,11 +345,6 @@ export function getTestListFetch(param) {
...
@@ -534,11 +345,6 @@ export function getTestListFetch(param) {
data
:
{
list
:
res
.
data
,
total
:
res
.
data
.
total
,
resData
:
res
.
data
},
data
:
{
list
:
res
.
data
,
total
:
res
.
data
.
total
,
resData
:
res
.
data
},
});
});
});
});
// return fetch(url2 + `/page/list`, {type: 'GET', data: param}).then((res) => {
// console.log({list: res.data.records, total: res.data.total})
// dispatch({type: Types.GET_SURTEST_LIST, data: {list: res.data, total: res.data.total, resData: res.data}})
// })
};
};
}
}
...
@@ -562,17 +368,6 @@ export function editTestFetch(params, surid, no, size) {
...
@@ -562,17 +368,6 @@ export function editTestFetch(params, surid, no, size) {
message
.
success
(
"操作失败"
);
message
.
success
(
"操作失败"
);
}
}
});
});
// return fetch(url2 + `/batch/update`, {type: 'post', data: param}).then((res) => {
//
// if (res.code === "1000") {
// dispatch({type: Types.EDIT_TEST, data: res.data})
// dispatch(getTestListFetch({researchId: surid, pageNo: no, pageSize: size}))
// message.success('操作成功');
// } else {
// message.success('操作失败');
// }
// })
};
};
}
}
...
@@ -588,32 +383,9 @@ export function jumpTestFetch(param) {
...
@@ -588,32 +383,9 @@ export function jumpTestFetch(param) {
console
.
log
(
res
.
data
);
console
.
log
(
res
.
data
);
dispatch
({
type
:
Types
.
GET_JUMPTEST_LIST
,
data
:
res
.
data
});
dispatch
({
type
:
Types
.
GET_JUMPTEST_LIST
,
data
:
res
.
data
});
});
});
// return fetch(url2 + `/jump/question/list`, {type: 'get', data: param}).then((res) => {
// console.log(res.data)
// dispatch({type: Types.GET_JUMPTEST_LIST, data: res.data})
// })
};
};
}
}
//获取消息模板 任务805
// export function postNewsList(data, callback) {
// let url = api.newsUrllist+ "/manage/message/getList";
// data.relationType=data.type;
// delete data['type'];
// return dispatch => {
// return fetch(url, {type: 'get', data}).then((json) => {
// let data=[];
// json.data.map(item=>{
// data.push({...item,name:item.title,content:item.context})
// })
// json.data=data;
// dispatch({type: NEWSLIST, data: json})
// if (callback) {
// callback();
// }
// });
// };
// };
export
function
postNewsList
(
data
,
callback
)
{
export
function
postNewsList
(
data
,
callback
)
{
// let url = api.newsUrllist+ "/manage/message/getList";
// let url = api.newsUrllist+ "/manage/message/getList";
let
url
=
api
.
postNewsList
;
let
url
=
api
.
postNewsList
;
...
@@ -627,13 +399,6 @@ export function postNewsList(data, callback) {
...
@@ -627,13 +399,6 @@ export function postNewsList(data, callback) {
callback
(
res
);
callback
(
res
);
}
}
});
});
// return fetch(url, {type: 'get', data}).then((json) => {
// dispatch({type: Types.NEWSLIST, data: json})
// if (callback) {
// callback();
// }
// });
};
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment