Showing
9 changed files
with
153 additions
and
23 deletions
| @@ -44,7 +44,7 @@ export struct CardParser { | @@ -44,7 +44,7 @@ export struct CardParser { | ||
| 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) | 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 47 | - Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO }) | 47 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy}) |
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 49 | .Card_13) { | 49 | .Card_13) { |
| 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; | @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; | ||
| 41 | import { CommentComponent } from './comment/view/CommentComponent'; | 41 | import { CommentComponent } from './comment/view/CommentComponent'; |
| 42 | import { EmptyComponent } from './view/EmptyComponent'; | 42 | import { EmptyComponent } from './view/EmptyComponent'; |
| 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; | 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 44 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 45 | +import { common } from '@kit.AbilityKit'; | ||
| 44 | 46 | ||
| 45 | const TAG = 'DynamicDetailComponent' | 47 | const TAG = 'DynamicDetailComponent' |
| 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 48 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| @@ -602,6 +604,7 @@ export struct DynamicDetailComponent { | @@ -602,6 +604,7 @@ export struct DynamicDetailComponent { | ||
| 602 | this.getInteractDataStatus() | 604 | this.getInteractDataStatus() |
| 603 | this.makeJumpInfo() | 605 | this.makeJumpInfo() |
| 604 | this.interactDataV2() | 606 | this.interactDataV2() |
| 607 | + this.viewBlogInsightIntentShare() | ||
| 605 | } | 608 | } |
| 606 | 609 | ||
| 607 | private async interactDataV2() { | 610 | private async interactDataV2() { |
| @@ -761,6 +764,14 @@ export struct DynamicDetailComponent { | @@ -761,6 +764,14 @@ export struct DynamicDetailComponent { | ||
| 761 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) | 764 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) |
| 762 | }) | 765 | }) |
| 763 | } | 766 | } |
| 767 | + | ||
| 768 | + /** | ||
| 769 | + * 意图上报 | ||
| 770 | + */ | ||
| 771 | + private viewBlogInsightIntentShare(){ | ||
| 772 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 773 | + viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactDataDTO) | ||
| 774 | + } | ||
| 764 | } | 775 | } |
| 765 | 776 | ||
| 766 | interface radiusType { | 777 | interface radiusType { |
| @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM | @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM | ||
| 31 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 31 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' | 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' |
| 33 | import { HttpUtils } from 'wdNetwork/Index'; | 33 | import { HttpUtils } from 'wdNetwork/Index'; |
| 34 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 35 | +import { common } from '@kit.AbilityKit'; | ||
| 34 | 36 | ||
| 35 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 37 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 36 | 38 | ||
| @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent { | @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent { | ||
| 56 | @State likeNum: number = 0 | 58 | @State likeNum: number = 0 |
| 57 | @State reachEndIncreament: number = 0 | 59 | @State reachEndIncreament: number = 0 |
| 58 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 60 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 59 | - | ||
| 60 | build() { | 61 | build() { |
| 61 | Stack({ alignContent: Alignment.Top }) { | 62 | Stack({ alignContent: Alignment.Top }) { |
| 62 | Stack({ alignContent: Alignment.Bottom }) { | 63 | Stack({ alignContent: Alignment.Bottom }) { |
| @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent { | @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent { | ||
| 261 | } else { | 262 | } else { |
| 262 | this.operationButtonList = ['comment', 'collect', 'share'] | 263 | this.operationButtonList = ['comment', 'collect', 'share'] |
| 263 | } | 264 | } |
| 265 | + | ||
| 266 | + //意图上报 | ||
| 267 | + this.viewBlogInsightIntentShare() | ||
| 264 | } | 268 | } |
| 265 | } | 269 | } |
| 266 | } | 270 | } |
| 267 | 271 | ||
| 272 | + //意图上报 | ||
| 273 | + private viewBlogInsightIntentShare(){ | ||
| 274 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 275 | + viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData) | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + | ||
| 268 | private async getRecommend() { | 279 | private async getRecommend() { |
| 269 | let params: postRecommendListParams = { | 280 | let params: postRecommendListParams = { |
| 270 | imei: HttpUtils.getImei(), | 281 | imei: HttpUtils.getImei(), |
| @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent { | @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent { | ||
| 341 | } | 352 | } |
| 342 | PageRepository.getContentInteract(params).then(res => { | 353 | PageRepository.getContentInteract(params).then(res => { |
| 343 | if (res.data) { | 354 | if (res.data) { |
| 355 | + this.interactData = res.data[0] | ||
| 344 | this.likeNum = Number(res.data[0]?.likeNum) || 0 | 356 | this.likeNum = Number(res.data[0]?.likeNum) || 0 |
| 345 | } | 357 | } |
| 346 | }) | 358 | }) |
| @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 22 | import { PageRepository } from '../repository/PageRepository'; | 22 | import { PageRepository } from '../repository/PageRepository'; |
| 23 | import { SpConstants } from 'wdConstant/Index'; | 23 | import { SpConstants } from 'wdConstant/Index'; |
| 24 | import { router } from '@kit.ArkUI'; | 24 | import { router } from '@kit.ArkUI'; |
| 25 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 26 | +import { common } from '@kit.AbilityKit'; | ||
| 25 | 27 | ||
| 26 | const TAG = 'MultiPictureDetailPageComponent'; | 28 | const TAG = 'MultiPictureDetailPageComponent'; |
| 27 | 29 | ||
| @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent { | @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 467 | this.getInteractBrowsOperate() | 469 | this.getInteractBrowsOperate() |
| 468 | this.getBatchAttentionStatus() | 470 | this.getBatchAttentionStatus() |
| 469 | } | 471 | } |
| 472 | + this.viewBlogInsightIntentShare() | ||
| 470 | }) | 473 | }) |
| 471 | .catch((err: Error) => { | 474 | .catch((err: Error) => { |
| 472 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | 475 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); |
| @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent { | @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 544 | } | 547 | } |
| 545 | }) | 548 | }) |
| 546 | } | 549 | } |
| 550 | + | ||
| 551 | + /** | ||
| 552 | + * 意图上报 | ||
| 553 | + */ | ||
| 554 | + private viewBlogInsightIntentShare(){ | ||
| 555 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 556 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 557 | + } | ||
| 547 | } | 558 | } |
| @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 12 | import { NetworkUtil, WindowModel } from 'wdKit'; | 12 | import { NetworkUtil, WindowModel } from 'wdKit'; |
| 13 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 14 | +import { common } from '@kit.AbilityKit'; | ||
| 13 | 15 | ||
| 14 | const TAG: string = 'SpacialTopicPageComponent' | 16 | const TAG: string = 'SpacialTopicPageComponent' |
| 15 | 17 | ||
| @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent { | @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent { | ||
| 49 | }) | 51 | }) |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 54 | + //意图上报 | ||
| 55 | + private viewBlogInsightIntentShare(){ | ||
| 56 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 57 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 58 | + } | ||
| 59 | + | ||
| 52 | private async getDetail() { | 60 | private async getDetail() { |
| 53 | this.isNetConnected = NetworkUtil.isNetConnected() | 61 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 54 | 62 | ||
| @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent { | @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent { | ||
| 71 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 79 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 72 | if (detailBeans && detailBeans.length > 0) { | 80 | if (detailBeans && detailBeans.length > 0) { |
| 73 | this.contentDetailData = detailBeans[0]; | 81 | this.contentDetailData = detailBeans[0]; |
| 82 | + this.viewBlogInsightIntentShare() | ||
| 74 | // if (this.contentDetailData[0]?.openComment) { | 83 | // if (this.contentDetailData[0]?.openComment) { |
| 75 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 84 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 76 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | 85 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| @@ -3,8 +3,6 @@ import { CommonConstants } from 'wdConstant'; | @@ -3,8 +3,6 @@ import { CommonConstants } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| 6 | -import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 7 | -import { common } from '@kit.AbilityKit'; | ||
| 8 | 6 | ||
| 9 | const TAG: string = 'Card5Component'; | 7 | const TAG: string = 'Card5Component'; |
| 10 | 8 | ||
| @@ -15,7 +13,6 @@ const TAG: string = 'Card5Component'; | @@ -15,7 +13,6 @@ const TAG: string = 'Card5Component'; | ||
| 15 | export struct Card5Component { | 13 | export struct Card5Component { |
| 16 | @State contentDTO: ContentDTO = new ContentDTO(); | 14 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | @Prop titleShowPolicy: number | string | 15 | @Prop titleShowPolicy: number | string |
| 18 | - @Prop compDTO: CompDTO = {} as CompDTO | ||
| 19 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 20 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 21 | @State titleMarked: boolean = false; | 18 | @State titleMarked: boolean = false; |
| @@ -100,8 +97,6 @@ export struct Card5Component { | @@ -100,8 +97,6 @@ export struct Card5Component { | ||
| 100 | .onClick((event: ClickEvent) => { | 97 | .onClick((event: ClickEvent) => { |
| 101 | this.clicked = true; | 98 | this.clicked = true; |
| 102 | ProcessUtils.processPage(this.contentDTO) | 99 | ProcessUtils.processPage(this.contentDTO) |
| 103 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 104 | - viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 105 | }) | 100 | }) |
| 106 | 101 | ||
| 107 | } | 102 | } |
| 1 | import { common } from '@kit.AbilityKit'; | 1 | import { common } from '@kit.AbilityKit'; |
| 2 | import { insightIntent } from '@kit.IntentsKit'; | 2 | import { insightIntent } from '@kit.IntentsKit'; |
| 3 | import { BusinessError } from '@kit.BasicServicesKit'; | 3 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 4 | -import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; | 4 | +import { CompDTO, CompList, ContentDTO, PageInfoBean, ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 5 | 5 | ||
| 6 | function generateUUID() { | 6 | function generateUUID() { |
| 7 | let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) | 7 | let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) |
| @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | +//ViewBlog意图共享-节目详情 目前单独在详情页上报 | ||
| 86 | +export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, item: ContentDetailDTO, | ||
| 87 | + interactData?: InteractDataDTO) { | ||
| 88 | + let identifier = generateUUID() | ||
| 89 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 90 | + intentName: 'ViewBlog', | ||
| 91 | + intentVersion: '1.0.1', | ||
| 92 | + identifier, | ||
| 93 | + intentActionInfo: { | ||
| 94 | + actionMode: ActionMode.EXECUTED, | ||
| 95 | + currentPercentage: 50, | ||
| 96 | + }, | ||
| 97 | + intentEntityInfo: { | ||
| 98 | + entityName: 'Blog', | ||
| 99 | + entityId: String(item?.newsId), | ||
| 100 | + displayName: item?.newsTitle, | ||
| 101 | + entityGroupId: String(item?.reLInfo?.channelId), //channelId | ||
| 102 | + logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri, | ||
| 103 | + metadataModificationTime: item?.publishTime, | ||
| 104 | + blogTitle: item?.newsTitle, | ||
| 105 | + blogType: 'Normal', | ||
| 106 | + blogCategory: item, | ||
| 107 | + categoryDisplayName: '', //TODO 分类名称 | ||
| 108 | + blogSubTitle: item?.newsSummary.length > 20 ? | ||
| 109 | + item?.newsSummary.substring(0, 20) : item?.newsSummary, | ||
| 110 | + blogAuthor: item?.newsSourceName, | ||
| 111 | + blogPublishTime: item?.publishTime, | ||
| 112 | + tag: item?.newsTags.split(','), | ||
| 113 | + viewCount: item?.viewCount || 0, | ||
| 114 | + likeCount: interactData?.likeNum || 0, | ||
| 115 | + forwardCount: interactData?.shareNum || 0, | ||
| 116 | + commentCount: interactData?.commentNum || 0, | ||
| 117 | + favorites: interactData?.collectNum || 0, | ||
| 118 | + rankingHint: 99, | ||
| 119 | + isPublicData: true | ||
| 120 | + } | ||
| 121 | + } | ||
| 85 | 122 | ||
| 86 | -//ViewBlog意图共享-早晚报 | 123 | + console.log('yzl', JSON.stringify(viewBlogInsightIntentItem)) |
| 124 | + // 共享数据 | ||
| 125 | + insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | ||
| 126 | + console.log('yzl shareIntent success'); | ||
| 127 | + }).catch((err: BusinessError) => { | ||
| 128 | + console.error(`yzl failed because ${err?.message}`); | ||
| 129 | + }); | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +//ViewColumn意图共享-早晚报 | ||
| 87 | export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, | 133 | export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, |
| 88 | pageInfoBean: PageInfoBean) { | 134 | pageInfoBean: PageInfoBean) { |
| 89 | console.log('viewColumInsightIntentShare') | 135 | console.log('viewColumInsightIntentShare') |
| 90 | - let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | 136 | + let viewColumInsightIntentItem: insightIntent.InsightIntent = { |
| 91 | intentName: 'ViewColumn', | 137 | intentName: 'ViewColumn', |
| 92 | intentVersion: '1.0.1', | 138 | intentVersion: '1.0.1', |
| 93 | identifier: generateUUID(), | 139 | identifier: generateUUID(), |
| @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | ||
| 108 | isPublicData: true | 154 | isPublicData: true |
| 109 | } | 155 | } |
| 110 | } | 156 | } |
| 111 | - console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem)) | 157 | + console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewColumInsightIntentItem)) |
| 112 | 158 | ||
| 113 | // 共享数据 | 159 | // 共享数据 |
| 114 | - insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | 160 | + insightIntent.shareIntent(context, [viewColumInsightIntentItem]).then(() => { |
| 115 | console.log('yzl shareIntent success'); | 161 | console.log('yzl shareIntent success'); |
| 116 | }).catch((err: BusinessError) => { | 162 | }).catch((err: BusinessError) => { |
| 117 | console.error(`yzl failed because ${err?.message}`); | 163 | console.error(`yzl failed because ${err?.message}`); |
| 1 | import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; | 1 | import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; |
| 2 | import { window } from '@kit.ArkUI'; | 2 | import { window } from '@kit.ArkUI'; |
| 3 | import { BusinessError } from '@kit.BasicServicesKit'; | 3 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 4 | - | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | /** | 5 | /** |
| 6 | * 意图调用 | 6 | * 意图调用 |
| 7 | */ | 7 | */ |
| 8 | export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | 8 | export default class InsightIntentExecutorImpl extends InsightIntentExecutor { |
| 9 | - private static readonly ViewColumn = 'ViewColumn'; | 9 | + private static readonly ViewBlog = 'ViewBlog'; |
| 10 | + private static readonly ViewColumnUpdate = 'ViewColumnUpdate'; | ||
| 11 | + | ||
| 10 | /** | 12 | /** |
| 11 | * override 执行前台UIAbility意图 | 13 | * override 执行前台UIAbility意图 |
| 12 | * | 14 | * |
| @@ -17,10 +19,13 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -17,10 +19,13 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 17 | */ | 19 | */ |
| 18 | onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): | 20 | onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): |
| 19 | Promise<insightIntent.ExecuteResult> { | 21 | Promise<insightIntent.ExecuteResult> { |
| 22 | + console.log('yzl onExecuteInUIAbilityForegroundMode',name,JSON.stringify(param)) | ||
| 20 | // 根据意图名称分发处理逻辑 | 23 | // 根据意图名称分发处理逻辑 |
| 21 | switch (name) { | 24 | switch (name) { |
| 22 | - case InsightIntentExecutorImpl.ViewColumn: | ||
| 23 | - return this.jumpToView(param, pageLoader); | 25 | + case InsightIntentExecutorImpl.ViewBlog: |
| 26 | + return this.jumpToViewBlog(param, pageLoader); | ||
| 27 | + case InsightIntentExecutorImpl.ViewColumnUpdate: | ||
| 28 | + return this.jumpToViewColumnUpdate(param, pageLoader); | ||
| 24 | default: | 29 | default: |
| 25 | break; | 30 | break; |
| 26 | } | 31 | } |
| @@ -32,18 +37,47 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -32,18 +37,47 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 32 | } as insightIntent.ExecuteResult) | 37 | } as insightIntent.ExecuteResult) |
| 33 | } | 38 | } |
| 34 | /** | 39 | /** |
| 35 | - * 实现跳转新闻页面功能 | ||
| 36 | - * | 40 | + * 实现习惯推荐功能 |
| 37 | * @param param 意图参数 | 41 | * @param param 意图参数 |
| 38 | * @param pageLoader 窗口 | 42 | * @param pageLoader 窗口 |
| 39 | */ | 43 | */ |
| 40 | - private jumpToView(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | 44 | + private jumpToViewBlog(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { |
| 45 | + console.log('yzl jumpToView',JSON.stringify(param)) | ||
| 41 | return new Promise((resolve, reject) => { | 46 | return new Promise((resolve, reject) => { |
| 42 | // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage | 47 | // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage |
| 43 | pageLoader.loadContent('pages/MainPage') | 48 | pageLoader.loadContent('pages/MainPage') |
| 44 | .then(() => { | 49 | .then(() => { |
| 45 | - let entityId: string = (param.items as Array<object>)?.[0]?.['entityId']; | ||
| 46 | - // TODO 调用成功的情况,此处可以打印日志 | 50 | + let entityGroupId: string = (param.items as Array<object>)?.[0]?.['entityGroupId']; |
| 51 | + ProcessUtils.jumpChannelTab(entityGroupId,'') | ||
| 52 | + resolve({ | ||
| 53 | + code: 0, | ||
| 54 | + result: { | ||
| 55 | + message: 'Intent execute success' | ||
| 56 | + } | ||
| 57 | + }); | ||
| 58 | + }) | ||
| 59 | + .catch((err: BusinessError) => { | ||
| 60 | + resolve({ | ||
| 61 | + code: -1, | ||
| 62 | + result: { | ||
| 63 | + message: 'Intent execute failed' | ||
| 64 | + } | ||
| 65 | + }) | ||
| 66 | + }); | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 实现事件推荐功能 | ||
| 72 | + * @param param 意图参数 | ||
| 73 | + * @param pageLoader 窗口 | ||
| 74 | + */ | ||
| 75 | + private jumpToViewColumnUpdate(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | ||
| 76 | + console.log('yzl jumpToViewColum',JSON.stringify(param)) | ||
| 77 | + return new Promise((resolve, reject) => { | ||
| 78 | + pageLoader.loadContent('pages/MainPage') | ||
| 79 | + .then(() => { | ||
| 80 | + // TODO 事件推荐调用 | ||
| 47 | resolve({ | 81 | resolve({ |
| 48 | code: 0, | 82 | code: 0, |
| 49 | result: { | 83 | result: { |
| @@ -52,7 +86,6 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -52,7 +86,6 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 52 | }); | 86 | }); |
| 53 | }) | 87 | }) |
| 54 | .catch((err: BusinessError) => { | 88 | .catch((err: BusinessError) => { |
| 55 | - // TODO 调用失败的情况 | ||
| 56 | resolve({ | 89 | resolve({ |
| 57 | code: -1, | 90 | code: -1, |
| 58 | result: { | 91 | result: { |
| 1 | { | 1 | { |
| 2 | "insightIntents": [ | 2 | "insightIntents": [ |
| 3 | { | 3 | { |
| 4 | - "intentName": "ViewColumn", | 4 | + "intentName": "ViewBlog", |
| 5 | + "domain": "", | ||
| 6 | + "intentVersion": "1.0.1", | ||
| 7 | + "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", | ||
| 8 | + "uiAbility": { | ||
| 9 | + "ability": "EntryAbility", | ||
| 10 | + "executeMode": [ | ||
| 11 | + "background", | ||
| 12 | + "foreground" | ||
| 13 | + ] | ||
| 14 | + } | ||
| 15 | + }, | ||
| 16 | + { | ||
| 17 | + "intentName": "ViewColumnUpdate", | ||
| 5 | "domain": "", | 18 | "domain": "", |
| 6 | "intentVersion": "1.0.1", | 19 | "intentVersion": "1.0.1", |
| 7 | "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", | 20 | "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", |
-
Please register or login to post a comment