Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
csssp-xcx-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
劳广强
csssp-xcx-h5
Commits
af511ab6
提交
af511ab6
authored
1月 05, 2023
作者:
杨斌基
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(上报内容): 按示例适配可上传照片还是视频,只照片时限定数量 3 张
上级
52b5a0bb
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
57 行增加
和
20 行删除
+57
-20
UploadActionSheet.vue
pages/record-content/UploadActionSheet.vue
+2
-12
index.vue
pages/record-content/index.vue
+55
-8
没有找到文件。
pages/record-content/UploadActionSheet.vue
浏览文件 @
af511ab6
...
...
@@ -5,20 +5,10 @@
</
template
>
<
script
>
const
actionsOptions
=
[
{
name
:
'图片'
,
type
:
'image'
,
},
{
name
:
'视频'
,
type
:
'video'
,
},
];
export
default
{
name
:
'UploadActionSheet'
,
props
:
{
actionsOptions
:
Array
,
success
:
{
type
:
Function
,
default
:
(
item
)
=>
{},
...
...
@@ -27,7 +17,7 @@ export default {
data
()
{
return
{
show
:
false
,
actionsOptions
,
//
actionsOptions,
};
},
methods
:
{
...
...
pages/record-content/index.vue
浏览文件 @
af511ab6
...
...
@@ -65,7 +65,7 @@
<view
class=
"step_box"
>
<view
class=
"tep_one"
>
<image
mode=
"aspectFill"
class=
"tep_icon"
src=
"/static/icon/ic_rw_zp@2x.png"
/>
<view
class=
"one"
>
{{ !showActive ? null :
'上传照片/视频'
}}
</view>
<view
class=
"one"
>
{{ !showActive ? null :
uploadTitle
}}
</view>
</view>
<view
class=
"photo_wrapper"
>
<view
class=
"photo_list"
>
...
...
@@ -85,7 +85,7 @@
<image
@
click
.
native
.
stop=
"cancel(item, index)"
mode=
"aspectFill"
class=
"upload_del"
src=
"/static/icon/ic_zp_del@2x.png"
/>
</view>
</view>
<view
class=
"photo_upload"
@
click=
"upload"
>
<view
v-if=
"isAllowUpload"
class=
"photo_upload"
@
click=
"upload"
>
<image
mode=
"aspectFill"
class=
"upload_icon"
src=
"/static/icon/upload_icon@2x.png"
/>
</view>
</view>
...
...
@@ -262,7 +262,7 @@
<view
class=
"step_box"
>
<view
class=
"tep_one"
>
<image
mode=
"aspectFill"
class=
"tep_icon"
src=
"/static/icon/ic_rw_zp@2x.png"
/>
<view
class=
"one"
>
{{
'上传照片/视频'
}}
</view>
<view
class=
"one"
>
{{
uploadTitle
}}
</view>
</view>
<view
class=
"photo_wrapper"
>
<view
class=
"photo_list"
>
...
...
@@ -282,7 +282,7 @@
<image
@
click
.
native
.
stop=
"cancel(item, index)"
mode=
"aspectFill"
class=
"upload_del"
src=
"/static/icon/ic_zp_del@2x.png"
/>
</view>
</view>
<view
class=
"photo_upload"
@
click=
"upload"
>
<view
v-if=
"isAllowUpload"
class=
"photo_upload"
@
click=
"upload"
>
<image
mode=
"aspectFill"
class=
"upload_icon"
src=
"/static/icon/upload_icon@2x.png"
/>
</view>
</view>
...
...
@@ -424,7 +424,7 @@
<!-- <van-action-sheet :show="show" :actions="typeList" bind:close="onClose" cancel-text="取消" bind:select="onSelect" />-->
<u-action-sheet
:actions=
"typeList"
:show=
"show"
cancelText=
"取消"
safeAreaInsetBottom
round=
"32rpx"
@
close=
"onActionSheetClose"
@
select=
"onActionSheetSelect"
/>
<UploadActionSheet
ref=
"uploadActionSheet"
:success=
"onUpload"
/>
<UploadActionSheet
ref=
"uploadActionSheet"
:
actionsOptions=
"uploadActionsOptions"
:
success=
"onUpload"
/>
<CertificateTypeActionSheet
ref=
"certificateTypeActionSheet"
:success=
"onCertificateTypeChange"
/>
<u-datetime-picker
:show=
"showIllegalTime"
...
...
@@ -447,6 +447,7 @@ import { baseEncode } from '@/utils/util';
const
maxUploadVideoSizeM
=
50
// M
const
maxUploadVideoSize
=
maxUploadVideoSizeM
*
1000
*
1000
// 单位 B,参考 macOS 用 1000 计算
const
mustUploadImageCount
=
3
const
typeMap
=
{
illegality
:
'交通违法举报'
,
...
...
@@ -489,7 +490,7 @@ export default {
certificateText
:
''
,
},
// 上传照片或视频类型
mediaType
:
[
'image'
,
'video'
],
//
mediaType: ['image', 'video'],
showActive
:
true
,
actionsOptions
,
...
...
@@ -505,6 +506,7 @@ export default {
license_plate
:
''
,
// 车牌号码
},
mustUploadImageCount
,
map
:
{
[
typeMap
.
illegality
]:
{
...
...
@@ -544,6 +546,41 @@ export default {
},
isDispersion
()
{
return
this
.
activeItem
.
name
===
typeMap
.
dispersion
},
uploadActionsOptions
()
{
const
{
activeItem
=
{}
}
=
this
const
actionsOptions
=
[
{
name
:
'照片'
,
type
:
'image'
,
},
{
name
:
'视频'
,
type
:
'video'
,
}
]
const
res
=
[]
if
(
activeItem
.
upload_image
===
1
)
{
res
.
push
(
actionsOptions
[
0
])
}
if
(
activeItem
.
upload_video
===
1
)
{
res
.
push
(
actionsOptions
[
1
])
}
return
res
},
isOnlyAllowUploadOneType
()
{
return
this
.
uploadActionsOptions
.
length
===
1
},
isOnlyAllowUploadImages
()
{
const
{
isOnlyAllowUploadOneType
,
uploadActionsOptions
:
options
}
=
this
return
isOnlyAllowUploadOneType
&&
options
[
0
].
type
===
'image'
},
uploadTitle
()
{
return
`上传
${
this
.
uploadActionsOptions
.
map
(
v
=>
v
.
name
).
join
(
'/'
)}
`
},
isAllowUpload
()
{
return
!
this
.
isOnlyAllowUploadImages
||
this
.
photoList
.
length
<
mustUploadImageCount
}
},
...
...
@@ -641,6 +678,11 @@ export default {
});
return
;
}
if
(
this
.
isOnlyAllowUploadOneType
)
{
// 跳过选择上传照片还是视频
this
.
onUpload
(
this
.
uploadActionsOptions
[
0
])
return
}
this
.
$refs
.
uploadActionSheet
.
show
=
true
;
},
...
...
@@ -770,11 +812,16 @@ export default {
}
try
{
const
images
=
this
.
photoList
.
filter
(({
type
})
=>
type
===
'image'
)
if
(
this
.
isOnlyAllowUploadImages
)
{
if
(
images
.
length
!==
mustUploadImageCount
)
{
return
t
(
`请上传
${
mustUploadImageCount
}
张照片`
)
}
}
await
uni
.
$u
.
http
.
post
(
'/api/photo_task/create'
,
{
title
:
this
.
title
,
type_id
:
this
.
id
,
image_list
:
this
.
photoList
.
filter
(({
type
})
=>
type
===
'image'
)
image_list
:
images
.
map
(({
url
})
=>
url
)
.
join
(),
video_list
:
this
.
photoList
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论