王士厅
Showing 77 changed files with 1697 additions and 1014 deletions

Too many changes to show.

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

... ... @@ -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:顶部长通栏广告
/**
* 本地稿件和组件样式
... ...
... ... @@ -11,6 +11,15 @@ export enum EmitterEventId {
// 跳转首页指定频道,事件id
JUMP_HOME_CHANNEL = 4,
LOCATION = 5
LOCATION = 5,
/*发布评论*/
COMMENT_PUBLISH = 6,
// 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
... ...
... ... @@ -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,5 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils"
export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil"
export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager"
... ...
import { SpConstants } from 'wdConstant';
import { SPHelper, StringUtils } from 'wdKit';
import { HostEnum, HostManager } from './HttpHostManager';
/**
* 网络请求参数工具类
*/
export class HttpParams {
private static userId = ''
private static userType = ''
private static token = ''
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)'
headers['channel'] = HttpParams.getChannel()
headers['plat'] = HttpParams.getPlat()
headers['Content-Type'] = 'application/json; charset=utf-8'
headers['timestamp'] = HttpParams.getTimestamp()
headers['RMRB-X-TOKEN'] = HttpParams.getXToken()
headers['device_id'] = HttpParams.getDeviceId()
if (HttpParams.getXToken() != '') {
headers['cookie'] = 'RMRB-X-TOKEN=' + HttpParams.getXToken()
}
headers['build_version'] = HttpParams.getVersion()
headers['adcode'] = HttpParams.getAdCode()
headers['os_version'] = HttpParams.getOsVersion()
headers['versionCode'] = HttpParams.getVersionCode()
headers['system'] = HttpParams.getTerminalId()
headers['version_name'] = HttpParams.getVersionName()
headers['EagleEye-TraceID'] = 'D539562E48554A60977AF4BECB6D6C7A'
headers['imei'] = HttpParams.getImei()
headers['Accept-Language'] = 'zh'
HttpParams.setLocationHeader(headers)
// // TODO 判断是否登录
headers['userId'] = HttpParams.getUserId()
headers['userType'] = HttpParams.getUserType()
//
headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
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
}
}
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 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(HttpParams.token)) {
return HttpParams.token
}
HttpParams.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
if (StringUtils.isNotEmpty(HttpParams.token)) {
return HttpParams.token
}
// return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
return ''
}
static getRefreshToken(): string {
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';
}
private static getTerminalId() {
return 'Android';
}
public static getImei() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
}
public static getUserId(): string {
// TODO 对接登录
if (StringUtils.isNotEmpty(HttpParams.userId)) {
return HttpParams.userId
}
HttpParams.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
return HttpParams.userId;
}
public static getUserType() {
if (StringUtils.isNotEmpty(HttpParams.userType)) {
return HttpParams.userType
}
HttpParams.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string
return HttpParams.userType;
}
public static setUserId(userId: string) {
HttpParams.userId = userId;
}
public static setUserType(userType: string) {
HttpParams.userType = userType;
}
public static setUserToken(token: string) {
HttpParams.token = token;
}
}
\ 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)) {
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 { HostEnum, HostManager } from './HttpHostManager';
/**
* 网络请求业务侧工具类
*/
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";
... ... @@ -293,21 +278,14 @@ 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 = ''
... ... @@ -354,24 +332,24 @@ export class HttpUrlUtils {
}
static addSpecialHeaders(headers: HashMap<string, string>) {
switch (HttpUrlUtils._hostUrl) {
case HttpUrlUtils.HOST_UAT:
switch (HostManager.getHost()) {
case HostEnum.HOST_UAT:
// TODO 待优化到常量类里
headers.set('X-Ca-Stage', 'PRE');
headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');
headers.set('appCode', '83092caa603a421aa0222308b3f6b27a');
break
case HttpUrlUtils.HOST_SIT:
case HostEnum.HOST_SIT:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');
headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07');
break
case HttpUrlUtils.HOST_PRODUCT:
case HostEnum.HOST_PRODUCT:
headers.set('X-Ca-Stage', 'RELEASE');
headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');
headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6');
break
case HttpUrlUtils.HOST_DEV:
case HostEnum.HOST_DEV:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');
headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9');
... ... @@ -392,8 +370,8 @@ export class HttpUrlUtils {
}
}
static getHost() {
return HttpUrlUtils._hostUrl;
static getHost(): string {
return HostManager.getHost();
}
private static getCity() {
... ... @@ -487,7 +465,7 @@ export class HttpUrlUtils {
return 'Android';
}
public static getImei() {
public static getImei() {
// TODO
return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
}
... ... @@ -510,48 +488,48 @@ export class HttpUrlUtils {
}
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,308 +539,315 @@ 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 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() + "/api/rmrb-contact/contact/zh/c/v2/content/interactData";
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;
}
... ...
// 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 { HttpRequest } from '../http/HttpRequest';
const TAG: string = '[HttpUtils]'
export class HttpUtils {
static buildHeaders(): Record<string, string> {
let timestamp: number = new Date().getTime(); // 单位毫秒
// let clientId = DeviceUtil.clientId()
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"] = ''; // 运营商信息
// 设备信息请求头
// 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校验
// 签名相关请求头
headers["timeStamp"] = timestamp + ''; // 服务端时间戳(毫秒):1701667763664
headers["signType"] = 'RSA'; // 签名类型,固定RSA
/**
* 添加公共参数,如登录后,添加登录信息
*/
static addCommonHeader() {
HttpRequest.addGlobalHeaderProvider(() => {
let headers: Record<string, string> = {};
return headers;
})
}
// 业务请求头
// headers["promotionID"] = '54b0f421-a6df-41d3-9be2-92820b2c5d8c'; // 促销Id todo
// headers["tenantId"] = ''; // 租户Id
/**
* 添加公共参数,如登出后,移除登录信息
*/
static removeCommonHeader() {
// 添加其他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;
}
}
// export default new HttpUtils()
}
\ 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)
}
}
... ...
import HashMap from '@ohos.util.HashMap';
import { Callback } from 'wdJsBridge';
import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger } from 'wdKit';
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, PhotoListBean } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
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,15 +90,15 @@ 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) {
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 = {
... ... @@ -109,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
ProcessUtils.gotoMultiPictureListPage(photoList, swiperIndex)
}
break;
case '5':
... ... @@ -182,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 HashMap from '@ohos.util.HashMap';
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 headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
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, headers).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)
... ...
... ... @@ -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
... ...
... ... @@ -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
... ...
... ... @@ -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; // 选中下划线颜色
}
... ...
... ... @@ -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"
... ...
... ... @@ -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';
/**
... ... @@ -60,7 +60,7 @@ export struct CompParser {
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
LiveHorizontalReservationComponent({ compDTO: compDTO })
ZhSingleRow03({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
... ...
... ... @@ -44,9 +44,9 @@ 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;
... ... @@ -121,31 +121,33 @@ export struct DynamicDetailComponent {
}
.width('63%')
.margin({right: $r('app.float.margin_6')})
if (this.followStatus == '0') {
Text('关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
this.handleAccention()
})
} else {
Text('已关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
})
if(!StringUtils.isEmpty(this.followStatus)){
if (this.followStatus == '0') {
Text('关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
this.handleAccention()
})
} else {
Text('已关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
})
}
}
}
.width('100%')
... ... @@ -209,7 +211,7 @@ export struct DynamicDetailComponent {
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
} else {
GridCol({
... ... @@ -226,7 +228,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 +240,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 +251,7 @@ export struct DynamicDetailComponent {
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
}
})
... ... @@ -330,8 +332,8 @@ 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)
if(this.interactDataDTO?.likeNum != 0){
Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
... ... @@ -430,12 +432,18 @@ export struct DynamicDetailComponent {
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
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,16 +461,23 @@ export struct DynamicDetailComponent {
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
this.followStatus = '0';
return
}
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
this.followStatus = '0';
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
}
}
//创建跳转信息
... ... @@ -558,18 +573,13 @@ 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
} else {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
// this.queryContentInteractCount()
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus === '1') {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
} else {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
})
}
}
... ...
... ... @@ -24,7 +24,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
const TAG = 'ImageAndTextPageComponent'
const TAG: string = 'ImageAndTextPageComponent'
@Component
export struct ImageAndTextPageComponent {
... ... @@ -90,20 +90,22 @@ export struct ImageAndTextPageComponent {
.height(24)
.margin({ right: 5 })
}
Text(`${this.interactData?.likeNum || 0 }`)
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
.fontWeight(500)
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)
.alignItems(VerticalAlign.Center)
.borderRadius(20)
// .border({
// width: 1,
// color: '#EDEDED',
// })
.border({
width: 1,
color: '#EDEDED',
})
.onClick(() => {
this.toggleLikeStatus()
})
... ... @@ -118,7 +120,9 @@ export struct ImageAndTextPageComponent {
}
// 评论
if(this.contentDetailData[0]?.openComment){
// CommentComponent({
//
// })
}
}
}
... ... @@ -126,7 +130,7 @@ export struct ImageAndTextPageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
if (!this.isPageEnd) {
... ... @@ -134,7 +138,9 @@ export struct ImageAndTextPageComponent {
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
if (this.contentDetailData?.length) {
OperRowListView({contentDetailData: this.contentDetailData[0]})
}
}
}
... ...
... ... @@ -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()
}
}
... ...
... ... @@ -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
... ... @@ -168,6 +168,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();
... ...
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';
const TAG: string = 'SpacialTopicPageComponent'
@Component
export struct SpacialTopicPageComponent {
... ... @@ -14,6 +17,7 @@ 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;
... ... @@ -37,11 +41,33 @@ 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;
this.trySendData2H5()
}
}
}
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
}
Stack({ alignContent: Alignment.Bottom }) {
Column() {
WdWebComponent({
... ... @@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent {
isPageEnd: $isPageEnd
})
}
.padding({ bottom: 56 })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
//底部交互区
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)
}
if (!this.isPageEnd) {
detailedSkeleton()
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 20, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
}
}.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
... ...
import { CompStyle } from 'wdConstant';
import { CompDTO } from 'wdBean';
import { CardAdvComponent } from './CardAdvComponent';
import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent';
import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent';
import { CardAdvLongImageComponent } from './CardAdvLongImageComponent';
... ...
... ... @@ -22,12 +22,12 @@ export struct CardAdvBigImageComponent {
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----')
}
build() {
... ...
//全标题 "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
... ... @@ -22,12 +22,12 @@ export struct CardAdvGanMiComponent {
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----')
}
build() {
... ...
... ... @@ -22,12 +22,12 @@ export struct CardAdvLongImageComponent {
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----')
}
build() {
... ...
//全标题 "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';
/**
* @Description: 广告---小图卡
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
import measure from '@ohos.measure';
import { DisplayUtils } from 'wdKit/Index';
const TAG: string = 'CardAdvSmallImageComponent';
/**
* @Description: 广告---小图卡
* @Author:
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
@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)
.borderRadius(4)
.id('adv_imag')
.alignRules({
top: { anchor: 'title_name', align: VerticalAlign.Top },
left: { anchor: 'title_name', align: HorizontalAlign.End },
})
.margin({ left: 12 })
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('62%').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 },
}).id('bottom_adv').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 +107,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')
}
\ No newline at end of file
}
... ...
... ... @@ -22,12 +22,12 @@ export struct CardAdvThreeImageComponent {
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '---三图卡-----aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '----三图卡----aboutToDisappear-----')
}
build() {
... ...
... ... @@ -22,12 +22,12 @@ export struct CardAdvVideoComponent {
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '---视频广告-----aboutToDisappear-----')
}
build() {
... ...
... ... @@ -22,12 +22,12 @@ export struct CardAdvVideoExComponent {
aboutToAppear(): void {
console.error('ZZZXXXXX', '--------aboutToAppear-----')
console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
}
aboutToDisappear(): void {
console.error('ZZZXXXXX', '--------aboutToDisappear-----')
console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----')
}
build() {
... ...
... ... @@ -102,7 +102,7 @@ export struct Card19Component {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
ProcessUtils.gotoMultiPictureListPage(photoList,0)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
... ...
... ... @@ -104,6 +104,9 @@ struct createImg {
}
.align(Alignment.BottomEnd)
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoVod(this.contentDTO)
})
} else {
// 竖图显示,宽度占50%,高度自适应
GridCol({
... ...
import { commentItemModel } from './CommentModel'
@Observed
export class publishCommentModel {
... ... @@ -25,7 +27,7 @@ export class publishCommentModel {
/*评论内容*/
commentContent: string = ""
/*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/
commentType: string = '1'
commentType: string = '2'
/*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/
rootCommentId: string = "-1"
/*父评论id,如果是其它评论的回复,该字段必填*/
... ... @@ -35,6 +37,10 @@ export class publishCommentModel {
//可选
placeHolderText: string = "优质评论会获得最佳评论人的称号"
//最新发布的评论
lastCommentModel: commentItemModel = new commentItemModel()
}
... ...
import ArrayList from '@ohos.util.ArrayList'
import { ViewType } from 'wdConstant/Index';
import { DateTimeUtils, LazyDataSource } from 'wdKit/Index';
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index';
import PageModel from '../../../viewmodel/PageModel';
import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel'
... ... @@ -9,6 +9,7 @@ import measure from '@ohos.measure'
import { CommentCustomDialog } from './CommentCustomDialog'
import { publishCommentModel } from '../model/PublishCommentModel';
import { ifaa } from '@kit.OnlineAuthenticationKit';
import { HttpUrlUtils } from 'wdNetwork/Index';
const TAG = 'CommentComponent';
... ... @@ -18,18 +19,13 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
@Preview
@Component
export struct CommentComponent {
// @State private browSingModel: commentListModel = new commentListModel()
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
... ... @@ -37,12 +33,23 @@ export struct CommentComponent {
aboutToAppear() {
//注册通知,来自别的组件的评论成功通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
//新增评论
this.addCommentLocal()
}
}
})
this.dialogController = new CustomDialogController({
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
this.addCommentLocal()
},
publishCommentModel:this.publishCommentModel
publishCommentModel: this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
... ... @@ -57,6 +64,24 @@ export struct CommentComponent {
}
//
addCommentLocal() {
let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
/*一级评论*/
if (this.publishCommentModel.lastCommentModel.parentId == '-1') {
this.allDatas.addFirstItem(model)
//TODO 跳转顶部
}else{
//二级评论
this.allDatas.getDataArray().forEach(element => {
if (element.id == this.publishCommentModel.lastCommentModel.rootCommentId) {
element.childCommentsLazyDataSource.addFirstItem(model)
}
});
}
}
/*标题:全部评论*/
@Builder
titleHeader() {
... ... @@ -73,6 +98,11 @@ export struct CommentComponent {
}
.margin({ left: 16 })
.onClick(()=>{
// this.allDatas.push(new commentItemModel())
// this.allDatas.addFirstItem(new commentItemModel())
// this.allDatas.reloadData();
})
}.height(44)
.width('100%')
... ... @@ -92,7 +122,11 @@ export struct CommentComponent {
/*查看更多和收起*/
@Builder
GroupFooterView(item: commentItemModel, index: number) {
footerExpandedView({ item: item, contentId: this.publishCommentModel.targetId, contentType: this.publishCommentModel.targetType })
footerExpandedView({
item: item,
contentId: this.publishCommentModel.targetId,
contentType: this.publishCommentModel.targetType
})
}
build() {
... ... @@ -114,7 +148,7 @@ export struct CommentComponent {
.onClick(() => {
console.log(TAG)
})
})
},(childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString())
}
} else {
ListItemGroup({ header: this.CommentHeaderItem(item, index) }) {
... ... @@ -129,29 +163,31 @@ export struct CommentComponent {
.onClick(() => {
console.log(TAG)
})
})
},(childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString())
}
}
})
},(item: commentItemModel, index: number) => JSON.stringify(item) + index.toString())
}.layoutWeight(1)
}
}
//获取数据
async getData() {
commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType).then(commentListModel => {
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
commentListModel.list.forEach(element => {
element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
let newModel = commentViewModel.deepCopyCommentItemModel(element)
// newModel.targetId = this.publishCommentModel.targetId
// newModel.targetType = this.publishCommentModel.targetType
this.allDatas.push(newModel)
});
commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType)
.then(commentListModel => {
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
commentListModel.list.forEach(element => {
element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
let newModel = commentViewModel.deepCopyCommentItemModel(element)
// 点赞用
newModel.targetId = this.publishCommentModel.targetId
newModel.targetType = this.publishCommentModel.targetType
this.allDatas.push(newModel)
});
}
})
}
})
}
}
... ... @@ -243,6 +279,8 @@ struct ChildCommentItem {
})
.margin({ left: 95, right: 16, top: -5 })
.onClick(() => {
this.publishCommentModel.rootCommentId = this.item.rootCommentId
this.publishCommentModel.parentId = this.item.id
this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':'
... ...
import { inputMethodEngine } from '@kit.IMEKit'
import { commentInfo } from 'wdBean/Index'
import { commentItemModel } from '../model/CommentModel'
import { publishCommentModel } from '../model/PublishCommentModel'
import commentViewModel from '../viewmodel/CommentViewModel'
... ... @@ -22,9 +24,10 @@ export struct CommentCustomDialog {
let bean: Record<string, string> = {};
// this.publishCommentModel.commentContent = this.commentText
//TODO 判断类型
this.publishCommentModel.commentType = '1'
commentViewModel.publishComment(this.publishCommentModel).then(() => {
this.publishCommentModel.commentType = '2'
commentViewModel.publishComment(this.publishCommentModel).then((model:commentItemModel) => {
this.publishCommentModel.commentContent = ''
this.publishCommentModel.lastCommentModel = model
// this.commentText = ''
if (this.controller != null) {
this.controller.close()
... ...
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
import { CommentCustomDialog } from './CommentCustomDialog'
@Preview
@Component
... ... @@ -8,6 +11,34 @@ export struct CommentTabComponent {
@State type:number = 1
@State placeHolder: string = '说两句...'
@State dialogController: CustomDialogController | null = null;
/*回调方法*/
dialogControllerConfirm: () => void = () => {}
aboutToAppear() {
this.dialogController = new CustomDialogController({
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
this.dialogControllerConfirm();
EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH,this.publishCommentModel.targetId)
},
publishCommentModel:this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
customStyle: true,
offset: {
dx: 0,
dy: -20
},
})
}
build() {
Row(){
Stack({alignContent:Alignment.Start}){
... ... @@ -15,6 +46,10 @@ export struct CommentTabComponent {
Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({left:10})
}
}.width(151).height(30)
.onClick(()=>{
this.publishCommentModel.parentId = '-1';
this.dialogController?.open();
})
}
}
... ... @@ -25,25 +60,52 @@ export struct CommentIconComponent {
/*展示类型*/
@State type:number = 1
/*回调方法*/
onClickItem: () => void = () => {}
build() {
Row(){
Stack({alignContent:Alignment.TopEnd}){
Image($r('app.media.comment_icon')).width(24).height(24)
// Stack({alignContent:Alignment.Start}) {
// Image($r('app.media.comment_icon_number')).objectFit(ImageFit.Fill).width(12).height(12)
Text(this.publishCommentModel.totalCommentNumer + '12345' +' ')
.fontSize(8)
.fontColor('#ffffff')
// .backgroundColor('#ED2800')
.height(12)
.margin({ left: 6 })
.backgroundImage($r('app.media.comment_icon_number'))
// }.width(25)
RelativeContainer() {
Image($r('app.media.comment_icon_number_bg'))
.objectFit(ImageFit.Fill)
.resizable({ slice: {top:1, left: 20 , right:1, bottom:1} })
.alignRules({
top: {anchor: "Text", align: VerticalAlign.Top},
left: {anchor: "Text", align: HorizontalAlign.Start},
right: {anchor: "Text", align: HorizontalAlign.End},
bottom : {anchor: "Text", align: VerticalAlign.Bottom},
})
// .offset({
// x:-6
// })
.id("Image")
Text('123213123123123')
.fontSize(8)
.fontColor('#ffffff')// .backgroundColor('#ED2800')
.height(12)
.alignRules({
top: {anchor: "__container__", align: VerticalAlign.Top},
left: {anchor: "__container__", align: HorizontalAlign.Start}
})
// .margin({left: 4,right:4
// })
/*动态计算文字宽度*/
.width(50)
// .backgroundColor(Color.Green)
.id("Text")
}
// }
.offset({
x:12
})
}
}.width(24).height(24)
// .backgroundColor(Color.Blue)
}
}
\ No newline at end of file
... ...
... ... @@ -5,7 +5,6 @@ import commentViewModel from '../viewmodel/CommentViewModel'
import { router, window } from '@kit.ArkUI'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MyCommentDataSource } from '../model/MyCommentDataSource'
import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils'
import { HttpUrlUtils } from 'wdNetwork/Index'
import PageModel from '../../../viewmodel/PageModel'
import { ErrorComponent } from '../../view/ErrorComponent'
... ... @@ -185,37 +184,14 @@ export struct QualityCommentsComponent {
Column() {
Stack() {
this.titleHeader()
this.listLayout()
// if(this.viewType == ViewType.ERROR){
// ErrorComponent()
// }else if(this.viewType == ViewType.EMPTY){
// EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment})
// }else {
// CustomPullToRefresh({
// alldata:[],
// scroller:this.scroller,
// customList:()=>{
// this.listLayout()
// // this.testLayout()
// },
// onRefresh:(resolve)=>{
// this.currentPage = 1
// this.getData(resolve)
// },
// onLoadMore:(resolve)=> {
// if (this.hasMore === false) {
// if(resolve) resolve('')
// return
// }
// this.currentPage++
// this.getData(resolve)
// }
// })
// }
if(this.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment})
}else {
this.listLayout()
}
}.alignContent(Alignment.Top)
}.backgroundColor(this.currentWindowColor).width('100%')
... ... @@ -251,12 +227,15 @@ export struct QualityCommentsComponent {
ListItem() {
}.height(this.bottomSafeHeight)
}
}.onReachEnd(()=>{
this.currentPage++
this.getData()
})
.margin({ top: 196 })
.height("100%")
.width("100%")
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
// .edgeEffect(EdgeEffect.Spring)
// .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
.edgeEffect(EdgeEffect.Spring)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
... ...
... ... @@ -148,7 +148,7 @@ class CommentViewModel {
bean['userName'] = UserDataLocal.getUserId();
bean['userHeaderUrl'] = UserDataLocal.getUserHeaderUrl();
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
HttpBizUtil.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
if (data.code != 0) {
fail()
return
... ... @@ -164,7 +164,7 @@ class CommentViewModel {
/*发布评论*/
publishComment(model: publishCommentModel) {
return new Promise<void>((success, fail) => {
return new Promise<commentItemModel>((success, fail) => {
let url = HttpUrlUtils.getPublishCommentUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string> = {};
... ... @@ -182,14 +182,15 @@ class CommentViewModel {
bean['targetType'] = model.targetType
bean['parentId'] = model.parentId
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean, headers).then((data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
fail()
return
}
ToastUtils.showToast(data.message, 1000);
success()
let model = data.data as commentItemModel
success(model)
}, (error: Error) => {
ToastUtils.showToast('评论失败', 1000);
fail()
... ... @@ -240,7 +241,7 @@ class CommentViewModel {
let promiseArray: Promise<commentStatusListModel | void>[] = [];
//未登录不用批查
if (HttpUrlUtils.getUserId()){
if (HttpUrlUtils.getUserId()) {
if (commentIDs.length > 0) {
let promise1 = new Promise<void>((success) => {
// HttpRequest HttpBizUtil
... ... @@ -285,7 +286,7 @@ class CommentViewModel {
})
promiseArray.push(promise1);
}
}
}
if (fromUserIDs.length > 0) {
let promise2 = new Promise<void>((success) => {
let url = HttpUrlUtils.getBatchUserUrl();
... ... @@ -386,8 +387,6 @@ class CommentViewModel {
}
deepCopyCommentItemModel(model: commentItemModel) {
let newModel = new commentItemModel()
... ... @@ -411,10 +410,13 @@ class CommentViewModel {
newModel.fromUserHeader = model.fromUserHeader
newModel.fromUserId = model.fromUserId
newModel.fromUserName = model.fromUserName
newModel.fromUserType = model.fromUserType
if (model.toUserType != null) {
newModel.fromUserType = model.fromUserType
}
newModel.id = model.id
newModel.likeNum = model.likeNum.toString()
if (model.likeNum) {
newModel.likeNum = model.likeNum.toString()
}
if (Number.parseInt(newModel.likeNum) <= 0) {
newModel.likeNum = ''
}
... ...
... ... @@ -77,6 +77,7 @@ export struct ZhSingleRow02 {
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
.visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
... ...
import { CompDTO, ContentDTO, Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
/**
* 小视频横划卡
* Zh_Single_Row-02
*/
const TAG = 'Zh_Single_Row-03'
@Entry
@Component
export struct ZhSingleRow03 {
@State compDTO: CompDTO = {} as CompDTO
scroller: Scroller = new Scroller()
build() {
Column() {
//顶部
this.CompHeader(this.compDTO)
Scroll(this.scroller){
Row() {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
Column() {
Row() {
Image(item.coverUrl)
.width(106)
.height(60)
.margin({right: 12})
Text(item.newsTitle)
.width(154)
.height(60)
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
.margin({bottom: 16})
Row() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Row() {
Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5))
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
.textAlign(TextAlign.Start)
Image($r('app.media.timeline_rect'))
.width(4)
.height(3)
.margin({right: 6})
Text(item.liveInfo.liveStartTime.split(' ')[1].slice(0, 5))
.margin({right: 6})
.fontColor(0x000000)
.fontSize(13)
Text('开始直播')
.fontColor(0xC8C8C8)
.fontSize(13)
}
Row() {
Text('预约')
.width(48)
.height(24)
.backgroundColor(0xED2800)
.fontColor(0xffffff)
.fontSize(12)
.textAlign(TextAlign.Center)
.borderRadius(3)
}
.margin({top: -5})
}
}
}
.width(298)
.height(116)
.padding({top: 12, bottom: 12, left: 12, right: 12})
.backgroundColor(0xf9f9f9)
.margin({right: 8})
.onClick(() => {
ProcessUtils.processPage(item)
})
})
}
}
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
}
.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')
})
.backgroundColor($r('app.color.white'))
}
@Builder
CompHeader(item: CompDTO) {
Row() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text('直播预约')
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_999999"))
.margin({ right: 1 })
Image($r("app.media.more"))
.width(14)
.height(14)
.onClick(() => {
// TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
.visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
}
}
@Extend(Text)
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
@Component
struct CreatorItem {
@Prop item: ContentDTO
@State rmhIsAttention: number = 0
build() {
ListItem() {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.item.coverUrl)
.width(156)
.height(208)
Row()
.width(156)
.height(80)
.linearGradient({
direction: GradientDirection.Bottom,
colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
})
Text(this.item.newsTitle)
.fontColor(0xffffff)
.fontSize(14)
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
.width(140)
.margin({bottom: 8})
}
}
.width(156)
.height(208)
.margin({ right: 11 })
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.image_border_radius'))
}
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.item)
})
}
/**
* 关注号主 TODO 这里后面需要抽离
*/
handleAccention(item: ContentDTO, status: number) {
this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
return
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postInteractAccentionOperateParams = {
attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
// userType: 1,
// userId: '1', // TODO 用户id需要从本地获取
status: status,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (status === 1) {
this.rmhIsAttention = 0
} else {
this.rmhIsAttention = 1
}
})
}
}
... ...
... ... @@ -36,6 +36,7 @@ export struct ZhSingleRow04 {
.width(14)
.height(14)
}
.visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
... ...
... ... @@ -120,6 +120,9 @@ export struct ZhSingleRow06 {
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
.onClick(() => {
ProcessUtils.commentGotoWeb(item.operDataList[0]?.commentInfo as commentInfo)
})
Row() {
Image($r("app.media.icon_elite_comment"))
... ...
... ... @@ -9,12 +9,13 @@ import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = "AppointmentListUI"
@Component
export struct AppointmentListUI{
export struct AppointmentListUI {
@State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource();
@State count:number = 0;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
... ... @@ -23,37 +24,41 @@ export struct AppointmentListUI{
build() {
Column() {
//标题栏目
CustomTitleUI({titleName:"预约列表"})
if(this.count == 0){
EmptyComponent({emptyType:10})
.height('100%')
.width('100%')
}else{
CustomTitleUI({ titleName: "预约列表" })
if (this.count == 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 10 })
.height('100%')
.width('100%')
}
} else {
//刷新控件 TODO
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({item:item})
AppointmentListChildComponent({ item: item })
}
.onClick(()=>{
.onClick(() => {
//TODO 跳转
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(4)
}
.cachedCount(4)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.margin({ top: '23lpx', left: '23lpx', right: '23lpx' })
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewPageData()
}
... ... @@ -65,70 +70,73 @@ export struct AppointmentListUI{
.width('100%')
}
getNewPageData(){
getNewPageData() {
this.isLoading = true
if(this.hasMore){
MinePageDatasModel.getAppointmentListData("20",`${this.curPageNum}`,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
this.hasMore = false
}else{
value.list.forEach((value)=>{
let dealTime = this.DealStartTime(value.planStartTime)
if(dealTime!=null && dealTime.length === 2){
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType,value.liveId,value.relId))
}else {
this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType,value.liveId,value.relId))
}
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
if (this.hasMore) {
MinePageDatasModel.getAppointmentListData("20", `${this.curPageNum}`, getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
} else {
value.list.forEach((value) => {
let dealTime = this.DealStartTime(value.planStartTime)
if (dealTime != null && dealTime.length === 2) {
this.data.push(new MineAppointmentItem(value.imageUrl, value.status, value.title, true, dealTime[0], dealTime[1], value.relType, value.liveId, value.relId))
} else {
this.data.push(new MineAppointmentItem(value.imageUrl, value.status, value.title, true, "", "", value.relType, value.liveId, value.relId))
}
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
this.isGetRequest = true
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.isLoading = false
})
}
this.isLoading = false
}
DealStartTime(planStartTime:string):string[]{
let dealData:string[] = []
DealStartTime(planStartTime: string): string[] {
let dealData: string[] = []
if(!StringUtils.isNotEmpty(planStartTime)){
console.log(TAG,"格式有误")
if (!StringUtils.isNotEmpty(planStartTime)) {
console.log(TAG, "格式有误")
return dealData
}
if(planStartTime.indexOf(" ") === -1){
console.log(TAG,"格式有误")
if (planStartTime.indexOf(" ") === -1) {
console.log(TAG, "格式有误")
return dealData
}
let arr = planStartTime.split(" ")
if(arr!=null && StringUtils.isNotEmpty(arr[0])){ //处理年月日
if (arr != null && StringUtils.isNotEmpty(arr[0])) { //处理年月日
let time = arr[0].split("-");
if(time.length === 3){
let month = time[1].indexOf("0") === 0 ? time[1].substring(1):time[1]
if (time.length === 3) {
let month = time[1].indexOf("0") === 0 ? time[1].substring(1) : time[1]
let day = time[2]
dealData[0] = `${month}月${day}日`
let today = `${new Date().getMonth()+1}月${new Date().getDate()}日`
if(dealData[0] === today){
let today = `${new Date().getMonth() + 1}月${new Date().getDate()}日`
if (dealData[0] === today) {
dealData[0] = "今日"
}
}
}
if(arr!=null && StringUtils.isNotEmpty(arr[1])){ //处理时分
if (arr != null && StringUtils.isNotEmpty(arr[1])) { //处理时分
let time = arr[1].split(":");
if(time.length === 3){
dealData[1] = `${time[0]}:${time[1]}`
if (time.length === 3) {
dealData[1] = `${time[0]}:${time[1]}`
}
}
console.log(TAG,JSON.stringify(dealData))
console.log(TAG, JSON.stringify(dealData))
return dealData
}
}
\ No newline at end of file
... ...
... ... @@ -256,11 +256,13 @@ export struct FollowChildComponent{
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
if(this.data.status === "1"){
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
}else{
UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
}
UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
// if(this.data.status === "1"){
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
// }else{
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
// }
}
}
})
... ...
... ... @@ -24,6 +24,7 @@ export struct FollowListDetailUI {
@State hasMore: boolean = true
curPageNum: number = 1;
preferences: dataPreferences.Preferences | null = null;
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
... ... @@ -33,9 +34,12 @@ export struct FollowListDetailUI {
build() {
Column() {
if (this.count === 0) {
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 14 })
.layoutWeight(1)
.width('100%')
}
} else {
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
... ... @@ -47,7 +51,7 @@ export struct FollowListDetailUI {
}, (item: FollowListDetailItem) => item.creatorId)
//没有更多数据 显示提示
if (!this.hasMore) {
if (!this.hasMore && this.count != 0) {
ListItem() {
ListHasNoMoreDataUI()
}
... ... @@ -75,16 +79,17 @@ export struct FollowListDetailUI {
let observer = (key: string) => {
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
if (this.creatorDirectoryId === -1) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
this.data.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
if (arr[1] == "0") {
this.data.getDataArray().forEach((element, index) => {
if (element.creatorId === arr[0]) {
this.data.deleteItem(index)
this.count = this.data.size()
}
});
}else{
if(!this.isLoading){
} else {
if (!this.isLoading) {
this.isLoading = true
this.hasMore = true
this.curPageNum = 1
... ... @@ -93,6 +98,16 @@ export struct FollowListDetailUI {
this.getMyFollowListDetail()
}
}
}else{
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
let arr = value.split(',')
if (arr[1] == "0"){
this.data.getDataArray().forEach((element, index) => {
if (element.creatorId === arr[0]) {
this.data.getData(index).status = "0"
}
})
}
}
}
}
... ... @@ -109,7 +124,7 @@ export struct FollowListDetailUI {
this.isLoading = false
} else {
value.list.forEach((value) => {
let fansNum:number = value.fansNum
let fansNum: number = value.fansNum
let fansNumString = ""
if (fansNum > 10000) {
let temp = (fansNum / 10000) + ""
... ... @@ -123,7 +138,7 @@ export struct FollowListDetailUI {
} else {
fansNumString = fansNum + ""
}
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl,value.authIcon))
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl, value.authIcon))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ... @@ -134,12 +149,15 @@ export struct FollowListDetailUI {
}
}
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isGetRequest = true
this.isLoading = false
})
}else {
} else {
this.isLoading = false
this.isGetRequest = true
}
}
... ... @@ -161,6 +179,7 @@ export struct FollowListDetailUI {
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
... ... @@ -169,7 +188,7 @@ export struct FollowListDetailUI {
getFollowListStatus(result: MineFollowListDetailItem) {
let data_temp: FollowListDetailItem[] = []
result.list.forEach((item) => {
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1,item.authIcon))
data_temp.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, "0", item.attentionUserId, item.cnUserType, item.cnUserId, item.cnMainControl, -1, item.authIcon))
})
let request = new CreatorDetailRequestItem()
... ... @@ -206,6 +225,7 @@ export struct FollowListDetailUI {
console.log(TAG, JSON.stringify(err))
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
this.isGetRequest = true
})
}
... ... @@ -225,7 +245,7 @@ export struct FollowListDetailUI {
})
result.forEach((item) => {
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl,item.authIcon))
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, item.introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon))
})
this.data.notifyDataReload()
... ... @@ -238,9 +258,11 @@ export struct FollowListDetailUI {
}
this.isLoading = false
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
\ No newline at end of file
... ...
... ... @@ -27,6 +27,7 @@ export struct HomePageBottomComponent{
@State userId:string = "";
@Link commentNum:number
preferences: dataPreferences.Preferences | null = null;
@State isGetRequest:boolean = false
aboutToAppear(){
this.getNewPageData()
... ... @@ -39,10 +40,11 @@ export struct HomePageBottomComponent{
if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
let arr = value.split(',')
if(arr!=null && arr.length === 2){
if(arr[1] == "0"){
this.data_follow.getDataArray().forEach((element,index) => {
if (element.creatorId === arr[1]) {
if (element.creatorId === arr[0]) {
this.data_follow.deleteItem(index)
this.count = this.data_follow.size()
}
});
}else{
... ... @@ -62,12 +64,14 @@ export struct HomePageBottomComponent{
build(){
Column(){
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
if(this.isGetRequest == true){
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}
if(this.count === 0){
if(this.count === 0 ){
if(this.style === 1){
Column(){
Row(){
... ... @@ -92,15 +96,19 @@ export struct HomePageBottomComponent{
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
if(this.isGetRequest == true){
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
ListHasNoMoreDataUI({style:2})
.layoutWeight(1)
if(this.isGetRequest == true){
EmptyComponent({emptyType:11})
.layoutWeight(1)
.width('100%')
}
}
}else{
if(this.style === 1){
... ... @@ -244,12 +252,15 @@ export struct HomePageBottomComponent{
}
}
this.isLoading = false
this.isGetRequest = true
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else{
this.isLoading = false
this.isGetRequest = true
}
}
... ... @@ -266,17 +277,18 @@ export struct HomePageBottomComponent{
MinePageDatasModel.getMineCommentListData(time,object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
this.getCommentListStatus(value)
}
this.isLoading = false
this.commentNum = value.totalCount
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else{
this.isLoading = false
this.isGetRequest = true
}
}
}
... ... @@ -329,9 +341,11 @@ export struct HomePageBottomComponent{
}
this.isLoading = false
this.isGetRequest = true
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
... ...
... ... @@ -6,50 +6,61 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { ChildCommentComponent } from './ChildCommentComponent';
import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = "HomePageBottomComponent"
@Component
export struct OtherHomePageBottomCommentComponent{
export struct OtherHomePageBottomCommentComponent {
@Prop curUserId: string
@State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource();
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count:number = 0;
@Prop levelHead:string
@Link commentNum:number
aboutToAppear(){
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State count: number = 0;
@Prop levelHead: string
@Link commentNum: number
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
}
build(){
Column(){
build() {
Column() {
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
.height('100%')
}else{
if (this.count === 0) {
if (this.isGetRequest == true) {
EmptyComponent({emptyType:11})
.height('100%')
.layoutWeight(1)
}
} else {
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item,levelHead:this.levelHead,isLastItem:index===this.data_comment.totalCount()-1})
ChildCommentComponent({
data: item,
levelHead: this.levelHead,
isLastItem: index === this.data_comment.totalCount() - 1
})
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(15)
}
.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
... ... @@ -57,9 +68,9 @@ export struct OtherHomePageBottomCommentComponent{
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
... ... @@ -72,7 +83,6 @@ export struct OtherHomePageBottomCommentComponent{
.justifyContent(FlexAlign.Start)
}
@Styles
listStyle() {
.backgroundColor(Color.White)
... ... @@ -81,60 +91,64 @@ export struct OtherHomePageBottomCommentComponent{
.borderRadius(12)
}
getNewPageData(){
getNewPageData() {
this.isLoading = true
if(this.hasMore){
if (this.hasMore) {
let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
let object = new OtherUserCommentListRequestItem("",20,this.curPageNum,time,"1",this.curUserId)
let object = new OtherUserCommentListRequestItem("", 20, this.curPageNum, time, "1", this.curUserId)
MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
MinePageDatasModel.getOtherCommentListData(object, getContext(this)).then((value) => {
if (!this.data_comment || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
}else{
} else {
this.getCommentListStatus(value)
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
} else {
this.isGetRequest = true
this.isLoading = false
}
}
getCommentListStatus(value:MineCommentListDetailItem){
getCommentListStatus(value: MineCommentListDetailItem) {
let status = new OtherUserCommentLikeStatusRequestItem()
let data : CommentListItem[] = []
value.list.forEach((item)=>{
if(item.checkStatus === 2){
let data: CommentListItem[] = []
value.list.forEach((item) => {
if (item.checkStatus === 2) {
status.commentIdList.push(item.id)
}
let commentContent = item.commentContent
if(item.sensitiveShow === 0 && item.sensitiveExist === 1){
if (item.sensitiveShow === 0 && item.sensitiveExist === 1) {
commentContent = item.commentContentSensitive
}
let parentCommentContent = ""
if(item.parentCommentVo!=null ){
if (item.parentCommentVo != null) {
parentCommentContent = item.parentCommentVo.commentContent
}
let parentCommentUserName = ""
if(item.parentCommentVo!=null ){
if (item.parentCommentVo != null) {
parentCommentUserName = item.parentCommentVo.fromUserName
}
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName))
})
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
if (item.commentId == list.id) {
list.like_status = item.status
}
})
})
data.forEach((item)=>{
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
... ... @@ -143,14 +157,16 @@ export struct OtherHomePageBottomCommentComponent{
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
} else {
this.hasMore = false
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.isGetRequest = true
})
}
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,7 @@ export struct OtherHomePageBottomFollowComponent{
curPageNum:number = 1;
@State count:number = 0;
@Prop curUserId: string
@State isGetRequest:boolean = false
aboutToAppear(){
... ... @@ -54,10 +55,11 @@ export struct OtherHomePageBottomFollowComponent{
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
if(this.isGetRequest == true){
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
... ... @@ -155,10 +157,15 @@ export struct OtherHomePageBottomFollowComponent{
}
}
this.isLoading = false
this.isGetRequest = true
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.isGetRequest = true
})
}else{
this.isGetRequest = true
this.isLoading = false
}
}
}
\ No newline at end of file
... ...
import { BottomNavi, CommonConstants } from 'wdConstant';
import { BottomNavDTO } from 'wdBean';
import { BottomNavDTO, TopNavDTO } from 'wdBean';
import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { MinePageComponent } from './MinePageComponent';
import { CompUtils } from '../../utils/CompUtils';
import PageViewModel from '../../viewmodel/PageViewModel';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
const TAG = 'BottomNavigationComponent';
let storage = LocalStorage.getShared();
... ... @@ -21,14 +22,13 @@ export struct BottomNavigationComponent {
@Provide isLayoutFullScreen: boolean = false
@Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229
@Provide isNight: boolean = false // 是否开启夜间模式
@Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息
@Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息
@Provide barBackgroundColor: Color = Color.Transparent
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
// 底导/顶导全部数据
@State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []
// 底导当前选中/焦点下标
@State currentNavIndex: number = BottomNavi.NEWS;
// @State currentTopNavSelectedIndex: number = 0; //
@State barBackgroundColor: Color = Color.Transparent
@State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据
@State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标
// 底导TabsController
private navController: TabsController = new TabsController();
readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比
... ... @@ -44,6 +44,7 @@ export struct BottomNavigationComponent {
@State assignChannel: AssignChannelParam = new AssignChannelParam()
// 自动刷新触发(双击tab自动刷新)
@State autoRefresh: number = 0
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
... ... @@ -84,7 +85,6 @@ export struct BottomNavigationComponent {
_currentNavIndex: $currentNavIndex,
navIndex: index,
currentBottomNavName: navItem.name,
barBackgroundColor: $barBackgroundColor,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
... ... @@ -99,8 +99,8 @@ export struct BottomNavigationComponent {
.animationDuration(0)
.barHeight($r('app.float.bottom_navigation_barHeight'))
.barMode(BarMode.Fixed)
// TODO:更详细的判断是视频频道
.barBackgroundColor(this.barBackgroundColor)
// 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域
.backgroundColor(this.barBackgroundColor)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
... ... @@ -108,17 +108,6 @@ export struct BottomNavigationComponent {
}
/**
* TODO:更详细的判断视频频道
*/
getFontColor(index: number): Color {
if (this.currentNavIndex === 2 && this.barBackgroundColor === Color.Black) {
return Color.White
} else {
return this.currentNavIndex === index ? Color.Red : Color.Gray
}
}
@Builder
tabBarBuilder(navItem: BottomNavDTO, index: number) {
Stack({ alignContent: Alignment.Bottom }) {
... ... @@ -126,37 +115,39 @@ export struct BottomNavigationComponent {
.height(CommonConstants.FULL_PARENT)
.padding({ bottom: 15, left: 10, right: 10, top: 2 })
.aspectRatio(this.ASPECT_RATIO_1_1)
.gesture(
TapGesture({ count: 2 })
.onAction((event: GestureEvent) => {
if (this.currentNavIndex === index) {
// 当前tab,双击事件
this.autoRefresh++
}
})
)
Text(navItem.name)
.margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
.fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray)
.fontColor(this.getFontColor(index))
.fontColor(this.currentNavIndex === index ? navItem.nameCColor : navItem.nameColor)
.opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY)
}
.height($r('app.float.bottom_navigation_barHeight'))
.hoverEffect(HoverEffect.Highlight)
.onClick(() => {
if (this.currentNavIndex === index) {
// 当前tab,双击事件
this.doubleClick(() => {
Logger.info(TAG, 'tab double click ')
this.autoRefresh++
})
if (navItem.name === '我的') {
this.barBackgroundColor = Color.White
this.currentBottomNavInfo = {} as BottomNavDTO
} else {
// 切换tab
this.currentNavIndex = index;
Logger.info(TAG, `onChange, index: ${index}`);
this.currentBottomNavInfo = navItem
}
this.currentNavIndex = index;
Logger.info(TAG, `onChange, index: ${index}`);
})
// .justifyContent(FlexAlign.Center)
// .onClick(() => {
// Logger.info(TAG, `onClick, index: ${index}`);
// this.currentNavIndex = index ?? 0;
// this.navController.changeIndex(this.currentNavIndex);
// })
}
// 底导切换函数
... ... @@ -199,17 +190,17 @@ export struct BottomNavigationComponent {
/**
* 双击实现
*/
doubleClickTime: number = 0
// doubleClickTime: number = 0
/**
* 双击实现
*/
private doubleClick(fun: () => void) {
let now = DateTimeUtils.getTimeStamp()
if (now - this.doubleClickTime < 200) {
fun()
} else {
this.doubleClickTime = now
}
}
// private doubleClick(fun: () => void) {
// let now = DateTimeUtils.getTimeStamp()
// if (now - this.doubleClickTime < 200) {
// fun()
// } else {
// this.doubleClickTime = now
// }
// }
}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
const MORE_CHANNEL: string = '更多频道'
const LOCAL_CHANNEL: string = '地方频道'
const TAG: string = 'ChannelSubscriptionLayout'
@CustomDialog
struct ChannelDialog {
... ...
import { CompDTO, TopNavDTO } from 'wdBean';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { LazyDataSource, Logger } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { PageComponent } from './PageComponent';
... ... @@ -26,12 +26,14 @@ export struct TopNavigationComponent {
@Consume isLayoutFullScreen: boolean
@Consume bottomRectHeight: number
@Consume topRectHeight: number
@Consume @Watch('topOrBottomNavChange') currentBottomNavInfo: BottomNavDTO // 当前底导信息
@Consume barBackgroundColor: Color
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Link barBackgroundColor: Color
@Link _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
@State @Watch('topOrBottomNavChange') currentTopNavSelectedIndex: number = 0;
@State currentTopNavName: string = '';
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
... ... @@ -56,6 +58,21 @@ export struct TopNavigationComponent {
// 当前底导index
@State navIndex: number = 0
topOrBottomNavChange() {
if (this.currentBottomNavName === this.currentBottomNavInfo?.name) {
this.setBarBackgroundColor()
}
}
setBarBackgroundColor() {
console.error('setBarBackgroundColor', this.currentTopNavName, this.currentBottomNavInfo?.name)
if (this.currentTopNavName === '视频' && this.currentBottomNavInfo?.name === '视频') {
this.barBackgroundColor = Color.Black
} else {
this.barBackgroundColor = Color.White
}
}
//处理新闻tab顶导频道数据
topNavListHandle() {
let _channelIds: number [] = []
... ... @@ -126,10 +143,14 @@ export struct TopNavigationComponent {
this.channelIds = _channelIds
this.myChannelList = _myChannelList
this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
//缓存首页频道
let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
if (index > -1) {
this.currentTopNavSelectedIndex = index
this.currentTopNavName = this.myChannelList[index].name
}
}
... ... @@ -196,7 +217,6 @@ export struct TopNavigationComponent {
groupId: this.groupId + '',
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
barBackgroundColor: $barBackgroundColor
})
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
... ... @@ -216,9 +236,10 @@ export struct TopNavigationComponent {
.barHeight($r('app.float.top_tab_bar_height'))
.barMode(BarMode.Scrollable)
.vertical(false)
// item.name === '视频' && this.currentTopNavSelectedIndex === 0 ?
.barBackgroundColor(this.barBackgroundColor)
.onChange((index: number) => {
this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
Logger.info(TAG, `onChange index : ${index}`);
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
... ... @@ -256,15 +277,11 @@ export struct TopNavigationComponent {
}
/**
* TODO:更详细的判断视频频道
* TODO:根据顶导配置获取颜色展示效果不对,待确认
*/
getFontColor(item: TopNavDTO, index: number): Color | string {
if (this._currentNavIndex === 2) {
if (this.currentTopNavSelectedIndex == 0) {
return item.name === '视频' ? Color.White : '#e5e0e0'
} else {
return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999"
}
getTopNavFontColor(item: TopNavDTO, index: number): Color | string {
if (item.name === '视频' && this.currentBottomNavInfo.name === '视频') {
return this.currentTopNavSelectedIndex === index ? Color.White : '#e5e0e0'
} else {
return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999"
}
... ... @@ -276,9 +293,10 @@ export struct TopNavigationComponent {
Text(item.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.getFontColor(item, index))
.padding({ top: $r('app.float.top_tab_item_padding_top') , bottom: $r('app.float.top_tab_item_padding_bottom')})
.fontColor(this.getTopNavFontColor(item, index))
.padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
.maxLines(this.MAX_LINE)
// .backgroundImage(this.currentTopNavSelectedIndex === index ? item.iconCUrl : item.iconUrl)
if (this.currentTopNavSelectedIndex === index) {
Row()
.width(20)
... ... @@ -292,18 +310,20 @@ export struct TopNavigationComponent {
minWidth: $r('app.float.top_tab_item_min_width'),
maxWidth: $r('app.float.top_tab_item_max_width')
})
.backgroundColor(Color.Transparent)
// .backgroundColor(Color.Transparent)
.padding({
left: $r('app.float.top_tab_item_padding_horizontal'),
right: $r('app.float.top_tab_item_padding_horizontal'),
})
.id(`col_tabBar${index}`)
.margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
}
aboutToAppear() {
//处理新闻tab顶导频道数据
this.topNavListHandle()
this.setBarBackgroundColor()
}
aboutToDisappear() {
... ...
... ... @@ -63,8 +63,4 @@ export struct SearchRelatedComponent {
.padding({ left: '31lpx', right: '31lpx' })
}
test(){
let c = "12121212121"
}
}
\ No newline at end of file
... ...
... ... @@ -36,7 +36,7 @@ export struct SearchResultComponent {
getSuggestData() {
this.isLoading = true
let request: SearchSuggestRequestItem = new SearchSuggestRequestItem(2, "", "", HttpUrlUtils.getImei(), UserDataLocal.userId, 8, "")
let request: SearchSuggestRequestItem = new SearchSuggestRequestItem(2, "", "", HttpUrlUtils.getImei(), UserDataLocal.getUserId(), 8, "")
SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
value.forEach((item) => {
... ...
... ... @@ -9,7 +9,6 @@ export struct AboutPageUI {
@State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议'];
@State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.'
@State version: string = '版本号:v'
clickTimes: number = 0
dialogController: CustomDialogController = new CustomDialogController({
builder: EnvironmentCustomDialog({
cancel: () => {
... ... @@ -42,12 +41,12 @@ export struct AboutPageUI {
.width('278lpx')
.height('154lpx')
.margin({ top: '173lpx', bottom: '154lpx' })
.onClick(() => {
this.clickTimes++
if (this.clickTimes > 2) {
this.dialogController.open()
}
})
.gesture(
TapGesture({ count: 2 })
.onAction((event: GestureEvent) => {
this.dialogController.open()
})
)
// Row(){
//
// }.backgroundColor(Color.Yellow)
... ...
import { SPHelper } from 'wdKit/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index';
@CustomDialog
export struct EnvironmentCustomDialog {
currentEnvironment: string = HttpUrlUtils.HOST_PRODUCT;
@State currentEnvironment: string = HostManager.getHost();
controller: CustomDialogController
cancel: () => void = () => {
}
... ... @@ -21,12 +21,12 @@ export struct EnvironmentCustomDialog {
.margin({ top: 20 })
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.checked(true)
.checked(this.currentEnvironment == HostEnum.HOST_SIT)
.height(20)
.width(20)
.onChange((isChecked: boolean) => {
if (isChecked) {
this.currentEnvironment = HttpUrlUtils.HOST_SIT;
this.currentEnvironment = HostEnum.HOST_SIT;
}
})
Text('切换到SIT(测试)环境,重启应用生效')
... ... @@ -37,12 +37,12 @@ export struct EnvironmentCustomDialog {
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.checked(true)
.checked(this.currentEnvironment == HostEnum.HOST_UAT)
.height(20)
.width(20)
.onChange((isChecked: boolean) => {
if (isChecked) {
this.currentEnvironment = HttpUrlUtils.HOST_UAT;
this.currentEnvironment = HostEnum.HOST_UAT;
}
})
Text('切换到UAT(预发布)环境,重启应用生效')
... ... @@ -53,12 +53,12 @@ export struct EnvironmentCustomDialog {
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.checked(true)
.checked(this.currentEnvironment == HostEnum.HOST_PRODUCT)
.height(20)
.width(20)
.onChange((isChecked: boolean) => {
if (isChecked) {
this.currentEnvironment = HttpUrlUtils.HOST_PRODUCT;
this.currentEnvironment = HostEnum.HOST_PRODUCT;
}
})
Text('切换到PROD(现网)环境,重启应用生效')
... ... @@ -69,12 +69,12 @@ export struct EnvironmentCustomDialog {
Row() {
Radio({ value: 'Radio1', group: 'radioGroup' })
.checked(true)
.checked(this.currentEnvironment == HostEnum.HOST_DEV)
.height(20)
.width(20)
.onChange((isChecked: boolean) => {
if (isChecked) {
this.currentEnvironment = HttpUrlUtils.HOST_DEV;
this.currentEnvironment = HostEnum.HOST_DEV;
}
})
Text('切换到DEV(开发)环境,重启应用生效')
... ...
... ... @@ -29,7 +29,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.width(14)
.height(14)
}
.visibility(this.compDTO?.objectType === '0' ? Visibility.None : Visibility.Visible)
.visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
... ...
import { Logger } from 'wdKit/Index'
import { LikeViewModel } from '../../viewmodel/LikeViewModel'
import { SPHelper } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
const TAG = 'LikeComponent';
... ... @@ -9,6 +13,8 @@ export struct LikeComponent {
viewModel: LikeViewModel = new LikeViewModel()
@Prop data: Record<string, string>
enableBtn = true
componentType : number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式
@State likeCount: number = 0 //点赞数
//上层传值 样例
// this.data['contentId'] = '30035444649' //必须
... ... @@ -23,34 +29,100 @@ export struct LikeComponent {
if (this.data) {
//获取点赞状态
this.getLikeStatus()
//获取点赞数
this.getLikeCount()
}
}
build() {
Column() {
Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
.width(24)
.height(24)
.onClick(() => {
if (!this.enableBtn) {
return
}
if (this.likeStatus) {
//1
this.executeLike('0')
} else {
//0
this.executeLike('1')
if (this.componentType == 2){
//2: 新闻页中间位置样式
Column() {
Button(){
Row(){
Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
.width(20)
.height(20)
Text(this.likeCount.toString())
.height(20)
.margin({
right: 0,
left: 4
})
.fontColor(this.likeStatus ? '#ED2800' : '#222222')
.fontSize('16')
}
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
.backgroundColor(Color.White)
.type(ButtonType.Capsule)
.borderColor('#EDEDED')
.borderRadius(20)
.borderWidth(1)
.onClick(()=>{
this.clickButtonEvent()
})
}.width(24).height(24)
}
.width(154)
.height(40)
}else {
//1: 底部栏目样式 默认样式
Column() {
Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
.width(24)
.height(24)
.onClick(() => {
this.clickButtonEvent()
})
}.width(24).height(24)
}
}
async clickButtonEvent(){
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
if (!this.enableBtn) {
return
}
if (this.likeStatus) {
//1
this.executeLike('0')
} else {
//0
this.executeLike('1')
}
}
executeLike(status: string) {
this.data['status'] = status
this.viewModel.executeLike2(this.data).then(() => {
this.likeStatus = !this.likeStatus
//点赞和取消点赞成功后更新点赞数
if(this.likeStatus){
this.likeCount ++
}else {
this.likeCount --
}
this.enableBtn = true
}).catch(() => {
this.enableBtn = true
... ... @@ -69,5 +141,19 @@ export struct LikeComponent {
})
}
//获取点赞数
getLikeCount() {
this.viewModel.getLikeCount(this.data).then((data) => {
if (data && data['data']) {
this.likeCount = data['data']['likeNum']
}else {
this.likeCount = 0
}
}).catch(() => {
this.likeCount = 0
})
}
}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,10 @@ import router from '@ohos.router';
import inputMethod from '@ohos.inputMethod';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import { LikeComponent } from './LikeComponent';
import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
import { publishCommentModel } from '../comment/model/PublishCommentModel'
// import { CommentCustomDialog } from '../comment/view/CommentCustomDialog';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -27,14 +31,17 @@ export interface OperationItem {
const TAG = 'OperRowListView';
@Preview
// @Preview
@Entry
@Component
export struct OperRowListView {
// private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Prop contentDetailData: ContentDetailDTO
// @Prop contentDetailData: ContentDetailDTO
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationList: OperationItem[] = [
{
... ... @@ -71,19 +78,30 @@ export struct OperRowListView {
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1" //必须
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
this.likeBean['userName'] = this.contentDetailData.editorName + ''
this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
this.likeBean['contentType'] = this.contentDetailData.newsType + ''
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.likeBean['status'] = ''
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
// 评论需要数据
this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
this.publishCommentModel.targetType = this.contentDetailData.newsType + ''
this.publishCommentModel.totalCommentNumer = '10'
}
build() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems:ItemAlign.Center }){
Row() {
Column() {
Image($r('app.media.icon_arrow_left_white'))
// Image($r('app.media.icon_arrow_left_white'))
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.aspectRatio(1)
... ... @@ -100,7 +118,17 @@ export struct OperRowListView {
.onClick(() => {
router.back();
})
TextInput({placeholder:'说两句11...'})
Column() {
/*评论组件*/
/* CommentCustomDialog({
placeHolderText: '说两句'
})*/
if (this.publishCommentModel?.targetId) {
CommentTabComponent({publishCommentModel: this.publishCommentModel})
CommentIconComponent({publishCommentModel: this.publishCommentModel})
}
}
/*TextInput({placeholder:'说两句...'})
.placeholderColor('#999999')
.placeholderFont(
{
... ... @@ -116,9 +144,9 @@ export struct OperRowListView {
.borderRadius(0)
.onClick(() => {
this.buildInputMethod()
})
})*/
}
.width('45.5%')
// .width('45.5%')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Start)
Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) {
... ... @@ -129,8 +157,12 @@ export struct OperRowListView {
.width('54.5%')
}
.width('100%')
.height(126)
.backgroundColor(Color.Black)
.height(50)
// .backgroundColor(Color.Black)
.backgroundColor(Color.White)
.margin({
bottom: 20
})
}
/**
* 组件项
... ... @@ -141,9 +173,12 @@ export struct OperRowListView {
buildOperationItem(item: OperationItem, index: number) {
Column() {
if (item.text === '点赞') {
LikeComponent({
data: this.likeBean
})
/*点赞组件*/
if (this.likeBean?.contentId) {
LikeComponent({
data: this.likeBean
})
}
/* RelativeContainer() {
Row() {
... ... @@ -191,6 +226,7 @@ export struct OperRowListView {
}
.id(`e_icon_${index}`)*/
} else if (item.text === '收藏') {
RelativeContainer() {
Row() {
Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)
... ... @@ -236,7 +272,7 @@ export struct OperRowListView {
}
.id(`e_icon_${index}`)
} else if (item.text === '评论') {
RelativeContainer() {
/* RelativeContainer() {
Row() {
Image(item.icon)
.width(24)
... ... @@ -279,7 +315,7 @@ export struct OperRowListView {
.id(`e_row3_${index}`)
}
}
.id(`e_icon_${index}`)
.id(`e_icon_${index}`)*/
} else {
RelativeContainer() {
Row() {
... ...
... ... @@ -43,5 +43,27 @@ export class LikeModel {
getLikeCount(data: Record<string, string>) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let channelId : string = data['channelId']
let contentId : string = data['contentId']
let contentType : string = data['contentType']
let detail : string = '1'
let url = HttpUrlUtils.getLikeCount() + `?channelId=${channelId}&contentId=${contentId}&contentType=${contentType}&detail=${detail}`
return new Promise<object>((success, fail) => {
HttpBizUtil.get<ResponseDTO<object>>(url, headers).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
return
}
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
})
})
}
}
\ No newline at end of file
... ...
import HashMap from '@ohos.util.HashMap';
import { UserDataLocal } from 'wdKit/Index';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';
export class LogoutModel{
requestLogout(){
let bean: Record<string, string> = {};
bean['refreshToken'] = UserDataLocal.USER_REFRESH_TOKEN
bean['refreshToken'] = 'ddrqreeee'
bean['refreshToken'] = HttpUrlUtils.getRefreshToken()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
if (!data) {
fail("数据为空")
return
... ... @@ -23,7 +20,6 @@ export class LogoutModel{
success(data.message)
}, (error: Error) => {
fail(error.message)
// Logger.debug("LoginViewModel:error ", error.toString())
})
})
}
... ...
... ... @@ -19,7 +19,7 @@ const TAG = "SearcherAboutDataModel"
class SearcherAboutDataModel{
private static instance: SearcherAboutDataModel;
public searchHistoryData:SearchHistoryItem[] = []
public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" + UserDataLocal.userId
public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" + UserDataLocal.getUserId()
private constructor() { }
... ...
... ... @@ -29,13 +29,11 @@ struct MineHomePage {
registTime:number = 0//账号注册时间
@State registerTimeForDay:number = 0
aboutToAppear(){
onPageShow(): void {
this.getUserInfo()
this.getUserLevel()
}
build() {
Stack({ alignContent: Alignment.Top }){
Image($r('app.media.title_bg'))
... ... @@ -65,9 +63,8 @@ struct MineHomePage {
.height('130lpx')
.objectFit(ImageFit.Cover)
}.onClick(()=>{
//TODO 显示头像
let params = {'userId': "531267787833221"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
}).width('135lpx')
.height('135lpx')
... ... @@ -370,6 +367,9 @@ struct MineHomePage {
if(StringUtils.isNotEmpty(value.introduction)){
this.desc = value.introduction
this.isHasIntroduction = true
}else{
this.desc = "点击添加简介,让大家认识你"
this.isHasIntroduction = false
}
this.browseNum = value.browseNum
this.commentNum = value.commentNum
... ...