Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
55e752f6
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6172
Star
101
Fork
177
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
21
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
21
Issue
21
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
55e752f6
编写于
12月 20, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复 showActionSheet 回调参数类型警告
上级
a1f21b55
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
101 addition
and
101 deletion
+101
-101
pages/API/choose-image/choose-image.uvue
pages/API/choose-image/choose-image.uvue
+31
-31
pages/API/choose-media/choose-media.uvue
pages/API/choose-media/choose-media.uvue
+70
-70
未找到文件。
pages/API/choose-image/choose-image.uvue
浏览文件 @
55e752f6
...
...
@@ -32,15 +32,15 @@
<input class="click-t" :value="countIndex+1" type="number" :maxlength="1" @confirm="chooseImageCount"
confirm-type="done" />
</view>
</view>
<!-- #ifdef APP -->
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
屏幕方向
</view>
<view class="uni-list-cell-right" @click="chooseOrientationType">
<text class="click-t">{{orientationType[orientationTypeIndex]}}</text>
</view>
</view>
<!-- #ifdef APP -->
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
屏幕方向
</view>
<view class="uni-list-cell-right" @click="chooseOrientationType">
<text class="click-t">{{orientationType[orientationTypeIndex]}}</text>
</view>
</view>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
...
...
@@ -131,11 +131,11 @@
['compressed'],
['original'],
['compressed', 'original']
]
var orientationTypeArray = [
'portrait',
'landscape',
'auto'
]
var orientationTypeArray = [
'portrait',
'landscape',
'auto'
]
var albumModeTypeArray = [
"custom",
...
...
@@ -149,8 +149,8 @@
sourceTypeIndex: 2,
sourceType: ['拍照', '相册', '拍照或相册'],
sizeTypeIndex: 2,
sizeType: ['压缩', '原图', '压缩或原图'],
orientationTypeIndex: 0,
sizeType: ['压缩', '原图', '压缩或原图'],
orientationTypeIndex: 0,
orientationType: ['竖屏', '横屏', '自动'],
albumModeTypeIndex:0,
albumModeType:["自定义相册","系统相册"],
...
...
@@ -172,8 +172,8 @@
this.sourceType = ['拍照', '相册', '拍照或相册']
this.sizeTypeIndex = 2
this.sizeType = ['压缩', '原图', '压缩或原图']
this.countIndex = 8
this.orientationTypeIndex = 0
this.countIndex = 8
this.orientationTypeIndex = 0
this.orientationType = ['竖屏', '横屏', '自动']
},
methods: {
...
...
@@ -214,7 +214,7 @@
uni.showActionSheet({
itemList: this.albumModeType,
success: (e) => {
this.albumModeTypeIndex = e.tapIndex
!
this.albumModeTypeIndex = e.tapIndex
}
})
},
...
...
@@ -231,7 +231,7 @@
uni.showActionSheet({
itemList: ['拍照', '相册', '拍照或相册'],
success: (e) => {
this.sourceTypeIndex = e.tapIndex
!
this.sourceTypeIndex = e.tapIndex
}
})
},
...
...
@@ -239,17 +239,17 @@
uni.showActionSheet({
itemList: ['压缩', '原图', '压缩或原图'],
success: (e) => {
this.sizeTypeIndex = e.tapIndex!
this.sizeTypeIndex = e.tapIndex
}
})
},
chooseOrientationType(){
uni.showActionSheet({
itemList: ['竖屏', '横屏', '自动'],
success: (e) => {
this.orientationTypeIndex = e.tapIndex
}
})
},
chooseOrientationType(){
uni.showActionSheet({
itemList: ['竖屏', '横屏', '自动'],
success: (e) => {
this.orientationTypeIndex = e.tapIndex!
}
})
},
chooseImageCount(event : InputConfirmEvent) {
let count = parseInt(event.detail.value) - 1
...
...
@@ -275,7 +275,7 @@
sourceType: sourceTypeArray[this.sourceTypeIndex],
sizeType: sizeTypeArray[this.sizeTypeIndex],
crop: this.isCrop ? { "quality": this.cropPercent, "width": this.cropWidth, "height": this.cropHeight, "resize": this.cropResize } as ChooseImageCropOptions : null,
count: this.imageList.length + this.count[this.countIndex] > 9 ? 9 - this.imageList.length : this.count[this.countIndex],
count: this.imageList.length + this.count[this.countIndex] > 9 ? 9 - this.imageList.length : this.count[this.countIndex],
// #ifdef APP
pageOrientation: orientationTypeArray[this.orientationTypeIndex],
// #endif
...
...
@@ -353,4 +353,4 @@
transition-property: height, margin-bottom;
transition-duration: 200ms;
}
</style>
</style>
pages/API/choose-media/choose-media.uvue
浏览文件 @
55e752f6
...
...
@@ -23,15 +23,15 @@
<view class="uni-list-cell-right" @click="chooseSizeType">
<text class="click-t">{{sizeTypes[sizeTypeIndex].title}}</text>
</view>
</view>
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
方式
</view>
<view class="uni-list-cell-right" @click="chooseMediaType">
<text class="click-t">{{(mediaTypes[mediaTypeIndex] as ChooseSource).title}}</text>
</view>
</view>
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
方式
</view>
<view class="uni-list-cell-right" @click="chooseMediaType">
<text class="click-t">{{(mediaTypes[mediaTypeIndex] as ChooseSource).title}}</text>
</view>
</view>
<view class="uni-list-cell cell-pd">
...
...
@@ -53,17 +53,17 @@
<text class="click-t">{{orientationTypes[orientationTypeIndex].title}}</text>
</view>
</view>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
相册模式
</view>
<view class="uni-list-cell-right" @click="albumModeChange">
<text class="click-t">{{albumModeTypes[albumModeTypeIndex].title}}</text>
</view>
</view>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
相册模式
</view>
<view class="uni-list-cell-right" @click="albumModeChange">
<text class="click-t">{{albumModeTypes[albumModeTypeIndex].title}}</text>
</view>
</view>
<!-- #endif -->
<view class="uni-list-cell cell-pd">
...
...
@@ -178,16 +178,16 @@
value: ['back'],
title: '后置摄像头',
}
];
const albumModeList : ChooseSource[] = [
{
value: ['custom'],
title: '自定义相册',
},
{
value: ['system'],
title: '系统相册',
}
];
const albumModeList : ChooseSource[] = [
{
value: ['custom'],
title: '自定义相册',
},
{
value: ['system'],
title: '系统相册',
}
];
export default {
data() {
...
...
@@ -198,7 +198,7 @@
mediaTypeIndex: 2,
sizeTypeIndex: 2,
cameraTypeIndex: 1,
orientationTypeIndex: 0,
orientationTypeIndex: 0,
albumModeTypeIndex: 0,
countIndex: 9,
maxDuration: 10,
...
...
@@ -206,7 +206,7 @@
mediaTypes: mediaTypeList as ChooseSource[],
sizeTypes: sizeTypeList as ChooseSource[],
cameraTypes: cameraTypeList as ChooseSource[],
orientationTypes: orientationTypeList as ChooseSource[],
orientationTypes: orientationTypeList as ChooseSource[],
albumModeTypes: albumModeList as ChooseSource[],
}
},
...
...
@@ -215,23 +215,23 @@
uni.showActionSheet({
itemList: ['拍摄', '相册', '拍摄或相册'],
success: (e) => {
this.sourceTypeIndex = e.tapIndex!
this.sourceTypeIndex = e.tapIndex
}
})
},
chooseSizeType() {
uni.showActionSheet({
itemList: ['压缩', '原图', '压缩或原图'],
success: (e) => {
this.sizeTypeIndex = e.tapIndex
}
})
},
chooseSizeType() {
uni.showActionSheet({
itemList: ['压缩', '原图', '压缩或原图'],
success: (e) => {
this.sizeTypeIndex = e.tapIndex!
}
})
},
chooseMediaType() {
uni.showActionSheet({
itemList: ['仅图片', '仅视频', '不限制'],
success: (e) => {
this.mediaTypeIndex = e.tapIndex
!
this.mediaTypeIndex = e.tapIndex
}
})
},
...
...
@@ -241,7 +241,7 @@
uni.showToast({
position: "bottom",
title: "图片数量应该不小于1不大于9"
})
})
this.countIndex = 9;
return
}
...
...
@@ -251,7 +251,7 @@
uni.showActionSheet({
itemList: ['竖屏', '横屏', '自动'],
success: (e) => {
this.orientationTypeIndex = e.tapIndex
!
this.orientationTypeIndex = e.tapIndex
}
})
},
...
...
@@ -259,23 +259,23 @@
uni.showActionSheet({
itemList: ['前置', '后置'],
success: (e) => {
this.cameraTypeIndex = e.tapIndex
!
this.cameraTypeIndex = e.tapIndex
}
})
},
onMaxDurationConfirm(value : number) {
this.maxDuration = value;
},
albumModeChange(){
uni.showActionSheet({
itemList: ['自定义相册','系统相册'],
success: (e) => {
this.albumModeTypeIndex = e.tapIndex
!
}
})
},
albumModeChange(){
uni.showActionSheet({
itemList: ['自定义相册','系统相册'],
success: (e) => {
this.albumModeTypeIndex = e.tapIndex
}
})
},
chooseMedia() {
if (this.mediaList.length >= this.countIndex) {
if (this.mediaList.length >= this.countIndex) {
const message = "已经有" + this.countIndex + "个了,请删除部分后重新选择";
uni.showToast({
position: "bottom",
...
...
@@ -293,9 +293,9 @@
maxDuration: this.maxDuration,
// #ifdef APP
pageOrientation: orientationTypeList[this.orientationTypeIndex].value[0],
// #endif
// #ifdef APP-ANDROID
albumMode: albumModeList[this.albumModeTypeIndex].value[0],
// #endif
// #ifdef APP-ANDROID
albumMode: albumModeList[this.albumModeTypeIndex].value[0],
// #endif
success: (res) => {
const tempFiles : ChooseMediaTempFile[] = res.tempFiles as ChooseMediaTempFile[];
...
...
@@ -311,18 +311,18 @@
}
})
},
previewMedia: function (index : number) {
const file : FileSource = this.mediaList[index];
if(file.fileType == "image"){
uni.previewImage({
current: 0,
urls: [file.filePath]
})
}else{
const url = "/pages/API/choose-media/fullscreen-video?url=" + file.filePath + "&cover=" + file.imagePath;
uni.navigateTo({
url:url,
})
previewMedia: function (index : number) {
const file : FileSource = this.mediaList[index];
if(file.fileType == "image"){
uni.previewImage({
current: 0,
urls: [file.filePath]
})
}else{
const url = "/pages/API/choose-media/fullscreen-video?url=" + file.filePath + "&cover=" + file.imagePath;
uni.navigateTo({
url:url,
})
}
},
...
...
@@ -377,4 +377,4 @@
.item_width {
width: 130px;
}
</style>
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录