修复部分禅道上的bug

This commit is contained in:
wangyu 2026-03-20 18:55:55 +08:00
parent 4af7f394cf
commit 40e0c9f3e1
12 changed files with 70 additions and 48 deletions

View File

@ -2,8 +2,8 @@
"app": {
"bundleName": "com.ylqh.hm_cube",
"vendor": "devcon",
"versionCode": 210,
"versionName": "2.1.0",
"versionCode": 240,
"versionName": "2.4.0",
"icon": "$media:layer_logo",
"label": "$string:app_name"
}

View File

@ -2,7 +2,13 @@ import { media } from "@kit.MediaKit";
import { fileIo } from "@kit.CoreFileKit";
import { avSessionManager } from "../manager/AVSessionManager";
import { MediaRecordEntity } from "../entity/MediaRecordEntity";
import { MediaManager } from "../manager/MediaManager";
import { MediaAction, MediaManager, MediaType } from "../manager/MediaManager";
import { ShareManager } from "../manager/ShareManager";
import { TipDialog } from "./TipDialog";
import { ToastUtils } from "../utils/ToastUtils";
import { LocalMediaManager } from "../manager/LocalMediaManager";
import { AppUtil } from "@pura/harmony-utils";
import { EventConstants } from "../common/EventConstants";
@CustomDialog
export struct AudioPlayerDialog {
@ -10,8 +16,7 @@ export struct AudioPlayerDialog {
@State index: number = 0
@State uri?: string = undefined
@State title?: string = undefined
@State media?: MediaRecordEntity = undefined
@State currentTime: number = 0
@State durationTime: number = 0
@State isPlaying: boolean = false
@ -39,11 +44,10 @@ export struct AudioPlayerDialog {
async initParams() {
this.mediaList = await MediaManager.getAudioList()
if (this.mediaList.length > this.index) {
this.uri = this.mediaList[this.index].uri
this.title = this.mediaList[this.index].name
if (this.uri) {
this.media = this.mediaList[this.index]
if (this.media.uri) {
// 打开相应的资源文件地址获取fd
let file = await fileIo.open(this.uri!!)
let file = await fileIo.open(this.media.uri)
this.avPlayer!!.url = 'fd://' + file.fd
}
}
@ -143,7 +147,7 @@ export struct AudioPlayerDialog {
})
.id('iv_close')
Text(this.title).fontColor($r('app.color.color_212226')).fontSize(16)
Text(this.media?.name).fontColor($r('app.color.color_212226')).fontSize(16)
.alignRules({
top: {anchor: 'iv_close', align: VerticalAlign.Bottom}
})
@ -181,11 +185,10 @@ export struct AudioPlayerDialog {
await this.avPlayer!!.pause()
await this.avPlayer!!.reset()
this.index--
this.uri = this.mediaList[this.index].uri
this.title = this.mediaList[this.index].name
if (this.uri) {
this.media = this.mediaList[this.index]
if (this.media.uri) {
// 打开相应的资源文件地址获取fd
let file = await fileIo.open(this.uri!!)
let file = await fileIo.open(this.media.uri)
this.avPlayer!!.url = 'fd://' + file.fd
}
}
@ -209,11 +212,10 @@ export struct AudioPlayerDialog {
await this.avPlayer!!.pause()
await this.avPlayer!!.reset()
this.index++
this.uri = this.mediaList[this.index].uri
this.title = this.mediaList[this.index].name
if (this.uri) {
this.media = this.mediaList[this.index]
if (this.media.uri) {
// 打开相应的资源文件地址获取fd
let file = await fileIo.open(this.uri!!)
let file = await fileIo.open(this.media.uri)
this.avPlayer!!.url = 'fd://' + file.fd
}
}
@ -240,6 +242,10 @@ export struct AudioPlayerDialog {
.borderColor($r('app.color.color_466afd'))
.backgroundColor(Color.Transparent)
.onClick(() => {
if (this.media?.uri) {
this.avPlayer!!.pause()
ShareManager.shareFile(this.media.uri)
}
})
Blank().width(9)
@ -254,7 +260,25 @@ export struct AudioPlayerDialog {
.layoutWeight(1)
.backgroundColor($r('app.color.color_466afd'))
.onClick(() => {
if (this.media) {
this.avPlayer!!.pause()
TipDialog.show(this.getUIContext(), {
title: '提示', content: '确定删除该音频?', callback: {
confirm: () => {
fileIo.unlink(this.media!!.uri)
.then(() => {
this.controller.close()
ToastUtils.show('删除成功')
LocalMediaManager.delete(this.media!!.name!!)
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.AUDIO, MediaAction.DELETE)
})
.catch(() => {
ToastUtils.show('删除失败, 请到文件管理中手动删除')
})
}
}
})
}
})
}
.alignRules({

View File

@ -37,7 +37,7 @@ export function mineMenuList(): ArrayList<MenuEntity> {
export function vipTipsList(): ArrayList<MenuEntity> {
let list = new ArrayList<MenuEntity>()
list.add(new MenuEntity($r("app.media.ic_vip_icon1"), "素材图库", ""))
list.add(new MenuEntity($r("app.media.ic_vip_icon2"), "视频去水印", ""))
list.add(new MenuEntity($r("app.media.ic_vip_icon2"), "视频打码", ""))
list.add(new MenuEntity($r("app.media.ic_vip_icon3"), "高清图片", ""))
list.add(new MenuEntity($r("app.media.ic_vip_icon4"), "视频加水印", ""))
list.add(new MenuEntity($r("app.media.ic_vip_icon5"), "视频提取", ""))

View File

@ -1,6 +0,0 @@
import { MaterialInfoEntity } from "./MaterialInfoEntity"
export class WxVideoEntity {
items?: Array<MaterialInfoEntity>
playback: boolean = false
}

View File

@ -341,12 +341,12 @@ class ApiService {
*/
getDownloadHistoryList(page: string, startTime: string, endTime: string): Promise<HttpResult> {
const params: Record<string, string> = {
'status': '2',
'is_deleted': '0',
'page': page,
'size': '20',
'status': '2',
'start_time': startTime,
'end_time': endTime
'end_time': endTime,
'is_delete': '0'
}
return AxiosRequest.get<HttpResult>(Api.DOWNLOAD_HISTORY_LIST, params)
}
@ -357,12 +357,12 @@ class ApiService {
*/
deleteDownloadHistory(startTime: string, endTime: string): Promise<HttpResult> {
const params: Record<string, string> = {
'status': '2',
'is_deleted': '0',
'page': '1',
'size': '9999',
'status': '2',
'start_time': startTime,
'end_time': endTime
'end_time': endTime,
'is_delete': '0'
}
return AxiosRequest.delete<HttpResult>(Api.DOWNLOAD_HISTORY_LIST, params)
}

View File

@ -164,6 +164,7 @@ struct LoginPage {
}
}
}),
width: '80%',
cornerRadius: 20,
maskColor: '#CC000000',
levelMode: LevelMode.EMBEDDED,

View File

@ -444,7 +444,11 @@ struct AddWatermarkPage {
.backgroundColor($r('app.color.color_466afd'))
.onClick(() => {
if (this.uri) {
if (this.showWatermark) {
this.addWatermark()
} else {
ToastUtils.show('请添加水印')
}
} else {
ToastUtils.show('请上传视频')
}

View File

@ -203,7 +203,7 @@ struct RemoveWatermarkPage {
build() {
Column() {
TitleBar({ title: '视频去水印' })
TitleBar({ title: '视频打码' })
Stack() {
Stack() {

View File

@ -16,7 +16,6 @@ import { TitleBar } from '../../../../view/TitleBar';
import { WxVideoViewModel } from '../../../../viewModel/WxVideoViewModel';
import { WxVideoMaterialPage } from './material/WxVideoMaterialPage';
import { CommonModifier, LevelMode, router } from '@kit.ArkUI';
import { WxVideoEntity } from '../../../../entity/WxVideoEntity';
import { WxImageMaterialPage } from './material/WxImageMaterialPage';
import { OnWXResp, WXApi, WXEventHandler } from '../../../../utils/wechat/WXApiEventHandlerImpl';
import * as WxOpenSdk from '@tencent/wechat_open_sdk';
@ -72,11 +71,11 @@ struct WxVideoPage {
}
}
@Monitor('viewModel.wxVideo')
@Monitor('viewModel.wxVideoList')
onMaterialInfoChange(monitor: IMonitor) {
const entity = monitor.value()?.now as WxVideoEntity
this.createVideoList(entity.items);
this.createImageList(entity.items);
const list = monitor.value()?.now as Array<MaterialInfoEntity>
this.createVideoList(list);
this.createImageList(list);
if (this.videoList.length > 0) {
this.tabController.changeIndex(0);
this.currentIndex = 0

View File

@ -40,9 +40,9 @@ struct DownloadHistory {
let nowDate = new Date(DateUtil.getNowYear(), DateUtil.getNowMonth(), 1)
let lastDate = new Date(DateUtil.getNowYear(), DateUtil.getNowMonth() - 1, 1)
if (this.currentIndex === 0) {
return Math.trunc(nowDate.getTime() / 1000)
return Math.trunc(nowDate.getTime() / 1000) - 1
} else {
return Math.trunc(lastDate.getTime() / 1000)
return Math.trunc(lastDate.getTime() / 1000) - 1
}
}

View File

@ -9,7 +9,7 @@ import { BaseViewModel } from './BaseViewModel';
export class TakeMaterialViewModel extends BaseViewModel {
@Trace materialInfo?: MaterialInfoEntity;
@Trace analysisInfo?: MaterialInfoEntity;
@Trace permissionInfo?: VipAuthEntity;
@Trace authInfo?: VipAuthEntity;
@Trace errorCode: number = 0;
private intervalId = 0
@ -74,7 +74,7 @@ export class TakeMaterialViewModel extends BaseViewModel {
try {
const result = await apiService.checkPermission('download');
if (result.isSuccess()) {
this.permissionInfo = plainToInstance(VipAuthEntity, result.data);
this.authInfo = plainToInstance(VipAuthEntity, result.data);
} else {
this.errorCode = result.code
ToastUtils.show(result.message, true);

View File

@ -1,6 +1,6 @@
import { plainToInstance } from 'class-transformer';
import { MaterialInfoEntity } from '../entity/MaterialInfoEntity';
import { VipAuthEntity } from '../entity/VipAuthEntity';
import { WxVideoEntity } from '../entity/WxVideoEntity';
import { WxVideoServiceEntity } from '../entity/WxVideoServiceEntity';
import { apiService } from '../net/ApiService';
import { ToastUtils } from '../utils/ToastUtils';
@ -8,9 +8,9 @@ import { BaseViewModel } from './BaseViewModel';
@ObservedV2
export class WxVideoViewModel extends BaseViewModel {
@Trace wxVideo?: WxVideoEntity;
@Trace wxVideoList?: Array<MaterialInfoEntity>;
@Trace deleteVideo?: object;
@Trace permissionInfo?: VipAuthEntity;
@Trace authInfo?: VipAuthEntity;
@Trace errorCode: number = 0;
@Trace wxService?: WxVideoServiceEntity
@Trace wxUserinfo?: object
@ -20,7 +20,7 @@ export class WxVideoViewModel extends BaseViewModel {
try {
const result = await apiService.wxVideoList()
if (result.isSuccess()) {
this.wxVideo = plainToInstance(WxVideoEntity, result.data);
this.wxVideoList = plainToInstance(MaterialInfoEntity, result.data as Array<Object>);
} else {
this.errorCode = result.code
ToastUtils.show(result.message, true)
@ -63,7 +63,7 @@ export class WxVideoViewModel extends BaseViewModel {
try {
const result = await apiService.checkPermission('download');
if (result.isSuccess()) {
this.permissionInfo = plainToInstance(VipAuthEntity, result.data);
this.authInfo = plainToInstance(VipAuthEntity, result.data);
} else {
this.errorCode = result.code
ToastUtils.show(result.message, true);