wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool: (115 commits)
  fix: 时间轴按钮颜色
  feat(动态):微调
  列表缺省页修复
  desc:fix bug(关注)
  屏蔽活动、音频
  fix
  fix:解决 切换至版面返回时 页面空白问题
  feat(动态):动态详情微调
  desc:历史搜索 关联用户
  fix:16656 人民号主页中的“+关注”与“已显示全部内容””的样式鸿蒙与安卓不一致
  fix: 16669desc:16669 人民号--关注鸿蒙版多出一个关注按钮少一个搜索入口
  解决音频、活动组件屏蔽后又被互动数据更新重新插入列表问题
  feat(卡片):隐藏人民账号横滑卡
  desc:修复搜索相关bug
  feat(动态):评论model重新创建
  增加合并游客评论弹框
  desc:评论相关 保存游客首次评论
  desc:评论相关 保存游客首次评论
  desc:评论相关 保存游客首次评论
  fix:H5详情页增加无网缺省图
  ...
Showing 85 changed files with 1893 additions and 1075 deletions

Too many changes to show.

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

... ... @@ -2,7 +2,7 @@
"app": {
"bundleName": "com.peopledailychina.hosactivity",
"vendor": "$string:app_vendor",
"versionCode": 1000000,
"versionCode": 10000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
... ...
... ... @@ -244,6 +244,30 @@
]
}
]
},
{
"name": "wdShareBase",
"srcPath": "./commons/wdShareBase",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdShare",
"srcPath": "./features/wdShare",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
... ...
... ... @@ -34,6 +34,8 @@ export class SpConstants{
//定位相关
static LOCATION_CITY_NAME = "location_city_name" //定位
static LOCATION_CITY_CODE = "location_city_code" //定位
static LOCATION_PROVINCE_CODE = "location_province_code" //定位,省份code
static LOCATION_DISTRICT_CODE = "location_district_code" //定位,区县,返回9位,如:合肥-瑶海区-310115114
static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位
//启动页数据存储key
... ... @@ -42,4 +44,7 @@ export class SpConstants{
//频道信息流页面左右挂角
static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
}
\ No newline at end of file
... ...
... ... @@ -67,15 +67,15 @@ export const enum CompStyle {
Card_Adv_4 = 4, //4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告
Card_Adv_5 = 5,
Card_Adv_6 = 5,
Card_Adv_7 = 7,
Card_Adv_8 = 8,
Card_Adv_9 = 9,
Card_Adv_10 = 10,
Card_Adv_11 = 11,
Card_Adv_12 = 12,
Card_Adv_4 = 4, //4:轮播图
Card_Adv_5 = 5, // 5:三图广告
Card_Adv_6 = 6, // 6:小图广告
Card_Adv_7 = 7, // 7:长通栏广告
Card_Adv_8 = 8, // 8:大图广告
Card_Adv_9 = 9, // 9:视频广告
Card_Adv_10 = 10, // 10:展会广告
Card_Adv_11 = 11, // 11:冠名广告
Card_Adv_12 = 12, // 12:顶部长通栏广告
/**
* 本地稿件和组件样式
... ...
import { Action } from './Action';
interface IImgItem {
pic: string
width: number
height: number
}
export interface IImgListData {
imgIndex: number
imgArr: IImgItem[]
}
interface dataObject {
// dataSource:
// 1、图文详情数据
... ... @@ -13,7 +24,7 @@ interface dataObject {
// 9、活动投稿 视频跳转
// 10、活动投稿 动态跳转
// 11、活动投稿 图集跳转
dataSource: number
dataSource: string
operateType?: string
webViewHeight?: string
dataJson?: string
... ... @@ -27,6 +38,7 @@ interface dataObject {
positionLeft?: string
positionTop?: string
videoLandscape?: string
imgListData?: string
}
/**
... ...
... ... @@ -50,6 +50,30 @@ export class DeviceUtil {
* @returns
*/
static getDisplayVersion(): string {
return deviceInfo.productModel;
return deviceInfo.displayVersion;
}
/**
* 返回设备sdk版本
* 12
* @returns
*/
static getOsVersion(): string {
return deviceInfo.sdkApiVersion + '';
}
/**
* 获取平台标识,暂手机,后续适配tv、笔记本、pad,再扩展
*/
static getPlat() {
return 'Phone';
}
/**
* 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值
*/
static getRandomUUIDForTraceID(): string {
deviceInfo.productModel
return util.generateRandomUUID().toUpperCase().replace('-', '')
}
}
... ...
... ... @@ -11,6 +11,18 @@ export enum EmitterEventId {
// 跳转首页指定频道,事件id
JUMP_HOME_CHANNEL = 4,
LOCATION = 5
LOCATION = 5,
/*发布评论*/
COMMENT_PUBLISH = 6,
// 关注,取消关注
PEOPLE_SHIP_ATTENTION = 7,
// App回到前台
APP_ENTER_FOREGROUD = 100,
// App进入后台
APP_ENTER_BACKGROUD = 101,
}
... ...
... ... @@ -289,4 +289,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
this.dataArray.splice(start, this.dataArray.length, ...data);
this.notifyDataReload()
}
public reloadData(): void {
this.notifyDataReload();
}
}
\ No newline at end of file
... ...
import data_preferences from '@ohos.data.preferences';
import { Logger } from './Logger';
/*
// SPHelper.default.get("key1", "defValue1").then((value1) => {
// this.message = value1.toString();
// })
const TAG = 'SPHelper'
// let value2: string = await SPHelper.default.get("key2", "defValue2");
// this.message = result;
*
* 单例模式
/**
* sp存储
*/
export class SPHelper {
private static context: Context;
... ... @@ -49,7 +45,11 @@ export class SPHelper {
saveSync(key: string, value: data_preferences.ValueType) {
const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
preferences.putSync(key, value)
preferences.flush() // todo:Asynchronously
preferences.flush().then(() => {
Logger.debug(TAG, 'saveSync flush success')
}).catch((error: object) => {
Logger.debug(TAG, 'saveSync flush failed: ' + JSON.stringify(error))
});
}
async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> {
... ... @@ -84,7 +84,11 @@ export class SPHelper {
deleteSync(key: string) {
const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
preferences.deleteSync(key)
preferences.flush(); // todo:Asynchronously
preferences.flush().then(() => {
Logger.debug(TAG, 'deleteSync flush success')
}).catch((error: object) => {
Logger.debug(TAG, 'deleteSync flush failed: ' + JSON.stringify(error))
});
}
async clearSync() {
... ... @@ -96,13 +100,7 @@ export class SPHelper {
});
}
// clearSync() {
// let preferences: data_preferences.Preferences = this.getVideoPreferencesSync()
// preferences.clearSync()
// preferences.flush()
// }
public getPreferences(){
public getPreferences() {
let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename);
return preferences;
}
... ...
... ... @@ -6,41 +6,34 @@ import { SPHelper } from './SPHelper'
import { StringUtils } from './StringUtils'
export class UserDataLocal {
public static userId=''
public static userType=''
public static token=''
public static userName=''
public static userHeaderUrl=''
public static userLevel = -1
public static userLevelHeaderUrl=''
private static userId=''
private static userType=''
private static userName=''
private static userHeaderUrl=''
private static userLevel = -1
private static userLevelHeaderUrl=''
//先写死
static USER_ID="userId"
static USER_Type="userType"
static USER_JWT_TOKEN="jwtToken"
static USER_NAME="userName"
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"
static USER_FOLLOW_OPERATION="user_follow_operation"
/**
* 清除 本地用户数据
*/
public static clearUserData(){
SPHelper.default.deleteSync(UserDataLocal.USER_ID)
SPHelper.default.deleteSync(UserDataLocal.USER_Type)
SPHelper.default.deleteSync(UserDataLocal.USER_JWT_TOKEN) //待确认
SPHelper.default.deleteSync(UserDataLocal.USER_NAME)
SPHelper.default.deleteSync(UserDataLocal.USER_HEADER_URL)
SPHelper.default.deleteSync(UserDataLocal.USER_LEVEL)
SPHelper.default.deleteSync(UserDataLocal.USER_LEVEL_HEADER_URL)
UserDataLocal.userId=''
UserDataLocal.userType=''
UserDataLocal.userName=''
UserDataLocal.userHeaderUrl=''
UserDataLocal.userLevel = -1
UserDataLocal.userLevelHeaderUrl=''
}
public static getUserId() {
... ... @@ -59,17 +52,6 @@ export class UserDataLocal {
return UserDataLocal.userType;
}
private static getXToken() {
if(StringUtils.isNotEmpty(UserDataLocal.token)){
return UserDataLocal.token
}
UserDataLocal.token = SPHelper.default.getSync(UserDataLocal.USER_JWT_TOKEN,"") as string
if(StringUtils.isNotEmpty(UserDataLocal.token)) {
return UserDataLocal.token
}
return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
}
public static getUserName() {
if(StringUtils.isNotEmpty(UserDataLocal.userName)){
return UserDataLocal.userName
... ... @@ -118,4 +100,5 @@ export class UserDataLocal {
public static setUserLevelHeaderUrl(url:string) {
SPHelper.default.save(UserDataLocal.USER_LEVEL_HEADER_URL, url)
}
}
\ No newline at end of file
... ...
... ... @@ -8,3 +8,7 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils"
export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil"
export { HttpUtils } from "./src/main/ets/utils/HttpUtils"
export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager"
... ...
... ... @@ -5,6 +5,7 @@ import { ResponseDTO } from '../bean/ResponseDTO';
import { HttpUrlUtils, WDHttp } from '../../../../Index';
import { RefreshTokenRes } from '../bean/RefreshTokenRes';
import { ResposeError } from '../bean/ResposeError';
import { HttpUtils } from '../utils/HttpUtils';
const TAG: string = 'HttpBizUtil'
... ... @@ -93,13 +94,12 @@ export class HttpBizUtil {
static refreshToken(): Promise<string> {
let url = HttpUrlUtils.getRefreshTokenUrl();
let params: HashMap<string, string> = new HashMap<string, string>()
params.set('refreshToken', HttpUrlUtils.getRefreshToken())
params.set('deviceId', HttpUrlUtils.getDeviceId())
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
params.set('refreshToken', HttpUtils.getRefreshToken())
params.set('deviceId', HttpUtils.getDeviceId())
// Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())
// 请求刷新token接口
return new Promise<string>((success, error) => {
WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
let newToken = ''
if (resDTO) {
Logger.debug(TAG, 'refreshToken getRefreshToken: ' + resDTO.message)
... ...
import { SpConstants } from 'wdConstant';
import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
import { HttpUtils } from '../utils/HttpUtils';
import { HostEnum, HostManager } from './HttpHostManager';
/**
* 网络请求参数工具类,TODO 不对外暴露,收缩权限
*/
export class HttpParams {
static buildHeaders(): Record<string, string> {
let headers: Record<string, string> = {};
// 通用请求头
headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO
headers['channel'] = 'rmrb_china_0000' // 自有渠道
headers['plat'] = DeviceUtil.getPlat()
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['device_id'] = DeviceUtil.clientId()
headers['build_version'] = HttpParams.getVersion()
headers['adcode'] = HttpUtils.getProvinceCode()
headers['os_version'] = DeviceUtil.getOsVersion()
headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识
headers['versionCode'] = HttpParams.getVersionCode()
headers['version_name'] = HttpParams.getVersionName()
headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID()
headers['imei'] = DeviceUtil.clientId()
headers['Accept-Language'] = 'zh'
headers['timestamp'] = DateTimeUtils.getTimeStamp() + ''
headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
HttpParams.setLocationHeader(headers)
if (HttpUtils.isLogin()) {
headers['RMRB-X-TOKEN'] = HttpUtils.getUserToken()
headers['cookie'] = 'RMRB-X-TOKEN=' + HttpUtils.getUserToken()
headers['userId'] = HttpUtils.getUserId()
headers['userType'] = HttpUtils.getUserType()
}
HttpParams.addSpecialHeaders(headers);
return headers;
}
static addSpecialHeaders(headers: Record<string, string>) {
switch (HostManager.getHost()) {
case HostEnum.HOST_UAT:
headers['X-Ca-Stage'] = 'PRE'
headers['Authorization'] = 'APPCODE 83092caa603a421aa0222308b3f6b27a'
headers['appCode'] = '83092caa603a421aa0222308b3f6b27a'
break
case HostEnum.HOST_SIT:
headers['X-Ca-Stage'] = 'TEST'
headers['Authorization'] = 'APPCODE 0af1f9085e484c97b2a44704bae72c07'
headers['appCode'] = '0af1f9085e484c97b2a44704bae72c07'
break
case HostEnum.HOST_PRODUCT:
headers['X-Ca-Stage'] = 'RELEASE'
headers['Authorization'] = 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'
headers['appCode'] = '3d4181bceeb94d9780e10dbb6c67bbf6'
break
case HostEnum.HOST_DEV:
headers['X-Ca-Stage'] = 'TEST'
headers['Authorization'] = 'APPCODE ff33172859e14f9a8299e3bd769e79f9'
headers['appCode'] = 'ff33172859e14f9a8299e3bd769e79f9'
break
default:
break
}
}
/**
* 设置定位信息header
*
* @param headers
*/
static setLocationHeader(headers: Record<string, string>) {
let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
if (StringUtils.isNotEmpty(cityName)) {
headers['city'] = encodeURI(cityName)
}
let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
if (StringUtils.isNotEmpty(cityCode)) {
headers['city_dode'] = encodeURI(cityCode)
}
}
private static getVersion() {
// TODO
return '202401242103';
}
private static getVersionCode() {
// TODO
return '10000';
}
private static getVersionName() {
// TODO 读取配置
return '1.0.0';
}
}
\ No newline at end of file
... ...
export enum HostEnum {
/**
* uat环境url
*/
HOST_UAT = 'https://pd-apis-uat.pdnews.cn',
/**
* 中文端sit环境
*/
HOST_SIT = 'https://pd-apis-sit.pdnews.cn',
/**
* dev环境url
*/
HOST_DEV = 'https://pd-apis-dev.pdnews.cn',
/**
* 正式环境url
*/
HOST_PRODUCT = 'https://pdapis.pdnews.cn',
}
/**
* 环境host管理工具类
*/
export class HostManager {
private static _hostUrl: HostEnum = HostEnum.HOST_PRODUCT;
static changeHost(host: HostEnum) {
HostManager._hostUrl = host;
}
static getHost(): string {
return HostManager._hostUrl;
}
}
\ No newline at end of file
... ...
import ArrayList from '@ohos.util.ArrayList';
import service from './AxiosRequest';
import { HttpUtils } from '../utils/HttpUtils';
import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios';
import { ResponseDTO } from '../bean/ResponseDTO';
import HashMap from '@ohos.util.HashMap';
import { HttpParams } from './HttpCommonParams';
export class HttpRequest {
private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList();
... ... @@ -14,7 +14,7 @@ export class HttpRequest {
static initHttpHeader() {
HttpRequest.addGlobalHeaderProvider(() => {
return HttpUtils.buildHeaders();
return HttpParams.buildHeaders();
})
}
... ... @@ -34,15 +34,17 @@ export class HttpRequest {
static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders {
let commonHeader: AxiosHeaders = new AxiosHeaders()
headers?.forEach((v, k) => {
commonHeader.set(k, v);
});
HttpRequest.globalHeaderProviders.forEach((func) => {
let headers = func();
for (const obj of Object.entries(headers)) {
let getHeaders = func();
for (const obj of Object.entries(getHeaders)) {
commonHeader.set(obj[0], obj[1]);
}
})
// 业务headers,覆盖common(如果有冲突的话,取业务)
headers?.forEach((v, k) => {
commonHeader.set(k, v);
});
if (!commonHeader.get('Content-Type')) {
commonHeader.set('Content-Type', 'application/json;charset=utf-8');
}
... ... @@ -56,24 +58,13 @@ export class HttpRequest {
return service.get(url, config)
}
static post0<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
let config: AxiosRequestConfig = {
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
}
return service.post(url, data, config)
}
static post<T = object>(url: string, data1?: object, headers?: HashMap<string, string>): Promise<T> {
let requestHeaders: AxiosHeaders = new AxiosHeaders()
headers?.forEach((v, k) => {
requestHeaders.set(k, v);
});
let config: AxiosRequestConfig = {
headers: requestHeaders as RawAxiosRequestHeaders,
}
return service.post(url, data1, config)
}
static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
let config: AxiosRequestConfig = {
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
... ...
import HashMap from '@ohos.util.HashMap';
import { SpConstants } from 'wdConstant';
import { SPHelper, StringUtils } from 'wdKit';
import { HostManager } from './HttpHostManager';
/**
* 网络请求业务侧工具类
* 网络请求业务侧接口url工具类
*/
export class HttpUrlUtils {
/**
* uat环境url
*/
static readonly HOST_UAT: string = "https://pd-apis-uat.pdnews.cn";
/**
* 中文端sit环境
*/
static readonly HOST_SIT: string = "https://pd-apis-sit.pdnews.cn";
/**
* 正式环境url
*/
static readonly HOST_PRODUCT: string = "https://pdapis.pdnews.cn";
/**
* dev环境url
*/
static readonly HOST_DEV: string = "https://pd-apis-dev.pdnews.cn";
/**
* 启动接口(底导接口)
*/
static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup";
... ... @@ -64,10 +46,6 @@ export class HttpUrlUtils {
*/
static readonly INTERACT_EXECUTELIKE: string = "/api/rmrb-interact/interact/zh/c/like/executeLike";
/**
* 收藏、取消收藏
*/
static readonly INTERACT_EXECUTECOLLECTRECORD: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
/**
* 关注号主
*/
static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation";
... ... @@ -293,265 +271,78 @@ export class HttpUrlUtils {
* 获取启动页相关数据
*/
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;
}
private static userId = ''
private static userType = ''
private static token = ''
static getCommonHeaders(): HashMap<string, string> {
let headers: HashMap<string, string> = new HashMap<string, string>()
headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)')
headers.set('channel', HttpUrlUtils.getChannel())
//headers.set('appCode', ConfigConstants.appCode)
headers.set('plat', HttpUrlUtils.getPlat())
//headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a')
headers.set('Content-Type', 'application/json; charset=utf-8')
headers.set('timestamp', HttpUrlUtils.getTimestamp())
headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken())
headers.set('device_id', HttpUrlUtils.getDeviceId())
if (HttpUrlUtils.getXToken() != '') {
headers.set('cookie', 'RMRB-X-TOKEN=' + HttpUrlUtils.getXToken())
}
headers.set('build_version', HttpUrlUtils.getVersion())
headers.set('adcode', HttpUrlUtils.getAdCode())
headers.set('os_version', HttpUrlUtils.getOsVersion())
//headers.set('X-Ca-Stage', 'PRE')
headers.set('versionCode', HttpUrlUtils.getVersionCode())
headers.set('system', HttpUrlUtils.getTerminalId())
headers.set('version_name', HttpUrlUtils.getVersionName())
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())
HttpUrlUtils.setLocationHeader(headers)
// TODO 判断是否登录
headers.set('userId', HttpUrlUtils.getUserId())
headers.set('userType', HttpUrlUtils.getUserType())
headers.set('mpassid', 'ZbHTMeTsfaYDAHqt8ZHIzcPs')
HttpUrlUtils.addSpecialHeaders(headers);
// Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');
// headers.forEach((v,k)=>{
// Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);
// })
// Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');
return headers;
}
static addSpecialHeaders(headers: HashMap<string, string>) {
switch (HttpUrlUtils._hostUrl) {
case HttpUrlUtils.HOST_UAT:
// TODO 待优化到常量类里
headers.set('X-Ca-Stage', 'PRE');
headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');
headers.set('appCode', '83092caa603a421aa0222308b3f6b27a');
break
case HttpUrlUtils.HOST_SIT:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');
headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07');
break
case HttpUrlUtils.HOST_PRODUCT:
headers.set('X-Ca-Stage', 'RELEASE');
headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');
headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6');
break
case HttpUrlUtils.HOST_DEV:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');
headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9');
break
default:
break
}
}
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;
}
private static getCity() {
// TODO 对接定位
return '%E5%90%88%E8%82%A5%E5%B8%82';
}
private static getChannel() {
// TODO 对接配置
return 'rmrb_china_0000';
}
private static getPlat() {
return 'Phone';
}
private static getTimestamp() {
// return DateTimeUtils.getCurrentTime() + '';
// TODO 暂时写死,有些page 真实时间戳 返回数据为空
return '155203523';
}
private static getXToken() {
if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {
return HttpUrlUtils.token
}
HttpUrlUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
if (StringUtils.isNotEmpty(HttpUrlUtils.token)) {
return HttpUrlUtils.token
}
// return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
return ''
}
static getRefreshToken() {
let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")
if (StringUtils.isNotEmpty(refreshToken)) {
return refreshToken as string;
}
return '';
}
public static getDeviceId() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
}
private static getVersion() {
// TODO
return '202401242103';
}
private static getVersionCode() {
// TODO
return '7301';
}
private static getVersionName() {
// TODO
return '7.3.0.1';
}
private static getAdCode() {
return '340000';
}
private static getOsVersion() {
// TODO
return '12';
}
public static getCityCode() {
// TODO
return '340100';
}
public static getProvinceCode() {
// TODO
return '340000';
}
/**
* 地区code
* 人民号号主推荐
*/
public static getDistrictCode() {
// TODO
return '340103';
}
static readonly RMH_RECOMMEND_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/rmh";
private static getTerminalId() {
return 'Android';
}
/**
* 关注号主发布内容接口
*/
static readonly ATTENTION_CONTENT_LIST_DATA_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/attention/contentList";
public static getImei() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
}
/**
* 一键关注接口
*/
static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch";
public static getUserId() {
// TODO 对接登录
if (StringUtils.isNotEmpty(HttpUrlUtils.userId)) {
return HttpUrlUtils.userId
}
HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
return HttpUrlUtils.userId;
}
public static getUserType() {
if (StringUtils.isNotEmpty(HttpUrlUtils.userType)) {
return HttpUrlUtils.userType
}
HttpUrlUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string
return HttpUrlUtils.userType;
static getHost(): string {
return HostManager.getHost();
}
static getVerifyCodeUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode";
return url;
}
static getVerifyCodeByTokenUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
return url;
}
static getCheckVerifyCodeByToken() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
return url;
}
static getForgetPasswordUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/forgotPassword";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/forgotPassword";
return url;
}
static getLogoutUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/appLogout";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/appLogout";
return url;
}
static getRefreshTokenUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH;
let url = HttpUrlUtils.getHost() + HttpUrlUtils.REFRESH_TOKEN_PATH;
return url;
}
static getResetPassworddUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/resetPassword";
return url;
}
static queryUserDetail() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/queryUserDetail";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/queryUserDetail";
return url;
}
static editUserDetail() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/editUserDetail";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/editUserDetail";
return url;
}
... ... @@ -561,358 +352,339 @@ export class HttpUrlUtils {
}
static getCheckVerifyCodeUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode";
return url;
}
static getAgreement() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement";
let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/agreement";
return url;
}
static getCheckVerifyByTokenCodeUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken";
return url;
}
/*优质评论页*/
static getQualityCommentUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality";
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/highQuality";
return url
}
/*获取详情页评论列表*/
static getContentCommentListDataUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/contentCommentList"
return url
}
/*获取子评论列表*/
static getChildContentCommentListDataUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/childCommentList"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/childCommentList"
return url
}
/*评论状态*/
static getBatchCommentStatusUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/batchCommentStatus"
return url
}
/*评论点赞*/
static getCommentLikeUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
return url
}
/*发布评论*/
static getPublishCommentUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/publish"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/publish"
return url
}
/*游客发布评论*/
static getNoUserPublishCommentUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
return url
}
/*levleIcon*/
static getBatchUserUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser"
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-point/auth/level/zh/c/batchUser"
return url
}
/*authIcon 20个一次上限*/
static getDetailListUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-contact/contact/zh/c/master/detailList"
let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/master/detailList"
return url
}
//账户注销
static accountLogoutUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/logoff";
return url;
}
//更换手机号绑定
static changeBindPhone() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/userPhoneChange";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/userPhoneChange";
return url;
}
//获取用户安全页信息
static querySecurity() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query";
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/security/query";
return url;
}
//游客评论合并
static visitorMergeComment() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorMerge";
return url;
}
static getAppointmentListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
return url
}
static getMyCollectionListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH
return url
}
static getExecuteCollcetUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
return url
}
static getFollowListDetailDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH
return url
}
static getFollowListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_DATA_PATH
return url
}
static getMineFollowListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_FOLLOW_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_FOLLOW_LIST_DATA_PATH
return url
}
static getFollowListStatusDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
return url
}
static getCommentListStatusDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH
return url
}
static getMineCommentListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH
return url
}
static getMineUserLevelDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH
return url
}
static getOtherUserLevelDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH
return url
}
static getMineUserDetailDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH
return url
}
static getOtherUserDetailDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH
return url
}
static getOtherCommentListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_COMMENT_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_COMMENT_LIST_DATA_PATH
return url
}
static getOtherUserFollowListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_FOLLOW_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_FOLLOW_LIST_DATA_PATH
return url
}
static getAppointmentOperationUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH
return url
}
static getCommentLikeOperationUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH
return url
}
static getFollowOperationUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_OPERATION_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_OPERATION_PATH
return url
}
static getSearchHintDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HINT_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_HINT_DATA_PATH
return url
}
static getSearchHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HOTS_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_HOTS_DATA_PATH
return url
}
static getRelatedSearchContentDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH
return url
}
static getInterestsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH;
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH;
return url;
}
static getUpdateInterestsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
return url;
}
static getLaunchPageDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH;
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LAUNCH_PAGE_PATH;
return url;
}
static getLiveDetailsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_DETAILS_PATH
return url
}
static getLiveListUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_LIST_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_LIST_PATH
return url
}
static getLiveChatListUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_CHAT_LIST_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH
return url
}
static getLiveRoomDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_ROOM_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH
return url
}
static getLiveAppointmentStatusUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH
return url
}
static getLiveAppointmentUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_PATH
return url
}
static getAppointmentStatusUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
return url
}
static getSearchResultCountDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
return url
}
static getSearchResultListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
return url
}
static getInteractListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
return url
}
static getCreatorDetailListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
return url
}
static getArticleCountHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH
return url
}
static getArticleListHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH
return url
}
static getCreatorInfluenceInfoHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH
return url
}
//点赞
static executeLike() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike";
let url = HttpUrlUtils.getHost() + "/api/rmrb-interact/interact/zh/c/like/executeLike";
return url;
}
//获取点赞状态
static getLikeStatus() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status";
let url = HttpUrlUtils.getHost() + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status";
return url;
}
//获取点赞数
static getLikeCount() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_V2_DATA_PATH;
return url;
}
//搜索推荐
static getSearchSuggestDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH
let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH
return url
}
//金刚位聚合页
static getThemeListUrl() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/themeList";
let url = HttpUrlUtils.getHost() + "/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>()
//
// headers.set('mpassid', 'XGt6jfGUx8ADAKruTyAMdhHj')
// headers.set('city', "%E5%90%88%E8%82%A5%E5%B8%82")
// headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 10; PCT-AL10 Build/HUAWEIPCT-AL10)')
// headers.set('channel', "rmrb_china_0000")
// headers.set('appCode', "0af1f9085e484c97b2a44704bae72c07")
// headers.set('Authorization', "APPCODE 0af1f9085e484c97b2a44704bae72c07")
// headers.set('X-Ca-Stage', "TEST")
// headers.set('plat', "Phone")
// headers.set('Content-Type', 'application/json; charset=utf-8')
// headers.set('timestamp', "740977741")
// headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDc1NjM3NywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ.KBkF0Yki-JWlq0ZIOCzgKwQc1ycBnFHa6CF-rMPRgHU")
// headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327")
// // headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8')
// headers.set('build_version', "202403112023")
// headers.set('adcode', "340000")
// headers.set('os_version', "10")
// headers.set('city_dode', "340100")
// headers.set('userId', "567387477063621")
// headers.set('versionCode', "7302")
// headers.set('system', "Android")
// headers.set('version_name', "7.3.0.2")
// headers.set('EagleEye-TraceID', '101118E4D006453DA549A82AA8CAFBFE')
// headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327")
// headers.set('userType', "1")
// headers.set('Accept-Language', 'zh')
//
// // HttpUrlUtils.addSpecialHeaders(headers);
// // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');
// // headers.forEach((v,k)=>{
// // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);
// // })
// // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');
// return headers;
// }
public static setUserId(userId: string) {
HttpUrlUtils.userId = userId;
}
public static setUserType(userType: string) {
HttpUrlUtils.userType = userType;
}
public static setUserToken(token: string) {
HttpUrlUtils.token = token;
// 人民号号主推荐
static getRmhRecommendUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.RMH_RECOMMEND_DATA_PATH;
return url;
}
// 关注号主发布内容接口
static getAttentionContentListUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_CONTENT_LIST_DATA_PATH;
return url;
}
// 一键关注接口
static getAttentionBatchUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_BATCH_DATA_PATH;
return url;
}
}
\ No newline at end of file
... ...
// import { ResponseLogin } from '../bean/account/ResponseLogin';
import { Logger } from 'wdKit';
// import { UserInfo } from '../bean/account/UserInfo';
// import { ConfigConstants } from '../constants/ConfigConstants';
// import { AccountManagerUtils } from './AccountManagerUtils';
// import { AppUtils } from './AppUtils';
// import { DeviceUtil } from './DeviceUtil';
// import { Logger } from './Logger';
// import { StringUtils } from './StringUtils';
import { SpConstants } from 'wdConstant/Index';
import { DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
import { HttpRequest } from '../http/HttpRequest';
const TAG: string = '[HttpUtils]'
/**
* http相关工具类,对外暴露
*/
export class HttpUtils {
static buildHeaders(): Record<string, string> {
let timestamp: number = new Date().getTime(); // 单位毫秒
// let clientId = DeviceUtil.clientId()
static getRefreshToken() {
let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")
if (StringUtils.isNotEmpty(refreshToken)) {
return refreshToken as string;
}
return '';
}
let headers: Record<string, string> = {};
// 通用请求头
headers["version"] = 'V3';
// headers["appId"] = ConfigConstants.appId; // 应用id
// headers["terminalId"] = ConfigConstants.terminalId; // 终端ID
// headers["sourceId"] = ConfigConstants.sourceId; // 咪咕视频
// headers["appType"] = ConfigConstants.appType; // 手机客户端App(安卓)
// headers["clientType"] = ConfigConstants.clientType; // 客户端类型
// headers["appVersion"] = AppUtils.getAppVersionCode() + ''; // 客户端版本号:2600010500
// headers["APP-VERSION-CODE"] = AppUtils.getAppVersionCode() + ''; // APP版本号:250006577
// headers["appVersionName"] = AppUtils.getAppVersionName() // app对外显示版本: '6.1.5.00'
// headers["appCode"] = ConfigConstants.appCode; // 应用编码:产品_渠道_应用的拼接串,用下划线_ 拼接而成
// headers["ptvCode"] = ConfigConstants.ptvCode; // 基线版本号_应用版本号 todo:
// headers["clientProvinceCode"] = ''; // 客户端分省号 // 02
// headers["provinceCode"] = ''; // 客户端分省号 // 02
// headers["clientCityId"] = ''; // 客户端城市ID // 0210
// headers["carrierCode"] = ''; // 运营商信息
/**
* 设备id,uuid
*/
public static getDeviceId(): string {
return DeviceUtil.clientId();
}
// 设备信息请求头
// headers["User-Agent"] = ''; // 终端UA,自动获取
headers["Content-Type"] = 'application/json;charset=UTF-8'; // 返回/响应的HTTP内容类型
headers["os"] = 'android'; // 操作系统类型:鸿蒙、安卓或iOS
// headers["osInfo"] = 'AD'; // 操作系统信息
headers["Phone-Info"] = 'HUAWEI'; // 手机信息: todo
// headers["oaid"] = ''; // 开放匿名设备ID,是中国移动安全联盟(MSA)发起并制定标准用户识别ID
headers["networkInfo"] = 'WIFI'; // 网络类型: todo
headers["cache-control"] = 'no-cache'; // 请求和响应遵循的缓存机制
// headers["clientId"] = clientId; // 客户端编号:客户端初始化时生成的客户端ID,保证唯一性
headers["imei"] = 'd1de6d3ae0db44bea1b3f0e20a14d90a'; // 终端手机序列号: todo
headers["X-UP-CLIENT-CHANNEL-ID"] = '2600010500-99000-101700010130012'; // 客户端渠道ID: todo
headers["channelCode"] = 'VIDEO_APPMAIL'; // 渠道编码
// headers["l_c"] = clientId; // 客户端id,同clientId
// headers["l_t"] = timestamp + ''; // 本机时间戳
// headers["l_s"] = ''; // l_c和l_t拼接后的MD5校验
/**
* 定位,城市code
*/
public static getCityCode(): string {
// 城市编码
return SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
}
// 签名相关请求头
headers["timeStamp"] = timestamp + ''; // 服务端时间戳(毫秒):1701667763664
headers["signType"] = 'RSA'; // 签名类型,固定RSA
/**
* 定位,省份code
*/
public static getProvinceCode(): string {
return SPHelper.default.getSync(SpConstants.LOCATION_PROVINCE_CODE, '') as string
}
// 业务请求头
// headers["promotionID"] = '54b0f421-a6df-41d3-9be2-92820b2c5d8c'; // 促销Id todo
// headers["tenantId"] = ''; // 租户Id
/**
* 定位,地区code
*/
public static getDistrictCode(): string {
let districtCode = SPHelper.default.getSync(SpConstants.LOCATION_DISTRICT_CODE, '') as string
if (districtCode === '') {
return districtCode
}
// 截取前6位,如返回310115114,需要310115 (上海浦东)
return districtCode.substring(0, 6);
}
// 添加其他header
// headers["sdkCeId"] = '27fb3129-5a54-45bc-8af1-7dc8f1155501'; // 用户中台老接口定义的ID,保持不变,现网:咪咕视频Android版,27fb3129-5a54-45bc-8af1-7dc8f1155501 todo
headers["support-pendant"] = '1'; // 挂件标识, "1":客户端支持挂件节目结构;非"1":不支持挂件节目结构-展示通用对象
Logger.info(TAG, "buildHeader headers:" + JSON.stringify(headers));
return headers;
public static getImei(): string {
return DeviceUtil.clientId();
}
}
// export default new HttpUtils()
public static getUserId(): string {
return SPHelper.default.getSync(SpConstants.USER_ID, "") as string
}
public static getUserType(): string {
return SPHelper.default.getSync(SpConstants.USER_Type, "") as string
}
static getUserToken(): string {
return SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
}
public static isLogin(): boolean {
let token = HttpUtils.getUserToken()
if (token == null || token == undefined || token.length <= 0) {
return false
}
return true
}
}
\ No newline at end of file
... ...
... ... @@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage'
export { registerRouter } from './src/main/ets/router/Action2Page'
export { ProcessUtils } from './src/main/ets/utils/ProcessUtils'
export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor'
\ No newline at end of file
... ...
import { WDRouterPage } from './WDRouterPage';
export interface JumpInterceptorAction {
on(params?: object, singleMode?: boolean): boolean
}
// TODO:待优化
// 临时解决跳转页面之前方法拦截,比如登录先走一键登录,直播请求接口等
//
export class RouterJumpInterceptor {
private static actions: Record<string, JumpInterceptorAction> = {}
static getInterceptorAction(jumpPage: WDRouterPage): JumpInterceptorAction | undefined {
return RouterJumpInterceptor.actions[jumpPage.url()]
}
static register(jumpPage: WDRouterPage, interceptorAction: JumpInterceptorAction) {
RouterJumpInterceptor.actions[jumpPage.url()] = interceptorAction
}
}
... ...
... ... @@ -66,6 +66,7 @@ export class WDRouterPage {
// 动态详情页
static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage");
static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
//我的 预约
static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
... ... @@ -124,4 +125,6 @@ export class WDRouterPage {
static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
// 栏目页面、频道详情
static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage");
//展示头像
static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage");
}
... ...
... ... @@ -3,6 +3,7 @@ import { Action } from 'wdBean'
import { ToastUtils } from 'wdKit'
import { Action2Page } from './Action2Page'
import { WDRouterPage } from './WDRouterPage'
import { RouterJumpInterceptor } from './RouterJumpInterceptor'
export class WDRouterRule {
static jumpWithAction(action?: Action) {
... ... @@ -16,6 +17,11 @@ export class WDRouterRule {
static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) {
if (page) {
let action = RouterJumpInterceptor.getInterceptorAction(page)
if (action && action.on(params, singleMode)) {
return
}
let mode = router.RouterMode.Standard
if (singleMode) {
mode = router.RouterMode.Single
... ... @@ -36,6 +42,10 @@ export class WDRouterRule {
static jumpWithReplacePage(page?: WDRouterPage, params?: object) {
if (page) {
let action = RouterJumpInterceptor.getInterceptorAction(page)
if (action && action.on(params)) {
return
}
if (params) {
// router.pushUrl({ url: 'pages/routerpage2', , params: params })
router.replaceUrl({ url: page.url(), params: params })
... ...
... ... @@ -17,7 +17,7 @@ const TAG = 'ProcessUtils';
*/
export class ProcessUtils {
/**
* 广告中心的业务广告跳转方法( 现用在挂角广告)
* 广告中心的业务广告跳转方法( 现用在挂角广告、信息流页面广告
* @param advContent
*/
static openAdvDetail(matInfo: CompAdvMatInfoBean) {
... ... @@ -157,13 +157,14 @@ export class ProcessUtils {
* 图集详情页
* @param content
* */
public static gotoMultiPictureListPage(photoList: PhotoListBean[]) {
public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 18,
extra: {
photoList
photoList,
swiperIndex
} as ExtraDTO
} as Params,
};
... ... @@ -186,8 +187,14 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: content?.objectId,
url: content.linkUrl,
pageID: 'SPACIAL_TOPIC_PAGE',
extra: {
relType: content?.relType,
relId: content?.relId,
channelId: content?.channelId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
... ... @@ -422,11 +429,10 @@ export class ProcessUtils {
/**
* 跳转人民号主页
*@params creatorId 创作者id
* @params creatorId 创作者id
*/
public static gotoPeopleShipHomePage(creatorId: string) {
let params = {'creatorId': creatorId} as Record<string, string>;
let params = { 'creatorId': creatorId } as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
... ...
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
... ...
export { WDShareObject, WDShareBase } from "./src/main/ets/WDShareBase"
export { ShareContent, ShareScene, ShareType } from "./src/main/ets/Constant"
\ No newline at end of file
... ...
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
},
],
"targets": [
{
"name": "default"
}
]
}
\ No newline at end of file
... ...
import { hspTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
... ...
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
... ...
{
"name": "wdsharebase",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "Index.ets",
"author": "",
"license": "Apache-2.0",
"packageType": "InterfaceHar",
"dependencies": {
}
}
\ No newline at end of file
... ...
export const enum ShareType {
System = 0,
WeChat,
QQ,
Weibo,
}
export const enum ShareScene {
System = 0,
WeChatSession,
WeChatTimeline,
QQFriend,
QQZone,
Weibo,
}
export const enum ShareContentType {
PrueText = 1,
ImageAndText,
Link,
}
export interface ShareContentText {
text: string
}
export interface ShareContentImageAndText {
title: string
desc?: string
imgURI: string
}
export interface ShareContentLink {
title: string
desc?: string
link: string
icon?: string
}
export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink
... ...
import { ShareContent, ShareContentImageAndText, ShareContentLink, ShareContentText,
ShareContentType,
ShareScene } from '../Constant';
import { WDShareInterface } from '../WDShareInterface';
import { AsyncCallback } from '@kit.BasicServicesKit';
import { common } from '@kit.AbilityKit';
import { systemShare } from '@kit.ShareKit';
import { uniformTypeDescriptor as utd } from '@kit.ArkData';
export class WDSystemShare implements WDShareInterface {
shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> {
return new Promise((resolve, fail) => {
try {
let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType));
let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
controller.on('dismiss', () => {
resolve("dismiss")
});
controller.show(context, {
previewMode: systemShare.SharePreviewMode.DEFAULT,
selectionMode: systemShare.SelectionMode.SINGLE
});
console.log("分享控制器调用完成")
} catch (e) {
fail(e)
}
})
}
getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData {
if (contentType === ShareContentType.PrueText) {
let prueText = content as ShareContentText
console.log("分享纯文本")
return new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: prueText.text
});
}
if (contentType === ShareContentType.ImageAndText) {
let imageAndText = content as ShareContentImageAndText
console.log("分享图片和文本")
let data: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: imageAndText.title
});
data.addRecord({
utd: utd.UniformDataType.PNG,
uri: imageAndText.imgURI
});
return data
}
console.log("分享链接和文本")
let link = content as ShareContentLink
let data: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: link.title
});
data.addRecord({
utd: utd.UniformDataType.HYPERLINK,
uri: link.link
});
return data
}
}
\ No newline at end of file
... ...
import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constant'
import { HashMap } from '@kit.ArkTS'
import { WDShareInterface } from './WDShareInterface'
import { WDSystemShare } from './System/WDSystemShare'
export interface WDShareObject {
to: ShareType,
scene: ShareScene,
type: ShareContentType,
obj: ShareContent
}
export class WDShareBase {
private static instance?: WDShareBase
static getInstance() : WDShareBase {
if (!WDShareBase.instance) {
WDShareBase.instance = new WDShareBase()
WDShareBase.instance.register()
}
return WDShareBase.instance
}
private handles: HashMap<ShareType, WDShareInterface> = new HashMap()
register() {
this.handles.set(ShareType.System, new WDSystemShare())
}
share(obj: WDShareObject) : null | Promise<string> {
let shareHandler: WDShareInterface = this.handles.get(obj.to)
if (shareHandler) {
return shareHandler.shareContent(obj.scene, obj.obj, obj.type)
}
return null
}
}
\ No newline at end of file
... ...
import { ShareContent, ShareContentType, ShareScene } from './Constant'
import { AsyncCallback } from '@kit.BasicServicesKit'
export interface WDShareInterface {
// shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void
shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string>
}
\ No newline at end of file
... ...
@Entry
@Component
struct IndexPage {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
... ...
{
"module": {
"name": "wdShareBase",
"type": "shared",
"description": "$string:shared_desc",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"pages": "$profile:main_pages"
}
}
\ No newline at end of file
... ...
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
... ...
{
"string": [
{
"name": "shared_desc",
"value": "description"
}
]
}
\ No newline at end of file
... ...
{
"src": [
"pages/IndexPage"
]
}
\ No newline at end of file
... ...
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
\ No newline at end of file
... ...
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest',() => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
\ No newline at end of file
... ...
import HashMap from '@ohos.util.HashMap';
import { Callback } from 'wdJsBridge';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger } from 'wdKit';
import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger, SPHelper } from 'wdKit';
import { H5CallNativeType } from './H5CallNativeType';
import { H5OperateType } from './H5OperateType';
import { ContentConstants } from 'wdConstant';
import { ContentConstants, SpConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import Url from '@ohos.url'
import { ContentDTO } from 'wdBean/Index';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
import { ContentDTO, PhotoListBean } from 'wdBean';
import { handleJsCallAppService } from './JsCallAppService'
const TAG = 'JsBridgeBiz'
... ... @@ -20,6 +19,19 @@ class AppInfo {
// TODO 完善
}
class AppLoginAuthInfo {
"X-Ca-Stage": string = ''
userType: number = SPHelper.default.getSync(SpConstants.USER_Type, '') as number
userName: string = SPHelper.default.getSync(SpConstants.USER_NAME, '') as string
userID: string = SPHelper.default.getSync(SpConstants.USER_ID, '') as string
"RMRB-X-TOKEN": string = SPHelper.default.getSync(SpConstants.USER_TEMP_TOKEN, '') as string
phoneNumber: string = SPHelper.default.getSync(SpConstants.USER_PHONE, '') as string
nickName: string = ''
isLogined: string = SPHelper.default.getSync(SpConstants.USER_STATUS, '') as string
creatorID: string = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string
Authorization: string = ''
}
/**
* h5调用native代码
* @param data
... ... @@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_getArticleDetailBussinessData:
break;
case H5CallNativeType.jsCall_callAppService:
handleJsCallCallAppService(data, (res: string) => {
handleJsCallAppService(data, (res: string) => {
call(res)
})
break;
... ... @@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_appInnerLinkMethod:
handleJsCallAppInnerLinkMethod(data)
break;
case H5CallNativeType.jsCall_getAppLoginAuthInfo:
call(handleJsCallGetAppLoginAuthInfo())
break;
default:
break;
}
... ... @@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) {
}
}
function handleJsCallCallAppService(data: Message, callback: (res: string) => void) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if (data?.data?.method === 'get') {
WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => {
callback(JSON.stringify(res))
})
}
if (data?.data?.method === 'post') {
WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => {
callback(JSON.stringify(res))
})
}
}
/**
* 获取App公共信息
*/
... ... @@ -90,17 +90,31 @@ function getAppPublicInfo(): string {
info.networkStatus = 1
let result = JSON.stringify(info)
Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info))
return result;
}
function handleJsCallReceiveH5Data(data: Message) {
switch (data?.data?.dataSource) {
case 5:
if (data?.data?.dataSource === 5) {
ProcessUtils.processPage(JSON.parse(data?.data?.dataJson || '{}'))
switch (String(data?.data?.dataSource)) {
case '3':
let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}")
let imgArr = imgListData?.imgArr || []
let swiperIndex = imgListData?.imgIndex
if (imgArr.length > 0) {
const photoList: PhotoListBean[] = imgArr.map(item => {
const photo: PhotoListBean = {
width: item.width,
height: item.height,
picPath: item.pic,
picDesc: ''
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList, swiperIndex)
}
break;
case '5':
ProcessUtils.processPage(JSON.parse(data?.data?.dataJson || '{}'))
break;
default:
break;
}
... ... @@ -168,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
}
}
}
function handleJsCallGetAppLoginAuthInfo() {
let appLoginAuthInfo = new AppLoginAuthInfo()
let result = JSON.stringify(appLoginAuthInfo)
return result;
}
\ No newline at end of file
... ...
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
const TAG = 'JsCallAppService'
export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
netError: '0',
responseMap
} as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
// if (data?.data?.method === 'get') {
// WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
// callback(JSON.stringify(res))
// })
// }
if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
h5ReceiveDataJson.responseMap = res
callback(JSON.stringify(h5ReceiveDataJson))
})
}
}
... ...
... ... @@ -79,6 +79,7 @@ export struct WdWebLocalComponent {
if (this.videoUrl) {
Video({ src: this.videoUrl })
.autoPlay(true)
.objectFit(ImageFit.Contain)
.width(this.positionWidth)
.height(this.positionHeight)
.borderRadius(5)
... ...
This file is too large to display.
... ... @@ -153,3 +153,15 @@ export {
UserExtend
} from './src/main/ets/bean/user/UserDetail';
export {
RmhRecommendDTO
} from './src/main/ets/bean/peoples/RmhRecommendDTO';
export {
PeopleShipContentListDTO
} from './src/main/ets/bean/peoples/PeopleShipContentListDTO';
export {
AttentionBatchDTO,
CreatorDTO
} from './src/main/ets/bean/peoples/AttentionBatchDTO';
... ...
/**
* @Description: 广告扩展信息的解析模型
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
export interface AdvExtraData {
itemTopImage: string;
itemMore: AdvExtraItemData;
item: AdvExtraItemData[]
}
export interface AdvExtraItemData {
/**
* 图片地址
*/
image: string;
/**
* 标题
*/
title: string ;
/**
* 跳转地址
*/
linkUrl: string;
/**
* 跳转类型
*/
linkType: string;
}
\ No newline at end of file
... ...
... ... @@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO {
relType: string;
liveStreamType?: number;
photoList: PhotoListBean[];
swiperIndex?: number
commentId?: string;
}
\ No newline at end of file
... ...
... ... @@ -2,11 +2,11 @@
* 批查接口查询互动相关数据,返回数据bean
*/
export interface InteractDataDTO {
collectNum: number | String;
commentNum: number | String;
collectNum: number | string;
commentNum: number | string;
contentId: string;
contentType: number;
likeNum: number | String;
likeNum: number | string;
readNum: number;
shareNum: number;
}
\ No newline at end of file
... ...
... ... @@ -8,4 +8,5 @@ export interface commentInfo {
newsId: string,
relId: string;
relType: string;
userId: string;
}
\ No newline at end of file
... ...
export interface UserInfoDTO {
userHeadUrl:string
userHeadUrl: string
userName?: string
headPhotoUrl?: string
}
... ...
export interface H5ReceiveDataExtraBean {
creatorId: string;
cnsTraceId: string;
isLogin: string;
loadImageOnlyWifiSwitch: string;
networkStatus: number;
loadImageOnlyWifiSwitch: string
darkMode: string;
fontSizes: string;
}
\ No newline at end of file
... ...
import { ResponseBean } from './ResponseBean';
export interface H5ReceiveDataJsonBean {
contentId: string;
contentType: string;
topicId: string;
channelId: string;
compId: string;
sourcePage: string;
export interface H5ReceiveDataJsonBean<T = ResponseBean> {
contentId?: string;
contentType?: string;
topicId?: string;
channelId?: string;
compId?: string;
sourcePage?: string;
netError: string;
responseMap: ResponseBean;
responseMap: T;
}
\ No newline at end of file
... ...
import { ContentDetailDTO } from '../detail/ContentDetailDTO';
export interface ResponseBean{
success:boolean;
export interface ResponseBean<T = ContentDetailDTO[]> {
success: boolean;
// 服务请求响应值/微服务响应状态码”
code: number;
... ... @@ -10,8 +10,7 @@ export interface ResponseBean{
message: string;
// 响应结果
data:ContentDetailDTO[];
data: T
// 请求响应时间戳(unix格式)
timestamp?: number;
}
\ No newline at end of file
... ...
... ... @@ -159,7 +159,7 @@ export interface LiveDetailsBean {
}
*/
liveInfo: LiveInfo
fullColumnImgUrls: Array<FullColumnImgUrls>
fullColumnImgUrls: Array<FullColumnImgUrlBean>
newsTitle: string
newsId: string
newIntroduction: string
... ... @@ -186,8 +186,12 @@ export interface MLive {
mliveId: string
}
export interface FullColumnImgUrls {
export interface FullColumnImgUrlBean {
url: string
height: string
landscape: number
size: string
weight: string
}
export interface Vlive {
... ...
import { FullColumnImgUrlBean } from './LiveDetailsBean'
export interface LiveRoomBean {
pageNum: number
pageSize: number
... ... @@ -15,6 +17,7 @@ export interface LiveRoomItemBean {
isWall: number
//是否置顶 1置顶0不置顶
isTop: number
//guest :嘉宾,host:主持人
role: string
//ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
dataType: string
... ... @@ -28,5 +31,7 @@ export interface LiveRoomItemBean {
duration: number
//音频地址
audioUrl: string
//详情页面插入数据bean
fullColumnImgUrlDto: FullColumnImgUrlBean
}
\ No newline at end of file
... ...
... ... @@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO';
* 底导(包含顶导列表)数据
*/
export interface BottomNavDTO {
backgroundUrl: string;
channelChooseActionUrl: string;
channelChooseCColor: string;
channelChooseColor: string;
channelMoreColor: string;
backgroundUrl: string; // 迭代四:页面背景图
channelChooseActionUrl: string; // 迭代四:频道选中下划线动画
channelChooseCColor: string; // 迭代四:频道未选中颜色
channelChooseColor: string; // 迭代四:频道选中颜色
channelMoreColor: string; // 迭代四:更多频道颜色
extraData: string;
homePageColor: string;
icon: string;
iconC: string;
homePageColor: string; // 迭代四:主页图标/文字颜色
icon: string; // 未选中图标
iconC: string; // 选中图标
id: number;
immersiveIconCUrl: string;
immersiveIconUrl: string;
immersiveNameCColor: string;
immersiveNameColor: string;
logoUrl: string;
immersiveIconCUrl: string; // 迭代二新增-图标颜色-选中(沉浸式频道)
immersiveIconUrl: string; // 迭代二新增-图标颜色-未选中(沉浸式频道)
immersiveNameCColor: string; // 迭代二新增-文字颜色-选中(沉浸式频道)
immersiveNameColor: string; // 迭代二新增-文字颜色-未选中(沉浸式频道)
logoUrl: string; // 迭代四:logo图片
morningAndEveningUrl: string;
name: string;
nameCColor: string;
nameColor: string;
nightIconCUrl: string;
nightIconUrl: string;
nightNameCColor: string;
nightNameColor: string;
noticeColor: string;
nameCColor: string; // 名字选中颜色
nameColor: string; // 名字颜色
nightIconCUrl: string; // 迭代三新增-图标颜色-选中(夜间模式)
nightIconUrl: string; // 迭代三新增-图标颜色-未选中(夜间模式)
nightNameCColor: string; // 迭代三新增-文字颜色-选中(夜间模式)
nightNameColor: string; // 迭代三新增-文字颜色-未选中(夜间模式)
noticeColor: string; // 迭代四:消息通知提醒颜色
pageId?: string;
pageType?: string;
searchBothColor: string;
searchUrl: string;
searchBothColor: string; // 迭代四:两侧文字图标颜色,搜索图标颜色
searchUrl: string; // 迭代四:搜索背景框
sortValue: number;
statusBarColor: number;
statusBarColor: number; // 迭代四:状态栏图标颜色,0:白色,1:黑色
topNavChannelList: TopNavDTO[];
topStyle: string;
type: string;
topStyle: string; // 顶部样式:中文的(11-新闻;12-人民号;13-视频;14-服务)
type: string; // 底部导航类型,1普通 2我的;【rmrb需要扩展】
fmorningAndEveningUrl: string; // 迭代四:早晚报背景框
dropDownAnimationColor: string; // 下拉加载动画颜色,1白色,2灰色。未配置值是null
}
\ No newline at end of file
... ...
... ... @@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO';
* 导航Body数据
*/
export interface NavigationBodyDTO {
backgroundColor: string;
backgroundColor: string; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavList: BottomNavDTO[];
// greyBottomNav: GreyBottomNav;
immersiveBackgroundColor: string;
nightBackgroundColor: string;
// greyBottomNav: GreyBottomNav; // 灰度皮肤
immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道)
nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式)
}
... ...
... ... @@ -7,14 +7,14 @@ export interface TopNavDTO {
channelType: number;
defaultPermitted: number;
delPermitted: number;
fontCColor: string;
fontColor: string;
fontCColor: string; // 频道展示样式颜色(选中状态)
fontColor: string; // 频道展示样式颜色(未选中状态)
headlinesOn: number;
homeChannel: string;
iconCUrl: string;
iconCUrlSize: string;
iconUrl: string;
iconUrlSize: string;
iconCUrlSize: string;
iconUrl: string; // 频道图片展示样式图片相对地址(未选中状态)
iconCUrl: string; //频道图片展示样式图片相对地址(选中状态
localChannel: string;
moreChannel: string;
movePermitted: number;
... ... @@ -23,5 +23,5 @@ export interface TopNavDTO {
num: number;
pageId: number;
pageType: string;
underlineCColor: string;
underlineCColor: string; // 选中下划线颜色
}
... ...
export class AttentionBatchDTO{
creators: CreatorDTO[];
constructor(creators: CreatorDTO[] = []) {
this.creators = creators
}
}
export class CreatorDTO {
attentionUserType: string;
attentionUserId: string;
attentionCreatorId: string;
constructor(attentionUserType: string, attentionUserId: string, attentionCreatorId: string) {
this.attentionUserType = attentionUserType
this.attentionUserId = attentionUserId
this.attentionCreatorId = attentionCreatorId
}
}
... ...
import { ContentDTO } from '../content/ContentDTO'
export interface PeopleShipContentListDTO {
followCreators: boolean;
hasNext: number;
list: ContentDTO[];
pageNum: number;
pageSize: number;
totalCount: number;
}
\ No newline at end of file
... ...
export interface RmhRecommendDTO {
authIcon: string;
authTitle: string;
authTitle2: string;
cnAttention: number;
cnMainControl: number;
creatorId: string;
fansNum: number;
headPhotoUrl: string;
introduction: string;
itemId: string;
itemType: string;
itemTypeCode: string;
posterShareControl: number;
region: string;
sceneId: string;
subSceneId: string;
traceId: string;
traceInfo: string;
userId: string;
userName: string;
userType: string;
}
... ...
... ... @@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent"
export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
... ...
... ... @@ -167,7 +167,7 @@ export struct AudioDetailComponent {
}
.layoutWeight(1)
OperRowListView()
// OperRowListView()
}
}
... ...
... ... @@ -9,6 +9,7 @@ import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow05 } from './compview/ZhSingleRow05';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
... ... @@ -23,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { CardAdvComponent } from './cardViewAdv/CardAdvComponent';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
/**
... ... @@ -44,49 +44,67 @@ export struct CompParser {
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
// if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
LiveHorizontalCardComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
if (compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
}
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
LiveHorizontalReservationComponent({ compDTO: compDTO })
ZhSingleRow03({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
ZhSingleRow05({ compDTO })
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ contentDTO: compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
ZhSingleColumn05({ compDTO: compDTO })
// ZhSingleColumn05({ compDTO: compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({compDTO})
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
else {
Text(compDTO.compStyle)
... ... @@ -97,10 +115,10 @@ export struct CompParser {
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
}
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}
// }
}
}
... ...
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,postBatchAttentionStatusParams,
PhotoListBean,
... ... @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base';
import { CommonConstants, SpConstants } from 'wdConstant/Index';
import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
import router from '@ohos.router';
import { publishCommentModel } from './comment/model/PublishCommentModel';
import { CommentComponent } from './comment/view/CommentComponent';
const TAG = 'DynamicDetailComponent'
@Preview
@Component
... ... @@ -44,12 +47,14 @@ export struct DynamicDetailComponent {
/**
* 关注状态:默认未关注 点击去关注
*/
@State followStatus: String = '0';
@State followStatus: String = '';
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined// 点赞、收藏状态
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
async aboutToAppear() {
await this.getContentDetailData()
}
... ... @@ -78,7 +83,7 @@ export struct DynamicDetailComponent {
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_7'))
.margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
.padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
... ... @@ -121,6 +126,7 @@ export struct DynamicDetailComponent {
}
.width('63%')
.margin({right: $r('app.float.margin_6')})
if(!StringUtils.isEmpty(this.followStatus)){
if (this.followStatus == '0') {
Text('关注')
.width($r('app.float.margin_54'))
... ... @@ -148,6 +154,7 @@ export struct DynamicDetailComponent {
})
}
}
}
.width('100%')
.margin({ left: $r('app.float.margin_16')})
//内容
... ... @@ -209,7 +216,7 @@ export struct DynamicDetailComponent {
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
} else {
GridCol({
... ... @@ -226,7 +233,7 @@ export struct DynamicDetailComponent {
})
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
}
} else if (this.contentDetailData.photoList.length === 4) {
... ... @@ -238,7 +245,7 @@ export struct DynamicDetailComponent {
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
} else {
GridCol({
... ... @@ -249,7 +256,7 @@ export struct DynamicDetailComponent {
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
}
})
... ... @@ -268,8 +275,8 @@ export struct DynamicDetailComponent {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.width(DisplayUtils.getDeviceWidth()- 32)
.height((DisplayUtils.getDeviceWidth()-32)* 9 / 16)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -284,7 +291,8 @@ export struct DynamicDetailComponent {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(CommonConstants.FULL_WIDTH)
.width(DisplayUtils.getDeviceWidth()/2)
.height(DisplayUtils.getDeviceWidth()/2* 4 / 3)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -292,7 +300,7 @@ export struct DynamicDetailComponent {
}
}
}
.margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
.padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 16,top: $r('app.float.margin_8')})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.mJumpInfo)
})
... ... @@ -330,9 +338,10 @@ export struct DynamicDetailComponent {
Image(this.newsStatusOfUser?.likeStatus == '1'?
$r('app.media.icon_like_selected_redheart')
:$r('app.media.icon_like_unselect_grey_redheart'))
.width($r('app.float.margin_24'))
.height($r('app.float.margin_24'))
.width($r('app.float.margin_36'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
.margin({ left: $r('app.float.margin_6_negative'),right: $r('app.float.margin_6_negative')})
if(this.interactDataDTO?.likeNum != 0){
Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
.fontColor($r('app.color.color_999999'))
... ... @@ -352,8 +361,22 @@ export struct DynamicDetailComponent {
//点赞操作
this.toggleLikeStatus()
})
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')})
CommentComponent({
publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
})
}
Blank().layoutWeight(1)
//fixme 评论组件
}
}
.width(CommonConstants.FULL_WIDTH)
... ... @@ -362,42 +385,19 @@ export struct DynamicDetailComponent {
.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)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
OperRowListView({ contentDetailData: this.contentDetailData
,interactData:this.interactDataDTO
,newsStatusOfUser:this.newsStatusOfUser
,publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
,needLike:false})
}
}
.alignSelf(ItemAlign.Start)
... ... @@ -430,12 +430,17 @@ export struct DynamicDetailComponent {
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData[0]?.newsId + '',
contentType: this.contentDetailData[0]?.newsType + '',
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
... ... @@ -453,6 +458,12 @@ export struct DynamicDetailComponent {
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
this.followStatus = '0';
return
}
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
... ... @@ -461,7 +472,7 @@ export struct DynamicDetailComponent {
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
this.followStatus = '0';
}
}
... ... @@ -558,8 +569,6 @@ export struct DynamicDetailComponent {
contentType: this.contentDetailData?.newsType + '',
}
ContentDetailRequest.postExecuteLike(params).then(res => {
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus === '1') {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
... ... @@ -567,9 +576,6 @@ export struct DynamicDetailComponent {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
// this.queryContentInteractCount()
}
})
}
}
... ...
import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit';
import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId, NetworkUtil } from 'wdKit';
import {
Action,
ContentDetailDTO,
... ... @@ -15,16 +15,18 @@ import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
import { OperRowListView } from './view/OperRowListView';
import { RecommendList } from '../components/view/RecommendList'
import { CommonConstants } from 'wdConstant';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { CommentComponent } from '../components/comment/view/CommentComponent'
import { HttpUtils } from 'wdNetwork/Index';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
const TAG = 'ImageAndTextPageComponent'
const TAG: string = 'ImageAndTextPageComponent'
@Component
export struct ImageAndTextPageComponent {
... ... @@ -36,6 +38,9 @@ export struct ImageAndTextPageComponent {
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
@State publishTime: string = ''
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State isNetConnected: boolean = true
build() {
Column() {
... ... @@ -80,21 +85,27 @@ export struct ImageAndTextPageComponent {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus === '1') {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') :
(this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
$r('app.media.icon_candle_active')))
.width(24)
.height(24)
.margin({ right: 5 })
} else {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') :
(this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') :
$r('app.media.icon_candle')))
.width(24)
.height(24)
.margin({ right: 5 })
}
Text(`${this.interactData?.likeNum || 0}`)
if (this.interactData?.likeNum != '0') {
Text(`${this.interactData?.likeNum}`)
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
.fontWeight(500)
}
}
.width(140)
.height(36)
.justifyContent(FlexAlign.Center)
... ... @@ -110,15 +121,18 @@ export struct ImageAndTextPageComponent {
}.width(CommonConstants.FULL_WIDTH).height(80)
.justifyContent(FlexAlign.Center)
Divider().strokeWidth(6).color('#f5f5f5')
}
if (this.recommendList.length > 0) {
Divider().strokeWidth(6).color('#f5f5f5')
RecommendList({ recommendList: this.recommendList })
}
// 评论
if(this.contentDetailData[0]?.openComment){
if (this.contentDetailData[0]?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
})
// .onMeasureSize()
}
}
}
... ... @@ -126,15 +140,32 @@ export struct ImageAndTextPageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.align(Alignment.Top)
if(!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
}
})
}else{
if (!this.isPageEnd) {
detailedSkeleton()
}
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
if (this.contentDetailData?.length) {
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
}
}
}
... ... @@ -143,6 +174,7 @@ export struct ImageAndTextPageComponent {
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
let contentId: string = ''
let relId: string = ''
let relType: string = ''
... ... @@ -162,7 +194,8 @@ export struct ImageAndTextPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
if (this.contentDetailData[0]?.recommendShow === 1) {
this.getRecommend()
... ... @@ -171,16 +204,28 @@ export struct ImageAndTextPageComponent {
this.getInteractDataStatus()
this.queryContentInteractCount()
}
if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
}
if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) {
this.operationButtonList = ['comment', 'collect', 'listen', 'share']
}
}
}
}
private async getRecommend() {
let params: postRecommendListParams = {
imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",
userId: HttpUrlUtils.getUserId(),
imei: HttpUtils.getImei(),
userId: HttpUtils.getUserId(),
contentId: String(this.contentDetailData[0]?.newsId),
recType: 1,
recType: Number(this.contentDetailData[0]?.reLInfo?.relType),
contentType: this.contentDetailData[0]?.newsType,
relId: this.contentDetailData[0]?.reLInfo?.relId,
channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
... ... @@ -215,7 +260,7 @@ export struct ImageAndTextPageComponent {
*/
toggleLikeStatus() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
if (!HttpUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
... ... @@ -258,6 +303,15 @@ export struct ImageAndTextPageComponent {
aboutToAppear() {
this.getDetail()
//注册通知,来自别的组件的评论成功通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
// 滚动到评论列表
}
}
})
}
aboutToDisappear() {
... ...
... ... @@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent';
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
import { BridgeWebViewControl } from 'wdJsBridge/Index';
const TAG: string = 'ImageAndTextWebComponent'
@Component
export struct ImageAndTextWebComponent {
action: Action = {} as Action
... ... @@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent {
// TODO 对接user信息、登录情况
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
creatorId: creatorId,
cnsTraceId: '',
isLogin: isLogin,
networkStatus: Number(NetworkUtil.isNetConnected()),
loadImageOnlyWifiSwitch: '2',
networkStatus: Number(NetworkUtil.isNetConnected()),
darkMode: 'light',
fontSizes: 'normalsize'
} as H5ReceiveDataExtraBean
let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
... ... @@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent {
this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
this.dataPrepared = true
this.trySendData2H5()
}
}
... ... @@ -114,7 +117,7 @@ export struct ImageAndTextWebComponent {
}
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData',JSON.stringify(h5ReceiveAppData));
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
JSON.stringify(h5ReceiveAppData), (data: string) => {
Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
... ...
... ... @@ -20,7 +20,7 @@ export struct ImageDownloadComponent {
@State image: PixelMap | undefined = undefined;
@State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例
@State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
url: string = ''
@Prop @Watch('onChangeUrl') url: string = ''
build() {
Column() {
... ... @@ -40,7 +40,11 @@ export struct ImageDownloadComponent {
}
async aboutToAppear(): Promise<void> {
aboutToAppear(): void {
this.onChangeUrl()
}
async onChangeUrl(): Promise<void> {
console.info(`cj2024 图片下载 ${this.url}`)
const context = getContext(this) as common.UIAbilityContext;
const atManager = abilityAccessCtrl.createAtManager();
... ...
import { PhotoListBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { display, router } from '@kit.ArkUI';
import { ImageDownloadComponent } from './ImageDownloadComponent';
import { ImageItemView } from './view/ImageItemView';
const TAG = 'ImageSwiperComponent';
@Component
export struct ImageSwiperComponent {
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private scroller: Scroller = new Scroller()
@State swiperIndex: number = 0;
photoList: PhotoListBean[] = [];
private swiperController: SwiperController = new SwiperController()
private displayTool = display.getDefaultDisplaySync()
private screenWidth: number = 0
private picWidth: number = 0
@State picHeight: number = 0
@State isEnableSwipe: boolean = true;
// @Provide bgc: Color = Color.White;
//watch监听页码回调
onCurrentPageNumUpdated(): void {
Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)
let _swiperIndex = Number.parseInt(this.currentPageNum)
Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
}
aboutToAppear(): void {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
// this.picWidth = this.screenWidth - vp2px(52)
this.picWidth = this.screenWidth
this.picHeight = this.picWidth * 578 / 375
}
build() {
RelativeContainer() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
router.back();
})
.id("backImg")
if (this.photoList && this.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.photoList, (item: PhotoListBean) => {
// MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })
})
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
})
Row() {
Scroll(this.scroller) {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.photoList.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}.fontColor(Color.White).margin(4)
}
}
.width('100%')
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
}
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath })
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End }
})
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
.id("downloadImg")
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
}
\ No newline at end of file
... ... @@ -152,6 +152,8 @@ export struct MorningEveningPaperComponent {
if (imageSource) {
this.pickColor(imageSource)
} else {
this.mixedBgColor = this.pageInfoBean.backgroundColor
}
}
... ... @@ -168,6 +170,11 @@ export struct MorningEveningPaperComponent {
}
}
async aboutToDisappear() {
let windowHight: window.Window = await window.getLastWindow(getContext(this));
await windowHight.setWindowLayoutFullScreen(false);
}
onPageHide() {
this.status = PlayerConstants.STATUS_PAUSE;
this.playerController?.pause();
... ...
... ... @@ -21,7 +21,7 @@ export struct MultiPictureDetailItemComponent {
.alt($r('app.media.picture_loading'))
.width(this.imageWidth)
.aspectRatio(this.ratio)
.objectFit(ImageFit.Fill)
.objectFit(ImageFit.Contain)
.interpolation(ImageInterpolation.High)
.onComplete(event => {
this.imageWidth = '100%'
... ...
import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit';
import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel} from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -12,6 +12,8 @@ import display from '@ohos.display';
import font from '@ohos.font';
import { OperRowListView } from './view/OperRowListView';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { ImageDownloadComponent } from '../components/ImageDownloadComponent';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from './view/EmptyComponent';
import { DateTimeUtils } from 'wdKit/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
... ... @@ -37,9 +39,11 @@ export struct MultiPictureDetailPageComponent {
private swiperController: SwiperController = new SwiperController()
private swiperControllerItem: SwiperController = new SwiperController()
@State swiperIndex: number = 0;
@Provide followStatus: string = '0' // 关注状态
@Provide followStatus: string | undefined = undefined // 关注状态
private scroller: Scroller = new Scroller()
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State showDownload: Boolean = false // 控制是否显示下载默认隐藏
@State publishCommentModel: publishCommentModel = new publishCommentModel()
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -78,42 +82,19 @@ export struct MultiPictureDetailPageComponent {
build() {
RelativeContainer() {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
Swiper(this.swiperControllerItem) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
this.init()
}
.width('100%')
.height('100%')
.vertical(true)
.autoPlay(false)
.cachedCount(1)
.indicator(false)
.displayCount(1)
.onAnimationEnd(event => {
router.back()
})
})
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.loop(false)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
})
@Builder
init() {
if (this.contentDetailData.rmhPlatform == 1) {
Row() {
Row({ space: 8 }) {
... ... @@ -154,6 +135,7 @@ export struct MultiPictureDetailPageComponent {
.height(14)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin(0)
.maxLines(1)
}
}
.width('81%')
... ... @@ -168,8 +150,8 @@ export struct MultiPictureDetailPageComponent {
right: 0
})
if (this.followStatus == '0') {
Row() {
if (this.followStatus == '0') {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Text('+关注').fontSize(12).fontColor(0xffffff)
... ... @@ -182,21 +164,87 @@ export struct MultiPictureDetailPageComponent {
.onClick(() => {
this.handleAccention()
})
} else {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Text('已关注').fontSize(12).fontColor(0xffffff)
}.alignItems(VerticalAlign.Center)
}
.borderRadius(4)
.backgroundColor('#B0B0B0')
.width(48)
.height(24)
}
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('21.6%')
.height('100%')
}
}
.width('100%')
.height(44)
.zIndex(10)
.alignRules({
top: { anchor: "e_swiper_content", align: VerticalAlign.Top },
middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center }
top: { anchor: "__container__", align: VerticalAlign.Top },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('e_attention')
}
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
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)
.width('100%')
.height('100%')
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.loop(false)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.zIndex(1)
.onChange((index: number) => {
this.swiperIndex = index
})
.onClick(() => {
this.showDownload = !this.showDownload
})
}
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 }
})
}
Column(){
Column(){
Row() {
Scroll(this.scroller) {
Row() {
... ... @@ -210,12 +258,14 @@ export struct MultiPictureDetailPageComponent {
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.contentDetailData.photoList.length}`)
Span(`/${this.contentDetailData?.photoList?.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}.fontColor(Color.White).margin(4)
}
.fontColor(Color.White)
.margin(4)
Text(`${this.contentDetailData.newsTitle}`)
.fontColor(Color.White)
... ... @@ -246,62 +296,61 @@ export struct MultiPictureDetailPageComponent {
}
}
.width('100%')
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.height(px2vp(this.titleHeight))
}
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.height(px2vp(this.titleHeight) + 64)
}
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 }
})
.align(Alignment.Bottom)
}
OperRowListView({
contentDetailData: this.contentDetailData,
})
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
publishCommentModel: this.publishCommentModel,
})
.width('100%')
.height(56)
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
}
.visibility(!this.showDownload ? Visibility.Visible : Visibility.None)
Column(){
Row() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween
}) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.contentDetailData?.photoList?.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}
.fontColor(Color.White)
.margin(4)
ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath })
.margin({
top: 16,
left: 16,
right: 16,
bottom: 0
top: 8,
left: 18,
bottom: 24,
right: 18
})
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
.id('e_oper_row')
}
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
.visibility(this.showDownload ? Visibility.Visible : Visibility.None)
}
.zIndex(10)
.id('e_swiper_bottom')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
getContentDetailData() {
... ... @@ -318,6 +367,20 @@ export struct MultiPictureDetailPageComponent {
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
if (this.contentDetailData.rmhPlatform == 1) {
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
}
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
... ...
import { Action, H5ReceiveDetailBean } from 'wdBean';
import { Action, H5ReceiveDetailBean, ContentDetailDTO } from 'wdBean';
import { WdWebComponent } from 'wdWebComponent';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge/Index';
import { detailedSkeleton } from './skeleton/detailSkeleton'
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
const TAG = 'SpacialTopicPageComponent'
import { OperRowListView } from './view/OperRowListView';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
const TAG: string = 'SpacialTopicPageComponent'
@Component
export struct SpacialTopicPageComponent {
... ... @@ -14,9 +18,11 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
... ... @@ -37,11 +43,42 @@ export struct SpacialTopicPageComponent {
})
}
private async getDetail() {
let contentId: string = ''
let relId: string = ''
let relType: string = ''
if (this.action && this.action.params) {
if (this.action.params.contentID) {
contentId = this.action.params.contentID;
}
if (this.action && this.action.params && this.action.params.extra) {
if (this.action.params.extra.relId) {
relId = this.action.params.extra.relId;
}
if (this.action.params.extra.relType) {
relType = this.action.params.extra.relType
}
}
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
}
this.trySendData2H5()
}
}
}
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
}
Stack({ alignContent: Alignment.Bottom }) {
Column() {
WdWebComponent({
... ... @@ -52,62 +89,25 @@ export struct SpacialTopicPageComponent {
isPageEnd: $isPageEnd
})
}
.padding({ bottom: 56 })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
if (!this.isPageEnd) {
detailedSkeleton()
}
//底部交互区
Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel
})
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)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 20, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
.backgroundColor(Color.White)
}
aboutToAppear() {
let action: Action = router.getParams() as Action
if (action) {
this.webUrl = action.params?.url || ''
if (this.action) {
this.webUrl = this.action.params?.url || ''
}
this.trySendData2H5()
}
aboutToDisappear() {
this.getDetail()
}
}
\ No newline at end of file
... ...
... ... @@ -30,7 +30,7 @@ export struct LiveFollowComponent {
Stack() {
Stack()
.height(22)
.width(130)
.width(150)
.backgroundColor('#000000')
.opacity(0.3)
.borderRadius({
... ... @@ -71,7 +71,7 @@ export struct LiveFollowComponent {
})
}
.height(22)
.width(130)
.width(150)
}
}
... ...
... ... @@ -3,10 +3,12 @@
*/
import { RmhInfoDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit';
@Component
export struct RmhTitle {
@Prop rmhInfo: RmhInfoDTO
@Prop publishTime: string | undefined
build() {
Flex() {
... ... @@ -29,6 +31,15 @@ export struct RmhTitle {
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.alignSelf(ItemAlign.Start)
Row() {
if (this.publishTime) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
Image($r('app.media.point'))
.width(16)
.height(16)
}
Text(this.rmhInfo.rmhDesc)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
... ... @@ -36,6 +47,7 @@ export struct RmhTitle {
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
}
Blank()
if (this.rmhInfo.cnIsAttention) {
... ...
import { CompStyle } from 'wdConstant';
import { CompDTO } from 'wdBean';
import { CardAdvComponent } from './CardAdvComponent';
import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent';
import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent';
import { CardAdvLongImageComponent } from './CardAdvLongImageComponent';
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -17,28 +15,39 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvBigImageComponent {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//新闻标题
Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
//大图
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.width(CommonConstants.FULL_WIDTH)
CardAdvBottom().margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.width('100%')
.lineHeight(25)
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean/Index';
/**
* @Description: 广告稿件 底部标签+删除按钮
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvBottom {
@State compDTO: CompDTO = {} as CompDTO;
build() {
Row() {
Text($r('app.string.comp_advertisement')).fontSize('12fp').fontColor($r('app.color.color_B0B0B0'))
Blank()
Stack() {
Image($r('app.media.comp_adv_close'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.borderWidth(0.5)
.borderColor($r('app.color.color_EDEDED'))
.borderRadius(4)
}.width('100%')
}
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
const TAG: string = 'Card2Component';
/**
* @Description: 类描述
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@Component
export struct CardAdvComponent {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
... ... @@ -17,44 +19,184 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvGanMiComponent {
@State compDTO: CompDTO = {} as CompDTO
@State advExtraData: AdvExtraData = {} as AdvExtraData
@State advLength: number = 0;
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
let extraData = this.compDTO.matInfo.extraData
let labelDTO = JSON.parse(extraData) as AdvExtraData
this.advExtraData = labelDTO
//this.advExtraData.item = [this.advExtraData.item[0]]
// this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国"
this.advLength = this.advExtraData.item.length
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
Row() {
Stack() {
//长图
Image(this.advExtraData.itemTopImage)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(343 / 40)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
// 广告标签和删除功能
Row() {
Text($r('app.string.comp_advertisement'))
.fontSize('10fp')
.fontColor($r('app.color.white'))
.width(28)
.height(16)
.backgroundColor('#4D000000')
.borderRadius(3)
.textAlign(TextAlign.Center)
Blank()
Stack() {
Image($r('app.media.comp_adv_close_white'))
.width(9)
.height(9)
.borderRadius({
topLeft: '4vp',
topRight: '4vp',
bottomLeft: '4vp',
bottomRight: '4vp'
})
}
.width(18)
.height(14)
.backgroundColor('#4D000000')
.borderWidth(0.5)
.borderColor($r('app.color.white'))
.borderRadius(3)
}.width('100%').padding({
top: 8,
left: 8,
right: 8
})
}
.alignContent(Alignment.Top)
.width(CommonConstants.FULL_WIDTH)
}.width('100%').padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
})
//
List({ space: 8 }) {
ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
ListItem() {
// 广告列表信息
Column() {
Image(content.image)
.width('100%')
.aspectRatio(150 / 84)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderRadius(4)
Text(content.title)
.fontSize('16fp')
.fontColor($r('app.color.color_222222'))
.fontSize('15fp')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.lineHeight(20)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
.margin({ top: 8 })
}.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: content.linkUrl,
linkType: content.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}
})
}
.width('100%')
.listDirection(Axis.Horizontal)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.contentStartOffset(this.advLength == 1 ? 0 : 16)
.contentEndOffset(this.advLength == 1 ? 0 : 16)
.margin({ top: 10, bottom: 10 })
.padding({
left: this.advLength == 1 ? 16 : 0,
right: this.advLength == 1 ? 16 : 0,
})
// 更多按钮
commonButton(this.advExtraData)
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
/*
标题样式
*/
@Builder
function commonButton(advExtraData: AdvExtraData) {
Row() {
Row() {
Blank()
Text('查看更多').fontColor('#222222').fontSize('14fp')
Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
Blank()
}
.width('100%')
.backgroundColor('#F5F5F5')
.borderRadius(3)
.padding({ top: 10, bottom: 10, })
.onClick(() => {
let matInfo: CompAdvMatInfoBean = {
linkUrl: advExtraData.itemMore.linkUrl,
linkType: advExtraData.itemMore.linkType
} as CompAdvMatInfoBean;
ProcessUtils.openAdvDetail(matInfo)
})
}.width('100%').padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
})
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -18,27 +19,43 @@ const TAG: string = 'Card2Component';
@Component
export struct CardAdvLongImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State haveTitle : boolean = true
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//新闻标题
if(this.haveTitle ){
Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
}
//长图
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(343 / 96)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
CardAdvBottom().margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.lineHeight(25)
}
\ No newline at end of file
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CompDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
const TAG: string = 'Card2Component';
import measure from '@ohos.measure';
import { DisplayUtils } from 'wdKit/Index';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'CardAdvSmallImageComponent';
/**
* @Description: 广告---小图卡
... ... @@ -17,30 +18,71 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvSmallImageComponent {
@State compDTO: CompDTO = {} as CompDTO
@State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '----小图卡----aboutToAppear-----')
// 计算标题文本行数
let screenWith = DisplayUtils.getDeviceWidth();
screenWith = screenWith * 0.62
let titleNameLineNum = this.getTextLineNum(this.compDTO.matInfo.advTitle, screenWith, 25, 18)
this.isBigThreeLine = titleNameLineNum >= 3;
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '---小图卡-----aboutToDisappear-----')
}
build() {
Column() {
RelativeContainer() {
// 广告标题
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.lineHeight(25)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.width('62%')
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start },
})
.id("title_name")
// 广告图
Image(this.compDTO.matInfo.matImageUrl[0])
.width('34%')
.aspectRatio(3 / 2)
.id('adv_imag')
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.borderRadius(4)
//.alt('wwww.baidu.com')
.alignRules({
top: { anchor: 'title_name', align: VerticalAlign.Top },
left: { anchor: 'title_name', align: HorizontalAlign.End },
})
.margin({ left: 12 })
CardAdvBottom().width('62%').id('bottom_adv').alignRules({
bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
left: { anchor: this.isBigThreeLine ? 'title_name' : '', align: HorizontalAlign.Start },
}).margin({
right: this.isBigThreeLine ? 0 : 12,
top: this.isBigThreeLine ? 8 : 0,
})
}
.width(CommonConstants.FULL_WIDTH)
.width("100%")
.height(this.isBigThreeLine ? 127 : 106)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
... ... @@ -48,13 +90,31 @@ export struct CardAdvSmallImageComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
// 获取文本几行
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height) / lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
return measure.measureTextSize({
textContent: text,
fontSize: fontSize,
lineHeight: lineHeight,
constraintWidth: constraintWidth,
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
... ...
... ... @@ -4,6 +4,7 @@ import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -17,28 +18,62 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvThreeImageComponent {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '---三图卡-----aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '----三图卡----aboutToDisappear-----')
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
//三图
Row() {
GridRow({ gutter: 2 }) {
ForEach(this.compDTO.matInfo.matImageUrl, (url: string, index: number) => {
if (index < 3) {
GridCol({ span: { xs: 4 } }) {
Image(url)
.width('100%')
.aspectRatio(113 / 75)
.borderRadius({
topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
topRight: index === 2 ? $r('app.float.image_border_radius') : 0,
bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0,
})
.borderColor($r('app.color.color_0D000000'))
}
}
})
}
}
.width(CommonConstants.FULL_PARENT)
.margin({ top: 8 })
// 广告工具组件
CardAdvBottom().width('100%').margin({ top: 8 })
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -47,9 +82,6 @@ export struct CardAdvThreeImageComponent {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
})
}
}
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ... @@ -17,28 +18,48 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct CardAdvVideoComponent {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = {} as ContentDTO
aboutToAppear(): void {
console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
console.error('ZZZXXXXX', '--------aboutToAppear-----')
// this.contentDTO.objectType = '1'
// this.contentDTO.videoInfo = { videoDuration: 1000 } as VideoInfoDTO
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '---视频广告-----aboutToDisappear-----')
}
build() {
Column() {
Text(this.compDTO.matInfo.advTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
//新闻标题
Text(this.compDTO.matInfo.advTitle).bottomTextStyle()
//大图
Stack() {
Image(this.compDTO.matInfo.matImageUrl[0])
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius(4)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
//播放状态+时长
CardMediaInfo({
contentDTO: this.contentDTO
})
}
.alignContent(Alignment.BottomEnd)
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
CardAdvBottom().margin({
top: 8,
})
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -48,13 +69,21 @@ export struct CardAdvVideoComponent {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
//ProcessUtils.processPage(this.contentDTO)
ProcessUtils.openAdvDetail(this.compDTO.matInfo)
})
}
}
/*
标题样式
*/
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
.fontSize('18fp')
.fontColor($r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.align(Alignment.Start)
.width('100%')
.lineHeight(25)
}
\ No newline at end of file
... ...