添加我的页面

This commit is contained in:
wangyu 2026-03-06 16:17:30 +08:00
parent 3936d39f7a
commit 43196aa8df
68 changed files with 832 additions and 758 deletions

View File

@ -18,7 +18,7 @@
}, },
{ {
"name": "wx_video_course", "name": "wx_video_course",
"value": "1、点击【添加助手】自动跳转进入微信创建快存助手;\n2、进入微信视频号选择视频分享至-客服消息-素材助手;\n3、返回【素材魔方APP】微信视频号页面下拉刷新即可下载微信号视频" "value": "1、点击【添加助手】自动跳转进入微信创建素材助手;\n2、进入微信视频号选择视频分享至-客服消息-素材助手;\n3、返回【素材魔方APP】微信视频号页面下拉刷新即可下载微信号视频"
}, },
{ {
"name": "wx_playback_course", "name": "wx_playback_course",

View File

@ -18,6 +18,7 @@ function defaultBuilder(option: TipDialogOption) {
Text(option.title) Text(option.title)
.fontColor($r('app.color.color_212226')) .fontColor($r('app.color.color_212226'))
.fontSize(22) .fontSize(22)
.fontFamily('ysbth')
.fontWeight(FontWeight.Medium) .fontWeight(FontWeight.Medium)
.visibility(StrUtil.isEmpty(option.title) ? Visibility.Hidden : Visibility.Visible) .visibility(StrUtil.isEmpty(option.title) ? Visibility.Hidden : Visibility.Visible)
Text(option.content) Text(option.content)

View File

@ -12,58 +12,60 @@ export declare class TipDialogOption {
@Builder @Builder
function defaultBuilder(option: TipDialogOption) { function defaultBuilder(option: TipDialogOption) {
Column() { Stack({alignContent: Alignment.Top}) {
Text(option.title) Image($r('app.media.ic_tip_dialog_top_bg')).width('100%').aspectRatio(2.72)
.fontColor($r('app.color.color_90ffffff'))
.fontSize(18) Column() {
.fontWeight(FontWeight.Medium) Text(option.title)
.visibility(StrUtil.isEmpty(option.title) ? Visibility.Hidden : Visibility.Visible) .fontColor($r('app.color.color_212226'))
Text(option.content) .fontSize(22)
.textAlign(TextAlign.Center) .fontFamily('ysbth')
.fontColor(StrUtil.isNotEmpty(option.title) ? $r('app.color.color_80ffffff') : $r('app.color.color_90ffffff')) .fontWeight(FontWeight.Medium)
.fontSize(StrUtil.isNotEmpty(option.title) ? 14 : 18) .visibility(StrUtil.isEmpty(option.title) ? Visibility.Hidden : Visibility.Visible)
.fontWeight(StrUtil.isNotEmpty(option.title) ? FontWeight.Normal : FontWeight.Medium) Text(option.content)
.textOverflow({ overflow: TextOverflow.Ellipsis }) .textAlign(TextAlign.Center)
.ellipsisMode(EllipsisMode.END) .fontColor(StrUtil.isNotEmpty(option.title) ? $r('app.color.color_727686') : $r('app.color.color_212226'))
.margin({ left: 27, top: 12, right: 27 }) .fontSize(StrUtil.isNotEmpty(option.title) ? 14 : 22)
.maxLines(5) .fontWeight(StrUtil.isNotEmpty(option.title) ? FontWeight.Normal : FontWeight.Medium)
Row() { .textOverflow({ overflow: TextOverflow.Ellipsis })
Button(StrUtil.isNotEmpty(option.leftText) ? option.leftText : '取消', { type: ButtonType.Capsule, stateEffect: false }) .ellipsisMode(EllipsisMode.END)
.fontColor($r('app.color.color_50ffffff')) .margin({ left: 27, top: 12, right: 27 })
.fontSize(14) .maxLines(5)
.backgroundColor($r('app.color.color_333333')) Row(){
.layoutWeight(1) Button(StrUtil.isNotEmpty(option.leftText) ? option.leftText : '取消', { type: ButtonType.Capsule, stateEffect: true })
.height(40) .width(110)
.onClick(() => { .height(40)
TipDialog.dismiss(); .fontColor($r('app.color.color_80859B'))
if (option.callback?.cancel) { .fontSize(16)
option.callback?.cancel(); .backgroundColor($r("app.color.color_f1f2f6"))
} .margin({left: 20})
}) .onClick(() => {
Blank().width(12) TipDialog.dismiss();
Button(StrUtil.isNotEmpty(option.rightText) ? option.rightText : '确定', { type: ButtonType.Capsule, stateEffect: false }) if (option.callback?.cancel) {
.fontColor(Color.White) option.callback?.cancel();
.fontSize(14) }
.backgroundColor(Color.Transparent) })
.linearGradient({ Blank().layoutWeight(1)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]], Button(StrUtil.isNotEmpty(option.rightText) ? option.rightText : '确定', { type: ButtonType.Capsule, stateEffect: true })
direction: GradientDirection.Right .width(110)
}) .height(40)
.layoutWeight(1) .fontColor(Color.White)
.height(40) .fontSize(16)
.onClick(() => { .backgroundColor($r("app.color.color_466afd"))
TipDialog.dismiss(); .margin({right: 20})
if (option.callback?.confirm) { .onClick(() => {
option.callback?.confirm(); TipDialog.dismiss();
} if (option.callback?.confirm) {
}) option.callback?.confirm();
}
})
}
.margin({top: 20})
} }
.padding({ left: 14, right: 14 }) .padding({ top: 20, bottom: 20 })
.margin({ top: 20 })
} }
.padding({ top: 22, bottom: 22 })
.borderRadius(20) .borderRadius(20)
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.width('80%') .width('80%')
} }

View File

@ -30,19 +30,22 @@ export class ConfigEntity {
wxVideoEnable: boolean = true; //视频号开关 wxVideoEnable: boolean = true; //视频号开关
@Expose({ name: 'client.wechat.video.playback.share.enable' }) @Expose({ name: 'client.wechat.video.playback.share.enable' })
playbackEnable: boolean = true; //直播回放开关 playbackEnable: boolean = true; //
@Expose({ name: 'client.course.wechat.video' }) @Expose({ name: 'client.course.urlplay' })
takeMaterialCourse: string = ""; //链接提取教程链接
@Expose({ name: 'client.course.sphplay' })
wxVideoCourse: string = ""; //视频号教程 wxVideoCourse: string = ""; //视频号教程
@Expose({ name: 'client.course.playback' }) @Expose({ name: 'client.course.zbhfplay' })
wxPlaybackCourse: string = ""; //直播回放教程 wxPlaybackCourse: string = ""; //直播回放教程
@Expose({ name: 'client.playback.join.type' }) @Expose({ name: 'client.playback.join.type' })
wxPlaybackJoinType: string = ""; //直播加群方式 wxPlaybackJoinType: string = ""; //直播加群方式
@Type(() => WxVideoConfigEntity) @Type(() => WxVideoConfigEntity)
@Expose({ name: 'client.mp.share.config.kcsp' }) @Expose({ name: 'client.mp.share.config.scmf' })
wxVideoConfig: WxVideoConfigEntity = new WxVideoConfigEntity() //直播回放小程序跳转配置 wxVideoConfig: WxVideoConfigEntity = new WxVideoConfigEntity() //直播回放小程序跳转配置
@Expose({ name: 'client.hmos.video.service.enable' }) //视频号助手是否可用 @Expose({ name: 'client.hmos.video.service.enable' }) //视频号助手是否可用

View File

@ -1,23 +0,0 @@
import { ArrayList } from "@kit.ArkTS";
export class HomeMenuEntity {
icon: Resource | null = null;
title: string = "";
alias: string = "";
constructor(icon: Resource, title: string, alias: string) {
this.icon = icon;
this.title = title;
this.alias = alias;
}
}
export function homeMenuList(): ArrayList<HomeMenuEntity> {
let list = new ArrayList<HomeMenuEntity>()
list.add(new HomeMenuEntity($r('app.media.ic_home_icon6'), "视频转音频", "videoToAudio"))
list.add(new HomeMenuEntity($r('app.media.ic_home_icon8'), "视频加水印", "addWatermark"))
list.add(new HomeMenuEntity($r('app.media.ic_home_icon5'), "视频转文字", "videoToText"))
list.add(new HomeMenuEntity($r('app.media.ic_home_icon9'), "长图拼接", "longImageMerge"))
list.add(new HomeMenuEntity($r('app.media.ic_home_icon10'), "更多功能", "moreTools"))
return list;
}

View File

@ -0,0 +1,32 @@
import { ArrayList } from "@kit.ArkTS";
export class MenuEntity {
icon: Resource | null = null;
title: string = "";
alias: string = "";
constructor(icon: Resource, title: string, alias: string) {
this.icon = icon;
this.title = title;
this.alias = alias;
}
}
export function homeMenuList(): ArrayList<MenuEntity> {
let list = new ArrayList<MenuEntity>()
list.add(new MenuEntity($r('app.media.ic_home_icon6'), "视频转音频", "videoToAudio"))
list.add(new MenuEntity($r('app.media.ic_home_icon8'), "视频加水印", "addWatermark"))
list.add(new MenuEntity($r('app.media.ic_home_icon5'), "视频转文字", "videoToText"))
list.add(new MenuEntity($r('app.media.ic_home_icon9'), "长图拼接", "longImageMerge"))
list.add(new MenuEntity($r('app.media.ic_home_icon10'), "更多功能", "moreTools"))
return list;
}
export function mineMenuList(): ArrayList<MenuEntity> {
let list = new ArrayList<MenuEntity>()
list.add(new MenuEntity($r('app.media.ic_mine_icon1'), "提取记录", "history"))
list.add(new MenuEntity($r('app.media.ic_mine_icon2'), "次数兑换", "diamond"))
list.add(new MenuEntity($r('app.media.ic_mine_icon3'), "意见反馈", "feedback"))
list.add(new MenuEntity($r('app.media.ic_mine_icon4'), "联系客服", "service"))
return list;
}

View File

@ -0,0 +1,5 @@
export class WxVideoServiceEntity {
corp_id: string = ""
link: string = ""
}

View File

@ -69,6 +69,7 @@ class UserConfigManager {
this.saveWxVideoEnable(config.config.wxVideoEnable); this.saveWxVideoEnable(config.config.wxVideoEnable);
this.savePlaybackEnable(config.config.playbackEnable); this.savePlaybackEnable(config.config.playbackEnable);
this.saveLoginType(config.config.loginType); this.saveLoginType(config.config.loginType);
this.saveTakeMaterialCourse(config.config.takeMaterialCourse);
this.saveWxVideoCourse(config.config.wxVideoCourse); this.saveWxVideoCourse(config.config.wxVideoCourse);
this.savePlaybackCourse(config.config.wxPlaybackCourse); this.savePlaybackCourse(config.config.wxPlaybackCourse);
this.saveWxPlaybackJoinType(config.config.wxPlaybackJoinType); this.saveWxPlaybackJoinType(config.config.wxPlaybackJoinType);
@ -242,6 +243,21 @@ class UserConfigManager {
return new Array('phone'); return new Array('phone');
} }
/**
* 链接提取教程链接
* @param url
*/
saveTakeMaterialCourse(url?: string) {
if (StrUtil.isNotEmpty(url)) {
PrefUtils.put('take_material_course', url!!);
}
}
getTakeMaterialCourse(): string {
return PrefUtils.getString('take_material_course');
}
/** /**
* 视频号教程链接 * 视频号教程链接
* @param url * @param url

View File

@ -82,27 +82,27 @@ export class Api {
/** /**
* 链接提取 * 链接提取
*/ */
static readonly MATERIAL_INFO = '/api/material'; static readonly MATERIAL_INFO = '/api/mat/url';
/** /**
* 视频号和直播回放提取 * 视频号和直播回放提取
*/ */
static readonly WX_VIDEO = '/api/weixin/video/log'; static readonly WX_VIDEO = '/api/wx';
/** /**
* 跳转至微信发送视频号给客服 * 跳转至微信发送视频号给客服
*/ */
static readonly WX_VIDEO_SERVICE = '/api/weixin/video/service' static readonly WX_VIDEO_SERVICE = '/api/wx/service/url'
/** /**
* 绑定微信用户信息 * 绑定微信用户信息
*/ */
static readonly BIND_WX_USER_INFO = '/api/weixin/user/info' static readonly BIND_WX_USER_INFO = '/api/wx/user/info'
/** /**
* 下载记录 * 下载记录
*/ */
static readonly DOWNLOAD_HISTORY_LIST = '/api/material/log' static readonly DOWNLOAD_HISTORY_LIST = '/api/mat/log'
/** /**
* 素材列表 * 素材列表

View File

@ -275,7 +275,7 @@ class ApiService {
* @returns * @returns
*/ */
analysisMaterial(logId: string): Promise<HttpResult> { analysisMaterial(logId: string): Promise<HttpResult> {
const params: Record<string, string> = { 'logid': logId } const params: Record<string, string> = { 'id': logId }
return AxiosRequest.get<HttpResult>(Api.MATERIAL_INFO, params) return AxiosRequest.get<HttpResult>(Api.MATERIAL_INFO, params)
} }
@ -283,9 +283,8 @@ class ApiService {
* 获取视频号和直播回放 * 获取视频号和直播回放
* @returns * @returns
*/ */
wxVideoList(scene: string): Promise<HttpResult> { wxVideoList(): Promise<HttpResult> {
const params: Record<string, string> = { 'v': 'v2', 'scene': scene } return AxiosRequest.get<HttpResult>(Api.WX_VIDEO)
return AxiosRequest.get<HttpResult>(Api.WX_VIDEO, params)
} }
/** /**
@ -293,8 +292,8 @@ class ApiService {
* @returns * @returns
*/ */
deleteWxVideo(logId: string): Promise<HttpResult> { deleteWxVideo(logId: string): Promise<HttpResult> {
const params: Record<string, string> = { 'logId': logId } const params: Record<string, string> = { 'id': logId }
return AxiosRequest.delete<HttpResult>(Api.WX_VIDEO, params) return AxiosRequest.delete<HttpResult>(Api.DOWNLOAD_HISTORY_LIST, params)
} }
/** /**
@ -307,7 +306,7 @@ class ApiService {
'size': size, 'size': size,
'message': message 'message': message
} }
return AxiosRequest.put<HttpResult>(Api.MATERIAL_INFO, params) return AxiosRequest.put<HttpResult>(Api.DOWNLOAD_HISTORY_LIST, params)
} }
/** /**

View File

@ -1,7 +1,6 @@
import { router, window } from '@kit.ArkUI'; import { router, window } from '@kit.ArkUI';
import { HomePage } from './home/HomePage'; import { HomePage } from './home/HomePage';
import { MinePage } from './mine/MinePage'; import { MinePage } from './mine/MinePage';
import { RecordPage } from './record/RecordPage';
import systemDateTime from '@ohos.systemDateTime'; import systemDateTime from '@ohos.systemDateTime';
import { ToastUtils } from '../../utils/ToastUtils'; import { ToastUtils } from '../../utils/ToastUtils';
import { AppUtil, PasteboardUtil, StrUtil } from '@pura/harmony-utils'; import { AppUtil, PasteboardUtil, StrUtil } from '@pura/harmony-utils';
@ -55,10 +54,9 @@ struct MainPage {
onPageShow(): void { onPageShow(): void {
this.viewModel.userinfo(); this.viewModel.userinfo();
if (this.currentIndex === 1) { if (this.currentIndex === 3) {
AppUtil.getContext().eventHub.emit(EventConstants.RecordRefreshEvent);
} else if (this.currentIndex === 2) {
AppUtil.getContext().eventHub.emit(EventConstants.MineRefreshEvent); AppUtil.getContext().eventHub.emit(EventConstants.MineRefreshEvent);
AppUtil.getContext().eventHub.emit(EventConstants.RecordRefreshEvent);
} }
this.checkPasteboard() this.checkPasteboard()
} }
@ -69,7 +67,7 @@ struct MainPage {
AppUtil.getContext().eventHub.emit(EventConstants.MineRefreshEvent); AppUtil.getContext().eventHub.emit(EventConstants.MineRefreshEvent);
}) })
AppUtil.getContext().eventHub.on(EventConstants.JumpToRecordEvent, (index: number) => { AppUtil.getContext().eventHub.on(EventConstants.JumpToRecordEvent, (index: number) => {
this.tabController.changeIndex(1) this.tabController.changeIndex(3)
this.currentIndex = 1 this.currentIndex = 1
}) })
} }

View File

@ -1,5 +1,5 @@
import { borderRadiuses } from '@kit.ArkUI'; import { borderRadiuses } from '@kit.ArkUI';
import { HomeMenuEntity, homeMenuList } from '../../../entity/HomeMenuEntity'; import { MenuEntity, homeMenuList } from '../../../entity/MenuEntity';
import { NoticeEntity } from '../../../entity/NoticeEntity'; import { NoticeEntity } from '../../../entity/NoticeEntity';
import { HomeViewModel } from '../../../viewModel/HomeViewModel'; import { HomeViewModel } from '../../../viewModel/HomeViewModel';
import { AppUtil, WantUtil } from '@pura/harmony-utils'; import { AppUtil, WantUtil } from '@pura/harmony-utils';
@ -323,7 +323,7 @@ export struct HomePage {
.id('layout_top_menu') .id('layout_top_menu')
Grid() { Grid() {
ForEach(homeMenuList().convertToArray(), (item: HomeMenuEntity) => { ForEach(homeMenuList().convertToArray(), (item: MenuEntity) => {
GridItem() { GridItem() {
Column() { Column() {
Image(item.icon) Image(item.icon)

View File

@ -1,3 +1,4 @@
import { ConfigManager } from '../../../../manager/UserConfigManager'
import { TitleBar } from '../../../../view/TitleBar' import { TitleBar } from '../../../../view/TitleBar'
@Entry @Entry
@ -5,14 +6,9 @@ import { TitleBar } from '../../../../view/TitleBar'
struct CoursePage { struct CoursePage {
build() { build() {
Column() { Column() {
TitleBar({title: '指导教程'}).width('100%') TitleBar({title: '提取教程'}).width('100%')
Scroll() { Scroll() {
Column() { Image(ConfigManager.getTakeMaterialCourse()).width('100%').height('auto')
Image($r('app.media.ic_course1'))
Image($r('app.media.ic_course2'))
Image($r('app.media.ic_course3'))
}
.height('auto')
} }
.layoutWeight(1) .layoutWeight(1)
.scrollBar(BarState.Off) .scrollBar(BarState.Off)

View File

@ -13,7 +13,7 @@ import {
import { VipPermissionEntity } from '../../../../entity/VipPermissionEntity'; import { VipPermissionEntity } from '../../../../entity/VipPermissionEntity';
import { LoginManager } from '../../../../manager/LoginGlobalManager'; import { LoginManager } from '../../../../manager/LoginGlobalManager';
import { ToastUtils } from '../../../../utils/ToastUtils'; import { ToastUtils } from '../../../../utils/ToastUtils';
import { LinkRecognizeViewModel } from '../../../../viewModel/LinkRecognizeViewModel'; import { TakeMaterialViewModel } from '../../../../viewModel/TakeMaterialViewModel';
import { AudioMaterialPage } from './material/AudioMaterialPage'; import { AudioMaterialPage } from './material/AudioMaterialPage';
import { ImageMaterialPage } from './material/ImageMaterialPage'; import { ImageMaterialPage } from './material/ImageMaterialPage';
import { TextMaterialPage } from './material/TextMaterialPage'; import { TextMaterialPage } from './material/TextMaterialPage';
@ -47,7 +47,7 @@ struct TakeMaterialPage {
@Local videoRowCount: number = 1; @Local videoRowCount: number = 1;
@Local imageRowCount: number = 1; @Local imageRowCount: number = 1;
viewModel: LinkRecognizeViewModel = new LinkRecognizeViewModel(this.getUIContext()); viewModel: TakeMaterialViewModel = new TakeMaterialViewModel(this.getUIContext());
tabController: TabsController = new TabsController(); tabController: TabsController = new TabsController();
titles: Array<string> = ['视频', '图片', '音频', '文本']; titles: Array<string> = ['视频', '图片', '音频', '文本'];
@ -460,7 +460,7 @@ struct TakeMaterialPage {
Column() { Column() {
Row() { Row() {
Button({ type: ButtonType.Circle, stateEffect: true }) { Button({ type: ButtonType.Circle, stateEffect: true }) {
Image($r('app.media.ic_back')).width(24).height(24) Image($r('app.media.ic_black_back')).width(24).height(24)
} }
.width(40) .width(40)
.height(40) .height(40)
@ -474,10 +474,11 @@ struct TakeMaterialPage {
Image($r('app.media.ic_link')).width(18).height(18) Image($r('app.media.ic_link')).width(18).height(18)
TextInput({ placeholder: '请输入链接地址', text: this.inputText }) TextInput({ placeholder: '请输入链接地址', text: this.inputText })
.layoutWeight(1) .layoutWeight(1)
.fontColor('#D6D6D6') .fontColor($r('app.color.color_1a1a1a'))
.fontSize(14) .fontSize(14)
.placeholderColor($r('app.color.color_30ffffff')) .placeholderColor($r('app.color.color_999999'))
.placeholderFont({ size: 14 }) .placeholderFont({ size: 14 })
.backgroundColor(Color.Transparent)
.onChange((value: string) => { .onChange((value: string) => {
this.inputText = value; this.inputText = value;
}) })
@ -485,17 +486,17 @@ struct TakeMaterialPage {
.width(18) .width(18)
.height(18) .height(18)
.padding(2) .padding(2)
.margin({right: 5})
.visibility(StrUtil.isNotEmpty(this.inputText) ? Visibility.Visible : Visibility.None) .visibility(StrUtil.isNotEmpty(this.inputText) ? Visibility.Visible : Visibility.None)
.onClick(() => { .onClick(() => {
this.inputText = ''; this.inputText = '';
}) })
Divider() Button('获取', {type: ButtonType.Capsule ,stateEffect:true})
.vertical(true) .fontSize(14)
.strokeWidth(1) .width(64)
.height(14) .height(32)
.color($r('app.color.color_10ffffff')) .margin({right: 4})
.margin({ left: 12, right: 12 }) .backgroundColor($r('app.color.color_466afd'))
Text('获取').fontColor($r('app.color.color_80ffffff')).fontSize(14)
.onClick(() => { .onClick(() => {
if (StrUtil.isNotEmpty(this.inputText)) { if (StrUtil.isNotEmpty(this.inputText)) {
KeyboardUtil.hide() KeyboardUtil.hide()
@ -507,11 +508,11 @@ struct TakeMaterialPage {
}) })
} }
.layoutWeight(1) .layoutWeight(1)
.height(34) .height(40)
.borderRadius(20) .borderRadius(20)
.backgroundColor($r('app.color.color_333333')) .backgroundColor(Color.White)
.margin({ left: 20, right: 16 }) .margin({ left: 10, right: 16 })
.padding({ left: 10, right: 10 }) .padding({left: 10})
}.height(100).padding({ top: 50 }) }.height(100).padding({ top: 50 })
Tabs({ barPosition: BarPosition.Start, controller: this.tabController }) { Tabs({ barPosition: BarPosition.Start, controller: this.tabController }) {
@ -572,12 +573,9 @@ struct TakeMaterialPage {
.tabBar(this.tabBuilder(this.titles[3], 3)) .tabBar(this.tabBuilder(this.titles[3], 3))
} }
.scrollable(false) .scrollable(false)
.onTabBarClick((index) => { .onSelected((index: number) => {
this.currentIndex = index; this.currentIndex = index;
}) })
/*.onSelected((index: number) => {
this.currentIndex = index;
})*/
.layoutWeight(1) .layoutWeight(1)
} }
.width('100%') .width('100%')
@ -587,14 +585,16 @@ struct TakeMaterialPage {
@Builder @Builder
tabBuilder(title: string, targetIndex: number) { tabBuilder(title: string, targetIndex: number) {
Column() { Stack() {
if (this.currentIndex === targetIndex) {
Image($r('app.media.ic_tab_indicator')).width(27).height(11).margin({top: 13})
}
Text(title) Text(title)
.fontColor(this.currentIndex === targetIndex ? $r("app.color.color_466afd") : $r('app.color.color_50ffffff')) .fontColor(this.currentIndex === targetIndex ? $r("app.color.color_212226") : $r('app.color.color_5c5f6c'))
.fontSize(this.currentIndex === targetIndex ? 17 : 14) .fontSize(this.currentIndex === targetIndex ? 16 : 14)
.fontWeight(this.currentIndex === targetIndex ? FontWeight.Medium : FontWeight.Regular) .fontWeight(this.currentIndex === targetIndex ? FontWeight.Medium : FontWeight.Regular)
} }
.width('100%') .width('100%')
.height(50) .height(50)
.justifyContent(FlexAlign.Center)
} }
} }

View File

@ -1,3 +1,4 @@
import { RouterUrls } from '../../../../../common/RouterUrls';
import { AudioMaterial } from '../../../../../entity/MaterialInfoEntity'; import { AudioMaterial } from '../../../../../entity/MaterialInfoEntity';
import { ToastUtils } from '../../../../../utils/ToastUtils'; import { ToastUtils } from '../../../../../utils/ToastUtils';
import { EmptyView, PageStatus } from '../../../../../view/EmptyView'; import { EmptyView, PageStatus } from '../../../../../view/EmptyView';
@ -43,7 +44,7 @@ export struct AudioMaterialPage {
Row() { Row() {
Row() { Row() {
Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18) Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18)
Text('全选').fontColor($r('app.color.color_90ffffff')).fontSize(16).margin({ left: 7 }) Text('全选').fontColor($r('app.color.color_1a1a1a')).fontSize(16).margin({ left: 7 })
} }
.onClick(() => { .onClick(() => {
this.isCheckAll = !this.isCheckAll; this.isCheckAll = !this.isCheckAll;
@ -57,9 +58,12 @@ export struct AudioMaterialPage {
Button('转发', { type: ButtonType.Capsule, stateEffect: true }) Button('转发', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.backgroundColor($r('app.color.color_333333'))
.fontColor($r('app.color.color_50ffffff'))
.fontSize(15) .fontSize(15)
.fontColor($r('app.color.color_466afd'))
.fontWeight(FontWeight.Medium)
.borderWidth(1)
.borderColor($r('app.color.color_466afd'))
.backgroundColor(Color.Transparent)
.onClick(() => { .onClick(() => {
if (this.onShare) { if (this.onShare) {
const list = this.selectedItems(); const list = this.selectedItems();
@ -76,12 +80,10 @@ export struct AudioMaterialPage {
Button('保存', { type: ButtonType.Capsule, stateEffect: true }) Button('保存', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.linearGradient({ .fontColor(Color.White)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.fontColor($r('app.color.color_90ffffff'))
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium)
.backgroundColor($r('app.color.color_466afd'))
.margin({ left: 12 }) .margin({ left: 12 })
.onClick(() => { .onClick(() => {
if (this.onSave) { if (this.onSave) {
@ -94,7 +96,7 @@ export struct AudioMaterialPage {
} }
}) })
} }
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 16, left: 16,
top: 10, top: 10,
@ -106,8 +108,13 @@ export struct AudioMaterialPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_audio'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无音频' noDataText: '暂无数据',
noDataBtnText: '链接提取教程',
noDataBtnIcon: $r('app.media.ic_take_material_course'),
onBtnClick: () => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.COURSE_PAGE})
}
}) })
} }
} }

View File

@ -1,3 +1,4 @@
import { RouterUrls } from '../../../../../common/RouterUrls';
import { ImageMaterial } from '../../../../../entity/MaterialInfoEntity'; import { ImageMaterial } from '../../../../../entity/MaterialInfoEntity';
import { ToastUtils } from '../../../../../utils/ToastUtils'; import { ToastUtils } from '../../../../../utils/ToastUtils';
import { EmptyView, PageStatus } from '../../../../../view/EmptyView'; import { EmptyView, PageStatus } from '../../../../../view/EmptyView';
@ -46,7 +47,7 @@ export struct ImageMaterialPage {
Row() { Row() {
Row() { Row() {
Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18) Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18)
Text('全选').fontColor($r('app.color.color_90ffffff')).fontSize(16).margin({ left: 7 }) Text('全选').fontColor($r('app.color.color_1a1a1a')).fontSize(16).margin({ left: 7 })
} }
.onClick(() => { .onClick(() => {
this.isCheckAll = !this.isCheckAll; this.isCheckAll = !this.isCheckAll;
@ -60,9 +61,12 @@ export struct ImageMaterialPage {
Button('转发', { type: ButtonType.Capsule, stateEffect: true }) Button('转发', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.backgroundColor($r('app.color.color_333333'))
.fontColor($r('app.color.color_50ffffff'))
.fontSize(15) .fontSize(15)
.fontColor($r('app.color.color_466afd'))
.fontWeight(FontWeight.Medium)
.borderWidth(1)
.borderColor($r('app.color.color_466afd'))
.backgroundColor(Color.Transparent)
.onClick(() => { .onClick(() => {
if (this.onShare) { if (this.onShare) {
const list = this.selectedItems(); const list = this.selectedItems();
@ -79,12 +83,10 @@ export struct ImageMaterialPage {
Button('保存', { type: ButtonType.Capsule, stateEffect: true }) Button('保存', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.linearGradient({ .fontColor(Color.White)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.fontColor($r('app.color.color_90ffffff'))
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium)
.backgroundColor($r('app.color.color_466afd'))
.margin({ left: 12 }) .margin({ left: 12 })
.onClick(() => { .onClick(() => {
if (this.onSave) { if (this.onSave) {
@ -97,7 +99,7 @@ export struct ImageMaterialPage {
} }
}) })
} }
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 16, left: 16,
top: 10, top: 10,
@ -109,8 +111,13 @@ export struct ImageMaterialPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_image'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无图片' noDataText: '暂无数据',
noDataBtnText: '链接提取教程',
noDataBtnIcon: $r('app.media.ic_take_material_course'),
onBtnClick: () => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.COURSE_PAGE})
}
}) })
} }
} }

View File

@ -1,4 +1,5 @@
import { PasteboardUtil } from '@pura/harmony-utils'; import { PasteboardUtil } from '@pura/harmony-utils';
import { RouterUrls } from '../../../../../common/RouterUrls';
import { TextMaterial } from '../../../../../entity/MaterialInfoEntity'; import { TextMaterial } from '../../../../../entity/MaterialInfoEntity';
import { ToastUtils } from '../../../../../utils/ToastUtils'; import { ToastUtils } from '../../../../../utils/ToastUtils';
import { EmptyView, PageStatus } from '../../../../../view/EmptyView'; import { EmptyView, PageStatus } from '../../../../../view/EmptyView';
@ -42,7 +43,7 @@ export struct TextMaterialPage {
Row() { Row() {
Row() { Row() {
Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18) Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18)
Text('全选').fontColor($r('app.color.color_90ffffff')).fontSize(16).margin({ left: 7 }) Text('全选').fontColor($r('app.color.color_1a1a1a')).fontSize(16).margin({ left: 7 })
} }
.onClick(() => { .onClick(() => {
this.isCheckAll = !this.isCheckAll; this.isCheckAll = !this.isCheckAll;
@ -54,12 +55,10 @@ export struct TextMaterialPage {
Button('复制文本', { type: ButtonType.Capsule, stateEffect: true }) Button('复制文本', { type: ButtonType.Capsule, stateEffect: true })
.layoutWeight(1) .layoutWeight(1)
.height(40) .height(40)
.linearGradient({ .fontColor(Color.White)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.fontColor($r('app.color.color_90ffffff'))
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium)
.backgroundColor($r('app.color.color_466afd'))
.margin({ left: 27 }) .margin({ left: 27 })
.onClick(() => { .onClick(() => {
const list = this.selectedItems(); const list = this.selectedItems();
@ -73,7 +72,7 @@ export struct TextMaterialPage {
} }
}) })
} }
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 16, left: 16,
top: 10, top: 10,
@ -85,8 +84,13 @@ export struct TextMaterialPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_text'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无文本' noDataText: '暂无数据',
noDataBtnText: '链接提取教程',
noDataBtnIcon: $r('app.media.ic_take_material_course'),
onBtnClick: () => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.COURSE_PAGE})
}
}) })
} }
} }

View File

@ -1,3 +1,4 @@
import { RouterUrls } from '../../../../../common/RouterUrls';
import { VideoMaterial } from '../../../../../entity/MaterialInfoEntity'; import { VideoMaterial } from '../../../../../entity/MaterialInfoEntity';
import { ToastUtils } from '../../../../../utils/ToastUtils'; import { ToastUtils } from '../../../../../utils/ToastUtils';
import { EmptyView, PageStatus } from '../../../../../view/EmptyView'; import { EmptyView, PageStatus } from '../../../../../view/EmptyView';
@ -46,7 +47,7 @@ export struct VideoMaterialPage {
Row() { Row() {
Row() { Row() {
Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18) Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')).width(18).height(18)
Text('全选').fontColor($r('app.color.color_90ffffff')).fontSize(16).margin({ left: 7 }) Text('全选').fontColor($r('app.color.color_1a1a1a')).fontSize(16).margin({ left: 7 })
} }
.onClick(() => { .onClick(() => {
this.isCheckAll = !this.isCheckAll; this.isCheckAll = !this.isCheckAll;
@ -60,9 +61,12 @@ export struct VideoMaterialPage {
Button('转发', { type: ButtonType.Capsule, stateEffect: true }) Button('转发', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.backgroundColor($r('app.color.color_333333'))
.fontColor($r('app.color.color_50ffffff'))
.fontSize(15) .fontSize(15)
.fontColor($r('app.color.color_466afd'))
.fontWeight(FontWeight.Medium)
.borderWidth(1)
.borderColor($r('app.color.color_466afd'))
.backgroundColor(Color.Transparent)
.onClick(() => { .onClick(() => {
if (this.onShare) { if (this.onShare) {
const list = this.selectedItems(); const list = this.selectedItems();
@ -79,12 +83,10 @@ export struct VideoMaterialPage {
Button('保存', { type: ButtonType.Capsule, stateEffect: true }) Button('保存', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.linearGradient({ .fontColor(Color.White)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.fontColor($r('app.color.color_90ffffff'))
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium)
.backgroundColor($r('app.color.color_466afd'))
.margin({ left: 12 }) .margin({ left: 12 })
.onClick(() => { .onClick(() => {
if (this.onSave) { if (this.onSave) {
@ -97,7 +99,7 @@ export struct VideoMaterialPage {
} }
}) })
} }
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 16, left: 16,
top: 10, top: 10,
@ -109,8 +111,13 @@ export struct VideoMaterialPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_video'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无视频' noDataText: '暂无数据',
noDataBtnText: '链接提取教程',
noDataBtnIcon: $r('app.media.ic_take_material_course'),
onBtnClick: () => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.COURSE_PAGE})
}
}) })
} }
} }

View File

@ -1,6 +1,6 @@
import { AppUtil, FileUtil, ObjectUtil, import {
PasteboardUtil, AppUtil, FileUtil, ObjectUtil, PasteboardUtil, RandomUtil, StrUtil
PermissionUtil, RandomUtil, StrUtil } from '@pura/harmony-utils'; } from '@pura/harmony-utils';
import { EventConstants } from '../../../../common/EventConstants'; import { EventConstants } from '../../../../common/EventConstants';
import { RouterUrls } from '../../../../common/RouterUrls'; import { RouterUrls } from '../../../../common/RouterUrls';
import { DownloadDialog, DownloadStatus } from '../../../../dialog/DownloadDialog'; import { DownloadDialog, DownloadStatus } from '../../../../dialog/DownloadDialog';
@ -15,7 +15,7 @@ import { ToastUtils } from '../../../../utils/ToastUtils';
import { TitleBar } from '../../../../view/TitleBar'; import { TitleBar } from '../../../../view/TitleBar';
import { WxVideoViewModel } from '../../../../viewModel/WxVideoViewModel'; import { WxVideoViewModel } from '../../../../viewModel/WxVideoViewModel';
import { WxVideoMaterialPage } from './material/WxVideoMaterialPage'; import { WxVideoMaterialPage } from './material/WxVideoMaterialPage';
import { LevelMode, router } from '@kit.ArkUI'; import { CommonModifier, LevelMode, router } from '@kit.ArkUI';
import { WxVideoEntity } from '../../../../entity/WxVideoEntity'; import { WxVideoEntity } from '../../../../entity/WxVideoEntity';
import { WxImageMaterialPage } from './material/WxImageMaterialPage'; import { WxImageMaterialPage } from './material/WxImageMaterialPage';
import { OnWXResp, WXApi, WXEventHandler } from '../../../../utils/wechat/WXApiEventHandlerImpl'; import { OnWXResp, WXApi, WXEventHandler } from '../../../../utils/wechat/WXApiEventHandlerImpl';
@ -23,46 +23,41 @@ import * as WxOpenSdk from '@tencent/wechat_open_sdk';
import { ErrCode, SendAuthResp } from '@tencent/wechat_open_sdk'; import { ErrCode, SendAuthResp } from '@tencent/wechat_open_sdk';
import { LoadingDialog } from '../../../../dialog/LoadingDialog'; import { LoadingDialog } from '../../../../dialog/LoadingDialog';
import BuildProfile from 'BuildProfile'; import BuildProfile from 'BuildProfile';
import { WxServiceEntity } from '../../../../entity/WxServiceEntity';
import { Constants } from '../../../../common/Constants'; import { Constants } from '../../../../common/Constants';
import { EventReportGlobalManager } from '../../../../manager/EventReportGlobalManager'; import { EventReportGlobalManager } from '../../../../manager/EventReportGlobalManager';
import { TipDialog } from '../../../../dialog/TipDialog'; import { TipDialog } from '../../../../dialog/TipDialog';
import { SimpleTipDialog } from '../../../../dialog/SimpleTipDialog'; import { SimpleTipDialog } from '../../../../dialog/SimpleTipDialog';
import { JoinWxGroupCourseDialog } from '../../../../dialog/JoinWxGroupCourseDialog'; import { JoinWxGroupCourseDialog } from '../../../../dialog/JoinWxGroupCourseDialog';
import { PrefUtils } from '../../../../utils/PrefUtils'; import { PrefUtils } from '../../../../utils/PrefUtils';
import { WxVideoServiceEntity } from '../../../../entity/WxVideoServiceEntity';
@Entry @Entry
@ComponentV2 @ComponentV2
struct WxVideoPage { struct WxVideoPage {
@Local tabBarModifier: CommonModifier = new CommonModifier()
@Local isPlayback: boolean = false @Local isPlayback: boolean = false
@Local currentIndex: number = 0; @Local currentIndex: number = 0;
@Local isRefreshing: boolean = false; @Local isRefreshing: boolean = false;
@Local videoList: Array<VideoMaterial> = []; @Local videoList: Array<VideoMaterial> = [];
@Local imageList: Array<ImageMaterial> = []; @Local imageList: Array<ImageMaterial> = [];
@Local videoRowCount: number = 1; @Local videoRowCount: number = 1;
@Local imageRowCount: number = 1; @Local imageRowCount: number = 1;
viewModel: WxVideoViewModel = new WxVideoViewModel(this.getUIContext()); viewModel: WxVideoViewModel = new WxVideoViewModel(this.getUIContext());
tabController: TabsController = new TabsController(); tabController: TabsController = new TabsController();
titles: Array<string> = ['视频', '图片']; titles: Array<string> = ['视频', '图片'];
type: number = 0 type: number = 0
mediaDownloader?: MediaDownloader | null mediaDownloader?: MediaDownloader | null
selectedList: Array<MediaEntity> = [] selectedList: Array<MediaEntity> = []
cacheFileUris: Array<string> = [] cacheFileUris: Array<string> = []
downloadIndex: number = 0 downloadIndex: number = 0
totalSize = 0 totalSize = 0
downloadStatus = DownloadStatus.DOWNLOADING downloadStatus = DownloadStatus.DOWNLOADING
joinGroupDialogController?: CustomDialogController | null; joinGroupDialogController?: CustomDialogController | null;
//从微信返回的回调 //从微信返回的回调
onWXResp: OnWXResp = (resp) => { onWXResp: OnWXResp = (resp) => {
//微信返回的数据 //微信返回的数据
if (resp instanceof SendAuthResp && resp.state?.endsWith('video')) { if (resp instanceof SendAuthResp && resp.state?.endsWith('video')) {
const authResult = JSON.stringify(resp ?? {}, null , 2); const authResult = JSON.stringify(resp ?? {}, null, 2);
const errCode = JSON.parse(authResult).errCode as number; const errCode = JSON.parse(authResult).errCode as number;
if (errCode === ErrCode.ERR_OK) { if (errCode === ErrCode.ERR_OK) {
const authCode = JSON.parse(authResult).code as string; const authCode = JSON.parse(authResult).code as string;
@ -97,13 +92,17 @@ struct WxVideoPage {
const info = monitor.value()?.now as VipPermissionEntity; const info = monitor.value()?.now as VipPermissionEntity;
if (info.auth) { if (info.auth) {
if (!LoginManager.isLogin()) { if (!LoginManager.isLogin()) {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.LOGIN_PAGE, params: {from: 1}}, router.RouterMode.Single) this.getUIContext()
.getRouter()
.pushUrl({ url: RouterUrls.LOGIN_PAGE, params: { from: 1 } }, router.RouterMode.Single)
return; return;
} }
this.shareOrDownload() this.shareOrDownload()
} else { } else {
if (!info.auth_ad) { if (!info.auth_ad) {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.VIP_PAGE, params: {origin: 'download_wechat_video'}}) this.getUIContext()
.getRouter()
.pushUrl({ url: RouterUrls.VIP_PAGE, params: { origin: 'download_wechat_video' } })
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_MEMBER_RECHARGE, 'download_wechat_video') EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_MEMBER_RECHARGE, 'download_wechat_video')
return; return;
} }
@ -114,7 +113,7 @@ struct WxVideoPage {
onErrorCodeChange(monitor: IMonitor) { onErrorCodeChange(monitor: IMonitor) {
const errorCode = monitor.value()?.now as number; const errorCode = monitor.value()?.now as number;
if (errorCode === 12002 || errorCode === 12003 || errorCode === 12004) { if (errorCode === 12002 || errorCode === 12003 || errorCode === 12004) {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.RECHARGE_DIAMOND_PAGE}); this.getUIContext().getRouter().pushUrl({ url: RouterUrls.RECHARGE_DIAMOND_PAGE });
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_RECHARGE_DIAMOND, 'download_wechat_video') EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_RECHARGE_DIAMOND, 'download_wechat_video')
ToastUtils.show('钻石已用完') ToastUtils.show('钻石已用完')
} }
@ -128,8 +127,8 @@ struct WxVideoPage {
@Monitor('viewModel.wxService') @Monitor('viewModel.wxService')
onWxServiceChange(monitor: IMonitor) { onWxServiceChange(monitor: IMonitor) {
const info = monitor.value()?.now as WxServiceEntity; const info = monitor.value()?.now as WxVideoServiceEntity;
if (StrUtil.isEmpty(info.corpid) || StrUtil.isEmpty(info.address)) { if (StrUtil.isEmpty(info.corp_id) || StrUtil.isEmpty(info.link)) {
ToastUtils.show('获取客服信息错误') ToastUtils.show('获取客服信息错误')
} else { } else {
ConfigManager.saveBindWxVideoHelper(true) ConfigManager.saveBindWxVideoHelper(true)
@ -149,6 +148,7 @@ struct WxVideoPage {
aboutToAppear(): void { aboutToAppear(): void {
WXEventHandler.registerOnWXRespCallback(this.onWXResp) WXEventHandler.registerOnWXRespCallback(this.onWXResp)
this.tabBarModifier.align(Alignment.Start)
this.initParams() this.initParams()
this.checkBindStatus() this.checkBindStatus()
} }
@ -170,12 +170,14 @@ struct WxVideoPage {
showSaveTip() { showSaveTip() {
if (PrefUtils.getBoolean('show_save_tip', true)) { if (PrefUtils.getBoolean('show_save_tip', true)) {
SimpleTipDialog.show(this.getUIContext(), {title: '重要提示', content: '下载完成后需要您点击弹窗允许保存之后才能保存文件到相册', callback: { SimpleTipDialog.show(this.getUIContext(), {
confirm: () => { title: '重要提示', content: '下载完成后需要您点击弹窗允许保存之后才能保存文件到相册', callback: {
this.viewModel.checkVip(); confirm: () => {
PrefUtils.put('show_save_tip', false) this.viewModel.checkVip();
PrefUtils.put('show_save_tip', false)
}
} }
}}) })
} else { } else {
this.viewModel.checkVip() this.viewModel.checkVip()
} }
@ -197,17 +199,20 @@ struct WxVideoPage {
shareMedia(media: MediaEntity) { shareMedia(media: MediaEntity) {
let filePath = FileUtil.getCacheDirPath() + FileUtil.separator + media.initFileName() let filePath = FileUtil.getCacheDirPath() + FileUtil.separator + media.initFileName()
if (FileUtil.accessSync(filePath) && FileUtil.isFile(filePath) && !(media.totalSize === 0 || media.currentLen !== media.totalSize)) { if (FileUtil.accessSync(filePath) && FileUtil.isFile(filePath) &&
!(media.totalSize === 0 || media.currentLen !== media.totalSize)) {
this.shareFile(media) this.shareFile(media)
} else { } else {
this.showDownloadDialog(media instanceof VideoMaterial && media.isMerge ? DownloadStatus.VIDEO_DOWNLOADING : DownloadStatus.DOWNLOADING) this.showDownloadDialog(media instanceof VideoMaterial && media.isMerge ? DownloadStatus.VIDEO_DOWNLOADING :
DownloadStatus.DOWNLOADING)
this.download(media, true) this.download(media, true)
} }
} }
async downloadMedia(media: MediaEntity) { async downloadMedia(media: MediaEntity) {
let filePath = FileUtil.getCacheDirPath() + FileUtil.separator + media.initFileName() let filePath = FileUtil.getCacheDirPath() + FileUtil.separator + media.initFileName()
if (FileUtil.accessSync(filePath) && FileUtil.isFile(filePath) && !(media.totalSize === 0 || media.currentLen !== media.totalSize)) { if (FileUtil.accessSync(filePath) && FileUtil.isFile(filePath) &&
!(media.totalSize === 0 || media.currentLen !== media.totalSize)) {
this.cacheFileUris.push(FileUtil.getUriFromPath(filePath)) this.cacheFileUris.push(FileUtil.getUriFromPath(filePath))
if (this.downloadIndex < this.selectedList.length - 1) { if (this.downloadIndex < this.selectedList.length - 1) {
this.downloadIndex++ this.downloadIndex++
@ -228,7 +233,8 @@ struct WxVideoPage {
this.isRefreshing = true this.isRefreshing = true
} }
} else { } else {
this.showDownloadDialog(media instanceof VideoMaterial && media.isMerge ? DownloadStatus.VIDEO_DOWNLOADING : DownloadStatus.DOWNLOADING) this.showDownloadDialog(media instanceof VideoMaterial && media.isMerge ? DownloadStatus.VIDEO_DOWNLOADING :
DownloadStatus.DOWNLOADING)
this.download(media) this.download(media)
} }
} }
@ -278,7 +284,7 @@ struct WxVideoPage {
this.updateDownloadDialog(DownloadStatus.PROCESSING) this.updateDownloadDialog(DownloadStatus.PROCESSING)
} }
}, },
onPause:() => { onPause: () => {
this.dismissDownloadDialog() this.dismissDownloadDialog()
}, },
onCancel: () => { onCancel: () => {
@ -313,32 +319,49 @@ struct WxVideoPage {
showDownloadDialog(status: DownloadStatus = DownloadStatus.DOWNLOADING) { showDownloadDialog(status: DownloadStatus = DownloadStatus.DOWNLOADING) {
this.downloadStatus = status this.downloadStatus = status
DownloadDialog.show(this.getUIContext(), { status: status, totalSize: 0, progress: 0, totalCount: this.selectedList.length, index: this.downloadIndex, callback: { DownloadDialog.show(this.getUIContext(), {
confirm: () => { status: status,
if (this.downloadStatus === DownloadStatus.COMPLETED) { totalSize: 0,
EventReportGlobalManager.eventReport(EventConstants.DIALOG_GO_TO_VIEW, this.titles[this.currentIndex]) progress: 0,
AppUtil.getContext().eventHub.emit(EventConstants.JumpToRecordEvent, this.currentIndex) totalCount: this.selectedList.length,
this.getUIContext().getRouter().back() index: this.downloadIndex,
} else { callback: {
//todo 后台下载 confirm: () => {
} if (this.downloadStatus === DownloadStatus.COMPLETED) {
}, EventReportGlobalManager.eventReport(EventConstants.DIALOG_GO_TO_VIEW, this.titles[this.currentIndex])
cancel: () => { AppUtil.getContext().eventHub.emit(EventConstants.JumpToRecordEvent, this.currentIndex)
if (this.downloadStatus !== DownloadStatus.COMPLETED) { this.getUIContext().getRouter().back()
if (this.mediaDownloader) { } else {
this.mediaDownloader.cancel() //todo 后台下载
EventReportGlobalManager.eventReport(EventConstants.CANCEL_DOWNLOAD_VIDEO, this.selectedList[this.downloadIndex].url) }
},
cancel: () => {
if (this.downloadStatus !== DownloadStatus.COMPLETED) {
if (this.mediaDownloader) {
this.mediaDownloader.cancel()
EventReportGlobalManager.eventReport(EventConstants.CANCEL_DOWNLOAD_VIDEO,
this.selectedList[this.downloadIndex].url)
}
} else {
EventReportGlobalManager.eventReport(EventConstants.DIALOG_CONFIRM_SAVE_FILE,
this.titles[this.currentIndex])
} }
} else {
EventReportGlobalManager.eventReport(EventConstants.DIALOG_CONFIRM_SAVE_FILE, this.titles[this.currentIndex])
} }
} }
} }) })
} }
updateDownloadDialog(status: DownloadStatus = DownloadStatus.DOWNLOADING, totalSize: number = 0, progress: number = 0, isAudio: boolean = false) { updateDownloadDialog(status: DownloadStatus = DownloadStatus.DOWNLOADING, totalSize: number = 0, progress: number = 0,
isAudio: boolean = false) {
this.downloadStatus = status this.downloadStatus = status
DownloadDialog.update({ status: status, totalSize: totalSize, progress: progress, totalCount: this.selectedList.length, index: this.downloadIndex, isAudio: isAudio }) DownloadDialog.update({
status: status,
totalSize: totalSize,
progress: progress,
totalCount: this.selectedList.length,
index: this.downloadIndex,
isAudio: isAudio
})
} }
dismissDownloadDialog() { dismissDownloadDialog() {
@ -396,21 +419,24 @@ struct WxVideoPage {
} }
checkBindStatus() { checkBindStatus() {
if (this.isPlayback && !ConfigManager.isBindWxPlaybackHelper() || !this.isPlayback && !ConfigManager.isBindWxVideoHelper()) { if (this.isPlayback && !ConfigManager.isBindWxPlaybackHelper() ||
!this.isPlayback && !ConfigManager.isBindWxVideoHelper()) {
if (LoginManager.getLastUserInfo()?.user_id !== LoginManager.getUserInfo()?.user_id) { if (LoginManager.getLastUserInfo()?.user_id !== LoginManager.getUserInfo()?.user_id) {
TipDialog.show(this.getUIContext(), {title: '提示', content: '系统检测到您更换了账号,请重新添加助手', callback: { TipDialog.show(this.getUIContext(), {
confirm: () => { title: '提示', content: '系统检测到您更换了账号,请重新添加助手', callback: {
if (this.isPlayback || !ConfigManager.isWxVideoServiceEnable()) { confirm: () => {
if (ConfigManager.getPlaybackJoinType() === "img") { if (this.isPlayback || !ConfigManager.isWxVideoServiceEnable()) {
this.showJoinGroupCourseDialog() if (ConfigManager.getPlaybackJoinType() === "img") {
this.showJoinGroupCourseDialog()
} else {
this.wxAuth()
}
} else { } else {
this.wxAuth() this.getWxServiceInfo()
} }
} else {
this.getWxServiceInfo()
} }
} }
}}) })
} }
} }
} }
@ -440,7 +466,7 @@ struct WxVideoPage {
req.nonAutomatic = true; req.nonAutomatic = true;
req.scope = 'snsapi_userinfo'; req.scope = 'snsapi_userinfo';
req.state = BuildProfile.BUNDLE_NAME + RandomUtil.getRandomInt(0, 1000) + '_video'; req.state = BuildProfile.BUNDLE_NAME + RandomUtil.getRandomInt(0, 1000) + '_video';
req.transaction =''; req.transaction = '';
await WXApi.sendReq(AppUtil.getContext(), req) await WXApi.sendReq(AppUtil.getContext(), req)
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_SHARE_WX_PLAYBACK, '前往微信分享直播回放') EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_SHARE_WX_PLAYBACK, '前往微信分享直播回放')
@ -452,12 +478,12 @@ struct WxVideoPage {
try { try {
let wxVideoConfig = ConfigManager.getWxVideoConfig() let wxVideoConfig = ConfigManager.getWxVideoConfig()
if (wxVideoConfig != null && LoginManager.getUserInfo()) { if (wxVideoConfig != null && LoginManager.getUserInfo()) {
PasteboardUtil.setDataText(LoginManager.getUserInfo()!!.user_id) PasteboardUtil.setDataText(`${LoginManager.getUserInfo()!!.user_id}|${Constants.APP_ID}`)
wxVideoConfig.id = LoginManager.getUserInfo()!!.user_id wxVideoConfig.id = `${LoginManager.getUserInfo()!!.user_id}|${Constants.APP_ID}`
let params = encodeURI(JSON.stringify(wxVideoConfig)).replace('+', '%20') let params = encodeURI(JSON.stringify(wxVideoConfig)).replace('+', '%20')
let launchMiniProgramReq = new WxOpenSdk.LaunchMiniProgramReq() let launchMiniProgramReq = new WxOpenSdk.LaunchMiniProgramReq()
launchMiniProgramReq.userName = Constants.MINI_PROGRAM_APP_ID //拉起的小程序的原始id launchMiniProgramReq.userName = Constants.MINI_PROGRAM_APP_ID //拉起的小程序的原始id
launchMiniProgramReq.path = `pages/index/index?path=share&param=${params}` launchMiniProgramReq.path = `pages/index/index?path=share&param=${params}`
launchMiniProgramReq.miniprogramType = 0 //拉起小程序的类型 0-正式版 1-开发版 2-体验版 launchMiniProgramReq.miniprogramType = 0 //拉起小程序的类型 0-正式版 1-开发版 2-体验版
await WXApi.sendReq(AppUtil.getContext(), launchMiniProgramReq) await WXApi.sendReq(AppUtil.getContext(), launchMiniProgramReq)
@ -482,10 +508,10 @@ struct WxVideoPage {
* 跳转客服 * 跳转客服
* @param service * @param service
*/ */
contactWxService(service: WxServiceEntity) { contactWxService(service: WxVideoServiceEntity) {
let req = new WxOpenSdk.OpenCustomerServiceChatReq() let req = new WxOpenSdk.OpenCustomerServiceChatReq()
req.corpId = service.corpid; // 企业ID req.corpId = service.corp_id; // 企业ID
req.url = service.address; // 客服URL req.url = service.link; // 客服URL
WXApi.sendReq(AppUtil.getContext(), req) WXApi.sendReq(AppUtil.getContext(), req)
} }
@ -502,12 +528,15 @@ struct WxVideoPage {
Column() { Column() {
TitleBar({ title: this.isPlayback ? '直播回放' : '视频号' }) TitleBar({ title: this.isPlayback ? '直播回放' : '视频号' })
Stack({ alignContent: Alignment.TopStart }) { Refresh({ refreshing: this.isRefreshing }) {
Refresh({refreshing: this.isRefreshing}) { Stack({ alignContent: Alignment.TopEnd }) {
Tabs({ barPosition: BarPosition.Start, controller: this.tabController }) { Tabs({ barPosition: BarPosition.Start, controller: this.tabController, barModifier: this.tabBarModifier }) {
TabContent() { TabContent() {
WxVideoMaterialPage({mediaList: this.videoList, rowCount: this.videoRowCount, isPlayback: this.isPlayback, WxVideoMaterialPage({
onShare:(video) => { mediaList: this.videoList,
rowCount: this.videoRowCount,
isPlayback: this.isPlayback,
onShare: (video) => {
this.type = 0 this.type = 0
this.selectedList.length = 0 this.selectedList.length = 0
this.selectedList.push(video) this.selectedList.push(video)
@ -519,18 +548,24 @@ struct WxVideoPage {
this.showSaveTip(); this.showSaveTip();
}, },
onItemDelete: (video) => { onItemDelete: (video) => {
TipDialog.show(this.getUIContext(), {title: '提示', content: this.isPlayback ? '确定删除该直播回放?' : '确定删除该视频号?', callback: { TipDialog.show(this.getUIContext(), {
confirm: () => { title: '提示', content: this.isPlayback ? '确定删除该直播回放?' : '确定删除该视频号?', callback: {
this.viewModel.deleteWxVideo(video.logid) confirm: () => {
this.viewModel.deleteWxVideo(video.logid)
}
} }
}}) })
} }
}) })
} }
.tabBar(this.tabBuilder(this.titles[0], 0))
TabContent() { TabContent() {
WxImageMaterialPage({mediaList: this.imageList, rowCount: this.imageRowCount, isPlayback: this.isPlayback, WxImageMaterialPage({
onShare:(image) => { mediaList: this.imageList,
rowCount: this.imageRowCount,
isPlayback: this.isPlayback,
onShare: (image) => {
this.type = 0 this.type = 0
this.selectedList.length = 0 this.selectedList.length = 0
this.selectedList.push(image) this.selectedList.push(image)
@ -542,35 +577,27 @@ struct WxVideoPage {
this.showSaveTip(); this.showSaveTip();
}, },
onItemDelete: (image) => { onItemDelete: (image) => {
TipDialog.show(this.getUIContext(), {title: '提示', content: this.isPlayback ? '确定删除该直播回放?' : '确定删除该视频号?', callback: { TipDialog.show(this.getUIContext(), {
confirm: () => { title: '提示', content: this.isPlayback ? '确定删除该直播回放?' : '确定删除该视频号?', callback: {
this.viewModel.deleteWxVideo(image.logid) confirm: () => {
this.viewModel.deleteWxVideo(image.logid)
}
} }
}}) })
} }
}) })
} }
.tabBar(this.tabBuilder(this.titles[1], 1))
} }
.scrollable(false) .scrollable(false)
/*.onSelected((index: number) => { .barMode(BarMode.Scrollable)
.onSelected((index: number) => {
this.currentIndex = index; this.currentIndex = index;
})*/
}
.onRefreshing(() => {
this.isRefreshing = true
this.viewModel.videoList(this.isPlayback ? 'playback' : 'wechatvideo')
})
.refreshOffset(50)
.pullToRefresh(true)
Row({ space: 40 }) {
ForEach(this.titles, (title: string, index) => {
this.tab(title, index);
}) })
Blank().layoutWeight(1)
Row() { Row() {
Image($r('app.media.ic_wx_video_course')).width(16).height(16) Image($r('app.media.ic_video_course')).width(16).height(16)
Text('视频教程').fontColor($r('app.color.color_80ffffff')).fontSize(12).margin({ left: 4 }) Text('视频教程').fontColor($r('app.color.color_212226')).fontSize(12).margin({ left: 4 })
} }
.onClick(() => { .onClick(() => {
if (this.isPlayback) { if (this.isPlayback) {
@ -579,24 +606,37 @@ struct WxVideoPage {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.VIDEO_PLAYER_PAGE, params: {uri: ConfigManager.getWxVideoCourse(), title: '视频教程'}}) this.getUIContext().getRouter().pushUrl({url: RouterUrls.VIDEO_PLAYER_PAGE, params: {uri: ConfigManager.getWxVideoCourse(), title: '视频教程'}})
} }
}) })
}.padding({ left: 16, right: 16 }) .height(50)
.margin({ top: 10 }) .margin({ top: 3, right: 16 })
}.layoutWeight(1) }
}
.layoutWeight(1)
.onRefreshing(() => {
this.isRefreshing = true
this.viewModel.videoList()
})
.refreshOffset(50)
.pullToRefresh(true)
} }
Row() { Row() {
Image(this.isPlayback ? $r('app.media.ic_playback_helper') : $r('app.media.ic_video_helper')).width(26).height(26) Image(this.isPlayback ? $r('app.media.ic_playback_helper') : $r('app.media.ic_video_helper'))
Text(this.isPlayback ? '添加直播\n回放助手' : '添加助手').margin({left: 6}).fontColor(Color.White).fontSize(12) .width(26)
Image($r('app.media.ic_arrow_dp16')).width(16).height(16).margin({left: 2}) .height(26)
Text(this.isPlayback ? '添加直播\n回放助手' : '添加助手')
.margin({ left: 6 })
.fontColor(this.isPlayback ? '#FF9614' : '#008EFF')
.fontSize(12)
Image(this.isPlayback ? $r('app.media.ic_playback_helper_arrow') : $r('app.media.ic_video_helper_arrow')).width(16).height(16).margin({ left: 2 })
} }
.padding(8) .padding(8)
.backgroundColor($r('app.color.color_333333')) .backgroundColor(Color.White)
.borderRadius({topLeft: 10, bottomLeft: 10}) .borderRadius({ topLeft: 10, bottomLeft: 10 })
.alignRules({ .alignRules({
right: {anchor:'__container__', align: HorizontalAlign.End}, right: { anchor: '__container__', align: HorizontalAlign.End },
bottom: {anchor:'__container__', align: VerticalAlign.Bottom}, bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
}) })
.margin({bottom: 100}) .margin({ bottom: 100 })
.onClick(() => { .onClick(() => {
if (this.isPlayback || !ConfigManager.isWxVideoServiceEnable()) { if (this.isPlayback || !ConfigManager.isWxVideoServiceEnable()) {
if (ConfigManager.getPlaybackJoinType() === "img") { if (ConfigManager.getPlaybackJoinType() === "img") {
@ -615,19 +655,18 @@ struct WxVideoPage {
} }
@Builder @Builder
tab(tabName: string, tabIndex: number) { tabBuilder(title: string, targetIndex: number) {
Row() { Stack() {
Text(tabName) if (this.currentIndex === targetIndex) {
.fontSize(this.currentIndex === tabIndex ? 17 : 14) Image($r('app.media.ic_tab_indicator')).width(27).height(11).margin({ top: 13 })
.fontWeight(this.currentIndex === tabIndex ? FontWeight.Medium : FontWeight.Regular) }
.lineHeight(24) Text(title)
.fontColor(tabIndex === this.currentIndex ? $r("app.color.color_466afd") : $r('app.color.color_50ffffff')) .fontColor(this.currentIndex === targetIndex ? $r("app.color.color_212226") : $r('app.color.color_5c5f6c'))
.fontSize(this.currentIndex === targetIndex ? 16 : 14)
.fontWeight(this.currentIndex === targetIndex ? FontWeight.Medium : FontWeight.Regular)
} }
.width('auto') .width('auto')
.height('auto') .height(50)
.onClick(() => { .margin({ left: targetIndex === 0 ? 16 : 40 })
this.tabController.changeIndex(tabIndex);
this.currentIndex = tabIndex;
})
} }
} }

View File

@ -55,7 +55,7 @@ export struct WxImageMaterialPage {
Row() { Row() {
Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') :
$r('app.media.ic_check_false')).width(18).height(18) $r('app.media.ic_check_false')).width(18).height(18)
Text('全选').fontColor($r('app.color.color_90ffffff')).fontSize(16).margin({ left: 7 }) Text('全选').fontColor($r('app.color.color_212226')).fontSize(16).margin({ left: 7 })
} }
.onClick(() => { .onClick(() => {
this.isCheckAll = !this.isCheckAll; this.isCheckAll = !this.isCheckAll;
@ -69,9 +69,12 @@ export struct WxImageMaterialPage {
Button('转发', { type: ButtonType.Capsule, stateEffect: true }) Button('转发', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.backgroundColor($r('app.color.color_333333'))
.fontColor($r('app.color.color_50ffffff'))
.fontSize(15) .fontSize(15)
.fontColor($r('app.color.color_466afd'))
.fontWeight(FontWeight.Medium)
.borderWidth(1)
.borderColor($r('app.color.color_466afd'))
.backgroundColor(Color.Transparent)
.onClick(() => { .onClick(() => {
if (this.onShare) { if (this.onShare) {
const list = this.selectedItems(); const list = this.selectedItems();
@ -88,12 +91,10 @@ export struct WxImageMaterialPage {
Button('保存', { type: ButtonType.Capsule, stateEffect: true }) Button('保存', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.linearGradient({ .fontColor(Color.White)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.fontColor($r('app.color.color_90ffffff'))
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium)
.backgroundColor($r('app.color.color_466afd'))
.margin({ left: 12 }) .margin({ left: 12 })
.onClick(() => { .onClick(() => {
if (this.onSave) { if (this.onSave) {
@ -106,7 +107,7 @@ export struct WxImageMaterialPage {
} }
}) })
} }
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 16, left: 16,
top: 10, top: 10,

View File

@ -54,7 +54,7 @@ export struct WxVideoMaterialPage {
Row() { Row() {
Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') : Image(this.mediaList.every(item => item.isChecked) ? $r('app.media.ic_check_true') :
$r('app.media.ic_check_false')).width(18).height(18) $r('app.media.ic_check_false')).width(18).height(18)
Text('全选').fontColor($r('app.color.color_90ffffff')).fontSize(16).margin({ left: 7 }) Text('全选').fontColor($r('app.color.color_212226')).fontSize(16).margin({ left: 7 })
} }
.onClick(() => { .onClick(() => {
this.isCheckAll = !this.isCheckAll; this.isCheckAll = !this.isCheckAll;
@ -68,9 +68,12 @@ export struct WxVideoMaterialPage {
Button('转发', { type: ButtonType.Capsule, stateEffect: true }) Button('转发', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.backgroundColor($r('app.color.color_333333'))
.fontColor($r('app.color.color_50ffffff'))
.fontSize(15) .fontSize(15)
.fontColor($r('app.color.color_466afd'))
.fontWeight(FontWeight.Medium)
.borderWidth(1)
.borderColor($r('app.color.color_466afd'))
.backgroundColor(Color.Transparent)
.onClick(() => { .onClick(() => {
if (this.onShare) { if (this.onShare) {
const list = this.selectedItems(); const list = this.selectedItems();
@ -87,12 +90,10 @@ export struct WxVideoMaterialPage {
Button('保存', { type: ButtonType.Capsule, stateEffect: true }) Button('保存', { type: ButtonType.Capsule, stateEffect: true })
.width(122) .width(122)
.height(40) .height(40)
.linearGradient({ .fontColor(Color.White)
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.fontColor($r('app.color.color_90ffffff'))
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium)
.backgroundColor($r('app.color.color_466afd'))
.margin({ left: 12 }) .margin({ left: 12 })
.onClick(() => { .onClick(() => {
if (this.onSave) { if (this.onSave) {
@ -105,7 +106,7 @@ export struct WxVideoMaterialPage {
} }
}) })
} }
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 16, left: 16,
top: 10, top: 10,
@ -129,9 +130,9 @@ export struct WxVideoMaterialPage {
}) })
Column() { Column() {
Text('操作步骤:').fontColor($r('app.color.color_90ffffff')).fontSize(14) Text('操作步骤:').fontColor($r('app.color.color_212226')).fontSize(14).fontWeight(FontWeight.Medium)
Text(this.isPlayback ? $r('app.string.wx_playback_course') : $r('app.string.wx_video_course')) Text(this.isPlayback ? $r('app.string.wx_playback_course') : $r('app.string.wx_video_course'))
.fontColor($r('app.color.color_50ffffff')) .fontColor('#4D4F57')
.fontSize(12) .fontSize(12)
.lineHeight(20) .lineHeight(20)
.margin({ top: 9 }) .margin({ top: 9 })

View File

@ -1,13 +1,11 @@
import { AppUtil, FileUtil, FormatUtil, NumberUtil, PasteboardUtil, StrUtil } from '@pura/harmony-utils'; import { AppUtil, PasteboardUtil, StrUtil } from '@pura/harmony-utils';
import { EventConstants } from '../../../common/EventConstants'; import { EventConstants } from '../../../common/EventConstants';
import { RouterUrls } from '../../../common/RouterUrls'; import { RouterUrls } from '../../../common/RouterUrls';
import { UserEntity } from '../../../entity/UserEntity'; import { UserEntity } from '../../../entity/UserEntity';
import { LoginManager } from '../../../manager/LoginGlobalManager'; import { LoginManager } from '../../../manager/LoginGlobalManager';
import { ToastUtils } from '../../../utils/ToastUtils'; import { ToastUtils } from '../../../utils/ToastUtils';
import { TextItemView } from '../../../view/TextItemView';
import MineViewModel from '../../../viewModel/MineViewModel'; import MineViewModel from '../../../viewModel/MineViewModel';
import { router } from '@kit.ArkUI'; import { CommonModifier, router } from '@kit.ArkUI';
import { TipDialog } from '../../../dialog/TipDialog';
import { fileIo, storageStatistics } from '@kit.CoreFileKit'; import { fileIo, storageStatistics } from '@kit.CoreFileKit';
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
import { LoadingDialog } from '../../../dialog/LoadingDialog'; import { LoadingDialog } from '../../../dialog/LoadingDialog';
@ -16,8 +14,12 @@ import { EventReportGlobalManager } from '../../../manager/EventReportGlobalMana
import { WxServiceEntity } from '../../../entity/WxServiceEntity'; import { WxServiceEntity } from '../../../entity/WxServiceEntity';
import { WXApi } from '../../../utils/wechat/WXApiEventHandlerImpl'; import { WXApi } from '../../../utils/wechat/WXApiEventHandlerImpl';
import * as WxOpenSdk from '@tencent/wechat_open_sdk'; import * as WxOpenSdk from '@tencent/wechat_open_sdk';
import { ScanUtil } from '@pura/picker_utils'; import { Constants } from '../../../common/Constants';
import { scanCore } from '@kit.ScanKit'; import { MenuEntity, mineMenuList } from '../../../entity/MenuEntity';
import { MediaAction, MediaType } from '../../../manager/MediaManager';
import { VideoRecordPage } from '../record/VideoRecordPage';
import { ImageRecordPage } from '../record/ImageRecordPage';
import { AudioRecordPage } from '../record/AudioRecordPage';
@ComponentV2 @ComponentV2
export struct MinePage { export struct MinePage {
@ -26,11 +28,14 @@ export struct MinePage {
@Local isLogin: boolean = LoginManager.isLogin(); @Local isLogin: boolean = LoginManager.isLogin();
@Local userinfo?: UserEntity; @Local userinfo?: UserEntity;
@Local diamondInfo?: DiamondDetailEntity @Local diamondInfo?: DiamondDetailEntity
@Local cacheSize: number = 0 @Local currentIndex: number = 0;
@Local tabBarModifier: CommonModifier = new CommonModifier()
scroller: Scroller = new Scroller(); private viewModel: MineViewModel = new MineViewModel(this.getUIContext());
viewModel: MineViewModel = new MineViewModel(this.getUIContext()); private scroller: Scroller = new Scroller();
private tabController: TabsController = new TabsController();
private titles: Array<string> = ['视频', '图片', '音频'];
@Monitor('viewModel.userEntity') @Monitor('viewModel.userEntity')
@ -54,8 +59,8 @@ export struct MinePage {
} }
aboutToAppear(): void { aboutToAppear(): void {
this.tabBarModifier.align(Alignment.Start)
this.initObserver(); this.initObserver();
this.getCache()
this.viewModel.userinfo(); this.viewModel.userinfo();
this.viewModel.getDiamondInfo() this.viewModel.getDiamondInfo()
} }
@ -64,45 +69,9 @@ export struct MinePage {
AppUtil.getContext().eventHub.on(EventConstants.MineRefreshEvent, () => { AppUtil.getContext().eventHub.on(EventConstants.MineRefreshEvent, () => {
this.isLogin = LoginManager.isLogin(); this.isLogin = LoginManager.isLogin();
this.viewModel.userinfo(); this.viewModel.userinfo();
this.getCache();
}); });
} }
getCache() {
storageStatistics.getCurrentBundleStats((error: BusinessError, bundleStats: storageStatistics.BundleStats) => {
if (error) {
console.error('getCurrentBundleStats failed with error:' + JSON.stringify(error));
} else {
console.info('getCurrentBundleStats successfully:' + JSON.stringify(bundleStats));
this.cacheSize = bundleStats.cacheSize
}
});
}
// Clear cache
clearCache() {
LoadingDialog.show(this.getUIContext())
let cacheDir = AppUtil.getContext().cacheDir;
fileIo.listFile(cacheDir).then((filenames) => {
for (let i = 0; i < filenames.length; i++) {
let dirPath = cacheDir + '/' + filenames[i];
let isDirectory: boolean = false;
try {
isDirectory = fileIo.statSync(dirPath).isDirectory();
} catch (e) {
console.error(JSON.stringify(e));
}
if (isDirectory) {
fileIo.rmdirSync(dirPath);
} else {
fileIo.unlinkSync(dirPath);
}
}
})
setTimeout(() => { this.getCache() }, 200)
LoadingDialog.dismiss()
}
/** /**
* 跳转客服 * 跳转客服
* @param service * @param service
@ -119,27 +88,20 @@ export struct MinePage {
Stack() { Stack() {
Image($r('app.media.ic_mine_top_bg')) Image($r('app.media.ic_mine_top_bg'))
.width('100%') .width('100%')
.aspectRatio(0.8) .aspectRatio(1.465)
.id('iv_top_bg') .id('iv_top_bg')
Image(this.userinfo?.vip === 3 ? $r('app.media.ic_vip_bg2') : $r('app.media.ic_vip_bg1'))
.width('100%')
.aspectRatio(1.4)
.visibility(this.userinfo?.vip !== 1 ? Visibility.Visible : Visibility.Hidden)
.id('iv_vip_bg')
Column() { Column() {
RelativeContainer() { RelativeContainer() {
Image(StrUtil.isNotEmpty(this.userinfo?.avater) ? this.userinfo?.avater : $r('app.media.ic_default_avatar')) Image(StrUtil.isNotEmpty(this.userinfo?.avater) ? this.userinfo?.avater : $r('app.media.ic_default_avatar'))
.alignRules({ .alignRules({
left: { anchor: '__container__', align: HorizontalAlign.Start }, left: { anchor: '__container__', align: HorizontalAlign.Start }
right: { anchor: '__container__', align: HorizontalAlign.End }
}) })
.margin({ top: 20 }) .margin({left: 16 })
.padding(1) .padding(1)
.borderRadius(45) .borderRadius(28)
.width(90) .width(56)
.height(90) .height(56)
.backgroundColor(Color.White) .backgroundColor(Color.White)
.id('iv_avatar') .id('iv_avatar')
.onClick(() => { .onClick(() => {
@ -151,26 +113,20 @@ export struct MinePage {
} }
}) })
Text('Hi! 快登录') Text('点击登录')
.width(52)
.height(18)
.fontColor(Color.White) .fontColor(Color.White)
.fontSize(12) .fontSize(10)
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
.alignRules({ .alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top }, left: { anchor: 'iv_avatar', align: HorizontalAlign.Start },
left: { anchor: 'iv_avatar', align: HorizontalAlign.End } right: { anchor: 'iv_avatar', align: HorizontalAlign.End },
bottom: { anchor: 'iv_avatar', align: VerticalAlign.Bottom }
}) })
.padding({ .margin({ bottom: -7 })
left: 6, .borderRadius(9)
right: 6, .backgroundColor($r('app.color.color_466afd'))
})
.margin({ left: -25 })
.linearGradient({
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.borderRadius({ topLeft: 6, topRight: 6, bottomRight: 6 })
.width('auto')
.height(24)
.visibility(this.isLogin ? Visibility.None : Visibility.Visible) .visibility(this.isLogin ? Visibility.None : Visibility.Visible)
.id('tv_nologin_tip') .id('tv_nologin_tip')
@ -195,14 +151,14 @@ export struct MinePage {
.id('tv_area') .id('tv_area')
Text(StrUtil.isNotEmpty(this.userinfo?.name) ? this.userinfo?.name : '游客') Text(StrUtil.isNotEmpty(this.userinfo?.name) ? this.userinfo?.name : '游客')
.fontColor($r('app.color.color_90ffffff')) .fontColor($r('app.color.color_212226'))
.fontSize(18) .fontSize(17)
.fontWeight(FontWeight.Medium) .fontWeight(FontWeight.Medium)
.margin({ top: 12 }) .margin({ left: 12, top: 4 })
.alignRules({ .alignRules({
top: { anchor: 'iv_avatar', align: VerticalAlign.Bottom }, top: { anchor: 'iv_avatar', align: VerticalAlign.Top },
left: { anchor: 'iv_avatar', align: HorizontalAlign.Start }, left: { anchor: 'iv_avatar', align: HorizontalAlign.End },
right: { anchor: 'iv_avatar', align: HorizontalAlign.End } bottom: { anchor: 'tv_user_id', align: VerticalAlign.Top}
}) })
.width('auto') .width('auto')
.height('auto') .height('auto')
@ -210,7 +166,7 @@ export struct MinePage {
Row() { Row() {
Text('ID:' + this.userinfo?.user_id) Text('ID:' + this.userinfo?.user_id)
.fontColor($r('app.color.color_999999')) .fontColor('#53555D')
.fontSize(14) .fontSize(14)
.id('tv_user_id') .id('tv_user_id')
Image($r('app.media.ic_copy_id')) Image($r('app.media.ic_copy_id'))
@ -221,164 +177,243 @@ export struct MinePage {
.alignRules({ .alignRules({
top: { anchor: 'tv_username', align: VerticalAlign.Bottom }, top: { anchor: 'tv_username', align: VerticalAlign.Bottom },
left: { anchor: 'tv_username', align: HorizontalAlign.Start }, left: { anchor: 'tv_username', align: HorizontalAlign.Start },
right: { anchor: 'tv_username', align: HorizontalAlign.End } bottom: { anchor: 'iv_avatar', align: VerticalAlign.Bottom }
}) })
.margin({ top: 4 }) .margin({ bottom: 4 })
.width('auto') .width('auto')
.id('layout_copy_id') .id('layout_copy_id')
.onClick(() => { .onClick(() => {
if (StrUtil.isNotEmpty(this.userinfo?.user_id)) { if (StrUtil.isNotEmpty(this.userinfo?.user_id)) {
PasteboardUtil.setDataTextSync(this.userinfo?.user_id!!) PasteboardUtil.setDataTextSync(`${this.userinfo?.user_id!!}|${Constants.APP_ID}`)
ToastUtils.show('复制成功') ToastUtils.show('复制成功')
} }
}) })
Image($r('app.media.ic_scan')).width(24).height(24) Row() {
.alignRules({ Image($r('app.media.ic_mine_setting')).width(26).height(26)
top: {anchor: '__container__', align: VerticalAlign.Top}, .onClick(() => {
right: {anchor: '__container__', align: HorizontalAlign.End} this.getUIContext().getRouter().pushUrl({url: RouterUrls.SETTING_PAGE});
}) EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_SYSTEM_SETTING)
.margin({ right: 20 }) })
.onClick(() => {
try {
ScanUtil.startScanForResult({ scanTypes: [scanCore.ScanType.QR_CODE], enableMultiMode: true, enableAlbum: true})
.then((result) => {
const code = result.originalValue
const array = code.split('-')
if (code.length === 36 && array.length === 5) {
this.getUIContext().getRouter().pushUrl({ url: RouterUrls.QRCODE_LOGIN_PAGE, params: { code: code }})
} else {
ToastUtils.show('无效二维码')
}
})
.catch(() => {
ToastUtils.show('此设备不支持二维码扫描')
})
} catch (e) {
ToastUtils.show('此设备不支持二维码扫描')
}
})
}
.margin({ top: 70 })
.width('100%')
.height(180)
.id('layout_userinfo')
Row() {
Column() {
Text(FormatUtil.getFormatFileSize(NumberUtil.toNumber(this.userinfo?.month_download_size!!)))
.fontColor($r('app.color.color_90ffffff'))
.fontSize(18)
.fontFamily('ddp500m')
.id('tv_month_size')
Text('本月流量')
.fontColor($r("app.color.color_50ffffff"))
.fontSize(12)
.margin({ top: 4 })
} }
.layoutWeight(1) .alignRules({
.onClick(() => { bottom: {anchor: 'iv_avatar', align: VerticalAlign.Top},
this.getUIContext().getRouter().pushUrl({url: RouterUrls.DOWNLOAD_HISTORY_PAGE}) right: {anchor: '__container__', align: HorizontalAlign.End}
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_DOWNLOAD_HISTORY)
}) })
.margin({ right: 20 })
Divider().vertical(true).color('#1affffff').strokeWidth(1).height(26)
Column() {
Text(this.userinfo?.month_download_count)
.fontColor($r('app.color.color_90ffffff'))
.fontSize(18)
.fontFamily('ddp500m')
.id('tv_month_count')
Text('本月下载')
.fontColor($r("app.color.color_50ffffff"))
.fontSize(12)
.margin({ top: 4 })
}
.layoutWeight(1)
.onClick(() => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.DOWNLOAD_HISTORY_PAGE})
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_DOWNLOAD_HISTORY)
})
Divider().vertical(true).color('#1affffff').strokeWidth(1).height(26)
Column() {
Text('0')
.fontColor($r('app.color.color_90ffffff'))
.fontSize(18)
.fontFamily('ddp500m')
.id('tv_task_count')
Text('下载任务')
.fontColor($r("app.color.color_50ffffff"))
.fontSize(12)
.margin({ top: 4 })
}
.layoutWeight(1)
.visibility(Visibility.None)
} }
.padding({ top: 9, bottom: 9 }) .margin({ top: 100 })
.width('100%') .width('100%')
.height('auto') .height(70)
.id('layout_download_info')
RelativeContainer() { RelativeContainer() {
Text(this.userinfo?.vip === 1 ? '素材魔方·会员' : this.userinfo?.vip_name) Stack() {
.fontColor($r('app.color.color_90ffffff')) Image($r('app.media.ic_mine_vip_bg')).width('100%').aspectRatio(5.01)
.fontSize(18) }
.fontWeight(FontWeight.Bold) .padding({left: 12, right: 12})
.fontFamily('almmsht') .alignRules({
.id('tv_vip_name') bottom: { anchor: '__container__', align: VerticalAlign.Bottom}
.alignRules({ })
bottom: { anchor: '__container__', align: VerticalAlign.Center } .id('layout_bg')
})
Text(this.userinfo?.vip === 1 ? '点击成为会员解锁所有功能' : this.userinfo?.vip === 2 ? this.userinfo.vip_expire + ' 会员到期' : '享受永久会员专属权益') Image($r('app.media.ic_mine_vip_tag')).width(74).height(69).id('iv_vip_tag')
.fontColor($r('app.color.color_60ffffff'))
.fontSize(14)
.margin({ top: 8 })
.id('tv_vip_expire')
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Center }
})
Button(this.userinfo?.vip === 1 ? '立即开通' : this.userinfo?.vip === 2 ? '立即续费' : '永久会员' , { type: ButtonType.Capsule, stateEffect: true }) Column() {
.fontColor('#291966') Row() {
.fontSize(14) Text(this.userinfo?.vip === 1 ? '会员办理' : this.userinfo?.vip_name)
.fontWeight(FontWeight.Medium) .fontSize(18)
.alignRules({ .fontFamily('ysbth')
top: { anchor: '__container__', align: VerticalAlign.Top }, .blendMode(BlendMode.DST_IN, BlendApplyType.OFFSCREEN)
bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, }
right: { anchor: '__container__', align: HorizontalAlign.End }
})
.linearGradient({ .linearGradient({
colors: [['#D4C4F9', 0.0], ['#E9E6F9', 1.0]], direction: GradientDirection.Right,
direction: GradientDirection.Top colors: [['#FBF1DE', 0.0], ['#C59F78', 1.0]]
})
.width(88)
.height(32)
.visibility(this.userinfo?.vip === 3 ? Visibility.None : Visibility.Visible)
.id('btn_to_vip')
.onClick(() => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.VIP_PAGE, params: {origin: 'center'}})
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_MEMBER_RECHARGE, 'center')
}) })
.blendMode(BlendMode.SRC_OVER, BlendApplyType.OFFSCREEN)
Text(this.userinfo?.vip === 1 ? '开通会员解锁所有功能' : this.userinfo?.vip === 2 ? this.userinfo.vip_expire + ' 会员到期' : '享受永久会员专属权益')
.fontColor('#FBF1DE')
.fontSize(13)
}
.alignRules({
left: { anchor: 'iv_vip_tag', align: HorizontalAlign.End},
top: { anchor: 'layout_bg', align: VerticalAlign.Top },
bottom: { anchor: 'layout_bg', align: VerticalAlign.Bottom }
})
.margin({bottom: 12})
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
Button({ type: ButtonType.Capsule, stateEffect: true }) {
Row() {
Text(this.userinfo?.vip === 1 ? '开通会员' : this.userinfo?.vip === 2 ? '立即续费' : '永久会员').fontColor('#8F6131').fontSize(14).fontWeight(FontWeight.Medium)
Image($r('app.media.ic_mine_vip_arrow')).width(14).height(14).margin({left: 1})
}
}
.alignRules({
top: { anchor: 'layout_bg', align: VerticalAlign.Top },
bottom: { anchor: 'layout_bg', align: VerticalAlign.Bottom },
right: { anchor: 'layout_bg', align: HorizontalAlign.End }
})
.linearGradient({
colors: [['#FFCD9E', 0.0], ['#FFEFDE', 1.0]],
direction: GradientDirection.Top
})
.width('auto')
.height(30)
.margin({right: 28, bottom: 12})
.padding({left: 9, top: 6, right: 7, bottom: 6})
.visibility(this.userinfo?.vip === 3 ? Visibility.None : Visibility.Visible)
.id('btn_to_vip')
.onClick(() => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.VIP_PAGE, params: {origin: 'center'}})
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_MEMBER_RECHARGE, 'center')
})
} }
.margin({ left: 16, top: 10, right: 16 }) .width('100%')
.padding({ left: 16, right: 16 }) .aspectRatio(4.464)
.backgroundImage($r('app.media.ic_mine_vip_bg'))
.backgroundImageSize({ width: '100%' }) Stack({alignContent: Alignment.Top}) {
.aspectRatio(4.28) Row()
.id('layout_vip_info') .width('100%')
.aspectRatio(3.348)
.linearGradient({
colors: [['#FFFFFF', 0.0], ['#F3F5F9', 1.0]],
direction: GradientDirection.Bottom
})
.borderRadius({ topLeft: 10, topRight: 10})
Column() {
Text('常用工具').fontColor($r('app.color.color_212226')).fontSize(16).fontWeight(FontWeight.Medium).margin({top: 20})
Grid() {
ForEach(mineMenuList().convertToArray(), (item: MenuEntity) => {
GridItem() {
Column() {
Image(item.icon)
.width(26)
.height(26)
Text(item.title)
.fontColor($r('app.color.color_212226'))
.fontSize(12)
.margin({ top: 8 })
}
.alignItems(HorizontalAlign.Center)
}
.width('25%')
.onClick(() => {
switch (item.alias) {
case 'history': {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.DOWNLOAD_HISTORY_PAGE});
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_DOWNLOAD_HISTORY, 'center')
break
}
case 'diamond': {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.RECHARGE_DIAMOND_PAGE});
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_RECHARGE_DIAMOND, 'center')
break
}
case 'feedback': {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.FEEDBACK_PAGE});
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_FEEDBACK, 'center')
break
}
case 'service': {
if (!WXApi.isWXAppInstalled()) {
ToastUtils.show('未安装微信客户端,请先下载安装微信客户端');
return;
}
this.viewModel.getWxService()
break
}
}
})
})
}
.maxCount(4)
.layoutDirection(GridDirection.Row)
.backgroundColor(Color.White)
.borderRadius(8)
.padding({top: 16, bottom: 16})
.margin({top: 10})
}
.width('100%')
.padding({left: 12, right: 12})
.alignItems(HorizontalAlign.Start)
}
.margin({top: -12})
Column() { Column() {
Row() {
Text('我的相册')
.fontColor($r('app.color.color_212226'))
.fontSize(16)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Start)
.layoutWeight(1)
Text(this.currentIndex === 2 ? '文件管理/我的手机/Download/素材魔方' : '文件管理/我的手机/Download/图库')
.fontColor($r('app.color.color_999999'))
.fontSize(12)
.onClick(() => {
})
}
.margin({left:12, top: 27, right: 12})
Stack({alignContent: Alignment.TopEnd}) {
Tabs({ barPosition: BarPosition.Start, controller: this.tabController, barModifier: this.tabBarModifier }) {
TabContent() {
VideoRecordPage()
}
.tabBar(this.tabBuilder(this.titles[0], 0))
TabContent() {
ImageRecordPage()
}
.tabBar(this.tabBuilder(this.titles[1], 1))
TabContent() {
AudioRecordPage()
}
.tabBar(this.tabBuilder(this.titles[2], 2))
}
.scrollable(false)
.barMode(BarMode.Scrollable)
.onTabBarClick((index) => {
this.currentIndex = index;
})
Row() {
Image($r('app.media.ic_clear_record')).width(11).height(13)
Text('全部清空').fontColor($r('app.color.color_999999')).fontSize(12).margin({left: 4})
}
.height(50)
.margin({ top: 3, right: 16 })
.onClick(() => {
switch (this.currentIndex) {
case 0: {
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.VIDEO, MediaAction.CLEAR)
}
case 1: {
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.IMAGE, MediaAction.CLEAR)
}
case 2: {
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.AUDIO, MediaAction.CLEAR)
}
}
})
.visibility(this.currentIndex === 2 ? Visibility.Visible : Visibility.None)
}
}
.width('100%')
.height('100%')
/*Column() {
TextItemView({ image: $r("app.media.ic_mine_icon1"), leftText: '免单挑战' }) TextItemView({ image: $r("app.media.ic_mine_icon1"), leftText: '免单挑战' })
.height(60) .height(60)
.id('item_challenge') .id('item_challenge')
.visibility(/*this.showChallenge ? Visibility.Visible : Visibility.None*/Visibility.None) .visibility(*//*this.showChallenge ? Visibility.Visible : Visibility.None*//*Visibility.None)
TextItemView({ image: $r("app.media.ic_mine_icon2"), leftText: '兑换钻石' }) TextItemView({ image: $r("app.media.ic_mine_icon2"), leftText: '兑换钻石' })
.height(60) .height(60)
.id('item_diamond') .id('item_diamond')
@ -392,7 +427,7 @@ export struct MinePage {
TextItemView({ image: $r("app.media.ic_mine_icon4"), leftText: '分享APP' }) TextItemView({ image: $r("app.media.ic_mine_icon4"), leftText: '分享APP' })
.height(60) .height(60)
.id('item_share') .id('item_share')
.visibility(/*this.showShare ? Visibility.Visible : Visibility.None*/Visibility.None) .visibility(*//*this.showShare ? Visibility.Visible : Visibility.None*//*Visibility.None)
TextItemView({ image: $r("app.media.ic_mine_icon5"), leftText: '联系客服' }).height(60).id('item_service') TextItemView({ image: $r("app.media.ic_mine_icon5"), leftText: '联系客服' }).height(60).id('item_service')
.onClick(() => { .onClick(() => {
if (!WXApi.isWXAppInstalled()) { if (!WXApi.isWXAppInstalled()) {
@ -419,8 +454,7 @@ export struct MinePage {
} }
.margin({ top: 16, left: 16, right: 16 }) .margin({ top: 16, left: 16, right: 16 })
.backgroundColor('#1E1D24') .backgroundColor('#1E1D24')
.borderRadius(8) .borderRadius(8)*/
.id('layout_menu')
Blank().layoutWeight(1) Blank().layoutWeight(1)
} }
@ -433,4 +467,20 @@ export struct MinePage {
.height('100%') .height('100%')
.backgroundColor($r('app.color.window_background')) .backgroundColor($r('app.color.window_background'))
} }
@Builder
tabBuilder(title: string, targetIndex: number) {
Stack() {
if (this.currentIndex === targetIndex) {
Image($r('app.media.ic_tab_indicator')).width(27).height(11).margin({ top: 13 })
}
Text(title)
.fontColor(this.currentIndex === targetIndex ? $r("app.color.color_212226") : $r('app.color.color_5c5f6c'))
.fontSize(this.currentIndex === targetIndex ? 16 : 14)
.fontWeight(this.currentIndex === targetIndex ? FontWeight.Medium : FontWeight.Regular)
}
.width('auto')
.height(50)
.margin({ left: targetIndex === 0 ? 12 : 30 })
}
} }

View File

@ -1,4 +1,4 @@
import { AppUtil } from '@pura/harmony-utils' import { AppUtil, FileUtil } from '@pura/harmony-utils'
import { EventConstants } from '../../../../common/EventConstants' import { EventConstants } from '../../../../common/EventConstants'
import { RouterUrls } from '../../../../common/RouterUrls' import { RouterUrls } from '../../../../common/RouterUrls'
import { TipDialog } from '../../../../dialog/TipDialog' import { TipDialog } from '../../../../dialog/TipDialog'
@ -10,12 +10,18 @@ import { TitleBar } from '../../../../view/TitleBar'
import { SettingsViewModel } from '../../../../viewModel/SettingsViewModel' import { SettingsViewModel } from '../../../../viewModel/SettingsViewModel'
import { router } from '@kit.ArkUI' import { router } from '@kit.ArkUI'
import { EventReportGlobalManager } from '../../../../manager/EventReportGlobalManager' import { EventReportGlobalManager } from '../../../../manager/EventReportGlobalManager'
import { fileIo, storageStatistics } from '@kit.CoreFileKit'
import { BusinessError } from '@kit.BasicServicesKit'
import { LoadingDialog } from '../../../../dialog/LoadingDialog'
import { TextItemView } from '../../../../view/TextItemView'
@Entry @Entry
@ComponentV2 @ComponentV2
struct SettingsPage { struct SettingsPage {
viewModel: SettingsViewModel = new SettingsViewModel(this.getUIContext()); viewModel: SettingsViewModel = new SettingsViewModel(this.getUIContext());
@Local cacheSize: number = 0
@Monitor('viewModel.destroy') @Monitor('viewModel.destroy')
onDestroy(monitor: IMonitor) { onDestroy(monitor: IMonitor) {
EventReportGlobalManager.eventReport(EventConstants.CANCEL_ACCOUNT) EventReportGlobalManager.eventReport(EventConstants.CANCEL_ACCOUNT)
@ -23,6 +29,46 @@ struct SettingsPage {
ToastUtils.show('账户已注销'); ToastUtils.show('账户已注销');
} }
aboutToAppear(): void {
this.getCache()
}
getCache() {
storageStatistics.getCurrentBundleStats((error: BusinessError, bundleStats: storageStatistics.BundleStats) => {
if (error) {
console.error('getCurrentBundleStats failed with error:' + JSON.stringify(error));
} else {
console.info('getCurrentBundleStats successfully:' + JSON.stringify(bundleStats));
this.cacheSize = bundleStats.cacheSize
}
});
}
// Clear cache
clearCache() {
LoadingDialog.show(this.getUIContext())
let cacheDir = AppUtil.getContext().cacheDir;
fileIo.listFile(cacheDir).then((filenames) => {
for (let i = 0; i < filenames.length; i++) {
let dirPath = cacheDir + '/' + filenames[i];
let isDirectory: boolean = false;
try {
isDirectory = fileIo.statSync(dirPath).isDirectory();
} catch (e) {
console.error(JSON.stringify(e));
}
if (isDirectory) {
fileIo.rmdirSync(dirPath);
} else {
fileIo.unlinkSync(dirPath);
}
}
})
setTimeout(() => { this.getCache() }, 200)
LoadingDialog.dismiss()
}
logout() { logout() {
LoginManager.saveLastUserInfo(LoginManager.getUserInfo()!!); LoginManager.saveLastUserInfo(LoginManager.getUserInfo()!!);
ConfigManager.saveBindWxPlaybackHelper(false); ConfigManager.saveBindWxPlaybackHelper(false);
@ -34,30 +80,42 @@ struct SettingsPage {
build() { build() {
Column() { Column() {
TitleBar({ title: '设置' }).width('100%') TitleBar({ title: '设置' }).width('100%').backgroundColor(Color.White)
Scroll() { Scroll() {
Column() { Column() {
TextItemChildView({ text: '意见反馈' }).height(60).margin({ left: 16, right: 16 }) TextItemChildView({ text: '账号绑定' }).height(60).padding({ left: 16, right: 16 })
.onClick(() => { .backgroundColor(Color.White)
this.getUIContext().getRouter().pushUrl({url: RouterUrls.FEEDBACK_PAGE})
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_FEEDBACK, 'center')
})
TextItemChildView({ text: '账号绑定' }).height(60).margin({ left: 16, right: 16 })
.onClick(() => { .onClick(() => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.BIND_ACCOUNT_PAGE}); this.getUIContext().getRouter().pushUrl({url: RouterUrls.BIND_ACCOUNT_PAGE});
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_ACCOUNT_BIND) EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_ACCOUNT_BIND)
}) })
TextItemChildView({ text: '账号管理' }).height(60).margin({ left: 16, right: 16 }) TextItemChildView({ text: '账号管理' }).height(60).padding({ left: 16, right: 16 })
.backgroundColor(Color.White)
.onClick(() => { .onClick(() => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.MANAGE_ACCOUNT_PAGE}); this.getUIContext().getRouter().pushUrl({url: RouterUrls.MANAGE_ACCOUNT_PAGE});
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_ACCOUNT_MANAGE) EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_ACCOUNT_MANAGE)
}) })
TextItemChildView({ text: '关于我们' }).height(60).margin({ left: 16, right: 16 }) Divider().strokeWidth(10).color($r('app.color.color_eff2f7'))
TextItemChildView({ text: '清除缓存', rightText: FileUtil.getFormatFileSize(this.cacheSize) }).height(60)
.backgroundColor(Color.White)
.padding({ left: 16, right: 16 })
.onClick(() => {
if (this.cacheSize > 0) {
TipDialog.show(this.getUIContext(), {title: '提示', content: '确定清除缓存?', callback: {
confirm: () => {
this.clearCache()
}
}})
}
})
TextItemChildView({ text: '关于我们' }).height(60).padding({ left: 16, right: 16 })
.backgroundColor(Color.White)
.onClick(() => { .onClick(() => {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.ABOUT_PAGE}); this.getUIContext().getRouter().pushUrl({url: RouterUrls.ABOUT_PAGE});
EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_ABOUT_US) EventReportGlobalManager.eventReport(EventConstants.JUMP_TO_ABOUT_US)
}) })
TextItemChildView({ text: '注销账号' }).height(60).margin({ left: 16, right: 16 }) TextItemChildView({ text: '注销账号' }).height(60).padding({ left: 16, right: 16 })
.backgroundColor(Color.White)
.onClick(() => { .onClick(() => {
TipDialog.show(this.getUIContext(), {title: '提示', content: '为了您的账户安全,注销账户后将会永久清除与该账户相关的所有信息,服务器不再保存', callback: { TipDialog.show(this.getUIContext(), {title: '提示', content: '为了您的账户安全,注销账户后将会永久清除与该账户相关的所有信息,服务器不再保存', callback: {
confirm: () => { confirm: () => {
@ -77,10 +135,7 @@ struct SettingsPage {
.fontColor(Color.White) .fontColor(Color.White)
.fontSize(15) .fontSize(15)
.fontWeight(FontWeight.Medium) .fontWeight(FontWeight.Medium)
.linearGradient({ .backgroundColor($r('app.color.color_466afd'))
colors: [['#F62C6C', 0.0], ['#FC4F54', 1.0]],
direction: GradientDirection.Right
})
.width('100%') .width('100%')
.height(46) .height(46)
.onClick(() => { .onClick(() => {

View File

@ -12,7 +12,7 @@ struct AboutPage {
TitleBar({ title: '关于' }).width('100%') TitleBar({ title: '关于' }).width('100%')
Image($r('app.media.ic_login_logo')).width(100).height(100).margin({ top: 100 }) Image($r('app.media.ic_login_logo')).width(100).height(100).margin({ top: 100 })
Text($r('app.string.app_name')) Text($r('app.string.app_name'))
.fontColor(Color.White) .fontColor($r('app.color.color_1a1a1a'))
.fontSize(16) .fontSize(16)
.fontWeight(FontWeight.Medium) .fontWeight(FontWeight.Medium)
.margin({ top: 16 }) .margin({ top: 16 })

View File

@ -78,8 +78,8 @@ export struct AudioRecordPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_audio'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无音频' noDataText: '暂无数据'
}) })
} }
} }

View File

@ -93,8 +93,8 @@ export struct ImageRecordPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_image'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无图片' noDataText: '暂无数据'
}) })
} }
} }

View File

@ -1,137 +0,0 @@
import { TitleBar } from '../../../view/TitleBar';
import { ImageRecordPage } from './ImageRecordPage';
import { VideoRecordPage } from './VideoRecordPage';
import { AppUtil } from '@pura/harmony-utils';
import { EventConstants } from '../../../common/EventConstants';
import { MediaAction, MediaType } from '../../../manager/MediaManager';
import { AudioRecordPage } from './AudioRecordPage';
import { CommonModifier } from '@kit.ArkUI';
@ComponentV2
export struct RecordPage {
@Consumer() recordIndex: number = 0;
@Local tabBarModifier: CommonModifier = new CommonModifier()
@Local currentIndex: number = 0;
@Local indicatorLeftMargin: number = 0;
@Local indicatorWidth: number = 0;
@Local tabsWidth: number = 0;
tabController: TabsController = new TabsController();
titles: Array<string> = ['视频', '图片', '音频'];
aboutToAppear(): void {
this.initObserver()
this.tabBarModifier.align(Alignment.Start)
}
initObserver() {
AppUtil.getContext().eventHub.on(EventConstants.MediaActionEvent, (type: MediaType, action: MediaAction) => {
if (action === MediaAction.ADD) {
switch (type) {
case MediaType.VIDEO: {
if (this.currentIndex !== 0) {
this.tabController.changeIndex(0)
this.currentIndex = 0
}
break
}
case MediaType.IMAGE: {
if (this.currentIndex !== 1) {
this.tabController.changeIndex(1)
this.currentIndex = 1
}
break
}
case MediaType.AUDIO: {
if (this.currentIndex !== 2) {
this.tabController.changeIndex(2)
this.currentIndex = 2
}
break
}
}
}
})
}
@Builder
tabBuilder(title: string, tabIndex: number) {
Text(title)
.width('auto')
.height(50)
.fontColor(this.currentIndex === tabIndex ? $r("app.color.color_466afd") : $r('app.color.color_50ffffff'))
.fontSize(this.currentIndex === tabIndex ? 17 : 14)
.fontWeight(this.currentIndex === tabIndex ? FontWeight.Medium : FontWeight.Regular)
.margin({ left: tabIndex === 0 ? 16 : 40 })
}
build() {
Column() {
TitleBar({title: '我的记录', showBack: false})
Stack({alignContent: Alignment.TopEnd}) {
Tabs({ barPosition: BarPosition.Start, controller: this.tabController, barModifier: this.tabBarModifier }) {
TabContent() {
VideoRecordPage()
}
.tabBar(this.tabBuilder(this.titles[0], 0))
TabContent() {
ImageRecordPage()
}
.tabBar(this.tabBuilder(this.titles[1], 1))
TabContent() {
AudioRecordPage()
}
.tabBar(this.tabBuilder(this.titles[2], 2))
}
.scrollable(false)
.barMode(BarMode.Scrollable)
.onTabBarClick((index) => {
this.currentIndex = index;
})
Row() {
Image($r('app.media.ic_clear_record')).width(16).height(16)
Text('全部清空').fontColor($r('app.color.color_80ffffff')).fontSize(12).margin({left: 4})
}
.height(50)
.margin({ top: 3, right: 16 })
.onClick(() => {
switch (this.currentIndex) {
case 0: {
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.VIDEO, MediaAction.CLEAR)
}
case 1: {
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.IMAGE, MediaAction.CLEAR)
}
case 2: {
AppUtil.getContext().eventHub.emit(EventConstants.MediaActionEvent, MediaType.AUDIO, MediaAction.CLEAR)
}
}
})
.visibility(this.currentIndex === 2 ? Visibility.Visible : Visibility.None)
}.layoutWeight(1)
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.window_background'))
}
@Builder
tab(tabName: string, tabIndex: number) {
Row() {
Text(tabName)
.fontSize(this.currentIndex === tabIndex ? 17 : 14)
.fontWeight(this.currentIndex === tabIndex ? FontWeight.Medium : FontWeight.Regular)
.lineHeight(24)
.fontColor(tabIndex === this.currentIndex ? $r("app.color.color_466afd") : $r('app.color.color_50ffffff'))
}
.width('auto')
.height('auto')
.onClick(() => {
this.tabController.changeIndex(tabIndex);
this.currentIndex = tabIndex;
})
}
}

View File

@ -93,8 +93,8 @@ export struct VideoRecordPage {
EmptyView({ EmptyView({
status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA, status: this.mediaList.length > 0 ? PageStatus.GONE : PageStatus.NO_DATA,
noDataImage: $r('app.media.ic_empty_video'), noDataImage: $r('app.media.ic_empty_data'),
noDataText: '暂无视频' noDataText: '暂无数据'
}) })
} }
} }

View File

@ -60,7 +60,7 @@ struct VideoPlayerPage {
build() { build() {
Column() { Column() {
TitleBar().width('100%') TitleBar({isDark: true}).width('100%')
RelativeContainer() { RelativeContainer() {
Video({ Video({
@ -70,7 +70,7 @@ struct VideoPlayerPage {
}) })
.width('100%') .width('100%')
.height('100%') .height('100%')
.backgroundColor($r('app.color.window_background')) .backgroundColor(Color.Black)
.controls(false) // 设置是否显示默认控制条 .controls(false) // 设置是否显示默认控制条
.autoPlay(true) // 设置是否自动播放 .autoPlay(true) // 设置是否自动播放
.loop(false) // 设置是否循环播放 .loop(false) // 设置是否循环播放
@ -204,6 +204,6 @@ struct VideoPlayerPage {
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
.backgroundColor($r('app.color.window_background')) .backgroundColor(Color.Black)
} }
} }

View File

@ -13,20 +13,9 @@ struct WebPage {
@Local url: string = ''; @Local url: string = '';
aboutToAppear(): void { aboutToAppear(): void {
this.windowStage.getMainWindowSync().setWindowSystemBarProperties({
statusBarColor: '#00000000',
statusBarContentColor: '#000000'
});
this.initParams(); this.initParams();
} }
aboutToDisappear(): void {
this.windowStage.getMainWindowSync().setWindowSystemBarProperties({
statusBarColor: '#00000000',
statusBarContentColor: '#ffffff'
});
}
initParams() { initParams() {
const params = this.getUIContext().getRouter().getParams() as Record<string, Object>; const params = this.getUIContext().getRouter().getParams() as Record<string, Object>;
if (params) { if (params) {

View File

@ -13,33 +13,35 @@ export struct EmptyView {
@Param noDataImage: Resource = $r('app.media.ic_empty_data'); @Param noDataImage: Resource = $r('app.media.ic_empty_data');
@Param noDataText: string = '暂无数据'; @Param noDataText: string = '暂无数据';
@Param noDataBtnText: string = '' @Param noDataBtnText: string = ''
@Param noDataBtnIcon?: Resource = undefined
@Param onBtnClick?: () => void = undefined; @Param onBtnClick?: () => void = undefined;
build() { build() {
Stack() { Stack() {
Column() { Column() {
Image(this.noDataImage).width(162).height(162).margin({ top: -50 }) Image(this.noDataImage).width(160).height(160).margin({ top: -50 })
Text(this.noDataText).fontColor($r('app.color.color_999999')).fontSize(12).margin({ top: 10 }) Text(this.noDataText).fontColor($r('app.color.color_999999')).fontSize(12)
Button(this.noDataBtnText) Button({ type: ButtonType.Capsule, stateEffect: true }) {
.height(30) Row() {
.fontColor($r("app.color.color_466afd")) if (this.noDataBtnIcon) {
.fontSize(14) Image(this.noDataBtnIcon).width(22).height(22)
.borderRadius(20)
.borderWidth(1)
.borderColor($r("app.color.color_466afd"))
.backgroundColor(Color.Transparent)
.padding({
left: 10,
right: 10
})
.margin({ top: 24 })
.visibility(StrUtil.isNotEmpty(this.noDataBtnText) ? Visibility.Visible : Visibility.Hidden)
.onClick(() => {
if (this.onBtnClick) {
this.onBtnClick();
} }
}) Text(this.noDataBtnText).fontColor(Color.White).fontSize(16).fontWeight(FontWeight.Medium)
}
}
.height(46)
.backgroundColor($r('app.color.color_466afd'))
.padding({
left: 22,
right: 22
})
.margin({ top: 40 })
.visibility(StrUtil.isNotEmpty(this.noDataBtnText) ? Visibility.Visible : Visibility.Hidden)
.onClick(() => {
if (this.onBtnClick) {
this.onBtnClick();
}
})
}.visibility(this.status === PageStatus.NO_DATA ? Visibility.Visible : Visibility.None) }.visibility(this.status === PageStatus.NO_DATA ? Visibility.Visible : Visibility.None)
Column() { Column() {

View File

@ -1,3 +1,4 @@
import { RouterUrls } from '../common/RouterUrls';
import { AudioMaterial, ImageMaterial, TextMaterial, VideoMaterial } from '../entity/MaterialInfoEntity'; import { AudioMaterial, ImageMaterial, TextMaterial, VideoMaterial } from '../entity/MaterialInfoEntity';
@ComponentV2 @ComponentV2
@ -13,7 +14,7 @@ export struct VideoMaterialItemView {
Image(this.media?.thumb) Image(this.media?.thumb)
.width('100%') .width('100%')
.height('100%') .height('100%')
.borderRadius(6) .borderRadius({topLeft: 10, topRight: 10})
.backgroundColor($r('app.color.color_222222')) .backgroundColor($r('app.color.color_222222'))
.id('iv_thumb') .id('iv_thumb')
@ -26,7 +27,7 @@ export struct VideoMaterialItemView {
}) })
.onClick(() => { .onClick(() => {
if (this.media?.play) { if (this.media?.play) {
this.getUIContext().getRouter().pushUrl({url: RouterUrls.VIDEO_PLAYER_PAGE, params: {uri: this.media.url}})
} }
}) })
@ -40,15 +41,17 @@ export struct VideoMaterialItemView {
.margin({ top: 6, right: 6 }) .margin({ top: 6, right: 6 })
Stack() { Stack() {
Image($r('app.media.ic_delete_material')).height(18).width(18) Image($r('app.media.ic_delete_material')).height(16).width(16)
} }
.width('100%') .width(30)
.height(34) .height(30)
.borderRadius(15)
.backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT })
.alignRules({ .alignRules({
bottom: {anchor: '__container__', align: VerticalAlign.Bottom} top: {anchor: '__container__', align: VerticalAlign.Top},
left: {anchor: '__container__', align: HorizontalAlign.Start}
}) })
.borderRadius({ bottomLeft: 6, bottomRight: 6 }) .margin({top: 6, left: 6})
.backdropBlur(20)
.visibility(this.isWxVideo ? Visibility.Visible : Visibility.None) .visibility(this.isWxVideo ? Visibility.Visible : Visibility.None)
.onClick(() => { .onClick(() => {
if (this.onDelete) { if (this.onDelete) {
@ -59,14 +62,15 @@ export struct VideoMaterialItemView {
Text(this.media?.title) Text(this.media?.title)
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
.fontColor($r('app.color.color_50ffffff')) .fontColor($r('app.color.color_1a1a1a'))
.fontSize(12) .fontSize(12)
.maxLines(2) .maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis }) .textOverflow({ overflow: TextOverflow.Ellipsis })
.ellipsisMode(EllipsisMode.END) .ellipsisMode(EllipsisMode.END)
.margin({ top: 10 }) .padding({left: 8, top: 10, right: 8, bottom: 10})
.visibility(this.isWxVideo ? Visibility.None : Visibility.Visible)
} }
.backgroundColor(Color.White)
.borderRadius(10)
} }
} }
@ -97,15 +101,17 @@ export struct ImageMaterialItemView {
.margin({ top: 6, right: 6 }) .margin({ top: 6, right: 6 })
Stack() { Stack() {
Image($r('app.media.ic_delete_material')).height(18).width(18) Image($r('app.media.ic_delete_material')).height(16).width(16)
} }
.width('100%') .width(30)
.height(34) .height(30)
.borderRadius(15)
.backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.LIGHT })
.alignRules({ .alignRules({
bottom: {anchor: '__container__', align: VerticalAlign.Bottom} top: {anchor: '__container__', align: VerticalAlign.Top},
left: {anchor: '__container__', align: HorizontalAlign.Start}
}) })
.borderRadius({ bottomLeft: 6, bottomRight: 6 }) .margin({top: 6, left: 6})
.backdropBlur(20)
.visibility(this.isWxVideo ? Visibility.Visible : Visibility.None) .visibility(this.isWxVideo ? Visibility.Visible : Visibility.None)
.onClick(() => { .onClick(() => {
if (this.onDelete) { if (this.onDelete) {
@ -125,7 +131,7 @@ export struct AudioMaterialItemView {
Row() { Row() {
Text(this.media?.title) Text(this.media?.title)
.layoutWeight(1) .layoutWeight(1)
.fontColor($r('app.color.color_90ffffff')) .fontColor($r('app.color.color_212226'))
.fontSize(15) .fontSize(15)
.maxLines(2) .maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis }) .textOverflow({ overflow: TextOverflow.Ellipsis })
@ -133,13 +139,13 @@ export struct AudioMaterialItemView {
Image(this.media?.isChecked ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')) Image(this.media?.isChecked ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false'))
.width(18).height(18).margin({ left: 10 }) .width(18).height(18).margin({ left: 10 })
} }
.borderRadius(6) .borderRadius(10)
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 12, left: 12,
top: 16, top: 14,
right: 12, right: 12,
bottom: 16 bottom: 14
}) })
} }
} }
@ -152,19 +158,19 @@ export struct TextMaterialItemView {
Row() { Row() {
Text(this.media?.desc) Text(this.media?.desc)
.layoutWeight(1) .layoutWeight(1)
.fontColor($r('app.color.color_90ffffff')) .fontColor($r('app.color.color_212226'))
.fontSize(14) .fontSize(14)
Image(this.media?.isChecked ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false')) Image(this.media?.isChecked ? $r('app.media.ic_check_true') : $r('app.media.ic_check_false'))
.width(18).height(18).margin({ left: 10 }) .width(18).height(18).margin({ left: 10 })
} }
.borderRadius(6) .borderRadius(10)
.backgroundColor($r('app.color.color_222222')) .backgroundColor(Color.White)
.padding({ .padding({
left: 12, left: 12,
top: 16, top: 14,
right: 12, right: 12,
bottom: 16 bottom: 14
}) })
} }
} }

View File

@ -1,16 +1,22 @@
@ComponentV2 @ComponentV2
export struct TextItemChildView { export struct TextItemChildView {
@Param text: string = ''; @Param text: string = '';
@Param rightText: string = '';
@Param divider: boolean = true; @Param divider: boolean = true;
build() { build() {
Column() { Column() {
Row() { Row() {
Text(this.text) Text(this.text)
.fontColor($r('app.color.color_90ffffff')) .fontColor($r('app.color.color_1a1a1a'))
.fontSize(14) .fontSize(14)
.layoutWeight(1) .layoutWeight(1)
Text(this.rightText)
.fontColor($r('app.color.color_666666'))
.fontSize(15)
.margin({ right: 1 })
Image($r('app.media.ic_arrow_dp16')) Image($r('app.media.ic_arrow_dp16'))
.width(16) .width(16)
.height(16) .height(16)
@ -18,7 +24,7 @@ export struct TextItemChildView {
.layoutWeight(1) .layoutWeight(1)
Divider() Divider()
.color($r('app.color.color_10ffffff')) .color($r('app.color.color_eff2f7'))
.strokeWidth(1) .strokeWidth(1)
.visibility(this.divider ? Visibility.Visible : Visibility.None) .visibility(this.divider ? Visibility.Visible : Visibility.None)
} }

View File

@ -14,13 +14,13 @@ export struct TextItemView {
.visibility(this.image ? Visibility.Visible : Visibility.None) .visibility(this.image ? Visibility.Visible : Visibility.None)
Text(this.leftText) Text(this.leftText)
.fontColor($r('app.color.color_80ffffff')) .fontColor($r('app.color.color_1a1a1a'))
.fontSize(15) .fontSize(15)
.layoutWeight(1) .layoutWeight(1)
.margin({ left: 10 }) .margin({ left: 10 })
Text(this.rightText) Text(this.rightText)
.fontColor(Color.White) .fontColor($r('app.color.color_666666'))
.fontSize(15) .fontSize(15)
.margin({ right: 1 }) .margin({ right: 1 })

View File

@ -6,7 +6,7 @@ import { ToastUtils } from '../utils/ToastUtils';
import { BaseViewModel } from './BaseViewModel'; import { BaseViewModel } from './BaseViewModel';
@ObservedV2 @ObservedV2
export class LinkRecognizeViewModel extends BaseViewModel { export class TakeMaterialViewModel extends BaseViewModel {
@Trace materialInfo?: MaterialInfoEntity; @Trace materialInfo?: MaterialInfoEntity;
@Trace analysisInfo?: MaterialInfoEntity; @Trace analysisInfo?: MaterialInfoEntity;
@Trace permissionInfo?: VipPermissionEntity; @Trace permissionInfo?: VipPermissionEntity;

View File

@ -1,7 +1,7 @@
import { plainToInstance } from 'class-transformer'; import { plainToInstance } from 'class-transformer';
import { VipPermissionEntity } from '../entity/VipPermissionEntity'; import { VipPermissionEntity } from '../entity/VipPermissionEntity';
import { WxServiceEntity } from '../entity/WxServiceEntity';
import { WxVideoEntity } from '../entity/WxVideoEntity'; import { WxVideoEntity } from '../entity/WxVideoEntity';
import { WxVideoServiceEntity } from '../entity/WxVideoServiceEntity';
import { apiService } from '../net/ApiService'; import { apiService } from '../net/ApiService';
import { ToastUtils } from '../utils/ToastUtils'; import { ToastUtils } from '../utils/ToastUtils';
import { BaseViewModel } from './BaseViewModel'; import { BaseViewModel } from './BaseViewModel';
@ -12,13 +12,13 @@ export class WxVideoViewModel extends BaseViewModel {
@Trace deleteVideo?: object; @Trace deleteVideo?: object;
@Trace permissionInfo?: VipPermissionEntity; @Trace permissionInfo?: VipPermissionEntity;
@Trace errorCode: number = 0; @Trace errorCode: number = 0;
@Trace wxService?: WxServiceEntity @Trace wxService?: WxVideoServiceEntity
@Trace wxUserinfo?: object @Trace wxUserinfo?: object
async videoList(scene: string) { async videoList() {
this.showLoading() this.showLoading()
try { try {
const result = await apiService.wxVideoList(scene) const result = await apiService.wxVideoList()
if (result.isSuccess()) { if (result.isSuccess()) {
this.wxVideo = plainToInstance(WxVideoEntity, result.data); this.wxVideo = plainToInstance(WxVideoEntity, result.data);
} else { } else {
@ -81,7 +81,7 @@ export class WxVideoViewModel extends BaseViewModel {
try { try {
const result = await apiService.wxVideoService() const result = await apiService.wxVideoService()
if (result.isSuccess()) { if (result.isSuccess()) {
this.wxService = plainToInstance(WxServiceEntity, result.data) this.wxService = plainToInstance(WxVideoServiceEntity, result.data)
} else { } else {
ToastUtils.show(result.message, true) ToastUtils.show(result.message, true)
} }

View File

@ -40,6 +40,14 @@
"name": "color_1b1b1b", "name": "color_1b1b1b",
"value": "#1B1B1B" "value": "#1B1B1B"
}, },
{
"name": "color_5c5f6c",
"value": "#5C5F6C"
},
{
"name": "color_eff2f7",
"value": "#EFF2F7"
},
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 530 B

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB