wangyujian_wd

Merge remote-tracking branch 'origin/main'

Showing 49 changed files with 1234 additions and 644 deletions
... ... @@ -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
... ...
... ... @@ -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,
};
... ...
... ... @@ -99,6 +99,7 @@ function handleJsCallReceiveH5Data(data: Message) {
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 +110,7 @@ function handleJsCallReceiveH5Data(data: Message) {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
ProcessUtils.gotoMultiPictureListPage(photoList,swiperIndex)
}
break;
case '5':
... ...
... ... @@ -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)
... ...
export interface UserInfoDTO {
userHeadUrl:string
userHeadUrl: string
userName?: string
headPhotoUrl?: string
}
... ...
... ... @@ -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; // 选中下划线颜色
}
... ...
... ... @@ -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';
... ... @@ -60,7 +61,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) {
... ...
... ... @@ -211,7 +211,7 @@ export struct DynamicDetailComponent {
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
} else {
GridCol({
... ... @@ -228,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) {
... ... @@ -240,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({
... ... @@ -251,7 +251,7 @@ export struct DynamicDetailComponent {
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
}
})
... ...
... ... @@ -13,6 +13,7 @@ import {
import DetailViewModel from '../viewmodel/DetailViewModel';
import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
import { OperRowListView } from './view/OperRowListView';
import router from '@ohos.router';
import { RecommendList } from '../components/view/RecommendList'
import { CommonConstants } from 'wdConstant';
import { HttpUrlUtils } from 'wdNetwork/Index';
... ... @@ -20,7 +21,6 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { CommentComponent } from '../components/comment/view/CommentComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -75,58 +75,16 @@ export struct ImageAndTextPageComponent {
isPageEnd: $isPageEnd
})
Column() {
// 点赞
if (this.contentDetailData[0]?.openLikes) {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus === '1') {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
.width(24)
.height(24)
.margin({ right: 5 })
} else {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
.width(24)
.height(24)
.margin({ right: 5 })
}
Text(`${this.interactData?.likeNum || 0 }`)
.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',
// })
.onClick(() => {
this.toggleLikeStatus()
})
}.width(CommonConstants.FULL_WIDTH).height(80)
.justifyContent(FlexAlign.Center)
Divider().strokeWidth(6).color('#f5f5f5')
}
if (this.recommendList.length > 0) {
RecommendList({ recommendList: this.recommendList })
}
// 评论
if(this.contentDetailData[0]?.openComment){
}
}
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 126 })
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
if (!this.isPageEnd) {
... ... @@ -134,7 +92,45 @@ export struct ImageAndTextPageComponent {
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0] })
if (this.contentDetailData?.length) {
OperRowListView({contentDetailData: this.contentDetailData[0]})
}
/* Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
})
Row() {
Image($r('app.media.icon_comment'))
.width(24)
.height(24)
.margin({ right: 24 })
.id('comment')
Image($r('app.media.icon_star'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_forward'))
.width(24)
.height(24)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)*/
}
}
... ...
... ... @@ -102,7 +102,7 @@ export struct Card19Component {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
ProcessUtils.gotoMultiPictureListPage(photoList,0)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
... ...
... ... @@ -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'
... ...
... ... @@ -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)
... ...
... ... @@ -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 }) {
... ... @@ -132,31 +121,34 @@ export struct BottomNavigationComponent {
.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++
.gesture(
TapGesture({ count: 2 })
.onAction((event: GestureEvent) => {
AlertDialog.show({ message: 'aa' })
if (this.currentNavIndex === index) {
// 当前tab,双击事件
this.autoRefresh++
}
})
)
.onClick(() => {
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 +191,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
... ...
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,7 @@ import router from '@ohos.router';
import inputMethod from '@ohos.inputMethod';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import { LikeComponent } from './LikeComponent';
import { CommentCustomDialog } from '../comment/view/CommentCustomDialog';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -27,11 +28,13 @@ 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> = {}
... ... @@ -71,12 +74,13 @@ 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))
}
build() {
... ... @@ -100,7 +104,13 @@ export struct OperRowListView {
.onClick(() => {
router.back();
})
TextInput({placeholder:'说两句11...'})
Column() {
/*评论组件*/
/* CommentCustomDialog({
placeHolderText: '说两句'
})*/
}
/*TextInput({placeholder:'说两句...'})
.placeholderColor('#999999')
.placeholderFont(
{
... ... @@ -116,9 +126,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 +139,11 @@ export struct OperRowListView {
.width('54.5%')
}
.width('100%')
.height(126)
.height(50)
.backgroundColor(Color.Black)
.margin({
bottom: 20
})
}
/**
* 组件项
... ... @@ -141,9 +154,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 +207,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 +253,7 @@ export struct OperRowListView {
}
.id(`e_icon_${index}`)
} else if (item.text === '评论') {
RelativeContainer() {
/* RelativeContainer() {
Row() {
Image(item.icon)
.width(24)
... ... @@ -279,7 +296,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() { }
... ...
... ... @@ -35,16 +35,8 @@ export class PageRepository {
}
static getPageInfoUrl(pageId: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PAGE_INFO_PATH;
// TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load?
url = url + "?channelStrategy=2&loadStrategy=first_load"
+ "&districtCode=" + HttpUrlUtils.getDistrictCode()
+ "&provinceCode=" + HttpUrlUtils.getProvinceCode()
+ "&cityCode=" + HttpUrlUtils.getCityCode()
+ "&refreshTime=" + DateTimeUtils.getTimeStamp()
+ "&pageId=" + pageId
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG, "getPageInfoUrl url = " + url)
let url = HttpUrlUtils.getHost() + HttpUrlUtils.PAGE_INFO_PATH + "?pageId=" + pageId;
// Logger.info(TAG, "getPageInfoUrl url = " + url)
return url;
}
... ... @@ -293,7 +285,7 @@ export class PageRepository {
static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -304,7 +296,7 @@ export class PageRepository {
static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -314,7 +306,7 @@ export class PageRepository {
static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
// 浏览历史新增、删除接口
... ... @@ -331,7 +323,7 @@ export class PageRepository {
static fetchBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -340,7 +332,7 @@ export class PageRepository {
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
static fetchNewspaperInfo(date: string) {
... ...
... ... @@ -48,5 +48,19 @@ export class LikeViewModel {
}
//点赞数
getLikeCount(bean: Record<string, string>) {
return new Promise<object>((success, fail) => {
this.likeModel.getLikeCount(bean).then((data) => {
success(data)
}).catch((error: string) => {
fail(error)
})
})
}
}
\ No newline at end of file
... ...
import { SpConstants } from 'wdConstant/Index'
import { SPHelper } from 'wdKit/Index'
import { SPHelper, UserDataLocal } from 'wdKit/Index'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { LogoutModel } from '../model/LogoutModel'
... ... @@ -20,17 +20,18 @@ export class LogoutViewModel{
}
static clearLoginInfo() {
SPHelper.default.save(SpConstants.USER_FIRST_MARK, '')
SPHelper.default.save(SpConstants.USER_ID, '')
SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '')
SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '')
SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, '')
SPHelper.default.save(SpConstants.USER_STATUS, '')
SPHelper.default.save(SpConstants.USER_Type, '')
SPHelper.default.save(SpConstants.USER_NAME, '')
SPHelper.default.save(SpConstants.USER_PHONE, '')
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, '')
SPHelper.default.saveSync(SpConstants.USER_ID, '')
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, '')
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '')
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, '')
SPHelper.default.saveSync(SpConstants.USER_STATUS, '')
SPHelper.default.saveSync(SpConstants.USER_Type, '')
SPHelper.default.saveSync(SpConstants.USER_NAME, '')
SPHelper.default.saveSync(SpConstants.USER_PHONE, '')
HttpUrlUtils.setUserId("")
HttpUrlUtils.setUserType("")
HttpUrlUtils.setUserToken('')
UserDataLocal.clearUserData()
}
}
\ No newline at end of file
... ...
import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO, PageDTO, PageInfoDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
import PageModel from './PageModel';
import PageViewModel from './PageViewModel';
import { promptAction } from '@kit.ArkUI';
import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import { CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import PageAdModel from './PageAdvModel';
import { ArrayList } from '@kit.ArkTS';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
... ... @@ -104,7 +104,11 @@ export class PageHelper {
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
pageModel.viewType = ViewType.LOADED;
let sizeBefore: number = pageModel.compList.size();
pageModel.currentPage++;
if (isLastGroup) {
// 认为分页只会在最后一个group里
pageModel.currentPage++;
}
// pageModel.currentPage++;
pageModel.hasMore = true;
//移除音频 和 活动
... ...
... ... @@ -245,7 +245,7 @@ export class ContentDetailRequest {
static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -255,7 +255,7 @@ export class ContentDetailRequest {
static postBatchLikeAndCollectStatus(params: batchLikeAndCollectParams): Promise<ResponseDTO<batchLikeAndCollectResult[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_STATUS
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -265,7 +265,7 @@ export class ContentDetailRequest {
static postBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
... ... @@ -277,7 +277,7 @@ export class ContentDetailRequest {
static postRecommendVideoList(params: recommentVideoListParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_VIDEOLIST
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -288,7 +288,7 @@ export class ContentDetailRequest {
static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -299,7 +299,7 @@ export class ContentDetailRequest {
static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -309,7 +309,7 @@ export class ContentDetailRequest {
static postPointLevelOperate(params: postPointLevelOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.USERPOINT_OPERATE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -318,7 +318,7 @@ export class ContentDetailRequest {
static postCommentPublish(params: postCommentPublishParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_PUBLISH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
... ... @@ -328,7 +328,7 @@ export class ContentDetailRequest {
static postInteractBrowsOperate(params: postInteractBrowsOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_BROWS_OPERATE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
/**
... ... @@ -337,6 +337,6 @@ export class ContentDetailRequest {
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
return WDHttp.post(url, params, headers)
}
}
\ No newline at end of file
... ...
... ... @@ -133,7 +133,7 @@ export struct DetailPlayShortVideoPage {
aboutToAppear() {
this.videoLandScape = this.contentDetailData?.videoInfo[0]?.videoLandScape
this.playerController.onCanplay = () => {
if (this.index == 0 || this.currentIndex === this.index) {
if ((this.index == 0 || this.currentIndex === this.index) && this.switchVideoStatus) {
this.playerController.play()
}
}
... ...
... ... @@ -38,7 +38,7 @@ export struct VideoChannelDetail {
// private recommend?: string = '' // 0.非推荐,1.推荐;
@Link @Watch('navIndexChange') bottomNavIndex: number
@Link @Watch('navIndexChange') topNavIndex: number
@Link barBackgroundColor: Color
@Consume barBackgroundColor: Color
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
... ... @@ -72,11 +72,11 @@ export struct VideoChannelDetail {
navIndexChange() {
console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
this.barBackgroundColor = Color.Black
// this.barBackgroundColor = Color.Black
this.switchVideoStatus = true
this.openFullScreen()
} else {
this.barBackgroundColor = Color.Transparent
// this.barBackgroundColor = Color.Transparent
this.switchVideoStatus = false
this.closeFullScreen()
}
... ...
... ... @@ -47,14 +47,14 @@ export class LoginViewModel {
return new Promise<LoginBean>((success, fail) => {
this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => {
SPHelper.default.save(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.save(SpConstants.USER_ID, data.id)
SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.save(SpConstants.USER_STATUS, data.status)
SPHelper.default.save(SpConstants.USER_Type, data.userType)
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
HttpUrlUtils.setUserId(data.id+"")
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
... ... @@ -71,14 +71,14 @@ export class LoginViewModel {
let passwordNew = await this.doMd(password)
Logger.debug(TAG, "PASSWORD:" + passwordNew)
this.loginModel.appLoginByPassword(phone, loginType, passwordNew, oldPassword).then((data: LoginBean) => {
SPHelper.default.save(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.save(SpConstants.USER_ID, data.id)
SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.save(SpConstants.USER_STATUS, data.status)
SPHelper.default.save(SpConstants.USER_Type, data.userType)
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark)
SPHelper.default.saveSync(SpConstants.USER_ID, data.id)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark)
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken)
SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
HttpUrlUtils.setUserId(data.id+"")
HttpUrlUtils.setUserType(data.userType+"")
HttpUrlUtils.setUserToken(data.jwtToken)
... ... @@ -94,8 +94,8 @@ export class LoginViewModel {
return new Promise<CheckVerifyBean>((success, reject) => {
this.loginModel.checkVerifyCode(phone, verifyCode).then((data: CheckVerifyBean) => {
//todo 保存数据
SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.tempToken)
SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_TEMP_TOKEN, data.tempToken)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
success(data)
}, (value: string) => {
... ... @@ -107,8 +107,8 @@ export class LoginViewModel {
return new Promise<CheckVerifyBean>((success, reject) => {
this.loginModel.checkVerifyCodeByToken(verifyCode).then((data: CheckVerifyBean) => {
//todo 保存数据
SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.tempToken)
SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken)
SPHelper.default.saveSync(SpConstants.USER_TEMP_TOKEN, data.tempToken)
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken)
success(data)
}, (value: string) => {
... ... @@ -149,14 +149,14 @@ export class LoginViewModel {
this.loginModel.logOut().then((data) => {
//清除登录状态以及token、userid等信息
SPHelper.default.save(SpConstants.USER_FIRST_MARK, '')
SPHelper.default.save(SpConstants.USER_ID, '')
SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '')
SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '')
SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, '')
SPHelper.default.save(SpConstants.USER_STATUS, '')
SPHelper.default.save(SpConstants.USER_Type, '')
SPHelper.default.save(SpConstants.USER_NAME, '')
SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, '')
SPHelper.default.saveSync(SpConstants.USER_ID, '')
SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, '')
SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '')
SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, '')
SPHelper.default.saveSync(SpConstants.USER_STATUS, '')
SPHelper.default.saveSync(SpConstants.USER_Type, '')
SPHelper.default.saveSync(SpConstants.USER_NAME, '')
HttpUrlUtils.setUserId("")
HttpUrlUtils.setUserType("")
HttpUrlUtils.setUserToken('')
... ... @@ -218,14 +218,14 @@ export class LoginViewModel {
this.loginModel.queryUserDetail().then((data: UserDetail) => {
//保存sp
if(data){
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.save(SpConstants.USER_PHONE, data.phone)
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone)
}
if(data.userExtend){
SPHelper.default.save(SpConstants.USER_SEX, data.userExtend.sex)
SPHelper.default.save(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"")
SPHelper.default.save(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
SPHelper.default.save(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex)
SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"")
SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
}
success(data)
... ...
... ... @@ -14,7 +14,7 @@ import {
StringUtils,
WindowModel
} from 'wdKit';
import { HttpUrlUtils, WDHttp } from 'wdNetwork';
import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
... ... @@ -25,7 +25,7 @@ export default class EntryAbility extends UIAbility {
WDHttp.initHttpHeader()
const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string
if (StringUtils.isNotEmpty(spHostUrl)) {
HttpUrlUtils.hostUrl = spHostUrl
HostManager.changeHost(spHostUrl as HostEnum)
}
// 注册监听网络连接
... ...