douaojie

Merge remote-tracking branch 'origin/main'

Showing 26 changed files with 422 additions and 125 deletions
... ... @@ -59,3 +59,5 @@ export { UmengStats } from "./src/main/ets/umeng/UmengStats"
export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils'
export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck'
export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@tingyun/harmonyos": "file:./src/main/ets/tingyunAPM/tingyun_0.0.6.har",
"@umeng/common": "^1.0.21",
"@umeng/analytics": "^1.0.19"
}
... ...
import { common } from '@kit.AbilityKit';
import tingyun, { LogLevel } from '@tingyun/harmonyos';
export class TingyunAPM {
private static TINGYUN_APP_KEY = "" //TODO:
private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com"
private static logEnable() {
return true
}
//
static initApp(context: common.UIAbilityContext, deviceId?: string) {
tingyun.init({
redirectHost: TingyunAPM.TINGYUN_REDIRECT_HOST,
appKey: TingyunAPM.TINGYUN_APP_KEY,
context: context,
httpEnabled: true,
logLevel: TingyunAPM.logEnable() ? LogLevel.DEBUG : LogLevel.NONE,
// TODO: axios实例对象
// axios:axiosInstance,
network: {
enabled: true,
},
crash: {
enabled: true,
jsCrashEnabled: true,
cppCrashEnabled: true,
},
freeze: {
enabled: true
}
});
if (deviceId) {
tingyun.setUserId(deviceId)
}
tingyun.startNextSession()
}
}
\ No newline at end of file
... ...
import { ToastUtils } from 'wdKit';
import { SPHelper,Logger,ToastUtils } from 'wdKit';
import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { SpConstants } from 'wdConstant/Index';
import { WDShare } from 'wdShare/Index';
const TAG = 'CarderInteraction'
/**
* 卡片 分享、评论、点赞公用组件
*/
@Component
export struct CarderInteraction {
@Prop contentDTO: ContentDTO
@State contentId: string = ''
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
build() {
Row(){
Row(){
... ... @@ -18,7 +29,7 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ToastUtils.showToast('分享为公共方法,待开发', 1000)
this.getContentDetailData()
})
Row(){
Image($r('app.media.CarderInteraction_comment'))
... ... @@ -31,7 +42,7 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ToastUtils.showToast('分享为公共方法,待开发', 1000)
ProcessUtils.processPage(this.contentDTO)
})
Row(){
Image($r('app.media.CarderInteraction_like'))
... ... @@ -44,7 +55,8 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ToastUtils.showToast('分享为公共方法,待开发', 1000)
ProcessUtils.processPage(this.contentDTO)
// ToastUtils.showToast('点赞为公共方法,待开发', 1000)
})
}
.width('100%')
... ... @@ -56,4 +68,45 @@ export struct CarderInteraction {
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
}
/**
* 请求(动态)详情页数据
* */
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType)
this.contentDetailData = data[0];
console.log('动态详情',JSON.stringify(this.contentDetailData))
WDShare.shareContent(this.contentDetailData)
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
this.getInteractDataStatus()
}
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
console.error(TAG, JSON.stringify(this.contentDetailData))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
}
}
... ...
... ... @@ -12,12 +12,13 @@ const TAG = 'Card11Component';
@Component
export struct Card11Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State clicked: boolean = false;
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor($r("app.color.color_222222"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width(CommonConstants.FULL_WIDTH)
... ... @@ -32,6 +33,8 @@ export struct Card11Component {
})
.backgroundColor($r("app.color.white"))
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -13,6 +13,7 @@ const TAG = 'Card12Component';
@Component
export struct Card12Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State clicked: boolean = false;
aboutToAppear(): void {
}
... ... @@ -27,7 +28,7 @@ export struct Card12Component {
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
.margin({ bottom: 8 })
... ... @@ -35,7 +36,7 @@ export struct Card12Component {
.lineHeight(25)
.fontFamily('PingFang SC-Regular')
}
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -45,6 +46,7 @@ export struct Card12Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -15,6 +15,7 @@ const TAG = 'Card14Component';
export struct Card14Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -31,7 +32,7 @@ export struct Card14Component {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.lineHeight(25)
.fontFamily('PingFang SC-Regular')
... ... @@ -52,7 +53,7 @@ export struct Card14Component {
.width(CommonConstants.FULL_WIDTH)
.margin({ bottom: 8 })
.height(75)
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
... ... @@ -63,6 +64,7 @@ export struct Card14Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -19,6 +19,7 @@ const TAG: string = 'Card15Component';
export struct Card15Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -33,7 +34,7 @@ export struct Card15Component {
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
.margin({ bottom: 8 })
... ... @@ -51,7 +52,7 @@ export struct Card15Component {
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.alignContent(Alignment.BottomEnd)
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -61,6 +62,7 @@ export struct Card15Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -20,6 +20,7 @@ interface fullColumnImgUrlItem {
export struct Card16Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -35,7 +36,7 @@ export struct Card16Component {
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
.margin({ bottom: 8 })
... ... @@ -52,7 +53,7 @@ export struct Card16Component {
})
}
}
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -62,6 +63,7 @@ export struct Card16Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -17,6 +17,7 @@ export struct Card17Component {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -28,7 +29,7 @@ export struct Card17Component {
Text(this.contentDTO.newsTitle)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.lineHeight(25)
.maxLines(3)
.width(CommonConstants.FULL_WIDTH)
... ... @@ -79,6 +80,7 @@ export struct Card17Component {
}
.width(CommonConstants.FULL_WIDTH)
.onClick((event: ClickEvent) => {
this.clicked = true;
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ...
... ... @@ -14,6 +14,7 @@ const TAG = 'Card19Component';
export struct Card19Component {
@State contentDTO: ContentDTO = {
} as ContentDTO
@State clicked: boolean = false;
build() {
Column() {
... ... @@ -23,11 +24,12 @@ export struct Card19Component {
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.margin({ bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ... @@ -45,7 +47,7 @@ export struct Card19Component {
})
ProcessUtils.gotoMultiPictureListPage(photoList,0)
})
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -55,6 +57,7 @@ export struct Card19Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ... @@ -138,12 +141,12 @@ struct createImg {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
// .height(172)
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
Image(this.loadImg ? item.fullUrl : '')
// .width('100%')
.width('100%')
.height(305)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
... ... @@ -158,6 +161,7 @@ struct createImg {
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.shadow({radius: 4, color: 0xc3cbd5, offsetX: 4, offsetY: 4})
}
.width(48)
.padding({bottom: 9})
... ...
... ... @@ -15,6 +15,7 @@ const TAG = 'Card20Component';
export struct Card20Component {
@State contentDTO: ContentDTO = {
} as ContentDTO;
@State clicked: boolean = false;
aboutToAppear(): void {
}
... ... @@ -27,7 +28,7 @@ export struct Card20Component {
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
.margin({ bottom: 8 })
... ... @@ -36,7 +37,7 @@ export struct Card20Component {
if (this.contentDTO.fullColumnImgUrls[0]) {
createImg({ contentDTO: this.contentDTO })
}
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -46,6 +47,7 @@ export struct Card20Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -15,6 +15,7 @@ const TAG: string = 'Card6Component-Card13Component';
export struct Card21Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -29,7 +30,7 @@ export struct Card21Component {
GridItem() {
Text(`${this.contentDTO.newsTitle}`)
.fontSize($r('app.float.selected_text_size'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.maxLines(4)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ... @@ -50,10 +51,11 @@ export struct Card21Component {
}
.columnsTemplate('2fr 1fr')
.maxCount(1)
CarderInteraction()
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
.padding({
... ...
... ... @@ -20,6 +20,7 @@ const TAG: string = 'Card2Component';
export struct Card2Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -35,7 +36,7 @@ export struct Card2Component {
}
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
... ... @@ -73,6 +74,7 @@ export struct Card2Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -10,22 +10,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
@Component
export struct Card3Component {
@State contentDTO: ContentDTO = {
// appStyle: '3',
// channelId: '2002',
// newsTitle: '习近平向斯洛伐克当选总统佩',
// objectId: '30044351686',
// objectType: '8',
// publishTime: '1712967589000',
// relId: '500005307414',
// relType: '1',
// source: '新华社',
} as ContentDTO;
@State clicked: boolean = false;
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor($r("app.color.color_222222"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
... ... @@ -38,6 +30,7 @@ export struct Card3Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -17,6 +17,8 @@ const TAG: string = 'Card4Component';
export struct Card4Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -29,7 +31,7 @@ export struct Card4Component {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
//三图
... ... @@ -67,6 +69,7 @@ export struct Card4Component {
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
... ...
... ... @@ -14,6 +14,7 @@ export struct Card5Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State titleShowPolicy: number | string = 1
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -64,6 +65,7 @@ export struct Card5Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
... ...
... ... @@ -15,6 +15,7 @@ const TAG: string = 'Card6Component-Card13Component';
export struct Card6Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -40,15 +41,14 @@ export struct Card6Component {
}
Text(`${this.contentDTO.newsTitle}`)
.fontColor(this.clicked ? 0x848484 : 0x222222)
.fontSize(16)
.fontWeight(FontWeight.Normal)
.maxLines(3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.textIndent(
this.contentDTO.newTags.length < 5 && this.contentDTO.newTags.length > 2 ?
60 : this.contentDTO.newTags.length != 0 && this.contentDTO.newTags.length < 3 ?
30 : 0)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 :
this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length < 3 ? 30 : 0)
}.alignContent(Alignment.TopStart)
}.height("80%")
... ... @@ -73,6 +73,7 @@ export struct Card6Component {
.alignContent(Alignment.BottomEnd)
}
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
.padding({
... ...
... ... @@ -14,6 +14,7 @@ const TAG: string = 'Card9Component';
export struct Card9Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
@State clicked: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -24,6 +25,7 @@ export struct Card9Component {
// 顶部标题,最多两行
if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontColor(this.clicked ? 0x848484 : 0x222222)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontWeight(600)
... ... @@ -81,6 +83,7 @@ export struct Card9Component {
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -49,9 +49,12 @@ export struct AccountAndSecurityLayout {
confirmDialogController: CustomDialogController = new CustomDialogController({
builder: ConfirmLogoutDialog({
cancel: () => {
},
tipShow:false,
title:"确认退出登录吗?",
leftText:"确认",
leftTextColor:$r('app.color.color_648DF2'),
rightText:"取消",
cancelIsLeft:false,
confirm: () => {
this.logout()
}
... ... @@ -213,17 +216,6 @@ export struct AccountAndSecurityLayout {
Column() {
Button('退出登录',{ stateEffect: true ,type: ButtonType.Normal}).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').borderRadius('8lpx').onClick(()=>{
this.confirmDialogController.open()
// AlertDialog.show({
// title: '🥟id : ' + "button",
// message: '标题:' + '退出登录',
// confirm: {
// value: "OK",
// action: () => {
//
// },
// }
// })
})
}
}
... ...
... ... @@ -2,6 +2,17 @@
@CustomDialog
export struct ConfirmLogoutDialog {
@State title: string = "标题"
@State titleShow: boolean = true
@State tipValue: string ="提示文字"
@State tipShow: boolean = true
@State cancelIsLeft :boolean = true//取消是否在左边
@State leftText: string = "取消"
@State rightText: string = "确认"
@State leftTextColor: Resource = $r('app.color.color_333333')
@State rightTextColor: Resource = $r('app.color.color_648DF2')
controller: CustomDialogController
cancel: () => void = () => {
}
... ... @@ -10,51 +21,78 @@ export struct ConfirmLogoutDialog {
build() {
Column() {
Text("确认退出登录吗?")
.fontColor("#222222")
.fontSize(18)
Column(){
if(this.titleShow){
Text(this.title)
.fontSize("32lpx")
.fontColor($r('app.color.color_333333'))
.lineHeight('50lpx')
.fontWeight(600)
}
if(this.tipShow){
Text(this.tipValue)
.margin({ top:this.titleShow?"10lpx":"0lpx" })
.fontSize("27lpx")
.fontWeight(400)
.lineHeight('38lpx')
.fontColor($r('app.color.color_999999'))
}
}.padding({top:"48lpx",bottom:"48lpx"})
.alignItems(HorizontalAlign.Center)
Divider()
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp')
Row() {
Text('确认')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.strokeWidth('1lpx')
.height('1lpx')
.color($r('app.color.color_EEEEEE'))
Row(){
Text(this.leftText)
.fontSize('35lpx')
.fontWeight(400)
.fontColor(this.leftTextColor)
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
if (this.controller != undefined){
if(this.cancelIsLeft){
this.controller.close()
this.cancel()
}else{
this.controller.close()
this.confirm()
}
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('取消')
.fontSize(16)
.fontColor("#648DF2")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
}).layoutWeight(1)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
Divider()
.width("1lpx")
.strokeWidth('1lpx')
.vertical(true)
.height('92lpx')
.color($r('app.color.color_EEEEEE'))
Text(this.rightText)
.fontSize('35lpx')
.textAlign(TextAlign.Center)
.fontWeight(400)
.fontColor(this.rightTextColor)
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
if (this.controller != undefined) {
if(this.cancelIsLeft){
this.controller.close()
this.confirm()
}else{
this.controller.close()
this.cancel()
}
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(110).backgroundColor(Color.White).borderRadius(6).width('74%')
}).layoutWeight(1)
}
.alignItems(VerticalAlign.Center)
.height('96lpx')
}.borderRadius(10)
.width("518lpx")
.backgroundColor("#FFF")
}
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@ import { LiveModel } from '../../viewmodel/LiveModel'
@Component
export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
@State compDTO: CompDTO = {} as CompDTO
@State clicked: boolean = false;
build() {
Column() {
... ... @@ -18,7 +19,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
.margin({ right: 4 })
Text(this.compDTO.objectTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.fontWeight(600)
}
... ... @@ -63,6 +64,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick(() => {
this.clicked = true;
this.gotoLive(this.compDTO?.operDataList[0])
})
}
... ...
... ... @@ -20,40 +20,15 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
import { LoginModule } from 'wdLogin/src/main/ets/LoginModule';
import { ConfigurationConstant } from '@kit.AbilityKit';
import { WDPushNotificationManager } from 'wdHwAbility/Index';
import { StartupManager } from '../startupmanager/StartupManager';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
UmengStats.preInit(this.context)
SPHelper.init(this.context);
StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context)
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
// mPaaS 初始化
MpaasUtils.initApp(this.context)
registerRouter();
LoginModule.startup()
NetworkManager.getInstance().init()
WDHttp.initHttpHeader()
const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string
if (StringUtils.isNotEmpty(spHostUrl)) {
HostManager.changeHost(spHostUrl as HostEnum)
}
// 还没深色模式需求,暂直接不跟随系统。
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
// 注册监听网络连接
EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => {
let type: NetworkType | null = null
if (str) {
type = JSON.parse(str) as NetworkType
}
Logger.info('network connected: ' + type?.toString())
}))
// 注册监听网络断开
EmitterUtils.receiveEvent(EmitterEventId.NETWORK_DISCONNECTED, (() => {
Logger.info('network disconnected')
}))
WDPushNotificationManager.getInstance().onWant(want)
}
// App活着情况下,点击推送通知进入
... ... @@ -63,7 +38,7 @@ export default class EntryAbility extends UIAbility {
onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
NetworkManager.getInstance().release()
StartupManager.sharedInstance().appOnDestory()
}
onWindowStageCreate(windowStage: window.WindowStage): void {
... ...
... ... @@ -14,6 +14,7 @@ import LaunchDataModel from '../viewModel/LaunchDataModel'
import { Logger, SPHelper, UmengStats } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { TrackingModule } from 'wdTracking/Index'
import { StartupManager } from '../../startupmanager/StartupManager'
@Entry
@Component
... ... @@ -45,10 +46,9 @@ struct LaunchPage {
}
onConfirm() {
UmengStats.initAfterAgreeProtocol()
TrackingModule.startup(getContext(this) as common.UIAbilityContext)
// Save privacy agreement status.
this.saveIsPrivacy();
StartupManager.sharedInstance().appAgreedProtocol()
//跳转引导页
this.jumpToGuidePage();
//同意隐私协议后请求启动页相关数据
... ... @@ -98,8 +98,7 @@ struct LaunchPage {
// }
} else {
UmengStats.initAfterAgreeProtocol()
TrackingModule.startup(getContext(this) as common.UIAbilityContext)
StartupManager.sharedInstance().appAgreedProtocol()
//需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页
//获取本地存储的启动页数据
... ...
import { AbilityConstant, common, Want } from '@kit.AbilityKit'
import { WDPushNotificationManager } from 'wdHwAbility/Index'
import { DeviceUtil,
EmitterEventId,
EmitterUtils,
Logger,
MpaasUtils, NetworkManager,
NetworkType,
SPHelper,
StringUtils,
TingyunAPM,
UmengStats } from 'wdKit/Index'
import { LoginModule } from 'wdLogin/Index'
import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index'
import { registerRouter } from 'wdRouter/Index'
import { TrackingModule } from 'wdTracking/Index'
import { JSON } from '@kit.ArkTS'
const TAG = "[StartupManager]"
/// 启动任务管理类
export class StartupManager {
private context?: common.UIAbilityContext
private static _manger?: StartupManager
static sharedInstance(): StartupManager {
if (!StartupManager._manger) {
StartupManager._manger = new StartupManager()
}
return StartupManager._manger
}
// App启动
appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) {
Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`)
this.context = context
// KV存储
SPHelper.init(context);
// 路由注册
registerRouter();
// 网络模块
NetworkManager.getInstance().init()
// App环境
const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string
if (StringUtils.isNotEmpty(spHostUrl)) {
HostManager.changeHost(spHostUrl as HostEnum)
}
// 友盟预初始化
this.preInitUmentStat()
// 通知栏点击后启动
WDPushNotificationManager.getInstance().onWant(want)
Logger.debug(TAG, "App onCreate: finised")
}
appOnDestory() {
Logger.debug(TAG, "App onDestory")
NetworkManager.getInstance().release()
}
// 同意隐私协议之后,立即执行必要初始化
appAgreedProtocol() {
Logger.debug(TAG, "App 已同意隐私等协议,开始必要初始化")
this.initCheckDeviceId()
this.initMpaas()
this.initSensorData()
this.initTingyun()
this.initNetwork()
this.initGeTuiPush()
this.initUmengStat()
this.initLocation()
this.initAuthLogin()
Logger.debug(TAG, "App 必要初始化完成")
}
// 到达主页后,初始化非必须部分
appReachMainPage() : Promise<void> {
return new Promise((resolve) => {
Logger.debug(TAG, "App 进入首页,开始其他任务初始化")
//TODO:
resolve()
})
}
// mPaaS 初始化,检测升级用
private initMpaas() {
Logger.debug(TAG, "App mPaaS初始化")
MpaasUtils.initApp(this.context!)
}
private initTingyun() {
// 暂时不能用,不初始化
// Logger.debug(TAG, "App tingyunAPM 初始化")
// TingyunAPM.initApp(this.context!, DeviceUtil.clientId())
}
private initSensorData() {
Logger.debug(TAG, "App 神策埋点 初始化")
TrackingModule.startup(this.context!)
}
private preInitUmentStat() {
UmengStats.preInit(this.context!)
}
private initUmengStat() {
Logger.debug(TAG, "App 友盟统计 初始化")
UmengStats.initAfterAgreeProtocol()
}
private initGeTuiPush() {
// Logger.debug(TAG, "App 初始化")
}
private initLocation() {
// Logger.debug(TAG, "App 初始化")
}
private initNetwork() {
Logger.debug(TAG, "App 网络 初始化")
WDHttp.initHttpHeader()
// 注册监听网络连接
EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => {
let type: NetworkType | null = null
if (str) {
type = JSON.parse(str) as NetworkType
}
Logger.info('network connected: ' + type?.toString())
}))
// 注册监听网络断开
EmitterUtils.receiveEvent(EmitterEventId.NETWORK_DISCONNECTED, (() => {
Logger.info('network disconnected')
}))
}
private initCheckDeviceId() {
DeviceUtil.clientId()
}
private initAuthLogin() {
Logger.debug(TAG, "App 登录模块 初始化")
LoginModule.startup()
}
private initThirdPlatformSDK() {
}
private initOthers() {
}
}
\ No newline at end of file
... ...