Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust_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
张伯涛
cust_web
Commits
6d00a908
Commit
6d00a908
authored
Apr 23, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了上传逻辑,以及修复了图片显示异步问题,上传判断字段后续需要改
parent
333b87d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
70 deletions
+139
-70
index.vue
src/views/contentManagement/activity/index.vue
+12
-8
index.vue
src/views/contentManagement/activity/info/index.vue
+26
-11
index.vue
src/views/contentManagement/banner/index.vue
+39
-22
index.vue
src/views/contentManagement/notice/index.vue
+10
-7
index.vue
src/views/contentManagement/notice/info/index.vue
+26
-11
index.vue
src/views/operationsManagement/member/info/index.vue
+26
-11
No files found.
src/views/contentManagement/activity/index.vue
View file @
6d00a908
...
@@ -525,17 +525,21 @@ export default {
...
@@ -525,17 +525,21 @@ export default {
loadData
()
{
loadData
()
{
this
.
loading
=
true
this
.
loading
=
true
listCmsActivity
(
this
.
queryParams
).
then
(
response
=>
{
listCmsActivity
(
this
.
queryParams
).
then
(
response
=>
{
this
.
tableData
=
response
.
data
const
tableData
=
response
.
data
// 处理分页数据里的url
// 处理分页数据里的url
this
.
tableData
.
forEach
(
item
=>
{
// 使用 Promise.all 处理所有的 getOssUrl 异步操作
getOssUrl
(
item
.
pictureId
).
then
(
imgRes
=>
{
const
promises
=
tableData
.
map
(
item
=>
{
item
.
url
=
imgRes
.
data
return
getOssUrl
(
item
.
pictureId
).
then
(
imgRes
=>
{
item
.
url
=
imgRes
.
data
// 更新 url 字段
})
})
})
})
this
.
total
=
response
.
total
// 等待所有异步操作完成
this
.
loading
=
false
Promise
.
all
(
promises
).
then
(()
=>
{
}
this
.
tableData
=
tableData
// 数据更新
)
this
.
total
=
response
.
total
this
.
loading
=
false
})
})
},
},
/** 查看报名人数 */
/** 查看报名人数 */
handleClick
(
row
)
{
handleClick
(
row
)
{
...
...
src/views/contentManagement/activity/info/index.vue
View file @
6d00a908
...
@@ -501,16 +501,31 @@ export default {
...
@@ -501,16 +501,31 @@ export default {
try
{
try
{
// 发起上传请求
// 发起上传请求
uploadPublic
(
formData
).
then
(
response
=>
{
uploadPublic
(
formData
).
then
(
response
=>
{
axios
({
if
(
response
.
data
.
ossInfoId
!==
null
&&
response
.
data
.
ossInfoId
!==
''
&&
response
.
data
.
ossInfoId
!==
undefined
){
method
:
'PUT'
,
// oss上传
url
:
response
.
data
.
url
,
axios
({
data
:
file
,
method
:
'PUT'
,
headers
:
{
url
:
response
.
data
.
url
,
'Content-Type'
:
file
.
type
data
:
file
,
}
headers
:
{
}).
then
(
res
=>
{
'Content-Type'
:
file
.
type
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
}
const
businessId
=
response
.
data
.
ossInfoId
}).
then
(
res
=>
{
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
ossInfoId
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
url
:
res1
.
data
,
businessId
:
businessId
}]
this
.
form
.
pictureId
=
businessId
this
.
imageUrl
=
res1
.
data
})
})
}
else
{
// 本地上传
getOssUrl
(
response
.
data
.
businessId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
businessId
// 更新 fileList,保存文件的 URL 和其他信息
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
this
.
fileList
=
[{
url
:
res1
.
data
,
url
:
res1
.
data
,
...
@@ -519,7 +534,7 @@ export default {
...
@@ -519,7 +534,7 @@ export default {
this
.
form
.
pictureId
=
businessId
this
.
form
.
pictureId
=
businessId
this
.
imageUrl
=
res1
.
data
this
.
imageUrl
=
res1
.
data
})
})
}
)
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'上传失败:'
,
error
)
console
.
error
(
'上传失败:'
,
error
)
...
...
src/views/contentManagement/banner/index.vue
View file @
6d00a908
...
@@ -299,20 +299,22 @@ export default {
...
@@ -299,20 +299,22 @@ export default {
/** 查询banner管理列表 */
/** 查询banner管理列表 */
getList
()
{
getList
()
{
this
.
loading
=
true
this
.
loading
=
true
listCmsBanner
(
this
.
queryParams
).
then
(
listCmsBanner
(
this
.
queryParams
).
then
(
response
=>
{
response
=>
{
const
tableData
=
response
.
data
this
.
cmsBannerList
=
response
.
data
// 处理分页数据里的url
// 处理分页数据里的url
// 使用 Promise.all 处理所有的 getOssUrl 异步操作
this
.
cmsBannerList
.
forEach
(
item
=>
{
const
promises
=
tableData
.
map
(
item
=>
{
getOssUrl
(
item
.
pictureId
).
then
(
imgRes
=>
{
return
getOssUrl
(
item
.
pictureId
).
then
(
imgRes
=>
{
item
.
url
=
imgRes
.
data
item
.
url
=
imgRes
.
data
// 更新 url 字段
})
})
})
console
.
log
(
'11111111111'
,
this
.
cmsBannerList
)
})
// 等待所有异步操作完成
Promise
.
all
(
promises
).
then
(()
=>
{
this
.
cmsBannerList
=
tableData
// 数据更新
this
.
total
=
response
.
total
this
.
total
=
response
.
total
this
.
loading
=
false
this
.
loading
=
false
}
}
)
)
}
)
},
},
/** 取消按钮 */
/** 取消按钮 */
cancel
()
{
cancel
()
{
...
@@ -447,16 +449,31 @@ export default {
...
@@ -447,16 +449,31 @@ export default {
try
{
try
{
// 发起上传请求
// 发起上传请求
uploadPublic
(
formData
).
then
(
response
=>
{
uploadPublic
(
formData
).
then
(
response
=>
{
axios
({
if
(
response
.
data
.
ossInfoId
!==
null
&&
response
.
data
.
ossInfoId
!==
''
&&
response
.
data
.
ossInfoId
!==
undefined
){
method
:
'PUT'
,
// oss上传
url
:
response
.
data
.
url
,
axios
({
data
:
file
,
method
:
'PUT'
,
headers
:
{
url
:
response
.
data
.
url
,
'Content-Type'
:
file
.
type
data
:
file
,
}
headers
:
{
}).
then
(
res
=>
{
'Content-Type'
:
file
.
type
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
}
const
businessId
=
response
.
data
.
ossInfoId
}).
then
(
res
=>
{
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
ossInfoId
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
url
:
res1
.
data
,
businessId
:
businessId
}]
this
.
form
.
pictureId
=
businessId
this
.
imageUrl
=
res1
.
data
})
})
}
else
{
// 本地上传
getOssUrl
(
response
.
data
.
businessId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
businessId
// 更新 fileList,保存文件的 URL 和其他信息
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
this
.
fileList
=
[{
url
:
res1
.
data
,
url
:
res1
.
data
,
...
@@ -465,7 +482,7 @@ export default {
...
@@ -465,7 +482,7 @@ export default {
this
.
form
.
pictureId
=
businessId
this
.
form
.
pictureId
=
businessId
this
.
imageUrl
=
res1
.
data
this
.
imageUrl
=
res1
.
data
})
})
}
)
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'上传失败:'
,
error
)
console
.
error
(
'上传失败:'
,
error
)
...
...
src/views/contentManagement/notice/index.vue
View file @
6d00a908
...
@@ -343,15 +343,18 @@ export default {
...
@@ -343,15 +343,18 @@ export default {
this
.
loading
=
true
this
.
loading
=
true
listCmsNotice
(
this
.
queryParams
).
then
(
listCmsNotice
(
this
.
queryParams
).
then
(
response
=>
{
response
=>
{
this
.
tableData
=
response
.
data
const
tableData
=
response
.
data
// 处理分页数据里的url
const
promises
=
tableData
.
map
(
item
=>
{
this
.
tableData
.
forEach
(
item
=>
{
return
getOssUrl
(
item
.
pictureId
).
then
(
imgRes
=>
{
getOssUrl
(
item
.
pictureId
).
then
(
imgRes
=>
{
item
.
url
=
imgRes
.
data
// 更新 url 字段
item
.
url
=
imgRes
.
data
})
})
})
})
this
.
total
=
response
.
total
// 等待所有异步操作完成
this
.
loading
=
false
Promise
.
all
(
promises
).
then
(()
=>
{
this
.
tableData
=
tableData
// 数据更新
this
.
total
=
response
.
total
this
.
loading
=
false
})
}
}
)
)
},
},
...
...
src/views/contentManagement/notice/info/index.vue
View file @
6d00a908
...
@@ -311,16 +311,31 @@ export default {
...
@@ -311,16 +311,31 @@ export default {
try
{
try
{
// 发起上传请求
// 发起上传请求
uploadPublic
(
formData
).
then
(
response
=>
{
uploadPublic
(
formData
).
then
(
response
=>
{
axios
({
if
(
response
.
data
.
ossInfoId
!==
null
&&
response
.
data
.
ossInfoId
!==
''
&&
response
.
data
.
ossInfoId
!==
undefined
){
method
:
'PUT'
,
// oss上传
url
:
response
.
data
.
url
,
axios
({
data
:
file
,
method
:
'PUT'
,
headers
:
{
url
:
response
.
data
.
url
,
'Content-Type'
:
file
.
type
data
:
file
,
}
headers
:
{
}).
then
(
res
=>
{
'Content-Type'
:
file
.
type
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
}
const
businessId
=
response
.
data
.
ossInfoId
}).
then
(
res
=>
{
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
ossInfoId
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
url
:
res1
.
data
,
businessId
:
businessId
}]
this
.
form
.
pictureId
=
businessId
this
.
imageUrl
=
res1
.
data
})
})
}
else
{
// 本地上传
getOssUrl
(
response
.
data
.
businessId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
businessId
// 更新 fileList,保存文件的 URL 和其他信息
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
this
.
fileList
=
[{
url
:
res1
.
data
,
url
:
res1
.
data
,
...
@@ -329,7 +344,7 @@ export default {
...
@@ -329,7 +344,7 @@ export default {
this
.
form
.
pictureId
=
businessId
this
.
form
.
pictureId
=
businessId
this
.
imageUrl
=
res1
.
data
this
.
imageUrl
=
res1
.
data
})
})
}
)
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'上传失败:'
,
error
)
console
.
error
(
'上传失败:'
,
error
)
...
...
src/views/operationsManagement/member/info/index.vue
View file @
6d00a908
...
@@ -1055,16 +1055,31 @@ export default {
...
@@ -1055,16 +1055,31 @@ export default {
try
{
try
{
// 发起上传请求
// 发起上传请求
uploadPublic
(
formData
).
then
(
response
=>
{
uploadPublic
(
formData
).
then
(
response
=>
{
axios
({
if
(
response
.
data
.
ossInfoId
!==
null
&&
response
.
data
.
ossInfoId
!==
''
&&
response
.
data
.
ossInfoId
!==
undefined
){
method
:
'PUT'
,
// oss上传
url
:
response
.
data
.
url
,
axios
({
data
:
file
,
method
:
'PUT'
,
headers
:
{
url
:
response
.
data
.
url
,
'Content-Type'
:
file
.
type
data
:
file
,
}
headers
:
{
}).
then
(
res
=>
{
'Content-Type'
:
file
.
type
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
}
const
businessId
=
response
.
data
.
ossInfoId
}).
then
(
res
=>
{
getOssUrl
(
response
.
data
.
ossInfoId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
ossInfoId
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
url
:
res1
.
data
,
businessId
:
businessId
}]
this
.
form
.
avatar
=
businessId
this
.
imageUrl
=
res1
.
data
})
})
}
else
{
// 本地上传
getOssUrl
(
response
.
data
.
businessId
).
then
(
res1
=>
{
const
businessId
=
response
.
data
.
businessId
// 更新 fileList,保存文件的 URL 和其他信息
// 更新 fileList,保存文件的 URL 和其他信息
this
.
fileList
=
[{
this
.
fileList
=
[{
url
:
res1
.
data
,
url
:
res1
.
data
,
...
@@ -1073,7 +1088,7 @@ export default {
...
@@ -1073,7 +1088,7 @@ export default {
this
.
form
.
avatar
=
businessId
this
.
form
.
avatar
=
businessId
this
.
imageUrl
=
res1
.
data
this
.
imageUrl
=
res1
.
data
})
})
}
)
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'上传失败:'
,
error
)
console
.
error
(
'上传失败:'
,
error
)
...
...
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