Showing
7 changed files
with
170 additions
and
53 deletions
| @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) => | @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) => | ||
| 18 | if (queryString) { | 18 | if (queryString) { |
| 19 | url = url + `?${queryString}` | 19 | url = url + `?${queryString}` |
| 20 | } | 20 | } |
| 21 | - console.log('yzl', queryString, url) | ||
| 22 | WDHttp.get(url).then((res) => { | 21 | WDHttp.get(url).then((res) => { |
| 23 | callback(JSON.stringify({ | 22 | callback(JSON.stringify({ |
| 24 | netError: '0', | 23 | netError: '0', |
| @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent { | @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent { | ||
| 23 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 23 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 24 | private webPrepared = false; | 24 | private webPrepared = false; |
| 25 | private dataPrepared = false; | 25 | private dataPrepared = false; |
| 26 | - | ||
| 27 | async onDetailDataUpdated() { | 26 | async onDetailDataUpdated() { |
| 28 | if (this.action) { | 27 | if (this.action) { |
| 29 | let contentId: string = '' | 28 | let contentId: string = '' |
| @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D'; | @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D'; | ||
| 21 | import { window } from '@kit.ArkUI'; | 21 | import { window } from '@kit.ArkUI'; |
| 22 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | 22 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; |
| 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' | 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' |
| 24 | +import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare' | ||
| 25 | +import { common } from '@kit.AbilityKit'; | ||
| 24 | 26 | ||
| 25 | const TAG = 'MorningEveningPaperComponent'; | 27 | const TAG = 'MorningEveningPaperComponent'; |
| 26 | 28 | ||
| @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent { | @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent { | ||
| 126 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) | 128 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) |
| 127 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" | 129 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" |
| 128 | this.pageInfoBean = pageInfoBean; | 130 | this.pageInfoBean = pageInfoBean; |
| 131 | + //早晚报意图上报 | ||
| 132 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 133 | + viewColumInsightIntentShare(context,String(dailyPaperTopicPageId), this.pageInfoBean) | ||
| 134 | + | ||
| 129 | this.title = this.pageInfoBean?.topicInfo?.title | 135 | this.title = this.pageInfoBean?.topicInfo?.title |
| 130 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN) | 136 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN) |
| 131 | const dateShow = new Date(dateTime) | 137 | const dateShow = new Date(dateTime) |
| @@ -15,7 +15,8 @@ import { NoMoreBean } from './NoMoreBean'; | @@ -15,7 +15,8 @@ import { NoMoreBean } from './NoMoreBean'; | ||
| 15 | import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; | 15 | import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; |
| 16 | import RefreshLayout from '../refresh/RefreshLayout'; | 16 | import RefreshLayout from '../refresh/RefreshLayout'; |
| 17 | import json from '@ohos.util.json'; | 17 | import json from '@ohos.util.json'; |
| 18 | - | 18 | +import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' |
| 19 | +import { common } from '@kit.AbilityKit'; | ||
| 19 | const TAG = 'PageComponent'; | 20 | const TAG = 'PageComponent'; |
| 20 | 21 | ||
| 21 | @Component | 22 | @Component |
| @@ -31,7 +32,6 @@ export struct PageComponent { | @@ -31,7 +32,6 @@ export struct PageComponent { | ||
| 31 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 32 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 32 | private listScroller: Scroller = new Scroller(); | 33 | private listScroller: Scroller = new Scroller(); |
| 33 | needload: boolean = true; | 34 | needload: boolean = true; |
| 34 | - | ||
| 35 | build() { | 35 | build() { |
| 36 | Column() { | 36 | Column() { |
| 37 | if (this.pageModel.viewType == ViewType.LOADING) { | 37 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -78,7 +78,10 @@ export struct PageComponent { | @@ -78,7 +78,10 @@ export struct PageComponent { | ||
| 78 | ListItem() { | 78 | ListItem() { |
| 79 | Column() { | 79 | Column() { |
| 80 | CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex }); | 80 | CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex }); |
| 81 | - } | 81 | + }.onClick(()=>{ |
| 82 | + this.viewBlogInsightIntentShare(compDTO) | ||
| 83 | + }) | ||
| 84 | + | ||
| 82 | } | 85 | } |
| 83 | }, | 86 | }, |
| 84 | (compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO)) | 87 | (compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO)) |
| @@ -257,7 +260,13 @@ export struct PageComponent { | @@ -257,7 +260,13 @@ export struct PageComponent { | ||
| 257 | this.pageModel.pageTotalCompSize = 0; | 260 | this.pageModel.pageTotalCompSize = 0; |
| 258 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 261 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 259 | }, 100) | 262 | }, 100) |
| 263 | + } | ||
| 260 | 264 | ||
| 265 | + viewBlogInsightIntentShare(compDTO:CompDTO){ | ||
| 266 | + if (this.channelId === '2001' || this.channelId === '2002') { | ||
| 267 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 268 | + viewBlogInsightIntentShare(context, this.channelId, [compDTO], ActionMode.EXECUTED) | ||
| 269 | + } | ||
| 261 | } | 270 | } |
| 262 | } | 271 | } |
| 263 | 272 |
| 1 | -import { insightIntent } from '@kit.IntentsKit'; | ||
| 2 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; | 1 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; |
| 3 | import { SpConstants } from 'wdConstant'; | 2 | import { SpConstants } from 'wdConstant'; |
| 4 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; | 3 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; |
| @@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | @@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | ||
| 9 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 10 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | 9 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; |
| 11 | import { channelSkeleton } from '../skeleton/channelSkeleton'; | 10 | import { channelSkeleton } from '../skeleton/channelSkeleton'; |
| 12 | -import { common } from '@kit.AbilityKit'; | ||
| 13 | - | ||
| 14 | 11 | ||
| 15 | const TAG = 'TopNavigationComponent'; | 12 | const TAG = 'TopNavigationComponent'; |
| 16 | 13 | ||
| @@ -61,8 +58,6 @@ export struct TopNavigationComponent { | @@ -61,8 +58,6 @@ export struct TopNavigationComponent { | ||
| 61 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 58 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 62 | // 传递给page的自动刷新通知 | 59 | // 传递给page的自动刷新通知 |
| 63 | @State autoRefresh2Page: number = 0 | 60 | @State autoRefresh2Page: number = 0 |
| 64 | - //保存当前导航选中时的时间戳 意图开始时间 | ||
| 65 | - @State executedStartTime: number = new Date().getTime() | ||
| 66 | // 当前底导index | 61 | // 当前底导index |
| 67 | @State navIndex: number = 0 | 62 | @State navIndex: number = 0 |
| 68 | @State animationDuration: number = 0 | 63 | @State animationDuration: number = 0 |
| @@ -190,48 +185,6 @@ export struct TopNavigationComponent { | @@ -190,48 +185,6 @@ export struct TopNavigationComponent { | ||
| 190 | return item.channelType === 3 | 185 | return item.channelType === 3 |
| 191 | } | 186 | } |
| 192 | 187 | ||
| 193 | - //意图共享 | ||
| 194 | - topNavInsightIntentShare(item: TopNavDTO){ | ||
| 195 | - let tapNavIntent: insightIntent.InsightIntent = { | ||
| 196 | - intentName: 'ViewBlog', | ||
| 197 | - intentVersion: '1.0.1', | ||
| 198 | - identifier: '52dac3b0-6520-4974-81e5-25f0879449b5', | ||
| 199 | - intentActionInfo: { | ||
| 200 | - actionMode: 'EXPECTED', | ||
| 201 | - currentPercentage: 50, | ||
| 202 | - executedTimeSlots: { | ||
| 203 | - executedEndTime: new Date().getTime(), | ||
| 204 | - executedStartTime: this.executedStartTime | ||
| 205 | - } | ||
| 206 | - }, | ||
| 207 | - intentEntityInfo: { | ||
| 208 | - entityName: 'Blog', | ||
| 209 | - entityId: String(item.pageId) || '', | ||
| 210 | - displayName: item.name, | ||
| 211 | - logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png', | ||
| 212 | - rankingHint: 99, | ||
| 213 | - isPublicData: true | ||
| 214 | - } | ||
| 215 | - } | ||
| 216 | - console.log('yzl',JSON.stringify(tapNavIntent)) | ||
| 217 | - try { | ||
| 218 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 219 | - // 共享数据 | ||
| 220 | - insightIntent.shareIntent(context, [tapNavIntent], (error) => { | ||
| 221 | - if (error?.code) { | ||
| 222 | - // 处理业务逻辑错误 | ||
| 223 | - console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 224 | - return; | ||
| 225 | - } | ||
| 226 | - // 执行正常业务 | ||
| 227 | - console.log('shareIntent succeed'); | ||
| 228 | - }); | ||
| 229 | - } catch (error) { | ||
| 230 | - // 处理异常 | ||
| 231 | - console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 232 | - } | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | 188 | ||
| 236 | build() { | 189 | build() { |
| 237 | Column() { | 190 | Column() { |
| 1 | +import { common } from '@kit.AbilityKit'; | ||
| 2 | +import { insightIntent } from '@kit.IntentsKit'; | ||
| 3 | +import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; | ||
| 4 | + | ||
| 5 | +function generateUniqueId() { | ||
| 6 | + // 生成当前时间戳 | ||
| 7 | + let timestamp = new Date().getTime(); | ||
| 8 | + | ||
| 9 | + // 将时间戳转换成16进制字符串 | ||
| 10 | + let hexString = timestamp.toString(16); | ||
| 11 | + | ||
| 12 | + // 确保字符串长度为16位,不足的话在前面补0 | ||
| 13 | + while (hexString.length < 16) { | ||
| 14 | + hexString = '0' + hexString; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + // 格式化为UUID样式 | ||
| 18 | + let uuid = hexString.substring(0, 8) + '-' + | ||
| 19 | + hexString.substring(8, 12) + '-' + | ||
| 20 | + hexString.substring(12, 16) + '-' + | ||
| 21 | + hexString.substring(16, 20) + '-' + | ||
| 22 | + hexString.substring(20); | ||
| 23 | + | ||
| 24 | + return uuid; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +export const enum ActionMode { | ||
| 28 | + // 将来时 | ||
| 29 | + EXPECTED = 'EXPECTED', | ||
| 30 | + // 完成时 | ||
| 31 | + EXECUTED = 'EXECUTED', | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +//ViewBlog意图共享-频道列表 | ||
| 35 | +export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string, | ||
| 36 | + compList: CompDTO[] | CompList[], actionMode: ActionMode) { | ||
| 37 | + console.log('viewBlogInsightIntentShare',actionMode) | ||
| 38 | + let insightIntentArray: insightIntent.InsightIntent [] = [] | ||
| 39 | + if (compList?.length > 0) { | ||
| 40 | + compList?.forEach((item: CompDTO | CompList) => { | ||
| 41 | + item.operDataList.forEach((_item: ContentDTO) => { | ||
| 42 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 43 | + intentName: 'ViewBlog', | ||
| 44 | + intentVersion: '1.0.1', | ||
| 45 | + identifier: generateUniqueId(), | ||
| 46 | + intentActionInfo: { | ||
| 47 | + actionMode, | ||
| 48 | + currentPercentage: 50, | ||
| 49 | + //目前不考虑发生时段 | ||
| 50 | + // executedTimeSlots: { | ||
| 51 | + // executedEndTime: new Date().getTime(), | ||
| 52 | + // executedStartTime: pageModel.executedStartTime | ||
| 53 | + // } | ||
| 54 | + }, | ||
| 55 | + intentEntityInfo: { | ||
| 56 | + entityName: 'Blog', | ||
| 57 | + entityId: _item?.objectId, | ||
| 58 | + displayName: _item?.newsTitle, | ||
| 59 | + entityGroupId, //channelId | ||
| 60 | + logoURL: _item?.coverUrl, | ||
| 61 | + metadataModificationTime: _item?.publishTimestamp, | ||
| 62 | + blogTitle: _item?.newsTitle, | ||
| 63 | + blogType: 'Normal', | ||
| 64 | + blogCategory: item.name, | ||
| 65 | + categoryDisplayName: item.name, | ||
| 66 | + blogSubTitle: _item?.newsSummary.length > 20 ? | ||
| 67 | + _item?.newsSummary.substring(0, 20) : _item?.newsSummary, | ||
| 68 | + blogAuthor: _item?.source, | ||
| 69 | + blogPublishTime: _item?.publishTimestamp, | ||
| 70 | + tag: _item?.newTags, | ||
| 71 | + likeCount: _item?.interactData?.likeNum || 0, | ||
| 72 | + forwardCount: _item?.interactData?.shareNum || 0, | ||
| 73 | + commentCount: _item?.interactData?.commentNum || 0, | ||
| 74 | + favorites: _item?.interactData?.collectNum || 0, | ||
| 75 | + viewCount: _item?.interactData?.readNum || 0, | ||
| 76 | + rankingHint: 99, | ||
| 77 | + isPublicData: true | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + insightIntentArray.push(viewBlogInsightIntentItem) | ||
| 81 | + }) | ||
| 82 | + | ||
| 83 | + }) | ||
| 84 | + console.log('yzl', JSON.stringify(insightIntentArray[0])) | ||
| 85 | + try { | ||
| 86 | + // 共享数据 | ||
| 87 | + insightIntent.shareIntent(context, insightIntentArray, (error) => { | ||
| 88 | + if (error?.code) { | ||
| 89 | + // 处理业务逻辑错误 | ||
| 90 | + console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 91 | + return; | ||
| 92 | + } | ||
| 93 | + // 执行正常业务 | ||
| 94 | + console.log('shareIntent succeed'); | ||
| 95 | + }); | ||
| 96 | + } catch (error) { | ||
| 97 | + // 处理异常 | ||
| 98 | + console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | + | ||
| 104 | +//ViewBlog意图共享-早晚报 | ||
| 105 | +export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, | ||
| 106 | + pageInfoBean: PageInfoBean) { | ||
| 107 | + console.log('viewColumInsightIntentShare') | ||
| 108 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 109 | + intentName: 'ViewColumn', | ||
| 110 | + intentVersion: '1.0.1', | ||
| 111 | + identifier: generateUniqueId(), | ||
| 112 | + intentActionInfo: { | ||
| 113 | + actionMode: ActionMode.EXECUTED, | ||
| 114 | + currentPercentage: 50, | ||
| 115 | + }, | ||
| 116 | + intentEntityInfo: { | ||
| 117 | + entityName: 'Column', | ||
| 118 | + entityId, | ||
| 119 | + displayName:pageInfoBean?.topicInfo?.title, | ||
| 120 | + description: pageInfoBean?.shareSummary, | ||
| 121 | + logoURL:pageInfoBean?.shareCoverUrl, | ||
| 122 | + activityType:['RecentViews'], | ||
| 123 | + columnTitle: pageInfoBean?.topicInfo?.title, | ||
| 124 | + columnSubTitle: pageInfoBean?.shareSummary, | ||
| 125 | + rankingHint: 99, | ||
| 126 | + isPublicData: true | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + try { | ||
| 131 | + // 共享数据 | ||
| 132 | + insightIntent.shareIntent(context, [viewBlogInsightIntentItem], (error) => { | ||
| 133 | + if (error?.code) { | ||
| 134 | + // 处理业务逻辑错误 | ||
| 135 | + console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 136 | + return; | ||
| 137 | + } | ||
| 138 | + // 执行正常业务 | ||
| 139 | + console.log('shareIntent succeed'); | ||
| 140 | + }); | ||
| 141 | + } catch (error) { | ||
| 142 | + // 处理异常 | ||
| 143 | + console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 144 | + } | ||
| 145 | +} |
| @@ -11,7 +11,8 @@ import { ArrayList } from '@kit.ArkTS'; | @@ -11,7 +11,8 @@ import { ArrayList } from '@kit.ArkTS'; | ||
| 11 | import { WDViewDefaultType } from '../components/view/EmptyComponent'; | 11 | import { WDViewDefaultType } from '../components/view/EmptyComponent'; |
| 12 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | 12 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; |
| 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; | 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; |
| 14 | - | 14 | +import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare' |
| 15 | +import { common } from '@kit.AbilityKit'; | ||
| 15 | const TAG = 'PageHelper'; | 16 | const TAG = 'PageHelper'; |
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| @@ -348,6 +349,11 @@ export class PageHelper { | @@ -348,6 +349,11 @@ export class PageHelper { | ||
| 348 | PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | 349 | PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { |
| 349 | // 刷新,替换所有数据 | 350 | // 刷新,替换所有数据 |
| 350 | this.resetInteract(data, pageModel.compList) | 351 | this.resetInteract(data, pageModel.compList) |
| 352 | + if(pageModel?.channelId !== '2001' && pageModel?.channelId !== '2002'){ | ||
| 353 | + //早晚报意图上报 | ||
| 354 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 355 | + viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED) | ||
| 356 | + } | ||
| 351 | }) | 357 | }) |
| 352 | 358 | ||
| 353 | // 测试数据 | 359 | // 测试数据 |
-
Please register or login to post a comment