Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yuzhilin
2024-05-15 19:15:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8f924b8039f1973689afaefb9955fc10c217085c
8f924b80
1 parent
ec03bf3f
feat:意图框架频道、早晚报上报
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
170 additions
and
53 deletions
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsCallAppService.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextWebComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/utils/InsightIntentShare.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/JsCallAppService.ets
View file @
8f924b8
...
...
@@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) =>
if (queryString) {
url = url + `?${queryString}`
}
console.log('yzl', queryString, url)
WDHttp.get(url).then((res) => {
callback(JSON.stringify({
netError: '0',
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextWebComponent.ets
View file @
8f924b8
...
...
@@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent {
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
async onDetailDataUpdated() {
if (this.action) {
let contentId: string = ''
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
8f924b8
...
...
@@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'MorningEveningPaperComponent';
...
...
@@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent {
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
this.pageInfoBean = pageInfoBean;
//早晚报意图上报
let context = getContext(this) as common.UIAbilityContext;
viewColumInsightIntentShare(context,String(dailyPaperTopicPageId), this.pageInfoBean)
this.title = this.pageInfoBean?.topicInfo?.title
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN)
const dateShow = new Date(dateTime)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
View file @
8f924b8
...
...
@@ -15,7 +15,8 @@ import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
import json from '@ohos.util.json';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageComponent';
@Component
...
...
@@ -31,7 +32,6 @@ export struct PageComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
needload: boolean = true;
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
...
...
@@ -78,7 +78,10 @@ export struct PageComponent {
ListItem() {
Column() {
CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex });
}
}.onClick(()=>{
this.viewBlogInsightIntentShare(compDTO)
})
}
},
(compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO))
...
...
@@ -257,7 +260,13 @@ export struct PageComponent {
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
viewBlogInsightIntentShare(compDTO:CompDTO){
if (this.channelId === '2001' || this.channelId === '2002') {
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.channelId, [compDTO], ActionMode.EXECUTED)
}
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
View file @
8f924b8
import { insightIntent } from '@kit.IntentsKit';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
...
...
@@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { common } from '@kit.AbilityKit';
const TAG = 'TopNavigationComponent';
...
...
@@ -61,8 +58,6 @@ export struct TopNavigationComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
//保存当前导航选中时的时间戳 意图开始时间
@State executedStartTime: number = new Date().getTime()
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
...
...
@@ -190,48 +185,6 @@ export struct TopNavigationComponent {
return item.channelType === 3
}
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
actionMode: 'EXPECTED',
currentPercentage: 50,
executedTimeSlots: {
executedEndTime: new Date().getTime(),
executedStartTime: this.executedStartTime
}
},
intentEntityInfo: {
entityName: 'Blog',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
rankingHint: 99,
isPublicData: true
}
}
console.log('yzl',JSON.stringify(tapNavIntent))
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
insightIntent.shareIntent(context, [tapNavIntent], (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}`);
}
}
build() {
Column() {
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/InsightIntentShare.ets
0 → 100644
View file @
8f924b8
import { common } from '@kit.AbilityKit';
import { insightIntent } from '@kit.IntentsKit';
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);
return uuid;
}
export const enum ActionMode {
// 将来时
EXPECTED = 'EXPECTED',
// 完成时
EXECUTED = 'EXECUTED',
}
//ViewBlog意图共享-频道列表
export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string,
compList: CompDTO[] | CompList[], actionMode: ActionMode) {
console.log('viewBlogInsightIntentShare',actionMode)
let insightIntentArray: insightIntent.InsightIntent [] = []
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(),
intentActionInfo: {
actionMode,
currentPercentage: 50,
//目前不考虑发生时段
// executedTimeSlots: {
// executedEndTime: new Date().getTime(),
// executedStartTime: pageModel.executedStartTime
// }
},
intentEntityInfo: {
entityName: 'Blog',
entityId: _item?.objectId,
displayName: _item?.newsTitle,
entityGroupId, //channelId
logoURL: _item?.coverUrl,
metadataModificationTime: _item?.publishTimestamp,
blogTitle: _item?.newsTitle,
blogType: 'Normal',
blogCategory: item.name,
categoryDisplayName: item.name,
blogSubTitle: _item?.newsSummary.length > 20 ?
_item?.newsSummary.substring(0, 20) : _item?.newsSummary,
blogAuthor: _item?.source,
blogPublishTime: _item?.publishTimestamp,
tag: _item?.newTags,
likeCount: _item?.interactData?.likeNum || 0,
forwardCount: _item?.interactData?.shareNum || 0,
commentCount: _item?.interactData?.commentNum || 0,
favorites: _item?.interactData?.collectNum || 0,
viewCount: _item?.interactData?.readNum || 0,
rankingHint: 99,
isPublicData: true
}
}
insightIntentArray.push(viewBlogInsightIntentItem)
})
})
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}`);
}
}
}
//ViewBlog意图共享-早晚报
export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string,
pageInfoBean: PageInfoBean) {
console.log('viewColumInsightIntentShare')
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
},
intentEntityInfo: {
entityName: 'Column',
entityId,
displayName:pageInfoBean?.topicInfo?.title,
description: pageInfoBean?.shareSummary,
logoURL:pageInfoBean?.shareCoverUrl,
activityType:['RecentViews'],
columnTitle: pageInfoBean?.topicInfo?.title,
columnSubTitle: pageInfoBean?.shareSummary,
rankingHint: 99,
isPublicData: true
}
}
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}`);
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
View file @
8f924b8
...
...
@@ -11,7 +11,8 @@ import { ArrayList } from '@kit.ArkTS';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageHelper';
/**
...
...
@@ -348,6 +349,11 @@ export class PageHelper {
PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
if(pageModel?.channelId !== '2001' && pageModel?.channelId !== '2002'){
//早晚报意图上报
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED)
}
})
// 测试数据
...
...
Please
register
or
login
to post a comment