yuzhilin

fix:17496 话题专题/投票专题详情页,点击投票,触发登录,登录成功后,点击投票,循环触发登录

... ... @@ -44,7 +44,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy })
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
... ...
... ... @@ -20,7 +20,7 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@State reload: number = 0;
@Prop reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
... ... @@ -134,13 +134,6 @@ export struct SpacialTopicPageComponent {
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
onPageShow() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
this.reload++
}
aboutToAppear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
... ... @@ -149,12 +142,6 @@ export struct SpacialTopicPageComponent {
this.getDetail()
}
onPageHide() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
}
aboutToDisappear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
... ...
... ... @@ -7,8 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'Card2Component';
/**
... ... @@ -111,11 +109,6 @@ export struct Card2Component {
this.clicked = true;
// persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
if (this.contentDTO?.channelId === '2001' || this.contentDTO?.channelId === '2002') {
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED)
}
})
}
}
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'Card5Component';
... ... @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component';
export struct Card5Component {
@State contentDTO: ContentDTO = new ContentDTO();
@Prop titleShowPolicy: number | string
@Prop compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -97,6 +100,8 @@ export struct Card5Component {
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED)
})
}
... ...
import { common } from '@kit.AbilityKit';
import { insightIntent } from '@kit.IntentsKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean';
function generateUniqueId() {
// 生成当前时间戳
let timestamp = new Date().getTime();
// 将时间戳转换成16进制字符串
let hexString = timestamp.toString(16);
// 确保字符串长度为16位,不足的话在前面补0
while (hexString.length < 16) {
hexString = '0' + hexString;
}
// 格式化为UUID样式
let uuid = hexString.substring(0, 8) + '-' +
hexString.substring(8, 12) + '-' +
hexString.substring(12, 16) + '-' +
hexString.substring(16, 20) + '-' +
hexString.substring(20);
function generateUUID() {
let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒)
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
let r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
... ... @@ -34,15 +23,16 @@ export const enum ActionMode {
//ViewBlog意图共享-频道列表
export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string,
compList: CompDTO[] | CompList[], actionMode: ActionMode) {
console.log('viewBlogInsightIntentShare',actionMode)
console.log('viewBlogInsightIntentShare', actionMode)
let insightIntentArray: insightIntent.InsightIntent [] = []
let identifier = generateUUID()
if (compList?.length > 0) {
compList?.forEach((item: CompDTO | CompList) => {
item.operDataList.forEach((_item: ContentDTO) => {
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
identifier,
intentActionInfo: {
actionMode,
currentPercentage: 50,
... ... @@ -67,7 +57,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
_item?.newsSummary.substring(0, 20) : _item?.newsSummary,
blogAuthor: _item?.source,
blogPublishTime: _item?.publishTimestamp,
tag: _item?.newTags,
tag: _item?.newTags.split(','),
likeCount: _item?.interactData?.likeNum || 0,
forwardCount: _item?.interactData?.shareNum || 0,
commentCount: _item?.interactData?.commentNum || 0,
... ... @@ -82,21 +72,13 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
})
console.log('yzl', JSON.stringify(insightIntentArray[0]))
try {
// 共享数据
insightIntent.shareIntent(context, insightIntentArray, (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
// 共享数据
insightIntent.shareIntent(context, insightIntentArray).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
}
... ... @@ -108,7 +90,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
identifier: generateUUID(),
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
... ... @@ -116,30 +98,22 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en
intentEntityInfo: {
entityName: 'Column',
entityId,
displayName:pageInfoBean?.topicInfo?.title,
displayName: pageInfoBean?.topicInfo?.title,
description: pageInfoBean?.shareSummary,
logoURL:pageInfoBean?.shareCoverUrl,
activityType:['RecentViews'],
logoURL: pageInfoBean?.shareCoverUrl,
activityType: ['RecentViews'],
columnTitle: pageInfoBean?.topicInfo?.title,
columnSubTitle: pageInfoBean?.shareSummary,
rankingHint: 99,
isPublicData: true
}
}
console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem))
try {
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
... ...
... ... @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage';
@Entry
@Component
struct SpacialTopicPage {
action: Action = {} as Action
@State action: Action = {} as Action
@State reload: number = 0
@State count: number = 0
build() {
Column() {
SpacialTopicPageComponent({ action: this.action })
SpacialTopicPageComponent({ action: this.action ,reload:this.reload })
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
... ... @@ -30,8 +31,12 @@ struct SpacialTopicPage {
}
aboutToAppear() {
Logger.info(TAG, 'aboutToAppear');
Logger.info(TAG, `aboutToAppearcount:${this.reload}`);
let action: Action = router.getParams() as Action
this.action = action
}
onPageShow() {
this.reload = this.reload + 1
Logger.info(TAG, `onPageShowcount:${this.reload}`);
}
}
\ No newline at end of file
... ...