提交 0bec2cfe 编写于 作者: 张磊

调整chooseImage和chooseVideo的示例支持useSystem。

上级 5296309a
......@@ -33,7 +33,7 @@
confirm-type="done" />
</view>
</view>
<!-- #ifdef APP -->
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
屏幕方向
......@@ -42,7 +42,17 @@
<text class="click-t">{{orientationType[orientationTypeIndex]}}</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">
<switch :checked="useSystemChecked" @change="useSystemChange"></switch>
</view>
</view>
<!-- #endif -->
<view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label">
图像裁剪
......@@ -144,7 +154,8 @@
cropPercent: 80,
cropWidth: 100,
cropHeight: 100,
cropResize: false
cropResize: false,
useSystemChecked:false
}
},
onUnload() {
......@@ -191,6 +202,9 @@
})
}
},
useSystemChange(e : UniSwitchChangeEvent){
this.useSystemChecked = e.detail.value
},
cropResizeChange(e : UniSwitchChangeEvent) {
this.cropResize = e.detail.value
},
......@@ -250,6 +264,7 @@
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],
pageOrientation: orientationTypeArray[this.orientationTypeIndex],
useSystem:this.useSystemChecked,
success: (res) => {
this.imageList = this.imageList.concat(res.tempFilePaths);
},
......
......@@ -13,7 +13,9 @@
<button type="primary" @click="chooseVideo">选取视频</button>
</view>
<enum-data title="视频来源" :items="sourceTypeItemTypes" @change="onSourceTypeChange"></enum-data>
<!-- #ifdef APP -->
<enum-data title="屏幕方向" :items="orientationTypeItemTypes" @change="onOrientationTypeChange"></enum-data>
<!-- #endif -->
<enum-data title="摄像头" :items="cameraItemTypes" @change="onCameraChange"></enum-data>
</view>
<input-data title="最长拍摄时间,单位秒" defaultValue="60" type="number" @confirm="onMaxDurationConfirm"></input-data>
......@@ -22,6 +24,11 @@
<boolean-data title="是否压缩" :defaultValue="true" @change="onCompressedChange"></boolean-data>
</view>
<!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<view class="uni-padding-wrap">
<boolean-data title="使用系统相册" :defaultValue="false" @change="useSystemChange"></boolean-data>
</view>
<!-- #endif -->
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
......@@ -47,7 +54,8 @@
compressed: true,
maxDuration: 60,
camera: "back" as Camera,
videoInfo: ""
videoInfo: "",
useSystem: false
}
},
methods: {
......@@ -59,7 +67,7 @@
pageOrientation: this.orientationType,
// #endif
maxDuration: this.maxDuration,
useSystem:this.useSystem,
camera: this.camera,
success: (res) => {
console.log("chooseVideo success", JSON.stringify(res));
......@@ -89,6 +97,9 @@
},
onCameraChange(value : number) {
this.camera = this.cameraItems[value];
},
useSystemChange(value : boolean) {
this.useSystem = value
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册