zhenghy
Showing 57 changed files with 1473 additions and 980 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
... ...
... ... @@ -124,4 +124,6 @@ export class WDRouterPage {
static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
// 栏目页面、频道详情
static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage");
//展示头像
static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage");
}
... ...
... ... @@ -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)
... ...
... ... @@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO {
relType: string;
liveStreamType?: number;
photoList: PhotoListBean[];
swiperIndex?: number
commentId?: string;
}
\ No newline at end of file
... ...
export interface UserInfoDTO {
userHeadUrl:string
userHeadUrl: string
userName?: string
headPhotoUrl?: string
}
... ...
... ... @@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent"
export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
... ...
... ... @@ -9,6 +9,7 @@ import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow05 } from './compview/ZhSingleRow05';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
... ... @@ -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) {
... ...
... ... @@ -44,9 +44,9 @@ export struct DynamicDetailComponent {
/**
* 关注状态:默认未关注 点击去关注
*/
@State followStatus: String = '0';
@State followStatus: String = '';
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined// 点赞、收藏状态
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
... ... @@ -121,31 +121,33 @@ export struct DynamicDetailComponent {
}
.width('63%')
.margin({right: $r('app.float.margin_6')})
if (this.followStatus == '0') {
Text('关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
this.handleAccention()
})
} else {
Text('已关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
})
if(!StringUtils.isEmpty(this.followStatus)){
if (this.followStatus == '0') {
Text('关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
this.handleAccention()
})
} else {
Text('已关注')
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
})
}
}
}
.width('100%')
... ... @@ -209,7 +211,7 @@ export struct DynamicDetailComponent {
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
} else {
GridCol({
... ... @@ -226,7 +228,7 @@ export struct DynamicDetailComponent {
})
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
}
} else if (this.contentDetailData.photoList.length === 4) {
... ... @@ -238,7 +240,7 @@ export struct DynamicDetailComponent {
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
} else {
GridCol({
... ... @@ -249,7 +251,7 @@ export struct DynamicDetailComponent {
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList)
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
})
}
})
... ... @@ -330,8 +332,8 @@ export struct DynamicDetailComponent {
Image(this.newsStatusOfUser?.likeStatus == '1'?
$r('app.media.icon_like_selected_redheart')
:$r('app.media.icon_like_unselect_grey_redheart'))
.width($r('app.float.margin_24'))
.height($r('app.float.margin_24'))
.width($r('app.float.margin_36'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
if(this.interactDataDTO?.likeNum != 0){
Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
... ... @@ -430,12 +432,18 @@ export struct DynamicDetailComponent {
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData[0]?.newsId + '',
contentType: this.contentDetailData[0]?.newsType + '',
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
... ... @@ -453,16 +461,23 @@ export struct DynamicDetailComponent {
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
this.followStatus = '0';
return
}
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
this.followStatus = '0';
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
}
}
//创建跳转信息
... ... @@ -558,18 +573,13 @@ export struct DynamicDetailComponent {
contentType: this.contentDetailData?.newsType + '',
}
ContentDetailRequest.postExecuteLike(params).then(res => {
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus === '1') {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
} else {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
// this.queryContentInteractCount()
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus === '1') {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
} else {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
})
}
}
... ...
... ... @@ -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)*/
}
}
... ...
... ... @@ -20,7 +20,7 @@ export struct ImageDownloadComponent {
@State image: PixelMap | undefined = undefined;
@State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例
@State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
url: string = ''
@Prop @Watch('onChangeUrl') url: string = ''
build() {
Column() {
... ... @@ -40,7 +40,11 @@ export struct ImageDownloadComponent {
}
async aboutToAppear(): Promise<void> {
aboutToAppear(): void {
this.onChangeUrl()
}
async onChangeUrl(): Promise<void> {
console.info(`cj2024 图片下载 ${this.url}`)
const context = getContext(this) as common.UIAbilityContext;
const atManager = abilityAccessCtrl.createAtManager();
... ...
import { PhotoListBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { display, router } from '@kit.ArkUI';
import { ImageDownloadComponent } from './ImageDownloadComponent';
import { ImageItemView } from './view/ImageItemView';
const TAG = 'ImageSwiperComponent';
@Component
export struct ImageSwiperComponent {
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private scroller: Scroller = new Scroller()
@State swiperIndex: number = 0;
photoList: PhotoListBean[] = [];
private swiperController: SwiperController = new SwiperController()
private displayTool = display.getDefaultDisplaySync()
private screenWidth: number = 0
private picWidth: number = 0
@State picHeight: number = 0
@State isEnableSwipe: boolean = true;
// @Provide bgc: Color = Color.White;
//watch监听页码回调
onCurrentPageNumUpdated(): void {
Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)
let _swiperIndex = Number.parseInt(this.currentPageNum)
Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
}
aboutToAppear(): void {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
// this.picWidth = this.screenWidth - vp2px(52)
this.picWidth = this.screenWidth
this.picHeight = this.picWidth * 578 / 375
}
build() {
RelativeContainer() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
router.back();
})
.id("backImg")
if (this.photoList && this.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.photoList, (item: PhotoListBean) => {
// MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })
})
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
})
Row() {
Scroll(this.scroller) {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.photoList.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}.fontColor(Color.White).margin(4)
}
}
.width('100%')
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
}
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath })
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End }
})
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
.id("downloadImg")
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
}
\ No newline at end of file
import { NetworkUtil, Logger, NetworkType, SPHelper, } from 'wdKit';
import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel} from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -78,230 +78,236 @@ export struct MultiPictureDetailPageComponent {
build() {
RelativeContainer() {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
Swiper(this.swiperControllerItem) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
this.init()
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
@Builder
init() {
if (this.contentDetailData.rmhPlatform == 1) {
Row() {
Row({ space: 8 }) {
Row() {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
}
.width('13%')
.height('100%')
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.SpaceAround,
alignItems: ItemAlign.Start
}) {
Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
.fontColor(Color.White)
.fontSize(14)
.fontFamily('PingFang PingFang SC-Medium')
.fontWeight(500)
.lineHeight(17)
.margin(0)
.height(17)
Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
.fontColor('#676767')
.fontSize(12)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(14)
.height(14)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin(0)
.maxLines(1)
}
.width('100%')
.height('100%')
.vertical(true)
.autoPlay(false)
.cachedCount(1)
.indicator(false)
.displayCount(1)
.onAnimationEnd(event => {
router.back()
})
})
}
.width('81%')
.height('100%')
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.loop(false)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
.width('74.4%')
.height('100%')
.margin({
top: 0,
bottom: 0,
left: 16,
right: 0
})
if (this.contentDetailData.rmhPlatform == 1) {
if (this.followStatus == '0') {
Row() {
Row({ space: 8 }) {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
}
.width('13%')
.height('100%')
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.SpaceAround,
alignItems: ItemAlign.Start
}) {
Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
.fontColor(Color.White)
.fontSize(14)
.fontFamily('PingFang PingFang SC-Medium')
.fontWeight(500)
.lineHeight(17)
.margin(0)
.height(17)
Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
.fontColor('#676767')
.fontSize(12)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(14)
.height(14)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin(0)
}
}
.width('81%')
.height('100%')
Text('+关注').fontSize(12).fontColor(0xffffff)
}.alignItems(VerticalAlign.Center)
}
.width('74.4%')
.height('100%')
.margin({
top: 0,
bottom: 0,
left: 16,
right: 0
.borderRadius(4)
.backgroundColor('#ED2800')
.width(48)
.height(24)
.onClick(() => {
this.handleAccention()
})
if (this.followStatus == '0') {
Row() {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
Text('+关注').fontSize(12).fontColor(0xffffff)
}.alignItems(VerticalAlign.Center)
}
.borderRadius(4)
.backgroundColor('#ED2800')
.width(48)
.height(24)
.onClick(() => {
this.handleAccention()
})
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('21.6%')
.height('100%')
}
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('21.6%')
.height('100%')
}
}
.width('100%')
.height(44)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('e_attention')
}
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
Swiper(this.swiperControllerItem) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
}
.width('100%')
.height(44)
.alignRules({
top: { anchor: "e_swiper_content", align: VerticalAlign.Top },
middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center }
.height('100%')
.vertical(true)
.autoPlay(false)
.cachedCount(1)
.indicator(false)
.displayCount(1)
.onAnimationEnd(event => {
router.back()
})
.id('e_attention')
}
Row() {
Scroll(this.scroller) {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.contentDetailData.photoList.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}.fontColor(Color.White).margin(4)
})
}
.index(this.swiperIndex)
.width('100%')
.height(px2vp(this.picHeight) + 32)
.vertical(false)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.loop(false)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.onChange((index: number) => {
this.swiperIndex = index
})
Text(`${this.contentDetailData.newsTitle}`)
.fontColor(Color.White)
.fontSize(16)
.fontFamily('PingFang SC-Semibold')
.fontWeight(600)
.lineHeight(24)
.margin({
top: 4,
left: 0,
bottom: 4,
right: 0
})
Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
.fontColor(Color.White)
Row() {
Scroll(this.scroller) {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.contentDetailData.photoList.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(22)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({
top: 4,
left: 0,
bottom: 4,
right: 18
})
.maxLines(16)
}
}
.width('100%')
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.height(px2vp(this.titleHeight))
}
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.height(px2vp(this.titleHeight) + 64)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}.fontColor(Color.White).margin(4)
}
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: this.netStatus, emptyButton: true, retry: () => {
this.getContentDetailData()
Text(`${this.contentDetailData.newsTitle}`)
.fontColor(Color.White)
.fontSize(16)
.fontFamily('PingFang SC-Semibold')
.fontWeight(600)
.lineHeight(24)
.margin({
top: 4,
left: 0,
bottom: 4,
right: 0
})
Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
.fontColor(Color.White)
.fontSize(14)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(22)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({
top: 4,
left: 0,
bottom: 4,
right: 18
})
.maxLines(16)
}
}
})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
.width('100%')
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.height(px2vp(this.titleHeight))
}
OperRowListView({
contentDetailData: this.contentDetailData,
.id('e_swiper_titles')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.height(px2vp(this.titleHeight) + 64)
}
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: this.netStatus, emptyButton: true, retry: () => {
this.getContentDetailData()
}
})
.id('e_empty_content')
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.width('100%')
.height(56)
.margin({
top: 16,
left: 16,
right: 16,
bottom: 0
})
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
.id('e_oper_row')
}
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.id('e_picture_container')
// 设置顶部绘制延伸到状态栏
// 设置底部绘制延伸到导航条
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
OperRowListView({
contentDetailData: this.contentDetailData,
})
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.width('100%')
.height(56)
.margin({
top: 16,
left: 16,
right: 16,
bottom: 0
})
.border({ width: { top: 0.5 }, color: '#FFFFFF' })
.id('e_oper_row')
}
getContentDetailData() {
... ... @@ -318,6 +324,11 @@ export struct MultiPictureDetailPageComponent {
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
if (this.contentDetailData.rmhPlatform == 1) {
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
... ...
... ... @@ -102,7 +102,7 @@ export struct Card19Component {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
ProcessUtils.gotoMultiPictureListPage(photoList,0)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
... ...
... ... @@ -104,6 +104,9 @@ struct createImg {
}
.align(Alignment.BottomEnd)
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoVod(this.contentDTO)
})
} else {
// 竖图显示,宽度占50%,高度自适应
GridCol({
... ...
... ... @@ -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
... ...
... ... @@ -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() { }
... ...
... ... @@ -29,13 +29,11 @@ struct MineHomePage {
registTime:number = 0//账号注册时间
@State registerTimeForDay:number = 0
aboutToAppear(){
onPageShow(): void {
this.getUserInfo()
this.getUserLevel()
}
build() {
Stack({ alignContent: Alignment.Top }){
Image($r('app.media.title_bg'))
... ... @@ -65,9 +63,8 @@ struct MineHomePage {
.height('130lpx')
.objectFit(ImageFit.Cover)
}.onClick(()=>{
//TODO 显示头像
let params = {'userId': "531267787833221"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
}).width('135lpx')
.height('135lpx')
... ... @@ -370,6 +367,9 @@ struct MineHomePage {
if(StringUtils.isNotEmpty(value.introduction)){
this.desc = value.introduction
this.isHasIntroduction = true
}else{
this.desc = "点击添加简介,让大家认识你"
this.isHasIntroduction = false
}
this.browseNum = value.browseNum
this.commentNum = value.commentNum
... ...
import { PhotoListBean } from 'wdBean/Index';
import { display, router } from '@kit.ArkUI';
import { Logger } from 'wdKit/Index';
import { ImageItemView } from '../components/view/ImageItemView';
import { ImageDownloadComponent } from '../components/ImageDownloadComponent';
import { Action } from 'wdBean';
... ... @@ -10,7 +9,6 @@ const TAG = 'MultiPictureListPage';
@Entry
@Component
export struct MultiPictureListPage {
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private scroller: Scroller = new Scroller()
@State swiperIndex: number = 0;
photoList: PhotoListBean[] = [];
... ... @@ -20,17 +18,10 @@ export struct MultiPictureListPage {
private picWidth: number = 0
@State picHeight: number = 0
@State isEnableSwipe: boolean = true;
@State currentUrl: string = ''
// @Provide bgc: Color = Color.White;
//watch监听页码回调
onCurrentPageNumUpdated(): void {
Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)
let _swiperIndex = Number.parseInt(this.currentPageNum)
Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
}
aboutToAppear(): void {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
... ... @@ -40,6 +31,8 @@ export struct MultiPictureListPage {
let par: Action = router.getParams() as Action;
let params = par?.params;
this.photoList = params?.extra?.photoList || [];
this.swiperIndex = params?.extra?.swiperIndex || 0;
this.currentUrl = this.photoList[this.swiperIndex]?.picPath
}
build() {
... ... @@ -80,6 +73,7 @@ export struct MultiPictureListPage {
})
.onChange((index: number) => {
this.swiperIndex = index
this.currentUrl = this.photoList[index]?.picPath
})
Row() {
... ... @@ -121,7 +115,7 @@ export struct MultiPictureListPage {
})
}
ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath })
ImageDownloadComponent({ url: this.currentUrl })
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End }
... ...
import { router } from '@kit.ArkUI';
@Entry
@Component
struct ShowUserHeaderPage {
@State headPhotoUrl: string = '';
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('720lpx')
.height('720lpx')
.objectFit(ImageFit.Auto)
.clip(new Circle({ width: '720lpx', height: '720lpx' }))
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_000000'))
.onClick(()=>{
router.back()
})
}
}
\ No newline at end of file
... ...
... ... @@ -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;
//移除音频 和 活动
... ...
... ... @@ -21,6 +21,7 @@
"components/page/LiveMorePage",
"components/page/ReserveMorePage",
"pages/VideoPlayPage",
"components/page/ThemeListPage"
"components/page/ThemeListPage",
"pages/ShowUserHeaderPage"
]
}
\ No newline at end of file
... ...
... ... @@ -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
... ...
... ... @@ -32,15 +32,15 @@ export struct DetailPlayLivePage {
aboutToAppear(): void {
Logger.info(TAG, `wyj-aboutToAppear`)
this.listener?.on("change", (mediaQueryResult) => {
Logger.info(TAG, `change;${mediaQueryResult.matches}`)
if (mediaQueryResult?.matches) {
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
} else {
this.displayDirection = DisplayDirection.VERTICAL
}
WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)
})
// this.listener?.on("change", (mediaQueryResult) => {
// Logger.info(TAG, `change;${mediaQueryResult.matches}`)
// if (mediaQueryResult?.matches) {
// this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
// } else {
// this.displayDirection = DisplayDirection.VERTICAL
// }
// WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)
// })
this.getLiveDetails()
this.getLiveRoomData()
}
... ... @@ -67,7 +67,7 @@ export struct DetailPlayLivePage {
onPageShowCus(): void {
Logger.info(TAG, `wyj-onPageShowCus`)
// WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
// WindowModel.shared.setPreferredOrientation(window.Orientation.LOCKED);
}
onPageHideCus(): void {
... ...
... ... @@ -100,7 +100,7 @@ export struct TabLiveItemComponent {
picDesc: ''
})
}
this.gotoMultipleListImagePage()
this.gotoMultipleListImagePage(index)
})
})
}
... ... @@ -187,13 +187,14 @@ export struct TabLiveItemComponent {
* 大图列表页
* @param content
* */
gotoMultipleListImagePage() {
gotoMultipleListImagePage(index: number) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 18,
extra: {
photoList: this.photoList
photoList: this.photoList,
swiperIndex: index,
} as ExtraDTO
} as Params,
};
... ...
... ... @@ -191,12 +191,15 @@ export struct PlayUIComponent {
@Builder
getMiddleUIComponent() {
Stack()
.layoutWeight(1)
.width('100%')
.onClick(() => {
this.isMenuVisible = !this.isMenuVisible
})
Stack() {
Text('播放功能暂时关闭')
.fontColor(Color.White)
}.alignContent(Alignment.Center)
.layoutWeight(1)
.width('100%')
.onClick(() => {
this.isMenuVisible = !this.isMenuVisible
})
}
@Builder
... ...
... ... @@ -13,7 +13,7 @@ export struct TopPlayComponent {
aboutToAppear(): void {
if (this.playerController) {
this.playerController.onCanplay = () => {
this.playerController?.play()
// this.playerController?.play()
}
}
}
... ... @@ -31,7 +31,7 @@ export struct TopPlayComponent {
} else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
this.playerController?.firstPlay(playUrl);
// this.playerController?.firstPlay(playUrl);
}
}
... ...
... ... @@ -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)
}
// 注册监听网络连接
... ...