yangsunyue_wd
Showing 64 changed files with 1420 additions and 298 deletions
@@ -244,6 +244,30 @@ @@ -244,6 +244,30 @@
244 ] 244 ]
245 } 245 }
246 ] 246 ]
  247 + },
  248 + {
  249 + "name": "wdShareBase",
  250 + "srcPath": "./commons/wdShareBase",
  251 + "targets": [
  252 + {
  253 + "name": "default",
  254 + "applyToProducts": [
  255 + "default"
  256 + ]
  257 + }
  258 + ]
  259 + },
  260 + {
  261 + "name": "wdShare",
  262 + "srcPath": "./features/wdShare",
  263 + "targets": [
  264 + {
  265 + "name": "default",
  266 + "applyToProducts": [
  267 + "default"
  268 + ]
  269 + }
  270 + ]
247 } 271 }
248 ] 272 ]
249 } 273 }
  1 +/node_modules
  2 +/oh_modules
  3 +/.preview
  4 +/build
  5 +/.cxx
  6 +/.test
  1 +export { WDShareObject, WDShareBase } from "./src/main/ets/WDShareBase"
  2 +
  3 +export { ShareContent, ShareScene, ShareType } from "./src/main/ets/Constant"
  1 +{
  2 + "apiType": "stageMode",
  3 + "buildOption": {
  4 + },
  5 + "buildOptionSet": [
  6 + {
  7 + "name": "release",
  8 + "arkOptions": {
  9 + "obfuscation": {
  10 + "ruleOptions": {
  11 + "enable": true,
  12 + "files": [
  13 + "./obfuscation-rules.txt"
  14 + ]
  15 + }
  16 + }
  17 + },
  18 + },
  19 + ],
  20 + "targets": [
  21 + {
  22 + "name": "default"
  23 + }
  24 + ]
  25 +}
  1 +import { hspTasks } from '@ohos/hvigor-ohos-plugin';
  2 +
  3 +export default {
  4 + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
  5 + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
  6 +}
  1 +# Define project specific obfuscation rules here.
  2 +# You can include the obfuscation configuration files in the current module's build-profile.json5.
  3 +#
  4 +# For more details, see
  5 +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
  6 +
  7 +# Obfuscation options:
  8 +# -disable-obfuscation: disable all obfuscations
  9 +# -enable-property-obfuscation: obfuscate the property names
  10 +# -enable-toplevel-obfuscation: obfuscate the names in the global scope
  11 +# -compact: remove unnecessary blank spaces and all line feeds
  12 +# -remove-log: remove all console.* statements
  13 +# -print-namecache: print the name cache that contains the mapping from the old names to new names
  14 +# -apply-namecache: reuse the given cache file
  15 +
  16 +# Keep options:
  17 +# -keep-property-name: specifies property names that you want to keep
  18 +# -keep-global-name: specifies names that you want to keep in the global scope
  1 +{
  2 + "name": "wdsharebase",
  3 + "version": "1.0.0",
  4 + "description": "Please describe the basic information.",
  5 + "main": "Index.ets",
  6 + "author": "",
  7 + "license": "Apache-2.0",
  8 + "packageType": "InterfaceHar",
  9 + "dependencies": {
  10 + }
  11 +}
  1 +
  2 +export const enum ShareType {
  3 + System = 0,
  4 + WeChat,
  5 + QQ,
  6 + Weibo,
  7 +
  8 +}
  9 +
  10 +export const enum ShareScene {
  11 + System = 0,
  12 +
  13 + WeChatSession,
  14 + WeChatTimeline,
  15 +
  16 + QQFriend,
  17 + QQZone,
  18 +
  19 + Weibo,
  20 +}
  21 +
  22 +export const enum ShareContentType {
  23 + PrueText = 1,
  24 + ImageAndText,
  25 + Link,
  26 +}
  27 +
  28 +export interface ShareContentText {
  29 + text: string
  30 +}
  31 +export interface ShareContentImageAndText {
  32 + title: string
  33 + desc?: string
  34 + imgURI: string
  35 +
  36 +}
  37 +export interface ShareContentLink {
  38 + title: string
  39 + desc?: string
  40 + link: string
  41 + icon?: string
  42 +}
  43 +
  44 +export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink
  1 +import { ShareContent, ShareContentImageAndText, ShareContentLink, ShareContentText,
  2 + ShareContentType,
  3 + ShareScene } from '../Constant';
  4 +import { WDShareInterface } from '../WDShareInterface';
  5 +import { AsyncCallback } from '@kit.BasicServicesKit';
  6 +import { common } from '@kit.AbilityKit';
  7 +import { systemShare } from '@kit.ShareKit';
  8 +import { uniformTypeDescriptor as utd } from '@kit.ArkData';
  9 +
  10 +export class WDSystemShare implements WDShareInterface {
  11 +
  12 + shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> {
  13 +
  14 + return new Promise((resolve, fail) => {
  15 + try {
  16 +
  17 + let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType));
  18 + let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
  19 +
  20 + controller.on('dismiss', () => {
  21 +
  22 + resolve("dismiss")
  23 + });
  24 +
  25 + controller.show(context, {
  26 + previewMode: systemShare.SharePreviewMode.DEFAULT,
  27 + selectionMode: systemShare.SelectionMode.SINGLE
  28 + });
  29 +
  30 + console.log("分享控制器调用完成")
  31 + } catch (e) {
  32 + fail(e)
  33 + }
  34 + })
  35 + }
  36 +
  37 + getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData {
  38 + if (contentType === ShareContentType.PrueText) {
  39 + let prueText = content as ShareContentText
  40 + console.log("分享纯文本")
  41 + return new systemShare.SharedData({
  42 + utd: utd.UniformDataType.PLAIN_TEXT,
  43 + content: prueText.text
  44 + });
  45 + }
  46 +
  47 + if (contentType === ShareContentType.ImageAndText) {
  48 + let imageAndText = content as ShareContentImageAndText
  49 + console.log("分享图片和文本")
  50 + let data: systemShare.SharedData = new systemShare.SharedData({
  51 + utd: utd.UniformDataType.PLAIN_TEXT,
  52 + content: imageAndText.title
  53 + });
  54 + data.addRecord({
  55 + utd: utd.UniformDataType.PNG,
  56 + uri: imageAndText.imgURI
  57 + });
  58 + return data
  59 + }
  60 +
  61 + console.log("分享链接和文本")
  62 + let link = content as ShareContentLink
  63 + let data: systemShare.SharedData = new systemShare.SharedData({
  64 + utd: utd.UniformDataType.PLAIN_TEXT,
  65 + content: link.title
  66 + });
  67 + data.addRecord({
  68 + utd: utd.UniformDataType.HYPERLINK,
  69 + uri: link.link
  70 + });
  71 + return data
  72 + }
  73 +
  74 +
  75 +}
  1 +import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constant'
  2 +import { HashMap } from '@kit.ArkTS'
  3 +import { WDShareInterface } from './WDShareInterface'
  4 +import { WDSystemShare } from './System/WDSystemShare'
  5 +
  6 +export interface WDShareObject {
  7 + to: ShareType,
  8 + scene: ShareScene,
  9 + type: ShareContentType,
  10 + obj: ShareContent
  11 +}
  12 +
  13 +export class WDShareBase {
  14 +
  15 + private static instance?: WDShareBase
  16 + static getInstance() : WDShareBase {
  17 + if (!WDShareBase.instance) {
  18 + WDShareBase.instance = new WDShareBase()
  19 + WDShareBase.instance.register()
  20 + }
  21 + return WDShareBase.instance
  22 + }
  23 +
  24 + private handles: HashMap<ShareType, WDShareInterface> = new HashMap()
  25 +
  26 + register() {
  27 + this.handles.set(ShareType.System, new WDSystemShare())
  28 + }
  29 +
  30 + share(obj: WDShareObject) : null | Promise<string> {
  31 + let shareHandler: WDShareInterface = this.handles.get(obj.to)
  32 + if (shareHandler) {
  33 + return shareHandler.shareContent(obj.scene, obj.obj, obj.type)
  34 + }
  35 + return null
  36 + }
  37 +
  38 +
  39 +
  40 +
  41 +}
  1 +import { ShareContent, ShareContentType, ShareScene } from './Constant'
  2 +import { AsyncCallback } from '@kit.BasicServicesKit'
  3 +
  4 +export interface WDShareInterface {
  5 + // shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void
  6 + shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string>
  7 +
  8 +
  9 +
  10 +}
  1 +@Entry
  2 +@Component
  3 +struct IndexPage {
  4 + @State message: string = 'Hello World';
  5 +
  6 + build() {
  7 + Row() {
  8 + Column() {
  9 + Text(this.message)
  10 + .fontSize(50)
  11 + .fontWeight(FontWeight.Bold)
  12 + }
  13 + .width('100%')
  14 + }
  15 + .height('100%')
  16 + }
  17 +}
  1 +{
  2 + "module": {
  3 + "name": "wdShareBase",
  4 + "type": "shared",
  5 + "description": "$string:shared_desc",
  6 + "deviceTypes": [
  7 + "phone",
  8 + "tablet",
  9 + "2in1"
  10 + ],
  11 + "deliveryWithInstall": true,
  12 + "pages": "$profile:main_pages"
  13 + }
  14 +}
  1 +{
  2 + "color": [
  3 + {
  4 + "name": "white",
  5 + "value": "#FFFFFF"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "string": [
  3 + {
  4 + "name": "shared_desc",
  5 + "value": "description"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "src": [
  3 + "pages/IndexPage"
  4 + ]
  5 +}
  1 +import localUnitTest from './LocalUnit.test';
  2 +
  3 +export default function testsuite() {
  4 + localUnitTest();
  5 +}
  1 +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
  2 +
  3 +export default function localUnitTest() {
  4 + describe('localUnitTest',() => {
  5 + // Defines a test suite. Two parameters are supported: test suite name and test suite function.
  6 + beforeAll(() => {
  7 + // Presets an action, which is performed only once before all test cases of the test suite start.
  8 + // This API supports only one parameter: preset action function.
  9 + });
  10 + beforeEach(() => {
  11 + // Presets an action, which is performed before each unit test case starts.
  12 + // The number of execution times is the same as the number of test cases defined by **it**.
  13 + // This API supports only one parameter: preset action function.
  14 + });
  15 + afterEach(() => {
  16 + // Presets a clear action, which is performed after each unit test case ends.
  17 + // The number of execution times is the same as the number of test cases defined by **it**.
  18 + // This API supports only one parameter: clear action function.
  19 + });
  20 + afterAll(() => {
  21 + // Presets a clear action, which is performed after all test cases of the test suite end.
  22 + // This API supports only one parameter: clear action function.
  23 + });
  24 + it('assertContain', 0, () => {
  25 + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
  26 + let a = 'abc';
  27 + let b = 'b';
  28 + // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
  29 + expect(a).assertContain(b);
  30 + expect(a).assertEqual(a);
  31 + });
  32 + });
  33 +}
  1 +/**
  2 + * @Description: 广告扩展信息的解析模型
  3 + * @Author:
  4 + * @Email: liyubing@wondertek.com.cn
  5 + * @CreateDate:
  6 + * @UpdateRemark: 更新说明
  7 + * @Version: 1.0
  8 + */
  9 +export interface AdvExtraData {
  10 +
  11 +
  12 + itemTopImage: string;
  13 + itemMore: AdvExtraItemData;
  14 + item: AdvExtraItemData[]
  15 +
  16 +}
  17 +
  18 +export interface AdvExtraItemData {
  19 +/**
  20 + * 图片地址
  21 + */
  22 + image: string;
  23 + /**
  24 + * 标题
  25 + */
  26 + title: string ;
  27 + /**
  28 + * 跳转地址
  29 + */
  30 + linkUrl: string;
  31 + /**
  32 + * 跳转类型
  33 + */
  34 + linkType: string;
  35 +
  36 +}
@@ -159,7 +159,7 @@ export interface LiveDetailsBean { @@ -159,7 +159,7 @@ export interface LiveDetailsBean {
159 } 159 }
160 */ 160 */
161 liveInfo: LiveInfo 161 liveInfo: LiveInfo
162 - fullColumnImgUrls: Array<FullColumnImgUrls> 162 + fullColumnImgUrls: Array<FullColumnImgUrlBean>
163 newsTitle: string 163 newsTitle: string
164 newsId: string 164 newsId: string
165 newIntroduction: string 165 newIntroduction: string
@@ -186,8 +186,12 @@ export interface MLive { @@ -186,8 +186,12 @@ export interface MLive {
186 mliveId: string 186 mliveId: string
187 } 187 }
188 188
189 -export interface FullColumnImgUrls { 189 +export interface FullColumnImgUrlBean {
190 url: string 190 url: string
  191 + height: string
  192 + landscape: number
  193 + size: string
  194 + weight: string
191 } 195 }
192 196
193 export interface Vlive { 197 export interface Vlive {
  1 +import { FullColumnImgUrlBean } from './LiveDetailsBean'
  2 +
1 export interface LiveRoomBean { 3 export interface LiveRoomBean {
2 pageNum: number 4 pageNum: number
3 pageSize: number 5 pageSize: number
@@ -15,6 +17,7 @@ export interface LiveRoomItemBean { @@ -15,6 +17,7 @@ export interface LiveRoomItemBean {
15 isWall: number 17 isWall: number
16 //是否置顶 1置顶0不置顶 18 //是否置顶 1置顶0不置顶
17 isTop: number 19 isTop: number
  20 + //guest :嘉宾,host:主持人
18 role: string 21 role: string
19 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 22 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
20 dataType: string 23 dataType: string
@@ -28,5 +31,7 @@ export interface LiveRoomItemBean { @@ -28,5 +31,7 @@ export interface LiveRoomItemBean {
28 duration: number 31 duration: number
29 //音频地址 32 //音频地址
30 audioUrl: string 33 audioUrl: string
  34 + //详情页面插入数据bean
  35 + fullColumnImgUrlDto: FullColumnImgUrlBean
31 36
32 } 37 }
@@ -167,7 +167,7 @@ export struct AudioDetailComponent { @@ -167,7 +167,7 @@ export struct AudioDetailComponent {
167 } 167 }
168 .layoutWeight(1) 168 .layoutWeight(1)
169 169
170 - OperRowListView() 170 + // OperRowListView()
171 } 171 }
172 } 172 }
173 173
@@ -39,6 +39,7 @@ export struct ImageAndTextPageComponent { @@ -39,6 +39,7 @@ export struct ImageAndTextPageComponent {
39 @State isPageEnd: boolean = false 39 @State isPageEnd: boolean = false
40 @State publishTime: string = '' 40 @State publishTime: string = ''
41 @State publishCommentModel: publishCommentModel = new publishCommentModel() 41 @State publishCommentModel: publishCommentModel = new publishCommentModel()
  42 + @State operationButtonList: string[] = ['comment', 'collect', 'share']
42 43
43 build() { 44 build() {
44 Column() { 45 Column() {
@@ -93,7 +94,7 @@ export struct ImageAndTextPageComponent { @@ -93,7 +94,7 @@ export struct ImageAndTextPageComponent {
93 .height(24) 94 .height(24)
94 .margin({ right: 5 }) 95 .margin({ right: 5 })
95 } 96 }
96 - if (this.interactData?.likeNum !== '0') { 97 + if (this.interactData?.likeNum != '0') {
97 Text(`${this.interactData?.likeNum}`) 98 Text(`${this.interactData?.likeNum}`)
98 .fontSize(16) 99 .fontSize(16)
99 .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') 100 .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
@@ -145,7 +146,8 @@ export struct ImageAndTextPageComponent { @@ -145,7 +146,8 @@ export struct ImageAndTextPageComponent {
145 if (this.contentDetailData?.length) { 146 if (this.contentDetailData?.length) {
146 OperRowListView({ 147 OperRowListView({
147 contentDetailData: this.contentDetailData[0], 148 contentDetailData: this.contentDetailData[0],
148 - publishCommentModel: this.publishCommentModel 149 + publishCommentModel: this.publishCommentModel,
  150 + operationButtonList: this.operationButtonList,
149 }) 151 })
150 } 152 }
151 } 153 }
@@ -193,17 +195,19 @@ export struct ImageAndTextPageComponent { @@ -193,17 +195,19 @@ export struct ImageAndTextPageComponent {
193 this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) 195 this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
194 this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) 196 this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
195 } 197 }
  198 + if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) {
  199 + this.operationButtonList = ['comment', 'collect', 'listen', 'share']
  200 + }
196 } 201 }
197 } 202 }
198 } 203 }
199 204
200 private async getRecommend() { 205 private async getRecommend() {
201 let params: postRecommendListParams = { 206 let params: postRecommendListParams = {
202 - // TODO ? imei: HttpUtils.getImei()  
203 - imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", 207 + imei: HttpUtils.getImei(),
204 userId: HttpUtils.getUserId(), 208 userId: HttpUtils.getUserId(),
205 contentId: String(this.contentDetailData[0]?.newsId), 209 contentId: String(this.contentDetailData[0]?.newsId),
206 - recType: 1, 210 + recType: Number(this.contentDetailData[0]?.reLInfo?.relType),
207 contentType: this.contentDetailData[0]?.newsType, 211 contentType: this.contentDetailData[0]?.newsType,
208 relId: this.contentDetailData[0]?.reLInfo?.relId, 212 relId: this.contentDetailData[0]?.reLInfo?.relId,
209 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) 213 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
@@ -117,7 +117,7 @@ export struct ImageAndTextWebComponent { @@ -117,7 +117,7 @@ export struct ImageAndTextWebComponent {
117 } 117 }
118 118
119 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { 119 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
120 - Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); 120 + Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData));
121 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, 121 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
122 JSON.stringify(h5ReceiveAppData), (data: string) => { 122 JSON.stringify(h5ReceiveAppData), (data: string) => {
123 Logger.debug('ImageAndTextWebComponent', "from js data = " + data); 123 Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
@@ -13,6 +13,7 @@ import font from '@ohos.font'; @@ -13,6 +13,7 @@ import font from '@ohos.font';
13 import { OperRowListView } from './view/OperRowListView'; 13 import { OperRowListView } from './view/OperRowListView';
14 import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; 14 import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
15 import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; 15 import { ImageDownloadComponent } from '../components/ImageDownloadComponent';
  16 +import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
16 import { EmptyComponent } from './view/EmptyComponent'; 17 import { EmptyComponent } from './view/EmptyComponent';
17 import { DateTimeUtils } from 'wdKit/Index'; 18 import { DateTimeUtils } from 'wdKit/Index';
18 import { HttpUrlUtils } from 'wdNetwork/Index'; 19 import { HttpUrlUtils } from 'wdNetwork/Index';
@@ -42,6 +43,7 @@ export struct MultiPictureDetailPageComponent { @@ -42,6 +43,7 @@ export struct MultiPictureDetailPageComponent {
42 private scroller: Scroller = new Scroller() 43 private scroller: Scroller = new Scroller()
43 @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 44 @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
44 @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 45 @State showDownload: Boolean = false // 控制是否显示下载默认隐藏
  46 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
45 47
46 //watch监听页码回调 48 //watch监听页码回调
47 onCurrentPageNumUpdated(): void { 49 onCurrentPageNumUpdated(): void {
@@ -302,6 +304,7 @@ export struct MultiPictureDetailPageComponent { @@ -302,6 +304,7 @@ export struct MultiPictureDetailPageComponent {
302 } 304 }
303 OperRowListView({ 305 OperRowListView({
304 contentDetailData: this.contentDetailData, 306 contentDetailData: this.contentDetailData,
  307 + publishCommentModel: this.publishCommentModel,
305 }) 308 })
306 .width('100%') 309 .width('100%')
307 .height(56) 310 .height(56)
@@ -369,6 +372,15 @@ export struct MultiPictureDetailPageComponent { @@ -369,6 +372,15 @@ export struct MultiPictureDetailPageComponent {
369 statusBarContentColor: '#ffffff', 372 statusBarContentColor: '#ffffff',
370 }) 373 })
371 } 374 }
  375 + if (this.contentDetailData?.openComment) {
  376 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  377 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  378 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  379 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  380 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  381 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  382 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
  383 + }
372 // this.contentDetailData.photoList = [] 384 // this.contentDetailData.photoList = []
373 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { 385 if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
374 // 暂无内容 386 // 暂无内容
@@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton' @@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'
7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
8 import { OperRowListView } from './view/OperRowListView'; 8 import { OperRowListView } from './view/OperRowListView';
9 import DetailViewModel from '../viewmodel/DetailViewModel'; 9 import DetailViewModel from '../viewmodel/DetailViewModel';
  10 +import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
10 11
11 const TAG: string = 'SpacialTopicPageComponent' 12 const TAG: string = 'SpacialTopicPageComponent'
12 13
@@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent { @@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent {
21 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 22 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
22 private webPrepared = false; 23 private webPrepared = false;
23 private dataPrepared = false; 24 private dataPrepared = false;
  25 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
24 26
25 private trySendData2H5() { 27 private trySendData2H5() {
26 if (!this.webPrepared || !this.dataPrepared) { 28 if (!this.webPrepared || !this.dataPrepared) {
@@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent { @@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent {
61 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 63 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
62 if (detailBeans && detailBeans.length > 0) { 64 if (detailBeans && detailBeans.length > 0) {
63 this.contentDetailData = detailBeans; 65 this.contentDetailData = detailBeans;
  66 + if (this.contentDetailData[0]?.openComment) {
  67 + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
  68 + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
  69 + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
  70 + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
  71 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
  72 + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
  73 + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
  74 + }
64 this.trySendData2H5() 75 this.trySendData2H5()
65 } 76 }
66 } 77 }
@@ -80,13 +91,16 @@ export struct SpacialTopicPageComponent { @@ -80,13 +91,16 @@ export struct SpacialTopicPageComponent {
80 } 91 }
81 .width(CommonConstants.FULL_WIDTH) 92 .width(CommonConstants.FULL_WIDTH)
82 .height(CommonConstants.FULL_HEIGHT) 93 .height(CommonConstants.FULL_HEIGHT)
83 - .padding({ bottom: 126 }) 94 + // .padding({ bottom: 76 })
84 95
85 if (!this.isPageEnd) { 96 if (!this.isPageEnd) {
86 detailedSkeleton() 97 detailedSkeleton()
87 } 98 }
88 //底部交互区 99 //底部交互区
89 - OperRowListView({ contentDetailData: this.contentDetailData[0] }) 100 + OperRowListView({
  101 + contentDetailData: this.contentDetailData[0],
  102 + publishCommentModel: this.publishCommentModel
  103 + })
90 } 104 }
91 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 105 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
92 } 106 }
@@ -30,7 +30,7 @@ export struct LiveFollowComponent { @@ -30,7 +30,7 @@ export struct LiveFollowComponent {
30 Stack() { 30 Stack() {
31 Stack() 31 Stack()
32 .height(22) 32 .height(22)
33 - .width(130) 33 + .width(150)
34 .backgroundColor('#000000') 34 .backgroundColor('#000000')
35 .opacity(0.3) 35 .opacity(0.3)
36 .borderRadius({ 36 .borderRadius({
@@ -71,7 +71,7 @@ export struct LiveFollowComponent { @@ -71,7 +71,7 @@ export struct LiveFollowComponent {
71 }) 71 })
72 } 72 }
73 .height(22) 73 .height(22)
74 - .width(130) 74 + .width(150)
75 } 75 }
76 } 76 }
77 77
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean'; 1 +import { CompDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 4 +import { CardAdvBottom } from './CardAdvBottom';
7 5
8 const TAG: string = 'Card2Component'; 6 const TAG: string = 'Card2Component';
9 7
10 -/**  
11 - * @Description: 广告---大图卡  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 8 +/**
  9 + * @Description: 广告---大图卡
  10 + * @Author:
  11 + * @Email: liyubing@wondertek.com.cn
  12 + * @CreateDate:
  13 + * @UpdateRemark: 更新说明
  14 + * @Version: 1.0
17 */ 15 */
18 @Component 16 @Component
19 export struct CardAdvBigImageComponent { 17 export struct CardAdvBigImageComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 18 @State compDTO: CompDTO = {} as CompDTO
22 19
  20 +
23 aboutToAppear(): void { 21 aboutToAppear(): void {
24 22
25 console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----') 23 console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
  24 +
  25 +
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
@@ -33,12 +33,21 @@ export struct CardAdvBigImageComponent { @@ -33,12 +33,21 @@ export struct CardAdvBigImageComponent {
33 build() { 33 build() {
34 34
35 Column() { 35 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 36 +
  37 + //新闻标题
  38 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
  39 + //大图
  40 + Image(this.compDTO.matInfo.matImageUrl[0])
  41 + .width(CommonConstants.FULL_WIDTH)
  42 + .aspectRatio(16 / 9)
  43 + .borderRadius(4)
  44 + .borderWidth(0.5)
  45 + .borderColor($r('app.color.color_0D000000'))
  46 + .width(CommonConstants.FULL_WIDTH)
  47 +
  48 + CardAdvBottom().margin({
  49 + top: 8,
  50 + })
42 } 51 }
43 .width(CommonConstants.FULL_WIDTH) 52 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 53 .padding({
@@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent { @@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 57 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 58 })
50 .onClick((event: ClickEvent) => { 59 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 60 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 61 })
53 } 62 }
54 } 63 }
55 64
  65 +/*
  66 + 标题样式
  67 + */
56 @Extend(Text) 68 @Extend(Text)
57 function bottomTextStyle() { 69 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 70 + .fontSize('18fp')
  71 + .fontColor($r('app.color.color_222222'))
  72 + .maxLines(3)
  73 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  74 + .align(Alignment.Start)
  75 + .width('100%')
  76 + .lineHeight(25)
60 } 77 }
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
  3 +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
  4 +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
3 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 6 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 7 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
@@ -7,22 +9,30 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' @@ -7,22 +9,30 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 9
8 const TAG: string = 'Card2Component'; 10 const TAG: string = 'Card2Component';
9 11
10 -/**  
11 - * @Description: 广告---冠名广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 12 +/**
  13 + * @Description: 广告---冠名广告
  14 + * @Author:
  15 + * @Email: liyubing@wondertek.com.cn
  16 + * @CreateDate:
  17 + * @UpdateRemark: 更新说明
  18 + * @Version: 1.0
17 */ 19 */
18 @Component 20 @Component
19 export struct CardAdvGanMiComponent { 21 export struct CardAdvGanMiComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 22 @State compDTO: CompDTO = {} as CompDTO
  23 + @State advExtraData: AdvExtraData = {} as AdvExtraData
  24 + @State advLength: number = 0;
22 25
23 aboutToAppear(): void { 26 aboutToAppear(): void {
24 27
25 console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----') 28 console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
  29 +
  30 + let extraData = this.compDTO.matInfo.extraData
  31 + let labelDTO = JSON.parse(extraData) as AdvExtraData
  32 + this.advExtraData = labelDTO
  33 + //this.advExtraData.item = [this.advExtraData.item[0]]
  34 + // this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国"
  35 + this.advLength = this.advExtraData.item.length
26 } 36 }
27 37
28 aboutToDisappear(): void { 38 aboutToDisappear(): void {
@@ -33,28 +43,160 @@ export struct CardAdvGanMiComponent { @@ -33,28 +43,160 @@ export struct CardAdvGanMiComponent {
33 build() { 43 build() {
34 44
35 Column() { 45 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 46 +
  47 +
  48 + Row() {
  49 + Stack() {
  50 + //长图
  51 + Image(this.advExtraData.itemTopImage)
  52 + .width(CommonConstants.FULL_WIDTH)
  53 + .aspectRatio(343 / 40)
  54 + .borderRadius(4)
  55 + .borderWidth(0.5)
  56 + .borderColor($r('app.color.color_0D000000'))
  57 +
  58 + // 广告标签和删除功能
  59 + Row() {
  60 + Text($r('app.string.comp_advertisement'))
  61 + .fontSize('10fp')
  62 + .fontColor($r('app.color.white'))
  63 + .width(28)
  64 + .height(16)
  65 + .backgroundColor('#4D000000')
  66 + .borderRadius(3)
  67 + .textAlign(TextAlign.Center)
  68 +
  69 + Blank()
  70 +
  71 + Stack() {
  72 + Image($r('app.media.comp_adv_close_white'))
  73 + .width(9)
  74 + .height(9)
  75 + .borderRadius({
  76 + topLeft: '4vp',
  77 + topRight: '4vp',
  78 + bottomLeft: '4vp',
  79 + bottomRight: '4vp'
  80 + })
  81 + }
  82 + .width(18)
  83 + .height(14)
  84 + .backgroundColor('#4D000000')
  85 + .borderWidth(0.5)
  86 + .borderColor($r('app.color.white'))
  87 + .borderRadius(3)
  88 +
  89 + }.width('100%').padding({
  90 + top: 8,
  91 + left: 8,
  92 + right: 8
  93 + })
  94 + }
  95 + .alignContent(Alignment.Top)
  96 + .width(CommonConstants.FULL_WIDTH)
  97 + }.width('100%').padding({
  98 + left: $r('app.float.card_comp_pagePadding_lf'),
  99 + right: $r('app.float.card_comp_pagePadding_lf'),
  100 + })
  101 +
  102 +
  103 + //
  104 + List({ space: 8 }) {
  105 +
  106 + ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
  107 +
  108 + ListItem() {
  109 + // 广告列表信息
  110 + Column() {
  111 +
  112 + Image(content.image)
  113 + .width('100%')
  114 + .aspectRatio(150 / 84)
  115 + .borderWidth(0.5)
  116 + .borderColor($r('app.color.color_0D000000'))
  117 + .borderRadius(4)
  118 +
  119 + Text(content.title)
  120 + .fontSize('16fp')
  121 + .fontColor($r('app.color.color_222222'))
  122 + .fontSize('15fp')
  123 + .maxLines(3)
  124 + .lineHeight(20)
  125 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  126 + .width('100%')
  127 + .margin({ top: 8 })
  128 +
  129 + }.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => {
  130 +
  131 + let matInfo: CompAdvMatInfoBean = {
  132 + linkUrl: content.linkUrl,
  133 + linkType: content.linkType
  134 + } as CompAdvMatInfoBean;
  135 + ProcessUtils.openAdvDetail(matInfo)
  136 +
  137 + })
  138 +
  139 + }
  140 +
  141 + })
  142 +
  143 + }
  144 + .width('100%')
  145 + .listDirection(Axis.Horizontal)
  146 + .edgeEffect(EdgeEffect.None)
  147 + .scrollBar(BarState.Off)
  148 + .contentStartOffset(this.advLength == 1 ? 0 : 16)
  149 + .contentEndOffset(this.advLength == 1 ? 0 : 16)
  150 + .margin({ top: 10, bottom: 10 })
  151 + .padding({
  152 + left: this.advLength == 1 ? 16 : 0,
  153 + right: this.advLength == 1 ? 16 : 0,
  154 + })
  155 +
  156 +
  157 + // 更多按钮
  158 + commonButton(this.advExtraData)
  159 +
42 } 160 }
43 .width(CommonConstants.FULL_WIDTH) 161 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 162 .padding({
45 - left: $r('app.float.card_comp_pagePadding_lf'),  
46 - right: $r('app.float.card_comp_pagePadding_lf'),  
47 top: $r('app.float.card_comp_pagePadding_tb'), 163 top: $r('app.float.card_comp_pagePadding_tb'),
48 bottom: $r('app.float.card_comp_pagePadding_tb') 164 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 165 })
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - }) 166 +
53 } 167 }
54 } 168 }
55 169
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 170 +/*
  171 + 标题样式
  172 + */
  173 +@Builder
  174 +function commonButton(advExtraData: AdvExtraData) {
  175 +
  176 +
  177 + Row() {
  178 + Row() {
  179 + Blank()
  180 + Text('查看更多').fontColor('#222222').fontSize('14fp')
  181 + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
  182 + Blank()
  183 +
  184 + }
  185 + .width('100%')
  186 + .backgroundColor('#F5F5F5')
  187 + .borderRadius(3)
  188 + .padding({ top: 10, bottom: 10, })
  189 + .onClick(() => {
  190 + let matInfo: CompAdvMatInfoBean = {
  191 + linkUrl: advExtraData.itemMore.linkUrl,
  192 + linkType: advExtraData.itemMore.linkType
  193 + } as CompAdvMatInfoBean;
  194 + ProcessUtils.openAdvDetail(matInfo)
  195 + })
  196 + }.width('100%').padding({
  197 + left: $r('app.float.card_comp_pagePadding_lf'),
  198 + right: $r('app.float.card_comp_pagePadding_lf'),
  199 +
  200 + })
  201 +
60 } 202 }
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
3 -import { CommonConstants } from 'wdConstant/Index'; 3 +import { CommonConstants, CompStyle } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  7 +import { CardAdvBottom } from './CardAdvBottom';
7 8
8 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
9 10
10 -/**  
11 - * @Description: 广告---长通栏广告 和 顶部长通栏广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 11 +/**
  12 + * @Description: 广告---长通栏广告 和 顶部长通栏广告
  13 + * @Author:
  14 + * @Email: liyubing@wondertek.com.cn
  15 + * @CreateDate:
  16 + * @UpdateRemark: 更新说明
  17 + * @Version: 1.0
17 */ 18 */
18 @Component 19 @Component
19 export struct CardAdvLongImageComponent { 20 export struct CardAdvLongImageComponent {
20 21
  22 +
21 @State compDTO: CompDTO = {} as CompDTO 23 @State compDTO: CompDTO = {} as CompDTO
22 24
  25 + @State haveTitle : boolean = true
  26 +
23 aboutToAppear(): void { 27 aboutToAppear(): void {
24 28
25 console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----') 29 console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
  30 +
  31 + this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
26 } 32 }
27 33
28 aboutToDisappear(): void { 34 aboutToDisappear(): void {
@@ -33,12 +39,23 @@ export struct CardAdvLongImageComponent { @@ -33,12 +39,23 @@ export struct CardAdvLongImageComponent {
33 build() { 39 build() {
34 40
35 Column() { 41 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 42 +
  43 + //新闻标题
  44 + if(this.haveTitle ){
  45 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
  46 + }
  47 +
  48 + //长图
  49 + Image(this.compDTO.matInfo.matImageUrl[0])
  50 + .width(CommonConstants.FULL_WIDTH)
  51 + .aspectRatio(343 / 96)
  52 + .borderRadius(4)
  53 + .borderWidth(0.5)
  54 + .borderColor($r('app.color.color_0D000000'))
  55 +
  56 + CardAdvBottom().margin({
  57 + top: 8,
  58 + })
42 } 59 }
43 .width(CommonConstants.FULL_WIDTH) 60 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 61 .padding({
@@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent { @@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 65 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 66 })
50 .onClick((event: ClickEvent) => { 67 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 68 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 69 })
53 } 70 }
54 } 71 }
55 72
  73 +/*
  74 + 标题样式
  75 + */
56 @Extend(Text) 76 @Extend(Text)
57 function bottomTextStyle() { 77 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 78 + .fontSize('18fp')
  79 + .fontColor($r('app.color.color_222222'))
  80 + .maxLines(3)
  81 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  82 + .align(Alignment.Start)
  83 + .lineHeight(25)
60 } 84 }
@@ -62,6 +62,7 @@ export struct CardAdvSmallImageComponent { @@ -62,6 +62,7 @@ export struct CardAdvSmallImageComponent {
62 .borderWidth(0.5) 62 .borderWidth(0.5)
63 .borderColor($r('app.color.color_0D000000')) 63 .borderColor($r('app.color.color_0D000000'))
64 .borderRadius(4) 64 .borderRadius(4)
  65 + //.alt('wwww.baidu.com')
65 .alignRules({ 66 .alignRules({
66 top: { anchor: 'title_name', align: VerticalAlign.Top }, 67 top: { anchor: 'title_name', align: VerticalAlign.Top },
67 left: { anchor: 'title_name', align: HorizontalAlign.End }, 68 left: { anchor: 'title_name', align: HorizontalAlign.End },
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 -import { CompDTO, ContentDTO } from 'wdBean'; 2 +import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  7 +import { CardAdvBottom } from './CardAdvBottom';
7 8
8 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
9 10
10 -/**  
11 - * @Description: 广告---视频广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 11 +/**
  12 + * @Description: 广告---视频广告
  13 + * @Author:
  14 + * @Email: liyubing@wondertek.com.cn
  15 + * @CreateDate:
  16 + * @UpdateRemark: 更新说明
  17 + * @Version: 1.0
17 */ 18 */
18 @Component 19 @Component
19 export struct CardAdvVideoComponent { 20 export struct CardAdvVideoComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
  22 + @State contentDTO: ContentDTO = {} as ContentDTO
22 23
23 aboutToAppear(): void { 24 aboutToAppear(): void {
24 -  
25 console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----') 25 console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
  26 +
  27 +
  28 + // this.contentDTO.objectType = '1'
  29 + // this.contentDTO.videoInfo = { videoDuration: 1000 } as VideoInfoDTO
26 } 30 }
27 31
28 aboutToDisappear(): void { 32 aboutToDisappear(): void {
@@ -33,12 +37,29 @@ export struct CardAdvVideoComponent { @@ -33,12 +37,29 @@ export struct CardAdvVideoComponent {
33 build() { 37 build() {
34 38
35 Column() { 39 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 40 +
  41 + //新闻标题
  42 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle()
  43 + //大图
  44 + Stack() {
  45 + Image(this.compDTO.matInfo.matImageUrl[0])
  46 + .width(CommonConstants.FULL_WIDTH)
  47 + .aspectRatio(16 / 9)
  48 + .borderRadius(4)
  49 + .borderWidth(0.5)
  50 + .borderColor($r('app.color.color_0D000000'))
  51 + //播放状态+时长
  52 + CardMediaInfo({
  53 + contentDTO: this.contentDTO
  54 + })
  55 + }
  56 + .alignContent(Alignment.BottomEnd)
  57 + .width(CommonConstants.FULL_WIDTH)
  58 + .margin({ top: 8 })
  59 +
  60 + CardAdvBottom().margin({
  61 + top: 8,
  62 + })
42 } 63 }
43 .width(CommonConstants.FULL_WIDTH) 64 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 65 .padding({
@@ -48,13 +69,21 @@ export struct CardAdvVideoComponent { @@ -48,13 +69,21 @@ export struct CardAdvVideoComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 69 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 70 })
50 .onClick((event: ClickEvent) => { 71 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 72 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 73 })
53 } 74 }
54 } 75 }
55 76
  77 +/*
  78 + 标题样式
  79 + */
56 @Extend(Text) 80 @Extend(Text)
57 function bottomTextStyle() { 81 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 82 + .fontSize('18fp')
  83 + .fontColor($r('app.color.color_222222'))
  84 + .maxLines(3)
  85 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  86 + .align(Alignment.Start)
  87 + .width('100%')
  88 + .lineHeight(25)
60 } 89 }
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean'; 1 +import { CompDTO } from 'wdBean';
  2 +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
  3 +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
3 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 6
8 const TAG: string = 'Card2Component'; 7 const TAG: string = 'Card2Component';
9 8
10 -/**  
11 - * @Description: 广告---冠名广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 9 +/**
  10 + * @Description: 广告---展会广告
  11 + * @Author:
  12 + * @Email: liyubing@wondertek.com.cn
  13 + * @CreateDate:
  14 + * @UpdateRemark: 更新说明
  15 + * @Version: 1.0
17 */ 16 */
18 @Component 17 @Component
19 export struct CardAdvVideoExComponent { 18 export struct CardAdvVideoExComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 19 @State compDTO: CompDTO = {} as CompDTO
  20 + @State advExtraData: AdvExtraData = {} as AdvExtraData
22 21
23 aboutToAppear(): void { 22 aboutToAppear(): void {
24 23
25 - console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----') 24 + console.error('ZZZXXXXX', '--展会广告------aboutToAppear-----')
  25 +
  26 + let extraData = this.compDTO.matInfo.extraData
  27 + let labelDTO = JSON.parse(extraData) as AdvExtraData
  28 + this.advExtraData = labelDTO
26 } 29 }
27 30
28 aboutToDisappear(): void { 31 aboutToDisappear(): void {
29 32
30 - console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----') 33 + console.error('ZZZXXXXX', '----展会广告----aboutToDisappear-----')
31 } 34 }
32 35
33 build() { 36 build() {
34 37
35 Column() { 38 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 39 +
  40 + Stack() {
  41 + //长图
  42 + Image(this.advExtraData.itemTopImage)
  43 + .width(CommonConstants.FULL_WIDTH)
  44 + .aspectRatio(343 / 80)
  45 + .borderRadius(4)
  46 + .borderWidth(0.5)
  47 + .borderColor($r('app.color.color_0D000000'))
  48 +
  49 +
  50 + Row() {
  51 +
  52 + Text($r('app.string.comp_advertisement'))
  53 + .fontSize('10fp')
  54 + .fontColor($r('app.color.white'))
  55 + .width(28)
  56 + .height(16)
  57 + .backgroundColor('#4D000000')
  58 + .borderRadius(4)
  59 + .textAlign(TextAlign.Center)
  60 +
  61 + Blank()
  62 +
  63 + Stack() {
  64 + Image($r('app.media.comp_adv_close_white'))
  65 + .width(9)
  66 + .height(9)
  67 + .borderRadius({
  68 + topLeft: '4vp',
  69 + topRight: '4vp',
  70 + bottomLeft: '4vp',
  71 + bottomRight: '4vp'
  72 + })
  73 + }
  74 + .width(18)
  75 + .height(14)
  76 + .backgroundColor('#4D000000')
  77 + .borderWidth(0.5)
  78 + .borderColor($r('app.color.white'))
  79 + .borderRadius(4)
  80 +
  81 + }.width('100%').padding({
  82 + top: 8,
  83 + left: 8,
  84 + right: 8
  85 + })
  86 + }
  87 + .alignContent(Alignment.Top)
  88 + .width(CommonConstants.FULL_WIDTH)
  89 +
  90 + //
  91 + List({ space: 10 }) {
  92 +
  93 + ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
  94 +
  95 + ListItem() {
  96 +
  97 + Text(content.title).fontSize('16fp').fontColor($r('app.color.color_222222')).width('100%').onClick(() => {
  98 + let matInfo: CompAdvMatInfoBean = {
  99 + linkUrl: content.linkUrl,
  100 + linkType: content.linkType
  101 + } as CompAdvMatInfoBean;
  102 + ProcessUtils.openAdvDetail(matInfo)
  103 + })
  104 + }
  105 +
  106 + })
  107 +
  108 + }.width('100%').listDirection(Axis.Vertical).margin({ top: 10, bottom: 10 })
  109 +
  110 + // 更多按钮
  111 + commonButton(this.advExtraData)
  112 +
42 } 113 }
43 .width(CommonConstants.FULL_WIDTH) 114 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 115 .padding({
@@ -47,14 +118,33 @@ export struct CardAdvVideoExComponent { @@ -47,14 +118,33 @@ export struct CardAdvVideoExComponent {
47 top: $r('app.float.card_comp_pagePadding_tb'), 118 top: $r('app.float.card_comp_pagePadding_tb'),
48 bottom: $r('app.float.card_comp_pagePadding_tb') 119 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 120 })
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - }) 121 +
53 } 122 }
54 } 123 }
55 124
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 125 +/*
  126 + 标题样式
  127 + */
  128 +@Builder
  129 +function commonButton(advExtraData: AdvExtraData) {
  130 +
  131 +
  132 + Row() {
  133 + Blank()
  134 + Text('查看更多').fontColor('#222222').fontSize('14fp')
  135 + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
  136 + Blank()
  137 +
  138 + }
  139 + .width('100%')
  140 + .backgroundColor('#F5F5F5')
  141 + .borderRadius(3)
  142 + .padding({ top: 10, bottom: 10, })
  143 + .onClick(() => {
  144 + let matInfo: CompAdvMatInfoBean = {
  145 + linkUrl: advExtraData.itemMore.linkUrl,
  146 + linkType: advExtraData.itemMore.linkType
  147 + } as CompAdvMatInfoBean;
  148 + ProcessUtils.openAdvDetail(matInfo)
  149 + })
60 } 150 }
@@ -71,6 +71,7 @@ export struct LiveCommentComponent { @@ -71,6 +71,7 @@ export struct LiveCommentComponent {
71 left: 6, 71 left: 6,
72 right: 2 72 right: 2
73 }) 73 })
  74 + .visibility(this.heartNum > 0 ? Visibility.Visible : Visibility.Hidden)
74 Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal')) 75 Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal'))
75 .width(24) 76 .width(24)
76 .height(24) 77 .height(24)
@@ -250,10 +250,10 @@ struct ChannelDialog { @@ -250,10 +250,10 @@ struct ChannelDialog {
250 .fontSize(16) 250 .fontSize(16)
251 .fontWeight(600) 251 .fontWeight(600)
252 .margin({ right: 4 }) 252 .margin({ right: 4 })
253 - Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)  
254 - .fontSize(12)  
255 - .fontWeight(400)  
256 - .fontColor('#222222') 253 + // Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
  254 + // .fontSize(12)
  255 + // .fontWeight(400)
  256 + // .fontColor('#222222')
257 } 257 }
258 258
259 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) 259 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
@@ -276,9 +276,9 @@ struct ChannelDialog { @@ -276,9 +276,9 @@ struct ChannelDialog {
276 Row() { 276 Row() {
277 Text(item.name) 277 Text(item.name)
278 .fontSize(14) 278 .fontSize(14)
279 - .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) 279 + .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222'))
280 280
281 - if (this.isEditIng && item.delPermitted === 1) { 281 + if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) {
282 Image($r('app.media.icon_audio_close')) 282 Image($r('app.media.icon_audio_close'))
283 .width(12) 283 .width(12)
284 .margin({ left: 1 }) 284 .margin({ left: 1 })
@@ -287,12 +287,12 @@ struct ChannelDialog { @@ -287,12 +287,12 @@ struct ChannelDialog {
287 .width('100%') 287 .width('100%')
288 .height('100%') 288 .height('100%')
289 .justifyContent(FlexAlign.Center) 289 .justifyContent(FlexAlign.Center)
290 - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') 290 + .backgroundColor(item.headlinesOn === 1 || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
291 } 291 }
292 .width('23%') 292 .width('23%')
293 .height(40) 293 .height(40)
294 .border({ 294 .border({
295 - width: item.homeChannel === '1' ? 0 : 1, 295 + width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1,
296 color: '#EDEDED', 296 color: '#EDEDED',
297 radius: 3 297 radius: 3
298 }) 298 })
@@ -303,7 +303,7 @@ struct ChannelDialog { @@ -303,7 +303,7 @@ struct ChannelDialog {
303 TapGesture() 303 TapGesture()
304 .onAction((event?: GestureEvent) => { 304 .onAction((event?: GestureEvent) => {
305 if (this.isEditIng) { 305 if (this.isEditIng) {
306 - if (item.delPermitted === 1) { 306 + if (item.delPermitted === 1 && item.movePermitted === 1) {
307 this.delChannelItem(index) 307 this.delChannelItem(index)
308 } 308 }
309 } else { 309 } else {
@@ -59,7 +59,6 @@ export struct TopNavigationComponent { @@ -59,7 +59,6 @@ export struct TopNavigationComponent {
59 @State autoRefresh2Page: number = 0 59 @State autoRefresh2Page: number = 0
60 // 当前底导index 60 // 当前底导index
61 @State navIndex: number = 0 61 @State navIndex: number = 0
62 -  
63 @State animationDuration: number = 0 62 @State animationDuration: number = 0
64 @State indicatorLeftMargin: number = 0 63 @State indicatorLeftMargin: number = 0
65 @State indicatorWidth: number = 0 64 @State indicatorWidth: number = 0
@@ -93,7 +92,8 @@ export struct TopNavigationComponent { @@ -93,7 +92,8 @@ export struct TopNavigationComponent {
93 92
94 //defaultMyChannelList 93 //defaultMyChannelList
95 defaultList.forEach(item => { 94 defaultList.forEach(item => {
96 - if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || item.headlinesOn === 1) { 95 + if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 ||
  96 + item.headlinesOn === 1) {
97 defaultMyChannelList.push(item); 97 defaultMyChannelList.push(item);
98 } 98 }
99 if (item.defaultPermitted === 1) { 99 if (item.defaultPermitted === 1) {
@@ -136,13 +136,15 @@ export struct TopNavigationComponent { @@ -136,13 +136,15 @@ export struct TopNavigationComponent {
136 } 136 }
137 137
138 //频道分类 138 //频道分类
139 - if (item.myChannel === '1' && item.name !== '播报') {  
140 - _myChannelList.push(item)  
141 - _channelIds.push(item.channelId)  
142 - } else if (item.moreChannel === '1') {  
143 - this.moreChannelList.push(item)  
144 - } else if (item.localChannel === '1') {  
145 - this.localChannelList.push(item) 139 + if (item.name !== '播报') { //暂时隐藏播报
  140 + if (item.myChannel === '1') {
  141 + _myChannelList.push(item)
  142 + _channelIds.push(item.channelId)
  143 + } else if (item.moreChannel === '1') {
  144 + this.moreChannelList.push(item)
  145 + } else if (item.localChannel === '1') {
  146 + this.localChannelList.push(item)
  147 + }
146 } 148 }
147 149
148 }) 150 })
@@ -169,7 +171,6 @@ export struct TopNavigationComponent { @@ -169,7 +171,6 @@ export struct TopNavigationComponent {
169 return item.name === '版面' 171 return item.name === '版面'
170 } 172 }
171 173
172 -  
173 build() { 174 build() {
174 Column() { 175 Column() {
175 // 顶部搜索、日报logo、早晚报 176 // 顶部搜索、日报logo、早晚报
@@ -216,51 +217,51 @@ export struct TopNavigationComponent { @@ -216,51 +217,51 @@ export struct TopNavigationComponent {
216 // 频道分类list 217 // 频道分类list
217 Stack({ alignContent: Alignment.TopEnd }) { 218 Stack({ alignContent: Alignment.TopEnd }) {
218 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { 219 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
219 - ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {  
220 - TabContent() {  
221 - if (this.currentBottomNavName === '视频' && navItem.name === '视频') {  
222 - VideoChannelDetail({  
223 - bottomNavIndex: $_currentNavIndex,  
224 - topNavIndex: $currentTopNavSelectedIndex,  
225 - groupId: this.groupId + '',  
226 - pageId: navItem.pageId + '',  
227 - channelId: navItem.channelId + '',  
228 - })  
229 - }  
230 - else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {  
231 - PeopleShipMainComponent({  
232 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
233 - navIndex: index,  
234 - pageId: navItem.pageId + '',  
235 - channelId: navItem.channelId + '',  
236 - })  
237 - }  
238 - else  
239 - if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {  
240 - PageComponent({ 220 + ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList,
  221 + (navItem: TopNavDTO, index: number) => {
  222 + TabContent() {
  223 + if (this.currentBottomNavName === '视频' && navItem.name === '视频') {
  224 + VideoChannelDetail({
  225 + bottomNavIndex: $_currentNavIndex,
  226 + topNavIndex: $currentTopNavSelectedIndex,
  227 + groupId: this.groupId + '',
  228 + pageId: navItem.pageId + '',
  229 + channelId: navItem.channelId + '',
  230 + })
  231 + } else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
  232 + PeopleShipMainComponent({
241 currentTopNavSelectedIndex: $currentTopNavSelectedIndex, 233 currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
242 navIndex: index, 234 navIndex: index,
243 pageId: navItem.pageId + '', 235 pageId: navItem.pageId + '',
244 channelId: navItem.channelId + '', 236 channelId: navItem.channelId + '',
245 - autoRefresh: this.autoRefresh2Page  
246 }) 237 })
247 - }  
248 - }  
249 - .tabBar(this.tabBarBuilder(navItem, index)) 238 + } else
  239 + if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
  240 + PageComponent({
  241 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
  242 + navIndex: index,
  243 + pageId: navItem.pageId + '',
  244 + channelId: navItem.channelId + '',
  245 + autoRefresh: this.autoRefresh2Page
  246 + })
  247 + }
  248 + }
  249 + .tabBar(this.tabBarBuilder(navItem, index))
250 250
251 - }, (navItem: TopNavDTO) => JSON.stringify(navItem)); 251 + }, (navItem: TopNavDTO) => JSON.stringify(navItem));
252 } 252 }
253 .barHeight($r('app.float.top_tab_bar_height')) 253 .barHeight($r('app.float.top_tab_bar_height'))
254 .barMode(BarMode.Scrollable) 254 .barMode(BarMode.Scrollable)
255 .vertical(false) 255 .vertical(false)
256 .barBackgroundColor(this.barBackgroundColor) 256 .barBackgroundColor(this.barBackgroundColor)
257 - .onAreaChange((oldValue: Area,newValue: Area)=> { 257 + .onAreaChange((oldValue: Area, newValue: Area) => {
258 let width = Number.parseFloat(newValue.width.toString()) 258 let width = Number.parseFloat(newValue.width.toString())
259 this.tabsWidth = Number.isNaN(width) ? 0 : width 259 this.tabsWidth = Number.isNaN(width) ? 0 : width
260 }) 260 })
261 .animationDuration(this.animationDuration) 261 .animationDuration(this.animationDuration)
262 .onChange((index: number) => { 262 .onChange((index: number) => {
263 - this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name 263 + this.currentTopNavName =
  264 + this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
264 Logger.info(TAG, `onChange index : ${index}`); 265 Logger.info(TAG, `onChange index : ${index}`);
265 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 266 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
266 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 267 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
@@ -288,27 +289,27 @@ export struct TopNavigationComponent { @@ -288,27 +289,27 @@ export struct TopNavigationComponent {
288 let targetIndexInfo = this.getTextInfo(targetIndex) 289 let targetIndexInfo = this.getTextInfo(targetIndex)
289 this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width) 290 this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width)
290 }) 291 })
291 - .onAnimationEnd((index: number,event: TabsAnimationEvent) => { 292 + .onAnimationEnd((index: number, event: TabsAnimationEvent) => {
292 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 293 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
293 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 294 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
294 ) { 295 ) {
295 return 296 return
296 } 297 }
297 - // 切换动画结束时触发该回调。下划线动画停止。  
298 - let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event)  
299 - this.startAnimateTo(0,currentIndicatorInfo.left,currentIndicatorInfo.width) 298 + // 切换动画结束时触发该回调。下划线动画停止。
  299 + let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event)
  300 + this.startAnimateTo(0, currentIndicatorInfo.left, currentIndicatorInfo.width)
300 }) 301 })
301 - .onGestureSwipe((index: number,event: TabsAnimationEvent) => { 302 + .onGestureSwipe((index: number, event: TabsAnimationEvent) => {
302 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 303 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
303 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 304 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
304 ) { 305 ) {
305 return 306 return
306 } 307 }
307 - // 在页面跟手滑动过程中,逐帧触发该回调。  
308 - let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event)  
309 - this.currentTopNavSelectedIndex = currentIndicatorInfo.index  
310 - this.indicatorLeftMargin = currentIndicatorInfo.left  
311 - this.indicatorWidth = currentIndicatorInfo.width 308 + // 在页面跟手滑动过程中,逐帧触发该回调。
  309 + let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event)
  310 + this.currentTopNavSelectedIndex = currentIndicatorInfo.index
  311 + this.indicatorLeftMargin = currentIndicatorInfo.left
  312 + this.indicatorWidth = currentIndicatorInfo.width
312 }) 313 })
313 314
314 // 分类列表最右侧频道设置 315 // 分类列表最右侧频道设置
@@ -351,8 +352,9 @@ export struct TopNavigationComponent { @@ -351,8 +352,9 @@ export struct TopNavigationComponent {
351 .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) 352 .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
352 .maxLines(this.MAX_LINE) 353 .maxLines(this.MAX_LINE)
353 .id(index.toString()) 354 .id(index.toString())
354 - .onAreaChange((oldValue: Area,newValue: Area) => {  
355 - if (this.currentTopNavSelectedIndex === index && (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)){ 355 + .onAreaChange((oldValue: Area, newValue: Area) => {
  356 + if (this.currentTopNavSelectedIndex === index &&
  357 + (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
356 if (newValue.position.x != undefined) { 358 if (newValue.position.x != undefined) {
357 let positionX = Number.parseFloat(newValue.position.x.toString()) 359 let positionX = Number.parseFloat(newValue.position.x.toString())
358 this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX 360 this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
@@ -396,7 +398,8 @@ export struct TopNavigationComponent { @@ -396,7 +398,8 @@ export struct TopNavigationComponent {
396 } 398 }
397 399
398 onTopNavigationDataUpdated() { 400 onTopNavigationDataUpdated() {
399 - Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); 401 + Logger.info(TAG,
  402 + `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
400 } 403 }
401 404
402 onAutoRefresh() { 405 onAutoRefresh() {
@@ -505,7 +508,7 @@ export struct TopNavigationComponent { @@ -505,7 +508,7 @@ export struct TopNavigationComponent {
505 let indexInfo = this.getTextInfo(index) 508 let indexInfo = this.getTextInfo(index)
506 let nextIndexInfo = this.getTextInfo(nextIndex) 509 let nextIndexInfo = this.getTextInfo(nextIndex)
507 let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth) 510 let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)
508 - let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。 511 + let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。
509 let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio 512 let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio
510 let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio 513 let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio
511 return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth } 514 return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }
@@ -15,6 +15,8 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV @@ -15,6 +15,8 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV
15 import { LikeComponent } from './LikeComponent'; 15 import { LikeComponent } from './LikeComponent';
16 import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent'; 16 import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
17 import { publishCommentModel } from '../comment/model/PublishCommentModel' 17 import { publishCommentModel } from '../comment/model/PublishCommentModel'
  18 +// import { AudioBarView } from '../MorningEveningPaper/AudioBarView'
  19 +// import { AudioDialog } from '../../dialog/AudioDialog'
18 import { HttpUrlUtils } from 'wdNetwork/Index'; 20 import { HttpUrlUtils } from 'wdNetwork/Index';
19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 21 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { PageRepository } from '../../repository/PageRepository'; 22 import { PageRepository } from '../../repository/PageRepository';
@@ -26,25 +28,27 @@ const TAG = 'OperRowListView'; @@ -26,25 +28,27 @@ const TAG = 'OperRowListView';
26 * 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享 28 * 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享
27 * 上层传值: 29 * 上层传值:
28 * 1、(必传) contentDetailData---稿件详情 30 * 1、(必传) contentDetailData---稿件详情
29 - * 2、(非必传) operationButtonList---组件展示条件,['comment', 'like', 'collect', 'share'],需要展示什么传什么  
30 - * comment--评论;like--点赞;collect--收藏;share--分享; 31 + * 2、(非必传) operationButtonList---组件展示条件,
  32 + * ['comment', 'like', 'collect', 'share'],需要展示什么传什么
  33 + * comment--评论;like--点赞;collect--收藏;listen--音频;share--分享;
31 * 34 *
32 * 传值示例: 35 * 传值示例:
33 OperRowListView({ 36 OperRowListView({
34 contentDetailData: this.contentDetailData[0], 37 contentDetailData: this.contentDetailData[0],
35 - operationButtonList: ['comment', 'like', 'collect', 'share'] 38 + operationButtonList: ['comment', 'like', 'collect', 'listen', 'share']
36 }) 39 })
37 */ 40 */
38 @Preview 41 @Preview
39 @Component 42 @Component
40 export struct OperRowListView { 43 export struct OperRowListView {
41 @Prop contentDetailData: ContentDetailDTO // 稿件详情 44 @Prop contentDetailData: ContentDetailDTO // 稿件详情
42 - @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件 45 + @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
43 @ObjectLink publishCommentModel: publishCommentModel 46 @ObjectLink publishCommentModel: publishCommentModel
44 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 47 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
45 @State interactData: InteractDataDTO = {} as InteractDataDTO 48 @State interactData: InteractDataDTO = {} as InteractDataDTO
46 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 49 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
47 @State likeBean: Record<string, string> = {} 50 @State likeBean: Record<string, string> = {}
  51 + @State audioUrl: string= ''
48 needLike: boolean = true 52 needLike: boolean = true
49 53
50 async aboutToAppear() { 54 async aboutToAppear() {
@@ -70,10 +74,16 @@ export struct OperRowListView { @@ -70,10 +74,16 @@ export struct OperRowListView {
70 this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + '' 74 this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
71 this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + '' 75 this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
72 this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/ 76 this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/
  77 + // 音频需要数据
  78 + if (this.operationButtonList?.includes('listen')) {
  79 + this.audioUrl = this.contentDetailData.audioList[0]?.audioUrl || ''
  80 + console.log(TAG, 'this.audioUrl+++', this.audioUrl)
  81 + }
73 } 82 }
74 83
75 build() { 84 build() {
76 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 85 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
  86 + // AudioDialog()
77 Row() { 87 Row() {
78 Column() { 88 Column() {
79 Image($r('app.media.icon_arrow_left')) 89 Image($r('app.media.icon_arrow_left'))
@@ -95,6 +105,8 @@ export struct OperRowListView { @@ -95,6 +105,8 @@ export struct OperRowListView {
95 this.builderLike() 105 this.builderLike()
96 } else if (item == 'collect') { 106 } else if (item == 'collect') {
97 this.builderCollect() 107 this.builderCollect()
  108 + } else if (item == 'listen') {
  109 + this.builderListen()
98 } else if (item == 'share') { 110 } else if (item == 'share') {
99 this.builderShare() 111 this.builderShare()
100 } else { 112 } else {
@@ -176,6 +188,25 @@ export struct OperRowListView { @@ -176,6 +188,25 @@ export struct OperRowListView {
176 } 188 }
177 189
178 /** 190 /**
  191 + * 音频组件
  192 + */
  193 + // this.audioUrl
  194 + @Builder
  195 + builderListen() {
  196 + Column() {
  197 + Image($r('app.media.icon_listen'))
  198 + .width(24)
  199 + .height(24)
  200 + .aspectRatio(1)
  201 + .interpolation(ImageInterpolation.High)
  202 + .onClick((event: ClickEvent) => {
  203 + ToastUtils.showToast('音频为公共方法,待开发', 1000);
  204 + })
  205 + }
  206 + .width(42)
  207 + }
  208 +
  209 + /**
179 * 分享组件 210 * 分享组件
180 */ 211 */
181 @Builder 212 @Builder
@@ -12,7 +12,7 @@ export struct ENewspaperListDialog { @@ -12,7 +12,7 @@ export struct ENewspaperListDialog {
12 @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string 12 @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
13 @State pageDialogShow: boolean = false 13 @State pageDialogShow: boolean = false
14 @State scrollIndex: number = 0 14 @State scrollIndex: number = 0
15 - @Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean 15 + @Prop @Watch('updateRecordsData') newspaperListBean: NewspaperListBean = {} as NewspaperListBean
16 private listScroller: Scroller = new Scroller(); 16 private listScroller: Scroller = new Scroller();
17 //文字版选择弹框 17 //文字版选择弹框
18 pageListDialogController: CustomDialogController = new CustomDialogController({ 18 pageListDialogController: CustomDialogController = new CustomDialogController({
@@ -114,92 +114,128 @@ export struct ENewspaperListDialog { @@ -114,92 +114,128 @@ export struct ENewspaperListDialog {
114 .fontSize($r('app.float.font_size_14')) 114 .fontSize($r('app.float.font_size_14'))
115 .fontColor($r('app.color.color_ED2800')) 115 .fontColor($r('app.color.color_ED2800'))
116 .fontWeight(600) 116 .fontWeight(600)
117 - .margin({ top: 16, bottom: 16 }) 117 + .width('100%')
  118 + .textAlign(TextAlign.Start)
  119 + .margin({
  120 + // top: 16,
  121 + bottom: 16
  122 + })
118 .maxLines(1) 123 .maxLines(1)
119 } 124 }
  125 + Column() {
  126 + if (positionItem.shortTitle) {
  127 + Text(positionItem.shortTitle)
  128 + .fontSize($r('app.float.font_size_14'))
  129 + .fontColor($r('app.color.color_222222'))
  130 + .fontWeight(600)
  131 + .maxLines(2)
  132 + .margin({
  133 + bottom: 8
  134 + })
  135 + }
120 136
121 - if (positionItem.shortTitle) {  
122 - Text(positionItem.shortTitle)  
123 - .fontSize($r('app.float.font_size_14'))  
124 - .fontColor($r('app.color.color_222222'))  
125 - .fontWeight(600)  
126 - .maxLines(2)  
127 - }  
128 -  
129 - if (positionItem.title) {  
130 - Text(positionItem.title)  
131 - .fontSize($r('app.float.font_size_17'))  
132 - .fontColor($r('app.color.color_222222'))  
133 - .fontWeight(600)  
134 - .margin({ top: 8 })  
135 - .maxLines(2)  
136 - } 137 + if (positionItem.title) {
  138 + Text(positionItem.title)
  139 + .fontSize($r('app.float.font_size_17'))
  140 + .fontColor($r('app.color.color_222222'))
  141 + .fontWeight(600)
  142 + .margin({
  143 + bottom: 8
  144 + })
  145 + .maxLines(2)
  146 + }
137 147
138 - if (positionItem.downTitle) {  
139 - Text(positionItem.downTitle)  
140 - .fontSize($r('app.float.font_size_14'))  
141 - .fontColor($r('app.color.color_222222'))  
142 - .fontWeight(600)  
143 - .margin({ top: 8 })  
144 - .maxLines(2) 148 + if (positionItem.downTitle) {
  149 + Text(positionItem.downTitle)
  150 + .fontSize($r('app.float.font_size_14'))
  151 + .fontColor($r('app.color.color_222222'))
  152 + .fontWeight(600)
  153 + .margin({
  154 + bottom: 8
  155 + })
  156 + .maxLines(2)
  157 + }
  158 + if (positionItem.newsTxt) {
  159 + Text(positionItem.newsTxt)
  160 + .fontSize($r('app.float.font_size_14'))
  161 + .fontColor($r('app.color.color_999999'))
  162 + .margin({
  163 + // bottom: 15
  164 + })
  165 + .maxLines(5)
  166 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  167 + }
145 } 168 }
  169 + .width('100%')
  170 + .alignItems(HorizontalAlign.Start)
  171 + .onClick(() => {
  172 + let taskAction: Action = {
  173 + type: 'JUMP_INNER_NEW_PAGE',
  174 + params: {
  175 + contentID: '' + positionItem.newsId,
  176 + pageID: 'IMAGE_TEXT_DETAIL',
  177 + extra: {
  178 + relType: positionItem.relType ?? '',
  179 + relId: '' + positionItem.relId,
  180 + sourcePage: '5'
  181 + } as ExtraDTO
  182 + } as Params,
  183 + };
  184 + WDRouterRule.jumpWithAction(taskAction)
  185 + // if (this.listDialogController) {
  186 + // this.listDialogController.close()
  187 + // }
  188 + })
146 189
147 - if (positionItem.newsTxt) {  
148 - Text(positionItem.newsTxt)  
149 - .fontSize($r('app.float.font_size_14'))  
150 - .fontColor($r('app.color.color_999999'))  
151 - .margin({ top: 15, bottom: 15 })  
152 - .maxLines(5)  
153 - .textOverflow({ overflow: TextOverflow.Ellipsis }) 190 + if (item.items.length != itemIndex + 1) {
  191 + Divider()
  192 + .strokeWidth(0.5)
  193 + .color('#EDEDED')
  194 + .padding({
  195 + top: 15,
  196 + bottom: 15
  197 + })
154 } 198 }
155 } 199 }
156 - .alignItems(HorizontalAlign.Start)  
157 - .onClick(() => {  
158 - let taskAction: Action = {  
159 - type: 'JUMP_INNER_NEW_PAGE',  
160 - params: {  
161 - contentID: '' + positionItem.newsId,  
162 - pageID: 'IMAGE_TEXT_DETAIL',  
163 - extra: {  
164 - relType: positionItem.relType ?? '',  
165 - relId: '' + positionItem.relId,  
166 - sourcePage: '5'  
167 - } as ExtraDTO  
168 - } as Params,  
169 - };  
170 - WDRouterRule.jumpWithAction(taskAction)  
171 - // if (this.listDialogController) {  
172 - // this.listDialogController.close()  
173 - // }  
174 - })  
175 } 200 }
176 }) 201 })
177 } 202 }
178 - .divider({  
179 - strokeWidth: 0.5,  
180 - color: '#EDEDED' 203 + // .divider({
  204 + // color: '#EDEDED',
  205 + // strokeWidth: 0.5
  206 + // })
  207 + .padding({
  208 + top: 16,
  209 + bottom: 16
181 }) 210 })
182 } 211 }
183 }) 212 })
184 } 213 }
  214 + .divider({
  215 + color: '#EDEDED',
  216 + strokeWidth: 0.5
  217 + })
185 .width('100%') 218 .width('100%')
186 - .padding({ left: 15, right: 15 }) 219 + .padding({
  220 + left: 15,
  221 + right: 15,
  222 + top: 16,
  223 + bottom: 16
  224 + })
187 .margin({ 225 .margin({
188 bottom: 85 226 bottom: 85
189 }) 227 })
190 .scrollBar(BarState.Off) 228 .scrollBar(BarState.Off)
191 - .divider({  
192 - strokeWidth: 0.5,  
193 - color: '#EDEDED'  
194 - })  
195 - .onScrollIndex((firstIndex: number) => {  
196 - console.log('firstIndex', firstIndex)  
197 - }) 229 +
198 .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => { 230 .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
199 - console.info('first' + firstIndex)  
200 - console.info('last' + lastIndex)  
201 - console.info('center' + centerIndex) 231 + console.info('ENewspaperListDialog::first' + firstIndex)
  232 + console.info('ENewspaperListDialog::last' + lastIndex)
  233 + console.info('ENewspaperListDialog::center' + centerIndex)
202 // this.updateCurrentPageNum(firstIndex) 234 // this.updateCurrentPageNum(firstIndex)
  235 + // const tempIndex = this.findClassIndex(firstIndex)
  236 + if (firstIndex !== centerIndex) {
  237 + return
  238 + }
203 this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}` 239 this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}`
204 }) 240 })
205 .onScroll((scrollOffset: number, scrollState: ScrollState) => { 241 .onScroll((scrollOffset: number, scrollState: ScrollState) => {
@@ -222,23 +258,25 @@ export struct ENewspaperListDialog { @@ -222,23 +258,25 @@ export struct ENewspaperListDialog {
222 }) 258 })
223 } 259 }
224 260
225 - updateCurrentPageNum(firstIndex: number): void {  
226 - if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {  
227 - let index = 0;  
228 - for (let itemBean of this.newspaperListBean.list) {  
229 - if (itemBean.items && itemBean.items.length > 0) {  
230 - for (let item of itemBean.items) {  
231 - index++  
232 - if (index == firstIndex) {  
233 - this.currentPageNum = itemBean.pageNum  
234 - return  
235 - }  
236 - }  
237 - }  
238 - }  
239 - }  
240 - 261 + updateRecordsData() {
  262 + // if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
  263 + // for (let itemBean of this.newspaperListBean.list) {
  264 + // index += itemBean.items.length
  265 + // this.records.push(index)
  266 + // }
  267 + // }
241 } 268 }
  269 +
  270 + // findClassIndex(index: number): number {
  271 + // let ans = 0;
  272 + // for (let i = 0; i < this.records.length; i++) {
  273 + // if (index >= this.records[i] && index < this.records[i + 1]) {
  274 + // ans = i;
  275 + // break;
  276 + // }
  277 + // }
  278 + // return ans;
  279 + // }
242 } 280 }
243 281
244 282
1 import font from '@ohos.font' 1 import font from '@ohos.font'
2 import { LiveDetailsBean } from 'wdBean/Index' 2 import { LiveDetailsBean } from 'wdBean/Index'
3 -import { DateTimeUtils, StringUtils } from 'wdKit/Index' 3 +import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
4 import { LiveViewModel } from '../../viewModel/LiveViewModel' 4 import { LiveViewModel } from '../../viewModel/LiveViewModel'
5 import { HttpUtils } from 'wdNetwork/Index' 5 import { HttpUtils } from 'wdNetwork/Index'
6 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 6 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
@@ -167,6 +167,11 @@ export struct LiveCountdownComponent { @@ -167,6 +167,11 @@ export struct LiveCountdownComponent {
167 (data) => { 167 (data) => {
168 if (data.success) { 168 if (data.success) {
169 this.isAppointmentLive = !this.isAppointmentLive 169 this.isAppointmentLive = !this.isAppointmentLive
  170 + if (this.isAppointmentLive) {
  171 + ToastUtils.showToast('预约成功', 1000)
  172 + } else {
  173 + ToastUtils.showToast('取消预约成功', 1000)
  174 + }
170 } 175 }
171 }, 176 },
172 () => { 177 () => {
@@ -34,7 +34,7 @@ export struct TabComponent { @@ -34,7 +34,7 @@ export struct TabComponent {
34 .layoutWeight(1) 34 .layoutWeight(1)
35 .vertical(false) 35 .vertical(false)
36 .barMode(BarMode.Fixed) 36 .barMode(BarMode.Fixed)
37 - .barWidth(200) 37 + .barWidth(70 * this.tabs.length)
38 .barHeight(48) 38 .barHeight(48)
39 .animationDuration(100) 39 .animationDuration(100)
40 .onChange((index: number) => { 40 .onChange((index: number) => {
1 import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' 1 import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
2 -import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI,  
3 - WDViewDefaultType } from 'wdComponent/Index' 2 +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI, WDViewDefaultType } from 'wdComponent/Index'
4 import { TabLiveItemComponent } from './TabLiveItemComponent' 3 import { TabLiveItemComponent } from './TabLiveItemComponent'
5 import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' 4 import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
6 import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' 5 import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean'
@@ -109,9 +108,14 @@ export struct TabLiveComponent { @@ -109,9 +108,14 @@ export struct TabLiveComponent {
109 let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean 108 let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean
110 liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction 109 liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction
111 liveRoomItemBeanTemp.senderUserName = '人民日报主持人' 110 liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
112 - liveRoomItemBeanTemp.pictureUrls=[] 111 + liveRoomItemBeanTemp.pictureUrls = []
113 liveRoomItemBeanTemp.pictureUrls.push(this.liveDetailsBean?.fullColumnImgUrls[0]?.url) 112 liveRoomItemBeanTemp.pictureUrls.push(this.liveDetailsBean?.fullColumnImgUrls[0]?.url)
114 - liveRoomItemBeanTemp.dataType='ZH_TEXT_AND_IMAGE_MSG' 113 + liveRoomItemBeanTemp.dataType = 'ZH_TEXT_AND_IMAGE_MSG'
  114 + let temp = this.liveDetailsBean?.fullColumnImgUrls[0]
  115 + if (temp) {
  116 + liveRoomItemBeanTemp.pictureResolutions = []
  117 + liveRoomItemBeanTemp.pictureResolutions.push(`${temp.height}*${temp.weight}`)
  118 + }
115 this.liveList.push(liveRoomItemBeanTemp) 119 this.liveList.push(liveRoomItemBeanTemp)
116 } 120 }
117 } 121 }
@@ -28,7 +28,7 @@ export struct TabLiveItemComponent { @@ -28,7 +28,7 @@ export struct TabLiveItemComponent {
28 .fontSize('14fp') 28 .fontSize('14fp')
29 .fontWeight(400) 29 .fontWeight(400)
30 .fontColor('#222222') 30 .fontColor('#222222')
31 - Text('主持人') 31 + Text(this.item.role === 'host' ? '主持人' : '嘉宾')
32 .maxLines(1) 32 .maxLines(1)
33 .textOverflow({ overflow: TextOverflow.Ellipsis }) 33 .textOverflow({ overflow: TextOverflow.Ellipsis })
34 .fontSize('11fp') 34 .fontSize('11fp')
@@ -43,7 +43,7 @@ export struct TabLiveItemComponent { @@ -43,7 +43,7 @@ export struct TabLiveItemComponent {
43 }) 43 })
44 .borderRadius(2) 44 .borderRadius(2)
45 .margin({ left: 8 }) 45 .margin({ left: 8 })
46 - .visibility('host' == this.item.role ? Visibility.Visible : Visibility.None) 46 + .visibility(StringUtils.isNotEmpty(this.item.role) ? Visibility.Visible : Visibility.None)
47 Text(DateTimeUtils.getCommentTime(new Date(this.item.time).getTime())) 47 Text(DateTimeUtils.getCommentTime(new Date(this.item.time).getTime()))
48 .maxLines(1) 48 .maxLines(1)
49 .textOverflow({ overflow: TextOverflow.Ellipsis }) 49 .textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -85,21 +85,21 @@ export struct TabLiveItemComponent { @@ -85,21 +85,21 @@ export struct TabLiveItemComponent {
85 List({ space: this.item.pictureUrls.length == 1 ? 0 : 5 }) { 85 List({ space: this.item.pictureUrls.length == 1 ? 0 : 5 }) {
86 ForEach(this.item.pictureUrls, (itemSub: string, index: number) => { 86 ForEach(this.item.pictureUrls, (itemSub: string, index: number) => {
87 ListItem() { 87 ListItem() {
88 - Image(itemSub)  
89 - .width(`${100 / this.item.pictureUrls.length}%`)  
90 - .height(this.item.pictureUrls.length > 1 ? 70 : 174)  
91 - .objectFit(ImageFit.Auto)  
92 - .borderRadius(4)  
93 - }.onClick(() => {  
94 - this.photoList = []  
95 - for (let item of this.item.pictureUrls) {  
96 - this.photoList.push({  
97 - width: 0,  
98 - height: 0,  
99 - picPath: item,  
100 - picDesc: ''  
101 - }) 88 + if (this.item.pictureUrls.length > 1) {
  89 + Image(itemSub)
  90 + .width(`${100 / this.item.pictureUrls.length}%`)
  91 + .height(70)
  92 + .objectFit(ImageFit.Auto)
  93 + .borderRadius(4)
  94 + } else {
  95 + Image(itemSub)
  96 + .width(`100%`)
  97 + // .aspectRatio(this.getAspectRation())
  98 + .height(177)
  99 + .objectFit(ImageFit.Auto)
  100 + .borderRadius(4)
102 } 101 }
  102 + }.onClick(() => {
103 this.gotoMultipleListImagePage(index) 103 this.gotoMultipleListImagePage(index)
104 }) 104 })
105 }) 105 })
@@ -147,7 +147,7 @@ export struct TabLiveItemComponent { @@ -147,7 +147,7 @@ export struct TabLiveItemComponent {
147 .margin({ 147 .margin({
148 top: 8, 148 top: 8,
149 }) 149 })
150 - .aspectRatio(Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[0]) / Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[1])) 150 + .aspectRatio(this.getAspectRation())
151 .onClick(() => { 151 .onClick(() => {
152 this.gotoVideoPlayPage() 152 this.gotoVideoPlayPage()
153 }) 153 })
@@ -188,6 +188,15 @@ export struct TabLiveItemComponent { @@ -188,6 +188,15 @@ export struct TabLiveItemComponent {
188 * @param content 188 * @param content
189 * */ 189 * */
190 gotoMultipleListImagePage(index: number) { 190 gotoMultipleListImagePage(index: number) {
  191 + this.photoList = []
  192 + for (let item of this.item.pictureUrls) {
  193 + this.photoList.push({
  194 + width: 0,
  195 + height: 0,
  196 + picPath: item,
  197 + picDesc: ''
  198 + })
  199 + }
191 let taskAction: Action = { 200 let taskAction: Action = {
192 type: 'JUMP_DETAIL_PAGE', 201 type: 'JUMP_DETAIL_PAGE',
193 params: { 202 params: {
@@ -204,4 +213,20 @@ export struct TabLiveItemComponent { @@ -204,4 +213,20 @@ export struct TabLiveItemComponent {
204 aboutToDisappear(): void { 213 aboutToDisappear(): void {
205 214
206 } 215 }
  216 +
  217 + getAspectRation(): number {
  218 + try {
  219 + if (this.item && this.item.pictureResolutions && this.item.pictureResolutions.length > 0) {
  220 + let temp: string[] = this.item.pictureResolutions[0]?.split('*')
  221 + if (temp && temp.length == 2) {
  222 + let width = Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[0])
  223 + let height = Number.parseFloat(this.item.pictureResolutions[0]?.split('*')[1])
  224 + return height / width
  225 + }
  226 + }
  227 + } catch (e) {
  228 + return 1
  229 + }
  230 + return 1
  231 + }
207 } 232 }
@@ -20,6 +20,9 @@ export struct PlayUIComponent { @@ -20,6 +20,9 @@ export struct PlayUIComponent {
20 @Consume displayDirection: DisplayDirection 20 @Consume displayDirection: DisplayDirection
21 21
22 onChangeMenuVisible() { 22 onChangeMenuVisible() {
  23 + if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo || this.liveDetailsBean?.liveInfo?.liveState === 'wait') {
  24 + return
  25 + }
23 let time: number = 0 26 let time: number = 0
24 if (this.isMenuVisible) { 27 if (this.isMenuVisible) {
25 setTimeout(() => { 28 setTimeout(() => {
@@ -38,14 +41,15 @@ export struct PlayUIComponent { @@ -38,14 +41,15 @@ export struct PlayUIComponent {
38 this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); 41 this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000));
39 this.progressVal = Math.floor(position * 100 / duration); 42 this.progressVal = Math.floor(position * 100 / duration);
40 } 43 }
41 -  
42 } 44 }
43 45
44 build() { 46 build() {
45 Column() { 47 Column() {
46 - this.getTopUIComponent()  
47 - this.getMiddleUIComponent()  
48 - this.getBottomUIComponent() 48 + if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) {
  49 + this.getTopUIComponent()
  50 + this.getMiddleUIComponent()
  51 + this.getBottomUIComponent()
  52 + }
49 } 53 }
50 .width('100%') 54 .width('100%')
51 .height('100%') 55 .height('100%')
@@ -67,7 +71,7 @@ export struct PlayUIComponent { @@ -67,7 +71,7 @@ export struct PlayUIComponent {
67 this.displayDirection = DisplayDirection.VERTICAL 71 this.displayDirection = DisplayDirection.VERTICAL
68 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? 72 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
69 window.Orientation.PORTRAIT : 73 window.Orientation.PORTRAIT :
70 - window.Orientation.LANDSCAPE) 74 + window.Orientation.LANDSCAPE_INVERTED)
71 // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ? 75 // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
72 // window.Orientation.PORTRAIT : 76 // window.Orientation.PORTRAIT :
73 // window.Orientation.LANDSCAPE); 77 // window.Orientation.LANDSCAPE);
@@ -106,15 +110,17 @@ export struct PlayUIComponent { @@ -106,15 +110,17 @@ export struct PlayUIComponent {
106 } 110 }
107 this.getLiveStatusView() 111 this.getLiveStatusView()
108 } 112 }
109 - }.width('100%') 113 + }
  114 + .width('100%')
110 .padding({ 115 .padding({
111 - top: 20, 116 + top: 15,
112 bottom: 6, 117 bottom: 6,
113 left: 10, 118 left: 10,
114 right: 10 119 right: 10
115 }) 120 })
116 .alignItems(HorizontalAlign.Start) 121 .alignItems(HorizontalAlign.Start)
117 .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) 122 .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None)
  123 + .linearGradient({ angle: 0, colors: [['#00000000', 0], ['#99000000', 1]] })
118 } 124 }
119 125
120 @Builder 126 @Builder
@@ -194,6 +200,9 @@ export struct PlayUIComponent { @@ -194,6 +200,9 @@ export struct PlayUIComponent {
194 .layoutWeight(1) 200 .layoutWeight(1)
195 .width('100%') 201 .width('100%')
196 .onClick(() => { 202 .onClick(() => {
  203 + if (this.liveDetailsBean?.liveInfo?.liveState === 'wait') {
  204 + return
  205 + }
197 this.isMenuVisible = !this.isMenuVisible 206 this.isMenuVisible = !this.isMenuVisible
198 }) 207 })
199 } 208 }
@@ -233,11 +242,12 @@ export struct PlayUIComponent { @@ -233,11 +242,12 @@ export struct PlayUIComponent {
233 this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL 242 this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL
234 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? 243 WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
235 window.Orientation.PORTRAIT : 244 window.Orientation.PORTRAIT :
236 - window.Orientation.LANDSCAPE) 245 + window.Orientation.LANDSCAPE_INVERTED)
237 // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ? 246 // devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
238 // window.Orientation.PORTRAIT : 247 // window.Orientation.PORTRAIT :
239 // window.Orientation.LANDSCAPE); 248 // window.Orientation.LANDSCAPE);
240 }) 249 })
  250 + .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
241 } 251 }
242 } 252 }
243 .alignItems(VerticalAlign.Center) 253 .alignItems(VerticalAlign.Center)
@@ -32,6 +32,7 @@ export struct TopPlayComponent { @@ -32,6 +32,7 @@ export struct TopPlayComponent {
32 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri 32 playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
33 } 33 }
34 this.playerController?.firstPlay(playUrl); 34 this.playerController?.firstPlay(playUrl);
  35 + // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4');
35 } 36 }
36 } 37 }
37 38
@@ -16,5 +16,6 @@ @@ -16,5 +16,6 @@
16 "wdConstant": "file:../../commons/wdConstant", 16 "wdConstant": "file:../../commons/wdConstant",
17 "wdDetailPlayApi": "file:../../features/wdDetailPlayApi", 17 "wdDetailPlayApi": "file:../../features/wdDetailPlayApi",
18 // "wdComponent": "file:../../features/wdComponent" 18 // "wdComponent": "file:../../features/wdComponent"
  19 + "wdShare": "file:../../features/wdShare"
19 } 20 }
20 } 21 }
@@ -11,6 +11,7 @@ import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit'; @@ -11,6 +11,7 @@ import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit';
11 import { WDPlayerController } from 'wdPlayer/Index'; 11 import { WDPlayerController } from 'wdPlayer/Index';
12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
13 import { SpConstants } from 'wdConstant/Index' 13 import { SpConstants } from 'wdConstant/Index'
  14 +import { WDShare } from "wdShare"
14 15
15 interface ILikeStyleResp { 16 interface ILikeStyleResp {
16 url: Resource; 17 url: Resource;
@@ -336,6 +337,8 @@ export struct PlayerRightView { @@ -336,6 +337,8 @@ export struct PlayerRightView {
336 .aspectRatio(1) 337 .aspectRatio(1)
337 .onClick((event: ClickEvent) => { 338 .onClick((event: ClickEvent) => {
338 ToastUtils.showToast('分享为公共方法,待开发', 1000); 339 ToastUtils.showToast('分享为公共方法,待开发', 1000);
  340 +
  341 + this.share()
339 }) 342 })
340 Text('分享') 343 Text('分享')
341 .width('100%') 344 .width('100%')
@@ -349,4 +352,9 @@ export struct PlayerRightView { @@ -349,4 +352,9 @@ export struct PlayerRightView {
349 } 352 }
350 .margin({ bottom: 20 }) 353 .margin({ bottom: 20 })
351 } 354 }
  355 +
  356 + share() {
  357 +
  358 + WDShare.shareContent(this.contentDetailData)
  359 + }
352 } 360 }
  1 +/node_modules
  2 +/oh_modules
  3 +/.preview
  4 +/build
  5 +/.cxx
  6 +/.test
  1 +
  2 +export { WDShare } from './src/main/ets/WDShare'
  3 +
  1 +{
  2 + "apiType": "stageMode",
  3 + "buildOption": {
  4 + },
  5 + "buildOptionSet": [
  6 + {
  7 + "name": "release",
  8 + "arkOptions": {
  9 + "obfuscation": {
  10 + "ruleOptions": {
  11 + "enable": true,
  12 + "files": [
  13 + "./obfuscation-rules.txt"
  14 + ]
  15 + }
  16 + }
  17 + },
  18 + },
  19 + ],
  20 + "targets": [
  21 + {
  22 + "name": "default"
  23 + }
  24 + ]
  25 +}
  1 +import { hspTasks } from '@ohos/hvigor-ohos-plugin';
  2 +
  3 +export default {
  4 + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
  5 + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
  6 +}
  1 +# Define project specific obfuscation rules here.
  2 +# You can include the obfuscation configuration files in the current module's build-profile.json5.
  3 +#
  4 +# For more details, see
  5 +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
  6 +
  7 +# Obfuscation options:
  8 +# -disable-obfuscation: disable all obfuscations
  9 +# -enable-property-obfuscation: obfuscate the property names
  10 +# -enable-toplevel-obfuscation: obfuscate the names in the global scope
  11 +# -compact: remove unnecessary blank spaces and all line feeds
  12 +# -remove-log: remove all console.* statements
  13 +# -print-namecache: print the name cache that contains the mapping from the old names to new names
  14 +# -apply-namecache: reuse the given cache file
  15 +
  16 +# Keep options:
  17 +# -keep-property-name: specifies property names that you want to keep
  18 +# -keep-global-name: specifies names that you want to keep in the global scope
  1 +{
  2 + "meta": {
  3 + "stableOrder": true
  4 + },
  5 + "lockfileVersion": 3,
  6 + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
  7 + "specifiers": {
  8 + "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
  9 + "wdBean@../wdBean": "wdBean@../wdBean",
  10 + "wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant",
  11 + "wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit",
  12 + "wdNetwork@../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork",
  13 + "wdRouter@../../commons/wdRouter": "wdRouter@../../commons/wdRouter",
  14 + "wdShareBase@../../commons/wdShareBase": "wdShareBase@../../commons/wdShareBase"
  15 + },
  16 + "packages": {
  17 + "@ohos/axios@2.2.0": {
  18 + "name": "@ohos/axios",
  19 + "integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==",
  20 + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
  21 + "registryType": "ohpm"
  22 + },
  23 + "wdBean@../wdBean": {
  24 + "name": "wdbean",
  25 + "resolved": "../wdBean",
  26 + "registryType": "local"
  27 + },
  28 + "wdConstant@../../commons/wdConstant": {
  29 + "name": "wdconstant",
  30 + "resolved": "../../commons/wdConstant",
  31 + "registryType": "local"
  32 + },
  33 + "wdKit@../../commons/wdKit": {
  34 + "name": "wdkit",
  35 + "resolved": "../../commons/wdKit",
  36 + "registryType": "local"
  37 + },
  38 + "wdNetwork@../../commons/wdNetwork": {
  39 + "name": "wdnetwork",
  40 + "resolved": "../../commons/wdNetwork",
  41 + "registryType": "local",
  42 + "dependencies": {
  43 + "wdConstant": "file:../wdConstant",
  44 + "wdKit": "file:../wdKit",
  45 + "@ohos/axios": "^2.1.1"
  46 + }
  47 + },
  48 + "wdRouter@../../commons/wdRouter": {
  49 + "name": "wdrouter",
  50 + "resolved": "../../commons/wdRouter",
  51 + "registryType": "local",
  52 + "dependencies": {
  53 + "wdKit": "file:../wdKit",
  54 + "wdBean": "file:../../features/wdBean",
  55 + "wdNetwork": "file:../../commons/wdNetwork",
  56 + "wdConstant": "file:../../commons/wdConstant"
  57 + }
  58 + },
  59 + "wdShareBase@../../commons/wdShareBase": {
  60 + "name": "wdsharebase",
  61 + "resolved": "../../commons/wdShareBase",
  62 + "registryType": "local",
  63 + "packageType": "InterfaceHar"
  64 + }
  65 + }
  66 +}
  1 +{
  2 + "name": "wdshare",
  3 + "version": "1.0.0",
  4 + "description": "Please describe the basic information.",
  5 + "main": "Index.ets",
  6 + "author": "",
  7 + "license": "Apache-2.0",
  8 + "packageType": "InterfaceHar",
  9 + "dependencies": {
  10 + "wdKit": "file:../../commons/wdKit",
  11 + "wdBean": "file:../../features/wdBean",
  12 + "wdRouter": "file:../../commons/wdRouter",
  13 + "wdShareBase": "file:../../commons/wdShareBase"
  14 + }
  15 +}
  1 +import { ContentDetailDTO, ContentDTO, PageInfoDTO } from 'wdBean/Index';
  2 +import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index';
  3 +import { ShareContentType } from 'wdShareBase/src/main/ets/Constant';
  4 +
  5 +export class WDShare {
  6 +
  7 + static shareContent(content: ContentDetailDTO, pageName: string ="", pageId: string = "") {
  8 +
  9 + //TODO: 处理分享弹框交互和 海报逻辑
  10 +
  11 + WDShareBase.getInstance().share({
  12 + to: ShareType.System,
  13 + scene: ShareScene.System,
  14 + type: ShareContentType.Link,
  15 + obj: {
  16 + title: content.shareInfo.shareTitle,
  17 + desc: content.shareInfo.shareSummary,
  18 + link: content.shareInfo.shareUrl,
  19 + }
  20 + })
  21 + }
  22 +
  23 + static shareProgram(program: ContentDTO, pageName: string ="", pageId: string = "") {
  24 +
  25 + }
  26 +
  27 + static shareSubject(subject: PageInfoDTO) {
  28 +
  29 +
  30 + }
  31 +
  32 +}
  1 +@Entry
  2 +@Component
  3 +struct Index {
  4 + @State message: string = 'Hello World';
  5 +
  6 + build() {
  7 + Row() {
  8 + Column() {
  9 + Text(this.message)
  10 + .fontSize(50)
  11 + .fontWeight(FontWeight.Bold)
  12 + }
  13 + .width('100%')
  14 + }
  15 + .height('100%')
  16 + }
  17 +}
  1 +export function add(a:number, b:number) {
  2 + return a + b;
  3 +}
  1 +{
  2 + "module": {
  3 + "name": "wdShare",
  4 + "type": "shared",
  5 + "description": "$string:shared_desc",
  6 + "deviceTypes": [
  7 + "phone",
  8 + "tablet",
  9 + "2in1"
  10 + ],
  11 + "deliveryWithInstall": true,
  12 + "pages": "$profile:main_pages"
  13 + }
  14 +}
  1 +{
  2 + "color": [
  3 + {
  4 + "name": "white",
  5 + "value": "#FFFFFF"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "string": [
  3 + {
  4 + "name": "shared_desc",
  5 + "value": "description"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "src": [
  3 + "pages/Index"
  4 + ]
  5 +}
  1 +import localUnitTest from './LocalUnit.test';
  2 +
  3 +export default function testsuite() {
  4 + localUnitTest();
  5 +}
  1 +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
  2 +
  3 +export default function localUnitTest() {
  4 + describe('localUnitTest',() => {
  5 + // Defines a test suite. Two parameters are supported: test suite name and test suite function.
  6 + beforeAll(() => {
  7 + // Presets an action, which is performed only once before all test cases of the test suite start.
  8 + // This API supports only one parameter: preset action function.
  9 + });
  10 + beforeEach(() => {
  11 + // Presets an action, which is performed before each unit test case starts.
  12 + // The number of execution times is the same as the number of test cases defined by **it**.
  13 + // This API supports only one parameter: preset action function.
  14 + });
  15 + afterEach(() => {
  16 + // Presets a clear action, which is performed after each unit test case ends.
  17 + // The number of execution times is the same as the number of test cases defined by **it**.
  18 + // This API supports only one parameter: clear action function.
  19 + });
  20 + afterAll(() => {
  21 + // Presets a clear action, which is performed after all test cases of the test suite end.
  22 + // This API supports only one parameter: clear action function.
  23 + });
  24 + it('assertContain', 0, () => {
  25 + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
  26 + let a = 'abc';
  27 + let b = 'b';
  28 + // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
  29 + expect(a).assertContain(b);
  30 + expect(a).assertEqual(a);
  31 + });
  32 + });
  33 +}