From 4fbe8584cc1bfe43f7782d1a863081fb0394a881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A3=8A?= <1633537611@qq.com> Date: Thu, 14 Nov 2024 17:53:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4chooseImage=E5=92=8CchooseVid?= =?UTF-8?q?eo=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/choose-image/choose-image.uvue | 26 +++++++++++++------ pages/API/choose-video/choose-video.uvue | 18 ++++++------- .../create-interstitial-ad.uvue | 2 +- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/pages/API/choose-image/choose-image.uvue b/pages/API/choose-image/choose-image.uvue index 5b97b299..9cce448b 100644 --- a/pages/API/choose-image/choose-image.uvue +++ b/pages/API/choose-image/choose-image.uvue @@ -46,10 +46,10 @@ - 系统相册 + 相册模式 - - + + {{albumModeType[albumModeTypeIndex]}} @@ -137,6 +137,10 @@ 'landscape', 'auto' ] + var albumModeTypeArray = [ + "custom", + "system" + ] export default { data() { return { @@ -148,14 +152,15 @@ sizeType: ['压缩', '原图', '压缩或原图'], orientationTypeIndex: 0, orientationType: ['竖屏', '横屏', '自动'], + albumModeTypeIndex:0, + albumModeType:["自定义相册","系统相册"], countIndex: 8, count: [1, 2, 3, 4, 5, 6, 7, 8, 9], isCrop: false, cropPercent: 80, cropWidth: 100, cropHeight: 100, - cropResize: false, - useSystemChecked:false + cropResize: false } }, onUnload() { @@ -202,8 +207,13 @@ }) } }, - useSystemChange(e : UniSwitchChangeEvent){ - this.useSystemChecked = e.detail.value + albumModeChange(){ + uni.showActionSheet({ + itemList: this.albumModeType, + success: (e) => { + this.albumModeTypeIndex = e.tapIndex! + } + }) }, cropResizeChange(e : UniSwitchChangeEvent) { this.cropResize = e.detail.value @@ -264,7 +274,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, + albumMode: albumModeTypeArray[this.albumModeTypeIndex], success: (res) => { this.imageList = this.imageList.concat(res.tempFilePaths); }, diff --git a/pages/API/choose-video/choose-video.uvue b/pages/API/choose-video/choose-video.uvue index e7c7187a..0f72aa07 100644 --- a/pages/API/choose-video/choose-video.uvue +++ b/pages/API/choose-video/choose-video.uvue @@ -17,6 +17,9 @@ + + + @@ -24,11 +27,6 @@ - - - - - @@ -47,6 +45,8 @@ 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[], + albumModeTypes: [{ "value": 0, "name": "自定义视频选择器" }, { "value": 1, "name": "系统视频选择器" }] as ItemType[], + albumModeTypeItems: ["custom", "system"], cameraItems: ["back", "front"] as Camera[], sourceType: ["album", "camera"] as Source[], orientationType: "portrait", @@ -55,7 +55,7 @@ maxDuration: 60, camera: "back" as Camera, videoInfo: "", - useSystem: false + albumMode: "custom" } }, methods: { @@ -67,7 +67,7 @@ pageOrientation: this.orientationType, // #endif maxDuration: this.maxDuration, - useSystem:this.useSystem, + albumMode: this.albumMode, camera: this.camera, success: (res) => { console.log("chooseVideo success", JSON.stringify(res)); @@ -98,8 +98,8 @@ onCameraChange(value : number) { this.camera = this.cameraItems[value]; }, - useSystemChange(value : boolean) { - this.useSystem = value + onAlbumModeChange(value : number) { + this.albumMode = this.albumModeTypeItems[value] } } } diff --git a/pages/API/create-interstitial-ad/create-interstitial-ad.uvue b/pages/API/create-interstitial-ad/create-interstitial-ad.uvue index e0e1cbd7..9d8aa0ee 100644 --- a/pages/API/create-interstitial-ad/create-interstitial-ad.uvue +++ b/pages/API/create-interstitial-ad/create-interstitial-ad.uvue @@ -39,7 +39,7 @@ this.btnDisable = false this.isAdLoadSuccess = true }) - this.interstitialAd!.onClose((e) => { + this.interstitialAd!.onClose((_) => { this.isAdLoadSuccess = false this.loadAd() }) -- GitLab