yangsunyue_wd
Showing 94 changed files with 2371 additions and 839 deletions

Too many changes to show.

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

{
"app": {
"bundleName": "com.wondertek.sight",
"bundleName": "com.peopledailychina.hosactivity",
"vendor": "$string:app_vendor",
"versionCode": 1000000,
"versionName": "1.0.0",
... ...
{
"app": {
// "signingConfigs": [
// {
// "name": "default",
// "type": "HarmonyOS",
// "material": {
// "certpath": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.cer",
// "storePassword": "0000001AB256FAF47AA4D68E4841C95D357490DE9FBB26A3A9161AD3069E31B3623E25CB49409CCA9CF7",
// "keyAlias": "debugKey",
// "keyPassword": "0000001AFB06818C2BC8DC275326668AAC62B91EBF7D3F84E8BE0F156D02623AA0F4F8C6B73F362CB371",
// "profile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p7b",
// "signAlg": "SHA256withECDSA",
// "storeFile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p12"
// }
// }
// ],
"signingConfigs": [
{
"name": "default",
"type": "HarmonyOS",
"material": {
"certpath": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.cer",
"storePassword": "0000001AB256FAF47AA4D68E4841C95D357490DE9FBB26A3A9161AD3069E31B3623E25CB49409CCA9CF7",
"keyAlias": "debugKey",
"keyPassword": "0000001AFB06818C2BC8DC275326668AAC62B91EBF7D3F84E8BE0F156D02623AA0F4F8C6B73F362CB371",
"profile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p7b",
"storePassword": "0000001EF28F8A628911F4F52B75E452C814EE4370854DD8DFCE186496B6AD88F8DE5AD3E10F24C1079F2EDD1FFF",
"certpath": "./singing_config/manual_com.peopledailychina.hosactivity_sign/鸿蒙中文版客户端证书.cer",
"keyAlias": "peopledailyhosalias",
"keyPassword": "0000001E2E8A50EFF2E6D2023242B432388B2748F8299D8BB319C0B06CFF7DCEA7482C5E3CDF1398CCE095BDC68B",
"profile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/peopledaiychina-hos-profile-debugDebug.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p12"
"storeFile": "./singing_config/manual_com.peopledailychina.hosactivity_sign/keystorefile.p12"
}
}
],
... ... @@ -217,6 +232,18 @@
]
}
]
},
{
"name": "wdHwAbility",
"srcPath": "./features/wdHwAbility",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
... ...
... ... @@ -22,3 +22,6 @@ export { ScreenType } from './src/main/ets/enum/ScreenType';
export { SpConstants } from './src/main/ets/constants/SpConstants';
export { DisplayDirection } from './src/main/ets/constants/VideoConstants';
export { ContentConstants } from './src/main/ets/constants/ContentConstants';
... ...
export class ContentConstants {
/* content#objectType,跳转类型:0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频 */
/**
* 0:不跳转
*/
static readonly TYPE_NONE: string = "0";
/**
* 1:点播
*/
static readonly TYPE_VOD: string = "1";
/**
* 2:直播
*/
static readonly TYPE_LIVE: string = "2";
/**
* 5:专题详情
*/
static readonly TYPE_SPECIAL_TOPIC: string = "5";
/**
* 6:链接
*/
static readonly TYPE_LINK: string = "6";
/**
* 8:图文详情,这里是h5页面
*/
static readonly TYPE_TELETEXT: string = "8";
/**
* 9:图集
*/
static readonly TYPE_NINE: string = "9";
/**
* 13:音频详情
*/
static readonly TYPE_AUDIO: string = "13";
/**
* 14:动态图文
*/
static readonly TYPE_FOURTEEN: string = "14";
/**
* 15:动态视频
*/
static readonly TYPE_FIFTEEN: string = "15";
/**
* 30:金刚位聚合页
*/
static readonly TYPE_THIRTY: string = "30";
}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,10 @@ export class SpConstants{
static USER_STATUS="user_status"
static USER_TEMP_TOKEN="tempToken"
static USER_PHONE = "user_phone"
static USER_CREATOR_ID = "creatorId"
static USER_HEAD_PHOTO_URL = "headPhotoUrl"
static USER_SEX = "sex"
static USER_BIRTHDAY = "birthday"
//协议相关
static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
... ... @@ -20,10 +24,18 @@ export class SpConstants{
static MESSAGE_BOARD_PRIVATE_PROTOCOL = "message_board_private_protocol" //"留言板-隐私政策"
//设置页面
static SETTING_WIFI_IMAGE_SWITCH = "setting_wifi_switch" //wifi 图片开关
static SETTING_WIFI_VIDEO_SWITCH = "setting_wifi_switch" //wifi 视频开关
static SETTING_WIFI_VIDEO_SWITCH = "setting_video_switch" //wifi 视频开关
static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关
static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关
//未登录保存兴趣标签
static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags'
//定位相关
static LOCATION_CITY_NAME = "location_city_name" //定位
static LOCATION_CITY_CODE = "location_city_code" //定位
//启动页数据存储key
static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model'
}
\ No newline at end of file
... ...
import { Action } from './Action';
interface dataObject {
// dataSource:
// 1、图文详情数据
// 2、英文端跳转推荐内容数据
// 3、显示图片预览
// 4、专题pageinfo数据
// 5、专题comp运营位点击跳转(传给App记录浏览历史)
// 6、图文详情引用内容跳转
// 7、专题分享海报图上的数据列表(H5可选第一页前5条运营位数据)
// 8、活动投稿 文章跳转
// 9、活动投稿 视频跳转
// 10、活动投稿 动态跳转
// 11、活动投稿 图集跳转
dataSource: number
operateType?: string
webViewHeight?: string
... ...
... ... @@ -44,4 +44,8 @@ export { EmitterUtils } from './src/main/ets/utils/EmitterUtils'
export { EmitterEventId } from './src/main/ets/utils/EmitterEventId'
export { HWLocationUtils } from './src/main/ets/utils/HWLocationUtils'
\ No newline at end of file
export { NetworkUtil } from './src/main/ets/utils/NetworkUtil'
export { NetworkManager } from './src/main/ets/network/NetworkManager'
export { NetworkType } from './src/main/ets/network/NetworkType'
... ...
import connection from '@ohos.net.connection';
import { BusinessError } from '@ohos.base';
import { Logger } from '../utils/Logger';
import { EmitterUtils } from '../utils/EmitterUtils';
import { EmitterEventId } from '../utils/EmitterEventId';
import { NetworkType } from './NetworkType';
const TAG = 'NetworkManager'
/**
* 网络管理类
*/
export class NetworkManager {
private netCon: connection.NetConnection | null = null;
private static instance: NetworkManager;
private networkType: NetworkType = NetworkType.TYPE_UNKNOWN
public static getInstance(): NetworkManager {
if (!NetworkManager.instance) {
NetworkManager.instance = new NetworkManager();
}
return NetworkManager.instance;
}
public init() {
// 初始化
if (this.netCon) {
// 拦截重复初始化
return
}
this.networkMonitorRegister()
}
public release() {
this.networkMonitorUnregister()
}
private constructor() {
}
private networkMonitorRegister() {
this.netCon = connection.createNetConnection();
this.netCon.register((error) => {
if (error) {
Logger.error(TAG, 'register error:' + error.message);
return;
}
Logger.info(TAG, 'register success');
})
this.netCon.on('netAvailable', (data: connection.NetHandle) => {
Logger.info(TAG, 'netAvailable, data is: ' + JSON.stringify(data))
})
this.netCon.on('netBlockStatusChange', (data: connection.NetBlockStatusInfo) => {
Logger.info(TAG, 'netBlockStatusChange, data is: ' + JSON.stringify(data))
// TODO 网络阻塞,是否创建新的网络、提示
})
this.netCon.on('netCapabilitiesChange', (data: connection.NetCapabilityInfo) => {
Logger.info(TAG, 'netCapabilitiesChange, data is: ' + JSON.stringify(data))
this.parseData(data)
// 可能多次通知
EmitterUtils.sendEvent(EmitterEventId.NETWORK_CONNECTED, JSON.stringify(this.networkType))
})
this.netCon.on('netConnectionPropertiesChange', (data: connection.NetConnectionPropertyInfo) => {
Logger.info(TAG, 'netConnectionPropertiesChange, data is: ' + JSON.stringify(data))
})
this.netCon.on('netUnavailable', ((data: void) => {
Logger.info(TAG, 'netUnavailable, data is: ' + JSON.stringify(data))
}));
this.netCon.on('netLost', ((data: connection.NetHandle) => {
Logger.info(TAG, 'netLost, data is: ' + JSON.stringify(data))
// TODO 断网
EmitterUtils.sendEvent(EmitterEventId.NETWORK_DISCONNECTED)
this.networkType = NetworkType.TYPE_NONE
}))
}
private networkMonitorUnregister() {
if (this.netCon) {
this.netCon.unregister((error: BusinessError) => {
if (error) {
Logger.error(TAG, 'unregister error:' + error.message);
return;
}
Logger.info(TAG, 'unregister success');
})
}
}
/**
* @deprecated
*/
private getNetworkMessage(netHandle: connection.NetHandle) {
connection.getNetCapabilities(netHandle, (error, netCap) => {
if (error) {
Logger.error(TAG, 'getNetCapabilities error:' + error.message);
return;
}
let netType = netCap.bearerTypes;
this.reset(netType)
})
}
private reset(netType: Array<connection.NetBearType>) {
if (netType == null) {
return
}
for (let i = 0; i < netType.length; i++) {
if (netType[i] === 0) {
// 蜂窝网
this.networkType = NetworkType.TYPE_CELLULAR
} else if (netType[i] === 1) {
// Wi-Fi网络
this.networkType = NetworkType.TYPE_WIFI
} else {
// 以太网网络
this.networkType = NetworkType.TYPE_ETHERNET
}
}
}
/**
* 获取网络类型,网络监听网络变化刷新类型,这里优先返回变量
*/
public getNetType(): NetworkType {
if (this.networkType != NetworkType.TYPE_UNKNOWN) {
return this.networkType
}
return this.getNetTypeSync()
}
/**
* 同步获取网络类型,耗时
*/
public getNetTypeSync(): NetworkType {
let netHandle = connection.getDefaultNetSync();
let netCapabilities = connection.getNetCapabilitiesSync(netHandle)
this.reset(netCapabilities.bearerTypes)
return this.networkType;
}
private parseData(data: connection.NetCapabilityInfo) {
// 解析网络信息
this.reset(data.netCap.bearerTypes)
}
}
\ No newline at end of file
... ...
/**
* 网络管理类
*/
export enum NetworkType {
// 未知
TYPE_UNKNOWN = -1,
// 无网络
TYPE_NONE = 0,
// wifi
TYPE_WIFI = 1,
// 蜂窝网
TYPE_CELLULAR = 2,
// 以太网
TYPE_ETHERNET = 3,
}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,10 @@
*/
export enum EmitterEventId {
// 通知登出,事件id
FORCE_USER_LOGIN_OUT = 1
FORCE_USER_LOGIN_OUT = 1,
// 网络连接成功,事件id
NETWORK_CONNECTED = 2,
// 网络断开,事件id
NETWORK_DISCONNECTED = 3,
}
... ...
... ... @@ -22,6 +22,11 @@ export class Logger {
private static domain: number = 0xFF00;
private static prefix: string = 'SightApp';
private static format: string = `%{public}s, %{public}s`;
private static format_ext: string = `%{public}s`;
/**
* 暂时没找到限制大小相关文档,尝试4000是不行的,3500可以。可以后续优化
*/
private static CHUNK_SIZE: number = 3500;
static isDebug: boolean = true;
/**
... ... @@ -36,46 +41,113 @@ export class Logger {
}
static debug(...args: string[]) {
if(!Logger.isDebug){
if (!Logger.isDebug) {
return
}
hilog.debug(Logger.domain, Logger.prefix, Logger.format, args);
Logger.logContent(LogLevel.DEBUG, ...args)
}
static info(...args: string[]) {
if(!Logger.isDebug){
if (!Logger.isDebug) {
return
}
hilog.info(Logger.domain, Logger.prefix, Logger.format, args);
Logger.logContent(LogLevel.INFO, ...args)
}
static warn(...args: string[]) {
if(!Logger.isDebug){
if (!Logger.isDebug) {
return
}
hilog.warn(Logger.domain, Logger.prefix, Logger.format, args);
Logger.logContent(LogLevel.WARN, ...args)
}
static error(...args: string[]) {
if(!Logger.isDebug){
if (!Logger.isDebug) {
return
}
hilog.error(Logger.domain, Logger.prefix, Logger.format, args);
Logger.logContent(LogLevel.ERROR, ...args)
}
static fatal(...args: string[]) {
if(!Logger.isDebug){
if (!Logger.isDebug) {
return
}
hilog.fatal(Logger.domain, Logger.prefix, Logger.format, args);
Logger.logContent(LogLevel.FATAL, ...args)
}
static isLoggable(level: LogLevel) {
if(!Logger.isDebug){
if (!Logger.isDebug) {
return
}
// 判断是否打印 TODO
hilog.isLoggable(Logger.domain, Logger.prefix, level);
}
static logContent(level: LogLevel, ...args: string[]) {
let msg = Logger.getMsg(...args)
let length = msg.length
if (length < Logger.CHUNK_SIZE) {
// 不超限,保持原来的打印
Logger.print(level, ...args)
} else {
// 超限,分段打印
for (let i = 0; i < length; i += Logger.CHUNK_SIZE) {
let count = Math.min(length - i, Logger.CHUNK_SIZE);
Logger.printExt(level, msg.substring(i, i + count));
}
}
}
static print(level: LogLevel, ...msg: string[]) {
switch (level) {
case LogLevel.DEBUG:
hilog.debug(Logger.domain, Logger.prefix, Logger.format, msg);
break
case LogLevel.INFO:
hilog.info(Logger.domain, Logger.prefix, Logger.format, msg);
break
case LogLevel.WARN:
hilog.warn(Logger.domain, Logger.prefix, Logger.format, msg);
break
case LogLevel.ERROR:
hilog.error(Logger.domain, Logger.prefix, Logger.format, msg);
break
case LogLevel.FATAL:
hilog.fatal(Logger.domain, Logger.prefix, Logger.format, msg);
break
}
}
static printExt(level: LogLevel, msg: string) {
switch (level) {
case LogLevel.DEBUG:
hilog.debug(Logger.domain, Logger.prefix, Logger.format_ext, msg);
break
case LogLevel.INFO:
hilog.info(Logger.domain, Logger.prefix, Logger.format_ext, msg);
break
case LogLevel.WARN:
hilog.warn(Logger.domain, Logger.prefix, Logger.format_ext, msg);
break
case LogLevel.ERROR:
hilog.error(Logger.domain, Logger.prefix, Logger.format_ext, msg);
break
case LogLevel.FATAL:
hilog.fatal(Logger.domain, Logger.prefix, Logger.format_ext, msg);
break
}
}
static getMsg(...args: string[]): string {
if (args == null || args.length <= 0) {
return '';
}
let msg = ''
args.forEach((v) => {
msg = msg.concat(', ').concat(v)
})
return msg.substring(2, msg.length);
}
}
export default new Logger('SightApp', 0xFF00)
\ No newline at end of file
... ...
import { NetworkManager } from '../network/NetworkManager'
import { NetworkType } from '../network/NetworkType'
/**
* 网络相关工具类
* 要实时监听网络,需要添加注册函数{例:src/main/ets/entryability/EntryAbility.ets:32}
*/
export class NetworkUtil {
/**
* 网络环境:0:无网 1:WiFi 2:2G 3:3G 4:4G 5:5G,暂时只识别出蜂窝网
* 扩展6-以太网
*/
static TYPE_NONE = '0'
static TYPE_WIFI = '1'
static TYPE_CELLULAR = '5'
// TODO 以太网,手机不涉及
static TYPE_ETHERNET = '6'
static getNetworkType(): string {
let type = NetworkManager.getInstance().getNetType()
return NetworkUtil.parseType(type)
}
static parseType(type: NetworkType): string {
switch (type) {
case NetworkType.TYPE_UNKNOWN:
case NetworkType.TYPE_NONE:
return NetworkUtil.TYPE_NONE;
case NetworkType.TYPE_WIFI:
return NetworkUtil.TYPE_WIFI;
case NetworkType.TYPE_CELLULAR:
return NetworkUtil.TYPE_CELLULAR;
case NetworkType.TYPE_ETHERNET:
return NetworkUtil.TYPE_ETHERNET;
default:
return NetworkUtil.TYPE_NONE;
}
}
/**
* 判断网络是否已连接
* @returns
*/
static isNetConnected(): boolean {
let type = NetworkManager.getInstance().getNetType()
if (type == NetworkType.TYPE_NONE) {
return false
}
return true
}
}
\ No newline at end of file
... ...
... ... @@ -26,7 +26,7 @@ export class ResourcesUtils {
try {
let text = buffer.from(content).toString("utf8");
if (text) {
Logger.info(TAG, "getResourcesText then text:" + text);
// Logger.info(TAG, "getResourcesText then text:" + text);
success(text);
} else {
Logger.warn(TAG, "getResourcesText then text is empty");
... ...
... ... @@ -24,6 +24,7 @@ export class UserDataLocal {
static USER_HEADER_URL="userHeaderUrl"
static USER_LEVEL="userLevel"
static USER_LEVEL_HEADER_URL="userLevelHeaderUrl"
static USER_FOLLOW_OPERATION="user_follow_operation"
//刷新token 用到
static USER_REFRESH_TOKEN="refreshToken"
... ... @@ -89,6 +90,10 @@ export class UserDataLocal {
SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url)
}
public static setUserFollowOperation(timestamp:string) {
SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp)
}
public static getUserLevel() {
if(UserDataLocal.userLevel != -1){
... ...
... ... @@ -132,6 +132,14 @@ export class WindowModel {
})
}
setWindowSystemBarEnable(names: Array<'status' | 'navigation'>) {
this.windowClass?.setWindowSystemBarEnable(names)
}
getWindowProperties() {
return this.windowClass?.getWindowProperties()
}
setWindowLayoutFullScreen(isFullScreen: boolean) {
this.isFullScreen = isFullScreen
this.windowClass?.setWindowLayoutFullScreen(isFullScreen)
... ...
... ... @@ -8,6 +8,11 @@
"tablet",
"2in1"
],
"deliveryWithInstall": true
"deliveryWithInstall": true,
"requestPermissions": [
{
"name": "ohos.permission.GET_NETWORK_INFO"
}
]
}
}
\ No newline at end of file
... ...
... ... @@ -12,8 +12,17 @@ export interface ResponseDTO<T = string> {
// 响应结果
data?: T;
/**
* @deprecated
*/
totalCount?: number;
meta?: MetaDTO;
// 请求响应时间戳(unix格式)
timestamp?: number;
}
export interface MetaDTO {
md5: string;
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import axios, {
HttpStatusCode,
InternalAxiosRequestConfig
} from '@ohos/axios';
import { Logger } from 'wdKit/Index';
// import type ResponseDTO from '../models/ResponseDTO';
... ... @@ -37,6 +38,7 @@ instance.interceptors.request.use(
}
// 公共请求参数
// config.params.key = key
Logger.debug('HttpRequest', 'request: ' + config.url)
return config;
},
(error: AxiosError) => {
... ... @@ -84,6 +86,9 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
// return Promise.reject(new Error(message))
// }
// const data: ResponseBean<any> = response.data
Logger.debug('HttpRequest', 'response ==============start=================')
Logger.debug('HttpRequest', 'response: ' + JSON.stringify(response.data))
Logger.debug('HttpRequest', 'response ==============end=================')
// 改造返回的数据,即将AxiosResponse的data返回,服务端返回的数据
return response.data;
} else {
... ... @@ -98,7 +103,7 @@ instance.interceptors.response.use(// 响应拦截器response类型就是Axios.r
// console.log(error.request)
// console.log(error.response)
// 这里用来处理http常见错误,进行全局提示
if(error!=null && error.response!=null ){
if (error != null && error.response != null) {
let message = buildErrorMsg(error.response.status);
// 错误消息可以使用全局弹框展示出来
console.log(`httpStatus:${error.response?.status}-${message},请检查网络或联系管理员!`)
... ...
... ... @@ -225,6 +225,10 @@ export class HttpUrlUtils {
*/
static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
/**
* 预约状态
*/
static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "api/live-center-message/zh/c/live/subscribe/user/batch";
/**
* 搜索结果 显示tab 数
*/
... ... @@ -281,12 +285,21 @@ export class HttpUrlUtils {
* 更新 兴趣偏好
*/
static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
/**
* 获取启动页相关数据
*/
static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage";
private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
/**
* 推荐列表
*/
static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
/**
* 搜索推荐
*/
static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
public static set hostUrl(value: string) {
HttpUrlUtils._hostUrl = value;
}
... ... @@ -319,8 +332,9 @@ export class HttpUrlUtils {
headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A')
headers.set('imei', HttpUrlUtils.getImei())
headers.set('Accept-Language', 'zh')
headers.set('city', HttpUrlUtils.getCity())
headers.set('city_dode', HttpUrlUtils.getCityCode())
// headers.set('city', HttpUrlUtils.getCity())
// headers.set('city_dode', HttpUrlUtils.getCityCode())
HttpUrlUtils.setLocationHeader(headers)
// TODO 判断是否登录
headers.set('userId', HttpUrlUtils.getUserId())
headers.set('userType', HttpUrlUtils.getUserType())
... ... @@ -363,6 +377,17 @@ export class HttpUrlUtils {
}
}
static setLocationHeader(headers: HashMap<string, string>) {
let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
if (StringUtils.isNotEmpty(cityName)) {
headers.set('city', encodeURI(cityName))
}
let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
if (StringUtils.isNotEmpty(cityCode)) {
headers.set('city_dode', encodeURI(cityCode))
}
}
static getHost() {
return HttpUrlUtils._hostUrl;
}
... ... @@ -458,7 +483,7 @@ export class HttpUrlUtils {
return 'Android';
}
private static getImei() {
public static getImei() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
}
... ... @@ -486,7 +511,12 @@ export class HttpUrlUtils {
}
static getVerifyCodeByTokenUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCodeByToken";
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
return url;
}
static getCheckVerifyCodeByToken() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
return url;
}
... ... @@ -732,6 +762,12 @@ export class HttpUrlUtils {
return url;
}
static getLaunchPageDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH;
return url;
}
static getLiveDetailsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
return url
... ... @@ -762,6 +798,11 @@ export class HttpUrlUtils {
return url
}
static getAppointmentStatusUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
return url
}
static getSearchResultCountDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
return url
... ... @@ -802,6 +843,17 @@ export class HttpUrlUtils {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike";
return url;
}
//搜索推荐
static getSearchSuggestDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH
return url
}
//金刚位聚合页
static getThemeListUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/themeList";
return url;
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
... ...
... ... @@ -2,4 +2,6 @@ export { WDRouterRule } from './src/main/ets/router/WDRouterRule'
export { WDRouterPage } from './src/main/ets/router/WDRouterPage'
export { registerRouter } from './src/main/ets/router/Action2Page'
\ No newline at end of file
export { registerRouter } from './src/main/ets/router/Action2Page'
export { ProcessUtils } from './src/main/ets/utils/ProcessUtils'
... ...
... ... @@ -9,6 +9,7 @@
"dependencies": {
"wdKit": "file:../wdKit",
"wdBean": "file:../../features/wdBean",
"wdNetwork": "file:../../commons/wdNetwork"
"wdNetwork": "file:../../commons/wdNetwork",
"wdConstant": "file:../../commons/wdConstant"
}
}
\ No newline at end of file
... ...
... ... @@ -50,11 +50,7 @@ export function registerRouter() {
Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) {
if (action.params?.liveStyle === 0) {
return WDRouterPage.detailPlayLivePage
} else {
return WDRouterPage.detailPlayVLivePage
}
return WDRouterPage.detailPlayLiveCommon
} else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) {
return WDRouterPage.detailVideoListPage
} else if (action.params?.detailPageType == 9) {
... ... @@ -69,6 +65,10 @@ export function registerRouter() {
return WDRouterPage.audioDetail
} else if (action.params?.detailPageType == 18) {
return WDRouterPage.multiPictureListPage
} else if (action.params?.detailPageType == 19) {
return WDRouterPage.videoPlayPage
}else if (action.params?.detailPageType == 30) {
return WDRouterPage.themeListPage
}
return WDRouterPage.detailPlayVodPage
})
... ...
... ... @@ -54,10 +54,13 @@ export class WDRouterPage {
// 直播详情页
static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage");
static detailPlayLiveCommon = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLiveCommon");
// 多图(图集)详情页
static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage");
//大图列表页
static multiPictureListPage = new WDRouterPage("wdComponent", "ets/pages/MultiPictureListPage");
//单个视频播放页
static videoPlayPage = new WDRouterPage("wdComponent", "ets/pages/VideoPlayPage");
// 音乐详情页
static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail");
// 动态详情页
... ... @@ -117,4 +120,6 @@ export class WDRouterPage {
static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage");
//预约更多页
static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage");
//金刚位聚合页
static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
}
... ...
import { Action, ContentDTO, Params } from 'wdBean';
import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Logger } from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import { WDRouterRule } from 'wdRouter';
import { ContentConstants } from '../constants/ContentConstants';
import { LiveModel } from '../viewmodel/LiveModel';
import { WDRouterRule } from '../router/WDRouterRule';
import { ContentConstants } from 'wdConstant';
import { common, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { AdvertsBean } from 'wdBean/src/main/ets/bean/adv/AdvertsBean';
// import { LiveModel } from '../viewmodel/LiveModel';
const TAG = 'ProcessUtils';
... ... @@ -13,6 +18,65 @@ const TAG = 'ProcessUtils';
*/
export class ProcessUtils {
/**
* 广告中心的业务广告跳转方法( 现用在挂角广告)
* @param advContent
*/
static openAdvDetail(matInfo: CompAdvMatInfoBean) {
if (matInfo == null) {
return;
}
// 优先openType,再取linkType
let type: string;
if (!StringUtils.isEmpty(matInfo.openType)) {
type = matInfo.openType;
} else {
type = matInfo.linkType;
}
if ('0' == type) {
// 0 :无链接
return;
}
let linkUrl: string = matInfo.linkUrl;
if (StringUtils.isEmpty(linkUrl)) {
return;
}
if ('1' == type) {
// 内链
let content: ContentDTO = {} as ContentDTO;
content.linkUrl = linkUrl;
ProcessUtils.gotoWeb(content);
} else if ('2' == type) {
// 外链
ProcessUtils.jumpExternalWebPage(linkUrl);
}
}
/**
* 展现中心的广告跳转 ( 现用在挂角广告)
* @param advert 展现中心的展现广告
*/
static advJumpMainPage(advert: AdvertsBean) {
let content: ContentDTO = {
linkUrl: advert.linkUrl,
pageId: advert.pageId,
objectId: advert.objectId,
objectType: advert.objectType,
relId: advert.relId,
bottomNavId: advert.bottomNavId
} as ContentDTO;
ProcessUtils.processPage(content);
}
/**
* 页面跳转
*/
static processPage(content: ContentDTO) {
... ... @@ -25,7 +89,7 @@ export class ProcessUtils {
return;
}
let type = content.objectType;
console.log(TAG,'objectType',`${JSON.stringify(content)}`);
console.log(TAG, 'objectType', `${JSON.stringify(content)}`);
switch (type) {
case ContentConstants.TYPE_NONE:
Logger.debug(TAG, "processPage, do nothing");
... ... @@ -57,10 +121,13 @@ export class ProcessUtils {
break;
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
break;
ProcessUtils.gotoDynamicDetailPage(content);
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoWeb(content);
ProcessUtils.gotoDynamicDetailPage(content);
break;
case ContentConstants.TYPE_THIRTY:
ProcessUtils.gotoThemeListPage(content)
break;
default:
break;
... ... @@ -75,7 +142,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 14,
detailPageType: Number.parseInt(content.objectType),
contentID: content?.objectId,
extra: {
relType: content?.relType,
... ... @@ -91,20 +158,18 @@ export class ProcessUtils {
* 图集详情页
* @param content
* */
private static gotoAtlasDetailPage(content: ContentDTO) {
public static gotoMultiPictureListPage(photoList: PhotoListBean[]) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 17,
contentID: content?.objectId,
detailPageType: 18,
extra: {
relType: content?.relType,
relId: content?.relId,
photoList
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
Logger.debug(TAG, `gotoMultiPictureListPage`);
}
private static gotoSpecialTopic(content: ContentDTO) {
... ... @@ -129,16 +194,25 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
static commentGotoWeb(content: commentInfo) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: content?.newsId,
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: content?.relType,
relId: content?.relId,
sourcePage: '5',
commentId: content?.commentId
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`);
}
private static gotoWeb(content: ContentDTO) {
// // topicId
// content.channelId;
// content.linkUrl;
// content.objectId;
// // CompId
// content.relId;
// content.relType;
// // ScrollToBottom
// // FromPage
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
... ... @@ -148,7 +222,8 @@ export class ProcessUtils {
relType: content?.relType,
relId: content?.relId,
channelId: content?.channelId,
sourcePage: '5'
sourcePage: '5',
commentId: content?.commentInfo?.commentId
} as ExtraDTO
} as Params,
};
... ... @@ -173,20 +248,11 @@ export class ProcessUtils {
}
private static async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
... ... @@ -212,4 +278,78 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAudio, ${content.objectId}`);
}
}
\ No newline at end of file
/**
* 金刚位聚合页
* @param content
* */
private static gotoThemeListPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 30,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
}
/**
* 图片预览页
* @param content
* */
private static gotoAtlasDetailPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 17,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
}
/**
* 打开外链
* @param url 外链地址
*/
public static jumpExternalWebPage(url: string) {
let context = getContext() as common.UIAbilityContext;
let wantInfo: Want = {
action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'],
uri: url
}
context.startAbility(wantInfo).then(() => {
Logger.debug(TAG, 'jumpExternalWebPage success')
}).catch((err: BusinessError) => {
Logger.error(TAG, 'jumpExternalWebPage success, error: ' + JSON.stringify(err))
})
}
/**
* 打开端内web页面
* @param url web地址
*/
public static gotoDefaultWebPage(url: string) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: url,
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
}
... ...
... ... @@ -3,8 +3,7 @@ import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger } from 'wdKit';
import { H5CallNativeType } from './H5CallNativeType';
import { ContentDTO } from 'wdBean';
//TODO 这里引用了 features模块,是否考虑将跳转抽到公共模块
import { ProcessUtils } from '../../../../../../features/wdComponent/src/main/ets/utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter/src/main/ets/utils/ProcessUtils';
const TAG = 'JsBridgeBiz'
... ... @@ -15,6 +14,7 @@ const TAG = 'JsBridgeBiz'
*/
export function performJSCallNative(data: Message, call: Callback) {
Logger.debug(TAG, 'performJSCallNative handlerName: ' + data.handlerName + ', data: ' + JSON.stringify(data.data))
switch (data.handlerName) {
case H5CallNativeType.jsCall_currentPageOperate:
break;
... ... @@ -25,12 +25,13 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_getArticleDetailBussinessData:
break;
case H5CallNativeType.jsCall_callAppService:
handleJsCallCallAppService(data)
break;
case H5CallNativeType.jsCall_receiveH5Data:
if(data?.data?.dataSource === 5){
handleH5Data(JSON.parse(data?.data?.dataJson || '{}'))
}
handleJsCallReceiveH5Data(data)
break;
case H5CallNativeType.jsCall_appInnerLinkMethod:
handleJsCallAppInnerLinkMethod(data)
break;
case 'changeNativeMessage':
call("this is change Web Message")
... ... @@ -52,17 +53,35 @@ class AppInfo {
* 获取App公共信息
*/
function getAppPublicInfo(): string {
let info = new AppInfo()
info.plat = 'Phone'
// 直接用Android,后续适配再新增鸿蒙
info.system = 'Android'
info.networkStatus = 1
let result = JSON.stringify(info)
Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info))
return result;
}
function handleH5Data(content:ContentDTO) {
Logger.debug(TAG, 'handleH5Data' + ', content: ' + JSON.stringify(content))
ProcessUtils.processPage(content)
function handleJsCallReceiveH5Data(data: Message) {
switch (data?.data?.dataSource) {
case 5:
if (data?.data?.dataSource === 5) {
ProcessUtils.processPage(JSON.parse(data?.data?.dataJson || '{}'))
}
break;
default:
break;
}
}
function handleJsCallCallAppService(data: Message) {
}
function handleJsCallAppInnerLinkMethod(data: Message) {
}
... ...
... ... @@ -7,7 +7,7 @@ import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
const TAG = 'WdWebLocalComponent';
const TAG = 'WdWebComponent';
@Component
export struct WdWebComponent {
... ... @@ -85,9 +85,10 @@ export struct WdWebComponent {
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
// setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
// }, 100)
//有时序问题 必须延时执行
setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
}, 200)
}
onPageEnd: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageEnd');
... ...
... ... @@ -102,9 +102,10 @@ export struct WdWebLocalComponent {
onPageBegin: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageBegin');
this.registerHandlers();
// setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
// }, 100)
//有时序问题 必须延时执行
setTimeout(() => {
BridgeUtil.webViewLoadLocalJs(getContext(this), this.webviewControl)
}, 200)
}
onPageEnd: (url?: string) => void = () => {
Logger.debug(TAG, 'onPageEnd');
... ...
... ... @@ -15,6 +15,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean';
// Content
export { ContentDTO } from './src/main/ets/bean/content/ContentDTO';
export { commentInfo } from './src/main/ets/bean/content/commentInfo';
export { AudioDTO } from './src/main/ets/bean/content/AudioDTO';
export { Action } from './src/main/ets/bean/content/Action'
... ... @@ -37,7 +39,6 @@ export {
postExecuteCollectRecordParams,
contentListParams,
postInteractAccentionOperateParams,
postRecommendListParams,
contentListItem
} from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
... ... @@ -119,12 +120,18 @@ export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO';
export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO';
export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean';
export { LiveRoomBean, LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean';
export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean';
export { ReserveBean } from './src/main/ets/bean/live/ReserveBean';
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';
... ... @@ -141,3 +148,8 @@ export {
InfluenceData
} from './src/main/ets/bean/peoples/PeopleShipUserDetailData';
export {
UserDetail,
UserExtend
} from './src/main/ets/bean/user/UserDetail';
... ...
/**
* @Description: 信息集合
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
export interface AdvertsBean{
/**
* 广告id
*/
id:string
/**
* 广告relId
*/
relId:string
/**
* 广告素材名称
*/
matTitle:string
/**
* 投放开始时间yyyy-MM-dd HH:mm:ss
*/
startTime:string
/**
* 投放结束时间yyyy-MM-dd HH:mm:ss
*/
endTime:string
/**
* 展现时段,多组数据:9:00:00-10:00:00|17:00:00-18:00:00
*/
displayTime:string
/**
* 展现优先级,数值越小,等级越高
*/
displayLevel:string
/**
* 链接跳转类型,0:无连接;1:内链(站内内容);2:外链
*/
linkType:number;
/**
* 外链广告外链地址,link_type=2生效
*/
linkUrl:string
/**
* 内链内容id 仅link_type=1生效
*/
contentId:string
/**
* 对象类型 0:不跳转 1:视频,2:直播,5:专题,6:链接,8:图文,9:组图,10:H5新闻,11:频道
*/
objectType:string
/**
* 内容标题
*/
contentTitle:string
/**
* 专题页面id
*/
topicPageId:string
/**
* 挂角封面图
*/
displayUrl:string
/**
* 页面id
*/
pageId:string
/**
* 跳转id
*/
objectId:string
/**
* 对象分类 ;频道(1:一级频道,2:二级频道),专题(1:普通专题,2:主题专题,3:作者专题)
*/
objectLevel:string
/**
* 底部导航栏 id(用于频道跳转)
*/
bottomNavId:string
}
\ No newline at end of file
... ...
/**
* @Description: 挂角广告数据
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
import { AdvertsBean } from './AdvertsBean';
import { CompAdvMatInfoBean, CompAdvSlotInfoBean } from './CompAdvInfoBean';
export interface AdvRuleBean {
/**
* 广告投放位编码
*/
pos: string;
/**
* 广告展示顺序,0:随机展示;1列表循环
*/
displayMode: number
/**
* 每间隔刷新n次展示广告
*/
refreshFrequency: number
/**
* 广告信息集合
*/
advert: AdvertsBean;
}
/**
* 广告组件数据
*/
export interface CompAdvBean {
/**
* 广告订单id
*/
id: string;
/**
* 投放开始时间
*/
startTime: number;
/**
* 投放结束时间
*/
endTime: number;
/**
* 信息流广告素材
*/
matInfo: CompAdvMatInfoBean
/**
* 信息流广告位
*/
slotInfo: CompAdvSlotInfoBean
/**
* 展示优先级
* 广告A,displayPriority=1
* 广告B,displayPriority=2
* 则打开页面时,挂角展示顺序 A->B (优先级升序排列)
*/
displayPriority: number;
/**
* 展示的次数
*/
showCount: number;
/**
* 页面id
*/
pageId: String ;
/**
* 开屏广告-显示时长
*/
displayDuration: String;
/**
* 开屏广告-展示轮数
* 2.launchAdInfo有多个时:
* 广告A,displayRound=10
* 广告B,displayRound=5,
* 每次开机屏展示广告概率
* 广告A=10/(10+5)
* 广告B=5/(10+5)
* 广告A展示10次后,不再展示,
* 广告B展示5此后,不再展示。
* 下一轮展示继续上面逻辑。
*/
displayRound: number;
}
... ...
/**
* @Description: 组件广告信息
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
/*
信息流广告素材解析累
*/
export interface CompAdvMatInfoBean {
/**
* 广告标题
*/
advTitle: string
/**
* 3:信息流广告
*/
advType: string
/**
* 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告)
*/
advSubType: string
/**
* 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用
*/
matImageUrl: string[]
/**
* 视频广告地址(adv_subtype=9)
*/
matVideoUrl: string
/**
* 扩展信息:advSubType=10,11时使用,字段示例见接口备注。
*/
extraData: string
/**
* 链接类型: 0:无链接;1:内链(文章);2:外链
*/
linkType: string
/**
* 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开
*/
openType: string
/**
* 广告跳转链接
*/
linkUrl: string
/**
* 素材类型(0:图片 1:视频)
*/
matType: string
/**
* 开屏样式(1:全屏样式 0:底部固定Logo)
*/
startStyle: string
}
/**
* 信息流广告位
*/
export interface CompAdvSlotInfoBean {
/**
* 组件id
*/
compId: string;
/**
* 广告位位置 从1开始
*/
position: number;
/**
* 频道id
*/
channelId: string;
}
\ No newline at end of file
... ...
... ... @@ -15,4 +15,5 @@ export interface ExtraDTO extends ItemDTO {
relType: string;
liveStreamType?: number;
photoList: PhotoListBean[];
commentId?: string;
}
\ No newline at end of file
... ...
... ... @@ -78,4 +78,6 @@ export interface ContentDTO {
titleShow?: number;
isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
commentInfo?: commentInfo
//底部导航栏 id(用于频道跳转)
bottomNavId:string;
}
\ No newline at end of file
... ...
... ... @@ -19,7 +19,10 @@ export interface Params {
// 13.音频详情页
// 17.多图(图集)详情页
// 18.大图列表页
// 19.单个视频播放页
detailPageType?: number; // 详情页类型
liveStyle?: number; // 直播类型:0横屏,1竖屏
creatorId?: string; //号主id
videoUrl?: string;
videoCoverUrl?: string;
}
... ...
... ... @@ -3,5 +3,9 @@ export interface commentInfo {
newsTitle: string,
userName: string,
userHeaderUrl: string,
publishTime: number
publishTime: number,
commentId: string,
newsId: string,
relId: string;
relType: string;
}
\ No newline at end of file
... ...
... ... @@ -177,14 +177,4 @@ export interface postInteractAccentionOperateParams {
// userType: number;
// userId: string;
status: number;
}
export interface postRecommendListParams {
imei: string;
userId ?: string;
contentId ?: string;
relId ?: string;
contentType ?: number;
recType: number;
channelId ? : string
}
\ No newline at end of file
... ...
... ... @@ -3,11 +3,14 @@ export interface RmhInfoDTO {
authTitle: string;
authTitle2: string;
banControl: number;
cnIsAttention: number;
cnIsAttention?: number;
cnAttention?: number;
cnlsComment?: number;
cnlsLike?: number;
cnMainControl: number;
cnShareControl: number;
cnIsComment: number;
cnIsLike: number;
cnIsComment?: number;
cnIsLike?: number;
posterShareControl: number;
rmhDesc: string;
rmhHeadUrl: string;
... ...
export interface postRecommendListParams {
imei: string;
userId ?: string;
contentId ?: string;
relId ?: string;
contentType ?: number;
recType: number;
channelId ? : string
}
\ No newline at end of file
... ...
export interface postThemeListParams {
sort: number;
pageNum: number;
pageSize: number;
}
\ No newline at end of file
... ...
... ... @@ -16,4 +16,11 @@ export interface LiveRoomItemBean {
//是否置顶 1置顶0不置顶
isTop: number
role: string
//ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
dataType: string
transcodeImageUrl: string
videoUrl: string
pictureResolutions: string[]
//音视频长度
duration: number
}
\ No newline at end of file
... ...
export interface ReserveBean {
relationId: string,
liveId: string
}
\ No newline at end of file
... ...
/**
* page接口返回的Page数据DTO
*/
import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean';
export interface PageInfoDTO {
pageId: string; // 页面id
id: number; // 楼层id
name: string; // 名称
hasAdInfo: number;
hasPopUp: number;
baselineShow: number;
groups: GroupInfoDTO[];
channelInfo: ChannelInfoDTO;
/**
* 1-有过广告配置,0-没有广告配置
*/
hasAdInfo: number;
/**
* 挂角广告数据
*/
cornersAdv:AdvRuleBean
/**
* 广告中心-挂角广告信息
*/
cornersAdv2:CompAdvBean[]
}
export interface ChannelInfoDTO {
... ...
export interface UserDetail{
createTime:string
headPhotoStatus:number
id:number
modifyNumber:number
phone:string
status:number
tenancy:number
userNameStatus:number
userType:number
userName:string
userExtend:UserExtend
}
export interface UserExtend{
airec:number
deviceId:string
lastLoginTime:string
sex:number
address:string
birthday:string
city:string
county:string
headPhotoUrl:string
introduction:string
province:string
sign:string
creatorId:string
}
... ...
... ... @@ -51,6 +51,8 @@ export { MultiPictureDetailPageComponent } from "./src/main/ets/components/Multi
export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent"
export { DynamicDetailComponent } from "./src/main/ets/components/DynamicDetailComponent"
export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel"
export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent"
... ...
... ... @@ -20,7 +20,8 @@ import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { CardParser } from './CardParser';
import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card5Component } from './cardview/Card5Component'
import { Card5Component } from './cardview/Card5Component';
import { Card2Component } from './cardview/Card2Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
/**
... ... @@ -71,6 +72,9 @@ export struct CompParser {
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ contentDTO: compDTO.operDataList[0] })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
... ...
import { AccountManagerUtils, Logger } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
PhotoListBean,
ContentDTO, } from 'wdBean';
ContentDTO,
RmhInfoDTO, } from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils } from '../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import display from '@ohos.display';
import { BusinessError } from '@ohos.base';
import { CommonConstants } from 'wdConstant/Index';
import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
import router from '@ohos.router';
const TAG = 'DynamicDetailComponent'
@Preview
@Component
... ... @@ -17,9 +23,17 @@ export struct DynamicDetailComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
//出参
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
//出参 fixme 模拟数据用json转换
@State contentDetailData: ContentDetailDTO = {
publishTime: "2023年03月14日 08:16",
rmhInfo:{rmhHeadUrl:"",rmhName:"人民号名称",rmhDesc:"人民号描述单行展示"},
newsContent:"优先展示这个内容",
newsSummary:"其次展示这个内容",
newsTitle:"上面两个都没有再展示这个内容",
newsType:15
} as ContentDetailDTO
//变量
scroller: Scroller = new Scroller();
/**
* 默认未关注 点击去关注
*/
... ... @@ -27,7 +41,13 @@ export struct DynamicDetailComponent {
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
private mJumpInfo: ContentDTO = {} as ContentDTO;
// 获取当前所有的display对象
promise: Promise<Array<display.Display>> = display.getAllDisplays()
// 屏幕宽度(单位px)
@State screenWidth: number = 0;
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -37,7 +57,6 @@ export struct DynamicDetailComponent {
}
build() {
Row() {
Column(){
//logo、日期
Row() {
... ... @@ -46,7 +65,7 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_28'))
.margin({ left: $r('app.float.margin_16') })
Blank()
Text("2023年03月14日 08:16")
Text(StringUtils.isEmpty(this.contentDetailData.publishTime)?"":this.contentDetailData.publishTime.replace('-','年').replace('-','月').replace(' ','日 ').substring(0,this.contentDetailData.publishTime.length-2))
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_28'))
... ... @@ -59,143 +78,307 @@ export struct DynamicDetailComponent {
.width('100%')
.height($r('app.float.margin_7'))
.margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
//号主信息
Row() {
//头像
Stack() {
Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
.alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))
.width($r('app.float.margin_32'))
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_16'))
Image($r('app.media.icon_border_test'))
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_24'))
}
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
Column(){
//昵称
Text("this.contentDetailData.rmhInfo?.rmhName")
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: $r('app.float.margin_5') })
//简介
Text("this.contentDetailData.rmhInfo?.rmhDesc")
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_B0B0B0'))
.fontWeight(FontWeight.Medium)
.margin({ left: $r('app.float.margin_5') })
}
if (this.followStatus == '0') {
Text('关注')
.width(60)
.height($r('app.float.margin_48'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
// this.handleAccention(this.item, 1)
})
} else {
Text('已关注')
.width($r('app.float.margin_60'))
.height($r('app.float.margin_48'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
// this.handleAccention(this.item, 0)
})
}
}
.width('100%')
//内容
Text("这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里")
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_18'))
.lineHeight($r('app.float.margin_25'))
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){
//附件内容:图片/视频
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
GridRow({
columns: { sm: this.contentDetailData.photoList.length
, md: this.contentDetailData.photoList.length == 1?1:
this.contentDetailData.photoList.length == 4?2:
3 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
//号主信息
Row() {
//头像
Stack() {
Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
.alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))
.width($r('app.float.margin_32'))
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_16'))
Image($r('app.media.icon_border_test'))
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_24'))
}
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
Column(){
//昵称
Text(this.contentDetailData.rmhInfo?.rmhName)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: $r('app.float.margin_5') })
.alignSelf(ItemAlign.Start)
//简介
Text(this.contentDetailData.rmhInfo?.rmhDesc)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_B0B0B0'))
.fontWeight(FontWeight.Medium)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ left: $r('app.float.margin_5') })
.alignSelf(ItemAlign.Start)
}
.width('63%')
.margin({right: $r('app.float.margin_6')})
if (this.followStatus == '0') {
Text('关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
// this.handleAccention(this.item, 1)
})
} else {
Text('已关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
// this.handleAccention(this.item, 0)
})
}
}
.width('100%')
.margin({ left: $r('app.float.margin_16')})
//内容
Text(StringUtils.isEmpty(this.contentDetailData.newsContent)
?StringUtils.isEmpty(this.contentDetailData.newsSummary)
?this.contentDetailData.newsTitle
:this.contentDetailData.newsSummary
:this.contentDetailData.newsContent)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_18'))
.lineHeight($r('app.float.margin_25'))
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
.alignSelf(ItemAlign.Start)
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
//附件内容:图片/视频
if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){
// 图片-从无图到9图展示
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
if (this.contentDetailData.photoList.length === 1) {
if (this.getPicType(item) !== 3) {
GridCol({
span: this.getPicType(item) === 1 ? 12 : 8
}){
Stack({
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType(item) === 1) {
Image(item.picPath)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType(item) === 2) {
Image(item.picPath)
.width('100%')
.height(305)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
})
} else {
GridCol({
span: { xs: 8 }
}) {
Image(item.picPath)
.width('100%')
.borderRadius(this.caclImageRadius(index))
.autoResize(true)
.opacity(!item.width && !item.height ? 0 : 1)
.onComplete(callback => {
item.width = callback?.width || 0;
item.height = callback?.height || 0;
})
}
}
} else if (this.contentDetailData.photoList.length === 4) {
GridCol({
span: { xs: 4 }
}) {
Image(item.picPath)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
}
} else {
GridCol({
span: { sm: 4, lg: 3 }
}) {
Image(item.picPath)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
}
}
})
}
.margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
}
}else{
if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){
GridRow() {
if (this.contentDetailData.videoInfo[0].videoLandScape === 1) {
// 横屏
GridCol({
span: { xs: 12 }
}) {
Stack() {
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)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
.align(Alignment.BottomEnd)
}
} else {
// 竖图显示,宽度占50%,高度自适应
GridCol({
span: { xs: 6 }
}) {
Stack() {
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)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
.align(Alignment.BottomEnd)
}
}
}
.margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.mJumpInfo)
})
}
}
//特别声明
Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
.fontColor($r('app.color.color_CCCCCC'))
.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') })
//微信/朋友圈/微博
Row(){
Image($r('app.media.xxhdpi_pic_wechat'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_pyq'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_wb'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
}
.margin({ top: $r('app.float.margin_24')})
//点赞
Row(){
Image($r('app.media.icon_like_selected_redheart'))
.width($r('app.float.margin_24'))
.height($r('app.float.margin_24'))
.objectFit(ImageFit.Cover)
Text("2.6万")
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_16'))
.lineHeight($r('app.float.margin_20'))
.margin({ left: $r('app.float.margin_2')})
}
.margin({top:$r('app.float.margin_16')})
Blank().layoutWeight(1)
//fixme 评论组件
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.alignSelf(ItemAlign.Start)
//底部交互区
Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
})
Row() {
Image($r('app.media.icon_comment'))
.width(24)
.height(24)
.margin({ right: 24 })
.id('comment')
Image($r('app.media.icon_star'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_forward'))
.width(24)
.height(24)
}
}else{
//附件内容:视频,只有一个
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
}
})
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
}
//特别声明
Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
.fontColor($r('app.color.color_CCCCCC'))
.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') })
//微信/朋友圈/微博
Row(){
Image($r('app.media.xxhdpi_pic_wechat'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_pyq'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_wb'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
}
.margin({ top: $r('app.float.margin_24')})
//点赞
Row(){
Image($r('app.media.icon_like_selected_redheart'))
.width($r('app.float.margin_24'))
.height($r('app.float.margin_24'))
.objectFit(ImageFit.Cover)
Text("2.6万")
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_16'))
.lineHeight($r('app.float.margin_20'))
.margin({ left: $r('app.float.margin_2')})
}
//评论组件/底部组件
}
}
.backgroundColor('#FFFFFFFF')
.alignSelf(ItemAlign.Start)
.backgroundColor('#FFFFFFFF')
.width('100%')
.height('100%')
}
/**
* 请求(动态)详情页数据
... ... @@ -204,13 +387,13 @@ export struct DynamicDetailComponent {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data[0];
this.makeJumpInfo
console.log('动态详情',JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
this.getBatchAttentionStatus
this.getInteractDataStatus
this.getBatchAttentionStatus()
this.getInteractDataStatus()
this.makeJumpInfo()
}
// 查询当前登录用户点赞状态
... ... @@ -253,192 +436,61 @@ export struct DynamicDetailComponent {
}
}
@Builder
setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){
//四角圆角
Image(picPath)
.width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight})
}
/**
* 组件项
*
* @param programmeBean item 组件项, 上面icon,下面标题
*/
@Builder
buildItemCard(item: PhotoListBean,len: number,index: number) {
Column() {
this.setItemImageRoundCorner(len, item, index)
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
}
.width('100%')
.onClick((event: ClickEvent) => {
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
//fixme 跳转到查看图片页面(带页脚/下载按钮)
// this.mJumpInfo.objectType = ContentConstants.TYPE_
ProcessUtils.processPage(this.mJumpInfo)
}else{
//fixme 跳转到播放视频页面(点播)
this.mJumpInfo.objectType = ContentConstants.TYPE_VOD
ProcessUtils.processPage(this.mJumpInfo)
}
})
}
//创建跳转信息
makeJumpInfo(){
this.mJumpInfo.pageId = 'dynamicDetailPage';
// this.mJumpInfo.from = 'dynamicDetailPage';
this.mJumpInfo.objectId = this.contentDetailData.newsId+"";
this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+"";
this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+"";
this.mJumpInfo.pageId = 'dynamicDetailPage'
this.mJumpInfo.objectId = this.contentDetailData.newsId+""
this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+""
this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+""
this.mJumpInfo.objectType = (this.contentDetailData.newsType+"") == ContentConstants.TYPE_FOURTEEN?this.contentDetailData.newsType+"":ContentConstants.TYPE_VOD
if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){
this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0]
}
}
//设置图片圆角
@Builder
setItemImageRoundCorner(len: number, item: PhotoListBean, index: number) {
if (len == 1) {
//四角圆角
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
} else if (len == 2) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (3 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (4 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else if (index == 1) {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
} else if (index = 2) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (5 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else if (6 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else if (7 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 4, 4);
}
} else if (8 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
} else if (index = 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
caclImageRadius(index: number) {
let radius: radiusType = {
topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
topRight: 0,
bottomLeft: 0,
bottomRight: 0,
}
if (this.contentDetailData.photoList.length === 1) {
radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0
} else if (this.contentDetailData.photoList.length === 5 && !this.contentDetailData.photoList[2].fullUrl) {
radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 4 ? $r('app.float.image_border_radius') : 0
} else {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index == 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 5) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else if (index == 7) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0
}
return radius
}
getPicType(item: PhotoListBean){
if (item.width && item.width) {
if (item.width / item.height > 343/172) {
return 1; //横长图
} else if (item.height / item.width > 305/228) {
return 2; //竖长图
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
return 3
}
} else {
return 3; //普通图
}
}
}
interface radiusType {
topLeft: number | Resource;
topRight: number | Resource;
bottomLeft: number | Resource;
bottomRight: number | Resource;
}
\ No newline at end of file
... ...
import { PhotoListBean } from 'wdBean';
import { Logger } from 'wdKit';
import router from '@ohos.router';
import display from '@ohos.display';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -11,14 +9,10 @@ export struct MultiPictureDetailItemComponent {
//alt app.media.picture_loading 设计稿尺寸
@State imageWidth:string | number = 167
@State ratio:number = 167/60
private scroller: Scroller = new Scroller()
private displayTool = display.getDefaultDisplaySync()
@State picHeight: number = 0
async aboutToAppear() {
Logger.info(TAG, 'pictures preview')
this.picHeight = this.displayTool.width * 578 / 375
// Logger.info(TAG, 'pictures preview')
}
build() {
... ... @@ -33,16 +27,6 @@ export struct MultiPictureDetailItemComponent {
this.imageWidth = '100%'
this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height
})
/*.onDrop(event => {
router.back();
})
.draggable(true)*/
/*Scroll(this.scroller) {
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.height(px2vp(this.picHeight))*/
}
.height('100%')
.width('100%')
... ...
import { Logger, SPHelper } from 'wdKit';
import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -18,6 +18,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../repository/PageRepository';
import { SpConstants } from 'wdConstant/Index';
import { router } from '@kit.ArkUI';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -34,6 +35,7 @@ export struct MultiPictureDetailPageComponent {
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private swiperController: SwiperController = new SwiperController()
private swiperControllerItem: SwiperController = new SwiperController()
@State swiperIndex: number = 0;
@Provide followStatus: string = '0' // 关注状态
private scroller: Scroller = new Scroller()
... ... @@ -59,7 +61,15 @@ export struct MultiPictureDetailPageComponent {
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
})
this.getContentDetailData()
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
// 有网络
this.getContentDetailData()
} else {
// 无网络
this.netStatus = 1
}
}
aboutToDisappear() {
... ... @@ -71,7 +81,19 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
Swiper(this.swiperControllerItem) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
}
.width('100%')
.height('100%')
.vertical(true)
.autoPlay(false)
.cachedCount(1)
.indicator(false)
.displayCount(1)
.onAnimationEnd(event => {
router.back()
})
})
}
.index(this.swiperIndex)
... ... @@ -82,6 +104,7 @@ export struct MultiPictureDetailPageComponent {
.cachedCount(3)
.indicator(false)
.displayCount(1)
.loop(false)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
... ... @@ -241,15 +264,18 @@ export struct MultiPictureDetailPageComponent {
})
.height(px2vp(this.titleHeight) + 64)
} else {
if(this.netStatus !== undefined) {
EmptyComponent({ emptyType: this.netStatus})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
}
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: this.netStatus, emptyButton: true, retry: () => {
this.getContentDetailData()
}
})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
OperRowListView({
contentDetailData: this.contentDetailData,
... ... @@ -278,44 +304,39 @@ export struct MultiPictureDetailPageComponent {
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
private getContentDetailData() {
getContentDetailData() {
try {
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
// Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`);
// Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`);
// Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`);
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.contentDetailData = resDTO.data?.[0];
if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
this.netStatus = 0
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
if (HttpUrlUtils.getUserId()) {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
}).catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
/*// 请求失败处理
if (err.response) {
// 请求已发出,但服务器响应的状态码不在2xx范围内
console.error('请求失败,状态码:', err.response.status);
console.error('响应数据:', err.response.data);
} else if (err.request) {
// 请求已发出,但无响应(例如:网络故障)
console.error('请求已发出,但无响应:', err.request);
} else {
// 发生了其他类型的错误(如配置错误或拒绝权限等)
console.error('请求发生错误:', err.message);
}*/
})
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType)
.then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
})
.catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
})
} catch (exception) {
}
... ...
import { CompInfoBean, CompDTO, CompList } from 'wdBean'
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
/**
* 播报--今日推荐列表
*/
... ...
import { CompInfoBean, CompDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit/Index'
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
/**
* 精选栏目
*/
... ...
... ... @@ -21,8 +21,10 @@ export struct CardMediaInfo {
Row() {
Image($r('app.media.card_play'))
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
if(this.contentDTO.videoInfo!=null){
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
}
}
} else if (this.contentDTO.objectType === '2') {
// liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
... ...
import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
... ...
... ... @@ -2,7 +2,7 @@
import { CommonConstants } from 'wdConstant'
import { ContentDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit'
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
const TAG = 'Card11Component';
... ...
... ... @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG = 'Card12Component';
... ...
... ... @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG = 'Card14Component';
... ...
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
... ...
... ... @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG = 'Card16Component';
... ...
... ... @@ -29,7 +29,8 @@ export struct Card17Component {
// 三个图,
GridRow({ gutter: 2 }) {
GridCol({ span: { xs: 8 } }) {
Image(this.contentDTO.fullColumnImgUrls[0].url)
Image(this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'')
.backgroundColor('#f5f5f5')
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius({
... ... @@ -39,7 +40,8 @@ export struct Card17Component {
}
GridCol({ span: { xs: 4 } }) {
Image(this.contentDTO.fullColumnImgUrls[1].url)
Image(this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'')
.backgroundColor('#f5f5f5')
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.margin({ bottom: 1 })
... ... @@ -54,7 +56,8 @@ export struct Card17Component {
}
GridCol({ span: { xs: 4 } }) {
Image(this.contentDTO.fullColumnImgUrls[2].url)
Image(this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'')
.backgroundColor('#f5f5f5')
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.margin({ top: 1 })
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card19Component';
... ... @@ -92,8 +92,17 @@ export struct Card19Component {
}
// 图片-从无图到9图展示
createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
.onClick(() => {
const photoList: PhotoListBean[] = this.contentDTO.fullColumnImgUrls.map(item => {
const photo: PhotoListBean = {
width: item.weight,
height: item.height,
picPath: item.fullUrl,
picDesc: ''
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
... ... @@ -103,6 +112,9 @@ export struct Card19Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
... ...
... ... @@ -2,7 +2,7 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG = 'Card20Component';
/**
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
... ...
//全标题 "appStyle":"2",
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
const TAG: string = 'Card2Component';
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
/**
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
const TAG: string = 'Card4Component';
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG: string = 'Card5Component';
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
const TAG: string = 'Card6Component-Card13Component';
... ...
import { ContentDTO, slideShows } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
/**
* 时间链卡--CompStyle: 09
... ...
... ... @@ -2,7 +2,7 @@ import { CompDTO, ContentDTO, } from 'wdBean';
import { BreakpointConstants, CommonConstants, DurationEnum } from 'wdConstant';
import { BreakPointType, Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { EmptyComponent } from '../view/EmptyComponent';
const TAG = 'Zh_Carousel_Layout-01';
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
const TAG = 'Zh_Grid_Layout-02';
... ...
... ... @@ -2,7 +2,7 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG = 'Zh_Grid_Layout-03';
const FULL_PARENT: string = '100%';
... ... @@ -36,6 +36,12 @@ export struct ZhGridLayout03 {
}
})
}
.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')
})
}
/**
... ... @@ -49,7 +55,9 @@ export struct ZhGridLayout03 {
Image(item.coverUrl)
.width(44)
.aspectRatio(1 / 1)
.margin(16)
.margin({
bottom: 16
})
Text(item.newsTitle)
.fontSize(13)
.maxLines(1)
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG = 'Zh_Single_Column-04';
... ...
... ... @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
/**
* 小视频横划卡
... ... @@ -31,6 +31,7 @@ export struct ZhSingleRow02 {
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
}
.width(CommonConstants.FULL_WIDTH)
.height(208)
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
/**
* 本地精选卡
... ... @@ -40,6 +40,10 @@ export struct ZhSingleRow04 {
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf')
})
// 列表内容
List({ space: 12 }) {
... ... @@ -50,7 +54,9 @@ export struct ZhSingleRow04 {
operDataListItem: item
}
)
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0, left:
index === 0 ? $r('app.float.card_comp_pagePadding_lf') : 0,
top: 6})
.onClick(() => {
ProcessUtils.processPage(item)
})
... ... @@ -60,13 +66,9 @@ export struct ZhSingleRow04 {
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width(CommonConstants.FULL_PARENT)
.height(166)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
... ... @@ -124,7 +126,7 @@ struct localCard {
.border({
radius: 2,
})
.shadow({ radius: 5, color: '#1A000000', offsetX: 0, offsetY: 2 })
.shadow({ radius: 15, color: '#1A000000', offsetX: 2, offsetY: 2 })
.margin({
right: 10
})
... ...
import { CompDTO, ContentDTO, Params } from 'wdBean';
import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { DateTimeUtils } from 'wdKit/Index';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
/**
* 精选评论卡
... ... @@ -27,6 +27,7 @@ const TAG = 'Zh_Single_Row-06'
// operDataList: Array<operDataListItem>
// }
@Entry
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
... ... @@ -44,9 +45,12 @@ export struct ZhSingleRow06 {
.textOverflow({overflow: TextOverflow.Ellipsis})
.lineHeight(23)
.fontSize(16)
.margin({bottom: 19})
.margin({bottom: 10})
.padding({bottom: 10})
.textAlign(TextAlign.Start)
.width('100%')
.border({width: {bottom: 1}})
.borderColor(0xf4f4f4)
Row() {
... ... @@ -68,6 +72,9 @@ export struct ZhSingleRow06 {
.backgroundColor(0xf9f9f9)
.borderRadius(4)
.margin({bottom: 12})
.onClick(() => {
ProcessUtils.commentGotoWeb(this.compDTO.operDataList[0]?.commentInfo as commentInfo)
})
Row() {
Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime))
... ... @@ -95,11 +102,6 @@ export struct ZhSingleRow06 {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
.margin({ bottom: 8 })
.height(251)
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
})
}
@Builder
... ... @@ -128,6 +130,9 @@ export struct ZhSingleRow06 {
.width(14)
.height(14)
}
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
})
}
.margin({bottom: 10})
.justifyContent(FlexAlign.SpaceBetween)
... ...
import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel'
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import { Action, Params } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Params } from 'wdBean';
@Component
export default struct MinePageMoreFunctionUI {
... ... @@ -70,18 +69,12 @@ export default struct MinePageMoreFunctionUI {
}
.onClick(() => {
console.log(index + "")
if (index == 0) {
// WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
} else if (index == 1) {
// WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
} else if (index == 2) {
} else if (index == 3) { //设置
if (item.msg == "设置") { //设置
let params: Params = {
pageID: 'mainSetting'
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params)
}else if (index == 4) { // 关于
}else if (item.msg == "关于") { // 关于
WDRouterRule.jumpWithPage(WDRouterPage.aboutPage)
}
})
... ...
... ... @@ -83,9 +83,11 @@ export default struct MinePagePersonFunctionUI {
.height('117lpx')
})
}
.rowsTemplate('1fr 1fr')
// .rowsTemplate('1fr 1fr')
.rowsTemplate('1fr')
.columnsTemplate('1fr 1fr 1fr 1fr')
.height('234lpx')
// .height('234lpx')
.height('167lpx')
.margin({top:'31lpx',left:'23lpx',right:'23lpx' })
}
}
\ No newline at end of file
... ...
... ... @@ -119,6 +119,7 @@ export default struct MinePageUserSimpleInfoUI {
.width('50lpx')
.height('50lpx')
}.width('131lpx')
.visibility(Visibility.Hidden)
}.backgroundColor($r('app.color.white'))
.setFullWidth()
.padding({top:'31lpx',left:'46lpx'})
... ...
import { StringUtils, ToastUtils } from 'wdKit/Index'
import { DateTimeUtils, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
... ... @@ -133,14 +133,17 @@ export struct FollowChildComponent{
.maxLines(1)
.margin({bottom:'12lpx'})
Row(){
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
Image($r("app.media.point"))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
if(this.data.cnFansNum!="0"){
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
}
if(this.data.cnFansNum!="0" && StringUtils.isNotEmpty(this.data.introduction)){
Image($r("app.media.point"))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
}
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
... ... @@ -222,6 +225,12 @@ export struct FollowChildComponent{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
if(this.data.status === "1"){
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
}else{
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
}
}
}
})
... ...
import { LazyDataSource } from 'wdKit';
import { LazyDataSource, SPHelper, UserDataLocal } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
... ... @@ -9,50 +9,55 @@ import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetai
import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from './FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
const TAG = "FollowListDetailUI"
@Component
export struct FollowListDetailUI{
@State creatorDirectoryId:number = -1;
@State type:number = 0
export struct FollowListDetailUI {
@State creatorDirectoryId: number = -1;
@State type: number = 0
@State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State count:number = 0;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
aboutToAppear() {
this.getNewPageData()
this.addFollowStatusObserver()
}
build(){
Column(){
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
build() {
Column() {
if (this.count === 0) {
ListHasNoMoreDataUI({ style: 2 })
.height('100%')
}else{
} else {
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:this.type})
FollowChildComponent({ data: item, type: this.type })
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
}, (item: FollowListDetailItem) => item.creatorId)
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(10)
.padding({left:'31lpx',right:'31lpx'})
}
.cachedCount(10)
.padding({ left: '31lpx', right: '31lpx' })
.layoutWeight(1)
.scrollBar(BarState.Off)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
... ... @@ -63,79 +68,128 @@ export struct FollowListDetailUI{
.width('100%')
}
getNewPageData(){
this.isLoading = true
//我的关注列表
if (this.creatorDirectoryId === -1){
if(this.hasMore){
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
this.hasMore = false
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
if (this.creatorDirectoryId === -1) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
this.data.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
this.data.deleteItem(index)
}
});
}else{
value.list.forEach((value)=>{
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
if(!this.isLoading){
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
this.data.clear()
this.data.notifyDataReload()
this.getMyFollowListDetail()
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
})
}
}
}else{
if(this.hasMore){
let object = new FollowListDetailRequestItem(this.creatorDirectoryId,20,this.curPageNum)
}
this.preferences.on('change', observer);
}
getMyFollowListDetail() {
if (this.hasMore) {
let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum)
MinePageDatasModel.getFollowListDetailData(object,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
} else {
value.list.forEach((value) => {
let fansNum:number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
fansNumString = temp + "万"
} else {
fansNumString = fansNum + ""
}
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
})
}else {
this.isLoading = false
}
}
getNewPageData() {
//我的关注列表
if (this.creatorDirectoryId === -1) {
this.getMyFollowListDetail()
} else {
if (this.hasMore) {
let object = new FollowListDetailRequestItem(this.creatorDirectoryId, 20, this.curPageNum)
MinePageDatasModel.getFollowListDetailData(object, getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
}else{
} else {
this.getFollowListStatus(value)
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
})
}
}
}
getFollowListStatus(result:MineFollowListDetailItem){
let data_temp : FollowListDetailItem[] = []
result.list.forEach((item)=>{
data_temp.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.cnMainControl,-1))
getFollowListStatus(result: MineFollowListDetailItem) {
let data_temp: FollowListDetailItem[] = []
result.list.forEach((item) => {
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1))
})
let request = new CreatorDetailRequestItem()
data_temp.forEach((data)=>{
data_temp.forEach((data) => {
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => {
if (value != null && value.length > 0) {
data_temp.forEach((data) => {
value.forEach((item) => {
if (data.creatorId == item.creatorId) {
data.headPhotoUrl = item.headPhotoUrl
if(item.fansNum>10000){
let temp = (item.fansNum/10000)+""
if (item.fansNum > 10000) {
let temp = (item.fansNum / 10000) + ""
let index = temp.indexOf('.')
if(index != -1){
temp = temp.substring(0,index+2)
}else{
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
data.cnFansNum = temp + "万"
}else{
} else {
data.cnFansNum = item.fansNum + ""
}
data.introduction = item.introduction
... ... @@ -144,32 +198,32 @@ export struct FollowListDetailUI{
}
})
})
this.getFollowStatus(data_temp,result.totalCount)
this.getFollowStatus(data_temp, result.totalCount)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
this.count = this.count === -1 ? 0 : this.count
})
}
getFollowStatus(result : FollowListDetailItem[],totalCount:number){
getFollowStatus(result: FollowListDetailItem[], totalCount: number) {
let status = new FollowListStatusRequestItem()
result.forEach((item)=>{
result.forEach((item) => {
status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
})
MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
result.forEach((list)=>{
MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
result.forEach((list) => {
if (item.creatorId == list.creatorId) {
list.status = item.status
}
})
})
result.forEach((item)=>{
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl))
result.forEach((item) => {
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl))
})
this.data.notifyDataReload()
... ... @@ -177,15 +231,14 @@ export struct FollowListDetailUI{
this.count = this.data.totalCount()
if (this.data.totalCount() < totalCount) {
this.curPageNum++
}else {
} else {
this.hasMore = false
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
})
}
}
\ No newline at end of file
... ...
import { Params } from 'wdBean';
import { DateTimeUtils, LazyDataSource,UserDataLocal } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { ContentDTO, Params } from 'wdBean';
import { DateTimeUtils, LazyDataSource, SPHelper,UserDataLocal } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
const TAG = "HomePageBottomComponent"
@Component
... ... @@ -21,9 +22,38 @@ export struct HomePageBottomComponent{
@State isMineAccount:boolean = true;
@State userId:string = "";
@Link commentNum:number
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
this.getNewPageData()
this.addFollowStatusObserver()
}
async addFollowStatusObserver() {
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
this.data_follow.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
this.data_follow.deleteItem(index)
}
});
}else{
if(!this.isLoading){
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
this.data_follow.clear()
this.data_follow.notifyDataReload()
this.getMyFollowListDetail()
}
}
}
}
this.preferences.on('change', observer);
}
build(){
... ... @@ -175,34 +205,55 @@ export struct HomePageBottomComponent{
.borderRadius(12)
}
getMyFollowListDetail(){
if(this.hasMore){
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data_follow || value.list.length == 0){
this.hasMore = false
}else{
value.list.forEach((value)=>{
let fansNum:number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
fansNumString = temp + "万"
} else {
fansNumString = fansNum + ""
}
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,fansNumString,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
if (this.data_follow.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
})
}else{
this.isLoading = false
}
}
getNewPageData(){
this.isLoading = true
//我的关注列表
if (this.style === 1){
if(this.hasMore){
let object = new FollowListDetailRequestItem(-1,20,this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data_follow || value.list.length == 0){
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
if (this.data_follow.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
})
}
this.getMyFollowListDetail()
}else if(this.style === 0){
if(this.hasMore){
let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
... ... @@ -214,7 +265,7 @@ export struct HomePageBottomComponent{
}else{
value.list.forEach((value)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType))
this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType,value.targetRelId,value.targetRelObjectId,value.targetRelType,value.targetStatus))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
... ... @@ -230,6 +281,8 @@ export struct HomePageBottomComponent{
console.log(TAG,"请求失败")
this.isLoading = false
})
}else{
this.isLoading = false
}
}
}
... ... @@ -312,6 +365,14 @@ struct ChildCommentComponent {
.width('662lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
.onClick(()=>{
ProcessUtils.processPage(
{objectId: this.data.targetId,
relType:this.data.targetRelType+"",
relId:this.data.targetRelId,
objectType:this.data.targetType+"",
} as ContentDTO )
})
if(!this.isLastItem){
Divider().width('100%')
... ...
... ... @@ -6,6 +6,8 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem';
import { ProcessUtils } from 'wdRouter/Index';
import { ContentDTO } from 'wdBean/Index';
const TAG = "HomePageBottomComponent"
@Component
... ... @@ -107,7 +109,7 @@ export struct OtherHomePageBottomCommentComponent{
let data : CommentListItem[] = []
value.list.forEach((item)=>{
status.commentIdList.push(item.id)
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType))
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus))
})
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
... ... @@ -120,7 +122,7 @@ export struct OtherHomePageBottomCommentComponent{
})
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))
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))
})
this.data_comment.notifyDataReload()
... ... @@ -237,6 +239,14 @@ struct ChildCommentComponent {
.width('662lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
.onClick(()=>{
ProcessUtils.processPage(
{objectId: this.data.targetId,
relType:this.data.targetRelType+"",
relId:this.data.targetRelId,
objectType:this.data.targetType+"",
} as ContentDTO )
})
if(!this.isLastItem){
Divider().width('100%')
... ...
... ... @@ -67,10 +67,10 @@ export struct BottomNavigationComponent {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: this.currentNavIndex,
changeBarBackgroundColor: (color: Color) => {
this.barBackgroundColor = color
}
_currentNavIndex: $currentNavIndex,
currentBottomNavName: navItem.name,
barBackgroundColor: $barBackgroundColor
})
}
... ... @@ -80,6 +80,7 @@ export struct BottomNavigationComponent {
});
}
.animationDuration(0)
.barHeight($r('app.float.bottom_navigation_barHeight'))
.barMode(BarMode.Fixed)
// TODO:更详细的判断是视频频道
... ... @@ -90,7 +91,9 @@ export struct BottomNavigationComponent {
// this.onBottomNavigationIndexChange()
})
.backgroundColor(this.barBackgroundColor)
.padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
// .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致
}
... ...
... ... @@ -3,7 +3,7 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import { Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
const TAG: string = 'CardView';
... ...
... ... @@ -298,47 +298,55 @@ struct ChannelDialog {
.zIndex(this.dragItem == item.num ? 1 : 0)
.translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
.gesture(
GestureGroup(GestureMode.Parallel,
TapGesture()
.onAction((event?: GestureEvent) => {
if (this.isEditIng) {
if (item.delPermitted === 1) {
this.delChannelItem(index)
}
} else {
this.confirm(index)
this.controller?.close()
GestureGroup(GestureMode.Parallel,
TapGesture()
.onAction((event?: GestureEvent) => {
if (this.isEditIng) {
if (item.delPermitted === 1) {
this.delChannelItem(index)
}
}),
PanGesture({ fingers: 1, direction: null, distance: 0 })
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
} else {
this.confirm(index)
this.controller?.close()
}
}),
LongPressGesture({ repeat: true })
.onAction((event: GestureEvent | undefined) => {
if (event) {
if (event.repeat && this.isEditIng === false) {
this.isEditIng = true;
}
}
}),
PanGesture({ fingers: 1, direction: null, distance: 0 })
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
.onActionUpdate((event: GestureEvent) => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.handleAnimationTo(item, event)
})
})
.onActionEnd((event: GestureEvent) => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
this.offsetX = 0
this.offsetY = 0
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
.onActionUpdate((event: GestureEvent) => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.handleAnimationTo(item, event)
})
})
.onActionEnd((event: GestureEvent) => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
this.offsetX = 0
this.offsetY = 0
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
})
).onCancel(() => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
this.offsetX = 0
this.offsetY = 0
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
).onCancel(() => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
this.offsetX = 0
this.offsetY = 0
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
})
)
}, (item: TopNavDTO) => JSON.stringify(item))
}
... ...
... ... @@ -156,22 +156,23 @@ struct EditUserInfoPage {
if (userName) {
if (userName != this.currentUserInfo.userName) {
this.currentUserInfo.userName = userName;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
this.updateEditModel()
// this.currentUserInfo.userName = userName;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
// this.updateEditModel()
this.getAccountOwnerInfo()
}
} else if (introduction){
if (introduction != this.currentUserInfo.userExtend.introduction ) {
this.currentUserInfo.userExtend.introduction = introduction;
this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
this.updateEditModel()
// this.currentUserInfo.userExtend.introduction = introduction;
// this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
// this.updateEditModel()
this.getAccountOwnerInfo()
}
}
}
}
updateEditModel(){
this.listData = []
// this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{
this.getAccountOwnerInfo()
... ... @@ -179,6 +180,7 @@ struct EditUserInfoPage {
}
getAccountOwnerInfo(){
EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => {
this.listData = []
this.headerImg = editModel.userExtend.headPhotoUrl
this.currentUserInfo = editModel as editModel;
this.listData.push(...EditInfoViewModel.getEditListInfo(editModel))
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
import { editModelParams } from '../../model/EditInfoModel'
import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel'
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
@Entry
@Component
struct EditUserIntroductionPage {
... ... @@ -51,6 +51,7 @@ struct EditUserIntroductionPage {
.borderRadius(5)
.margin(30)
.onClick(()=>{
this.updateEditModel()
let params: editModelParams = {
introduction: this.introduction
}
... ... @@ -61,4 +62,12 @@ struct EditUserIntroductionPage {
})
}
}
updateEditModel(){
let currentUserInfo:editModel = new editModel()
currentUserInfo.userExtend.introduction = this.introduction
currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro
EditInfoViewModel.updateUserInfo(currentUserInfo)
}
}
\ No newline at end of file
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
import { editModelParams } from '../../model/EditInfoModel'
import { editModel, editModelParams, WDEditDataModelType } from '../../model/EditInfoModel'
import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
// import { encryptMessage } from '../../../utils/cryptoUtil'
import { encryptMessage } from 'wdLogin/src/main/ets/utils/cryptoUtil'
@Entry
@Component
struct EditUserNikeNamePage {
... ... @@ -51,14 +53,24 @@ struct EditUserNikeNamePage {
.borderRadius(5)
.margin(30)
.onClick(()=>{
let params: editModelParams = {
userName: this.nikeName
}
router.back({
url:'',
params:params
})
///内部更新
this.updateEditModel()
})
}
}
async updateEditModel(){
let currentUserInfo:editModel = new editModel()
currentUserInfo.userName = await encryptMessage(this.nikeName);
currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname
EditInfoViewModel.updateUserInfo(currentUserInfo).then(()=>{
let params: editModelParams = {
userName: this.nikeName
}
router.back({
url:'',
params:params
})
})
}
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
import RefreshLayout from '../page/RefreshLayout';
... ...
... ... @@ -14,6 +14,7 @@ import { CompParser } from '../CompParser';
import { CompDTO } from 'wdBean';
import PageHelper from '../../viewmodel/PageHelper';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { ProcessUtils } from 'wdRouter/Index';
const TAG = 'PageComponent';
... ... @@ -52,48 +53,56 @@ export struct PageComponent {
@Builder
ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
RelativeContainer() {
List() {
// 下拉刷新
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
},
(compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
)
// 加载更多
ListItem() {
if (this.pageModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
} else if (!this.pageModel.contentNeedScroll) {
NoMoreLayout()
}
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
},
(compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
)
// 加载更多
ListItem() {
if (this.pageModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
})
} else if (!this.pageModel.contentNeedScroll) {
NoMoreLayout()
}
}
}
// comp自己处理分页,这里设置EdgeEffect.None
.edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring)
.scrollBar(BarState.Off)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
.onScrollIndex((start: number, end: number) => {
// Listen to the first index of the current list.
this.pageModel.startIndex = start;
// 包含了 头尾item,判断时需要考虑+2
this.pageModel.endIndex = end;
})
.id('page_list')
// 挂角广告
this.pageHornAd()
}
// comp自己处理分页,这里设置EdgeEffect.None
.edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring)
.scrollBar(BarState.Off)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
.onScrollIndex((start: number, end: number) => {
// Listen to the first index of the current list.
this.pageModel.startIndex = start;
// 包含了 头尾item,判断时需要考虑+2
this.pageModel.endIndex = end;
})
}
@Builder
... ... @@ -105,6 +114,100 @@ export struct PageComponent {
// })
}
/**
* 页面挂角广告
*/
@Builder
pageHornAd() {
if (this.pageModel.isShowAds) {
if (this.pageModel.pageCornerAdv.matInfo != null) {
// 页面右边挂角
this.drawPageCornerAdvView(1, 1 == this.pageModel.isRightAdv)
} else if (this.pageModel.pageCornerContentInfo.advert != null) {
this.drawPageCornerAdvView(2, 1 == this.pageModel.isRightAdv)
}
}
}
/**
* 绘制页面挂角
*
* @param type 1:广告中心的挂角广告;2:展现中心的挂角广告
* @param isRightCorne true:右挂角;false:左挂角
*/
@Builder
drawPageCornerAdvView(type: number, isRightCorne: boolean) {
// 页面左挂角
Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]
: this.pageModel.pageCornerContentInfo.advert.displayUrl)
.width($r('app.float.vp_80'))
.height($r('app.float.vp_80'))
.id("left_iv")
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
left: { anchor: isRightCorne ? "" : '__container__', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? '__container__' : "", align: HorizontalAlign.End },
})
.margin({
bottom: "65vp",
left: isRightCorne ? 0 : $r('app.float.card_comp_pagePadding_lf'),
right: isRightCorne ? $r('app.float.card_comp_pagePadding_lf') : 0,
})
.onClick(() => {
if (type === 1) {
// 广告业务跳转
ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);
} else {
// 展现中心的业务跳转
ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert)
}
})
// 关闭按钮
Image($r('app.media.icon_adv_horn_close'))
.id('left_close')
.width($r('app.float.vp_16'))
.alignRules({
top: { anchor: 'left_iv', align: VerticalAlign.Top },
left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
})
.offset({
x: isRightCorne ? 10 : -10,
y: isRightCorne ? -10 : -10
})
.onClick(() => {
// 关闭挂角广告
this.pageModel.isShowAds = false;
})
if (type == 1) {
Text($r('app.string.comp_advertisement'))
.width($r('app.float.vp_28'))
.height($r('app.float.vp_16'))
.fontSize($r('app.float.font_size_10'))
.fontColor(Color.White)
.id('left_tag')
.alignRules({
bottom: { anchor: 'left_iv', align: VerticalAlign.Bottom },
left: { anchor: isRightCorne ? '' : 'left_iv', align: HorizontalAlign.Start },
right: { anchor: isRightCorne ? 'left_iv' : '', align: HorizontalAlign.End },
})
.textAlign(TextAlign.Center)
.backgroundColor($r('app.color.res_color_general_000000_30'))
.borderRadius({
topLeft: $r('app.float.vp_2'),
topRight: $r('app.float.vp_2'),
bottomLeft: $r('app.float.vp_2'),
bottomRight: $r('app.float.vp_2')
})
}
}
async aboutToAppear() {
// 选中tab,才请求数据。拦截大量接口请求
if (this.navIndex === this.currentTopNavSelectedIndex) {
... ... @@ -125,14 +228,15 @@ export struct PageComponent {
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);
if (pageInfo == null) {
this.pageModel.viewType = ViewType.EMPTY;
return;
}
this.pageModel.pageInfo = pageInfo;
this.pageModel.loadStrategy = 1
PageHelper.parseGroup(this.pageModel)
PageHelper.getInitData(this.pageModel)
// let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);
// if (pageInfo == null) {
// this.pageModel.viewType = ViewType.EMPTY;
// return;
// }
// this.pageModel.pageInfo = pageInfo;
// this.pageModel.loadStrategy = 1
// PageHelper.parseGroup(this.pageModel)
}
}
... ...
... ... @@ -95,7 +95,7 @@ export struct PrivacySettingPage {
.margin({ top: '46lpx' })
.onClick(() => {
//跳转隐私政策
let bean={contentId:"2",pageID:""} as Params
let bean={contentID:"2",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
})
Text(this.tipsEnd)
... ...
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
import { ContentDTO, ReserveBean } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
import RefreshLayout from '../page/RefreshLayout';
... ... @@ -7,6 +7,7 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean';
import PageModel from '../../viewmodel/PageModel';
import { LazyDataSource } from 'wdKit/Index';
import { router } from '@kit.ArkUI';
import { LiveModel } from '../../viewmodel/LiveModel';
const TAG: string = 'ReserveMorePage';
... ... @@ -23,12 +24,15 @@ const TAG: string = 'ReserveMorePage';
struct ReserveMorePage {
@State private pageModel: PageModel = new PageModel();
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
reserveBean: ReserveBean[] = []
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
type: number = 2;
currentPage: number = 1;
pageSize: number = 20;
operDataList: ContentDTO[] = [];
title: string = '预约列表'
//是否预约过直播
@State isAppointmentLive: boolean = false
@State contentDTO: ContentDTO = {
// appStyle: '15',
// coverType: 1,
... ... @@ -69,12 +73,32 @@ struct ReserveMorePage {
// }
} as ContentDTO;
aboutToAppear(): void {
PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => {
async aboutToAppear(): Promise<void> {
// PageViewModel.get
PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
// this.operDataList = []
// this.operDataList.push(...liveReviewDTO.list)
this.data.push(...liveReviewDTO.list)
this.reserveBean = this.transformToLiveDetailsBeans(liveReviewDTO.list)
const apointMentStatus = await LiveModel.getAppointmentStatus(this.reserveBean)
console.info(`cj2024 ${apointMentStatus.code}`)
})
}
// 这个函数遍历liveReviewDTO.list并转换为LiveDetailsBean数组
transformToLiveDetailsBeans(list: ContentDTO[]): ReserveBean[] {
const liveDetailsBeans: ReserveBean[] = [];
list.forEach(item => {
liveDetailsBeans.push({
relationId: item.relId,
liveId: item.objectId,
});
});
return liveDetailsBeans
}
build() {
... ... @@ -86,9 +110,8 @@ struct ReserveMorePage {
// .title('直播列表')
Column() {
this.TabbarNormal()
Column() {
this.TabbarNormal()
this.ListLayout()
}
.padding({
... ... @@ -200,7 +223,7 @@ struct ReserveMorePage {
.margin(12)
Flex({ justifyContent: FlexAlign.Center }) {
Text('预约')
Text(this.isAppointmentLive ? '已预约' : '预约')
.fontSize(12)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
... ... @@ -208,6 +231,9 @@ struct ReserveMorePage {
.height(24)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
.onClick(() => {
this.liveAppointment(item)
})
}
.width(52)
.backgroundColor('#ED2800')
... ... @@ -255,6 +281,23 @@ struct ReserveMorePage {
}
}
async liveAppointment(item: ContentDTO) {
// this.liveViewModel.liveAppointment(
// this.liveDetailsBean.reLInfo ? this.liveDetailsBean.reLInfo.relId : '',
// this.liveDetailsBean.newsId,
// !this.isAppointmentLive).then(
// (data) => {
// if (data.success) {
// this.isAppointmentLive = !this.isAppointmentLive
// }
// },
// () => {
//
// })
const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false)
// const liveDetail = await LiveModel.getAppointmentStatus(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false)
}
/*导航栏*/
@Builder
TabbarNormal() {
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants ,ViewType} from 'wdConstant';
import PageViewModel from '../../viewmodel/PageViewModel';
import RefreshLayout from '../page/RefreshLayout';
import { RefreshLayoutBean } from '../page/RefreshLayoutBean';
import PageModel from '../../viewmodel/PageModel';
import { DateTimeUtils, LazyDataSource } from 'wdKit/Index';
import router from '@ohos.router';
import { CardParser } from '../CardParser';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { ErrorComponent } from '../view/ErrorComponent';
import { EmptyComponent } from '../view/EmptyComponent';
const TAG: string = 'ThemeListPage';
@Entry
@Component
struct ThemeListPage {
@State private pageModel: PageModel = new PageModel();
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
sort: number = 1;
currentPage: number = 1;
pageSize: number = 20;
title: string = '金刚位聚合页'
aboutToAppear(): void {
PageViewModel.postThemeList(this.sort, this.currentPage, this.pageSize).then((liveReviewDTO) => {
console.log(`postThemeList${JSON.stringify(liveReviewDTO)}`)
this.data.push(...liveReviewDTO.list)
if(this.data.getDataArray().length > 0){
this.pageModel.viewType = ViewType.LOADED;
}else{
this.pageModel.viewType = ViewType.EMPTY
}
})
}
build() {
Column() {
this.TabbarNormal()
if (this.pageModel.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.pageModel.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.pageModel.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
this.ListLayout()
}
}
.padding({
bottom: $r('app.float.card_comp_pagePadding_tb')
})
}
@Builder
LoadingLayout() {
channelSkeleton()
}
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
router.back()
})
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
.height(44)
.width('100%')
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
})
}
@Builder
ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => {
ListItem() {
Column() {
CardParser({ contentDTO });
}
}
},
(contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString()
)
}
.scrollBar(BarState.Off)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
.onScrollIndex((start: number, end: number) => {
this.pageModel.startIndex = start;
this.pageModel.endIndex = end;
})
}
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@ import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
const TAG = 'TopNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 0);
PersistentStorage.persistProp('indexSettingChannelId', 2002);
const storage = LocalStorage.getShared();
... ... @@ -22,22 +22,21 @@ const storage = LocalStorage.getShared();
@Component
export struct TopNavigationComponent {
private groupId: number = 0
private currentBottomNavName: string = ''
private tabsController: TabsController = new TabsController()
private changeBarBackgroundColor: (color: Color) => void = () => {
}
@Consume isLayoutFullScreen: boolean
@Consume bottomRectHeight: number
@Consume topRectHeight: number
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State barBackgroundColor: Color = Color.Transparent
@Prop @Watch('indexChange') _currentNavIndex?: number;
@Link barBackgroundColor: Color
@Link _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State @Watch('indexChange') currentTopNavSelectedIndex: number = 0;
@State currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
@StorageProp('indexSettingChannelId') indexSettingChannelId: number = 0
@StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
... ... @@ -107,7 +106,7 @@ export struct TopNavigationComponent {
}
//频道分类
if (item.myChannel === '1') {
if (item.myChannel === '1' && item.name !== '播报') {
_myChannelList.push(item)
_channelIds.push(item.channelId)
} else if (item.moreChannel === '1') {
... ... @@ -122,13 +121,9 @@ export struct TopNavigationComponent {
this.myChannelList = _myChannelList
//缓存首页频道
if (!this.indexSettingChannelId) {
AppStorage.set('indexSettingChannelId', this.homeChannelList[0].channelId)
} else {
let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
if (index > -1) {
this.currentTopNavSelectedIndex = index
}
let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
if (index > -1) {
this.currentTopNavSelectedIndex = index
}
}
... ... @@ -150,29 +145,6 @@ export struct TopNavigationComponent {
WDRouterRule.jumpWithAction(taskAction)
}
indexChange() {
// 判断视频频道待处理
if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) {
this.barBackgroundColor = Color.Black
this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
WindowModel.shared.setWindowLayoutFullScreen(true)
this.isLayoutFullScreen = true
this.bottomRectHeight = this.bottomSafeHeight
this.topRectHeight = this.topSafeHeight
} else {
this.barBackgroundColor = Color.Transparent
this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
WindowModel.shared.setWindowLayoutFullScreen(false)
this.isLayoutFullScreen = false
this.bottomRectHeight = 0
this.topRectHeight = 0
}
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -225,15 +197,16 @@ export struct TopNavigationComponent {
// 频道分类list
Stack({ alignContent: Alignment.TopEnd }) {
Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
TabContent() {
if (this._currentNavIndex === 2 && navItem.name === '视频') {
if (this.currentBottomNavName === '视频' && navItem.name === '视频') {
VideoChannelDetail({
bottomNavIndex: this._currentNavIndex,
topNavIndex: this.currentTopNavSelectedIndex,
bottomNavIndex: $_currentNavIndex,
topNavIndex: $currentTopNavSelectedIndex,
groupId: this.groupId + '',
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
barBackgroundColor: $barBackgroundColor
})
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
... ... @@ -322,12 +295,13 @@ export struct TopNavigationComponent {
.fontColor(this.getFontColor(item, index))
.padding({ top: $r('app.float.top_tab_item_padding_top') })
.maxLines(this.MAX_LINE)
Divider()
.width(16)
.strokeWidth(2)// 分割线粗细度。
.padding({ top: 2 })
.color(Color.Red)
.opacity(this.currentTopNavSelectedIndex === index ? 1 : 0)
if (this.currentTopNavSelectedIndex === index) {
Row()
.width(20)
.height(3)
.backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)
}
}
.hoverEffect(HoverEffect.Highlight)
.constraintSize({
... ...
... ... @@ -151,7 +151,7 @@ export struct PeopleShipHomeArticleListComponent {
try {
this.isLoading = true
let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type)
Logger.debug(TAG, `获取页面信息, ${listData.list.length}`);
Logger.debug(TAG, `获取页面信息, ${JSON.stringify(listData.list)}`);
Logger.debug(TAG, `已更新值最新, ${this.currentPage}`);
if (resolve ) {
... ... @@ -173,7 +173,7 @@ export struct PeopleShipHomeArticleListComponent {
}
this.isLoading = false
this.queryArticleContentInteractCount(listData)
Logger.debug(TAG, '展示的总数', `${this.arr.length}`)
Logger.debug(TAG, '展示的总数'+`${this.arr.length}`)
}catch (exception) {
if (resolve) {
resolve('')
... ... @@ -236,7 +236,8 @@ export struct PeopleShipHomeArticleListComponent {
// 19.动态图文卡-人民号,20.动态视频卡-人民号,
// 21 小视频卡-人民号
contentDTO.objectType = `${element.type}`;
// 时间显示
contentDTO.isSearch = true
// contentDTO.productNum = element.productCount;
// if (master) {
// contentDTO.customWorkStatus = element.workStatus;
... ... @@ -277,8 +278,10 @@ export struct PeopleShipHomeArticleListComponent {
//图集数量
contentDTO.photoNum = element.mainPicCount;
if (element.mainPicCount) {
contentDTO.photoNum = element.mainPicCount;
}
Logger.debug(TAG, '图集数量:' + `${element.mainPicCount}`)
if (element.contentExt && element.contentExt.length > 0) {
let extModel = element.contentExt[0];
contentDTO.openLikes = extModel.openLikes;
... ...