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 61308a40
authored
Mar 09, 2026
by
cen
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: oss处理
1 parent
7b268dcd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
38 deletions
pages/boutique/preview.vue
pages/evaluationForm/addEvaluationFrom.vue
pages/evaluationForm/components/uploadMedia.vue
pages/evaluationForm/confirmCar.vue
pages/evaluationForm/signInfo.vue
pages/usedCar/deliveryManagement/components/DeliverySteps/Step2.vue
pages/usedCar/deliveryManagement/components/DeliverySteps/Step3.vue
utils/ossImageProcess.js
pages/boutique/preview.vue
View file @
61308a4
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<view
:class=
"['popup-body',
{ 'has-ai': AIUrl }]">
<view
:class=
"['popup-body',
{ 'has-ai': AIUrl }]">
<video
ref=
"videoPlayer"
:src=
"detailUrl"
controls
v-if=
"sourceType == 2"
></video>
<video
ref=
"videoPlayer"
:src=
"detailUrl"
controls
v-if=
"sourceType == 2"
></video>
<view
class=
"img-detail"
v-else
>
<view
class=
"img-detail"
v-else
>
<image
@
click=
"back"
:src=
"
detail
Url"
mode=
"heightFix"
/>
<image
@
click=
"back"
:src=
"
imagePreview
Url"
mode=
"heightFix"
/>
</view>
</view>
</view>
</view>
<view
class=
"AI-window"
v-if=
"AIUrl"
>
<view
class=
"AI-window"
v-if=
"AIUrl"
>
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
</
template
>
</
template
>
<
script
type=
"text/ecmascript-6"
>
<
script
type=
"text/ecmascript-6"
>
import
{
aiUrlMixin
,
report
}
from
'@/mixin/index.js'
import
{
aiUrlMixin
,
report
}
from
'@/mixin/index.js'
import
{
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
export
default
{
export
default
{
mixins
:
[
report
,
aiUrlMixin
],
mixins
:
[
report
,
aiUrlMixin
],
...
@@ -53,6 +54,10 @@ export default {
...
@@ -53,6 +54,10 @@ export default {
if
(
this
.
isComponents
)
status
=
this
.
show
if
(
this
.
isComponents
)
status
=
this
.
show
return
status
return
status
},
},
imagePreviewUrl
()
{
// 仅图片回显拼接 OSS 参数展示,视频保持原始 URL
return
getImageDisplayUrl
(
this
.
detailUrl
)
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
this
.
init
(
options
)
this
.
init
(
options
)
...
...
pages/evaluationForm/addEvaluationFrom.vue
View file @
61308a4
...
@@ -147,7 +147,6 @@ import OrderPopup from '@/components/OrderPopup/index.vue'
...
@@ -147,7 +147,6 @@ import OrderPopup from '@/components/OrderPopup/index.vue'
import
SelectCar
from
'./components/SelectCar.vue'
import
SelectCar
from
'./components/SelectCar.vue'
import
FormCell
from
'./components/FormCell.vue'
import
FormCell
from
'./components/FormCell.vue'
import
{
uploadFile
}
from
'@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUploadFile/uploadFile.js'
import
{
appendImageOssProcess
}
from
'@/utils/ossImageProcess.js'
import
SelectCity
from
'./components/SelectCity.vue'
import
SelectCity
from
'./components/SelectCity.vue'
import
UploadMedia
from
'./components/uploadMedia.vue'
import
UploadMedia
from
'./components/uploadMedia.vue'
import
NoticePopup
from
'@/components/NoticePopup.vue'
import
NoticePopup
from
'@/components/NoticePopup.vue'
...
@@ -1236,7 +1235,6 @@ export default {
...
@@ -1236,7 +1235,6 @@ export default {
// 上传所有选择的图片
// 上传所有选择的图片
for
(
const
tempFilePath
of
res
.
tempFilePaths
)
{
for
(
const
tempFilePath
of
res
.
tempFilePaths
)
{
let
url
=
await
uploadFile
(
tempFilePath
)
let
url
=
await
uploadFile
(
tempFilePath
)
url
=
appendImageOssProcess
(
url
)
console
.
log
(
'上传图片成功'
,
url
)
console
.
log
(
'上传图片成功'
,
url
)
this
[
type
](
url
)
this
[
type
](
url
)
}
}
...
@@ -1265,7 +1263,6 @@ export default {
...
@@ -1265,7 +1263,6 @@ export default {
// 上传所有选择的图片
// 上传所有选择的图片
for
(
const
tempFilePath
of
res
.
tempFilePaths
)
{
for
(
const
tempFilePath
of
res
.
tempFilePaths
)
{
let
url
=
await
uploadFile
(
tempFilePath
)
let
url
=
await
uploadFile
(
tempFilePath
)
url
=
appendImageOssProcess
(
url
)
console
.
log
(
'上传图片成功'
,
url
)
console
.
log
(
'上传图片成功'
,
url
)
this
[
type
](
url
)
this
[
type
](
url
)
}
}
...
...
pages/evaluationForm/components/uploadMedia.vue
View file @
61308a4
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<
script
>
<
script
>
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
appendImageOssProcess
,
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
{
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
permision
from
'@/js_sdk/wa-permission/permission.js'
import
permision
from
'@/js_sdk/wa-permission/permission.js'
export
default
{
export
default
{
...
@@ -156,7 +156,6 @@ export default {
...
@@ -156,7 +156,6 @@ export default {
// 上传所有选择的图片
// 上传所有选择的图片
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
let
url
=
await
uploadFile
(
res
.
tempFiles
[
i
],
res
.
tempFilePaths
[
i
])
let
url
=
await
uploadFile
(
res
.
tempFiles
[
i
],
res
.
tempFilePaths
[
i
])
url
=
appendImageOssProcess
(
url
)
uni
.
hideLoading
()
uni
.
hideLoading
()
...
@@ -198,7 +197,6 @@ export default {
...
@@ -198,7 +197,6 @@ export default {
// 上传所有选择的图片
// 上传所有选择的图片
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
res
.
tempFilePaths
.
length
;
i
++
)
{
let
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
)
console
.
log
(
'上传图片成功'
,
url
)
uni
.
hideLoading
()
uni
.
hideLoading
()
// const fileExtension = res.tempFiles[0]?.name ? res.tempFiles[0]?.name.split('.').pop().toLowerCase() : res.tempFiles[0]?.path.split('.').pop().toLowerCase()
// 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 @
61308a4
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
<
script
>
<
script
>
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
appendImageOssProcess
,
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
{
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
FormCell
from
'./components/FormCell.vue'
import
FormCell
from
'./components/FormCell.vue'
import
GeneralPopup
from
'./components/GeneralPopup.vue'
import
GeneralPopup
from
'./components/GeneralPopup.vue'
import
OrderPopup
from
'@/components/OrderPopup/index.vue'
import
OrderPopup
from
'@/components/OrderPopup/index.vue'
...
@@ -671,8 +671,8 @@ export default {
...
@@ -671,8 +671,8 @@ export default {
},
},
// 添加图片到对应的数组中(确保响应式更新)
// 添加图片到对应的数组中(确保响应式更新)
addImage
(
field
,
url
)
{
addImage
(
field
,
url
)
{
//
图片追加 OSS 处理参数,视频不处理
//
上传完成后保持原始 URL;仅在回显/预览时拼接 OSS 处理参数展示
const
finalUrl
=
url
.
includes
(
this
.
videoProcess
)
?
url
:
appendImageOssProcess
(
url
)
const
finalUrl
=
url
// 添加新图片
// 添加新图片
if
(
!
Array
.
isArray
(
this
.
uploadedImages
[
field
.
key
]))
{
if
(
!
Array
.
isArray
(
this
.
uploadedImages
[
field
.
key
]))
{
this
.
$set
(
this
.
uploadedImages
,
field
.
key
,
[])
this
.
$set
(
this
.
uploadedImages
,
field
.
key
,
[])
...
...
pages/evaluationForm/signInfo.vue
View file @
61308a4
...
@@ -373,7 +373,7 @@ import FormCell from './components/FormCell.vue'
...
@@ -373,7 +373,7 @@ import FormCell from './components/FormCell.vue'
import
GeneralPopup
from
'./components/GeneralPopup.vue'
import
GeneralPopup
from
'./components/GeneralPopup.vue'
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
appendImageOssProcess
,
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
{
getImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
import
OrderPopup
from
'@/components/OrderPopup/index.vue'
import
OrderPopup
from
'@/components/OrderPopup/index.vue'
import
dayjs
from
'dayjs'
import
dayjs
from
'dayjs'
import
NoticePopup
from
'@/components/NoticePopup.vue'
import
NoticePopup
from
'@/components/NoticePopup.vue'
...
@@ -1416,8 +1416,8 @@ export default {
...
@@ -1416,8 +1416,8 @@ export default {
})
})
},
},
addMedia
(
field
,
media
)
{
addMedia
(
field
,
media
)
{
const
url
=
media
.
type
===
'image'
?
appendImageOssProcess
(
media
.
url
)
:
media
.
url
// 上传完成后保持原始 URL;仅在回显/预览时拼接 OSS 处理参数展示
this
.
$set
(
this
.
formData
,
field
,
url
)
this
.
$set
(
this
.
formData
,
field
,
media
.
url
)
},
},
removeMedia
(
field
)
{
removeMedia
(
field
)
{
// 显示确认对话框
// 显示确认对话框
...
...
pages/usedCar/deliveryManagement/components/DeliverySteps/Step2.vue
View file @
61308a4
...
@@ -13,14 +13,17 @@
...
@@ -13,14 +13,17 @@
{{
imgList
.
length
}}
/10
{{
imgList
.
length
}}
/10
</view>
</view>
</
template
>
</
template
>
<
template
v-for=
"(i, index) in imgList"
>
<view
<view
class=
"img-item"
:key=
"index"
>
class=
"img-item"
<image
:src=
"i"
class=
"img"
mode=
"aspectFill"
@
click=
"previewMedia(i, 1)"
/>
v-for=
"(i, index) in imgList"
<view
class=
"del flex"
>
:key=
"index"
<uni-icons
type=
"closeempty"
:size=
"10"
color=
"#fff"
@
click=
"delImage(index)"
></uni-icons>
>
</view>
<!-- 缩略图展示时为图片拼接 OSS 预览参数,存储与提交依然使用原始 URL -->
<image
:src=
"getImageDisplayUrl(i)"
class=
"img"
mode=
"aspectFill"
@
click=
"previewMedia(i, 1)"
/>
<view
class=
"del flex"
>
<uni-icons
type=
"closeempty"
:size=
"10"
color=
"#fff"
@
click=
"delImage(index)"
></uni-icons>
</view>
</view>
</
template
>
</
view
>
</view>
</view>
<view
class=
"img-tips"
>
单个文件不超过10M,最多可上传10张。
</view>
<view
class=
"img-tips"
>
单个文件不超过10M,最多可上传10张。
</view>
</view>
</view>
...
@@ -46,6 +49,7 @@
...
@@ -46,6 +49,7 @@
<
script
type=
"text/ecmascript-6"
>
<
script
type=
"text/ecmascript-6"
>
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
{
uploadFile
}
from
'@/utils/ossUpload.js'
import
permision
from
'@/js_sdk/wa-permission/permission.js'
import
permision
from
'@/js_sdk/wa-permission/permission.js'
import
{
getImageDisplayUrl
as
rawGetImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
const
MAX_IMAGE_SIZE
=
10
*
1024
*
1024
,
// 图片最大10MB
const
MAX_IMAGE_SIZE
=
10
*
1024
*
1024
,
// 图片最大10MB
MAX_IMG_COUNT
=
10
// 最大图片数量
MAX_IMG_COUNT
=
10
// 最大图片数量
export
default
{
export
default
{
...
@@ -68,6 +72,9 @@ export default {
...
@@ -68,6 +72,9 @@ export default {
mounted
()
{
mounted
()
{
},
},
methods
:
{
methods
:
{
getImageDisplayUrl
(
url
)
{
return
rawGetImageDisplayUrl
(
url
)
},
delImage
(
index
)
{
delImage
(
index
)
{
this
.
imgList
.
splice
(
index
,
1
)
this
.
imgList
.
splice
(
index
,
1
)
},
},
...
...
pages/usedCar/deliveryManagement/components/DeliverySteps/Step3.vue
View file @
61308a4
<
template
>
<
template
>
<view
class=
"step-3"
>
<view
class=
"step-3"
>
<view
class=
"upload-box box"
>
<view
class=
"upload-box box"
>
<view
class=
"title"
>
<view
class=
"title"
>
交付照片
</view>
交付照片
</view>
<view
class=
"img-list flex"
>
<view
class=
"img-list flex"
>
<template
v-for=
"(i, index) in detail.imgList"
>
<template
v-for=
"(i, index) in detail.imgList"
>
<view
<view
class=
"img-item"
:key=
"index"
>
class=
"img-item"
<image
:src=
"getImageDisplayUrl(i)"
class=
"img"
mode=
"aspectFill"
@
click=
"previewMedia(i, 1)"
/>
:key=
"index"
>
<image
:src=
"i"
class=
"img"
mode=
"aspectFill"
@
click=
"previewMedia(i, 1)"
/>
</view>
</view>
</
template
>
</
template
>
</view>
</view>
...
@@ -30,7 +20,7 @@
...
@@ -30,7 +20,7 @@
<view
class=
"sprite-icon icon-delivery-step-2"
></view>
<view
class=
"sprite-icon icon-delivery-step-2"
></view>
<view
class=
"info"
>
<view
class=
"info"
>
客户提车确认
客户提车确认
<view
class=
"des"
>
提车时间:{{
detail.pickUpTime
}}
</view>
<view
class=
"des"
>
提车时间:{{
detail.pickUpTime
}}
</view>
</view>
</view>
<view
class=
"btn flex"
>
已提车
</view>
<view
class=
"btn flex"
>
已提车
</view>
</view>
</view>
...
@@ -38,6 +28,7 @@
...
@@ -38,6 +28,7 @@
</template>
</template>
<
script
type=
"text/ecmascript-6"
>
<
script
type=
"text/ecmascript-6"
>
import
{
getImageDisplayUrl
as
rawGetImageDisplayUrl
}
from
'@/utils/ossImageProcess.js'
export
default
{
export
default
{
name
:
''
,
name
:
''
,
props
:
{
props
:
{
...
@@ -56,6 +47,9 @@ export default {
...
@@ -56,6 +47,9 @@ export default {
mounted
()
{
mounted
()
{
},
},
methods
:
{
methods
:
{
getImageDisplayUrl
(
url
)
{
return
rawGetImageDisplayUrl
(
url
)
},
previewMedia
(
media
,
type
)
{
previewMedia
(
media
,
type
)
{
const
url
=
`/pages/boutique/preview?tabName=预览&sourceType=
${
type
}
&detailUrl=
${
media
}
`
const
url
=
`/pages/boutique/preview?tabName=预览&sourceType=
${
type
}
&detailUrl=
${
media
}
`
uni
.
navigateTo
({
uni
.
navigateTo
({
...
...
utils/ossImageProcess.js
View file @
61308a4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* OSS 图片处理参数
* OSS 图片处理参数
* 用于上传图片返回地址及详情/编辑回显时的图片展示
* 用于上传图片返回地址及详情/编辑回显时的图片展示
*/
*/
export
const
IMAGE_OSS_PROCESS
=
'x-oss-process=image/format,jpg/quality,q_100'
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_EXTENSIONS
=
[
'.mp4'
,
'.mov'
,
'.avi'
,
'.wmv'
,
'.flv'
,
'.m4v'
,
'.3gp'
,
'.mkv'
,
'.webm'
]
const
VIDEO_OSS_SNAPSHOT
=
'x-oss-process=video/snapshot'
const
VIDEO_OSS_SNAPSHOT
=
'x-oss-process=video/snapshot'
...
@@ -12,7 +12,7 @@ const VIDEO_OSS_SNAPSHOT = 'x-oss-process=video/snapshot'
...
@@ -12,7 +12,7 @@ const VIDEO_OSS_SNAPSHOT = 'x-oss-process=video/snapshot'
* @param {string} url - 媒体 URL
* @param {string} url - 媒体 URL
* @returns {boolean}
* @returns {boolean}
*/
*/
export
function
isVideoUrl
(
url
)
{
function
isVideoUrl
(
url
)
{
if
(
!
url
||
typeof
url
!==
'string'
)
return
false
if
(
!
url
||
typeof
url
!==
'string'
)
return
false
if
(
url
.
includes
(
VIDEO_OSS_SNAPSHOT
))
return
true
if
(
url
.
includes
(
VIDEO_OSS_SNAPSHOT
))
return
true
const
urlLower
=
url
.
toLowerCase
()
const
urlLower
=
url
.
toLowerCase
()
...
@@ -25,7 +25,7 @@ export function isVideoUrl(url) {
...
@@ -25,7 +25,7 @@ export function isVideoUrl(url) {
* @param {string} url - 原始 URL
* @param {string} url - 原始 URL
* @returns {string} 带处理参数的 URL
* @returns {string} 带处理参数的 URL
*/
*/
export
function
appendImageOssProcess
(
url
)
{
function
appendImageOssProcess
(
url
)
{
if
(
!
url
||
typeof
url
!==
'string'
)
return
url
||
''
if
(
!
url
||
typeof
url
!==
'string'
)
return
url
||
''
if
(
isVideoUrl
(
url
))
return
url
if
(
isVideoUrl
(
url
))
return
url
if
(
url
.
includes
(
IMAGE_OSS_PROCESS
))
return
url
if
(
url
.
includes
(
IMAGE_OSS_PROCESS
))
return
url
...
@@ -40,9 +40,16 @@ export function appendImageOssProcess(url) {
...
@@ -40,9 +40,16 @@ export function appendImageOssProcess(url) {
* @param {boolean} [isImageType] - 已知为图片类型时可传 true,跳过视频判断
* @param {boolean} [isImageType] - 已知为图片类型时可传 true,跳过视频判断
* @returns {string}
* @returns {string}
*/
*/
export
function
getImageDisplayUrl
(
url
,
isImageType
=
false
)
{
function
getImageDisplayUrl
(
url
,
isImageType
=
false
)
{
if
(
!
url
||
typeof
url
!==
'string'
)
return
url
||
''
if
(
!
url
||
typeof
url
!==
'string'
)
return
url
||
''
if
(
isImageType
)
return
appendImageOssProcess
(
url
)
if
(
isImageType
)
return
appendImageOssProcess
(
url
)
if
(
isVideoUrl
(
url
))
return
url
if
(
isVideoUrl
(
url
))
return
url
return
appendImageOssProcess
(
url
)
return
appendImageOssProcess
(
url
)
}
}
module
.
exports
=
{
IMAGE_OSS_PROCESS
,
isVideoUrl
,
appendImageOssProcess
,
getImageDisplayUrl
}
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