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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
411 additions
and
27 deletions
+411
-27
dist.zip
+0
-0
src/pages/TrainingTools/Survey/Create/AddTest.jsx
+1
-1
src/pages/TrainingTools/Survey/Create/TestModal.jsx
+0
-0
src/pages/TrainingTools/Survey/Create/index.jsx
+0
-26
src/pages/TrainingTools/Survey/Details/index.jsx
+0
-0
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
-0
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 {
* */
console
.
log
(
"xxxxxxxxxxxxaaaaa"
,
this
.
state
.
testItem
.
contentAppendixUrl
);
const
uploadProps
=
{
uploadUtilName
:
"上传图片
/音/视频
"
,
uploadUtilName
:
"上传图片"
,
getUrl
:
(
fileUrl
,
fileName
)
=>
{
this
.
setState
({
fileUrl
,
...
...
src/pages/TrainingTools/Survey/Create/TestModal.jsx
View file @
bfe13a01
This diff is collapsed.
Click to expand it.
src/pages/TrainingTools/Survey/Create/index.jsx
View file @
bfe13a01
...
...
@@ -3,7 +3,6 @@ import Base from "./Base";
import
AddTest
from
"./AddTest"
;
import
Jumpquestion
from
"./jumpquestios.js"
;
import
MessageRemind
from
"@/common/MessageRemind"
;
import
TagGroup
from
"@/common/tags"
;
import
moment
from
"moment"
;
import
{
message
}
from
"antd"
;
import
{
Link
,
browserHistory
,
withRouter
}
from
"react-router-dom"
;
...
...
@@ -220,13 +219,6 @@ class SurveyCreact extends Component {
console
.
log
(
tags
.
join
(),
"任务938"
);
};
//设置日历任务状态
changeTask
=
value
=>
{
this
.
setState
({
enableTask
:
value
,
});
};
render
()
{
const
{
details
,
surid
,
newsList
}
=
this
.
props
;
...
...
@@ -248,12 +240,6 @@ class SurveyCreact extends Component {
if
(
details
.
keywords
)
{
defaultTags
=
details
.
keywords
.
split
(
","
);
}
const
tagPropsNew
=
{
defaultTags
:
defaultTags
,
getTags
:
this
.
getTags
,
};
// 938 结束
const
remindProps
=
{
defaultValue
:
details
,
...
...
@@ -285,13 +271,7 @@ class SurveyCreact extends Component {
type
:
"number"
,
})(<
InputNumber
min=
{
0
}
/>)
}
</
FormItem
>
<
FormItem
label=
"自定义关键词"
{
...
formItemLayout
}
>
{
getFieldDecorator
(
"keywords"
)(<
TagGroup
{
...
tagPropsNew
}
/>)
}
</
FormItem
>
</
Form
>
{
/* <Remind ref={(obj) => this.remind = obj} {...remindProps} key={this.state.key} newsList={newsList}/> */
}
{
// 修改
details
.
remind
!==
0
&&
details
.
remind
&&
(
<
MessageRemind
...
...
@@ -313,12 +293,6 @@ class SurveyCreact extends Component {
wrappedComponentRef=
{
form
=>
(
this
.
messageRemind
=
form
)
}
/>
)
}
<
Task
taskValue=
{
details
.
enableTask
}
type=
{
0
}
getFieldDecorator=
{
getFieldDecorator
}
changeTask=
{
this
.
changeTask
}
/>
</
div
>
</
div
>
),
...
...
src/pages/TrainingTools/Survey/Details/index.jsx
View file @
bfe13a01
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
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