zhenghy

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
Showing 100 changed files with 1856 additions and 420 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

... ... @@ -23,6 +23,10 @@
{
"name": "load_net_data_none",
"value": "no data"
},
{
"name": "location_reason",
"value": " "
}
]
}
... ...
... ... @@ -244,6 +244,30 @@
]
}
]
},
{
"name": "wdShareBase",
"srcPath": "./commons/wdShareBase",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdShare",
"srcPath": "./features/wdShare",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,8 @@ export class ContentConstants {
* 2:直播
*/
static readonly TYPE_LIVE: string = "2";
static readonly TYPE_FOUR: string = "4";
/**
* 5:专题详情
*/
... ...
... ... @@ -44,4 +44,7 @@ export class SpConstants{
//频道信息流页面左右挂角
static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
}
\ No newline at end of file
... ...
... ... @@ -53,5 +53,15 @@ export class AppUtils {
}
return '';
}
static getAppChannel() {
// TODO: 待确认,暂时写死一个
return "rmrb_china_0000"
}
static getOSName() {
// TODO: 待确认,暂时写死Android
return "Harmony"
}
}
... ...
... ... @@ -70,10 +70,16 @@ export class DeviceUtil {
}
/**
* 获取设备型号: HUAWEI Mate 60 Pro
*/
static getMarketName() {
return deviceInfo.marketName
}
/**
* 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值
*/
static getRandomUUIDForTraceID(): string {
deviceInfo.productModel
return util.generateRandomUUID().toUpperCase().replace('-', '')
return util.generateRandomUUID().toUpperCase().replace(/-/g, '')
}
}
... ...
... ... @@ -17,6 +17,14 @@ export enum EmitterEventId {
// 关注,取消关注
PEOPLE_SHIP_ATTENTION = 7,
// 我的关注 为null
MY_FOLLOW_EMPTY = 8,
// 登录成功
LOGIN_SUCCESS = 8,
// 换绑成功
PHONE_CHANGE_SUCCESS = 9,
// App回到前台
APP_ENTER_FOREGROUD = 100,
... ...
... ... @@ -72,6 +72,10 @@ export class UserDataLocal {
SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url)
}
public static setUserType(type:string) {
SPHelper.default.save(UserDataLocal.USER_Type, type)
}
public static setUserFollowOperation(timestamp:string) {
SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp)
}
... ...
... ... @@ -6,6 +6,9 @@
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
"@umeng/analytics@^1.0.19": "@umeng/analytics@1.0.19",
"@umeng/common@^1.0.21": "@umeng/common@1.0.21",
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": "libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon",
"wdConstant@../wdConstant": "wdConstant@../wdConstant",
"wdKit@../wdKit": "wdKit@../wdKit"
},
... ... @@ -16,6 +19,26 @@
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
"registryType": "ohpm"
},
"@umeng/analytics@1.0.19": {
"name": "@umeng/analytics",
"integrity": "sha512-0m9z5l8to+POjDl9UkCQC8s4P+e2E1OILwUglC7ME4QwqfH44e59GLJtQdwF0h6kwpsy3YBft4SoWK8MYbuP7g==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/analytics/-/analytics-1.0.19.har",
"registryType": "ohpm"
},
"@umeng/common@1.0.21": {
"name": "@umeng/common",
"integrity": "sha512-EbXsd4OoRisTQf5egNY/+z1D2bvrYw9VwC2xu3EJA9TiDPSbnaJZ5+yltA/Se6yZ4oCcFvq6e5/AAfPuumunbw==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@umeng/common/-/common-1.0.21.har",
"registryType": "ohpm",
"dependencies": {
"libcommon.so": "./src/main/cpp/types/libcommon"
}
},
"libcommon.so@../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon": {
"name": "libcommon.so",
"resolved": "../../oh_modules/.ohpm/@umeng+common@1.0.21/oh_modules/@umeng/common/src/main/cpp/types/libcommon",
"registryType": "local"
},
"wdConstant@../wdConstant": {
"name": "wdconstant",
"resolved": "../wdConstant",
... ... @@ -24,7 +47,11 @@
"wdKit@../wdKit": {
"name": "wdkit",
"resolved": "../wdKit",
"registryType": "local"
"registryType": "local",
"dependencies": {
"@umeng/common": "^1.0.21",
"@umeng/analytics": "^1.0.19"
}
}
}
}
\ No newline at end of file
... ...
import { SpConstants } from 'wdConstant';
import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
import { AppUtils, DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
import { HttpUtils } from '../utils/HttpUtils';
import { HostEnum, HostManager } from './HttpHostManager';
... ... @@ -11,16 +11,16 @@ export class HttpParams {
let headers: Record<string, string> = {};
// 通用请求头
headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO
headers['channel'] = 'rmrb_china_0000' // 自有渠道
headers['channel'] = AppUtils.getAppChannel()
headers['plat'] = DeviceUtil.getPlat()
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['device_id'] = DeviceUtil.clientId()
headers['build_version'] = HttpParams.getVersion()
headers['adcode'] = HttpUtils.getProvinceCode()
headers['os_version'] = DeviceUtil.getOsVersion()
headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识
headers['versionCode'] = HttpParams.getVersionCode()
headers['version_name'] = HttpParams.getVersionName()
headers['system'] = AppUtils.getOSName()
headers['versionCode'] = AppUtils.getAppVersionCode()
headers['version_name'] = AppUtils.getAppVersionName()
headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID()
headers['imei'] = DeviceUtil.clientId()
headers['Accept-Language'] = 'zh'
... ...
... ... @@ -441,6 +441,12 @@ export class HttpUrlUtils {
return url;
}
//游客评论合并
static visitorMergeComment() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge";
return url;
}
static getAppointmentListDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
return url
... ...
... ... @@ -67,7 +67,7 @@ export class ProcessUtils {
linkUrl: advert.linkUrl,
pageId: advert.pageId,
objectId: advert.objectId,
objectType: advert.objectType,
objectType: advert.objectType.toString(),
relId: advert.relId,
bottomNavId: advert.bottomNavId
} as ContentDTO;
... ... @@ -100,6 +100,9 @@ export class ProcessUtils {
case ContentConstants.TYPE_LIVE:
ProcessUtils.gotoLive(content)
break
case ContentConstants.TYPE_FOUR:
ProcessUtils.gotoDefaultWeb(content);
break
case ContentConstants.TYPE_AUDIO:
ProcessUtils.gotoAudio(content)
break;
... ... @@ -121,6 +124,7 @@ export class ProcessUtils {
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
... ... @@ -319,6 +323,8 @@ export class ProcessUtils {
extra: {
relType: content?.relType,
relId: content?.relId,
extra: content?.extra,
title: content?.newsTitle
} as ExtraDTO
} as Params,
};
... ...
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
... ...
export { WDShareObject, WDShareBase } from "./src/main/ets/WDShareBase"
export { ShareContent, ShareScene, ShareType } from "./src/main/ets/Constant"
\ No newline at end of file
... ...
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
},
],
"targets": [
{
"name": "default"
}
]
}
\ No newline at end of file
... ...
import { hspTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
... ...
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
... ...
{
"name": "wdsharebase",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "Index.ets",
"author": "",
"license": "Apache-2.0",
"packageType": "InterfaceHar",
"dependencies": {
}
}
\ No newline at end of file
... ...
export const enum ShareType {
System = 0,
WeChat,
QQ,
Weibo,
}
export const enum ShareScene {
System = 0,
WeChatSession,
WeChatTimeline,
QQFriend,
QQZone,
Weibo,
}
export const enum ShareContentType {
PrueText = 1,
ImageAndText,
Link,
}
export interface ShareContentText {
text: string
}
export interface ShareContentImageAndText {
title: string
desc?: string
imgURI: string
}
export interface ShareContentLink {
title: string
desc?: string
link: string
icon?: string
}
export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink
... ...
import { ShareContent, ShareContentImageAndText, ShareContentLink, ShareContentText,
ShareContentType,
ShareScene } from '../Constant';
import { WDShareInterface } from '../WDShareInterface';
import { AsyncCallback } from '@kit.BasicServicesKit';
import { common } from '@kit.AbilityKit';
import { systemShare } from '@kit.ShareKit';
import { uniformTypeDescriptor as utd } from '@kit.ArkData';
export class WDSystemShare implements WDShareInterface {
shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> {
return new Promise((resolve, fail) => {
try {
let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType));
let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
controller.on('dismiss', () => {
resolve("dismiss")
});
controller.show(context, {
previewMode: systemShare.SharePreviewMode.DEFAULT,
selectionMode: systemShare.SelectionMode.SINGLE
});
console.log("分享控制器调用完成")
} catch (e) {
fail(e)
}
})
}
getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData {
if (contentType === ShareContentType.PrueText) {
let prueText = content as ShareContentText
console.log("分享纯文本")
return new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: prueText.text
});
}
if (contentType === ShareContentType.ImageAndText) {
let imageAndText = content as ShareContentImageAndText
console.log("分享图片和文本")
let data: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: imageAndText.title
});
data.addRecord({
utd: utd.UniformDataType.PNG,
uri: imageAndText.imgURI
});
return data
}
console.log("分享链接和文本")
let link = content as ShareContentLink
let data: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: link.title
});
data.addRecord({
utd: utd.UniformDataType.HYPERLINK,
uri: link.link
});
return data
}
}
\ No newline at end of file
... ...
import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constant'
import { HashMap } from '@kit.ArkTS'
import { WDShareInterface } from './WDShareInterface'
import { WDSystemShare } from './System/WDSystemShare'
export interface WDShareObject {
to: ShareType,
scene: ShareScene,
type: ShareContentType,
obj: ShareContent
}
export class WDShareBase {
private static instance?: WDShareBase
static getInstance() : WDShareBase {
if (!WDShareBase.instance) {
WDShareBase.instance = new WDShareBase()
WDShareBase.instance.register()
}
return WDShareBase.instance
}
private handles: HashMap<ShareType, WDShareInterface> = new HashMap()
register() {
this.handles.set(ShareType.System, new WDSystemShare())
}
share(obj: WDShareObject) : null | Promise<string> {
let shareHandler: WDShareInterface = this.handles.get(obj.to)
if (shareHandler) {
return shareHandler.shareContent(obj.scene, obj.obj, obj.type)
}
return null
}
}
\ No newline at end of file
... ...
import { ShareContent, ShareContentType, ShareScene } from './Constant'
import { AsyncCallback } from '@kit.BasicServicesKit'
export interface WDShareInterface {
// shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void
shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string>
}
\ No newline at end of file
... ...
@Entry
@Component
struct IndexPage {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
... ...
{
"module": {
"name": "wdShareBase",
"type": "shared",
"description": "$string:shared_desc",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"pages": "$profile:main_pages"
}
}
\ No newline at end of file
... ...
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
... ...
{
"string": [
{
"name": "shared_desc",
"value": "description"
}
]
}
\ No newline at end of file
... ...
{
"src": [
"pages/IndexPage"
]
}
\ No newline at end of file
... ...
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
\ No newline at end of file
... ...
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest',() => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
\ No newline at end of file
... ...
... ... @@ -9,13 +9,17 @@ import router from '@ohos.router';
import Url from '@ohos.url'
import { ContentDTO, PhotoListBean } from 'wdBean';
import { handleJsCallAppService } from './JsCallAppService'
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'JsBridgeBiz'
class AppInfo {
plat: string = ''
system: string = ''
networkStatus: number = 1
screenStatusBarHeight: number = 40 // TODO 这里需要动态获取
screenTabbarSafeHeight: number = 42 // TODO 这里需要动态获取
imei: string = HttpUtils.getImei()
device_id: string = HttpUtils.getDeviceId()
// TODO 完善
}
... ...
... ... @@ -4,6 +4,7 @@ import { Logger } from 'wdKit/Index';
import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { DateTimeUtils } from 'wdKit'
const TAG = 'WdWebLocalComponent';
... ... @@ -22,6 +23,13 @@ export struct WdWebLocalComponent {
@State positionLeft: number = 0
@State positionTop: number = 0
@State videoLandscape: string = '1'
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
@State sliderStartTime: string = '';
@State currentTime: number = 0;
@State durationTime: number = 0;
@State durationStringTime: string = '';
@State isPause: boolean = true;
controller: VideoController = new VideoController()
build() {
Column() {
... ... @@ -77,22 +85,87 @@ export struct WdWebLocalComponent {
})
if (this.videoUrl) {
Video({ src: this.videoUrl })
.autoPlay(true)
.objectFit(ImageFit.Contain)
.width(this.positionWidth)
.height(this.positionHeight)
.borderRadius(5)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
Stack({ alignContent: Alignment.Bottom }) {
Video({
src: this.videoUrl,
currentProgressRate: this.curRate,
controller: this.controller
})
.offset({
x: this.positionLeft,
y: this.positionTop
})
.id("video")
}
.borderRadius(5)
.controls(false)
.autoPlay(true)
.objectFit(ImageFit.Contain)
.onStart(() => {
this.isPause = false
})
.onPause(() => {
this.isPause = true
})
.onPrepared((event) => {
if (event) {
this.durationTime = event.duration
}
})
.onUpdate((event) => {
if (event) {
this.currentTime = event.time
}
})
Row() {
Image($r(this.isPause ? 'app.media.icon_play' : 'app.media.icon_pause'))
.width(24)
.height(24)
.onClick(()=>{
if(this.isPause){
this.controller.start()
}else{
this.controller.pause()
}
})
Row() {
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600)
Slider({
value: this.currentTime,
min: 0,
max: this.durationTime
})
.width("50%")
.selectedColor('#ED2800')
.margin({ left: 4, right: 4 })
// .blockStyle({
// type: SliderBlockType.IMAGE,
// image: $r('app.media.slider_block')
// })
// .blockSize({ width: 18, height: 12 })
.onChange((value: number, mode: SliderChangeMode) => {
this.controller.setCurrentTime(value);
})
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600)
}
.justifyContent(FlexAlign.Center)
Image($r('app.media.icon_full_screen'))
.width(24)
.height(24)
.onClick(()=>{
this.controller.requestFullscreen(true)
})
}
.opacity(0.8)
.width("100%")
.justifyContent(FlexAlign.SpaceAround)
}
.width(this.positionWidth)
.height(this.positionHeight)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
})
.offset({
x: this.positionLeft,
y: this.positionTop
})
.id("video")
}
}
}.width('100%')
.height(this.webHeight)
... ...
... ... @@ -130,8 +130,6 @@ export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO';
export { postRecommendListParams } from './src/main/ets/bean/detail/postRecommendListParams';
export { postThemeListParams } from './src/main/ets/bean/detail/postThemeListParams';
export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO';
export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO';
... ... @@ -165,3 +163,7 @@ export {
AttentionBatchDTO,
CreatorDTO
} from './src/main/ets/bean/peoples/AttentionBatchDTO';
export { GoldenPositionExtraBean } from './src/main/ets/bean/content/GoldenPositionExtraBean';
export { ClassBean } from './src/main/ets/bean/content/ClassBean';
export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean';
... ...
/**
* @Description: 广告扩展信息的解析模型
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
export interface AdvExtraData {
itemTopImage: string;
itemMore: AdvExtraItemData;
item: AdvExtraItemData[]
}
export interface AdvExtraItemData {
/**
* 图片地址
*/
image: string;
/**
* 标题
*/
title: string ;
/**
* 跳转地址
*/
linkUrl: string;
/**
* 跳转类型
*/
linkType: string;
}
\ No newline at end of file
... ...
... ... @@ -17,4 +17,6 @@ export interface ExtraDTO extends ItemDTO {
photoList: PhotoListBean[];
swiperIndex?: number
commentId?: string;
extra?:string
title: string
}
\ No newline at end of file
... ...
import { FullColumnImgUrlDTO } from '../detail/FullColumnImgUrlDTO';
import { LiveInfoDTO } from '../detail/LiveInfoDTO';
import { VideoInfoDTO } from '../detail/VideoInfoDTO';
import { InteractDataDTO } from './InteractDataDTO';
import { slideShows } from '../morningevening/slideShows';
import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
import { RmhInfoDTO } from '../detail/RmhInfoDTO';
import { commentInfo } from './commentInfo';
import { ArrayList } from '@kit.ArkTS';
export interface ClassBean {
secondClassifyName:string
classifyName:string
}
\ No newline at end of file
... ...
... ... @@ -77,7 +77,11 @@ export interface ContentDTO {
newTags: string;
titleShow?: number;
isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
isCollection?: boolean; // 是否是收藏的结果,区分搜索和主页的数据
commentInfo?: commentInfo
//底部导航栏 id(用于频道跳转)
bottomNavId:string;
// 链接类型: 0:无链接;1:内链(文章);2:外链
openType:string
extra:string
}
\ No newline at end of file
... ...
export interface CreatorsBean {
id:number
name:string
}
\ No newline at end of file
... ...
import { ArrayList } from '@kit.ArkTS';
import { ClassBean } from './ClassBean';
import { CreatorsBean } from './CreatorsBean';
export interface GoldenPositionExtraBean {
sort:number
pageNum:number
pageSize:number
channelId:string
topicId:string
keyWord:string
aggregateType:string
poolCode:string
showPublishStartTime:string
showPublishEndTime:string
keywordsType:string
keywords:ArrayList<string>
classifys: ArrayList<ClassBean>
creatorTags: ArrayList<CreatorsBean>
}
\ No newline at end of file
... ...
... ... @@ -18,4 +18,5 @@ export interface RmhInfoDTO {
rmhName: string;
userId: string;
userType: string;
honoraryIcon:string;
}
... ...
export interface postThemeListParams {
sort: number;
pageNum: number;
pageSize: number;
}
\ No newline at end of file
... ... @@ -159,7 +159,7 @@ export interface LiveDetailsBean {
}
*/
liveInfo: LiveInfo
fullColumnImgUrls: Array<FullColumnImgUrls>
fullColumnImgUrls: Array<FullColumnImgUrlBean>
newsTitle: string
newsId: string
newIntroduction: string
... ... @@ -186,8 +186,12 @@ export interface MLive {
mliveId: string
}
export interface FullColumnImgUrls {
export interface FullColumnImgUrlBean {
url: string
height: string
landscape: number
size: string
weight: string
}
export interface Vlive {
... ...
import { FullColumnImgUrlBean } from './LiveDetailsBean'
export interface LiveRoomBean {
pageNum: number
pageSize: number
... ... @@ -15,6 +17,7 @@ export interface LiveRoomItemBean {
isWall: number
//是否置顶 1置顶0不置顶
isTop: number
//guest :嘉宾,host:主持人
role: string
//ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
dataType: string
... ... @@ -28,5 +31,7 @@ export interface LiveRoomItemBean {
duration: number
//音频地址
audioUrl: string
//详情页面插入数据bean
fullColumnImgUrlDto: FullColumnImgUrlBean
}
\ No newline at end of file
... ...
... ... @@ -167,7 +167,7 @@ export struct AudioDetailComponent {
}
.layoutWeight(1)
OperRowListView()
// OperRowListView()
}
}
... ...
... ... @@ -25,6 +25,7 @@ import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
/**
* comp适配器.
... ... @@ -34,7 +35,9 @@ import { AdvCardParser } from './cardViewAdv/AdvCardParser';
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
build() {
Column() {
... ... @@ -44,7 +47,7 @@ export struct CompParser {
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
// if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
//if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -77,8 +80,8 @@ export struct CompParser {
ZhSingleRow04({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
ZhSingleRow05({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -100,7 +103,8 @@ export struct CompParser {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({compDTO})
AdvCardParser({pageModel:this.pageModel,compDTO})
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
... ... @@ -119,6 +123,6 @@ export struct CompParser {
}
}
// }
// }
}
... ...
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,postBatchAttentionStatusParams,
PhotoListBean,
... ... @@ -53,7 +53,7 @@ export struct DynamicDetailComponent {
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -83,7 +83,7 @@ export struct DynamicDetailComponent {
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_7'))
.margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
.padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
... ... @@ -97,15 +97,29 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_16'))
Image($r('app.media.icon_border_test'))
Image(this.contentDetailData.rmhInfo?.honoraryIcon)
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_24'))
if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){
Stack() {
Image(this.contentDetailData.rmhInfo?.authIcon)
.width($r('app.float.vp_12'))
.height($r('app.float.vp_12'))
.objectFit(ImageFit.Cover)
}
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.BottomEnd)
}
}
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
.onClick(() => {
ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId)
})
Column(){
//昵称
Text(this.contentDetailData.rmhInfo?.rmhName)
... ... @@ -128,7 +142,7 @@ export struct DynamicDetailComponent {
.margin({right: $r('app.float.margin_6')})
if(!StringUtils.isEmpty(this.followStatus)){
if (this.followStatus == '0') {
Text('关注')
Text('+关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
... ... @@ -147,7 +161,8 @@ export struct DynamicDetailComponent {
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.borderColor($r('app.color.color_CCCCCC_1A'))
.backgroundColor($r('app.color.color_CCCCCC_1A'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
... ... @@ -275,8 +290,8 @@ export struct DynamicDetailComponent {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.width(DisplayUtils.getDeviceWidth()- 32)
.height((DisplayUtils.getDeviceWidth()-32)* 9 / 16)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -291,7 +306,8 @@ export struct DynamicDetailComponent {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(CommonConstants.FULL_WIDTH)
.width(DisplayUtils.getDeviceWidth()/2)
.height(DisplayUtils.getDeviceWidth()/2* 4 / 3)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -299,7 +315,7 @@ export struct DynamicDetailComponent {
}
}
}
.margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
.padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 25,top: $r('app.float.margin_8')})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.mJumpInfo)
})
... ... @@ -311,8 +327,8 @@ export struct DynamicDetailComponent {
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_16'))
.margin({ top: $r('app.float.margin_16')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
,left: $r('app.float.vp_12')
,right: $r('app.float.vp_12') })
//微信/朋友圈/微博
Row(){
Image($r('app.media.xxhdpi_pic_wechat'))
... ... @@ -362,9 +378,17 @@ export struct DynamicDetailComponent {
})
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')})
CommentComponent({
publishCommentModel: this.publishCommentModel
publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
})
}
Blank().layoutWeight(1)
... ... @@ -379,7 +403,15 @@ export struct DynamicDetailComponent {
OperRowListView({ contentDetailData: this.contentDetailData
,interactData:this.interactDataDTO
,newsStatusOfUser:this.newsStatusOfUser
,publishCommentModel: this.publishCommentModel
,publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
,needLike:false})
}
}
... ... @@ -399,17 +431,6 @@ export struct DynamicDetailComponent {
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
if (this.contentDetailData.openComment) {
this.publishCommentModel = {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
}
this.getBatchAttentionStatus()
this.getInteractDataStatus()
this.makeJumpInfo()
... ...
... ... @@ -42,10 +42,12 @@ export struct ENewspaperPageComponent {
console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date))
if (date.fullYear && date.month && date.date) {
let month: number = date.month + 1
this.calendarDate = `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}`
this.calendarDate =
`${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}`
this.getNewspaperTime()
this.getNewspaperList()
this.selectDate = new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
this.selectDate =
new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
}
}
}),
... ... @@ -81,8 +83,8 @@ export struct ENewspaperPageComponent {
this.picHeight = this.picWidth * 566 / 378
//注册字体
font.registerFont({
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
familyName: 'BebasNeueBold',
familySrc: $rawfile('font/BebasNeueBold.otf')
})
this.getNewspaperTime()
this.getNewspaperList()
... ... @@ -117,7 +119,7 @@ export struct ENewspaperPageComponent {
Text(this.calendarDate?.replace('-', '.')?.replace('-', '.'))
.fontSize($r('app.float.font_size_20'))
.fontColor($r('app.color.white'))
.fontFamily('BebasNeue_Regular')
.fontFamily('BebasNeueBold')
.fontWeight(FontWeight.Regular)
Image($r('app.media.icon_triangle'))
... ... @@ -148,6 +150,7 @@ export struct ENewspaperPageComponent {
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_share')
.visibility(Visibility.Hidden)
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
... ... @@ -208,13 +211,15 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_shadow')
Row() {
Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版')
Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' :
'滑动查看下一版')
.fontColor(Color.White)
.fontSize($r('app.float.font_size_14'))
Image($r('app.media.icon_next_page'))
.width($r('app.float.vp_16'))
.height($r('app.float.vp_16'))
.visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible)
.visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None :
Visibility.Visible)
}
.justifyContent(FlexAlign.Center)
.margin({ top: $r('app.float.margin_16') })
... ... @@ -232,7 +237,7 @@ export struct ENewspaperPageComponent {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
.fontColor($r('app.color.white'))
.fontFamily('BebasNeue_Regular')
.fontFamily('BebasNeueBold')
Text('版')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.white'))
... ...
import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit';
import {
Logger,
NumberFormatterUtils,
DateTimeUtils,
EmitterUtils,
EmitterEventId,
NetworkUtil,
DisplayUtils
} from 'wdKit';
import {
Action,
ContentDetailDTO,
... ... @@ -20,7 +28,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { CommentComponent } from '../components/comment/view/CommentComponent'
import { HttpUtils } from 'wdNetwork/Index';
... ... @@ -39,6 +47,9 @@ export struct ImageAndTextPageComponent {
@State isPageEnd: boolean = false
@State publishTime: string = ''
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State isNetConnected: boolean = true
@State info: Area | null = null
build() {
Column() {
... ... @@ -83,17 +94,21 @@ export struct ImageAndTextPageComponent {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus === '1') {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') :
(this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
$r('app.media.icon_candle_active')))
.width(24)
.height(24)
.margin({ right: 5 })
} else {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') :
(this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') :
$r('app.media.icon_candle')))
.width(24)
.height(24)
.margin({ right: 5 })
}
if (this.interactData?.likeNum !== '0') {
if (this.interactData?.likeNum != '0') {
Text(`${this.interactData?.likeNum}`)
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
... ... @@ -125,7 +140,11 @@ export struct ImageAndTextPageComponent {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
// .onMeasureSize()
}
}
}
... ... @@ -135,18 +154,27 @@ export struct ImageAndTextPageComponent {
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.align(Alignment.Top)
if (!this.isPageEnd) {
detailedSkeleton()
if (!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
}
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
}
}
//底部交互区
if (this.contentDetailData?.length) {
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel
})
}
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
}
}
... ... @@ -155,6 +183,7 @@ export struct ImageAndTextPageComponent {
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
let contentId: string = ''
let relId: string = ''
let relType: string = ''
... ... @@ -174,7 +203,8 @@ export struct ImageAndTextPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
if (this.contentDetailData[0]?.recommendShow === 1) {
this.getRecommend()
... ... @@ -184,13 +214,16 @@ export struct ImageAndTextPageComponent {
this.queryContentInteractCount()
}
if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
}
if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) {
this.operationButtonList = ['comment', 'collect', 'listen', 'share']
}
}
}
... ... @@ -198,11 +231,10 @@ export struct ImageAndTextPageComponent {
private async getRecommend() {
let params: postRecommendListParams = {
// TODO ? imei: HttpUtils.getImei()
imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",
imei: HttpUtils.getImei(),
userId: HttpUtils.getUserId(),
contentId: String(this.contentDetailData[0]?.newsId),
recType: 1,
recType: Number(this.contentDetailData[0]?.reLInfo?.relType),
contentType: this.contentDetailData[0]?.newsType,
relId: this.contentDetailData[0]?.reLInfo?.relId,
channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
... ... @@ -280,6 +312,24 @@ export struct ImageAndTextPageComponent {
aboutToAppear() {
this.getDetail()
//注册通知,来自别的组件的评论成功通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
// 滚动到评论列表
if (this.info) {
// let height = DisplayUtils.getDeviceHeight() / 2
let offSetY = this.info?.globalPosition.y as number
//头部距离48
this.scroller.scrollTo({
yOffset: offSetY - 100,
xOffset: 0,
animation: { duration: 1000, curve: Curve.Ease }
})
}
}
}
})
}
aboutToDisappear() {
... ...
... ... @@ -117,7 +117,7 @@ export struct ImageAndTextWebComponent {
}
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData));
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
JSON.stringify(h5ReceiveAppData), (data: string) => {
Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
... ...
// import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
import { CompList, PageInfoBean } from 'wdBean';
import { DateTimeUtils, Logger, SPHelper } from 'wdKit/Index';
import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index';
import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog';
import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
// import { AudioBarView } from './AudioBarView';
... ... @@ -102,6 +102,7 @@ export struct MorningEveningPaperComponent {
async aboutToAppear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(true);
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
let dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
... ... @@ -173,6 +174,7 @@ export struct MorningEveningPaperComponent {
async aboutToDisappear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(false);
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
onPageHide() {
... ...
... ... @@ -34,7 +34,7 @@ export struct PaperTitleComponent {
Text(this.subTitle ?? '')// Text('2024年\n1月16日')
// .width(50)
.margin({ left: 5 })
.fontSize(12)
.fontSize(8)
.fontColor($r('app.color.white'))
.maxLines(2)
... ... @@ -47,7 +47,8 @@ export struct PaperTitleComponent {
.alignItems(VerticalAlign.Center)
.alignRules({
left: { anchor: "img_logo1", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('row_paper_date')
Image($r('app.media.icon_close'))
... ... @@ -55,7 +56,8 @@ export struct PaperTitleComponent {
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_close')
.onClick((event: ClickEvent) => {
// console.info(TAG, "img_close")
... ... @@ -68,11 +70,12 @@ export struct PaperTitleComponent {
.width($r('app.float.top_arrow_size'))
.alignRules({
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_share')
.margin({ right: 13 })
}
// .margin({ left: 14, right: 14 })
.margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
// .backgroundColor(Color.Black)
... ...
... ... @@ -150,7 +150,10 @@ export struct SingleColumn999Component {
scrollBackward: NestedScrollMode.SELF_FIRST
})
} else {
EmptyComponent({ emptyHeight: 200 })
if (this.compListItem && this.compListItem?.operDataList) {
EmptyComponent({ emptyHeight: 200 })
}
}
}
... ...
... ... @@ -5,7 +5,8 @@ import {
PhotoListBean,
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams
postInteractAccentionOperateParams,
Params
} from 'wdBean';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import display from '@ohos.display';
... ... @@ -13,6 +14,7 @@ import font from '@ohos.font';
import { OperRowListView } from './view/OperRowListView';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { ImageDownloadComponent } from '../components/ImageDownloadComponent';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from './view/EmptyComponent';
import { DateTimeUtils } from 'wdKit/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
... ... @@ -42,6 +44,8 @@ export struct MultiPictureDetailPageComponent {
private scroller: Scroller = new Scroller()
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State showDownload: Boolean = false // 控制是否显示下载默认隐藏
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -59,10 +63,10 @@ export struct MultiPictureDetailPageComponent {
this.picHeight = this.picWidth * 578 / 375
this.titleHeight = this.screenWidth * 178 / 375
//注册字体
font.registerFont({
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
})
// font.registerFont({
// familyName: 'BebasNeueBold',
// familySrc: $rawfile('font/BebasNeueBold.otf')
// })
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
... ... @@ -96,19 +100,31 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData.rmhPlatform == 1) {
Row() {
Row({ space: 8 }) {
Row() {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
if (this.getImgUrl()){
Row() {
Image(this.getImgUrl())
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
.onClick(() => {
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
// 号主页
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
}
.width('13%')
.height('100%')
}
.width('13%')
.height('100%')
Row() {
Flex({
... ... @@ -188,6 +204,7 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('e_attention')
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
}
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
... ... @@ -302,10 +319,9 @@ export struct MultiPictureDetailPageComponent {
}
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
.width('100%')
.height(56)
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
}
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
Column(){
... ... @@ -369,10 +385,20 @@ export struct MultiPictureDetailPageComponent {
statusBarContentColor: '#ffffff',
})
}
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
this.operationButtonList = []
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
... ... @@ -387,12 +413,17 @@ export struct MultiPictureDetailPageComponent {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
this.operationButtonList = []
})
} catch (exception) {
}
}
getImgUrl() {
return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
}
// 记录浏览历史
private getInteractBrowsOperate() {
try {
... ...
... ... @@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
import { OperRowListView } from './view/OperRowListView';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
const TAG: string = 'SpacialTopicPageComponent'
... ... @@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent {
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
... ... @@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
}
this.trySendData2H5()
}
}
... ... @@ -80,13 +91,15 @@ export struct SpacialTopicPageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
if (!this.isPageEnd) {
detailedSkeleton()
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel
})
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
... ...
... ... @@ -110,7 +110,7 @@ export struct RMCalendar {
if (this.onDateChange) {
this.onDateChange(item)
if (item.fullYear && item.month) {
this.title = `${item.fullYear}年${item.month + 1}月`
this.title = `${item.fullYear}年${this.getMonthStr(item.month + 1)}月`
}
}
}
... ... @@ -191,18 +191,20 @@ export struct RMCalendar {
*/
private calcData() {
this.title = `${this.selectDay.getFullYear()}年${this.selectDay.getMonth() + 1}月`
this.title = `${this.selectDay.getFullYear()}年${this.getMonthStr(this.selectDay.getMonth() + 1)}月`
this.selectDay.setDate(1)
if (this.selectDay.getFullYear() < this.startDate.getFullYear()
|| (this.selectDay.getFullYear() == this.startDate.getFullYear() && this.selectDay.getMonth() <= this.startDate.getMonth())) {
|| (this.selectDay.getFullYear() == this.startDate.getFullYear() &&
this.selectDay.getMonth() <= this.startDate.getMonth())) {
this.hasPre = false
} else {
this.hasPre = true
}
if (this.selectDay.getFullYear() > this.endDate.getFullYear()
|| (this.selectDay.getFullYear() == this.endDate.getFullYear() && this.selectDay.getMonth() >= this.endDate.getMonth())) {
|| (this.selectDay.getFullYear() == this.endDate.getFullYear() &&
this.selectDay.getMonth() >= this.endDate.getMonth())) {
this.hasNext = false
} else {
this.hasNext = true
... ... @@ -274,7 +276,8 @@ export struct RMCalendar {
Text(this.title)
.fontSize(this.titleFontSize)
.fontColor(this.titleFontColor)
.fontWeight(this.titleFontWeight)
.fontWeight(600)
.fontFamily('PingFang SC-Semibold')
}
Blank()
... ... @@ -318,7 +321,22 @@ export struct RMCalendar {
left: 35,
right: 35
})
.padding(
{ bottom: 20 })
.border({ radius: 4 })
}
}
getMonthStr(month?: number): string {
if (!month) {
return ''
}
if (month <= 0) {
return ''
}
if (month <= 9) {
return '0' + month
}
return month + ''
}
}
\ No newline at end of file
... ...
... ... @@ -100,7 +100,7 @@ export struct RMCalenderCell {
.fontSize(this.itemFontSize)
.fontColor(this.getItemColor())
.fontWeight(this.itemFontWeight)
.fontFamily('BebasNeue_Regular')
.fontFamily('BebasNeueBold')
}
}
// .justifyContent(FlexAlign.Center)
... ...
... ... @@ -16,12 +16,12 @@ export struct CardMediaInfo {
build() {
Row() {
if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') {
if (this.contentDTO?.objectType === '1' || this.contentDTO?.objectType === '15') {
// 点播、动态视频
Row() {
Image($r('app.media.card_play'))
.mediaLogo()
if(this.contentDTO.videoInfo!=null){
if (this.contentDTO.videoInfo != null) {
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
}
... ... @@ -30,23 +30,23 @@ export struct CardMediaInfo {
// liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
// 显示直播信息
Row() {
if(this.contentDTO.liveInfo.liveState === 'wait') {
if (this.contentDTO?.liveInfo?.liveState === 'wait') {
Image($r('app.media.card_wait'))
.mediaLogo()
Text('预约')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'running') {
} else if (this.contentDTO?.liveInfo?.liveState === 'running') {
Image($r('app.media.card_live'))
.mediaLogo()
Text('直播中')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
} else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo?.replayUri) {
Image($r('app.media.card_play'))
.mediaLogo()
Text('回看')
.mediaText()
} else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
.replayUri) {
} else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo
?.replayUri) {
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播结束')
... ... @@ -69,6 +69,15 @@ export struct CardMediaInfo {
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
}
} else if (this.contentDTO.objectType === '4') {//广告标签
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(3)
.textAlign(TextAlign.Center)
}
}
.margin(6)
... ...
... ... @@ -28,7 +28,7 @@ export struct CardSourceInfo {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
if (this.contentDTO.isSearch || this.contentDTO.isCollection || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
... ...
... ... @@ -30,7 +30,7 @@ export struct LiveFollowComponent {
Stack() {
Stack()
.height(22)
.width(130)
.width(150)
.backgroundColor('#000000')
.opacity(0.3)
.borderRadius({
... ... @@ -71,7 +71,7 @@ export struct LiveFollowComponent {
})
}
.height(22)
.width(130)
.width(150)
}
}
... ...
... ... @@ -31,21 +31,25 @@ export struct RmhTitle {
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.alignSelf(ItemAlign.Start)
Row() {
if (this.publishTime) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) {
Row() {
if (this.publishTime) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
Image($r('app.media.point'))
.width(16)
.height(16)
}
Text(this.rmhInfo.rmhDesc)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
Image($r('app.media.point'))
.width(16)
.height(16)
.maxLines(1)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textAlign(TextAlign.Start)
}
Text(this.rmhInfo.rmhDesc)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('75%')
}
}
... ...
... ... @@ -7,6 +7,7 @@ import { CardAdvBigImageComponent } from './CardAdvBigImageComponent';
import { CardAdvVideoComponent } from './CardAdvVideoComponent';
import { CardAdvGanMiComponent } from './CardAdvGanMiComponent';
import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件解析类
... ... @@ -19,28 +20,29 @@ import { CardAdvVideoExComponent } from './CardAdvVideoExComponent';
@Component
export struct AdvCardParser {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
build() {
this.contentBuilder(this.compDTO);
this.contentBuilder(this.pageModel, this.compDTO);
}
@Builder
contentBuilder(compDTO: CompDTO) {
contentBuilder(pageModel: PageModel, compDTO: CompDTO) {
if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_5) { //三图广告
CardAdvThreeImageComponent({ compDTO })
CardAdvThreeImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_6) { //小图广告
CardAdvSmallImageComponent({ compDTO })
CardAdvSmallImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_7 ||
compDTO.matInfo.advSubType === CompStyle.Card_Adv_12) { // 长通栏广告 和 顶部长通栏广告
CardAdvLongImageComponent({ compDTO })
CardAdvLongImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_8) { //大图广告
CardAdvBigImageComponent({ compDTO })
CardAdvBigImageComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_9) { //视频广告
CardAdvVideoComponent({ compDTO })
CardAdvVideoComponent({ pageModel, compDTO })
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_10) { //展会广告
CardAdvVideoExComponent({ compDTO })
CardAdvVideoExComponent({ pageModel, compDTO})
} else if (compDTO.matInfo.advSubType === CompStyle.Card_Adv_11) { //冠名广告
CardAdvGanMiComponent({ compDTO })
CardAdvGanMiComponent({ pageModel, compDTO })
}
}
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---大图卡
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
/**
* @Description: 广告---大图卡
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvBigImageComponent {
@State compDTO: CompDTO = {} as CompDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//新闻标题
Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
//大图
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.width(CommonConstants.FULL_WIDTH)
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -48,13 +53,21 @@ export struct CardAdvBigImageComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.width('100%')
.lineHeight(25)
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件 底部标签+删除按钮
* @Description: 广告稿件 底部标签+删除按钮
* @Author:
* @Email: liyubing@wondertek.com.cn
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvBottom {
@State compDTO: CompDTO = {} as CompDTO;
pageModel: PageModel = new PageModel();
@State compDTO: CompDTO = {} as CompDTO
build() {
... ... @@ -36,6 +39,30 @@ export struct CardAdvBottom {
.borderColor($r('app.color.color_EDEDED'))
.borderRadius(4)
}.width('100%')
}.width('100%').onClick(() => {
this.delComp()
})
}
/**
* 删除稿件
*/
private delComp() {
if (this.pageModel) {
let a = this.compDTO;
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i)
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
currentIndex = i
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
}
}
}
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---冠名广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
/**
* @Description: 广告---冠名广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvGanMiComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
@State advLength: number = 0;
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
let extraData = this.compDTO.matInfo.extraData
let labelDTO = JSON.parse(extraData) as AdvExtraData
this.advExtraData = labelDTO
//this.advExtraData.item = [this.advExtraData.item[0]]
// this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国"
this.advLength = this.advExtraData.item.length
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
Row() {
Stack() {
//长图
Image(this.advExtraData.itemTopImage)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(343 / 40)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
// 广告标签和删除功能
CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
}.width('100%').padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
})
//
List({ space: 8 }) {
ForEach(this.advExtraData.item, (content: AdvExtraItemData, index: number) => {
ListItem() {
// 广告列表信息
Column() {
Image(content.image)
.width('100%')
.aspectRatio(150 / 84)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderRadius(4)
Text(content.title)
.fontSize('16fp')
.fontColor($r('app.color.color_222222'))
.fontSize('15fp')
.maxLines(3)
.lineHeight(20)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
.margin({ top: 8 })
}
.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%')
.margin({ left: index === 0 ? this.advLength == 1 ? 0 : 16 : 0 })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: content.linkUrl,
linkType: content.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}
})
}
.width('100%')
.listDirection(Axis.Horizontal)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
// .contentStartOffset(this.advLength == 1 ? 0 : 16)
.contentEndOffset(this.advLength == 1 ? 0 : 16)
.margin({ top: 10, bottom: 10 })
.padding({
left: this.advLength == 1 ? 16 : 0,
right: this.advLength == 1 ? 16 : 0,
})
// 更多按钮
commonButton(this.advExtraData)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
/*
标题样式
*/
@Builder
function commonButton(advExtraData: AdvExtraData) {
Row() {
Row() {
Blank()
Text('查看更多').fontColor('#222222').fontSize('14fp')
Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
Blank()
}
.width('100%')
.backgroundColor('#F5F5F5')
.borderRadius(3)
.padding({ top: 10, bottom: 10, })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: advExtraData.itemMore.linkUrl,
linkType: advExtraData.itemMore.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}.width('100%').padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
})
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import PageModel from '../../viewmodel/PageModel';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---长通栏广告 和 顶部长通栏广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
/**
* @Description: 广告---长通栏广告 和 顶部长通栏广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvLongImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State haveTitle: boolean = true
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//新闻标题
if (this.haveTitle) {
Text(this.compDTO.matInfo.advTitle).width('100%').bottomTextStyle().margin({ bottom: 8, })
}
//长图
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(343 / 96)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardAdvBottom({ pageModel: this.pageModel, compDTO:this.compDTO }).margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -48,13 +56,20 @@ export struct CardAdvLongImageComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.lineHeight(25)
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter';
import measure from '@ohos.measure';
import { DisplayUtils } from 'wdKit/Index';
import { CardAdvBottom } from './CardAdvBottom';
import PageModel from '../../viewmodel/PageModel';
const TAG: string = 'CardAdvSmallImageComponent';
... ... @@ -20,10 +21,9 @@ const TAG: string = 'CardAdvSmallImageComponent';
export struct CardAdvSmallImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '----小图卡----aboutToAppear-----')
// 计算标题文本行数
let screenWith = DisplayUtils.getDeviceWidth();
screenWith = screenWith * 0.62
... ... @@ -33,7 +33,6 @@ export struct CardAdvSmallImageComponent {
aboutToDisappear(): void {
console.error('ZZZXXXXX', '---小图卡-----aboutToDisappear-----')
}
build() {
... ... @@ -62,6 +61,7 @@ export struct CardAdvSmallImageComponent {
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderRadius(4)
//.alt('wwww.baidu.com')
.alignRules({
top: { anchor: 'title_name', align: VerticalAlign.Top },
left: { anchor: 'title_name', align: HorizontalAlign.End },
... ... @@ -69,7 +69,7 @@ export struct CardAdvSmallImageComponent {
.margin({ left: 12 })
CardAdvBottom().width('62%').id('bottom_adv').alignRules({
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('62%').id('bottom_adv').alignRules({
bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
... ...
... ... @@ -2,6 +2,7 @@
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
... ... @@ -19,15 +20,13 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvThreeImageComponent {
@State compDTO: CompDTO = {} as CompDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '---三图卡-----aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '----三图卡----aboutToDisappear-----')
}
build() {
... ... @@ -65,7 +64,7 @@ export struct CardAdvThreeImageComponent {
.margin({ top: 8 })
// 广告工具组件
CardAdvBottom().width('100%').margin({ top: 8 })
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).width('100%').margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
* @Description: 广告稿件 顶部标签+删除按钮
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvTop {
pageModel: PageModel = new PageModel();
compDTO: CompDTO = {} as CompDTO
build() {
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(4)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(4)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
}).onClick(() => {
this.delComp()
})
}
/**
* 删除稿件
*/
private delComp() {
if (this.pageModel) {
let a = this.compDTO;
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i)
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
currentIndex = i
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
}
}
}
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---视频广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
/**
* @Description: 广告---视频广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvVideoComponent {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = {} as ContentDTO
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
// this.contentDTO.objectType = '1'
// this.contentDTO.videoInfo = { videoDuration: 1000 } as VideoInfoDTO
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '---视频广告-----aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//新闻标题
Text(this.compDTO.matInfo.advTitle).bottomTextStyle()
//大图
Stack() {
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
//播放状态+时长
CardMediaInfo({
contentDTO: this.contentDTO
})
}
.alignContent(Alignment.BottomEnd)
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
CardAdvBottom({pageModel:this.pageModel,compDTO:this.compDTO}).margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -48,13 +67,21 @@ export struct CardAdvVideoComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.width('100%')
.lineHeight(25)
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import PageModel from '../../viewmodel/PageModel';
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
/**
* @Description: 广告---冠名广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
/**
* @Description: 广告---展会广告
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvVideoExComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
pageModel: PageModel = new PageModel();
aboutToAppear(): void {
console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
let extraData = this.compDTO.matInfo.extraData
let labelDTO = JSON.parse(extraData) as AdvExtraData
this.advExtraData = labelDTO
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
Stack() {
//长图
Image(this.advExtraData.itemTopImage)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(343 / 80)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardAdvTop({ pageModel: this.pageModel, compDTO: this.compDTO })
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
//
List({ space: 10 }) {
ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
ListItem() {
Text(content.title).fontSize('16fp').fontColor($r('app.color.color_222222')).width('100%').onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: content.linkUrl,
linkType: content.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}
})
}.width('100%').listDirection(Axis.Vertical).margin({ top: 10, bottom: 10 })
// 更多按钮
commonButton(this.advExtraData)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -47,14 +84,33 @@ export struct CardAdvVideoExComponent {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
/*
标题样式
*/
@Builder
function commonButton(advExtraData: AdvExtraData) {
Row() {
Blank()
Text('查看更多').fontColor('#222222').fontSize('14fp')
Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
Blank()
}
.width('100%')
.backgroundColor('#F5F5F5')
.borderRadius(3)
.padding({ top: 10, bottom: 10, })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: advExtraData.itemMore.linkUrl,
linkType: advExtraData.itemMore.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}
\ No newline at end of file
... ...
import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
/**
* 大专题卡--CompStyle: 10
... ... @@ -110,12 +109,23 @@ export struct Card10Component {
// 右侧图片
if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Image(item.fullColumnImgUrls[0].url)
.width(117)
.height(78)
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.image_border_radius'))
.margin({ left: 12 })
Stack() {
Image(item.fullColumnImgUrls[0].url)
.width(117)
.height(78)
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.image_border_radius'))
.margin({ left: 12 })
CardMediaInfo({
contentDTO: {
objectType: String(item.objectType),
videoInfo: { videoDuration: Number(item.videoDuration) as number },
photoNum: Number(item.photoNum),
voiceInfo: { voiceDuration: Number(item.voiceDuration) as number }
} as ContentDTO
})
}
.alignContent(Alignment.BottomEnd)
}
}
.padding({ top: 10, bottom: 10 })
... ...
import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
... ... @@ -104,10 +104,12 @@ export struct Card9Component {
Column() {
Row() {
// 标题
Image($r("app.media.timeline_rect"))
Image($r("app.media.timeAxis"))
.width(9)
.height(9)
.margin({ right: 5 })
.fillColor(item.newsTitleColor)
Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm"))
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_222222'))
... ...
... ... @@ -15,7 +15,7 @@ export class publishCommentModel {
/*【迭代二新增】关联的频道id/专题id; 页面必传*/
targetRelObjectId: string = ""
/*【迭代二新增】是否是重点稿件 1是 0否 页面必传*/
keyArticle: string = ''
keyArticle: string = '0'
/*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增) 页面必传*/
targetType: string = ''
/*评论总数*/
... ...
... ... @@ -9,8 +9,9 @@ import measure from '@ohos.measure'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel';
import { ifaa } from '@kit.OnlineAuthenticationKit';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
const TAG = 'CommentComponent';
... ... @@ -25,6 +26,10 @@ export struct CommentComponent {
// @State private browSingModel: commentListModel = new commentListModel()
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
... ... @@ -69,11 +74,12 @@ export struct CommentComponent {
//
addCommentLocal() {
let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
// let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
let model = this.publishCommentModel.lastCommentModel
/*一级评论*/
// if (this.publishCommentModel.lastCommentModel)
if (this.publishCommentModel.lastCommentModel.parentId == '-1') {
this.allDatas.addFirstItem(model)
//TODO 跳转顶部
} else {
//二级评论
this.allDatas.getDataArray().forEach(element => {
... ... @@ -134,7 +140,7 @@ export struct CommentComponent {
build() {
Column() {
List() {
List({scroller:this.listScroller}) {
ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
... ... @@ -176,7 +182,6 @@ export struct CommentComponent {
if (this.hasMore === false) NoMoreLayout()
}
}
.onReachEnd(()=>{
if (this.hasMore) {
this.getData()
... ... @@ -552,6 +557,12 @@ struct commentFooterView {
}
.onClick(() => {
// 未登录,跳转登录
const user_id = HttpUtils.getUserId()
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
commentLikeChange(this.item)
commentViewModel.commentLike(this.item).then(() => {
}).catch(() => {
... ...
... ... @@ -7,17 +7,17 @@ import commentViewModel from '../viewmodel/CommentViewModel'
@Preview
@CustomDialog
export struct CommentCustomDialog {
@ObjectLink publishCommentModel: publishCommentModel
controller?: CustomDialogController
confirm: (value: Record<string, string>) => void = () => {
}
@State private emojiSwitch: boolean = false
textInputController: TextAreaController = new TextAreaController()
@State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 }
aboutToAppear(): void {
// this.textInputController.caretPosition(0)
}
publishCommentRequest() {
... ... @@ -25,9 +25,11 @@ export struct CommentCustomDialog {
// this.publishCommentModel.commentContent = this.commentText
//TODO 判断类型
this.publishCommentModel.commentType = '2'
commentViewModel.publishComment(this.publishCommentModel).then((model:commentItemModel) => {
commentViewModel.publishComment(this.publishCommentModel).then((model: commentItemModel) => {
this.publishCommentModel.commentContent = ''
this.publishCommentModel.lastCommentModel = model
//
this.publishCommentModel.lastCommentModel = commentViewModel.deepCopyCommentItemModel(model)
// this.commentText = ''
if (this.controller != null) {
this.controller.close()
... ... @@ -72,12 +74,13 @@ export struct CommentCustomDialog {
.height(30)
.onClick(() => {
// this.commentText = this.commentText + '神鼎'
this.positionInfo = this.textInputController.getCaretOffset()
this.emojiSwitch = !this.emojiSwitch
if (this.emojiSwitch) {
this.textInputController.stopEditing()
} else {
this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
// this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
}
})
... ... @@ -114,7 +117,7 @@ export struct CommentCustomDialog {
//表情view
if (this.emojiSwitch) {
emojiView()
emojiView({ publishCommentModel: this.publishCommentModel }).height(150)
}
}.backgroundColor(Color.White)
... ... @@ -127,10 +130,90 @@ export struct CommentCustomDialog {
@Component
struct emojiView {
@ObjectLink publishCommentModel: publishCommentModel
/*没找到获取系统emoji的方案*/
private emojiString = '😀,😁,😂,😃,😄,😅,😆,😇,😈,😉,😊,😋,😌,😍,😎,😏,😐,😑,😒,😓,😔,😕,😖,😗,😘,😙,😚,😛,😜,😝,😞,😟,😠,😡,😢,😣,😤,😥,😦,😧,😨,😩,😪,😫,😬,😭,😮,😯,😰,😱,😲,😳,😴,😵,😶,😷,😸,😹,😺,😻,😼,😽,😾,😿,🙀,🙅,🙆,🙇,🙈,🙉,🙊,🙋,🙌,🙍,🙎,🙏'
private displayArray: string[][] = []
private swiperController: SwiperController = new SwiperController()
aboutToAppear(): void {
this.displayArray = chunk(this.emojiString.split(','), 20)
//补上删除按钮以及空白占位
let lastElement = this.displayArray.slice(-1)[0];
if (lastElement.length < 20) {
let needLength = (20 - lastElement.length)
for (let index = 0; index < needLength; index++) {
lastElement.push('')
}
}
this.displayArray.forEach(element => {
element.push('删除')
});
}
build() {
// String.fromCodePoint()
Swiper(this.swiperController) {
ForEach(this.displayArray, (array: [], index) => {
Column() {
Grid() {
ForEach(array, (emoji: string, subIndex: number) => {
GridItem() {
Text() {
if (emoji == '删除') {
ImageSpan($r('app.media.wdInput_delete'))
} else {
Span(emoji)
}
}.textAlign(TextAlign.Center).width(30).height(30)
// .backgroundColor(Color.Orange)
}.onClick(() => {
if (emoji == '删除') {
this.publishCommentModel.commentContent = this.publishCommentModel.commentContent.substring(0, this.publishCommentModel.commentContent.length -1)
} else if (emoji == '') {
} else {
this.publishCommentModel.commentContent = this.publishCommentModel.commentContent + emoji
}
})
})
}
.maxCount(6)
.columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr')
.rowsGap(10)
.layoutDirection(GridDirection.Row)
Row().height(40)
}
})
}
.indicator(true)
.vertical(false)
.height(140)
}
}
function chunk<T>(array: T[], size: number): T[][] {
const result: T[][] = [];
for (let i = 0; i < array.length; i += size) {
result.push(array.slice(i, i + size));
}
return result;
}
... ...
... ... @@ -44,7 +44,10 @@ export struct CommentTabComponent {
}
}.width(151).height(30)
.onClick(() => {
this.publishCommentModel.rootCommentId = '-1';
this.publishCommentModel.parentId = '-1';
this.publishCommentModel.placeHolderText = "优质评论会获得最佳评论人的称号"
this.dialogController?.open();
})
}
... ...
... ... @@ -71,6 +71,7 @@ export struct LiveCommentComponent {
left: 6,
right: 2
})
.visibility(this.heartNum > 0 ? Visibility.Visible : Visibility.Hidden)
Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal'))
.width(24)
.height(24)
... ...
import { ViewType } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index'
import { commentItemModel, commentListModel } from '../model/CommentModel'
import { commentItemModel } from '../model/CommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
import { router, window } from '@kit.ArkUI'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MyCommentDataSource } from '../model/MyCommentDataSource'
import { HttpUrlUtils } from 'wdNetwork/Index'
import PageModel from '../../../viewmodel/PageModel'
import { HttpUtils } from 'wdNetwork/Index'
import { ErrorComponent } from '../../view/ErrorComponent'
import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent'
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'
import { EmptyComponent, WDViewDefaultType } from '../../view/EmptyComponent'
import NoMoreLayout from '../../page/NoMoreLayout'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
const TAG = 'QualityCommentsComponent';
... ... @@ -24,9 +23,6 @@ export struct QualityCommentsComponent {
@State hasMore: boolean = true;
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
@State tileOpacity: number = 0;
firstPositionY: number = 0;
bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
... ... @@ -34,6 +30,11 @@ export struct QualityCommentsComponent {
lastWindowColor: string = '#ffffff'
currentWindowColor: string = '#FF4202'
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
/*必传*/
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToDisappear(): void {
... ... @@ -43,13 +44,33 @@ export struct QualityCommentsComponent {
windowClass.setWindowLayoutFullScreen(false)
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
}
aboutToAppear(): void {
this.fullScreen();
this.getData();
this.showAlert()
}
showAlert(){
this.dialogController = new CustomDialogController({
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
},
publishCommentModel: this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -20
},
})
}
getData(resolve?: (value: string | PromiseLike<string>) => void){
... ... @@ -217,7 +238,7 @@ export struct QualityCommentsComponent {
// ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
QualityCommentItem({ item: item, index: index , dialogController:this.dialogController, publishCommentModel:this.publishCommentModel}).margin({ left: 12, right: 12 })
}
})
// 加载更多
... ... @@ -243,16 +264,6 @@ export struct QualityCommentsComponent {
}
@Builder
testLayout(){
List({ space: 12, scroller:this.scroller }){
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
}
})
}
}
}
... ... @@ -261,6 +272,8 @@ export struct QualityCommentsComponent {
@Component
struct QualityCommentItem {
@ObjectLink publishCommentModel: publishCommentModel
dialogController: CustomDialogController | null = null;
@ObjectLink item: commentItemModel
index: number = 0
... ... @@ -360,7 +373,20 @@ struct QualityCommentItem {
Row({ space: 16 }) {
Row() {
Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
}
}.onClick(()=>{
this.publishCommentModel.targetId = this.item.targetId
this.publishCommentModel.targetRelId = this.item.targetRelId
this.publishCommentModel.targetTitle = this.item.targetTitle
this.publishCommentModel.targetRelType = this.item.targetRelType
this.publishCommentModel.targetRelObjectId = this.item.targetRelObjectId
this.publishCommentModel.targetType = this.item.targetType
// this.publishCommentModel.keyArticle = this.item.keyArticle
this.publishCommentModel.rootCommentId = this.item.rootCommentId
this.publishCommentModel.parentId = this.item.id
this.dialogController?.open()
})
Row() {
Image($r(this.item.api_status ? 'app.media.comment_like_select' : 'app.media.comment_like_normal'))
... ... @@ -373,6 +399,12 @@ struct QualityCommentItem {
.margin({ left: 3 })
}
}.onClick(() => {
// 未登录,跳转登录
const user_id = HttpUtils.getUserId()
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
commentLikeChange(this.item)
commentViewModel.commentLike(this.item).then(() => {
}).catch(() => {
... ...
import { DateTimeUtils, Logger, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import {
... ... @@ -183,6 +184,14 @@ class CommentViewModel {
}
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let userId = HttpUtils.getUserId()
let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '')
if (!userId && !FIRSTCOMMENTTIME) {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
success(model)
}, (error: Error) => {
ToastUtils.showToast('评论失败', 1000);
... ...
... ... @@ -180,7 +180,7 @@ struct CarouselLayout01CardView {
})
Column() {
// 这里用于展示轮播图右上角信息,这里只对直播类型的展示
if (this.item.objectType === '2') {
if (this.item.objectType === '2' || this.item.objectType ==='4') {
CardMediaInfo({ contentDTO: this.item })
.width(CommonConstants.FULL_PARENT)
}
... ...
... ... @@ -4,6 +4,7 @@ import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit';
/**
* 直播预约卡
... ... @@ -17,6 +18,22 @@ export struct ZhSingleRow03 {
@State compDTO: CompDTO = {} as CompDTO
scroller: Scroller = new Scroller()
format(timeNum: number) {
const todayDate = new Date().setHours(0,0,0,0)
const parseDate = new Date(timeNum).setHours(0,0,0,0);
if (todayDate === parseDate) {
return '今天'
} else { const str = DateTimeUtils.formatDate(timeNum, 'MM月dd日')
const month: string = str.split('月')[0];
if (month[0] === "0") {
return str.slice(1)
} else {
return str.slice(0)
}
}
}
build() {
Column() {
//顶部
... ... @@ -42,7 +59,8 @@ export struct ZhSingleRow03 {
Row() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Row() {
Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
Text(this.format(new Date(item.liveInfo.liveStartTime).getTime()))
// Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
... ... @@ -106,7 +124,7 @@ export struct ZhSingleRow03 {
.width(3)
.height(16)
.margin({ right: 4 })
Text('直播预')
Text('直播预')
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
... ...
... ... @@ -30,6 +30,7 @@ const TAG = 'Zh_Single_Row-06'
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
@State likeBl: boolean = false;
build() {
Column() {
... ... @@ -81,7 +82,7 @@ export struct ZhSingleRow06 {
.fontColor(0x999999)
Row(){
Image($r('app.media.icon_like_no'))
Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
.width(16)
.height(16)
.margin({right: 3})
... ... @@ -90,6 +91,13 @@ export struct ZhSingleRow06 {
.fontSize(14)
.fontColor(0x999999)
}
.onClick(() => {
if (this.likeBl) {
this.likeBl = false;
} else {
this.likeBl = true;
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
... ...
... ... @@ -9,13 +9,12 @@ export default struct MinePageMoreFunctionUI {
build() {
Column() {
Column() {
Text(`更多功能`)
.width('456lpx')
.height('38lpx')
.fontColor($r('app.color.color_666666'))
Text("更多功能")
.fontColor($r('app.color.color_222222'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.fontWeight('600lpx')
.lineHeight('46lpx')
.fontWeight(FontWeight.Bold)
}.height('92lpx')
.width('100%')
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -9,13 +9,13 @@ export default struct MinePageUserSimpleInfoUI {
@Watch('loginStateChange') @Prop isLogin :boolean
@State userName:string = "登陆注册"
@State headPhotoUrl:string = ""
userType:string = "1"
@State levelHead:string = ""
@State levelId:number = 0
loginStateChange(){
if(this.isLogin){
this.getUserInfo()
this.getUserLevel()
}else{
this.headPhotoUrl = ""
this.levelHead = ""
... ... @@ -54,8 +54,10 @@ export default struct MinePageUserSimpleInfoUI {
Text(this.userName)
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.fontWeight(FontWeight.Bold)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('33lpx')
.lineHeight("46lpx")
Image($r('app.media.mine_user_edit'))
.width('27lpx')
... ... @@ -144,7 +146,21 @@ export default struct MinePageUserSimpleInfoUI {
this.userName = value.userName
this.headPhotoUrl = value.headPhotoUrl
UserDataLocal.setUserHeaderUrl(value.headPhotoUrl)
this.userType = value.userType
UserDataLocal.setUserType(value.userType)
if(this.userType === "1"){
if(StringUtils.isNotEmpty(value.honoraryIcon)){
this.levelHead = value.honoraryIcon
return
}
if(StringUtils.isNotEmpty(value.avatarFrame)){
this.levelHead = value.avatarFrame
}
}
}
this.getUserLevel()
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
... ... @@ -152,10 +168,14 @@ export default struct MinePageUserSimpleInfoUI {
getUserLevel(){
MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
if(value!=null){
this.levelHead = value.levelHead
if(StringUtils.isEmpty(this.levelHead)){
if(this.userType === "1"){
this.levelHead = value.levelHead
}
}
this.levelId = value.levelId
UserDataLocal.setUserLevel(value.levelId)
UserDataLocal.setUserLevelHeaderUrl(value.levelHead + "")
UserDataLocal.setUserLevel(this.levelId)
UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "")
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
... ...
... ... @@ -19,7 +19,7 @@ export struct FollowChildComponent{
Row() {
Row(){
Stack({alignContent: Alignment.Bottom}){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.icon_default_head_mater'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
... ... @@ -128,7 +128,7 @@ export struct FollowChildComponent{
Row() {
Row(){
Stack({alignContent: Alignment.Bottom}){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.icon_default_head_mater'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
... ...
import { EmitterUtils, EmitterEventId, Logger } from 'wdKit/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { FollowListItem } from '../../../viewmodel/FollowListItem'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
... ... @@ -20,16 +21,26 @@ export struct FollowFirstTabsComponent{
})
if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
//个人主页 跳转 关注页 tab 2
let intervalID = setInterval(() => {
this.currentIndex = this.changeIndex
this.controller.changeIndex(this.currentIndex)
clearInterval(intervalID);
}, 500);
this.jumpFollowNextPage()
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => {
if(this.controller != null && this.data.length>1 ){
this.jumpFollowNextPage()
}
}))
}
jumpFollowNextPage(){
//个人主页 跳转 关注页 tab 2
let intervalID = setInterval(() => {
this.currentIndex = 1
this.controller.changeIndex(this.currentIndex)
clearInterval(intervalID);
}, 500);
}
@Builder TabBuilder(index: number, item: FollowListItem) {
... ... @@ -74,6 +85,7 @@ export struct FollowFirstTabsComponent{
.vertical(false)
.barMode(BarMode.Scrollable)
.barWidth('100%')
.barBackgroundColor($r('app.color.white'))
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
... ...
import { LazyDataSource, SPHelper, UserDataLocal } from 'wdKit';
import { EmitterEventId, EmitterUtils, LazyDataSource, SPHelper, UserDataLocal } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
... ... @@ -70,9 +70,15 @@ export struct FollowListDetailUI {
Column() {
if (this.count === 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 14 })
.layoutWeight(1)
.width('100%')
if(this.creatorDirectoryId === -1){
EmptyComponent({ emptyType: 14,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
}else{
EmptyComponent({ emptyType: 16,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
}
}
} else {
... ... @@ -156,10 +162,12 @@ export struct FollowListDetailUI {
}
this.isLoading = false
this.isGetRequest = true
this.sendFollowMessage()
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isGetRequest = true
this.isLoading = false
this.sendFollowMessage()
})
} else {
this.isLoading = false
... ... @@ -167,6 +175,12 @@ export struct FollowListDetailUI {
}
}
sendFollowMessage(){
if(this.count === 0){
EmitterUtils.sendEvent(EmitterEventId.MY_FOLLOW_EMPTY)
}
}
getNewPageData() {
//我的关注列表
if (this.creatorDirectoryId === -1) {
... ... @@ -179,6 +193,7 @@ export struct FollowListDetailUI {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
this.isGetRequest = true
} else {
this.getFollowListStatus(value)
}
... ... @@ -226,6 +241,8 @@ export struct FollowListDetailUI {
})
})
this.getFollowStatus(data_temp, result.totalCount)
}else{
this.isGetRequest = true
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
... ...
import { FollowListItem, FollowThirdListItem } from '../../../viewmodel/FollowListItem'
import { FollowListDetailUI } from './FollowListDetailUI'
import measure from '@ohos.measure'
@Component
export struct FollowThirdTabsComponent{
... ... @@ -11,8 +12,8 @@ export struct FollowThirdTabsComponent{
private controller: TabsController = new TabsController()
fontColor: string = '#999999'
selectedFontColor: string = '#000000'
fontColor: string = '#666666'
selectedFontColor: string = '#222222'
build(){
if(this.data != null){
... ... @@ -26,32 +27,44 @@ export struct FollowThirdTabsComponent{
@Builder TabBuilder(index: number, item: FollowThirdListItem) {
Column(){
Text(item.directoryName)
.fontSize('30lpx')
.textAlign(TextAlign.Center)
.fontWeight(this.currentIndex === index ? 600 : 400)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.lineHeight('38lpx')
.backgroundColor($r('app.color.color_F9F9F9'))
.padding('13lpx')
.maxLines(1)
Row(){
Image(index === 0?$r("app.media.ic_collect_left_left"):(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?$r('app.media.ic_collect_right_left'):$r('app.media.ic_collect_mid_left')))
.width(index === 0?"19lpx":"35lpx")
.height('61lpx')
.objectFit(ImageFit.Fill)
Text(item.directoryName)
.fontSize('27lpx')
.fontWeight(this.currentIndex === index ? "600lpx" : "400lpx")
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.lineHeight('35lpx')
.backgroundImage($r('app.media.ic_collect_mid'))
.backgroundImageSize(ImageSize.Cover)
.padding({top:"13lpx",bottom:"13lpx"})
Image(index === 0?$r("app.media.ic_collect_left_right"):(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?$r('app.media.ic_collect_right_right'):$r('app.media.ic_collect_mid_right')))
.width(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"19lpx":"35lpx")
.height('61lpx')
.objectFit(ImageFit.Fill)
}
}
.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('84lpx')
.margin({right:'9lpx'})
.padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"})
.justifyContent(FlexAlign.Center)
.offset({x:index === 0?"0lpx":"-5lpx"})
.height('80lpx')
.justifyContent(FlexAlign.End)
}
@Builder FollowThirdUI(){
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Row() {
Scroll() {
Row() {
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
... ... @@ -63,8 +76,8 @@ export struct FollowThirdTabsComponent{
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'11lpx'})
.width('100%')
.padding({left:'31lpx',right:'48lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
... ... @@ -77,11 +90,6 @@ export struct FollowThirdTabsComponent{
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
TabContent(){
Column(){
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.margin({left:'20lpx'})
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id})
}
}
... ... @@ -99,4 +107,19 @@ export struct FollowThirdTabsComponent{
}
}
getMeasureText(text: string,index:number) {
let width = measure.measureText({
textContent: text,
fontSize: px2fp(27),
lineHeight: px2fp(35)
})
if(index === 0){
return width + 19+ 35
}else if(index === this.data[this.firstIndex].children[this.secondIndex].children.length-1){
return width + 35+ 35
}else{
return width + 35+ 19
}
}
}
\ No newline at end of file
... ...
import { ContentDTO, Params } from 'wdBean';
import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
... ... @@ -106,6 +105,7 @@ export struct HomePageBottomComponent{
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
.offset({y:"-200lpx"})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
... ... @@ -114,6 +114,7 @@ export struct HomePageBottomComponent{
EmptyComponent({emptyType:11})
.layoutWeight(1)
.width('100%')
.offset({y:"-200lpx"})
}
}
}else{
... ... @@ -146,7 +147,7 @@ export struct HomePageBottomComponent{
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:1})
FollowChildComponent({data: item,type:2})
}
.onClick(() => {
})
... ... @@ -284,6 +285,7 @@ export struct HomePageBottomComponent{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
this.isLoading = false
this.isGetRequest = true
}else{
this.getCommentListStatus(value)
}
... ... @@ -322,6 +324,27 @@ export struct HomePageBottomComponent{
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
... ...
... ... @@ -101,6 +101,7 @@ export struct OtherHomePageBottomCommentComponent {
if (!this.data_comment || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
this.isGetRequest = true
} else {
this.getCommentListStatus(value)
}
... ... @@ -138,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent {
data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
... ...
... ... @@ -250,10 +250,10 @@ struct ChannelDialog {
.fontSize(16)
.fontWeight(600)
.margin({ right: 4 })
Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
.fontSize(12)
.fontWeight(400)
.fontColor('#222222')
// Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
// .fontSize(12)
// .fontWeight(400)
// .fontColor('#222222')
}
Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
... ... @@ -276,9 +276,9 @@ struct ChannelDialog {
Row() {
Text(item.name)
.fontSize(14)
.fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222'))
.fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222'))
if (this.isEditIng && item.delPermitted === 1) {
if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) {
Image($r('app.media.icon_audio_close'))
.width(12)
.margin({ left: 1 })
... ... @@ -287,12 +287,12 @@ struct ChannelDialog {
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
.backgroundColor(item.headlinesOn === 1 || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
}
.width('23%')
.height(40)
.border({
width: item.homeChannel === '1' ? 0 : 1,
width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1,
color: '#EDEDED',
radius: 3
})
... ... @@ -303,7 +303,7 @@ struct ChannelDialog {
TapGesture()
.onAction((event?: GestureEvent) => {
if (this.isEditIng) {
if (item.delPermitted === 1) {
if (item.delPermitted === 1 && item.movePermitted === 1) {
this.delChannelItem(index)
}
} else {
... ... @@ -319,7 +319,7 @@ struct ChannelDialog {
}
}
}),
PanGesture({ fingers: 1, direction: null, distance: 0 })
PanGesture({ fingers: 1, direction: this.isEditIng ? PanDirection.All:PanDirection.None, distance: 0 })
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
this.dragRefOffsetX = 0
... ... @@ -449,7 +449,7 @@ struct ChannelDialog {
}.width('100%').height('100%')
.scrollBar(BarState.Off)
}
.padding({ top: 40, right: 15, bottom: 20, left: 15 })
.padding({ top: 40, right: 15, bottom: 40, left: 15 })
.backgroundColor('#ffffff')
}
}
... ... @@ -526,10 +526,9 @@ struct ChannelSubscriptionLayout {
.width(18)
}
.width(36)
.height(36)
.height(40)
.justifyContent(FlexAlign.Center)
.padding({ bottom: 6 })
.backgroundColor('#ffffff')
.backgroundColor(Color.White)
.onClick(() => {
if (this.dialogController != null) {
this.dialogController.open()
... ...
... ... @@ -3,6 +3,7 @@ import { RefreshLayoutBean } from './RefreshLayoutBean';
/**
* Custom layout to show refresh or load.
* @deprecated
*/
@Component
export default struct CustomLayout {
... ...
... ... @@ -128,7 +128,8 @@ struct EditUserInfoPage {
onAccept:(value:DatePickerResult) => {
let mon = value.month as number + 1
let monStr = mon < 10? '0'+mon.toString():mon.toString();
this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+value.day;
let dayStr = value.day as number < 10? '0'+value.day:value.day;
this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+dayStr;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
this.updateEditModel()
}
... ...
... ... @@ -8,6 +8,7 @@ import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
import { MergeRecordDialog } from '../../dialog/MergeRecordDialog'
const TAG = 'MinePageComponent';
... ... @@ -30,9 +31,23 @@ export struct MinePageComponent {
this.isLogin = false
}else {
this.isLogin = true
this.addRecordDialog()
}
}
}
mergeDialogController: CustomDialogController = new CustomDialogController({
builder: MergeRecordDialog({
cancel: () => {
this.clearMergeRecord()
},
confirm: () => {
this.dealMergeRecordData()
}
}),
customStyle: true,
alignment: DialogAlignment.Center,
autoCancel: false
})
aboutToAppear(){
this.getUserLogin()
... ... @@ -112,5 +127,29 @@ export struct MinePageComponent {
}
}
addRecordDialog() {
setTimeout(() => {
this.dealMergeRecordDialog()
}, 300)
}
dealMergeRecordDialog() {
let commentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, "")
if (StringUtils.isNotEmpty(commentTime)) {
this.mergeDialogController.open()
}
}
dealMergeRecordData() {
MinePageDatasModel.visitorMergeComment().then(() => {
this.mergeDialogController.close()
}).catch(() => {
this.mergeDialogController.close()
})
}
clearMergeRecord(){
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, "")
}
}
... ...
... ... @@ -47,6 +47,7 @@ struct MyCollectionListPage {
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
hasMore:this.browSingModel.hasMore,
customList:()=>{
this.ListLayout()
},
... ... @@ -122,10 +123,14 @@ struct MyCollectionListPage {
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (this.currentPage === 1) {
this.allDatas = []
this.allDatas.push(...collectionItem.list)
}else {
this.allDatas = this.allDatas.concat(...collectionItem.list)
}
for (let index = 0; index < collectionItem.list.length; index++) {
const compDTO = collectionItem.list[index];
compDTO.isCollection = true ///用于时间展示
this.allDatas.push(compDTO)
}
if (collectionItem.hasNext === 0) {
this.browSingModel.hasMore = false;
} else {
... ... @@ -188,8 +193,17 @@ struct MyCollectionListPage {
})
//重置删除状态
this.updataUIState()
}
updataUIState(){
this.isEditState = false
this.isAllSelect = false
if (this.allDatas.length === 0) {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.hasMore === true
}
}
}
\ No newline at end of file
... ...
... ... @@ -5,12 +5,15 @@ import { RefreshConstants } from '../../utils/RefreshConstants'
*/
@Component
export default struct NoMoreLayout {
build() {
Row() {
Column() {
Text($r('app.string.footer_text'))
.margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING })
.fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
.fontColor('#CCCCCC')
.margin({bottom:40})
}
.width(RefreshConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
... ...