Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 83c44187
authored
Feb 25, 2026
by
cen
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: oss更新
1 parent
75b3806b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
19 deletions
env.js
pages/evaluationForm/addEvaluationFrom.vue
pages/evaluationForm/components/uploadMedia.vue
pages/evaluationForm/confirmCar.vue
pages/evaluationForm/evaluationFormDetails.vue
pages/evaluationForm/signInfo.vue
utils/ossImageProcess.js
env.js
View file @
83c4418
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'beta'
]
const
index
=
3
const
index
=
2
/**
*
0本地
...
...
pages/evaluationForm/addEvaluationFrom.vue
View file @
83c4418
...
...
@@ -147,6 +147,7 @@ import OrderPopup from '@/components/OrderPopup/index.vue'
import
SelectCar
from
'./components/SelectCar.vue'
import
FormCell
from
'./components/FormCell.vue'
import
{
uploadFile
}
from
'@/utils/ossUploadFile/uploadFile.js'
import
{
appendImageOssProcess
}
from
'@/utils/ossImageProcess.js'
import
SelectCity
from
'./components/SelectCity.vue'
import
UploadMedia
from
'./components/uploadMedia.vue'
import
NoticePopup
from
'@/components/NoticePopup.vue'
...
...
@@ -1234,7 +1235,8 @@ export default {
try
{
// 上传所有选择的图片
for
(
const
tempFilePath
of
res
.
tempFilePaths
)
{
const
url
=
await
uploadFile
(
tempFilePath
)
let
url
=
await
uploadFile
(
tempFilePath
)
url
=
appendImageOssProcess
(
url
)
console
.
log
(
'上传图片成功'
,
url
)
this
[
type
](
url
)
}
...
...
@@ -1262,7 +1264,8 @@ export default {
try
{
// 上传所有选择的图片
for
(
const
tempFilePath
of
res
.
tempFilePaths
)
{
const
url
=
await
uploadFile
(
tempFilePath
)
let
url
=
await
uploadFile
(
tempFilePath
)
url
=
appendImageOssProcess
(
url
)
console
.
log
(
'上传图片成功'
,
url
)
this
[
type
](
url
)
}
...
...
pages/evaluationForm/components/uploadMedia.vue
View file @
83c4418
...
...
@@ -16,7 +16,7 @@
<!-- 显示已上传的媒体列表 -->
<view
v-for=
"(media, index) in getMedia(field)"
:key=
"index"
class=
"uploaded-media-container"
>
<!-- 图片显示 -->
<image
v-if=
"field.accept == 'image'"
:src=
"
media.url || media
"
mode=
"aspectFill"
class=
"uploaded-media"
@
click
.
stop=
"previewMedia(media, 1)"
></image>
<image
v-if=
"field.accept == 'image'"
:src=
"
getImageDisplayUrl(media.url || media)
"
mode=
"aspectFill"
class=
"uploaded-media"
@
click
.
stop=
"previewMedia(media, 1)"
></image>
<!-- 视频显示 -->
<view
v-else
class=
"video-container"
@
click
.
stop=
"previewMedia(media, 2)"
>
<!--
<video
:src=
"media.url || media"
mode=
"aspectFill"
controls
class=
"uploaded-media"
></video>
-->
...
...
@@ -37,6 +37,7 @@
<
script
>
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
appendImageOssProcess
,
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
permision
from
'@/js_sdk/wa-permission/permission.js'
export
default
{
...
...
@@ -73,6 +74,7 @@ export default {
}
},
methods
:
{
getImageDisplayUrl
,
// 处理媒体上传
async
handleMediaUpload
(
field
)
{
// #ifdef APP-PLUS
...
...
@@ -153,7 +155,8 @@ export default {
uni
.
showLoading
({
title
:
'上传中...'
,
mask
:
true
})
// 上传所有选择的图片
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
const
url
=
await
uploadFile
(
res
.
tempFiles
[
i
],
res
.
tempFilePaths
[
i
])
let
url
=
await
uploadFile
(
res
.
tempFiles
[
i
],
res
.
tempFilePaths
[
i
])
url
=
appendImageOssProcess
(
url
)
uni
.
hideLoading
()
...
...
@@ -194,7 +197,8 @@ export default {
uni
.
showLoading
({
title
:
'上传中...'
,
mask
:
true
})
// 上传所有选择的图片
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
const
url
=
await
uploadFile
(
res
.
tempFiles
[
i
],
res
.
tempFilePaths
[
i
])
let
url
=
await
uploadFile
(
res
.
tempFiles
[
i
],
res
.
tempFilePaths
[
i
])
url
=
appendImageOssProcess
(
url
)
console
.
log
(
'上传图片成功'
,
url
)
uni
.
hideLoading
()
// const fileExtension = res.tempFiles[0]?.name ? res.tempFiles[0]?.name.split('.').pop().toLowerCase() : res.tempFiles[0]?.path.split('.').pop().toLowerCase()
...
...
pages/evaluationForm/confirmCar.vue
View file @
83c4418
...
...
@@ -33,12 +33,12 @@
<view
v-if=
"image.includes(videoProcess)"
class=
"video-container"
@
click
.
stop=
"previewMedia(media, 2)"
>
<!--
<video
:src=
"media.url || media"
mode=
"aspectFill"
controls
class=
"uploaded-media"
></video>
-->
<image
:src=
"
image"
mode=
"aspectFill"
@
click
.
stop=
"previewMedia(image, 1
)"
></image>
<image
:src=
"
getImageDisplayUrl(image)"
mode=
"aspectFill"
@
click
.
stop=
"previewMedia(image, 2
)"
></image>
<view
class=
"video-play-icon"
>
<view
class=
"sprite-icon icon-upload-play"
></view>
</view>
</view>
<image
v-else
:src=
"
image"
mode=
"aspectFill"
class=
"uploaded-image
"
></image>
<image
v-else
:src=
"
getImageDisplayUrl(image)"
mode=
"aspectFill"
class=
"uploaded-image"
@
click
.
stop=
"previewMedia(image, 1)
"
></image>
<view
class=
"delete-icon"
@
click
.
stop=
"deleteImage(field.key, index, 'upload')"
>
<view
class=
"sprite-icon icon-icon-circle-error"
></view>
</view>
...
...
@@ -66,7 +66,7 @@
<view
class=
"upload-images-wrapper"
>
<!-- 显示已上传的图片列表 -->
<view
v-for=
"(image, index) in getImages(field, 'confirm')"
:key=
"index"
class=
"uploaded-image-container"
>
<image
:src=
"
image"
mode=
"aspectFill"
class=
"uploaded-image
"
></image>
<image
:src=
"
getImageDisplayUrl(image)"
mode=
"aspectFill"
class=
"uploaded-image"
@
click
.
stop=
"previewMedia(image, 1)
"
></image>
<view
class=
"delete-icon"
@
click
.
stop=
"deleteImage(field.key, index, 'confirm')"
>
<view
class=
"sprite-icon icon-icon-circle-error"
></view>
</view>
...
...
@@ -119,6 +119,7 @@
<
script
>
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
appendImageOssProcess
,
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
FormCell
from
'./components/FormCell.vue'
import
GeneralPopup
from
'./components/GeneralPopup.vue'
import
OrderPopup
from
'@/components/OrderPopup/index.vue'
...
...
@@ -249,6 +250,7 @@ export default {
return
false
},
methods
:
{
getImageDisplayUrl
,
init
(
options
)
{
this
.
query
=
options
this
.
getEvalOrderSimpleDetail
()
...
...
@@ -669,13 +671,15 @@ export default {
},
// 添加图片到对应的数组中(确保响应式更新)
addImage
(
field
,
url
)
{
// 图片追加 OSS 处理参数,视频不处理
const
finalUrl
=
url
.
includes
(
this
.
videoProcess
)
?
url
:
appendImageOssProcess
(
url
)
// 添加新图片
if
(
!
Array
.
isArray
(
this
.
uploadedImages
[
field
.
key
]))
{
this
.
$set
(
this
.
uploadedImages
,
field
.
key
,
[])
}
// 添加新媒体
this
.
$set
(
this
.
uploadedImages
[
field
.
key
],
this
.
uploadedImages
[
field
.
key
].
length
,
u
rl
)
this
.
$set
(
this
.
uploadedImages
[
field
.
key
],
this
.
uploadedImages
[
field
.
key
].
length
,
finalU
rl
)
console
.
log
(
'this.uploadedImages'
,
this
.
uploadedImages
)
},
// 删除图片
...
...
pages/evaluationForm/evaluationFormDetails.vue
View file @
83c4418
This diff is collapsed.
Click to expand it.
pages/evaluationForm/signInfo.vue
View file @
83c4418
...
...
@@ -40,7 +40,7 @@
<template>
<!-- 判断是否已上传 -->
<view
v-if=
"formData.idCardFrontUrl"
class=
"uploaded-item"
>
<image
:src=
"
formData.idCardFrontUrl
"
mode=
"aspectFit"
></image>
<image
:src=
"
getImageDisplayUrl(formData.idCardFrontUrl)
"
mode=
"aspectFit"
></image>
<view
class=
"delete-icon"
@
click
.
stop=
"removeMedia('idCardFrontUrl')"
>
<view
class=
"sprite-icon icon-icon-circle-error"
></view>
...
...
@@ -61,7 +61,7 @@
</view>
<
template
>
<view
v-if=
"formData.idCardBackUrl"
class=
"uploaded-item"
>
<image
:src=
"
formData.idCardBackUrl
"
mode=
"aspectFit"
></image>
<image
:src=
"
getImageDisplayUrl(formData.idCardBackUrl)
"
mode=
"aspectFit"
></image>
<!--
<view
class=
"remove-icon"
@
click
.
stop=
"removeMedia('idCardBackUrl')"
></view>
-->
<view
class=
"delete-icon"
@
click
.
stop=
"removeMedia('idCardBackUrl')"
>
<view
class=
"sprite-icon icon-icon-circle-error"
></view>
...
...
@@ -84,7 +84,7 @@
</view>
<
template
>
<view
v-if=
"formData.orgLicenseUrl"
class=
"uploaded-item"
>
<image
:src=
"
formData.orgLicenseUrl
"
mode=
"aspectFit"
></image>
<image
:src=
"
getImageDisplayUrl(formData.orgLicenseUrl)
"
mode=
"aspectFit"
></image>
<!--
<view
class=
"remove-icon"
@
click
.
stop=
"removeMedia('idCardBackUrl')"
></view>
-->
<view
class=
"delete-icon"
@
click
.
stop=
"removeMedia('orgLicenseUrl')"
>
<view
class=
"sprite-icon icon-icon-circle-error"
></view>
...
...
@@ -114,7 +114,7 @@
</view>
</view>
<!-- 图片显示 -->
<image
v-else
:src=
"
formData.thirdPartyTransactionVoucher
"
mode=
"aspectFit"
@
click
.
stop=
"previewMedia(formData.thirdPartyTransactionVoucher, 1)"
></image>
<image
v-else
:src=
"
getImageDisplayUrl(formData.thirdPartyTransactionVoucher)
"
mode=
"aspectFit"
@
click
.
stop=
"previewMedia(formData.thirdPartyTransactionVoucher, 1)"
></image>
<view
class=
"delete-icon"
@
click
.
stop=
"removeMedia('thirdPartyTransactionVoucher')"
>
<view
class=
"sprite-icon icon-icon-circle-error"
></view>
...
...
@@ -281,15 +281,15 @@
</view>
<view
class=
"flex align-start"
v-if=
"(formData.signerType === 0 || formData.signerType === 1) && formData.idCardFrontUrl"
>
<view
class=
"title-label-see mr-16"
>
身份证国徽面
</view>
<image
:src=
"
formData.idCardFrontUrl
"
@
click
.
stop=
"previewMedia(formData.idCardFrontUrl, 1)"
></image>
<image
:src=
"
getImageDisplayUrl(formData.idCardFrontUrl)
"
@
click
.
stop=
"previewMedia(formData.idCardFrontUrl, 1)"
></image>
</view>
<view
class=
"flex align-start"
v-if=
"(formData.signerType === 0 || formData.signerType === 1) && formData.idCardBackUrl"
>
<view
class=
"title-label-see mr-16"
>
身份证人像面
</view>
<image
:src=
"
formData.idCardBackUrl
"
@
click
.
stop=
"previewMedia(formData.idCardBackUrl, 1)"
></image>
<image
:src=
"
getImageDisplayUrl(formData.idCardBackUrl)
"
@
click
.
stop=
"previewMedia(formData.idCardBackUrl, 1)"
></image>
</view>
<view
class=
"flex align-start"
v-if=
"(formData.signerType === 1 || formData.signerType === 2) && formData.orgLicenseUrl"
>
<view
class=
"title-label-see mr-16"
>
营业执照图片
</view>
<image
:src=
"
formData.orgLicenseUrl
"
@
click
.
stop=
"previewMedia(formData.orgLicenseUrl, 1)"
></image>
<image
:src=
"
getImageDisplayUrl(formData.orgLicenseUrl)
"
@
click
.
stop=
"previewMedia(formData.orgLicenseUrl, 1)"
></image>
</view>
<view
class=
"flex align-start"
v-if=
"formData.thirdPartyTransactionVoucher"
>
<view
class=
"title-label-see mr-16"
>
三方/委托交易 凭证
</view>
...
...
@@ -301,7 +301,7 @@
</view>
</view>
<!-- 图片显示 -->
<image
v-else
:src=
"
formData.thirdPartyTransactionVoucher
"
@
click
.
stop=
"previewMedia(formData.thirdPartyTransactionVoucher, 1)"
></image>
<image
v-else
:src=
"
getImageDisplayUrl(formData.thirdPartyTransactionVoucher)
"
@
click
.
stop=
"previewMedia(formData.thirdPartyTransactionVoucher, 1)"
></image>
</view>
</view>
<view
class=
"flex align-center gridBox mb-32"
>
...
...
@@ -373,6 +373,7 @@ import FormCell from './components/FormCell.vue'
import
GeneralPopup
from
'./components/GeneralPopup.vue'
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
appendImageOssProcess
,
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
OrderPopup
from
'@/components/OrderPopup/index.vue'
import
dayjs
from
'dayjs'
import
NoticePopup
from
'@/components/NoticePopup.vue'
...
...
@@ -690,6 +691,7 @@ export default {
console
.
log
(
'formData'
,
this
.
formData
)
},
methods
:
{
getImageDisplayUrl
,
init
(
options
)
{
this
.
query
=
options
this
.
formData
.
handoverTime
=
dayjs
().
format
(
'YYYY-MM-DD HH:mm:00'
)
...
...
@@ -1414,7 +1416,8 @@ export default {
})
},
addMedia
(
field
,
media
)
{
this
.
$set
(
this
.
formData
,
field
,
media
.
url
)
const
url
=
media
.
type
===
'image'
?
appendImageOssProcess
(
media
.
url
)
:
media
.
url
this
.
$set
(
this
.
formData
,
field
,
url
)
},
removeMedia
(
field
)
{
// 显示确认对话框
...
...
utils/ossImageProcess.js
0 → 100644
View file @
83c4418
/**
* OSS 图片处理参数
* 用于上传图片返回地址及详情/编辑回显时的图片展示
*/
export
const
IMAGE_OSS_PROCESS
=
'x-oss-process=image/format,jpg/quality,q_100'
const
VIDEO_EXTENSIONS
=
[
'.mp4'
,
'.mov'
,
'.avi'
,
'.wmv'
,
'.flv'
,
'.m4v'
,
'.3gp'
,
'.mkv'
,
'.webm'
]
const
VIDEO_OSS_SNAPSHOT
=
'x-oss-process=video/snapshot'
/**
* 判断 URL 是否为视频
* @param {string} url - 媒体 URL
* @returns {boolean}
*/
export
function
isVideoUrl
(
url
)
{
if
(
!
url
||
typeof
url
!==
'string'
)
return
false
if
(
url
.
includes
(
VIDEO_OSS_SNAPSHOT
))
return
true
const
urlLower
=
url
.
toLowerCase
()
const
pathPart
=
urlLower
.
split
(
'?'
)[
0
].
split
(
'#'
)[
0
]
return
VIDEO_EXTENSIONS
.
some
(
ext
=>
pathPart
.
endsWith
(
ext
))
}
/**
* 为图片 URL 追加 OSS 处理参数(视频不处理)
* @param {string} url - 原始 URL
* @returns {string} 带处理参数的 URL
*/
export
function
appendImageOssProcess
(
url
)
{
if
(
!
url
||
typeof
url
!==
'string'
)
return
url
||
''
if
(
isVideoUrl
(
url
))
return
url
if
(
url
.
includes
(
IMAGE_OSS_PROCESS
))
return
url
const
separator
=
url
.
includes
(
'?'
)
?
'&'
:
'?'
return
url
+
separator
+
IMAGE_OSS_PROCESS
}
/**
* 获取图片展示 URL:图片追加 OSS 参数,视频原样返回
* 用于详情/编辑回显时,多图片分割后的每个 URL 展示
* @param {string} url - 媒体 URL
* @param {boolean} [isImageType] - 已知为图片类型时可传 true,跳过视频判断
* @returns {string}
*/
export
function
getImageDisplayUrl
(
url
,
isImageType
=
false
)
{
if
(
!
url
||
typeof
url
!==
'string'
)
return
url
||
''
if
(
isImageType
)
return
appendImageOssProcess
(
url
)
if
(
isVideoUrl
(
url
))
return
url
return
appendImageOssProcess
(
url
)
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment