提交 4fbe8584 编写于 作者: 张磊

调整chooseImage和chooseVideo示例

上级 929dbc62
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
<!-- #ifdef APP-ANDROID --> <!-- #ifdef APP-ANDROID -->
<view class="uni-list-cell cell-pd"> <view class="uni-list-cell cell-pd">
<view class="uni-list-cell-left uni-label"> <view class="uni-list-cell-left uni-label">
系统相册 相册模式
</view> </view>
<view class="uni-list-cell-right"> <view class="uni-list-cell-right" @click="albumModeChange">
<switch :checked="useSystemChecked" @change="useSystemChange"></switch> <text class="click-t">{{albumModeType[albumModeTypeIndex]}}</text>
</view> </view>
</view> </view>
<!-- #endif --> <!-- #endif -->
...@@ -137,6 +137,10 @@ ...@@ -137,6 +137,10 @@
'landscape', 'landscape',
'auto' 'auto'
] ]
var albumModeTypeArray = [
"custom",
"system"
]
export default { export default {
data() { data() {
return { return {
...@@ -148,14 +152,15 @@ ...@@ -148,14 +152,15 @@
sizeType: ['压缩', '原图', '压缩或原图'], sizeType: ['压缩', '原图', '压缩或原图'],
orientationTypeIndex: 0, orientationTypeIndex: 0,
orientationType: ['竖屏', '横屏', '自动'], orientationType: ['竖屏', '横屏', '自动'],
albumModeTypeIndex:0,
albumModeType:["自定义相册","系统相册"],
countIndex: 8, countIndex: 8,
count: [1, 2, 3, 4, 5, 6, 7, 8, 9], count: [1, 2, 3, 4, 5, 6, 7, 8, 9],
isCrop: false, isCrop: false,
cropPercent: 80, cropPercent: 80,
cropWidth: 100, cropWidth: 100,
cropHeight: 100, cropHeight: 100,
cropResize: false, cropResize: false
useSystemChecked:false
} }
}, },
onUnload() { onUnload() {
...@@ -202,8 +207,13 @@ ...@@ -202,8 +207,13 @@
}) })
} }
}, },
useSystemChange(e : UniSwitchChangeEvent){ albumModeChange(){
this.useSystemChecked = e.detail.value uni.showActionSheet({
itemList: this.albumModeType,
success: (e) => {
this.albumModeTypeIndex = e.tapIndex!
}
})
}, },
cropResizeChange(e : UniSwitchChangeEvent) { cropResizeChange(e : UniSwitchChangeEvent) {
this.cropResize = e.detail.value this.cropResize = e.detail.value
...@@ -264,7 +274,7 @@ ...@@ -264,7 +274,7 @@
crop: this.isCrop ? { "quality": this.cropPercent, "width": this.cropWidth, "height": this.cropHeight, "resize": this.cropResize } as ChooseImageCropOptions : null, 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], pageOrientation: orientationTypeArray[this.orientationTypeIndex],
useSystem:this.useSystemChecked, albumMode: albumModeTypeArray[this.albumModeTypeIndex],
success: (res) => { success: (res) => {
this.imageList = this.imageList.concat(res.tempFilePaths); this.imageList = this.imageList.concat(res.tempFilePaths);
}, },
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
<enum-data title="屏幕方向" :items="orientationTypeItemTypes" @change="onOrientationTypeChange"></enum-data> <enum-data title="屏幕方向" :items="orientationTypeItemTypes" @change="onOrientationTypeChange"></enum-data>
<!-- #endif --> <!-- #endif -->
<enum-data title="摄像头" :items="cameraItemTypes" @change="onCameraChange"></enum-data> <enum-data title="摄像头" :items="cameraItemTypes" @change="onCameraChange"></enum-data>
<!-- #ifdef APP-ANDROID -->
<enum-data title="相册模式" :items="albumModeTypes" @change="onAlbumModeChange"></enum-data>
<!-- #endif -->
</view> </view>
<input-data title="最长拍摄时间,单位秒" defaultValue="60" type="number" @confirm="onMaxDurationConfirm"></input-data> <input-data title="最长拍摄时间,单位秒" defaultValue="60" type="number" @confirm="onMaxDurationConfirm"></input-data>
<!-- #ifdef APP --> <!-- #ifdef APP -->
...@@ -24,11 +27,6 @@ ...@@ -24,11 +27,6 @@
<boolean-data title="是否压缩" :defaultValue="true" @change="onCompressedChange"></boolean-data> <boolean-data title="是否压缩" :defaultValue="true" @change="onCompressedChange"></boolean-data>
</view> </view>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-ANDROID -->
<view class="uni-padding-wrap">
<boolean-data title="使用系统相册" :defaultValue="false" @change="useSystemChange"></boolean-data>
</view>
<!-- #endif -->
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
<!-- #endif --> <!-- #endif -->
...@@ -47,6 +45,8 @@ ...@@ -47,6 +45,8 @@
sourceTypeItemTypes: [{ "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[][], sourceTypeItems: [["album"], ["camera"], ["album", "camera"]] as Source[][],
cameraItemTypes: [{ "value": 0, "name": "后置摄像头" }, { "value": 1, "name": "前置摄像头" }] as ItemType[], cameraItemTypes: [{ "value": 0, "name": "后置摄像头" }, { "value": 1, "name": "前置摄像头" }] as ItemType[],
albumModeTypes: [{ "value": 0, "name": "自定义视频选择器" }, { "value": 1, "name": "系统视频选择器" }] as ItemType[],
albumModeTypeItems: ["custom", "system"],
cameraItems: ["back", "front"] as Camera[], cameraItems: ["back", "front"] as Camera[],
sourceType: ["album", "camera"] as Source[], sourceType: ["album", "camera"] as Source[],
orientationType: "portrait", orientationType: "portrait",
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
maxDuration: 60, maxDuration: 60,
camera: "back" as Camera, camera: "back" as Camera,
videoInfo: "", videoInfo: "",
useSystem: false albumMode: "custom"
} }
}, },
methods: { methods: {
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
pageOrientation: this.orientationType, pageOrientation: this.orientationType,
// #endif // #endif
maxDuration: this.maxDuration, maxDuration: this.maxDuration,
useSystem:this.useSystem, albumMode: this.albumMode,
camera: this.camera, camera: this.camera,
success: (res) => { success: (res) => {
console.log("chooseVideo success", JSON.stringify(res)); console.log("chooseVideo success", JSON.stringify(res));
...@@ -98,8 +98,8 @@ ...@@ -98,8 +98,8 @@
onCameraChange(value : number) { onCameraChange(value : number) {
this.camera = this.cameraItems[value]; this.camera = this.cameraItems[value];
}, },
useSystemChange(value : boolean) { onAlbumModeChange(value : number) {
this.useSystem = value this.albumMode = this.albumModeTypeItems[value]
} }
} }
} }
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
this.btnDisable = false this.btnDisable = false
this.isAdLoadSuccess = true this.isAdLoadSuccess = true
}) })
this.interstitialAd!.onClose((e) => { this.interstitialAd!.onClose((_) => {
this.isAdLoadSuccess = false this.isAdLoadSuccess = false
this.loadAd() this.loadAd()
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册