Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea-resources-web
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
tea-resources-web
Commits
7579b181
Commit
7579b181
authored
Mar 27, 2024
by
高宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通用上传接口
parent
beb9b637
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
10 deletions
+84
-10
sysContest.js
src/api/contentManagement/sysContest.js
+8
-0
index.vue
src/views/contentManagement/centralCase/info/index.vue
+18
-1
index.vue
src/views/contentManagement/competitionSupport/index.vue
+21
-5
index.vue
src/views/contentManagement/developmentCourse/index.vue
+19
-3
index.vue
src/views/contentManagement/newsInformation/info/index.vue
+18
-1
No files found.
src/api/contentManagement/sysContest.js
View file @
7579b181
...
@@ -66,3 +66,11 @@ export function exportCmsContest(query) {
...
@@ -66,3 +66,11 @@ export function exportCmsContest(query) {
responseType
:
'blob'
responseType
:
'blob'
})
})
}
}
// 7.上传接口
export
function
uploadPublic
(
data
)
{
return
request
({
url
:
'common/fileUpload'
,
method
:
'post'
,
data
})
}
src/views/contentManagement/centralCase/info/index.vue
View file @
7579b181
...
@@ -61,7 +61,8 @@
...
@@ -61,7 +61,8 @@
<el-form-item
label=
"封面:"
>
<el-form-item
label=
"封面:"
>
<el-upload
<el-upload
class=
"avatar-uploader"
class=
"avatar-uploader"
:action=
"fileUpload"
action=
"#"
:http-request=
"handleUpload"
:show-file-list=
"false"
:show-file-list=
"false"
:on-success=
"handleAvatarSuccess"
:on-success=
"handleAvatarSuccess"
:before-upload=
"beforeAvatarUpload"
:before-upload=
"beforeAvatarUpload"
...
@@ -96,6 +97,7 @@
...
@@ -96,6 +97,7 @@
<
script
>
<
script
>
import
{
VueEditor
}
from
'vue2-editor'
import
{
VueEditor
}
from
'vue2-editor'
import
{
addCmsProject
,
getCmsProject
,
updateCmsProject
}
from
'@/api/contentManagement/cmsProject'
import
{
addCmsProject
,
getCmsProject
,
updateCmsProject
}
from
'@/api/contentManagement/cmsProject'
import
{
uploadPublic
}
from
'@/api/contentManagement/sysContest'
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -176,6 +178,21 @@ export default {
...
@@ -176,6 +178,21 @@ export default {
this
.
getDetail
()
this
.
getDetail
()
},
},
methods
:
{
methods
:
{
/**
* @description: 处理上传接口
* @author: gaoyu
* @param:
* @return:
**/
handleUpload
(
file
)
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
formData
.
append
(
'temp'
,
'centralCase'
)
uploadPublic
(
formData
).
then
(
res
=>
{
this
.
form
.
pictureId
=
res
.
data
.
businessId
this
.
imageUrl
=
this
.
imagePath
+
res
.
data
.
path
})
},
// 查询详情
// 查询详情
getDetail
()
{
getDetail
()
{
console
.
log
(
'查询详情'
)
console
.
log
(
'查询详情'
)
...
...
src/views/contentManagement/competitionSupport/index.vue
View file @
7579b181
...
@@ -155,13 +155,14 @@
...
@@ -155,13 +155,14 @@
<!-- </el-upload>-->
<!-- </el-upload>-->
<el-upload
<el-upload
class=
"avatar-uploader"
class=
"avatar-uploader"
:action=
"fileUpload"
action=
"#"
:http-request=
"handleUpload"
:show-file-list=
"false"
:show-file-list=
"false"
:on-success=
"handleAvatarSuccess"
:on-success=
"handleAvatarSuccess"
:before-upload=
"beforeAvatarUpload"
:before-upload=
"beforeAvatarUpload"
>
>
<!-- <img v-if="imageUrl" :src="imageUrl" style="height: 200px;width: 200px">--
>
<img
v-if=
"imageUrl"
:src=
"imageUrl"
style=
"height: 200px;width: 200px"
>
<img
v-if=
"form.url"
:src=
"form.url"
style=
"height: 200px;width: 200px"
>
<!-- <img v-if="form.url" :src="form.url" style="height: 200px;width: 200px">--
>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
</el-upload>
</el-upload>
</el-form-item>
</el-form-item>
...
@@ -187,7 +188,7 @@ import {
...
@@ -187,7 +188,7 @@ import {
delCmsContest
,
delCmsContest
,
addCmsContest
,
addCmsContest
,
updateCmsContest
,
updateCmsContest
,
exportCmsContest
exportCmsContest
,
uploadPublic
}
from
'@/api/contentManagement/sysContest'
}
from
'@/api/contentManagement/sysContest'
import
commonField
from
'@/utils/commonField'
import
commonField
from
'@/utils/commonField'
...
@@ -223,7 +224,7 @@ export default {
...
@@ -223,7 +224,7 @@ export default {
dictValue
:
'0'
dictValue
:
'0'
}
}
],
],
fileUpload
:
'/dev-api/common/fileUpload?file='
+
this
.
file
+
'&temp='
+
'
temp
'
,
fileUpload
:
'/dev-api/common/fileUpload?file='
+
this
.
file
+
'&temp='
+
'
competitionSupport
'
,
// imagePath: 'http://49.232.167.247:20020/eduServer/',
// imagePath: 'http://49.232.167.247:20020/eduServer/',
imagePath
:
'http://192.168.1.12:8888/eduServer/'
,
imagePath
:
'http://192.168.1.12:8888/eduServer/'
,
imageUrl
:
''
,
imageUrl
:
''
,
...
@@ -265,6 +266,21 @@ export default {
...
@@ -265,6 +266,21 @@ export default {
this
.
getList
()
// 列表查询
this
.
getList
()
// 列表查询
},
},
methods
:
{
methods
:
{
/**
* @description: 处理上传接口
* @author: gaoyu
* @param:
* @return:
**/
handleUpload
(
file
)
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
formData
.
append
(
'temp'
,
'competitionSupport'
)
uploadPublic
(
formData
).
then
(
res
=>
{
this
.
form
.
contestPicture
=
res
.
data
.
businessId
this
.
imageUrl
=
this
.
imagePath
+
res
.
data
.
path
})
},
/** 查询列表 */
/** 查询列表 */
getList
()
{
getList
()
{
this
.
loading
=
true
this
.
loading
=
true
...
...
src/views/contentManagement/developmentCourse/index.vue
View file @
7579b181
...
@@ -189,7 +189,8 @@
...
@@ -189,7 +189,8 @@
<el-upload
<el-upload
:show-file-list=
"false"
:show-file-list=
"false"
list-type=
"picture-card"
list-type=
"picture-card"
:action=
"fileUpload"
action=
"#"
:http-request=
"handleUpload"
:on-success=
"handleAvatarSuccess"
:on-success=
"handleAvatarSuccess"
:before-upload=
"beforeAvatarUpload"
:before-upload=
"beforeAvatarUpload"
:on-remove=
"handleRemove"
:on-remove=
"handleRemove"
...
@@ -232,6 +233,7 @@ import {
...
@@ -232,6 +233,7 @@ import {
exportCmsDevelopment
exportCmsDevelopment
}
from
'@/api/contentManagement/cmsDevelopment'
}
from
'@/api/contentManagement/cmsDevelopment'
import
commonField
from
'@/utils/commonField'
import
commonField
from
'@/utils/commonField'
import
{
uploadPublic
}
from
'@/api/contentManagement/sysContest'
export
default
{
export
default
{
name
:
'CmsDevelopment'
,
name
:
'CmsDevelopment'
,
...
@@ -241,7 +243,7 @@ export default {
...
@@ -241,7 +243,7 @@ export default {
dialogImageUrl
:
''
,
dialogImageUrl
:
''
,
dialogVisible
:
false
,
dialogVisible
:
false
,
disabled
:
false
,
disabled
:
false
,
fileUpload
:
'/dev-api/common/fileUpload?file='
+
this
.
file
+
'&temp='
+
'
temp
'
,
fileUpload
:
'/dev-api/common/fileUpload?file='
+
this
.
file
+
'&temp='
+
'
development
'
,
// 遮罩层
// 遮罩层
loading
:
true
,
loading
:
true
,
// 总条数
// 总条数
...
@@ -323,7 +325,21 @@ export default {
...
@@ -323,7 +325,21 @@ export default {
this
.
getList
()
// 列表查询
this
.
getList
()
// 列表查询
},
},
methods
:
{
methods
:
{
/**
* @description: 处理上传接口
* @author: gaoyu
* @param:
* @return:
**/
handleUpload
(
file
)
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
formData
.
append
(
'temp'
,
'developmentCourse'
)
uploadPublic
(
formData
).
then
(
res
=>
{
this
.
form
.
img
=
res
.
data
.
businessId
this
.
imageUrl
=
this
.
imagePath
+
res
.
data
.
path
})
},
handleAvatarSuccess
(
res
,
file
)
{
handleAvatarSuccess
(
res
,
file
)
{
console
.
log
(
'res'
,
res
)
console
.
log
(
'res'
,
res
)
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
)
this
.
imageUrl
=
URL
.
createObjectURL
(
file
.
raw
)
...
...
src/views/contentManagement/newsInformation/info/index.vue
View file @
7579b181
...
@@ -86,7 +86,8 @@
...
@@ -86,7 +86,8 @@
<el-form-item
label=
"封面:"
>
<el-form-item
label=
"封面:"
>
<el-upload
<el-upload
class=
"avatar-uploader"
class=
"avatar-uploader"
:action=
"fileUpload"
action=
"#"
:http-request=
"handleUpload"
:show-file-list=
"false"
:show-file-list=
"false"
:on-success=
"handleAvatarSuccess"
:on-success=
"handleAvatarSuccess"
:before-upload=
"beforeAvatarUpload"
:before-upload=
"beforeAvatarUpload"
...
@@ -123,6 +124,7 @@ import {
...
@@ -123,6 +124,7 @@ import {
getSysContentNewsInformation
,
updateSysContentNewsInformation
getSysContentNewsInformation
,
updateSysContentNewsInformation
}
from
'@/api/contentManagement/sysContentNewsInformation'
}
from
'@/api/contentManagement/sysContentNewsInformation'
import
{
VueEditor
}
from
'vue2-editor'
import
{
VueEditor
}
from
'vue2-editor'
import
{
uploadPublic
}
from
'@/api/contentManagement/sysContest'
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -203,6 +205,21 @@ export default {
...
@@ -203,6 +205,21 @@ export default {
this
.
getDetail
()
this
.
getDetail
()
},
},
methods
:
{
methods
:
{
/**
* @description: 处理上传接口
* @author: gaoyu
* @param:
* @return:
**/
handleUpload
(
file
)
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
file
.
file
)
formData
.
append
(
'temp'
,
'newInformation'
)
uploadPublic
(
formData
).
then
(
res
=>
{
this
.
form
.
pictureId
=
res
.
data
.
businessId
this
.
imageUrl
=
this
.
imagePath
+
res
.
data
.
path
})
},
// 查询详情
// 查询详情
getDetail
()
{
getDetail
()
{
console
.
log
(
'查询详情'
)
console
.
log
(
'查询详情'
)
...
...
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