From 0bec2cfee0b997c4a8147c97051fd0e71fdcb80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A3=8A?= <1633537611@qq.com> Date: Mon, 11 Nov 2024 16:54:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4chooseImage=E5=92=8CchooseVid?= =?UTF-8?q?eo=E7=9A=84=E7=A4=BA=E4=BE=8B=E6=94=AF=E6=8C=81useSystem?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/choose-image/choose-image.uvue | 23 ++++++++++++++--- pages/API/choose-video/choose-video.uvue | 33 ++++++++++++++++-------- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/pages/API/choose-image/choose-image.uvue b/pages/API/choose-image/choose-image.uvue index 6367ccf6..5b97b299 100644 --- a/pages/API/choose-image/choose-image.uvue +++ b/pages/API/choose-image/choose-image.uvue @@ -33,7 +33,7 @@ confirm-type="done" /> - + 屏幕方向 @@ -41,8 +41,18 @@ {{orientationType[orientationTypeIndex]}} - - + + + + + + 系统相册 + + + + + + 图像裁剪 @@ -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); }, diff --git a/pages/API/choose-video/choose-video.uvue b/pages/API/choose-video/choose-video.uvue index b813a290..e7c7187a 100644 --- a/pages/API/choose-video/choose-video.uvue +++ b/pages/API/choose-video/choose-video.uvue @@ -12,8 +12,10 @@ - + + + @@ -22,6 +24,11 @@ + + + + + @@ -35,19 +42,20 @@ 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[], - orientationType: "portrait", + sourceType: ["album", "camera"] as Source[], + orientationType: "portrait", orientationTypeItems: ["portrait", "landscape", "auto"], compressed: true, maxDuration: 60, camera: "back" as Camera, - videoInfo: "" + videoInfo: "", + useSystem: false } }, methods: { @@ -55,11 +63,11 @@ uni.chooseVideo({ sourceType: this.sourceType, // #ifdef APP - compressed: this.compressed, + compressed: this.compressed, pageOrientation: this.orientationType, // #endif - maxDuration: this.maxDuration, - + maxDuration: this.maxDuration, + useSystem:this.useSystem, camera: this.camera, success: (res) => { console.log("chooseVideo success", JSON.stringify(res)); @@ -74,9 +82,9 @@ }); } }); - }, - onOrientationTypeChange(value : number) { - this.orientationType = this.orientationTypeItems[value]; + }, + onOrientationTypeChange(value : number) { + this.orientationType = this.orientationTypeItems[value]; }, onSourceTypeChange(value : number) { this.sourceType = this.sourceTypeItems[value]; @@ -89,6 +97,9 @@ }, onCameraChange(value : number) { this.camera = this.cameraItems[value]; + }, + useSystemChange(value : boolean) { + this.useSystem = value } } } -- GitLab