提交 ac8bcf4a 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

update chooseImage、chooseVideo添加pageOrientation测试例

上级 fdafa697
......@@ -32,7 +32,17 @@
<input class="click-t" :value="countIndex+1" type="number" :maxlength="1" @confirm="chooseImageCount"
confirm-type="done" />
</view>
</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="chooseOrientationType">
<text class="click-t">{{orientationType[orientationTypeIndex]}}</text>
</view>
</view>
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
图像裁剪
......@@ -111,6 +121,11 @@
['compressed'],
['original'],
['compressed', 'original']
]
var orientationTypeArray = [
'portrait',
'landscape',
'auto'
]
export default {
data() {
......@@ -120,7 +135,9 @@
sourceTypeIndex: 2,
sourceType: ['拍照', '相册', '拍照或相册'],
sizeTypeIndex: 2,
sizeType: ['压缩', '原图', '压缩或原图'],
sizeType: ['压缩', '原图', '压缩或原图'],
orientationTypeIndex: 0,
orientationType: ['竖屏', '横屏', '自动'],
countIndex: 8,
count: [1, 2, 3, 4, 5, 6, 7, 8, 9],
isCrop: false,
......@@ -136,7 +153,9 @@
this.sourceType = ['拍照', '相册', '拍照或相册']
this.sizeTypeIndex = 2
this.sizeType = ['压缩', '原图', '压缩或原图']
this.countIndex = 8
this.countIndex = 8
this.orientationTypeIndex = 0
this.orientationType = ['竖屏', '横屏', '自动']
},
methods: {
cropHeightConfim(e : InputConfirmEvent) {
......@@ -196,6 +215,14 @@
this.sizeTypeIndex = e.tapIndex!
}
})
},
chooseOrientationType(){
uni.showActionSheet({
itemList: ['竖屏', '横屏', '自动'],
success: (e) => {
this.orientationTypeIndex = e.tapIndex!
}
})
},
chooseImageCount(event : InputConfirmEvent) {
let count = parseInt(event.detail.value) - 1
......@@ -221,7 +248,8 @@
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],
pageOrientation: orientationTypeArray[this.orientationTypeIndex],
success: (res) => {
this.imageList = this.imageList.concat(res.tempFilePaths);
},
......
......@@ -12,7 +12,8 @@
<view class="uni-btn-v">
<button type="primary" @click="chooseVideo">选取视频</button>
</view>
<enum-data title="视频来源" :items="sourceTypeItemTypes" @change="onSourceTypeChange"></enum-data>
<enum-data title="视频来源" :items="sourceTypeItemTypes" @change="onSourceTypeChange"></enum-data>
<enum-data title="屏幕方向" :items="orientationTypeItemTypes" @change="onOrientationTypeChange"></enum-data>
<enum-data title="摄像头" :items="cameraItemTypes" @change="onCameraChange"></enum-data>
</view>
<input-data title="最长拍摄时间,单位秒" defaultValue="60" type="number" @confirm="onMaxDurationConfirm"></input-data>
......@@ -34,12 +35,15 @@
data() {
return {
title: "chooseVideo",
src: "",
src: "",
orientationTypeItemTypes: [{ "value": 0, "name": "竖屏" }, { "value": 1, "name": "横屏" }, { "value": 2, "name": "自动" }] as ItemType[],
sourceTypeItemTypes: [{ "value": 0, "name": "从相册中选择视频" }, { "value": 1, "name": "拍摄视频" }, { "value": 2, "name": "从相册中选择视频或拍摄视频" }] as ItemType[],
sourceTypeItems: [["album"], ["camera"], ["album", "camera"]] as Source[][],
cameraItemTypes: [{ "value": 0, "name": "后置摄像头" }, { "value": 1, "name": "前置摄像头" }] as ItemType[],
cameraItems: ["back", "front"] as Camera[],
sourceType: ["album", "camera"] as Source[],
sourceType: ["album", "camera"] as Source[],
orientationType: "portrait",
orientationTypeItems: ["portrait", "landscape", "auto"],
compressed: true,
maxDuration: 60,
camera: "back" as Camera,
......@@ -51,9 +55,11 @@
uni.chooseVideo({
sourceType: this.sourceType,
// #ifdef APP
compressed: this.compressed,
compressed: this.compressed,
pageOrientation: this.orientationType,
// #endif
maxDuration: this.maxDuration,
maxDuration: this.maxDuration,
camera: this.camera,
success: (res) => {
console.log("chooseVideo success", JSON.stringify(res));
......@@ -68,6 +74,9 @@
});
}
});
},
onOrientationTypeChange(value : number) {
this.orientationType = this.orientationTypeItems[value];
},
onSourceTypeChange(value : number) {
this.sourceType = this.sourceTypeItems[value];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册