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

Too many changes to show.

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

@@ -67,15 +67,15 @@ export const enum CompStyle { @@ -67,15 +67,15 @@ export const enum CompStyle {
67 67
68 68
69 69
70 - Card_Adv_4 = 4, //4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告  
71 - Card_Adv_5 = 5,  
72 - Card_Adv_6 = 5,  
73 - Card_Adv_7 = 7,  
74 - Card_Adv_8 = 8,  
75 - Card_Adv_9 = 9,  
76 - Card_Adv_10 = 10,  
77 - Card_Adv_11 = 11,  
78 - Card_Adv_12 = 12, 70 + Card_Adv_4 = 4, //4:轮播图
  71 + Card_Adv_5 = 5, // 5:三图广告
  72 + Card_Adv_6 = 6, // 6:小图广告
  73 + Card_Adv_7 = 7, // 7:长通栏广告
  74 + Card_Adv_8 = 8, // 8:大图广告
  75 + Card_Adv_9 = 9, // 9:视频广告
  76 + Card_Adv_10 = 10, // 10:展会广告
  77 + Card_Adv_11 = 11, // 11:冠名广告
  78 + Card_Adv_12 = 12, // 12:顶部长通栏广告
79 79
80 /** 80 /**
81 * 本地稿件和组件样式 81 * 本地稿件和组件样式
@@ -11,6 +11,15 @@ export enum EmitterEventId { @@ -11,6 +11,15 @@ export enum EmitterEventId {
11 // 跳转首页指定频道,事件id 11 // 跳转首页指定频道,事件id
12 JUMP_HOME_CHANNEL = 4, 12 JUMP_HOME_CHANNEL = 4,
13 13
14 - LOCATION = 5 14 + LOCATION = 5,
  15 + /*发布评论*/
  16 + COMMENT_PUBLISH = 6,
  17 +
  18 + // App回到前台
  19 + APP_ENTER_FOREGROUD = 100,
  20 + // App进入后台
  21 + APP_ENTER_BACKGROUD = 101,
  22 +
  23 +
15 } 24 }
16 25
@@ -289,4 +289,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> { @@ -289,4 +289,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
289 this.dataArray.splice(start, this.dataArray.length, ...data); 289 this.dataArray.splice(start, this.dataArray.length, ...data);
290 this.notifyDataReload() 290 this.notifyDataReload()
291 } 291 }
  292 +
  293 + public reloadData(): void {
  294 + this.notifyDataReload();
  295 + }
292 } 296 }
@@ -6,41 +6,34 @@ import { SPHelper } from './SPHelper' @@ -6,41 +6,34 @@ import { SPHelper } from './SPHelper'
6 import { StringUtils } from './StringUtils' 6 import { StringUtils } from './StringUtils'
7 7
8 export class UserDataLocal { 8 export class UserDataLocal {
9 - public static userId=''  
10 - public static userType=''  
11 - public static token=''  
12 - public static userName=''  
13 -  
14 - public static userHeaderUrl=''  
15 - public static userLevel = -1  
16 - public static userLevelHeaderUrl='' 9 + private static userId=''
  10 + private static userType=''
  11 + private static userName=''
  12 + private static userHeaderUrl=''
  13 + private static userLevel = -1
  14 + private static userLevelHeaderUrl=''
17 15
18 //先写死 16 //先写死
19 static USER_ID="userId" 17 static USER_ID="userId"
20 static USER_Type="userType" 18 static USER_Type="userType"
21 - static USER_JWT_TOKEN="jwtToken"  
22 static USER_NAME="userName" 19 static USER_NAME="userName"
23 -  
24 static USER_HEADER_URL="userHeaderUrl" 20 static USER_HEADER_URL="userHeaderUrl"
25 static USER_LEVEL="userLevel" 21 static USER_LEVEL="userLevel"
26 static USER_LEVEL_HEADER_URL="userLevelHeaderUrl" 22 static USER_LEVEL_HEADER_URL="userLevelHeaderUrl"
27 - static USER_FOLLOW_OPERATION="user_follow_operation"  
28 -  
29 - //刷新token 用到  
30 - static USER_REFRESH_TOKEN="refreshToken"  
31 23
  24 + static USER_FOLLOW_OPERATION="user_follow_operation"
32 25
33 /** 26 /**
34 * 清除 本地用户数据 27 * 清除 本地用户数据
35 */ 28 */
36 public static clearUserData(){ 29 public static clearUserData(){
37 - SPHelper.default.deleteSync(UserDataLocal.USER_ID)  
38 - SPHelper.default.deleteSync(UserDataLocal.USER_Type)  
39 - SPHelper.default.deleteSync(UserDataLocal.USER_JWT_TOKEN) //待确认  
40 - SPHelper.default.deleteSync(UserDataLocal.USER_NAME)  
41 - SPHelper.default.deleteSync(UserDataLocal.USER_HEADER_URL)  
42 - SPHelper.default.deleteSync(UserDataLocal.USER_LEVEL)  
43 - SPHelper.default.deleteSync(UserDataLocal.USER_LEVEL_HEADER_URL) 30 + UserDataLocal.userId=''
  31 + UserDataLocal.userType=''
  32 + UserDataLocal.userName=''
  33 +
  34 + UserDataLocal.userHeaderUrl=''
  35 + UserDataLocal.userLevel = -1
  36 + UserDataLocal.userLevelHeaderUrl=''
44 } 37 }
45 38
46 public static getUserId() { 39 public static getUserId() {
@@ -59,17 +52,6 @@ export class UserDataLocal { @@ -59,17 +52,6 @@ export class UserDataLocal {
59 return UserDataLocal.userType; 52 return UserDataLocal.userType;
60 } 53 }
61 54
62 - private static getXToken() {  
63 - if(StringUtils.isNotEmpty(UserDataLocal.token)){  
64 - return UserDataLocal.token  
65 - }  
66 - UserDataLocal.token = SPHelper.default.getSync(UserDataLocal.USER_JWT_TOKEN,"") as string  
67 - if(StringUtils.isNotEmpty(UserDataLocal.token)) {  
68 - return UserDataLocal.token  
69 - }  
70 - return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';  
71 - }  
72 -  
73 public static getUserName() { 55 public static getUserName() {
74 if(StringUtils.isNotEmpty(UserDataLocal.userName)){ 56 if(StringUtils.isNotEmpty(UserDataLocal.userName)){
75 return UserDataLocal.userName 57 return UserDataLocal.userName
@@ -118,4 +100,5 @@ export class UserDataLocal { @@ -118,4 +100,5 @@ export class UserDataLocal {
118 public static setUserLevelHeaderUrl(url:string) { 100 public static setUserLevelHeaderUrl(url:string) {
119 SPHelper.default.save(UserDataLocal.USER_LEVEL_HEADER_URL, url) 101 SPHelper.default.save(UserDataLocal.USER_LEVEL_HEADER_URL, url)
120 } 102 }
  103 +
121 } 104 }
@@ -8,3 +8,5 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" @@ -8,3 +8,5 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils"
8 8
9 export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil" 9 export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil"
10 10
  11 +export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager"
  12 +
  1 +import { SpConstants } from 'wdConstant';
  2 +import { SPHelper, StringUtils } from 'wdKit';
  3 +import { HostEnum, HostManager } from './HttpHostManager';
  4 +
  5 +/**
  6 + * 网络请求参数工具类
  7 + */
  8 +export class HttpParams {
  9 + private static userId = ''
  10 + private static userType = ''
  11 + private static token = ''
  12 +
  13 + static buildHeaders(): Record<string, string> {
  14 + let headers: Record<string, string> = {};
  15 + // 通用请求头
  16 + headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)'
  17 + headers['channel'] = HttpParams.getChannel()
  18 + headers['plat'] = HttpParams.getPlat()
  19 + headers['Content-Type'] = 'application/json; charset=utf-8'
  20 + headers['timestamp'] = HttpParams.getTimestamp()
  21 + headers['RMRB-X-TOKEN'] = HttpParams.getXToken()
  22 + headers['device_id'] = HttpParams.getDeviceId()
  23 + if (HttpParams.getXToken() != '') {
  24 + headers['cookie'] = 'RMRB-X-TOKEN=' + HttpParams.getXToken()
  25 + }
  26 + headers['build_version'] = HttpParams.getVersion()
  27 + headers['adcode'] = HttpParams.getAdCode()
  28 + headers['os_version'] = HttpParams.getOsVersion()
  29 + headers['versionCode'] = HttpParams.getVersionCode()
  30 + headers['system'] = HttpParams.getTerminalId()
  31 + headers['version_name'] = HttpParams.getVersionName()
  32 + headers['EagleEye-TraceID'] = 'D539562E48554A60977AF4BECB6D6C7A'
  33 + headers['imei'] = HttpParams.getImei()
  34 + headers['Accept-Language'] = 'zh'
  35 + HttpParams.setLocationHeader(headers)
  36 + // // TODO 判断是否登录
  37 + headers['userId'] = HttpParams.getUserId()
  38 + headers['userType'] = HttpParams.getUserType()
  39 + //
  40 + headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
  41 + HttpParams.addSpecialHeaders(headers);
  42 + return headers;
  43 + }
  44 +
  45 + static addSpecialHeaders(headers: Record<string, string>) {
  46 + switch (HostManager.getHost()) {
  47 + case HostEnum.HOST_UAT:
  48 + headers['X-Ca-Stage'] = 'PRE'
  49 + headers['Authorization'] = 'APPCODE 83092caa603a421aa0222308b3f6b27a'
  50 + headers['appCode'] = '83092caa603a421aa0222308b3f6b27a'
  51 + break
  52 + case HostEnum.HOST_SIT:
  53 + headers['X-Ca-Stage'] = 'TEST'
  54 + headers['Authorization'] = 'APPCODE 0af1f9085e484c97b2a44704bae72c07'
  55 + headers['appCode'] = '0af1f9085e484c97b2a44704bae72c07'
  56 + break
  57 + case HostEnum.HOST_PRODUCT:
  58 + headers['X-Ca-Stage'] = 'RELEASE'
  59 + headers['Authorization'] = 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'
  60 + headers['appCode'] = '3d4181bceeb94d9780e10dbb6c67bbf6'
  61 + break
  62 + case HostEnum.HOST_DEV:
  63 + headers['X-Ca-Stage'] = 'TEST'
  64 + headers['Authorization'] = 'APPCODE ff33172859e14f9a8299e3bd769e79f9'
  65 + headers['appCode'] = 'ff33172859e14f9a8299e3bd769e79f9'
  66 + break
  67 + default:
  68 + break
  69 + }
  70 + }
  71 +
  72 + static setLocationHeader(headers: Record<string, string>) {
  73 + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
  74 + if (StringUtils.isNotEmpty(cityName)) {
  75 + headers['city'] = encodeURI(cityName)
  76 + }
  77 + let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
  78 + if (StringUtils.isNotEmpty(cityCode)) {
  79 + headers['city_dode'] = encodeURI(cityCode)
  80 + }
  81 + }
  82 +
  83 + private static getCity() {
  84 + // TODO 对接定位
  85 + return '%E5%90%88%E8%82%A5%E5%B8%82';
  86 + }
  87 +
  88 + private static getChannel() {
  89 + // TODO 对接配置
  90 + return 'rmrb_china_0000';
  91 + }
  92 +
  93 + private static getPlat() {
  94 + return 'Phone';
  95 + }
  96 +
  97 + private static getTimestamp() {
  98 + // return DateTimeUtils.getCurrentTime() + '';
  99 + // TODO 暂时写死,有些page 真实时间戳 返回数据为空
  100 + return '155203523';
  101 + }
  102 +
  103 + private static getXToken() {
  104 + if (StringUtils.isNotEmpty(HttpParams.token)) {
  105 + return HttpParams.token
  106 + }
  107 + HttpParams.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
  108 + if (StringUtils.isNotEmpty(HttpParams.token)) {
  109 + return HttpParams.token
  110 + }
  111 + // return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
  112 + return ''
  113 + }
  114 +
  115 + static getRefreshToken(): string {
  116 + let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")
  117 + if (StringUtils.isNotEmpty(refreshToken)) {
  118 + return refreshToken as string;
  119 + }
  120 + return '';
  121 + }
  122 +
  123 + public static getDeviceId() {
  124 + // TODO
  125 + return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
  126 + }
  127 +
  128 + private static getVersion() {
  129 + // TODO
  130 + return '202401242103';
  131 + }
  132 +
  133 + private static getVersionCode() {
  134 + // TODO
  135 + return '7301';
  136 + }
  137 +
  138 + private static getVersionName() {
  139 + // TODO
  140 + return '7.3.0.1';
  141 + }
  142 +
  143 + private static getAdCode() {
  144 + return '340000';
  145 + }
  146 +
  147 + private static getOsVersion() {
  148 + // TODO
  149 + return '12';
  150 + }
  151 +
  152 + public static getCityCode() {
  153 + // TODO
  154 + return '340100';
  155 + }
  156 +
  157 + public static getProvinceCode() {
  158 + // TODO
  159 + return '340000';
  160 + }
  161 +
  162 + /**
  163 + * 地区code
  164 + */
  165 + public static getDistrictCode() {
  166 + // TODO
  167 + return '340103';
  168 + }
  169 +
  170 + private static getTerminalId() {
  171 + return 'Android';
  172 + }
  173 +
  174 + public static getImei() {
  175 + // TODO
  176 + return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
  177 + }
  178 +
  179 + public static getUserId(): string {
  180 + // TODO 对接登录
  181 + if (StringUtils.isNotEmpty(HttpParams.userId)) {
  182 + return HttpParams.userId
  183 + }
  184 + HttpParams.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string
  185 + return HttpParams.userId;
  186 + }
  187 +
  188 + public static getUserType() {
  189 + if (StringUtils.isNotEmpty(HttpParams.userType)) {
  190 + return HttpParams.userType
  191 + }
  192 + HttpParams.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string
  193 + return HttpParams.userType;
  194 + }
  195 +
  196 + public static setUserId(userId: string) {
  197 + HttpParams.userId = userId;
  198 + }
  199 +
  200 + public static setUserType(userType: string) {
  201 + HttpParams.userType = userType;
  202 + }
  203 +
  204 + public static setUserToken(token: string) {
  205 + HttpParams.token = token;
  206 + }
  207 +}
  1 +export enum HostEnum {
  2 + /**
  3 + * uat环境url
  4 + */
  5 + HOST_UAT = 'https://pd-apis-uat.pdnews.cn',
  6 + /**
  7 + * 中文端sit环境
  8 + */
  9 + HOST_SIT = 'https://pd-apis-sit.pdnews.cn',
  10 + /**
  11 + * dev环境url
  12 + */
  13 + HOST_DEV = 'https://pd-apis-dev.pdnews.cn',
  14 + /**
  15 + * 正式环境url
  16 + */
  17 + HOST_PRODUCT = 'https://pdapis.pdnews.cn',
  18 +}
  19 +
  20 +/**
  21 + * 环境host管理工具类
  22 + */
  23 +export class HostManager {
  24 + private static _hostUrl: HostEnum = HostEnum.HOST_PRODUCT;
  25 +
  26 + static changeHost(host: HostEnum) {
  27 + HostManager._hostUrl = host;
  28 + }
  29 +
  30 + static getHost(): string {
  31 + return HostManager._hostUrl;
  32 + }
  33 +}
1 import ArrayList from '@ohos.util.ArrayList'; 1 import ArrayList from '@ohos.util.ArrayList';
2 import service from './AxiosRequest'; 2 import service from './AxiosRequest';
3 -import { HttpUtils } from '../utils/HttpUtils';  
4 import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios'; 3 import { AxiosError, AxiosHeaders, AxiosRequestConfig, RawAxiosRequestHeaders } from '@ohos/axios';
5 import { ResponseDTO } from '../bean/ResponseDTO'; 4 import { ResponseDTO } from '../bean/ResponseDTO';
6 import HashMap from '@ohos.util.HashMap'; 5 import HashMap from '@ohos.util.HashMap';
  6 +import { HttpParams } from './HttpCommonParams';
7 7
8 export class HttpRequest { 8 export class HttpRequest {
9 private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList(); 9 private static globalHeaderProviders: ArrayList<() => Record<string, string>> = new ArrayList();
@@ -14,7 +14,7 @@ export class HttpRequest { @@ -14,7 +14,7 @@ export class HttpRequest {
14 14
15 static initHttpHeader() { 15 static initHttpHeader() {
16 HttpRequest.addGlobalHeaderProvider(() => { 16 HttpRequest.addGlobalHeaderProvider(() => {
17 - return HttpUtils.buildHeaders(); 17 + return HttpParams.buildHeaders();
18 }) 18 })
19 } 19 }
20 20
@@ -34,15 +34,17 @@ export class HttpRequest { @@ -34,15 +34,17 @@ export class HttpRequest {
34 34
35 static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders { 35 static buildHeaderWithGlobalHeader(headers?: HashMap<string, string>): AxiosHeaders {
36 let commonHeader: AxiosHeaders = new AxiosHeaders() 36 let commonHeader: AxiosHeaders = new AxiosHeaders()
37 - headers?.forEach((v, k) => {  
38 - commonHeader.set(k, v);  
39 - }); 37 +
40 HttpRequest.globalHeaderProviders.forEach((func) => { 38 HttpRequest.globalHeaderProviders.forEach((func) => {
41 let headers = func(); 39 let headers = func();
42 for (const obj of Object.entries(headers)) { 40 for (const obj of Object.entries(headers)) {
43 commonHeader.set(obj[0], obj[1]); 41 commonHeader.set(obj[0], obj[1]);
44 } 42 }
45 }) 43 })
  44 + // 业务headers,覆盖common(如果有冲突的话,取业务)
  45 + headers?.forEach((v, k) => {
  46 + commonHeader.set(k, v);
  47 + });
46 if (!commonHeader.get('Content-Type')) { 48 if (!commonHeader.get('Content-Type')) {
47 commonHeader.set('Content-Type', 'application/json;charset=utf-8'); 49 commonHeader.set('Content-Type', 'application/json;charset=utf-8');
48 } 50 }
@@ -56,24 +58,13 @@ export class HttpRequest { @@ -56,24 +58,13 @@ export class HttpRequest {
56 return service.get(url, config) 58 return service.get(url, config)
57 } 59 }
58 60
59 - static post0<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 61 + static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
60 let config: AxiosRequestConfig = { 62 let config: AxiosRequestConfig = {
61 headers: HttpRequest.buildHeaderWithGlobalHeader(headers) 63 headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
62 } 64 }
63 return service.post(url, data, config) 65 return service.post(url, data, config)
64 } 66 }
65 67
66 - static post<T = object>(url: string, data1?: object, headers?: HashMap<string, string>): Promise<T> {  
67 - let requestHeaders: AxiosHeaders = new AxiosHeaders()  
68 - headers?.forEach((v, k) => {  
69 - requestHeaders.set(k, v);  
70 - });  
71 - let config: AxiosRequestConfig = {  
72 - headers: requestHeaders as RawAxiosRequestHeaders,  
73 - }  
74 - return service.post(url, data1, config)  
75 - }  
76 -  
77 static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> { 68 static put<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
78 let config: AxiosRequestConfig = { 69 let config: AxiosRequestConfig = {
79 headers: HttpRequest.buildHeaderWithGlobalHeader(headers) 70 headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
1 import HashMap from '@ohos.util.HashMap'; 1 import HashMap from '@ohos.util.HashMap';
2 import { SpConstants } from 'wdConstant'; 2 import { SpConstants } from 'wdConstant';
3 import { SPHelper, StringUtils } from 'wdKit'; 3 import { SPHelper, StringUtils } from 'wdKit';
  4 +import { HostEnum, HostManager } from './HttpHostManager';
4 5
5 /** 6 /**
6 * 网络请求业务侧工具类 7 * 网络请求业务侧工具类
7 */ 8 */
8 export class HttpUrlUtils { 9 export class HttpUrlUtils {
9 /** 10 /**
10 - * uat环境url  
11 - */  
12 - static readonly HOST_UAT: string = "https://pd-apis-uat.pdnews.cn";  
13 - /**  
14 - * 中文端sit环境  
15 - */  
16 - static readonly HOST_SIT: string = "https://pd-apis-sit.pdnews.cn";  
17 - /**  
18 - * 正式环境url  
19 - */  
20 - static readonly HOST_PRODUCT: string = "https://pdapis.pdnews.cn";  
21 - /**  
22 - * dev环境url  
23 - */  
24 - static readonly HOST_DEV: string = "https://pd-apis-dev.pdnews.cn";  
25 - /**  
26 * 启动接口(底导接口) 11 * 启动接口(底导接口)
27 */ 12 */
28 static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; 13 static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup";
@@ -293,21 +278,14 @@ export class HttpUrlUtils { @@ -293,21 +278,14 @@ export class HttpUrlUtils {
293 * 获取启动页相关数据 278 * 获取启动页相关数据
294 */ 279 */
295 static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage"; 280 static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage";
296 - private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;  
297 /** 281 /**
298 * 推荐列表 282 * 推荐列表
299 */ 283 */
300 static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; 284 static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
301 -  
302 /** 285 /**
303 * 搜索推荐 286 * 搜索推荐
304 */ 287 */
305 static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; 288 static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
306 -  
307 - public static set hostUrl(value: string) {  
308 - HttpUrlUtils._hostUrl = value;  
309 - }  
310 -  
311 private static userId = '' 289 private static userId = ''
312 private static userType = '' 290 private static userType = ''
313 private static token = '' 291 private static token = ''
@@ -354,24 +332,24 @@ export class HttpUrlUtils { @@ -354,24 +332,24 @@ export class HttpUrlUtils {
354 } 332 }
355 333
356 static addSpecialHeaders(headers: HashMap<string, string>) { 334 static addSpecialHeaders(headers: HashMap<string, string>) {
357 - switch (HttpUrlUtils._hostUrl) {  
358 - case HttpUrlUtils.HOST_UAT: 335 + switch (HostManager.getHost()) {
  336 + case HostEnum.HOST_UAT:
359 // TODO 待优化到常量类里 337 // TODO 待优化到常量类里
360 headers.set('X-Ca-Stage', 'PRE'); 338 headers.set('X-Ca-Stage', 'PRE');
361 headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a'); 339 headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');
362 headers.set('appCode', '83092caa603a421aa0222308b3f6b27a'); 340 headers.set('appCode', '83092caa603a421aa0222308b3f6b27a');
363 break 341 break
364 - case HttpUrlUtils.HOST_SIT: 342 + case HostEnum.HOST_SIT:
365 headers.set('X-Ca-Stage', 'TEST'); 343 headers.set('X-Ca-Stage', 'TEST');
366 headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07'); 344 headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');
367 headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07'); 345 headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07');
368 break 346 break
369 - case HttpUrlUtils.HOST_PRODUCT: 347 + case HostEnum.HOST_PRODUCT:
370 headers.set('X-Ca-Stage', 'RELEASE'); 348 headers.set('X-Ca-Stage', 'RELEASE');
371 headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'); 349 headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');
372 headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6'); 350 headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6');
373 break 351 break
374 - case HttpUrlUtils.HOST_DEV: 352 + case HostEnum.HOST_DEV:
375 headers.set('X-Ca-Stage', 'TEST'); 353 headers.set('X-Ca-Stage', 'TEST');
376 headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9'); 354 headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');
377 headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9'); 355 headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9');
@@ -392,8 +370,8 @@ export class HttpUrlUtils { @@ -392,8 +370,8 @@ export class HttpUrlUtils {
392 } 370 }
393 } 371 }
394 372
395 - static getHost() {  
396 - return HttpUrlUtils._hostUrl; 373 + static getHost(): string {
  374 + return HostManager.getHost();
397 } 375 }
398 376
399 private static getCity() { 377 private static getCity() {
@@ -487,7 +465,7 @@ export class HttpUrlUtils { @@ -487,7 +465,7 @@ export class HttpUrlUtils {
487 return 'Android'; 465 return 'Android';
488 } 466 }
489 467
490 - public static getImei() { 468 + public static getImei() {
491 // TODO 469 // TODO
492 return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; 470 return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
493 } 471 }
@@ -510,48 +488,48 @@ export class HttpUrlUtils { @@ -510,48 +488,48 @@ export class HttpUrlUtils {
510 } 488 }
511 489
512 static getVerifyCodeUrl() { 490 static getVerifyCodeUrl() {
513 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode"; 491 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode";
514 return url; 492 return url;
515 } 493 }
516 494
517 static getVerifyCodeByTokenUrl() { 495 static getVerifyCodeByTokenUrl() {
518 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken"; 496 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/sendVerifyCodeByToken";
519 return url; 497 return url;
520 } 498 }
521 499
522 static getCheckVerifyCodeByToken() { 500 static getCheckVerifyCodeByToken() {
523 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken"; 501 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/checkVerifyCodeByToken";
524 return url; 502 return url;
525 } 503 }
526 504
527 505
528 static getForgetPasswordUrl() { 506 static getForgetPasswordUrl() {
529 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/forgotPassword"; 507 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/forgotPassword";
530 return url; 508 return url;
531 } 509 }
532 510
533 static getLogoutUrl() { 511 static getLogoutUrl() {
534 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/appLogout"; 512 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/appLogout";
535 return url; 513 return url;
536 } 514 }
537 515
538 static getRefreshTokenUrl() { 516 static getRefreshTokenUrl() {
539 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.REFRESH_TOKEN_PATH; 517 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.REFRESH_TOKEN_PATH;
540 return url; 518 return url;
541 } 519 }
542 520
543 static getResetPassworddUrl() { 521 static getResetPassworddUrl() {
544 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; 522 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/resetPassword";
545 return url; 523 return url;
546 } 524 }
547 525
548 static queryUserDetail() { 526 static queryUserDetail() {
549 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/queryUserDetail"; 527 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/queryUserDetail";
550 return url; 528 return url;
551 } 529 }
552 530
553 static editUserDetail() { 531 static editUserDetail() {
554 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/editUserDetail"; 532 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/editUserDetail";
555 return url; 533 return url;
556 } 534 }
557 535
@@ -561,308 +539,315 @@ export class HttpUrlUtils { @@ -561,308 +539,315 @@ export class HttpUrlUtils {
561 } 539 }
562 540
563 static getCheckVerifyCodeUrl() { 541 static getCheckVerifyCodeUrl() {
564 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode"; 542 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/checkVerifyCode";
565 return url; 543 return url;
566 } 544 }
567 545
568 static getAgreement() { 546 static getAgreement() {
569 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/agreement"; 547 + let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/agreement";
570 return url; 548 return url;
571 } 549 }
572 550
573 static getCheckVerifyByTokenCodeUrl() { 551 static getCheckVerifyByTokenCodeUrl() {
574 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken"; 552 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/checkVerifyCodeByToken";
575 return url; 553 return url;
576 } 554 }
577 555
578 556
579 /*优质评论页*/ 557 /*优质评论页*/
580 static getQualityCommentUrl() { 558 static getQualityCommentUrl() {
581 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/highQuality"; 559 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/highQuality";
582 560
583 return url 561 return url
584 } 562 }
585 563
586 /*获取详情页评论列表*/ 564 /*获取详情页评论列表*/
587 static getContentCommentListDataUrl() { 565 static getContentCommentListDataUrl() {
588 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/contentCommentList" 566 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/contentCommentList"
589 return url 567 return url
590 } 568 }
591 569
592 /*获取子评论列表*/ 570 /*获取子评论列表*/
593 static getChildContentCommentListDataUrl() { 571 static getChildContentCommentListDataUrl() {
594 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/childCommentList" 572 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/childCommentList"
595 return url 573 return url
596 } 574 }
597 575
598 /*评论状态*/ 576 /*评论状态*/
599 static getBatchCommentStatusUrl() { 577 static getBatchCommentStatusUrl() {
600 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus" 578 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/batchCommentStatus"
601 return url 579 return url
602 } 580 }
603 581
604 /*评论点赞*/ 582 /*评论点赞*/
605 static getCommentLikeUrl() { 583 static getCommentLikeUrl() {
606 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike" 584 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
607 return url 585 return url
608 } 586 }
609 587
610 /*发布评论*/ 588 /*发布评论*/
611 static getPublishCommentUrl() { 589 static getPublishCommentUrl() {
612 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/publish" 590 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/publish"
613 return url 591 return url
614 } 592 }
615 593
616 /*游客发布评论*/ 594 /*游客发布评论*/
617 static getNoUserPublishCommentUrl() { 595 static getNoUserPublishCommentUrl() {
618 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/commentLike" 596 + let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
619 return url 597 return url
620 } 598 }
621 599
622 /*levleIcon*/ 600 /*levleIcon*/
623 static getBatchUserUrl() { 601 static getBatchUserUrl() {
624 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser" 602 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-point/auth/level/zh/c/batchUser"
625 return url 603 return url
626 } 604 }
627 605
628 /*authIcon 20个一次上限*/ 606 /*authIcon 20个一次上限*/
629 static getDetailListUrl() { 607 static getDetailListUrl() {
630 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-contact/contact/zh/c/master/detailList" 608 + let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/master/detailList"
631 return url 609 return url
632 } 610 }
633 611
634 612
635 //账户注销 613 //账户注销
636 static accountLogoutUrl() { 614 static accountLogoutUrl() {
637 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/logoff"; 615 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/logoff";
638 return url; 616 return url;
639 } 617 }
640 618
641 //更换手机号绑定 619 //更换手机号绑定
642 static changeBindPhone() { 620 static changeBindPhone() {
643 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/userPhoneChange"; 621 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/userPhoneChange";
644 return url; 622 return url;
645 } 623 }
646 624
647 //获取用户安全页信息 625 //获取用户安全页信息
648 static querySecurity() { 626 static querySecurity() {
649 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-center/user/zh/c/security/query"; 627 + let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/user/zh/c/security/query";
650 return url; 628 return url;
651 } 629 }
652 630
653 static getAppointmentListDataUrl() { 631 static getAppointmentListDataUrl() {
654 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH 632 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_LIST_DATA_PATH
655 return url 633 return url
656 } 634 }
657 635
658 static getMyCollectionListDataUrl() { 636 static getMyCollectionListDataUrl() {
659 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH 637 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH
660 return url 638 return url
661 } 639 }
662 640
663 static getExecuteCollcetUrl() { 641 static getExecuteCollcetUrl() {
664 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH 642 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
665 return url 643 return url
666 } 644 }
667 645
668 static getFollowListDetailDataUrl() { 646 static getFollowListDetailDataUrl() {
669 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH 647 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH
670 return url 648 return url
671 } 649 }
672 650
673 static getFollowListDataUrl() { 651 static getFollowListDataUrl() {
674 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_DATA_PATH 652 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_DATA_PATH
675 return url 653 return url
676 } 654 }
677 655
678 static getMineFollowListDataUrl() { 656 static getMineFollowListDataUrl() {
679 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_FOLLOW_LIST_DATA_PATH 657 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_FOLLOW_LIST_DATA_PATH
680 return url 658 return url
681 } 659 }
682 660
683 static getFollowListStatusDataUrl() { 661 static getFollowListStatusDataUrl() {
684 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH 662 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
685 return url 663 return url
686 } 664 }
687 665
688 static getCommentListStatusDataUrl() { 666 static getCommentListStatusDataUrl() {
689 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH 667 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_LIST_STATUS_DATA_PATH
690 return url 668 return url
691 } 669 }
692 670
693 static getMineCommentListDataUrl() { 671 static getMineCommentListDataUrl() {
694 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH 672 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH
695 return url 673 return url
696 } 674 }
697 675
698 static getMineUserLevelDataUrl() { 676 static getMineUserLevelDataUrl() {
699 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH 677 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH
700 return url 678 return url
701 } 679 }
702 680
703 static getOtherUserLevelDataUrl() { 681 static getOtherUserLevelDataUrl() {
704 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH 682 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH
705 return url 683 return url
706 } 684 }
707 685
708 static getMineUserDetailDataUrl() { 686 static getMineUserDetailDataUrl() {
709 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH 687 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH
710 return url 688 return url
711 } 689 }
712 690
713 static getOtherUserDetailDataUrl() { 691 static getOtherUserDetailDataUrl() {
714 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH 692 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH
715 return url 693 return url
716 } 694 }
717 695
718 static getOtherCommentListDataUrl() { 696 static getOtherCommentListDataUrl() {
719 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_COMMENT_LIST_DATA_PATH 697 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_COMMENT_LIST_DATA_PATH
720 return url 698 return url
721 } 699 }
722 700
723 static getOtherUserFollowListDataUrl() { 701 static getOtherUserFollowListDataUrl() {
724 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.OTHER_USER_FOLLOW_LIST_DATA_PATH 702 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.OTHER_USER_FOLLOW_LIST_DATA_PATH
725 return url 703 return url
726 } 704 }
727 705
728 static getAppointmentOperationUrl() { 706 static getAppointmentOperationUrl() {
729 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH 707 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_OPERATION_STATUS_PATH
730 return url 708 return url
731 } 709 }
732 710
733 static getCommentLikeOperationUrl() { 711 static getCommentLikeOperationUrl() {
734 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH 712 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH
735 return url 713 return url
736 } 714 }
737 715
738 static getFollowOperationUrl() { 716 static getFollowOperationUrl() {
739 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.FOLLOW_OPERATION_PATH 717 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_OPERATION_PATH
740 return url 718 return url
741 } 719 }
742 720
743 static getSearchHintDataUrl() { 721 static getSearchHintDataUrl() {
744 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HINT_DATA_PATH 722 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_HINT_DATA_PATH
745 return url 723 return url
746 } 724 }
747 725
748 static getSearchHotsDataUrl() { 726 static getSearchHotsDataUrl() {
749 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HOTS_DATA_PATH 727 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_HOTS_DATA_PATH
750 return url 728 return url
751 } 729 }
752 730
753 static getRelatedSearchContentDataUrl() { 731 static getRelatedSearchContentDataUrl() {
754 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH 732 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RELATED_SEARCH_CONTENT_DATA_PATH
755 return url 733 return url
756 } 734 }
757 735
758 static getInterestsUrl() { 736 static getInterestsUrl() {
759 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH; 737 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH;
760 return url; 738 return url;
761 739
762 } 740 }
763 741
764 static getUpdateInterestsUrl() { 742 static getUpdateInterestsUrl() {
765 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH; 743 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
766 return url; 744 return url;
767 } 745 }
768 746
769 static getLaunchPageDataUrl() { 747 static getLaunchPageDataUrl() {
770 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LAUNCH_PAGE_PATH; 748 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LAUNCH_PAGE_PATH;
771 return url; 749 return url;
772 750
773 } 751 }
774 752
775 static getLiveDetailsUrl() { 753 static getLiveDetailsUrl() {
776 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH 754 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_DETAILS_PATH
777 return url 755 return url
778 } 756 }
779 757
780 static getLiveListUrl() { 758 static getLiveListUrl() {
781 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_LIST_PATH 759 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_LIST_PATH
782 return url 760 return url
783 } 761 }
784 762
785 static getLiveChatListUrl() { 763 static getLiveChatListUrl() {
786 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_CHAT_LIST_PATH 764 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH
787 return url 765 return url
788 } 766 }
789 767
790 static getLiveRoomDataUrl() { 768 static getLiveRoomDataUrl() {
791 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_ROOM_DATA_PATH 769 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH
792 return url 770 return url
793 } 771 }
794 772
795 static getLiveAppointmentStatusUrl() { 773 static getLiveAppointmentStatusUrl() {
796 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH 774 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_STATUS_PATH
797 return url 775 return url
798 } 776 }
799 777
800 static getLiveAppointmentUrl() { 778 static getLiveAppointmentUrl() {
801 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_PATH 779 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_PATH
802 return url 780 return url
803 } 781 }
804 782
805 static getAppointmentStatusUrl() { 783 static getAppointmentStatusUrl() {
806 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH 784 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
807 return url 785 return url
808 } 786 }
809 787
810 static getSearchResultCountDataUrl() { 788 static getSearchResultCountDataUrl() {
811 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH 789 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
812 return url 790 return url
813 } 791 }
814 792
815 static getSearchResultListDataUrl() { 793 static getSearchResultListDataUrl() {
816 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH 794 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_RESULT_LIST_DATA_PATH
817 return url 795 return url
818 } 796 }
819 797
820 static getInteractListDataUrl() { 798 static getInteractListDataUrl() {
821 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH 799 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
822 return url 800 return url
823 } 801 }
824 802
825 static getCreatorDetailListDataUrl() { 803 static getCreatorDetailListDataUrl() {
826 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH 804 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
827 return url 805 return url
828 } 806 }
829 807
830 static getArticleCountHotsDataUrl() { 808 static getArticleCountHotsDataUrl() {
831 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH 809 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH
832 return url 810 return url
833 } 811 }
834 812
835 static getArticleListHotsDataUrl() { 813 static getArticleListHotsDataUrl() {
836 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH 814 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH
837 return url 815 return url
838 } 816 }
839 817
840 static getCreatorInfluenceInfoHotsDataUrl() { 818 static getCreatorInfluenceInfoHotsDataUrl() {
841 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH 819 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH
842 return url 820 return url
843 } 821 }
844 822
845 //点赞 823 //点赞
846 static executeLike() { 824 static executeLike() {
847 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; 825 + let url = HttpUrlUtils.getHost() + "/api/rmrb-interact/interact/zh/c/like/executeLike";
848 return url; 826 return url;
849 } 827 }
850 828
851 //获取点赞状态 829 //获取点赞状态
852 static getLikeStatus() { 830 static getLikeStatus() {
853 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status"; 831 + let url = HttpUrlUtils.getHost() + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status";
854 return url; 832 return url;
855 } 833 }
856 834
  835 + //获取点赞数
  836 + static getLikeCount() {
  837 + let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/v2/content/interactData";
  838 + return url;
  839 + }
  840 +
  841 +
857 //搜索推荐 842 //搜索推荐
858 static getSearchSuggestDataUrl() { 843 static getSearchSuggestDataUrl() {
859 - let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH 844 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH
860 return url 845 return url
861 } 846 }
862 847
863 //金刚位聚合页 848 //金刚位聚合页
864 static getThemeListUrl() { 849 static getThemeListUrl() {
865 - let url = HttpUrlUtils._hostUrl + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; 850 + let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList";
866 return url; 851 return url;
867 } 852 }
868 853
1 -// import { ResponseLogin } from '../bean/account/ResponseLogin';  
2 -import { Logger } from 'wdKit';  
3 -  
4 -// import { UserInfo } from '../bean/account/UserInfo';  
5 -// import { ConfigConstants } from '../constants/ConfigConstants';  
6 -// import { AccountManagerUtils } from './AccountManagerUtils';  
7 -// import { AppUtils } from './AppUtils';  
8 -// import { DeviceUtil } from './DeviceUtil';  
9 -// import { Logger } from './Logger';  
10 -// import { StringUtils } from './StringUtils'; 1 +import { HttpRequest } from '../http/HttpRequest';
11 2
12 const TAG: string = '[HttpUtils]' 3 const TAG: string = '[HttpUtils]'
13 4
14 export class HttpUtils { 5 export class HttpUtils {
15 - static buildHeaders(): Record<string, string> {  
16 - let timestamp: number = new Date().getTime(); // 单位毫秒  
17 - // let clientId = DeviceUtil.clientId()  
18 -  
19 - let headers: Record<string, string> = {};  
20 - // 通用请求头  
21 - headers["version"] = 'V3';  
22 - // headers["appId"] = ConfigConstants.appId; // 应用id  
23 - // headers["terminalId"] = ConfigConstants.terminalId; // 终端ID  
24 - // headers["sourceId"] = ConfigConstants.sourceId; // 咪咕视频  
25 - // headers["appType"] = ConfigConstants.appType; // 手机客户端App(安卓)  
26 - // headers["clientType"] = ConfigConstants.clientType; // 客户端类型  
27 - // headers["appVersion"] = AppUtils.getAppVersionCode() + ''; // 客户端版本号:2600010500  
28 - // headers["APP-VERSION-CODE"] = AppUtils.getAppVersionCode() + ''; // APP版本号:250006577  
29 - // headers["appVersionName"] = AppUtils.getAppVersionName() // app对外显示版本: '6.1.5.00'  
30 - // headers["appCode"] = ConfigConstants.appCode; // 应用编码:产品_渠道_应用的拼接串,用下划线_ 拼接而成  
31 - // headers["ptvCode"] = ConfigConstants.ptvCode; // 基线版本号_应用版本号 todo:  
32 - // headers["clientProvinceCode"] = ''; // 客户端分省号 // 02  
33 - // headers["provinceCode"] = ''; // 客户端分省号 // 02  
34 - // headers["clientCityId"] = ''; // 客户端城市ID // 0210  
35 - // headers["carrierCode"] = ''; // 运营商信息  
36 -  
37 - // 设备信息请求头  
38 - // headers["User-Agent"] = ''; // 终端UA,自动获取  
39 - headers["Content-Type"] = 'application/json;charset=UTF-8'; // 返回/响应的HTTP内容类型  
40 - headers["os"] = 'android'; // 操作系统类型:鸿蒙、安卓或iOS  
41 - // headers["osInfo"] = 'AD'; // 操作系统信息  
42 - headers["Phone-Info"] = 'HUAWEI'; // 手机信息: todo  
43 - // headers["oaid"] = ''; // 开放匿名设备ID,是中国移动安全联盟(MSA)发起并制定标准用户识别ID  
44 - headers["networkInfo"] = 'WIFI'; // 网络类型: todo  
45 - headers["cache-control"] = 'no-cache'; // 请求和响应遵循的缓存机制  
46 - // headers["clientId"] = clientId; // 客户端编号:客户端初始化时生成的客户端ID,保证唯一性  
47 - headers["imei"] = 'd1de6d3ae0db44bea1b3f0e20a14d90a'; // 终端手机序列号: todo  
48 - headers["X-UP-CLIENT-CHANNEL-ID"] = '2600010500-99000-101700010130012'; // 客户端渠道ID: todo  
49 - headers["channelCode"] = 'VIDEO_APPMAIL'; // 渠道编码  
50 - // headers["l_c"] = clientId; // 客户端id,同clientId  
51 - // headers["l_t"] = timestamp + ''; // 本机时间戳  
52 - // headers["l_s"] = ''; // l_c和l_t拼接后的MD5校验  
53 -  
54 - // 签名相关请求头  
55 - headers["timeStamp"] = timestamp + ''; // 服务端时间戳(毫秒):1701667763664  
56 - headers["signType"] = 'RSA'; // 签名类型,固定RSA 6 + /**
  7 + * 添加公共参数,如登录后,添加登录信息
  8 + */
  9 + static addCommonHeader() {
  10 + HttpRequest.addGlobalHeaderProvider(() => {
  11 + let headers: Record<string, string> = {};
  12 + return headers;
  13 + })
  14 + }
57 15
58 - // 业务请求头  
59 - // headers["promotionID"] = '54b0f421-a6df-41d3-9be2-92820b2c5d8c'; // 促销Id todo  
60 - // headers["tenantId"] = ''; // 租户Id 16 + /**
  17 + * 添加公共参数,如登出后,移除登录信息
  18 + */
  19 + static removeCommonHeader() {
61 20
62 - // 添加其他header  
63 - // headers["sdkCeId"] = '27fb3129-5a54-45bc-8af1-7dc8f1155501'; // 用户中台老接口定义的ID,保持不变,现网:咪咕视频Android版,27fb3129-5a54-45bc-8af1-7dc8f1155501 todo  
64 - headers["support-pendant"] = '1'; // 挂件标识, "1":客户端支持挂件节目结构;非"1":不支持挂件节目结构-展示通用对象  
65 - Logger.info(TAG, "buildHeader headers:" + JSON.stringify(headers));  
66 - return headers;  
67 } 21 }
68 -}  
69 -  
70 -// export default new HttpUtils() 22 +}
@@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage' @@ -5,3 +5,5 @@ export { WDRouterPage } from './src/main/ets/router/WDRouterPage'
5 export { registerRouter } from './src/main/ets/router/Action2Page' 5 export { registerRouter } from './src/main/ets/router/Action2Page'
6 6
7 export { ProcessUtils } from './src/main/ets/utils/ProcessUtils' 7 export { ProcessUtils } from './src/main/ets/utils/ProcessUtils'
  8 +
  9 +export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor'
  1 +import { WDRouterPage } from './WDRouterPage';
  2 +
  3 +export interface JumpInterceptorAction {
  4 + on(params?: object, singleMode?: boolean): boolean
  5 +}
  6 +
  7 +// TODO:待优化
  8 +// 临时解决跳转页面之前方法拦截,比如登录先走一键登录,直播请求接口等
  9 +//
  10 +export class RouterJumpInterceptor {
  11 +
  12 + private static actions: Record<string, JumpInterceptorAction> = {}
  13 +
  14 + static getInterceptorAction(jumpPage: WDRouterPage): JumpInterceptorAction | undefined {
  15 + return RouterJumpInterceptor.actions[jumpPage.url()]
  16 + }
  17 +
  18 + static register(jumpPage: WDRouterPage, interceptorAction: JumpInterceptorAction) {
  19 + RouterJumpInterceptor.actions[jumpPage.url()] = interceptorAction
  20 + }
  21 +
  22 +
  23 +}
@@ -66,6 +66,7 @@ export class WDRouterPage { @@ -66,6 +66,7 @@ export class WDRouterPage {
66 // 动态详情页 66 // 动态详情页
67 static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage"); 67 static dynamicDetailPage = new WDRouterPage("phone", "ets/pages/detail/DynamicDetailPage");
68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); 68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
  69 + static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
69 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); 70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
70 //我的 预约 71 //我的 预约
71 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); 72 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
@@ -124,4 +125,6 @@ export class WDRouterPage { @@ -124,4 +125,6 @@ export class WDRouterPage {
124 static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage"); 125 static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
125 // 栏目页面、频道详情 126 // 栏目页面、频道详情
126 static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage"); 127 static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage");
  128 + //展示头像
  129 + static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage");
127 } 130 }
@@ -3,6 +3,7 @@ import { Action } from 'wdBean' @@ -3,6 +3,7 @@ import { Action } from 'wdBean'
3 import { ToastUtils } from 'wdKit' 3 import { ToastUtils } from 'wdKit'
4 import { Action2Page } from './Action2Page' 4 import { Action2Page } from './Action2Page'
5 import { WDRouterPage } from './WDRouterPage' 5 import { WDRouterPage } from './WDRouterPage'
  6 +import { RouterJumpInterceptor } from './RouterJumpInterceptor'
6 7
7 export class WDRouterRule { 8 export class WDRouterRule {
8 static jumpWithAction(action?: Action) { 9 static jumpWithAction(action?: Action) {
@@ -16,6 +17,11 @@ export class WDRouterRule { @@ -16,6 +17,11 @@ export class WDRouterRule {
16 17
17 static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) { 18 static jumpWithPage(page?: WDRouterPage, params?: object, singleMode?: boolean) {
18 if (page) { 19 if (page) {
  20 + let action = RouterJumpInterceptor.getInterceptorAction(page)
  21 + if (action && action.on(params, singleMode)) {
  22 + return
  23 + }
  24 +
19 let mode = router.RouterMode.Standard 25 let mode = router.RouterMode.Standard
20 if (singleMode) { 26 if (singleMode) {
21 mode = router.RouterMode.Single 27 mode = router.RouterMode.Single
@@ -36,6 +42,10 @@ export class WDRouterRule { @@ -36,6 +42,10 @@ export class WDRouterRule {
36 42
37 static jumpWithReplacePage(page?: WDRouterPage, params?: object) { 43 static jumpWithReplacePage(page?: WDRouterPage, params?: object) {
38 if (page) { 44 if (page) {
  45 + let action = RouterJumpInterceptor.getInterceptorAction(page)
  46 + if (action && action.on(params)) {
  47 + return
  48 + }
39 if (params) { 49 if (params) {
40 // router.pushUrl({ url: 'pages/routerpage2', , params: params }) 50 // router.pushUrl({ url: 'pages/routerpage2', , params: params })
41 router.replaceUrl({ url: page.url(), params: params }) 51 router.replaceUrl({ url: page.url(), params: params })
@@ -17,7 +17,7 @@ const TAG = 'ProcessUtils'; @@ -17,7 +17,7 @@ const TAG = 'ProcessUtils';
17 */ 17 */
18 export class ProcessUtils { 18 export class ProcessUtils {
19 /** 19 /**
20 - * 广告中心的业务广告跳转方法( 现用在挂角广告) 20 + * 广告中心的业务广告跳转方法( 现用在挂角广告、信息流页面广告
21 * @param advContent 21 * @param advContent
22 */ 22 */
23 static openAdvDetail(matInfo: CompAdvMatInfoBean) { 23 static openAdvDetail(matInfo: CompAdvMatInfoBean) {
@@ -157,13 +157,14 @@ export class ProcessUtils { @@ -157,13 +157,14 @@ export class ProcessUtils {
157 * 图集详情页 157 * 图集详情页
158 * @param content 158 * @param content
159 * */ 159 * */
160 - public static gotoMultiPictureListPage(photoList: PhotoListBean[]) { 160 + public static gotoMultiPictureListPage(photoList: PhotoListBean[], swiperIndex?: number) {
161 let taskAction: Action = { 161 let taskAction: Action = {
162 type: 'JUMP_DETAIL_PAGE', 162 type: 'JUMP_DETAIL_PAGE',
163 params: { 163 params: {
164 detailPageType: 18, 164 detailPageType: 18,
165 extra: { 165 extra: {
166 - photoList 166 + photoList,
  167 + swiperIndex
167 } as ExtraDTO 168 } as ExtraDTO
168 } as Params, 169 } as Params,
169 }; 170 };
@@ -186,8 +187,14 @@ export class ProcessUtils { @@ -186,8 +187,14 @@ export class ProcessUtils {
186 let taskAction: Action = { 187 let taskAction: Action = {
187 type: 'JUMP_INNER_NEW_PAGE', 188 type: 'JUMP_INNER_NEW_PAGE',
188 params: { 189 params: {
  190 + contentID: content?.objectId,
189 url: content.linkUrl, 191 url: content.linkUrl,
190 pageID: 'SPACIAL_TOPIC_PAGE', 192 pageID: 'SPACIAL_TOPIC_PAGE',
  193 + extra: {
  194 + relType: content?.relType,
  195 + relId: content?.relId,
  196 + channelId: content?.channelId,
  197 + } as ExtraDTO
191 } as Params, 198 } as Params,
192 }; 199 };
193 WDRouterRule.jumpWithAction(taskAction) 200 WDRouterRule.jumpWithAction(taskAction)
@@ -422,11 +429,10 @@ export class ProcessUtils { @@ -422,11 +429,10 @@ export class ProcessUtils {
422 429
423 /** 430 /**
424 * 跳转人民号主页 431 * 跳转人民号主页
425 - *@params creatorId 创作者id 432 + * @params creatorId 创作者id
426 */ 433 */
427 public static gotoPeopleShipHomePage(creatorId: string) { 434 public static gotoPeopleShipHomePage(creatorId: string) {
428 - let params = {'creatorId': creatorId} as Record<string, string>; 435 + let params = { 'creatorId': creatorId } as Record<string, string>;
429 WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) 436 WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
430 } 437 }
431 -  
432 } 438 }
1 -import HashMap from '@ohos.util.HashMap';  
2 import { Callback } from 'wdJsBridge'; 1 import { Callback } from 'wdJsBridge';
3 import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message'; 2 import { Message, IImgListData } from 'wdJsBridge/src/main/ets/bean/Message';
4 -import { Logger } from 'wdKit'; 3 +import { Logger, SPHelper } from 'wdKit';
5 import { H5CallNativeType } from './H5CallNativeType'; 4 import { H5CallNativeType } from './H5CallNativeType';
6 import { H5OperateType } from './H5OperateType'; 5 import { H5OperateType } from './H5OperateType';
7 -import { ContentConstants } from 'wdConstant'; 6 +import { ContentConstants, SpConstants } from 'wdConstant';
8 import { ProcessUtils } from 'wdRouter'; 7 import { ProcessUtils } from 'wdRouter';
9 import router from '@ohos.router'; 8 import router from '@ohos.router';
10 import Url from '@ohos.url' 9 import Url from '@ohos.url'
11 import { ContentDTO, PhotoListBean } from 'wdBean'; 10 import { ContentDTO, PhotoListBean } from 'wdBean';
12 -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; 11 +import { handleJsCallAppService } from './JsCallAppService'
13 12
14 const TAG = 'JsBridgeBiz' 13 const TAG = 'JsBridgeBiz'
15 14
@@ -20,6 +19,19 @@ class AppInfo { @@ -20,6 +19,19 @@ class AppInfo {
20 // TODO 完善 19 // TODO 完善
21 } 20 }
22 21
  22 +class AppLoginAuthInfo {
  23 + "X-Ca-Stage": string = ''
  24 + userType: number = SPHelper.default.getSync(SpConstants.USER_Type, '') as number
  25 + userName: string = SPHelper.default.getSync(SpConstants.USER_NAME, '') as string
  26 + userID: string = SPHelper.default.getSync(SpConstants.USER_ID, '') as string
  27 + "RMRB-X-TOKEN": string = SPHelper.default.getSync(SpConstants.USER_TEMP_TOKEN, '') as string
  28 + phoneNumber: string = SPHelper.default.getSync(SpConstants.USER_PHONE, '') as string
  29 + nickName: string = ''
  30 + isLogined: string = SPHelper.default.getSync(SpConstants.USER_STATUS, '') as string
  31 + creatorID: string = SPHelper.default.getSync(SpConstants.USER_CREATOR_ID, '') as string
  32 + Authorization: string = ''
  33 +}
  34 +
23 /** 35 /**
24 * h5调用native代码 36 * h5调用native代码
25 * @param data 37 * @param data
@@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -39,7 +51,7 @@ export function performJSCallNative(data: Message, call: Callback) {
39 case H5CallNativeType.jsCall_getArticleDetailBussinessData: 51 case H5CallNativeType.jsCall_getArticleDetailBussinessData:
40 break; 52 break;
41 case H5CallNativeType.jsCall_callAppService: 53 case H5CallNativeType.jsCall_callAppService:
42 - handleJsCallCallAppService(data, (res: string) => { 54 + handleJsCallAppService(data, (res: string) => {
43 call(res) 55 call(res)
44 }) 56 })
45 break; 57 break;
@@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) { @@ -49,6 +61,9 @@ export function performJSCallNative(data: Message, call: Callback) {
49 case H5CallNativeType.jsCall_appInnerLinkMethod: 61 case H5CallNativeType.jsCall_appInnerLinkMethod:
50 handleJsCallAppInnerLinkMethod(data) 62 handleJsCallAppInnerLinkMethod(data)
51 break; 63 break;
  64 + case H5CallNativeType.jsCall_getAppLoginAuthInfo:
  65 + call(handleJsCallGetAppLoginAuthInfo())
  66 + break;
52 default: 67 default:
53 break; 68 break;
54 } 69 }
@@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) { @@ -64,21 +79,6 @@ function handleJsCallCurrentPageOperate(data: Message) {
64 } 79 }
65 } 80 }
66 81
67 -function handleJsCallCallAppService(data: Message, callback: (res: string) => void) {  
68 - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();  
69 - let url: string = HttpUrlUtils.getHost() + data?.data?.url  
70 - if (data?.data?.method === 'get') {  
71 - WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => {  
72 - callback(JSON.stringify(res))  
73 - })  
74 - }  
75 - if (data?.data?.method === 'post') {  
76 - WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => {  
77 - callback(JSON.stringify(res))  
78 - })  
79 - }  
80 -}  
81 -  
82 /** 82 /**
83 * 获取App公共信息 83 * 获取App公共信息
84 */ 84 */
@@ -90,15 +90,15 @@ function getAppPublicInfo(): string { @@ -90,15 +90,15 @@ function getAppPublicInfo(): string {
90 info.networkStatus = 1 90 info.networkStatus = 1
91 let result = JSON.stringify(info) 91 let result = JSON.stringify(info)
92 Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info)) 92 Logger.debug(TAG, 'getAppPublicInfo: ' + JSON.stringify(info))
93 -  
94 return result; 93 return result;
95 } 94 }
96 95
97 function handleJsCallReceiveH5Data(data: Message) { 96 function handleJsCallReceiveH5Data(data: Message) {
98 - switch (data?.data?.dataSource) { 97 + switch (String(data?.data?.dataSource)) {
99 case '3': 98 case '3':
100 let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}") 99 let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}")
101 let imgArr = imgListData?.imgArr || [] 100 let imgArr = imgListData?.imgArr || []
  101 + let swiperIndex = imgListData?.imgIndex
102 if (imgArr.length > 0) { 102 if (imgArr.length > 0) {
103 const photoList: PhotoListBean[] = imgArr.map(item => { 103 const photoList: PhotoListBean[] = imgArr.map(item => {
104 const photo: PhotoListBean = { 104 const photo: PhotoListBean = {
@@ -109,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) { @@ -109,7 +109,7 @@ function handleJsCallReceiveH5Data(data: Message) {
109 } 109 }
110 return photo 110 return photo
111 }) 111 })
112 - ProcessUtils.gotoMultiPictureListPage(photoList) 112 + ProcessUtils.gotoMultiPictureListPage(photoList, swiperIndex)
113 } 113 }
114 break; 114 break;
115 case '5': 115 case '5':
@@ -182,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -182,3 +182,9 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
182 } 182 }
183 } 183 }
184 } 184 }
  185 +
  186 +function handleJsCallGetAppLoginAuthInfo() {
  187 + let appLoginAuthInfo = new AppLoginAuthInfo()
  188 + let result = JSON.stringify(appLoginAuthInfo)
  189 + return result;
  190 +}
  1 +import HashMap from '@ohos.util.HashMap';
  2 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
  3 +import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
  4 +import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
  5 +
  6 +const TAG = 'JsCallAppService'
  7 +
  8 +
  9 +export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
  10 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  11 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
  12 +
  13 + let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
  14 +
  15 + let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
  16 + netError: '0',
  17 + responseMap
  18 + } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
  19 +
  20 + // if (data?.data?.method === 'get') {
  21 + // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
  22 + // callback(JSON.stringify(res))
  23 + // })
  24 + // }
  25 + if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
  26 + WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
  27 + h5ReceiveDataJson.responseMap = res
  28 + callback(JSON.stringify(h5ReceiveDataJson))
  29 + })
  30 + }
  31 +}
@@ -79,6 +79,7 @@ export struct WdWebLocalComponent { @@ -79,6 +79,7 @@ export struct WdWebLocalComponent {
79 if (this.videoUrl) { 79 if (this.videoUrl) {
80 Video({ src: this.videoUrl }) 80 Video({ src: this.videoUrl })
81 .autoPlay(true) 81 .autoPlay(true)
  82 + .objectFit(ImageFit.Contain)
82 .width(this.positionWidth) 83 .width(this.positionWidth)
83 .height(this.positionHeight) 84 .height(this.positionHeight)
84 .borderRadius(5) 85 .borderRadius(5)
@@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO { @@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO {
15 relType: string; 15 relType: string;
16 liveStreamType?: number; 16 liveStreamType?: number;
17 photoList: PhotoListBean[]; 17 photoList: PhotoListBean[];
  18 + swiperIndex?: number
18 commentId?: string; 19 commentId?: string;
19 } 20 }
@@ -8,4 +8,5 @@ export interface commentInfo { @@ -8,4 +8,5 @@ export interface commentInfo {
8 newsId: string, 8 newsId: string,
9 relId: string; 9 relId: string;
10 relType: string; 10 relType: string;
  11 + userId: string;
11 } 12 }
1 export interface UserInfoDTO { 1 export interface UserInfoDTO {
2 - userHeadUrl:string 2 + userHeadUrl: string
  3 + userName?: string
  4 + headPhotoUrl?: string
3 } 5 }
1 export interface H5ReceiveDataExtraBean { 1 export interface H5ReceiveDataExtraBean {
2 creatorId: string; 2 creatorId: string;
  3 + cnsTraceId: string;
3 isLogin: string; 4 isLogin: string;
  5 + loadImageOnlyWifiSwitch: string;
4 networkStatus: number; 6 networkStatus: number;
5 - loadImageOnlyWifiSwitch: string 7 + darkMode: string;
  8 + fontSizes: string;
6 } 9 }
1 import { ResponseBean } from './ResponseBean'; 1 import { ResponseBean } from './ResponseBean';
2 2
3 -export interface H5ReceiveDataJsonBean {  
4 - contentId: string;  
5 - contentType: string;  
6 - topicId: string;  
7 - channelId: string;  
8 - compId: string;  
9 - sourcePage: string; 3 +export interface H5ReceiveDataJsonBean<T = ResponseBean> {
  4 + contentId?: string;
  5 + contentType?: string;
  6 + topicId?: string;
  7 + channelId?: string;
  8 + compId?: string;
  9 + sourcePage?: string;
10 netError: string; 10 netError: string;
11 - responseMap: ResponseBean; 11 + responseMap: T;
12 12
13 } 13 }
1 import { ContentDetailDTO } from '../detail/ContentDetailDTO'; 1 import { ContentDetailDTO } from '../detail/ContentDetailDTO';
2 2
3 -export interface ResponseBean{  
4 - success:boolean; 3 +export interface ResponseBean<T = ContentDetailDTO[]> {
  4 + success: boolean;
5 5
6 // 服务请求响应值/微服务响应状态码” 6 // 服务请求响应值/微服务响应状态码”
7 code: number; 7 code: number;
@@ -10,8 +10,7 @@ export interface ResponseBean{ @@ -10,8 +10,7 @@ export interface ResponseBean{
10 message: string; 10 message: string;
11 11
12 // 响应结果 12 // 响应结果
13 - data:ContentDetailDTO[];  
14 - 13 + data: T
15 // 请求响应时间戳(unix格式) 14 // 请求响应时间戳(unix格式)
16 timestamp?: number; 15 timestamp?: number;
17 } 16 }
@@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO'; @@ -4,37 +4,39 @@ import { TopNavDTO } from './TopNavDTO';
4 * 底导(包含顶导列表)数据 4 * 底导(包含顶导列表)数据
5 */ 5 */
6 export interface BottomNavDTO { 6 export interface BottomNavDTO {
7 - backgroundUrl: string;  
8 - channelChooseActionUrl: string;  
9 - channelChooseCColor: string;  
10 - channelChooseColor: string;  
11 - channelMoreColor: string; 7 + backgroundUrl: string; // 迭代四:页面背景图
  8 + channelChooseActionUrl: string; // 迭代四:频道选中下划线动画
  9 + channelChooseCColor: string; // 迭代四:频道未选中颜色
  10 + channelChooseColor: string; // 迭代四:频道选中颜色
  11 + channelMoreColor: string; // 迭代四:更多频道颜色
12 extraData: string; 12 extraData: string;
13 - homePageColor: string;  
14 - icon: string;  
15 - iconC: string; 13 + homePageColor: string; // 迭代四:主页图标/文字颜色
  14 + icon: string; // 未选中图标
  15 + iconC: string; // 选中图标
16 id: number; 16 id: number;
17 - immersiveIconCUrl: string;  
18 - immersiveIconUrl: string;  
19 - immersiveNameCColor: string;  
20 - immersiveNameColor: string;  
21 - logoUrl: string; 17 + immersiveIconCUrl: string; // 迭代二新增-图标颜色-选中(沉浸式频道)
  18 + immersiveIconUrl: string; // 迭代二新增-图标颜色-未选中(沉浸式频道)
  19 + immersiveNameCColor: string; // 迭代二新增-文字颜色-选中(沉浸式频道)
  20 + immersiveNameColor: string; // 迭代二新增-文字颜色-未选中(沉浸式频道)
  21 + logoUrl: string; // 迭代四:logo图片
22 morningAndEveningUrl: string; 22 morningAndEveningUrl: string;
23 name: string; 23 name: string;
24 - nameCColor: string;  
25 - nameColor: string;  
26 - nightIconCUrl: string;  
27 - nightIconUrl: string;  
28 - nightNameCColor: string;  
29 - nightNameColor: string;  
30 - noticeColor: string; 24 + nameCColor: string; // 名字选中颜色
  25 + nameColor: string; // 名字颜色
  26 + nightIconCUrl: string; // 迭代三新增-图标颜色-选中(夜间模式)
  27 + nightIconUrl: string; // 迭代三新增-图标颜色-未选中(夜间模式)
  28 + nightNameCColor: string; // 迭代三新增-文字颜色-选中(夜间模式)
  29 + nightNameColor: string; // 迭代三新增-文字颜色-未选中(夜间模式)
  30 + noticeColor: string; // 迭代四:消息通知提醒颜色
31 pageId?: string; 31 pageId?: string;
32 pageType?: string; 32 pageType?: string;
33 - searchBothColor: string;  
34 - searchUrl: string; 33 + searchBothColor: string; // 迭代四:两侧文字图标颜色,搜索图标颜色
  34 + searchUrl: string; // 迭代四:搜索背景框
35 sortValue: number; 35 sortValue: number;
36 - statusBarColor: number; 36 + statusBarColor: number; // 迭代四:状态栏图标颜色,0:白色,1:黑色
37 topNavChannelList: TopNavDTO[]; 37 topNavChannelList: TopNavDTO[];
38 - topStyle: string;  
39 - type: string; 38 + topStyle: string; // 顶部样式:中文的(11-新闻;12-人民号;13-视频;14-服务)
  39 + type: string; // 底部导航类型,1普通 2我的;【rmrb需要扩展】
  40 + fmorningAndEveningUrl: string; // 迭代四:早晚报背景框
  41 + dropDownAnimationColor: string; // 下拉加载动画颜色,1白色,2灰色。未配置值是null
40 } 42 }
@@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO'; @@ -4,9 +4,10 @@ import { BottomNavDTO } from './BottomNavDTO';
4 * 导航Body数据 4 * 导航Body数据
5 */ 5 */
6 export interface NavigationBodyDTO { 6 export interface NavigationBodyDTO {
7 - backgroundColor: string; 7 + backgroundColor: string; // 迭代二新增-底部导航背景色(信息流频道)
8 bottomNavList: BottomNavDTO[]; 8 bottomNavList: BottomNavDTO[];
9 - // greyBottomNav: GreyBottomNav;  
10 - immersiveBackgroundColor: string;  
11 - nightBackgroundColor: string; 9 +
  10 + // greyBottomNav: GreyBottomNav; // 灰度皮肤
  11 + immersiveBackgroundColor: string; // 迭代二新增-底部导航背景色(沉浸式频道)
  12 + nightBackgroundColor: string; // 迭代三新增-底部导航背景色(夜间模式)
12 } 13 }
@@ -7,14 +7,14 @@ export interface TopNavDTO { @@ -7,14 +7,14 @@ export interface TopNavDTO {
7 channelType: number; 7 channelType: number;
8 defaultPermitted: number; 8 defaultPermitted: number;
9 delPermitted: number; 9 delPermitted: number;
10 - fontCColor: string;  
11 - fontColor: string; 10 + fontCColor: string; // 频道展示样式颜色(选中状态)
  11 + fontColor: string; // 频道展示样式颜色(未选中状态)
12 headlinesOn: number; 12 headlinesOn: number;
13 homeChannel: string; 13 homeChannel: string;
14 - iconCUrl: string;  
15 - iconCUrlSize: string;  
16 - iconUrl: string;  
17 iconUrlSize: string; 14 iconUrlSize: string;
  15 + iconCUrlSize: string;
  16 + iconUrl: string; // 频道图片展示样式图片相对地址(未选中状态)
  17 + iconCUrl: string; //频道图片展示样式图片相对地址(选中状态
18 localChannel: string; 18 localChannel: string;
19 moreChannel: string; 19 moreChannel: string;
20 movePermitted: number; 20 movePermitted: number;
@@ -23,5 +23,5 @@ export interface TopNavDTO { @@ -23,5 +23,5 @@ export interface TopNavDTO {
23 num: number; 23 num: number;
24 pageId: number; 24 pageId: number;
25 pageType: string; 25 pageType: string;
26 - underlineCColor: string; 26 + underlineCColor: string; // 选中下划线颜色
27 } 27 }
@@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi @@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
71 71
72 export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" 72 export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
73 73
74 -export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent"  
75 -  
76 export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" 74 export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
77 75
78 export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" 76 export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
@@ -9,6 +9,7 @@ import { @@ -9,6 +9,7 @@ import {
9 HorizontalStrokeCardThreeTwoRadioForOneComponent 9 HorizontalStrokeCardThreeTwoRadioForOneComponent
10 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; 10 } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
11 import { ZhSingleRow02 } from './compview/ZhSingleRow02'; 11 import { ZhSingleRow02 } from './compview/ZhSingleRow02';
  12 +import { ZhSingleRow03 } from './compview/ZhSingleRow03';
12 import { ZhSingleRow04 } from './compview/ZhSingleRow04'; 13 import { ZhSingleRow04 } from './compview/ZhSingleRow04';
13 import { ZhSingleRow05 } from './compview/ZhSingleRow05'; 14 import { ZhSingleRow05 } from './compview/ZhSingleRow05';
14 import { ZhSingleRow06 } from './compview/ZhSingleRow06'; 15 import { ZhSingleRow06 } from './compview/ZhSingleRow06';
@@ -23,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02'; @@ -23,7 +24,6 @@ import { ZhGridLayout02 } from './compview/ZhGridLayout02';
23 import { Card2Component } from './cardview/Card2Component'; 24 import { Card2Component } from './cardview/Card2Component';
24 import { Card5Component } from './cardview/Card5Component'; 25 import { Card5Component } from './cardview/Card5Component';
25 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 26 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
26 -import { CardAdvComponent } from './cardViewAdv/CardAdvComponent';  
27 import { AdvCardParser } from './cardViewAdv/AdvCardParser'; 27 import { AdvCardParser } from './cardViewAdv/AdvCardParser';
28 28
29 /** 29 /**
@@ -60,7 +60,7 @@ export struct CompParser { @@ -60,7 +60,7 @@ export struct CompParser {
60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { 60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
61 ZhSingleRow02({ compDTO }) 61 ZhSingleRow02({ compDTO })
62 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { 62 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
63 - LiveHorizontalReservationComponent({ compDTO: compDTO }) 63 + ZhSingleRow03({ compDTO: compDTO })
64 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { 64 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
65 ZhGridLayout02({ compDTO: compDTO }) 65 ZhGridLayout02({ compDTO: compDTO })
66 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { 66 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
@@ -44,9 +44,9 @@ export struct DynamicDetailComponent { @@ -44,9 +44,9 @@ export struct DynamicDetailComponent {
44 /** 44 /**
45 * 关注状态:默认未关注 点击去关注 45 * 关注状态:默认未关注 点击去关注
46 */ 46 */
47 - @State followStatus: String = '0'; 47 + @State followStatus: String = '';
48 48
49 - @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined// 点赞、收藏状态 49 + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
50 //跳转 50 //跳转
51 private mJumpInfo: ContentDTO = {} as ContentDTO; 51 private mJumpInfo: ContentDTO = {} as ContentDTO;
52 52
@@ -121,31 +121,33 @@ export struct DynamicDetailComponent { @@ -121,31 +121,33 @@ export struct DynamicDetailComponent {
121 } 121 }
122 .width('63%') 122 .width('63%')
123 .margin({right: $r('app.float.margin_6')}) 123 .margin({right: $r('app.float.margin_6')})
124 - if (this.followStatus == '0') {  
125 - Text('关注')  
126 - .width($r('app.float.margin_54'))  
127 - .height($r('app.float.margin_24'))  
128 - .textAlign(TextAlign.Center)  
129 - .fontSize($r('app.float.font_size_12'))  
130 - .borderRadius($r('app.float.vp_3'))  
131 - .backgroundColor($r('app.color.color_ED2800'))  
132 - .fontColor($r('app.color.color_fff'))  
133 - .onClick(() => {  
134 - this.handleAccention()  
135 - })  
136 - } else {  
137 - Text('已关注')  
138 - .width($r('app.float.margin_54'))  
139 - .height($r('app.float.margin_24'))  
140 - .borderWidth(1)  
141 - .textAlign(TextAlign.Center)  
142 - .fontSize($r('app.float.font_size_12'))  
143 - .borderRadius($r('app.float.vp_3'))  
144 - .borderColor($r('app.color.color_CCCCCC'))  
145 - .fontColor($r('app.color.color_CCCCCC'))  
146 - .onClick(() => {  
147 - this.handleAccention()  
148 - }) 124 + if(!StringUtils.isEmpty(this.followStatus)){
  125 + if (this.followStatus == '0') {
  126 + Text('关注')
  127 + .width($r('app.float.margin_54'))
  128 + .height($r('app.float.margin_24'))
  129 + .textAlign(TextAlign.Center)
  130 + .fontSize($r('app.float.font_size_12'))
  131 + .borderRadius($r('app.float.vp_3'))
  132 + .backgroundColor($r('app.color.color_ED2800'))
  133 + .fontColor($r('app.color.color_fff'))
  134 + .onClick(() => {
  135 + this.handleAccention()
  136 + })
  137 + } else {
  138 + Text('已关注')
  139 + .width($r('app.float.margin_54'))
  140 + .height($r('app.float.margin_24'))
  141 + .borderWidth(1)
  142 + .textAlign(TextAlign.Center)
  143 + .fontSize($r('app.float.font_size_12'))
  144 + .borderRadius($r('app.float.vp_3'))
  145 + .borderColor($r('app.color.color_CCCCCC'))
  146 + .fontColor($r('app.color.color_CCCCCC'))
  147 + .onClick(() => {
  148 + this.handleAccention()
  149 + })
  150 + }
149 } 151 }
150 } 152 }
151 .width('100%') 153 .width('100%')
@@ -209,7 +211,7 @@ export struct DynamicDetailComponent { @@ -209,7 +211,7 @@ export struct DynamicDetailComponent {
209 } 211 }
210 } 212 }
211 .onClick((event: ClickEvent) => { 213 .onClick((event: ClickEvent) => {
212 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 214 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
213 }) 215 })
214 } else { 216 } else {
215 GridCol({ 217 GridCol({
@@ -226,7 +228,7 @@ export struct DynamicDetailComponent { @@ -226,7 +228,7 @@ export struct DynamicDetailComponent {
226 }) 228 })
227 } 229 }
228 .onClick((event: ClickEvent) => { 230 .onClick((event: ClickEvent) => {
229 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 231 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
230 }) 232 })
231 } 233 }
232 } else if (this.contentDetailData.photoList.length === 4) { 234 } else if (this.contentDetailData.photoList.length === 4) {
@@ -238,7 +240,7 @@ export struct DynamicDetailComponent { @@ -238,7 +240,7 @@ export struct DynamicDetailComponent {
238 .borderRadius(this.caclImageRadius(index)) 240 .borderRadius(this.caclImageRadius(index))
239 } 241 }
240 .onClick((event: ClickEvent) => { 242 .onClick((event: ClickEvent) => {
241 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 243 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
242 }) 244 })
243 } else { 245 } else {
244 GridCol({ 246 GridCol({
@@ -249,7 +251,7 @@ export struct DynamicDetailComponent { @@ -249,7 +251,7 @@ export struct DynamicDetailComponent {
249 .borderRadius(this.caclImageRadius(index)) 251 .borderRadius(this.caclImageRadius(index))
250 } 252 }
251 .onClick((event: ClickEvent) => { 253 .onClick((event: ClickEvent) => {
252 - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) 254 + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
253 }) 255 })
254 } 256 }
255 }) 257 })
@@ -330,8 +332,8 @@ export struct DynamicDetailComponent { @@ -330,8 +332,8 @@ export struct DynamicDetailComponent {
330 Image(this.newsStatusOfUser?.likeStatus == '1'? 332 Image(this.newsStatusOfUser?.likeStatus == '1'?
331 $r('app.media.icon_like_selected_redheart') 333 $r('app.media.icon_like_selected_redheart')
332 :$r('app.media.icon_like_unselect_grey_redheart')) 334 :$r('app.media.icon_like_unselect_grey_redheart'))
333 - .width($r('app.float.margin_24'))  
334 - .height($r('app.float.margin_24')) 335 + .width($r('app.float.margin_36'))
  336 + .height($r('app.float.margin_36'))
335 .objectFit(ImageFit.Cover) 337 .objectFit(ImageFit.Cover)
336 if(this.interactDataDTO?.likeNum != 0){ 338 if(this.interactDataDTO?.likeNum != 0){
337 Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum)) 339 Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
@@ -430,12 +432,18 @@ export struct DynamicDetailComponent { @@ -430,12 +432,18 @@ export struct DynamicDetailComponent {
430 432
431 // 已登录->查询用户对作品点赞、收藏状态 433 // 已登录->查询用户对作品点赞、收藏状态
432 private async getInteractDataStatus() { 434 private async getInteractDataStatus() {
  435 + // 未登录,跳转登录
  436 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  437 + if (!user_id) {
  438 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  439 + return
  440 + }
433 try { 441 try {
434 const params: batchLikeAndCollectParams = { 442 const params: batchLikeAndCollectParams = {
435 contentList: [ 443 contentList: [
436 { 444 {
437 - contentId: this.contentDetailData[0]?.newsId + '',  
438 - contentType: this.contentDetailData[0]?.newsType + '', 445 + contentId: this.contentDetailData?.newsId + '',
  446 + contentType: this.contentDetailData?.newsType + '',
439 } 447 }
440 ] 448 ]
441 } 449 }
@@ -453,16 +461,23 @@ export struct DynamicDetailComponent { @@ -453,16 +461,23 @@ export struct DynamicDetailComponent {
453 * 查询当前登录用户是否关注作品号主 461 * 查询当前登录用户是否关注作品号主
454 * */ 462 * */
455 private async getBatchAttentionStatus() { 463 private async getBatchAttentionStatus() {
  464 + // 未登录,跳转登录
  465 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  466 + if (!user_id) {
  467 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  468 + this.followStatus = '0';
  469 + return
  470 + }
456 try { 471 try {
457 - const params: postBatchAttentionStatusParams = {  
458 - creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] 472 + const params: postBatchAttentionStatusParams = {
  473 + creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
  474 + }
  475 + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
  476 + this.followStatus = data[0]?.status;
  477 + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
  478 + } catch (exception) {
  479 + this.followStatus = '0';
459 } 480 }
460 - let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)  
461 - this.followStatus = data[0]?.status;  
462 - Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)  
463 - } catch (exception) {  
464 -  
465 - }  
466 } 481 }
467 482
468 //创建跳转信息 483 //创建跳转信息
@@ -558,18 +573,13 @@ export struct DynamicDetailComponent { @@ -558,18 +573,13 @@ export struct DynamicDetailComponent {
558 contentType: this.contentDetailData?.newsType + '', 573 contentType: this.contentDetailData?.newsType + '',
559 } 574 }
560 ContentDetailRequest.postExecuteLike(params).then(res => { 575 ContentDetailRequest.postExecuteLike(params).then(res => {
561 -  
562 - if (this.newsStatusOfUser) {  
563 - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'  
564 - if (this.newsStatusOfUser.likeStatus === '1') {  
565 - this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1  
566 - } else {  
567 - this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1  
568 - }  
569 - console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)  
570 - // this.queryContentInteractCount() 576 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
  577 + if (this.newsStatusOfUser.likeStatus === '1') {
  578 + this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) + 1
  579 + } else {
  580 + this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
571 } 581 }
572 - 582 + console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
573 }) 583 })
574 } 584 }
575 } 585 }
@@ -24,7 +24,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent' @@ -24,7 +24,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent'
24 24
25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; 25 const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
26 26
27 -const TAG = 'ImageAndTextPageComponent' 27 +const TAG: string = 'ImageAndTextPageComponent'
28 28
29 @Component 29 @Component
30 export struct ImageAndTextPageComponent { 30 export struct ImageAndTextPageComponent {
@@ -90,20 +90,22 @@ export struct ImageAndTextPageComponent { @@ -90,20 +90,22 @@ export struct ImageAndTextPageComponent {
90 .height(24) 90 .height(24)
91 .margin({ right: 5 }) 91 .margin({ right: 5 })
92 } 92 }
93 - Text(`${this.interactData?.likeNum || 0 }`)  
94 - .fontSize(16)  
95 - .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')  
96 - .fontWeight(500) 93 + if(this.interactData?.likeNum !== '0'){
  94 + Text(`${this.interactData?.likeNum}`)
  95 + .fontSize(16)
  96 + .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  97 + .fontWeight(500)
  98 + }
97 } 99 }
98 .width(140) 100 .width(140)
99 .height(36) 101 .height(36)
100 .justifyContent(FlexAlign.Center) 102 .justifyContent(FlexAlign.Center)
101 .alignItems(VerticalAlign.Center) 103 .alignItems(VerticalAlign.Center)
102 .borderRadius(20) 104 .borderRadius(20)
103 - // .border({  
104 - // width: 1,  
105 - // color: '#EDEDED',  
106 - // }) 105 + .border({
  106 + width: 1,
  107 + color: '#EDEDED',
  108 + })
107 .onClick(() => { 109 .onClick(() => {
108 this.toggleLikeStatus() 110 this.toggleLikeStatus()
109 }) 111 })
@@ -118,7 +120,9 @@ export struct ImageAndTextPageComponent { @@ -118,7 +120,9 @@ export struct ImageAndTextPageComponent {
118 } 120 }
119 // 评论 121 // 评论
120 if(this.contentDetailData[0]?.openComment){ 122 if(this.contentDetailData[0]?.openComment){
121 - 123 + // CommentComponent({
  124 + //
  125 + // })
122 } 126 }
123 } 127 }
124 } 128 }
@@ -126,7 +130,7 @@ export struct ImageAndTextPageComponent { @@ -126,7 +130,7 @@ export struct ImageAndTextPageComponent {
126 } 130 }
127 .width(CommonConstants.FULL_WIDTH) 131 .width(CommonConstants.FULL_WIDTH)
128 .height(CommonConstants.FULL_HEIGHT) 132 .height(CommonConstants.FULL_HEIGHT)
129 - .padding({ bottom: 126 }) 133 + .padding({ bottom: 76 })
130 .scrollBar(BarState.Off) 134 .scrollBar(BarState.Off)
131 135
132 if (!this.isPageEnd) { 136 if (!this.isPageEnd) {
@@ -134,7 +138,9 @@ export struct ImageAndTextPageComponent { @@ -134,7 +138,9 @@ export struct ImageAndTextPageComponent {
134 } 138 }
135 139
136 //底部交互区 140 //底部交互区
137 - OperRowListView({ contentDetailData: this.contentDetailData[0] }) 141 + if (this.contentDetailData?.length) {
  142 + OperRowListView({contentDetailData: this.contentDetailData[0]})
  143 + }
138 } 144 }
139 145
140 } 146 }
@@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent'; @@ -12,6 +12,7 @@ import { WdWebLocalComponent } from 'wdWebComponent';
12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 12 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
13 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 13 import { BridgeWebViewControl } from 'wdJsBridge/Index';
14 14
  15 +const TAG: string = 'ImageAndTextWebComponent'
15 @Component 16 @Component
16 export struct ImageAndTextWebComponent { 17 export struct ImageAndTextWebComponent {
17 action: Action = {} as Action 18 action: Action = {} as Action
@@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent { @@ -60,9 +61,12 @@ export struct ImageAndTextWebComponent {
60 // TODO 对接user信息、登录情况 61 // TODO 对接user信息、登录情况
61 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { 62 let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
62 creatorId: creatorId, 63 creatorId: creatorId,
  64 + cnsTraceId: '',
63 isLogin: isLogin, 65 isLogin: isLogin,
64 - networkStatus: Number(NetworkUtil.isNetConnected()),  
65 loadImageOnlyWifiSwitch: '2', 66 loadImageOnlyWifiSwitch: '2',
  67 + networkStatus: Number(NetworkUtil.isNetConnected()),
  68 + darkMode: 'light',
  69 + fontSizes: 'normalsize'
66 70
67 } as H5ReceiveDataExtraBean 71 } as H5ReceiveDataExtraBean
68 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { 72 let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
@@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent { @@ -83,7 +87,6 @@ export struct ImageAndTextWebComponent {
83 this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean 87 this.h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean
84 this.dataPrepared = true 88 this.dataPrepared = true
85 this.trySendData2H5() 89 this.trySendData2H5()
86 -  
87 } 90 }
88 91
89 } 92 }
@@ -20,7 +20,7 @@ export struct ImageDownloadComponent { @@ -20,7 +20,7 @@ export struct ImageDownloadComponent {
20 @State image: PixelMap | undefined = undefined; 20 @State image: PixelMap | undefined = undefined;
21 @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 21 @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例
22 @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer 22 @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
23 - url: string = '' 23 + @Prop @Watch('onChangeUrl') url: string = ''
24 24
25 build() { 25 build() {
26 Column() { 26 Column() {
@@ -40,7 +40,11 @@ export struct ImageDownloadComponent { @@ -40,7 +40,11 @@ export struct ImageDownloadComponent {
40 40
41 } 41 }
42 42
43 - async aboutToAppear(): Promise<void> { 43 + aboutToAppear(): void {
  44 + this.onChangeUrl()
  45 + }
  46 +
  47 + async onChangeUrl(): Promise<void> {
44 console.info(`cj2024 图片下载 ${this.url}`) 48 console.info(`cj2024 图片下载 ${this.url}`)
45 const context = getContext(this) as common.UIAbilityContext; 49 const context = getContext(this) as common.UIAbilityContext;
46 const atManager = abilityAccessCtrl.createAtManager(); 50 const atManager = abilityAccessCtrl.createAtManager();
1 -import { PhotoListBean } from 'wdBean/Index';  
2 -import { Logger } from 'wdKit/Index';  
3 -import { display, router } from '@kit.ArkUI';  
4 -import { ImageDownloadComponent } from './ImageDownloadComponent';  
5 -import { ImageItemView } from './view/ImageItemView';  
6 -  
7 -const TAG = 'ImageSwiperComponent';  
8 -  
9 -@Component  
10 -export struct ImageSwiperComponent {  
11 - @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'  
12 - private scroller: Scroller = new Scroller()  
13 - @State swiperIndex: number = 0;  
14 - photoList: PhotoListBean[] = [];  
15 - private swiperController: SwiperController = new SwiperController()  
16 - private displayTool = display.getDefaultDisplaySync()  
17 - private screenWidth: number = 0  
18 - private picWidth: number = 0  
19 - @State picHeight: number = 0  
20 - @State isEnableSwipe: boolean = true;  
21 -  
22 - // @Provide bgc: Color = Color.White;  
23 -  
24 - //watch监听页码回调  
25 - onCurrentPageNumUpdated(): void {  
26 - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,)  
27 - let _swiperIndex = Number.parseInt(this.currentPageNum)  
28 - Logger.info(TAG, `_swiperIndex:${_swiperIndex}`)  
29 - this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex  
30 - }  
31 -  
32 - aboutToAppear(): void {  
33 - //获取宽高尺寸  
34 - this.screenWidth = this.displayTool.width  
35 - // this.picWidth = this.screenWidth - vp2px(52)  
36 - this.picWidth = this.screenWidth  
37 - this.picHeight = this.picWidth * 578 / 375  
38 - }  
39 -  
40 - build() {  
41 - RelativeContainer() {  
42 - Image($r('app.media.icon_arrow_left_white'))  
43 - .width(24)  
44 - .height(24)  
45 - .aspectRatio(1)  
46 - .interpolation(ImageInterpolation.High)  
47 - .alignRules({  
48 - top: { anchor: "__container__", align: VerticalAlign.Top },  
49 - left: { anchor: "__container__", align: HorizontalAlign.Start }  
50 - })  
51 - .onClick(() => {  
52 - router.back();  
53 - })  
54 - .id("backImg")  
55 -  
56 - if (this.photoList && this.photoList?.length > 0) {  
57 - Swiper(this.swiperController) {  
58 - ForEach(this.photoList, (item: PhotoListBean) => {  
59 - // MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })  
60 - ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe })  
61 - })  
62 - }  
63 - .index(this.swiperIndex)  
64 - .width('100%')  
65 - .height(px2vp(this.picHeight) + 32)  
66 - .vertical(false)  
67 - .autoPlay(false)  
68 - .cachedCount(3)  
69 - .indicator(false)  
70 - .displayCount(1)  
71 - .id('e_swiper_content')  
72 - .alignRules({  
73 - center: { anchor: "__container__", align: VerticalAlign.Center },  
74 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
75 - })  
76 - .onChange((index: number) => {  
77 - this.swiperIndex = index  
78 - })  
79 -  
80 - Row() {  
81 - Scroll(this.scroller) {  
82 - Row() {  
83 - Flex({  
84 - direction: FlexDirection.Column,  
85 - justifyContent: FlexAlign.Start  
86 - }) {  
87 - Text() {  
88 - Span(`${this.swiperIndex + 1}`)  
89 - .fontSize(24)  
90 - .fontFamily('PingFang SC-Medium')  
91 - .fontWeight(500)  
92 - .lineHeight(28)  
93 - Span(`/${this.photoList.length}`)  
94 - .fontSize(14)  
95 - .fontFamily('PingFang SC-Medium')  
96 - .fontWeight(500)  
97 - .lineHeight(19)  
98 - }.fontColor(Color.White).margin(4)  
99 - }  
100 - }  
101 - .width('100%')  
102 - .margin({  
103 - top: 8,  
104 - left: 18,  
105 - bottom: 24,  
106 - right: 18  
107 - })  
108 - }  
109 - .scrollable(ScrollDirection.Vertical)  
110 - .scrollBarWidth(0)  
111 - }  
112 - .id('e_swiper_titles')  
113 - .alignRules({  
114 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
115 - middle: { anchor: "__container__", align: HorizontalAlign.Center }  
116 - })  
117 - }  
118 -  
119 - ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath })  
120 - .alignRules({  
121 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
122 - right: { anchor: "__container__", align: HorizontalAlign.End }  
123 - })  
124 - .margin({  
125 - top: 8,  
126 - left: 18,  
127 - bottom: 24,  
128 - right: 18  
129 - })  
130 - .id("downloadImg")  
131 - }  
132 - .width('100%')  
133 - .height('100%')  
134 - .backgroundColor(Color.Black)  
135 - .id('e_picture_container')  
136 - // 设置顶部绘制延伸到状态栏  
137 - // 设置底部绘制延伸到导航条  
138 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])  
139 - }  
140 -}  
@@ -168,6 +168,11 @@ export struct MorningEveningPaperComponent { @@ -168,6 +168,11 @@ export struct MorningEveningPaperComponent {
168 } 168 }
169 } 169 }
170 170
  171 + async aboutToDisappear() {
  172 + let windowHight: window.Window = await window.getLastWindow(getContext(this));
  173 + await windowHight.setWindowLayoutFullScreen(false);
  174 + }
  175 +
171 onPageHide() { 176 onPageHide() {
172 this.status = PlayerConstants.STATUS_PAUSE; 177 this.status = PlayerConstants.STATUS_PAUSE;
173 this.playerController?.pause(); 178 this.playerController?.pause();
1 -import { Action, H5ReceiveDetailBean } from 'wdBean'; 1 +import { Action, H5ReceiveDetailBean, ContentDetailDTO } from 'wdBean';
2 import { WdWebComponent } from 'wdWebComponent'; 2 import { WdWebComponent } from 'wdWebComponent';
3 import router from '@ohos.router'; 3 import router from '@ohos.router';
4 import { CommonConstants } from 'wdConstant' 4 import { CommonConstants } from 'wdConstant'
5 import { BridgeWebViewControl } from 'wdJsBridge/Index'; 5 import { BridgeWebViewControl } from 'wdJsBridge/Index';
6 import { detailedSkeleton } from './skeleton/detailSkeleton' 6 import { detailedSkeleton } from './skeleton/detailSkeleton'
7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
8 -const TAG = 'SpacialTopicPageComponent' 8 +import { OperRowListView } from './view/OperRowListView';
  9 +import DetailViewModel from '../viewmodel/DetailViewModel';
  10 +
  11 +const TAG: string = 'SpacialTopicPageComponent'
9 12
10 @Component 13 @Component
11 export struct SpacialTopicPageComponent { 14 export struct SpacialTopicPageComponent {
@@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent { @@ -14,6 +17,7 @@ export struct SpacialTopicPageComponent {
14 action: Action = {} as Action 17 action: Action = {} as Action
15 @State webUrl: string = ''; 18 @State webUrl: string = '';
16 @State isPageEnd: boolean = false 19 @State isPageEnd: boolean = false
  20 + @State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
17 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 21 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
18 private webPrepared = false; 22 private webPrepared = false;
19 private dataPrepared = false; 23 private dataPrepared = false;
@@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent { @@ -37,11 +41,33 @@ export struct SpacialTopicPageComponent {
37 }) 41 })
38 } 42 }
39 43
  44 + private async getDetail() {
  45 + let contentId: string = ''
  46 + let relId: string = ''
  47 + let relType: string = ''
  48 + if (this.action && this.action.params) {
  49 + if (this.action.params.contentID) {
  50 + contentId = this.action.params.contentID;
  51 + }
  52 + if (this.action && this.action.params && this.action.params.extra) {
  53 + if (this.action.params.extra.relId) {
  54 + relId = this.action.params.extra.relId;
  55 + }
  56 + if (this.action.params.extra.relType) {
  57 + relType = this.action.params.extra.relType
  58 + }
  59 +
  60 + }
  61 + let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
  62 + if (detailBeans && detailBeans.length > 0) {
  63 + this.contentDetailData = detailBeans;
  64 + this.trySendData2H5()
  65 + }
  66 + }
  67 + }
  68 +
40 build() { 69 build() {
41 Column() { 70 Column() {
42 - if (!this.isPageEnd) {  
43 - detailedSkeleton()  
44 - }  
45 Stack({ alignContent: Alignment.Bottom }) { 71 Stack({ alignContent: Alignment.Bottom }) {
46 Column() { 72 Column() {
47 WdWebComponent({ 73 WdWebComponent({
@@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent { @@ -52,62 +78,23 @@ export struct SpacialTopicPageComponent {
52 isPageEnd: $isPageEnd 78 isPageEnd: $isPageEnd
53 }) 79 })
54 } 80 }
55 - .padding({ bottom: 56 })  
56 .width(CommonConstants.FULL_WIDTH) 81 .width(CommonConstants.FULL_WIDTH)
57 .height(CommonConstants.FULL_HEIGHT) 82 .height(CommonConstants.FULL_HEIGHT)
  83 + .padding({ bottom: 126 })
58 84
59 - //底部交互区  
60 - Row() {  
61 - Image($r('app.media.icon_arrow_left'))  
62 - .width(24)  
63 - .height(24)  
64 - .onClick((event: ClickEvent) => {  
65 - router.back()  
66 - })  
67 -  
68 - Row() {  
69 - Image($r('app.media.icon_comment'))  
70 - .width(24)  
71 - .height(24)  
72 - .margin({ right: 24 })  
73 - .id('comment')  
74 -  
75 - Image($r('app.media.icon_star'))  
76 - .width(24)  
77 - .height(24)  
78 - .margin({ right: 24 })  
79 -  
80 - Image($r('app.media.icon_listen'))  
81 - .width(24)  
82 - .height(24)  
83 - .margin({ right: 24 })  
84 -  
85 - Image($r('app.media.icon_forward'))  
86 - .width(24)  
87 - .height(24)  
88 -  
89 - } 85 + if (!this.isPageEnd) {
  86 + detailedSkeleton()
90 } 87 }
91 - .width(CommonConstants.FULL_WIDTH)  
92 - .height(56)  
93 - .padding({ left: 15, right: 15, bottom: 20, top: 20 })  
94 - .justifyContent(FlexAlign.SpaceBetween)  
95 - .backgroundColor(Color.White)  
96 - 88 + //底部交互区
  89 + OperRowListView({ contentDetailData: this.contentDetailData[0] })
97 } 90 }
98 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 91 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
99 - .backgroundColor(Color.White)  
100 } 92 }
101 93
102 aboutToAppear() { 94 aboutToAppear() {
103 - let action: Action = router.getParams() as Action  
104 - if (action) {  
105 - this.webUrl = action.params?.url || '' 95 + if (this.action) {
  96 + this.webUrl = this.action.params?.url || ''
106 } 97 }
107 - this.trySendData2H5()  
108 - }  
109 -  
110 - aboutToDisappear() {  
111 - 98 + this.getDetail()
112 } 99 }
113 } 100 }
1 import { CompStyle } from 'wdConstant'; 1 import { CompStyle } from 'wdConstant';
2 import { CompDTO } from 'wdBean'; 2 import { CompDTO } from 'wdBean';
3 -import { CardAdvComponent } from './CardAdvComponent';  
4 import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent'; 3 import { CardAdvThreeImageComponent } from './CardAdvThreeImageComponent';
5 import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent'; 4 import { CardAdvSmallImageComponent } from './CardAdvSmallImageComponent';
6 import { CardAdvLongImageComponent } from './CardAdvLongImageComponent'; 5 import { CardAdvLongImageComponent } from './CardAdvLongImageComponent';
@@ -22,12 +22,12 @@ export struct CardAdvBigImageComponent { @@ -22,12 +22,12 @@ export struct CardAdvBigImageComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '---大图卡-----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean';  
3 -import { CommonConstants } from 'wdConstant/Index';  
4 -import { ProcessUtils } from 'wdRouter';  
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 -  
8 -const TAG: string = 'Card2Component';  
9 -  
10 -/**  
11 - * @Description: 类描述  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0  
17 - */  
18 -@Component  
19 -export struct CardAdvComponent {  
20 -  
21 - @State compDTO: CompDTO = {} as CompDTO  
22 -  
23 - aboutToAppear(): void {  
24 -  
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----')  
26 - }  
27 -  
28 - aboutToDisappear(): void {  
29 -  
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----')  
31 - }  
32 -  
33 - build() {  
34 -  
35 - Column() {  
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start)  
42 - }  
43 - .width(CommonConstants.FULL_WIDTH)  
44 - .padding({  
45 - left: $r('app.float.card_comp_pagePadding_lf'),  
46 - right: $r('app.float.card_comp_pagePadding_lf'),  
47 - top: $r('app.float.card_comp_pagePadding_tb'),  
48 - bottom: $r('app.float.card_comp_pagePadding_tb')  
49 - })  
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - })  
53 - }  
54 -}  
55 -  
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0')  
60 -}  
@@ -22,12 +22,12 @@ export struct CardAdvGanMiComponent { @@ -22,12 +22,12 @@ export struct CardAdvGanMiComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '--冠名广告------aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -22,12 +22,12 @@ export struct CardAdvLongImageComponent { @@ -22,12 +22,12 @@ export struct CardAdvLongImageComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 -import { CompDTO, ContentDTO } from 'wdBean';  
3 -import { CommonConstants } from 'wdConstant/Index'; 2 +import { CompDTO } from 'wdBean';
4 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 -  
8 -const TAG: string = 'Card2Component';  
9 -  
10 -/**  
11 - * @Description: 广告---小图卡  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 4 +
  5 +import measure from '@ohos.measure';
  6 +import { DisplayUtils } from 'wdKit/Index';
  7 +
  8 +const TAG: string = 'CardAdvSmallImageComponent';
  9 +
  10 +/**
  11 + * @Description: 广告---小图卡
  12 + * @Author:
  13 + * @Email: liyubing@wondertek.com.cn
  14 + * @CreateDate:
  15 + * @UpdateRemark: 更新说明
  16 + * @Version: 1.0
17 */ 17 */
18 @Component 18 @Component
19 export struct CardAdvSmallImageComponent { 19 export struct CardAdvSmallImageComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 20 @State compDTO: CompDTO = {} as CompDTO
  21 + @State isBigThreeLine: boolean = false // 标题的行数大于等于3行 是true
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '----小图卡----aboutToAppear-----')
  26 + // 计算标题文本行数
  27 + let screenWith = DisplayUtils.getDeviceWidth();
  28 + screenWith = screenWith * 0.62
  29 + let titleNameLineNum = this.getTextLineNum(this.compDTO.matInfo.advTitle, screenWith, 25, 18)
  30 + this.isBigThreeLine = titleNameLineNum >= 3;
26 } 31 }
27 32
28 aboutToDisappear(): void { 33 aboutToDisappear(): void {
29 34
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 35 + console.error('ZZZXXXXX', '---小图卡-----aboutToDisappear-----')
31 } 36 }
32 37
33 build() { 38 build() {
34 39
35 - Column() { 40 + RelativeContainer() {
  41 +
  42 + // 广告标题
36 Text(this.compDTO.matInfo.advTitle) 43 Text(this.compDTO.matInfo.advTitle)
37 - .fontSize($r('app.float.font_size_17')) 44 + .fontSize('18fp')
38 .fontColor($r('app.color.color_222222')) 45 .fontColor($r('app.color.color_222222'))
39 .maxLines(3) 46 .maxLines(3)
  47 + .lineHeight(25)
40 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 48 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
41 - .align(Alignment.Start) 49 + .width('62%')
  50 + .alignRules({
  51 + top: { anchor: '__container__', align: VerticalAlign.Top },
  52 + left: { anchor: '__container__', align: HorizontalAlign.Start },
  53 + })
  54 + .id("title_name")
  55 + // 广告图
  56 + Image(this.compDTO.matInfo.matImageUrl[0])
  57 + .width('34%')
  58 + .aspectRatio(3 / 2)
  59 + .borderRadius(4)
  60 + .id('adv_imag')
  61 + .alignRules({
  62 + top: { anchor: 'title_name', align: VerticalAlign.Top },
  63 + left: { anchor: 'title_name', align: HorizontalAlign.End },
  64 +
  65 + })
  66 + .margin({ left: 12 })
  67 +
  68 + Row() {
  69 + Text($r('app.string.comp_advertisement')).fontSize('12fp').fontColor($r('app.color.color_B0B0B0'))
  70 +
  71 + Blank()
  72 +
  73 + Stack() {
  74 + Image($r('app.media.comp_adv_close'))
  75 + .width(9)
  76 + .height(9)
  77 + .borderRadius({
  78 + topLeft: '4vp',
  79 + topRight: '4vp',
  80 + bottomLeft: '4vp',
  81 + bottomRight: '4vp'
  82 + })
  83 + }
  84 + .width(18)
  85 + .height(14)
  86 + .borderWidth(0.5)
  87 + .borderColor($r('app.color.color_EDEDED'))
  88 + .borderRadius(4)
  89 +
  90 + }.width('62%').alignRules({
  91 + bottom: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: VerticalAlign.Bottom },
  92 + right: { anchor: this.isBigThreeLine ? '' : 'adv_imag', align: HorizontalAlign.Start },
  93 +
  94 + top: { anchor: this.isBigThreeLine ? 'title_name' : '', align: VerticalAlign.Bottom },
  95 + left: { anchor: this.isBigThreeLine ? 'title_name' : '', align: HorizontalAlign.Start },
  96 + }).id('bottom_adv').margin({
  97 + right: this.isBigThreeLine ? 0 : 12,
  98 + top: this.isBigThreeLine ? 8 : 0,
  99 + })
42 } 100 }
43 - .width(CommonConstants.FULL_WIDTH) 101 + .width("100%")
  102 + .height(this.isBigThreeLine ? 127 : 106)
44 .padding({ 103 .padding({
45 left: $r('app.float.card_comp_pagePadding_lf'), 104 left: $r('app.float.card_comp_pagePadding_lf'),
46 right: $r('app.float.card_comp_pagePadding_lf'), 105 right: $r('app.float.card_comp_pagePadding_lf'),
@@ -48,13 +107,31 @@ export struct CardAdvSmallImageComponent { @@ -48,13 +107,31 @@ export struct CardAdvSmallImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 107 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 108 })
50 .onClick((event: ClickEvent) => { 109 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 110 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
  111 + })
  112 + }
  113 +
  114 + // 获取文本几行
  115 + private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
  116 + let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
  117 + let height: number = Number(size.height)
  118 + return Math.ceil(px2vp(height) / lineHeight)
  119 + }
  120 +
  121 + private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
  122 + return measure.measureTextSize({
  123 + textContent: text,
  124 + fontSize: fontSize,
  125 + lineHeight: lineHeight,
  126 + constraintWidth: constraintWidth,
52 }) 127 })
53 } 128 }
54 } 129 }
55 130
  131 +
56 @Extend(Text) 132 @Extend(Text)
57 function bottomTextStyle() { 133 function bottomTextStyle() {
58 .fontSize(12) 134 .fontSize(12)
59 .fontColor('#B0B0B0') 135 .fontColor('#B0B0B0')
60 -}  
  136 +}
  137 +
@@ -22,12 +22,12 @@ export struct CardAdvThreeImageComponent { @@ -22,12 +22,12 @@ export struct CardAdvThreeImageComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '---三图卡-----aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '----三图卡----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -22,12 +22,12 @@ export struct CardAdvVideoComponent { @@ -22,12 +22,12 @@ export struct CardAdvVideoComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '---视频广告-----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -22,12 +22,12 @@ export struct CardAdvVideoExComponent { @@ -22,12 +22,12 @@ export struct CardAdvVideoExComponent {
22 22
23 aboutToAppear(): void { 23 aboutToAppear(): void {
24 24
25 - console.error('ZZZXXXXX', '--------aboutToAppear-----') 25 + console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
29 29
30 - console.error('ZZZXXXXX', '--------aboutToDisappear-----') 30 + console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----')
31 } 31 }
32 32
33 build() { 33 build() {
@@ -102,7 +102,7 @@ export struct Card19Component { @@ -102,7 +102,7 @@ export struct Card19Component {
102 } 102 }
103 return photo 103 return photo
104 }) 104 })
105 - ProcessUtils.gotoMultiPictureListPage(photoList) 105 + ProcessUtils.gotoMultiPictureListPage(photoList,0)
106 }) 106 })
107 //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 107 //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
108 } 108 }
@@ -104,6 +104,9 @@ struct createImg { @@ -104,6 +104,9 @@ struct createImg {
104 } 104 }
105 .align(Alignment.BottomEnd) 105 .align(Alignment.BottomEnd)
106 } 106 }
  107 + .onClick((event: ClickEvent) => {
  108 + ProcessUtils.gotoVod(this.contentDTO)
  109 + })
107 } else { 110 } else {
108 // 竖图显示,宽度占50%,高度自适应 111 // 竖图显示,宽度占50%,高度自适应
109 GridCol({ 112 GridCol({
  1 +import { commentItemModel } from './CommentModel'
  2 +
1 @Observed 3 @Observed
2 export class publishCommentModel { 4 export class publishCommentModel {
3 5
@@ -25,7 +27,7 @@ export class publishCommentModel { @@ -25,7 +27,7 @@ export class publishCommentModel {
25 /*评论内容*/ 27 /*评论内容*/
26 commentContent: string = "" 28 commentContent: string = ""
27 /*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/ 29 /*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/
28 - commentType: string = '1' 30 + commentType: string = '2'
29 /*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/ 31 /*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/
30 rootCommentId: string = "-1" 32 rootCommentId: string = "-1"
31 /*父评论id,如果是其它评论的回复,该字段必填*/ 33 /*父评论id,如果是其它评论的回复,该字段必填*/
@@ -35,6 +37,10 @@ export class publishCommentModel { @@ -35,6 +37,10 @@ export class publishCommentModel {
35 //可选 37 //可选
36 placeHolderText: string = "优质评论会获得最佳评论人的称号" 38 placeHolderText: string = "优质评论会获得最佳评论人的称号"
37 39
  40 + //最新发布的评论
  41 + lastCommentModel: commentItemModel = new commentItemModel()
  42 +
  43 +
38 } 44 }
39 45
40 46
1 import ArrayList from '@ohos.util.ArrayList' 1 import ArrayList from '@ohos.util.ArrayList'
2 import { ViewType } from 'wdConstant/Index'; 2 import { ViewType } from 'wdConstant/Index';
3 -import { DateTimeUtils, LazyDataSource } from 'wdKit/Index'; 3 +import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index';
4 import PageModel from '../../../viewmodel/PageModel'; 4 import PageModel from '../../../viewmodel/PageModel';
5 import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel'; 5 import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel';
6 import commentViewModel from '../viewmodel/CommentViewModel' 6 import commentViewModel from '../viewmodel/CommentViewModel'
@@ -9,6 +9,7 @@ import measure from '@ohos.measure' @@ -9,6 +9,7 @@ import measure from '@ohos.measure'
9 import { CommentCustomDialog } from './CommentCustomDialog' 9 import { CommentCustomDialog } from './CommentCustomDialog'
10 import { publishCommentModel } from '../model/PublishCommentModel'; 10 import { publishCommentModel } from '../model/PublishCommentModel';
11 import { ifaa } from '@kit.OnlineAuthenticationKit'; 11 import { ifaa } from '@kit.OnlineAuthenticationKit';
  12 +import { HttpUrlUtils } from 'wdNetwork/Index';
12 13
13 const TAG = 'CommentComponent'; 14 const TAG = 'CommentComponent';
14 15
@@ -18,18 +19,13 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 @@ -18,18 +19,13 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
18 @Preview 19 @Preview
19 @Component 20 @Component
20 export struct CommentComponent { 21 export struct CommentComponent {
21 -  
22 // @State private browSingModel: commentListModel = new commentListModel() 22 // @State private browSingModel: commentListModel = new commentListModel()
23 /*必传*/ 23 /*必传*/
24 @ObjectLink publishCommentModel: publishCommentModel 24 @ObjectLink publishCommentModel: publishCommentModel
25 -  
26 isloading: boolean = false 25 isloading: boolean = false
27 -  
28 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); 26 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
29 -  
30 @State dialogController: CustomDialogController | null = null; 27 @State dialogController: CustomDialogController | null = null;
31 28
32 -  
33 // 在自定义组件即将析构销毁时将dialogControlle置空 29 // 在自定义组件即将析构销毁时将dialogControlle置空
34 aboutToDisappear() { 30 aboutToDisappear() {
35 this.dialogController = null // 将dialogController置空 31 this.dialogController = null // 将dialogController置空
@@ -37,12 +33,23 @@ export struct CommentComponent { @@ -37,12 +33,23 @@ export struct CommentComponent {
37 33
38 aboutToAppear() { 34 aboutToAppear() {
39 35
  36 + //注册通知,来自别的组件的评论成功通知
  37 + EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
  38 + if (targetId) {
  39 + if (targetId == this.publishCommentModel.targetId) {
  40 + //新增评论
  41 + this.addCommentLocal()
  42 + }
  43 + }
  44 + })
  45 +
  46 +
40 this.dialogController = new CustomDialogController({ 47 this.dialogController = new CustomDialogController({
41 builder: CommentCustomDialog({ 48 builder: CommentCustomDialog({
42 confirm: (value: Record<string, string>) => { 49 confirm: (value: Record<string, string>) => {
43 - 50 + this.addCommentLocal()
44 }, 51 },
45 - publishCommentModel:this.publishCommentModel 52 + publishCommentModel: this.publishCommentModel
46 }), 53 }),
47 autoCancel: true, 54 autoCancel: true,
48 alignment: DialogAlignment.Bottom, 55 alignment: DialogAlignment.Bottom,
@@ -57,6 +64,24 @@ export struct CommentComponent { @@ -57,6 +64,24 @@ export struct CommentComponent {
57 64
58 } 65 }
59 66
  67 + //
  68 + addCommentLocal() {
  69 + let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
  70 + /*一级评论*/
  71 + if (this.publishCommentModel.lastCommentModel.parentId == '-1') {
  72 + this.allDatas.addFirstItem(model)
  73 + //TODO 跳转顶部
  74 + }else{
  75 + //二级评论
  76 + this.allDatas.getDataArray().forEach(element => {
  77 + if (element.id == this.publishCommentModel.lastCommentModel.rootCommentId) {
  78 + element.childCommentsLazyDataSource.addFirstItem(model)
  79 + }
  80 + });
  81 + }
  82 +
  83 + }
  84 +
60 /*标题:全部评论*/ 85 /*标题:全部评论*/
61 @Builder 86 @Builder
62 titleHeader() { 87 titleHeader() {
@@ -73,6 +98,11 @@ export struct CommentComponent { @@ -73,6 +98,11 @@ export struct CommentComponent {
73 98
74 } 99 }
75 .margin({ left: 16 }) 100 .margin({ left: 16 })
  101 + .onClick(()=>{
  102 + // this.allDatas.push(new commentItemModel())
  103 + // this.allDatas.addFirstItem(new commentItemModel())
  104 + // this.allDatas.reloadData();
  105 + })
76 106
77 }.height(44) 107 }.height(44)
78 .width('100%') 108 .width('100%')
@@ -92,7 +122,11 @@ export struct CommentComponent { @@ -92,7 +122,11 @@ export struct CommentComponent {
92 /*查看更多和收起*/ 122 /*查看更多和收起*/
93 @Builder 123 @Builder
94 GroupFooterView(item: commentItemModel, index: number) { 124 GroupFooterView(item: commentItemModel, index: number) {
95 - footerExpandedView({ item: item, contentId: this.publishCommentModel.targetId, contentType: this.publishCommentModel.targetType }) 125 + footerExpandedView({
  126 + item: item,
  127 + contentId: this.publishCommentModel.targetId,
  128 + contentType: this.publishCommentModel.targetType
  129 + })
96 } 130 }
97 131
98 build() { 132 build() {
@@ -114,7 +148,7 @@ export struct CommentComponent { @@ -114,7 +148,7 @@ export struct CommentComponent {
114 .onClick(() => { 148 .onClick(() => {
115 console.log(TAG) 149 console.log(TAG)
116 }) 150 })
117 - }) 151 + },(childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString())
118 } 152 }
119 } else { 153 } else {
120 ListItemGroup({ header: this.CommentHeaderItem(item, index) }) { 154 ListItemGroup({ header: this.CommentHeaderItem(item, index) }) {
@@ -129,29 +163,31 @@ export struct CommentComponent { @@ -129,29 +163,31 @@ export struct CommentComponent {
129 .onClick(() => { 163 .onClick(() => {
130 console.log(TAG) 164 console.log(TAG)
131 }) 165 })
132 - }) 166 + },(childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString())
133 } 167 }
134 } 168 }
135 - }) 169 + },(item: commentItemModel, index: number) => JSON.stringify(item) + index.toString())
136 }.layoutWeight(1) 170 }.layoutWeight(1)
137 } 171 }
138 } 172 }
139 173
140 //获取数据 174 //获取数据
141 async getData() { 175 async getData() {
142 - commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType).then(commentListModel => {  
143 - if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {  
144 - commentListModel.list.forEach(element => {  
145 - element.hasMore = Number.parseInt(element.childCommentNum) ? true : false  
146 - let newModel = commentViewModel.deepCopyCommentItemModel(element)  
147 - // newModel.targetId = this.publishCommentModel.targetId  
148 - // newModel.targetType = this.publishCommentModel.targetType  
149 - this.allDatas.push(newModel)  
150 - }); 176 + commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType)
  177 + .then(commentListModel => {
  178 + if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
  179 + commentListModel.list.forEach(element => {
  180 + element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
  181 + let newModel = commentViewModel.deepCopyCommentItemModel(element)
  182 + // 点赞用
  183 + newModel.targetId = this.publishCommentModel.targetId
  184 + newModel.targetType = this.publishCommentModel.targetType
  185 + this.allDatas.push(newModel)
  186 + });
151 187
152 188
153 - }  
154 - }) 189 + }
  190 + })
155 191
156 } 192 }
157 } 193 }
@@ -243,6 +279,8 @@ struct ChildCommentItem { @@ -243,6 +279,8 @@ struct ChildCommentItem {
243 }) 279 })
244 .margin({ left: 95, right: 16, top: -5 }) 280 .margin({ left: 95, right: 16, top: -5 })
245 .onClick(() => { 281 .onClick(() => {
  282 +
  283 +
246 this.publishCommentModel.rootCommentId = this.item.rootCommentId 284 this.publishCommentModel.rootCommentId = this.item.rootCommentId
247 this.publishCommentModel.parentId = this.item.id 285 this.publishCommentModel.parentId = this.item.id
248 this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':' 286 this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':'
1 import { inputMethodEngine } from '@kit.IMEKit' 1 import { inputMethodEngine } from '@kit.IMEKit'
  2 +import { commentInfo } from 'wdBean/Index'
  3 +import { commentItemModel } from '../model/CommentModel'
2 import { publishCommentModel } from '../model/PublishCommentModel' 4 import { publishCommentModel } from '../model/PublishCommentModel'
3 import commentViewModel from '../viewmodel/CommentViewModel' 5 import commentViewModel from '../viewmodel/CommentViewModel'
4 6
@@ -22,9 +24,10 @@ export struct CommentCustomDialog { @@ -22,9 +24,10 @@ export struct CommentCustomDialog {
22 let bean: Record<string, string> = {}; 24 let bean: Record<string, string> = {};
23 // this.publishCommentModel.commentContent = this.commentText 25 // this.publishCommentModel.commentContent = this.commentText
24 //TODO 判断类型 26 //TODO 判断类型
25 - this.publishCommentModel.commentType = '1'  
26 - commentViewModel.publishComment(this.publishCommentModel).then(() => { 27 + this.publishCommentModel.commentType = '2'
  28 + commentViewModel.publishComment(this.publishCommentModel).then((model:commentItemModel) => {
27 this.publishCommentModel.commentContent = '' 29 this.publishCommentModel.commentContent = ''
  30 + this.publishCommentModel.lastCommentModel = model
28 // this.commentText = '' 31 // this.commentText = ''
29 if (this.controller != null) { 32 if (this.controller != null) {
30 this.controller.close() 33 this.controller.close()
  1 +import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
1 import { publishCommentModel } from '../model/PublishCommentModel' 2 import { publishCommentModel } from '../model/PublishCommentModel'
  3 +import { CommentCustomDialog } from './CommentCustomDialog'
  4 +
2 5
3 @Preview 6 @Preview
4 @Component 7 @Component
@@ -8,6 +11,34 @@ export struct CommentTabComponent { @@ -8,6 +11,34 @@ export struct CommentTabComponent {
8 @State type:number = 1 11 @State type:number = 1
9 @State placeHolder: string = '说两句...' 12 @State placeHolder: string = '说两句...'
10 13
  14 + @State dialogController: CustomDialogController | null = null;
  15 +
  16 + /*回调方法*/
  17 + dialogControllerConfirm: () => void = () => {}
  18 +
  19 +
  20 +
  21 + aboutToAppear() {
  22 +
  23 + this.dialogController = new CustomDialogController({
  24 + builder: CommentCustomDialog({
  25 + confirm: (value: Record<string, string>) => {
  26 + this.dialogControllerConfirm();
  27 + EmitterUtils.sendEvent(EmitterEventId.COMMENT_PUBLISH,this.publishCommentModel.targetId)
  28 + },
  29 + publishCommentModel:this.publishCommentModel
  30 + }),
  31 + autoCancel: true,
  32 + alignment: DialogAlignment.Bottom,
  33 + customStyle: true,
  34 + offset: {
  35 + dx: 0,
  36 + dy: -20
  37 + },
  38 + })
  39 +
  40 + }
  41 +
11 build() { 42 build() {
12 Row(){ 43 Row(){
13 Stack({alignContent:Alignment.Start}){ 44 Stack({alignContent:Alignment.Start}){
@@ -15,6 +46,10 @@ export struct CommentTabComponent { @@ -15,6 +46,10 @@ export struct CommentTabComponent {
15 Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({left:10}) 46 Text(this.placeHolder).fontSize(12).fontColor('#999999').margin({left:10})
16 } 47 }
17 }.width(151).height(30) 48 }.width(151).height(30)
  49 + .onClick(()=>{
  50 + this.publishCommentModel.parentId = '-1';
  51 + this.dialogController?.open();
  52 + })
18 } 53 }
19 } 54 }
20 55
@@ -25,25 +60,52 @@ export struct CommentIconComponent { @@ -25,25 +60,52 @@ export struct CommentIconComponent {
25 /*展示类型*/ 60 /*展示类型*/
26 @State type:number = 1 61 @State type:number = 1
27 62
  63 + /*回调方法*/
  64 + onClickItem: () => void = () => {}
  65 +
28 build() { 66 build() {
29 Row(){ 67 Row(){
30 Stack({alignContent:Alignment.TopEnd}){ 68 Stack({alignContent:Alignment.TopEnd}){
31 Image($r('app.media.comment_icon')).width(24).height(24) 69 Image($r('app.media.comment_icon')).width(24).height(24)
32 // Stack({alignContent:Alignment.Start}) { 70 // Stack({alignContent:Alignment.Start}) {
33 - // Image($r('app.media.comment_icon_number')).objectFit(ImageFit.Fill).width(12).height(12)  
34 - Text(this.publishCommentModel.totalCommentNumer + '12345' +' ')  
35 - .fontSize(8)  
36 - .fontColor('#ffffff')  
37 - // .backgroundColor('#ED2800')  
38 - .height(12)  
39 - .margin({ left: 6 })  
40 - .backgroundImage($r('app.media.comment_icon_number'))  
41 - // }.width(25) 71 + RelativeContainer() {
  72 + Image($r('app.media.comment_icon_number_bg'))
  73 + .objectFit(ImageFit.Fill)
  74 + .resizable({ slice: {top:1, left: 20 , right:1, bottom:1} })
  75 + .alignRules({
  76 + top: {anchor: "Text", align: VerticalAlign.Top},
  77 + left: {anchor: "Text", align: HorizontalAlign.Start},
  78 + right: {anchor: "Text", align: HorizontalAlign.End},
  79 + bottom : {anchor: "Text", align: VerticalAlign.Bottom},
  80 + })
  81 + // .offset({
  82 + // x:-6
  83 + // })
  84 + .id("Image")
  85 +
  86 + Text('123213123123123')
  87 + .fontSize(8)
  88 + .fontColor('#ffffff')// .backgroundColor('#ED2800')
  89 + .height(12)
  90 + .alignRules({
  91 + top: {anchor: "__container__", align: VerticalAlign.Top},
  92 + left: {anchor: "__container__", align: HorizontalAlign.Start}
  93 + })
  94 + // .margin({left: 4,right:4
  95 + // })
  96 + /*动态计算文字宽度*/
  97 + .width(50)
  98 + // .backgroundColor(Color.Green)
  99 + .id("Text")
  100 +
  101 + }
  102 + // }
42 103
43 .offset({ 104 .offset({
44 x:12 105 x:12
45 }) 106 })
46 } 107 }
47 }.width(24).height(24) 108 }.width(24).height(24)
  109 + // .backgroundColor(Color.Blue)
48 } 110 }
49 } 111 }
@@ -5,7 +5,6 @@ import commentViewModel from '../viewmodel/CommentViewModel' @@ -5,7 +5,6 @@ import commentViewModel from '../viewmodel/CommentViewModel'
5 import { router, window } from '@kit.ArkUI' 5 import { router, window } from '@kit.ArkUI'
6 import { CustomTitleUI } from '../../reusable/CustomTitleUI' 6 import { CustomTitleUI } from '../../reusable/CustomTitleUI'
7 import { MyCommentDataSource } from '../model/MyCommentDataSource' 7 import { MyCommentDataSource } from '../model/MyCommentDataSource'
8 -import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils'  
9 import { HttpUrlUtils } from 'wdNetwork/Index' 8 import { HttpUrlUtils } from 'wdNetwork/Index'
10 import PageModel from '../../../viewmodel/PageModel' 9 import PageModel from '../../../viewmodel/PageModel'
11 import { ErrorComponent } from '../../view/ErrorComponent' 10 import { ErrorComponent } from '../../view/ErrorComponent'
@@ -185,37 +184,14 @@ export struct QualityCommentsComponent { @@ -185,37 +184,14 @@ export struct QualityCommentsComponent {
185 Column() { 184 Column() {
186 Stack() { 185 Stack() {
187 this.titleHeader() 186 this.titleHeader()
188 - this.listLayout()  
189 -  
190 - // if(this.viewType == ViewType.ERROR){  
191 - // ErrorComponent()  
192 - // }else if(this.viewType == ViewType.EMPTY){  
193 - // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment})  
194 - // }else {  
195 - // CustomPullToRefresh({  
196 - // alldata:[],  
197 - // scroller:this.scroller,  
198 - // customList:()=>{  
199 - // this.listLayout()  
200 - // // this.testLayout()  
201 - // },  
202 - // onRefresh:(resolve)=>{  
203 - // this.currentPage = 1  
204 - // this.getData(resolve)  
205 - // },  
206 - // onLoadMore:(resolve)=> {  
207 - // if (this.hasMore === false) {  
208 - // if(resolve) resolve('')  
209 - // return  
210 - // }  
211 - // this.currentPage++  
212 - // this.getData(resolve)  
213 - // }  
214 - // })  
215 - // }  
216 -  
217 -  
218 187
  188 + if(this.viewType == ViewType.ERROR){
  189 + ErrorComponent()
  190 + }else if(this.viewType == ViewType.EMPTY){
  191 + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment})
  192 + }else {
  193 + this.listLayout()
  194 + }
219 195
220 }.alignContent(Alignment.Top) 196 }.alignContent(Alignment.Top)
221 }.backgroundColor(this.currentWindowColor).width('100%') 197 }.backgroundColor(this.currentWindowColor).width('100%')
@@ -251,12 +227,15 @@ export struct QualityCommentsComponent { @@ -251,12 +227,15 @@ export struct QualityCommentsComponent {
251 ListItem() { 227 ListItem() {
252 228
253 }.height(this.bottomSafeHeight) 229 }.height(this.bottomSafeHeight)
254 - } 230 + }.onReachEnd(()=>{
  231 + this.currentPage++
  232 + this.getData()
  233 + })
255 .margin({ top: 196 }) 234 .margin({ top: 196 })
256 .height("100%") 235 .height("100%")
257 .width("100%") 236 .width("100%")
258 - .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果  
259 - // .edgeEffect(EdgeEffect.Spring) 237 + // .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
  238 + .edgeEffect(EdgeEffect.Spring)
260 .nestedScroll({ 239 .nestedScroll({
261 scrollForward: NestedScrollMode.PARENT_FIRST, 240 scrollForward: NestedScrollMode.PARENT_FIRST,
262 scrollBackward: NestedScrollMode.SELF_FIRST 241 scrollBackward: NestedScrollMode.SELF_FIRST
@@ -148,7 +148,7 @@ class CommentViewModel { @@ -148,7 +148,7 @@ class CommentViewModel {
148 bean['userName'] = UserDataLocal.getUserId(); 148 bean['userName'] = UserDataLocal.getUserId();
149 bean['userHeaderUrl'] = UserDataLocal.getUserHeaderUrl(); 149 bean['userHeaderUrl'] = UserDataLocal.getUserHeaderUrl();
150 150
151 - HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => { 151 + HttpBizUtil.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
152 if (data.code != 0) { 152 if (data.code != 0) {
153 fail() 153 fail()
154 return 154 return
@@ -164,7 +164,7 @@ class CommentViewModel { @@ -164,7 +164,7 @@ class CommentViewModel {
164 /*发布评论*/ 164 /*发布评论*/
165 publishComment(model: publishCommentModel) { 165 publishComment(model: publishCommentModel) {
166 166
167 - return new Promise<void>((success, fail) => { 167 + return new Promise<commentItemModel>((success, fail) => {
168 let url = HttpUrlUtils.getPublishCommentUrl() 168 let url = HttpUrlUtils.getPublishCommentUrl()
169 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 169 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
170 let bean: Record<string, string> = {}; 170 let bean: Record<string, string> = {};
@@ -182,14 +182,15 @@ class CommentViewModel { @@ -182,14 +182,15 @@ class CommentViewModel {
182 bean['targetType'] = model.targetType 182 bean['targetType'] = model.targetType
183 bean['parentId'] = model.parentId 183 bean['parentId'] = model.parentId
184 184
185 - HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => { 185 + HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean, headers).then((data: ResponseDTO<commentItemModel>) => {
186 if (data.code != 0) { 186 if (data.code != 0) {
187 ToastUtils.showToast(data.message, 1000); 187 ToastUtils.showToast(data.message, 1000);
188 fail() 188 fail()
189 return 189 return
190 } 190 }
191 ToastUtils.showToast(data.message, 1000); 191 ToastUtils.showToast(data.message, 1000);
192 - success() 192 + let model = data.data as commentItemModel
  193 + success(model)
193 }, (error: Error) => { 194 }, (error: Error) => {
194 ToastUtils.showToast('评论失败', 1000); 195 ToastUtils.showToast('评论失败', 1000);
195 fail() 196 fail()
@@ -240,7 +241,7 @@ class CommentViewModel { @@ -240,7 +241,7 @@ class CommentViewModel {
240 let promiseArray: Promise<commentStatusListModel | void>[] = []; 241 let promiseArray: Promise<commentStatusListModel | void>[] = [];
241 242
242 //未登录不用批查 243 //未登录不用批查
243 - if (HttpUrlUtils.getUserId()){ 244 + if (HttpUrlUtils.getUserId()) {
244 if (commentIDs.length > 0) { 245 if (commentIDs.length > 0) {
245 let promise1 = new Promise<void>((success) => { 246 let promise1 = new Promise<void>((success) => {
246 // HttpRequest HttpBizUtil 247 // HttpRequest HttpBizUtil
@@ -285,7 +286,7 @@ class CommentViewModel { @@ -285,7 +286,7 @@ class CommentViewModel {
285 }) 286 })
286 promiseArray.push(promise1); 287 promiseArray.push(promise1);
287 } 288 }
288 - } 289 + }
289 if (fromUserIDs.length > 0) { 290 if (fromUserIDs.length > 0) {
290 let promise2 = new Promise<void>((success) => { 291 let promise2 = new Promise<void>((success) => {
291 let url = HttpUrlUtils.getBatchUserUrl(); 292 let url = HttpUrlUtils.getBatchUserUrl();
@@ -386,8 +387,6 @@ class CommentViewModel { @@ -386,8 +387,6 @@ class CommentViewModel {
386 387
387 } 388 }
388 389
389 -  
390 -  
391 deepCopyCommentItemModel(model: commentItemModel) { 390 deepCopyCommentItemModel(model: commentItemModel) {
392 let newModel = new commentItemModel() 391 let newModel = new commentItemModel()
393 392
@@ -411,10 +410,13 @@ class CommentViewModel { @@ -411,10 +410,13 @@ class CommentViewModel {
411 newModel.fromUserHeader = model.fromUserHeader 410 newModel.fromUserHeader = model.fromUserHeader
412 newModel.fromUserId = model.fromUserId 411 newModel.fromUserId = model.fromUserId
413 newModel.fromUserName = model.fromUserName 412 newModel.fromUserName = model.fromUserName
414 - newModel.fromUserType = model.fromUserType 413 + if (model.toUserType != null) {
  414 + newModel.fromUserType = model.fromUserType
  415 + }
415 newModel.id = model.id 416 newModel.id = model.id
416 - newModel.likeNum = model.likeNum.toString()  
417 - 417 + if (model.likeNum) {
  418 + newModel.likeNum = model.likeNum.toString()
  419 + }
418 if (Number.parseInt(newModel.likeNum) <= 0) { 420 if (Number.parseInt(newModel.likeNum) <= 0) {
419 newModel.likeNum = '' 421 newModel.likeNum = ''
420 } 422 }
@@ -77,6 +77,7 @@ export struct ZhSingleRow02 { @@ -77,6 +77,7 @@ export struct ZhSingleRow02 {
77 .padding({ 77 .padding({
78 right: $r('app.float.card_comp_pagePadding_lf'), 78 right: $r('app.float.card_comp_pagePadding_lf'),
79 }) 79 })
  80 + .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
80 .onClick(() => { 81 .onClick(() => {
81 if (this.compDTO?.objectType === '11') { 82 if (this.compDTO?.objectType === '11') {
82 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) 83 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
  1 +import { CompDTO, ContentDTO, Params } from 'wdBean';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +import { HttpUrlUtils } from 'wdNetwork/Index';
  4 +import { postInteractAccentionOperateParams } from 'wdBean';
  5 +import { PageRepository } from '../../repository/PageRepository';
  6 +import { CommonConstants } from 'wdConstant/Index';
  7 +import { ProcessUtils } from 'wdRouter';
  8 +
  9 +/**
  10 + * 小视频横划卡
  11 + * Zh_Single_Row-02
  12 + */
  13 +const TAG = 'Zh_Single_Row-03'
  14 +
  15 +@Entry
  16 +@Component
  17 +export struct ZhSingleRow03 {
  18 + @State compDTO: CompDTO = {} as CompDTO
  19 + scroller: Scroller = new Scroller()
  20 +
  21 + build() {
  22 + Column() {
  23 + //顶部
  24 + this.CompHeader(this.compDTO)
  25 +
  26 + Scroll(this.scroller){
  27 + Row() {
  28 + ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
  29 + Column() {
  30 + Row() {
  31 + Image(item.coverUrl)
  32 + .width(106)
  33 + .height(60)
  34 + .margin({right: 12})
  35 + Text(item.newsTitle)
  36 + .width(154)
  37 + .height(60)
  38 + .maxLines(3)
  39 + .textOverflow({overflow: TextOverflow.Ellipsis})
  40 + }
  41 + .margin({bottom: 16})
  42 +
  43 + Row() {
  44 + Flex({justifyContent: FlexAlign.SpaceBetween}){
  45 + Row() {
  46 + Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5))
  47 + .margin({right: 6})
  48 + .fontColor(0x000000)
  49 + .fontSize(13)
  50 + .textAlign(TextAlign.Start)
  51 + Image($r('app.media.timeline_rect'))
  52 + .width(4)
  53 + .height(3)
  54 + .margin({right: 6})
  55 + Text(item.liveInfo.liveStartTime.split(' ')[1].slice(0, 5))
  56 + .margin({right: 6})
  57 + .fontColor(0x000000)
  58 + .fontSize(13)
  59 + Text('开始直播')
  60 + .fontColor(0xC8C8C8)
  61 + .fontSize(13)
  62 + }
  63 +
  64 + Row() {
  65 + Text('预约')
  66 + .width(48)
  67 + .height(24)
  68 + .backgroundColor(0xED2800)
  69 + .fontColor(0xffffff)
  70 + .fontSize(12)
  71 + .textAlign(TextAlign.Center)
  72 + .borderRadius(3)
  73 + }
  74 + .margin({top: -5})
  75 + }
  76 +
  77 + }
  78 + }
  79 + .width(298)
  80 + .height(116)
  81 + .padding({top: 12, bottom: 12, left: 12, right: 12})
  82 + .backgroundColor(0xf9f9f9)
  83 + .margin({right: 8})
  84 + .onClick(() => {
  85 + ProcessUtils.processPage(item)
  86 + })
  87 + })
  88 + }
  89 + }
  90 + .scrollable(ScrollDirection.Horizontal)
  91 + .scrollBar(BarState.Off)
  92 + }
  93 + .padding({
  94 + left: $r('app.float.card_comp_pagePadding_lf'),
  95 + right: $r('app.float.card_comp_pagePadding_lf'),
  96 + top: $r('app.float.card_comp_pagePadding_tb'),
  97 + bottom: $r('app.float.card_comp_pagePadding_tb')
  98 + })
  99 + .backgroundColor($r('app.color.white'))
  100 + }
  101 +
  102 + @Builder
  103 + CompHeader(item: CompDTO) {
  104 + Row() {
  105 + Row() {
  106 + Image($r("app.media.redLine"))
  107 + .width(3)
  108 + .height(16)
  109 + .margin({ right: 4 })
  110 + Text('直播预约')
  111 + .fontSize($r("app.float.font_size_17"))
  112 + .fontColor($r("app.color.color_222222"))
  113 + .fontWeight(600)
  114 + }
  115 +
  116 + Row() {
  117 + Text("更多")
  118 + .fontSize($r("app.float.font_size_14"))
  119 + .fontColor($r("app.color.color_999999"))
  120 + .margin({ right: 1 })
  121 + Image($r("app.media.more"))
  122 + .width(14)
  123 + .height(14)
  124 + .onClick(() => {
  125 + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
  126 + let params = {'index': "1"} as Record<string, string>
  127 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
  128 + })
  129 + }
  130 + .padding({
  131 + right: $r('app.float.card_comp_pagePadding_lf'),
  132 + })
  133 + .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
  134 + .onClick(() => {
  135 + if (this.compDTO?.objectType === '11') {
  136 + ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
  137 + } else if (this.compDTO?.objectType === '5') {
  138 + ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
  139 + } else if (this.compDTO?.objectType === '6') {
  140 + ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
  141 + }
  142 + })
  143 + }
  144 + .justifyContent(FlexAlign.SpaceBetween)
  145 + .margin({ top: 8, bottom: 8 })
  146 + .width('100%')
  147 + }
  148 +}
  149 +
  150 +@Extend(Text)
  151 +function textOverflowStyle(maxLine: number) {
  152 + .maxLines(maxLine)
  153 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  154 +}
  155 +
  156 +@Component
  157 +struct CreatorItem {
  158 + @Prop item: ContentDTO
  159 + @State rmhIsAttention: number = 0
  160 + build() {
  161 + ListItem() {
  162 + Column() {
  163 + Stack({ alignContent: Alignment.Bottom }) {
  164 + Image(this.item.coverUrl)
  165 + .width(156)
  166 + .height(208)
  167 + Row()
  168 + .width(156)
  169 + .height(80)
  170 + .linearGradient({
  171 + direction: GradientDirection.Bottom,
  172 + colors: [['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]]
  173 + })
  174 + Text(this.item.newsTitle)
  175 + .fontColor(0xffffff)
  176 + .fontSize(14)
  177 + .maxLines(2)
  178 + .textOverflow({overflow: TextOverflow.Ellipsis})
  179 + .width(140)
  180 + .margin({bottom: 8})
  181 + }
  182 + }
  183 + .width(156)
  184 + .height(208)
  185 + .margin({ right: 11 })
  186 + .borderColor($r('app.color.color_EDEDED'))
  187 + .borderRadius($r('app.float.image_border_radius'))
  188 + }
  189 + .onClick((event: ClickEvent) => {
  190 + ProcessUtils.processPage(this.item)
  191 + })
  192 + }
  193 +
  194 + /**
  195 + * 关注号主 TODO 这里后面需要抽离
  196 + */
  197 + handleAccention(item: ContentDTO, status: number) {
  198 + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
  199 + return
  200 + // 未登录,跳转登录
  201 + if (!HttpUrlUtils.getUserId()) {
  202 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  203 + return
  204 + }
  205 +
  206 + const params: postInteractAccentionOperateParams = {
  207 + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  208 + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
  209 + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
  210 + // userType: 1,
  211 + // userId: '1', // TODO 用户id需要从本地获取
  212 + status: status,
  213 + }
  214 + PageRepository.postInteractAccentionOperate(params).then(res => {
  215 + console.log(TAG, '关注号主==', JSON.stringify(res.data))
  216 + if (status === 1) {
  217 + this.rmhIsAttention = 0
  218 + } else {
  219 + this.rmhIsAttention = 1
  220 + }
  221 + })
  222 + }
  223 +}
@@ -36,6 +36,7 @@ export struct ZhSingleRow04 { @@ -36,6 +36,7 @@ export struct ZhSingleRow04 {
36 .width(14) 36 .width(14)
37 .height(14) 37 .height(14)
38 } 38 }
  39 + .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
39 .onClick(() => { 40 .onClick(() => {
40 if (this.compDTO?.objectType === '11') { 41 if (this.compDTO?.objectType === '11') {
41 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) 42 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
@@ -120,6 +120,9 @@ export struct ZhSingleRow06 { @@ -120,6 +120,9 @@ export struct ZhSingleRow06 {
120 .maxLines(1) 120 .maxLines(1)
121 .textOverflow({overflow: TextOverflow.Ellipsis}) 121 .textOverflow({overflow: TextOverflow.Ellipsis})
122 } 122 }
  123 + .onClick(() => {
  124 + ProcessUtils.commentGotoWeb(item.operDataList[0]?.commentInfo as commentInfo)
  125 + })
123 126
124 Row() { 127 Row() {
125 Image($r("app.media.icon_elite_comment")) 128 Image($r("app.media.icon_elite_comment"))
@@ -9,12 +9,13 @@ import { EmptyComponent } from '../../view/EmptyComponent'; @@ -9,12 +9,13 @@ import { EmptyComponent } from '../../view/EmptyComponent';
9 const TAG = "AppointmentListUI" 9 const TAG = "AppointmentListUI"
10 10
11 @Component 11 @Component
12 -export struct AppointmentListUI{ 12 +export struct AppointmentListUI {
13 @State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource(); 13 @State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource();
14 - @State count:number = 0;  
15 - @State isLoading:boolean = false  
16 - @State hasMore:boolean = true  
17 - curPageNum:number = 1; 14 + @State count: number = 0;
  15 + @State isLoading: boolean = false
  16 + @State hasMore: boolean = true
  17 + curPageNum: number = 1;
  18 + @State isGetRequest: boolean = false
18 19
19 aboutToAppear() { 20 aboutToAppear() {
20 this.getNewPageData() 21 this.getNewPageData()
@@ -23,37 +24,41 @@ export struct AppointmentListUI{ @@ -23,37 +24,41 @@ export struct AppointmentListUI{
23 build() { 24 build() {
24 Column() { 25 Column() {
25 //标题栏目 26 //标题栏目
26 - CustomTitleUI({titleName:"预约列表"})  
27 - if(this.count == 0){  
28 - EmptyComponent({emptyType:10})  
29 - .height('100%')  
30 - .width('100%')  
31 - }else{ 27 + CustomTitleUI({ titleName: "预约列表" })
  28 + if (this.count == 0) {
  29 + if (this.isGetRequest == true) {
  30 + EmptyComponent({ emptyType: 10 })
  31 + .height('100%')
  32 + .width('100%')
  33 + }
  34 +
  35 + } else {
32 //刷新控件 TODO 36 //刷新控件 TODO
33 //List 37 //List
34 List({ space: '6lpx' }) { 38 List({ space: '6lpx' }) {
35 LazyForEach(this.data, (item: MineAppointmentItem, index: number) => { 39 LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
36 ListItem() { 40 ListItem() {
37 - AppointmentListChildComponent({item:item}) 41 + AppointmentListChildComponent({ item: item })
38 } 42 }
39 - .onClick(()=>{ 43 + .onClick(() => {
40 //TODO 跳转 44 //TODO 跳转
41 }) 45 })
42 }, (item: MineAppointmentItem, index: number) => index.toString()) 46 }, (item: MineAppointmentItem, index: number) => index.toString())
43 47
44 //没有更多数据 显示提示 48 //没有更多数据 显示提示
45 - if(!this.hasMore){  
46 - ListItem(){ 49 + if (!this.hasMore) {
  50 + ListItem() {
47 ListHasNoMoreDataUI() 51 ListHasNoMoreDataUI()
48 } 52 }
49 } 53 }
50 - }.cachedCount(4) 54 + }
  55 + .cachedCount(4)
51 .scrollBar(BarState.Off) 56 .scrollBar(BarState.Off)
52 - .margin({top:'23lpx',left:'23lpx',right:'23lpx'}) 57 + .margin({ top: '23lpx', left: '23lpx', right: '23lpx' })
53 .layoutWeight(1) 58 .layoutWeight(1)
54 - .onReachEnd(()=>{  
55 - console.log(TAG,"触底了");  
56 - if(!this.isLoading){ 59 + .onReachEnd(() => {
  60 + console.log(TAG, "触底了");
  61 + if (!this.isLoading) {
57 //加载分页数据 62 //加载分页数据
58 this.getNewPageData() 63 this.getNewPageData()
59 } 64 }
@@ -65,70 +70,73 @@ export struct AppointmentListUI{ @@ -65,70 +70,73 @@ export struct AppointmentListUI{
65 .width('100%') 70 .width('100%')
66 } 71 }
67 72
68 - getNewPageData(){ 73 + getNewPageData() {
69 this.isLoading = true 74 this.isLoading = true
70 - if(this.hasMore){  
71 - MinePageDatasModel.getAppointmentListData("20",`${this.curPageNum}`,getContext(this)).then((value)=>{  
72 - if (!this.data || value.list.length == 0){  
73 - this.hasMore = false  
74 - }else{  
75 - value.list.forEach((value)=>{  
76 - let dealTime = this.DealStartTime(value.planStartTime)  
77 - if(dealTime!=null && dealTime.length === 2){  
78 - this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,dealTime[0],dealTime[1],value.relType,value.liveId,value.relId))  
79 - }else {  
80 - this.data.push(new MineAppointmentItem(value.imageUrl,value.status,value.title,true,"","",value.relType,value.liveId,value.relId))  
81 - }  
82 - })  
83 - this.data.notifyDataReload()  
84 - this.count = this.data.totalCount()  
85 - if (this.data.totalCount() < value.totalCount) {  
86 - this.curPageNum++  
87 - }else {  
88 - this.hasMore = false 75 + if (this.hasMore) {
  76 + MinePageDatasModel.getAppointmentListData("20", `${this.curPageNum}`, getContext(this)).then((value) => {
  77 + if (!this.data || value.list.length == 0) {
  78 + this.hasMore = false
  79 + } else {
  80 + value.list.forEach((value) => {
  81 + let dealTime = this.DealStartTime(value.planStartTime)
  82 + if (dealTime != null && dealTime.length === 2) {
  83 + this.data.push(new MineAppointmentItem(value.imageUrl, value.status, value.title, true, dealTime[0], dealTime[1], value.relType, value.liveId, value.relId))
  84 + } else {
  85 + this.data.push(new MineAppointmentItem(value.imageUrl, value.status, value.title, true, "", "", value.relType, value.liveId, value.relId))
89 } 86 }
  87 + })
  88 + this.data.notifyDataReload()
  89 + this.count = this.data.totalCount()
  90 + if (this.data.totalCount() < value.totalCount) {
  91 + this.curPageNum++
  92 + } else {
  93 + this.hasMore = false
90 } 94 }
91 - }).catch((err:Error)=>{  
92 - console.log(TAG,JSON.stringify(err))  
93 - }) 95 + }
  96 + this.isGetRequest = true
  97 + this.isLoading = false
  98 + }).catch((err: Error) => {
  99 + console.log(TAG, JSON.stringify(err))
  100 + this.isGetRequest = true
  101 + this.isLoading = false
  102 + })
94 } 103 }
95 - this.isLoading = false  
96 } 104 }
97 105
98 - DealStartTime(planStartTime:string):string[]{  
99 - let dealData:string[] = [] 106 + DealStartTime(planStartTime: string): string[] {
  107 + let dealData: string[] = []
100 108
101 - if(!StringUtils.isNotEmpty(planStartTime)){  
102 - console.log(TAG,"格式有误") 109 + if (!StringUtils.isNotEmpty(planStartTime)) {
  110 + console.log(TAG, "格式有误")
103 return dealData 111 return dealData
104 } 112 }
105 113
106 - if(planStartTime.indexOf(" ") === -1){  
107 - console.log(TAG,"格式有误") 114 + if (planStartTime.indexOf(" ") === -1) {
  115 + console.log(TAG, "格式有误")
108 return dealData 116 return dealData
109 } 117 }
110 let arr = planStartTime.split(" ") 118 let arr = planStartTime.split(" ")
111 - if(arr!=null && StringUtils.isNotEmpty(arr[0])){ //处理年月日 119 + if (arr != null && StringUtils.isNotEmpty(arr[0])) { //处理年月日
112 let time = arr[0].split("-"); 120 let time = arr[0].split("-");
113 - if(time.length === 3){  
114 - let month = time[1].indexOf("0") === 0 ? time[1].substring(1):time[1] 121 + if (time.length === 3) {
  122 + let month = time[1].indexOf("0") === 0 ? time[1].substring(1) : time[1]
115 let day = time[2] 123 let day = time[2]
116 124
117 dealData[0] = `${month}月${day}日` 125 dealData[0] = `${month}月${day}日`
118 - let today = `${new Date().getMonth()+1}月${new Date().getDate()}日`  
119 - if(dealData[0] === today){ 126 + let today = `${new Date().getMonth() + 1}月${new Date().getDate()}日`
  127 + if (dealData[0] === today) {
120 dealData[0] = "今日" 128 dealData[0] = "今日"
121 } 129 }
122 } 130 }
123 } 131 }
124 132
125 - if(arr!=null && StringUtils.isNotEmpty(arr[1])){ //处理时分 133 + if (arr != null && StringUtils.isNotEmpty(arr[1])) { //处理时分
126 let time = arr[1].split(":"); 134 let time = arr[1].split(":");
127 - if(time.length === 3){  
128 - dealData[1] = `${time[0]}:${time[1]}` 135 + if (time.length === 3) {
  136 + dealData[1] = `${time[0]}:${time[1]}`
129 } 137 }
130 } 138 }
131 - console.log(TAG,JSON.stringify(dealData)) 139 + console.log(TAG, JSON.stringify(dealData))
132 return dealData 140 return dealData
133 } 141 }
134 } 142 }
@@ -256,11 +256,13 @@ export struct FollowChildComponent{ @@ -256,11 +256,13 @@ export struct FollowChildComponent{
256 if (value.code === 0 || value.code.toString() === "0") { 256 if (value.code === 0 || value.code.toString() === "0") {
257 this.data.status = this.data.status ==="0"?"1":"0" 257 this.data.status = this.data.status ==="0"?"1":"0"
258 258
259 - if(this.data.status === "1"){  
260 - UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")  
261 - }else{  
262 - UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)  
263 - } 259 + UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
  260 +
  261 + // if(this.data.status === "1"){
  262 + // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
  263 + // }else{
  264 + // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
  265 + // }
264 } 266 }
265 } 267 }
266 }) 268 })
@@ -24,6 +24,7 @@ export struct FollowListDetailUI { @@ -24,6 +24,7 @@ export struct FollowListDetailUI {
24 @State hasMore: boolean = true 24 @State hasMore: boolean = true
25 curPageNum: number = 1; 25 curPageNum: number = 1;
26 preferences: dataPreferences.Preferences | null = null; 26 preferences: dataPreferences.Preferences | null = null;
  27 + @State isGetRequest: boolean = false
27 28
28 aboutToAppear() { 29 aboutToAppear() {
29 this.getNewPageData() 30 this.getNewPageData()
@@ -33,9 +34,12 @@ export struct FollowListDetailUI { @@ -33,9 +34,12 @@ export struct FollowListDetailUI {
33 build() { 34 build() {
34 Column() { 35 Column() {
35 if (this.count === 0) { 36 if (this.count === 0) {
36 - EmptyComponent({emptyType:14})  
37 - .layoutWeight(1)  
38 - .width('100%') 37 + if (this.isGetRequest == true) {
  38 + EmptyComponent({ emptyType: 14 })
  39 + .layoutWeight(1)
  40 + .width('100%')
  41 + }
  42 +
39 } else { 43 } else {
40 List({ space: 3 }) { 44 List({ space: 3 }) {
41 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { 45 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
@@ -47,7 +51,7 @@ export struct FollowListDetailUI { @@ -47,7 +51,7 @@ export struct FollowListDetailUI {
47 }, (item: FollowListDetailItem) => item.creatorId) 51 }, (item: FollowListDetailItem) => item.creatorId)
48 52
49 //没有更多数据 显示提示 53 //没有更多数据 显示提示
50 - if (!this.hasMore) { 54 + if (!this.hasMore && this.count != 0) {
51 ListItem() { 55 ListItem() {
52 ListHasNoMoreDataUI() 56 ListHasNoMoreDataUI()
53 } 57 }
@@ -75,16 +79,17 @@ export struct FollowListDetailUI { @@ -75,16 +79,17 @@ export struct FollowListDetailUI {
75 let observer = (key: string) => { 79 let observer = (key: string) => {
76 if (key == UserDataLocal.USER_FOLLOW_OPERATION) { 80 if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
77 if (this.creatorDirectoryId === -1) { 81 if (this.creatorDirectoryId === -1) {
78 - let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string 82 + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
79 let arr = value.split(',') 83 let arr = value.split(',')
80 - if(arr!=null && arr.length === 2){  
81 - this.data.getDataArray().forEach((element,index) => {  
82 - if (element.creatorId === arr[1]) { 84 + if (arr[1] == "0") {
  85 + this.data.getDataArray().forEach((element, index) => {
  86 + if (element.creatorId === arr[0]) {
83 this.data.deleteItem(index) 87 this.data.deleteItem(index)
  88 + this.count = this.data.size()
84 } 89 }
85 }); 90 });
86 - }else{  
87 - if(!this.isLoading){ 91 + } else {
  92 + if (!this.isLoading) {
88 this.isLoading = true 93 this.isLoading = true
89 this.hasMore = true 94 this.hasMore = true
90 this.curPageNum = 1 95 this.curPageNum = 1
@@ -93,6 +98,16 @@ export struct FollowListDetailUI { @@ -93,6 +98,16 @@ export struct FollowListDetailUI {
93 this.getMyFollowListDetail() 98 this.getMyFollowListDetail()
94 } 99 }
95 } 100 }
  101 + }else{
  102 + let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION, "") as string
  103 + let arr = value.split(',')
  104 + if (arr[1] == "0"){
  105 + this.data.getDataArray().forEach((element, index) => {
  106 + if (element.creatorId === arr[0]) {
  107 + this.data.getData(index).status = "0"
  108 + }
  109 + })
  110 + }
96 } 111 }
97 } 112 }
98 } 113 }
@@ -109,7 +124,7 @@ export struct FollowListDetailUI { @@ -109,7 +124,7 @@ export struct FollowListDetailUI {
109 this.isLoading = false 124 this.isLoading = false
110 } else { 125 } else {
111 value.list.forEach((value) => { 126 value.list.forEach((value) => {
112 - let fansNum:number = value.fansNum 127 + let fansNum: number = value.fansNum
113 let fansNumString = "" 128 let fansNumString = ""
114 if (fansNum > 10000) { 129 if (fansNum > 10000) {
115 let temp = (fansNum / 10000) + "" 130 let temp = (fansNum / 10000) + ""
@@ -123,7 +138,7 @@ export struct FollowListDetailUI { @@ -123,7 +138,7 @@ export struct FollowListDetailUI {
123 } else { 138 } else {
124 fansNumString = fansNum + "" 139 fansNumString = fansNum + ""
125 } 140 }
126 - 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)) 141 + 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))
127 }) 142 })
128 this.data.notifyDataReload() 143 this.data.notifyDataReload()
129 this.count = this.data.totalCount() 144 this.count = this.data.totalCount()
@@ -134,12 +149,15 @@ export struct FollowListDetailUI { @@ -134,12 +149,15 @@ export struct FollowListDetailUI {
134 } 149 }
135 } 150 }
136 this.isLoading = false 151 this.isLoading = false
  152 + this.isGetRequest = true
137 }).catch((err: Error) => { 153 }).catch((err: Error) => {
138 console.log(TAG, "请求失败") 154 console.log(TAG, "请求失败")
  155 + this.isGetRequest = true
139 this.isLoading = false 156 this.isLoading = false
140 }) 157 })
141 - }else { 158 + } else {
142 this.isLoading = false 159 this.isLoading = false
  160 + this.isGetRequest = true
143 } 161 }
144 } 162 }
145 163
@@ -161,6 +179,7 @@ export struct FollowListDetailUI { @@ -161,6 +179,7 @@ export struct FollowListDetailUI {
161 }).catch((err: Error) => { 179 }).catch((err: Error) => {
162 console.log(TAG, "请求失败") 180 console.log(TAG, "请求失败")
163 this.isLoading = false 181 this.isLoading = false
  182 + this.isGetRequest = true
164 }) 183 })
165 } 184 }
166 } 185 }
@@ -169,7 +188,7 @@ export struct FollowListDetailUI { @@ -169,7 +188,7 @@ export struct FollowListDetailUI {
169 getFollowListStatus(result: MineFollowListDetailItem) { 188 getFollowListStatus(result: MineFollowListDetailItem) {
170 let data_temp: FollowListDetailItem[] = [] 189 let data_temp: FollowListDetailItem[] = []
171 result.list.forEach((item) => { 190 result.list.forEach((item) => {
172 - 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)) 191 + 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))
173 }) 192 })
174 let request = new CreatorDetailRequestItem() 193 let request = new CreatorDetailRequestItem()
175 194
@@ -206,6 +225,7 @@ export struct FollowListDetailUI { @@ -206,6 +225,7 @@ export struct FollowListDetailUI {
206 console.log(TAG, JSON.stringify(err)) 225 console.log(TAG, JSON.stringify(err))
207 this.isLoading = false 226 this.isLoading = false
208 this.count = this.count === -1 ? 0 : this.count 227 this.count = this.count === -1 ? 0 : this.count
  228 + this.isGetRequest = true
209 }) 229 })
210 } 230 }
211 231
@@ -225,7 +245,7 @@ export struct FollowListDetailUI { @@ -225,7 +245,7 @@ export struct FollowListDetailUI {
225 }) 245 })
226 246
227 result.forEach((item) => { 247 result.forEach((item) => {
228 - 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)) 248 + 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))
229 }) 249 })
230 250
231 this.data.notifyDataReload() 251 this.data.notifyDataReload()
@@ -238,9 +258,11 @@ export struct FollowListDetailUI { @@ -238,9 +258,11 @@ export struct FollowListDetailUI {
238 } 258 }
239 259
240 this.isLoading = false 260 this.isLoading = false
  261 + this.isGetRequest = true
241 }).catch((err: Error) => { 262 }).catch((err: Error) => {
242 console.log(TAG, "请求失败") 263 console.log(TAG, "请求失败")
243 this.isLoading = false 264 this.isLoading = false
  265 + this.isGetRequest = true
244 }) 266 })
245 } 267 }
246 } 268 }
@@ -27,6 +27,7 @@ export struct HomePageBottomComponent{ @@ -27,6 +27,7 @@ export struct HomePageBottomComponent{
27 @State userId:string = ""; 27 @State userId:string = "";
28 @Link commentNum:number 28 @Link commentNum:number
29 preferences: dataPreferences.Preferences | null = null; 29 preferences: dataPreferences.Preferences | null = null;
  30 + @State isGetRequest:boolean = false
30 31
31 aboutToAppear(){ 32 aboutToAppear(){
32 this.getNewPageData() 33 this.getNewPageData()
@@ -39,10 +40,11 @@ export struct HomePageBottomComponent{ @@ -39,10 +40,11 @@ export struct HomePageBottomComponent{
39 if (key == UserDataLocal.USER_FOLLOW_OPERATION) { 40 if (key == UserDataLocal.USER_FOLLOW_OPERATION) {
40 let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string 41 let value = SPHelper.default.getSync(UserDataLocal.USER_FOLLOW_OPERATION,"") as string
41 let arr = value.split(',') 42 let arr = value.split(',')
42 - if(arr!=null && arr.length === 2){ 43 + if(arr[1] == "0"){
43 this.data_follow.getDataArray().forEach((element,index) => { 44 this.data_follow.getDataArray().forEach((element,index) => {
44 - if (element.creatorId === arr[1]) { 45 + if (element.creatorId === arr[0]) {
45 this.data_follow.deleteItem(index) 46 this.data_follow.deleteItem(index)
  47 + this.count = this.data_follow.size()
46 } 48 }
47 }); 49 });
48 }else{ 50 }else{
@@ -62,12 +64,14 @@ export struct HomePageBottomComponent{ @@ -62,12 +64,14 @@ export struct HomePageBottomComponent{
62 64
63 build(){ 65 build(){
64 Column(){ 66 Column(){
65 - Divider().width('100%')  
66 - .height('2lpx')  
67 - .strokeWidth('1lpx')  
68 - .backgroundColor($r('app.color.color_EDEDED')) 67 + if(this.isGetRequest == true){
  68 + Divider().width('100%')
  69 + .height('2lpx')
  70 + .strokeWidth('1lpx')
  71 + .backgroundColor($r('app.color.color_EDEDED'))
  72 + }
69 73
70 - if(this.count === 0){ 74 + if(this.count === 0 ){
71 if(this.style === 1){ 75 if(this.style === 1){
72 Column(){ 76 Column(){
73 Row(){ 77 Row(){
@@ -92,15 +96,19 @@ export struct HomePageBottomComponent{ @@ -92,15 +96,19 @@ export struct HomePageBottomComponent{
92 let params = {'index': "1"} as Record<string, string> 96 let params = {'index': "1"} as Record<string, string>
93 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) 97 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
94 }) 98 })
95 -  
96 - EmptyComponent({emptyType:14})  
97 - .layoutWeight(1)  
98 - .width('100%') 99 + if(this.isGetRequest == true){
  100 + EmptyComponent({emptyType:14})
  101 + .layoutWeight(1)
  102 + .width('100%')
  103 + }
99 }.layoutWeight(1) 104 }.layoutWeight(1)
100 .justifyContent(FlexAlign.Start) 105 .justifyContent(FlexAlign.Start)
101 }else{ 106 }else{
102 - ListHasNoMoreDataUI({style:2})  
103 - .layoutWeight(1) 107 + if(this.isGetRequest == true){
  108 + EmptyComponent({emptyType:11})
  109 + .layoutWeight(1)
  110 + .width('100%')
  111 + }
104 } 112 }
105 }else{ 113 }else{
106 if(this.style === 1){ 114 if(this.style === 1){
@@ -244,12 +252,15 @@ export struct HomePageBottomComponent{ @@ -244,12 +252,15 @@ export struct HomePageBottomComponent{
244 } 252 }
245 } 253 }
246 this.isLoading = false 254 this.isLoading = false
  255 + this.isGetRequest = true
247 }).catch((err:Error)=>{ 256 }).catch((err:Error)=>{
248 console.log(TAG,"请求失败") 257 console.log(TAG,"请求失败")
249 this.isLoading = false 258 this.isLoading = false
  259 + this.isGetRequest = true
250 }) 260 })
251 }else{ 261 }else{
252 this.isLoading = false 262 this.isLoading = false
  263 + this.isGetRequest = true
253 } 264 }
254 } 265 }
255 266
@@ -266,17 +277,18 @@ export struct HomePageBottomComponent{ @@ -266,17 +277,18 @@ export struct HomePageBottomComponent{
266 MinePageDatasModel.getMineCommentListData(time,object,getContext(this)).then((value)=>{ 277 MinePageDatasModel.getMineCommentListData(time,object,getContext(this)).then((value)=>{
267 if (!this.data_comment || value.list.length == 0){ 278 if (!this.data_comment || value.list.length == 0){
268 this.hasMore = false 279 this.hasMore = false
  280 + this.isLoading = false
269 }else{ 281 }else{
270 this.getCommentListStatus(value) 282 this.getCommentListStatus(value)
271 } 283 }
272 - this.isLoading = false  
273 - this.commentNum = value.totalCount  
274 }).catch((err:Error)=>{ 284 }).catch((err:Error)=>{
275 console.log(TAG,"请求失败") 285 console.log(TAG,"请求失败")
276 this.isLoading = false 286 this.isLoading = false
  287 + this.isGetRequest = true
277 }) 288 })
278 }else{ 289 }else{
279 this.isLoading = false 290 this.isLoading = false
  291 + this.isGetRequest = true
280 } 292 }
281 } 293 }
282 } 294 }
@@ -329,9 +341,11 @@ export struct HomePageBottomComponent{ @@ -329,9 +341,11 @@ export struct HomePageBottomComponent{
329 } 341 }
330 342
331 this.isLoading = false 343 this.isLoading = false
  344 + this.isGetRequest = true
332 }).catch((err:Error)=>{ 345 }).catch((err:Error)=>{
333 console.log(TAG,"请求失败") 346 console.log(TAG,"请求失败")
334 this.isLoading = false 347 this.isLoading = false
  348 + this.isGetRequest = true
335 }) 349 })
336 } 350 }
337 351
@@ -6,50 +6,61 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; @@ -6,50 +6,61 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
6 import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; 6 import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
7 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; 7 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
8 import { ChildCommentComponent } from './ChildCommentComponent'; 8 import { ChildCommentComponent } from './ChildCommentComponent';
  9 +import { EmptyComponent } from '../../view/EmptyComponent';
9 10
10 const TAG = "HomePageBottomComponent" 11 const TAG = "HomePageBottomComponent"
  12 +
11 @Component 13 @Component
12 -export struct OtherHomePageBottomCommentComponent{ 14 +export struct OtherHomePageBottomCommentComponent {
13 @Prop curUserId: string 15 @Prop curUserId: string
14 @State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource(); 16 @State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource();
15 - @State isLoading:boolean = false  
16 - @State hasMore:boolean = true  
17 - curPageNum:number = 1;  
18 - @State count:number = 0;  
19 - @Prop levelHead:string  
20 - @Link commentNum:number  
21 -  
22 - aboutToAppear(){ 17 + @State isLoading: boolean = false
  18 + @State hasMore: boolean = true
  19 + curPageNum: number = 1;
  20 + @State count: number = 0;
  21 + @Prop levelHead: string
  22 + @Link commentNum: number
  23 + @State isGetRequest: boolean = false
  24 +
  25 + aboutToAppear() {
23 this.getNewPageData() 26 this.getNewPageData()
24 } 27 }
25 28
26 - build(){  
27 - Column(){ 29 + build() {
  30 + Column() {
28 Divider().width('100%') 31 Divider().width('100%')
29 .height('2lpx') 32 .height('2lpx')
30 .strokeWidth('1lpx') 33 .strokeWidth('1lpx')
31 .backgroundColor($r('app.color.color_EDEDED')) 34 .backgroundColor($r('app.color.color_EDEDED'))
32 35
33 - if(this.count === 0){  
34 - ListHasNoMoreDataUI({style:2})  
35 - .height('100%')  
36 - }else{ 36 + if (this.count === 0) {
  37 + if (this.isGetRequest == true) {
  38 + EmptyComponent({emptyType:11})
  39 + .height('100%')
  40 + .layoutWeight(1)
  41 + }
  42 + } else {
37 List({ space: 3 }) { 43 List({ space: 3 }) {
38 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 44 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
39 ListItem() { 45 ListItem() {
40 - ChildCommentComponent({data: item,levelHead:this.levelHead,isLastItem:index===this.data_comment.totalCount()-1}) 46 + ChildCommentComponent({
  47 + data: item,
  48 + levelHead: this.levelHead,
  49 + isLastItem: index === this.data_comment.totalCount() - 1
  50 + })
41 } 51 }
42 .onClick(() => { 52 .onClick(() => {
43 }) 53 })
44 }, (item: CommentListItem, index: number) => index.toString()) 54 }, (item: CommentListItem, index: number) => index.toString())
45 55
46 //没有更多数据 显示提示 56 //没有更多数据 显示提示
47 - if(!this.hasMore){  
48 - ListItem(){ 57 + if (!this.hasMore) {
  58 + ListItem() {
49 ListHasNoMoreDataUI() 59 ListHasNoMoreDataUI()
50 } 60 }
51 } 61 }
52 - }.cachedCount(15) 62 + }
  63 + .cachedCount(15)
53 .layoutWeight(1) 64 .layoutWeight(1)
54 .scrollBar(BarState.Off) 65 .scrollBar(BarState.Off)
55 .edgeEffect(EdgeEffect.None) 66 .edgeEffect(EdgeEffect.None)
@@ -57,9 +68,9 @@ export struct OtherHomePageBottomCommentComponent{ @@ -57,9 +68,9 @@ export struct OtherHomePageBottomCommentComponent{
57 scrollForward: NestedScrollMode.PARENT_FIRST, 68 scrollForward: NestedScrollMode.PARENT_FIRST,
58 scrollBackward: NestedScrollMode.SELF_FIRST 69 scrollBackward: NestedScrollMode.SELF_FIRST
59 }) 70 })
60 - .onReachEnd(()=>{  
61 - console.log(TAG,"触底了");  
62 - if(!this.isLoading){ 71 + .onReachEnd(() => {
  72 + console.log(TAG, "触底了");
  73 + if (!this.isLoading) {
63 this.isLoading = true 74 this.isLoading = true
64 //加载分页数据 75 //加载分页数据
65 this.getNewPageData() 76 this.getNewPageData()
@@ -72,7 +83,6 @@ export struct OtherHomePageBottomCommentComponent{ @@ -72,7 +83,6 @@ export struct OtherHomePageBottomCommentComponent{
72 .justifyContent(FlexAlign.Start) 83 .justifyContent(FlexAlign.Start)
73 } 84 }
74 85
75 -  
76 @Styles 86 @Styles
77 listStyle() { 87 listStyle() {
78 .backgroundColor(Color.White) 88 .backgroundColor(Color.White)
@@ -81,60 +91,64 @@ export struct OtherHomePageBottomCommentComponent{ @@ -81,60 +91,64 @@ export struct OtherHomePageBottomCommentComponent{
81 .borderRadius(12) 91 .borderRadius(12)
82 } 92 }
83 93
84 - getNewPageData(){ 94 + getNewPageData() {
85 this.isLoading = true 95 this.isLoading = true
86 - if(this.hasMore){ 96 + if (this.hasMore) {
87 let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) 97 let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
88 - let object = new OtherUserCommentListRequestItem("",20,this.curPageNum,time,"1",this.curUserId) 98 + let object = new OtherUserCommentListRequestItem("", 20, this.curPageNum, time, "1", this.curUserId)
89 99
90 - MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{  
91 - if (!this.data_comment || value.list.length == 0){ 100 + MinePageDatasModel.getOtherCommentListData(object, getContext(this)).then((value) => {
  101 + if (!this.data_comment || value.list.length == 0) {
92 this.hasMore = false 102 this.hasMore = false
93 this.isLoading = false 103 this.isLoading = false
94 - }else{ 104 + } else {
95 this.getCommentListStatus(value) 105 this.getCommentListStatus(value)
96 } 106 }
97 - }).catch((err:Error)=>{  
98 - console.log(TAG,"请求失败") 107 + }).catch((err: Error) => {
  108 + console.log(TAG, "请求失败")
99 this.isLoading = false 109 this.isLoading = false
  110 + this.isGetRequest = true
100 }) 111 })
  112 + } else {
  113 + this.isGetRequest = true
  114 + this.isLoading = false
101 } 115 }
102 } 116 }
103 117
104 - getCommentListStatus(value:MineCommentListDetailItem){ 118 + getCommentListStatus(value: MineCommentListDetailItem) {
105 119
106 let status = new OtherUserCommentLikeStatusRequestItem() 120 let status = new OtherUserCommentLikeStatusRequestItem()
107 - let data : CommentListItem[] = []  
108 - value.list.forEach((item)=>{  
109 - if(item.checkStatus === 2){ 121 + let data: CommentListItem[] = []
  122 + value.list.forEach((item) => {
  123 + if (item.checkStatus === 2) {
110 status.commentIdList.push(item.id) 124 status.commentIdList.push(item.id)
111 } 125 }
112 let commentContent = item.commentContent 126 let commentContent = item.commentContent
113 - if(item.sensitiveShow === 0 && item.sensitiveExist === 1){ 127 + if (item.sensitiveShow === 0 && item.sensitiveExist === 1) {
114 commentContent = item.commentContentSensitive 128 commentContent = item.commentContentSensitive
115 } 129 }
116 let parentCommentContent = "" 130 let parentCommentContent = ""
117 - if(item.parentCommentVo!=null ){ 131 + if (item.parentCommentVo != null) {
118 parentCommentContent = item.parentCommentVo.commentContent 132 parentCommentContent = item.parentCommentVo.commentContent
119 } 133 }
120 let parentCommentUserName = "" 134 let parentCommentUserName = ""
121 - if(item.parentCommentVo!=null ){ 135 + if (item.parentCommentVo != null) {
122 parentCommentUserName = item.parentCommentVo.fromUserName 136 parentCommentUserName = item.parentCommentVo.fromUserName
123 } 137 }
124 - 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)) 138 + 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))
125 }) 139 })
126 140
127 - MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{  
128 - newValue.forEach((item)=>{  
129 - data.forEach((list)=>{ 141 + MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
  142 + newValue.forEach((item) => {
  143 + data.forEach((list) => {
130 if (item.commentId == list.id) { 144 if (item.commentId == list.id) {
131 list.like_status = item.status 145 list.like_status = item.status
132 } 146 }
133 }) 147 })
134 }) 148 })
135 149
136 - data.forEach((item)=>{  
137 - 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)) 150 + data.forEach((item) => {
  151 + 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))
138 }) 152 })
139 153
140 this.data_comment.notifyDataReload() 154 this.data_comment.notifyDataReload()
@@ -143,14 +157,16 @@ export struct OtherHomePageBottomCommentComponent{ @@ -143,14 +157,16 @@ export struct OtherHomePageBottomCommentComponent{
143 this.commentNum = value.totalCount 157 this.commentNum = value.totalCount
144 if (this.data_comment.totalCount() < value.totalCount) { 158 if (this.data_comment.totalCount() < value.totalCount) {
145 this.curPageNum++ 159 this.curPageNum++
146 - }else { 160 + } else {
147 this.hasMore = false 161 this.hasMore = false
148 } 162 }
149 163
150 this.isLoading = false 164 this.isLoading = false
151 - }).catch((err:Error)=>{  
152 - console.log(TAG,"请求失败") 165 + this.isGetRequest = true
  166 + }).catch((err: Error) => {
  167 + console.log(TAG, "请求失败")
153 this.isLoading = false 168 this.isLoading = false
  169 + this.isGetRequest = true
154 }) 170 })
155 } 171 }
156 } 172 }
@@ -17,6 +17,7 @@ export struct OtherHomePageBottomFollowComponent{ @@ -17,6 +17,7 @@ export struct OtherHomePageBottomFollowComponent{
17 curPageNum:number = 1; 17 curPageNum:number = 1;
18 @State count:number = 0; 18 @State count:number = 0;
19 @Prop curUserId: string 19 @Prop curUserId: string
  20 + @State isGetRequest:boolean = false
20 21
21 22
22 aboutToAppear(){ 23 aboutToAppear(){
@@ -54,10 +55,11 @@ export struct OtherHomePageBottomFollowComponent{ @@ -54,10 +55,11 @@ export struct OtherHomePageBottomFollowComponent{
54 let params = {'index': "1"} as Record<string, string> 55 let params = {'index': "1"} as Record<string, string>
55 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) 56 WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
56 }) 57 })
57 -  
58 - EmptyComponent({emptyType:14})  
59 - .layoutWeight(1)  
60 - .width('100%') 58 + if(this.isGetRequest == true){
  59 + EmptyComponent({emptyType:14})
  60 + .layoutWeight(1)
  61 + .width('100%')
  62 + }
61 }.layoutWeight(1) 63 }.layoutWeight(1)
62 .justifyContent(FlexAlign.Start) 64 .justifyContent(FlexAlign.Start)
63 }else{ 65 }else{
@@ -155,10 +157,15 @@ export struct OtherHomePageBottomFollowComponent{ @@ -155,10 +157,15 @@ export struct OtherHomePageBottomFollowComponent{
155 } 157 }
156 } 158 }
157 this.isLoading = false 159 this.isLoading = false
  160 + this.isGetRequest = true
158 }).catch((err:Error)=>{ 161 }).catch((err:Error)=>{
159 console.log(TAG,"请求失败") 162 console.log(TAG,"请求失败")
160 this.isLoading = false 163 this.isLoading = false
  164 + this.isGetRequest = true
161 }) 165 })
  166 + }else{
  167 + this.isGetRequest = true
  168 + this.isLoading = false
162 } 169 }
163 } 170 }
164 } 171 }
1 import { BottomNavi, CommonConstants } from 'wdConstant'; 1 import { BottomNavi, CommonConstants } from 'wdConstant';
2 -import { BottomNavDTO } from 'wdBean'; 2 +import { BottomNavDTO, TopNavDTO } from 'wdBean';
3 import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; 3 import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
4 import { TopNavigationComponent } from './TopNavigationComponent'; 4 import { TopNavigationComponent } from './TopNavigationComponent';
5 import { MinePageComponent } from './MinePageComponent'; 5 import { MinePageComponent } from './MinePageComponent';
6 import { CompUtils } from '../../utils/CompUtils'; 6 import { CompUtils } from '../../utils/CompUtils';
7 import PageViewModel from '../../viewmodel/PageViewModel'; 7 import PageViewModel from '../../viewmodel/PageViewModel';
8 import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; 8 import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
  9 +import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
9 10
10 const TAG = 'BottomNavigationComponent'; 11 const TAG = 'BottomNavigationComponent';
11 let storage = LocalStorage.getShared(); 12 let storage = LocalStorage.getShared();
@@ -21,14 +22,13 @@ export struct BottomNavigationComponent { @@ -21,14 +22,13 @@ export struct BottomNavigationComponent {
21 @Provide isLayoutFullScreen: boolean = false 22 @Provide isLayoutFullScreen: boolean = false
22 @Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229 23 @Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229
23 @Provide isNight: boolean = false // 是否开启夜间模式 24 @Provide isNight: boolean = false // 是否开启夜间模式
  25 + @Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息
  26 + @Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息
  27 + @Provide barBackgroundColor: Color = Color.Transparent
24 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 28 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
25 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 29 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
26 - // 底导/顶导全部数据  
27 - @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []  
28 - // 底导当前选中/焦点下标  
29 - @State currentNavIndex: number = BottomNavi.NEWS;  
30 - // @State currentTopNavSelectedIndex: number = 0; //  
31 - @State barBackgroundColor: Color = Color.Transparent 30 + @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据
  31 + @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标
32 // 底导TabsController 32 // 底导TabsController
33 private navController: TabsController = new TabsController(); 33 private navController: TabsController = new TabsController();
34 readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 34 readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比
@@ -44,6 +44,7 @@ export struct BottomNavigationComponent { @@ -44,6 +44,7 @@ export struct BottomNavigationComponent {
44 @State assignChannel: AssignChannelParam = new AssignChannelParam() 44 @State assignChannel: AssignChannelParam = new AssignChannelParam()
45 // 自动刷新触发(双击tab自动刷新) 45 // 自动刷新触发(双击tab自动刷新)
46 @State autoRefresh: number = 0 46 @State autoRefresh: number = 0
  47 +
47 async aboutToAppear() { 48 async aboutToAppear() {
48 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); 49 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
49 let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) 50 let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
@@ -84,7 +85,6 @@ export struct BottomNavigationComponent { @@ -84,7 +85,6 @@ export struct BottomNavigationComponent {
84 _currentNavIndex: $currentNavIndex, 85 _currentNavIndex: $currentNavIndex,
85 navIndex: index, 86 navIndex: index,
86 currentBottomNavName: navItem.name, 87 currentBottomNavName: navItem.name,
87 - barBackgroundColor: $barBackgroundColor,  
88 assignChannel: this.assignChannel, 88 assignChannel: this.assignChannel,
89 autoRefresh: this.autoRefresh 89 autoRefresh: this.autoRefresh
90 }) 90 })
@@ -99,8 +99,8 @@ export struct BottomNavigationComponent { @@ -99,8 +99,8 @@ export struct BottomNavigationComponent {
99 .animationDuration(0) 99 .animationDuration(0)
100 .barHeight($r('app.float.bottom_navigation_barHeight')) 100 .barHeight($r('app.float.bottom_navigation_barHeight'))
101 .barMode(BarMode.Fixed) 101 .barMode(BarMode.Fixed)
102 - // TODO:更详细的判断是视频频道  
103 .barBackgroundColor(this.barBackgroundColor) 102 .barBackgroundColor(this.barBackgroundColor)
  103 + // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域
104 .backgroundColor(this.barBackgroundColor) 104 .backgroundColor(this.barBackgroundColor)
105 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) 105 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
106 106
@@ -108,17 +108,6 @@ export struct BottomNavigationComponent { @@ -108,17 +108,6 @@ export struct BottomNavigationComponent {
108 108
109 } 109 }
110 110
111 - /**  
112 - * TODO:更详细的判断视频频道  
113 - */  
114 - getFontColor(index: number): Color {  
115 - if (this.currentNavIndex === 2 && this.barBackgroundColor === Color.Black) {  
116 - return Color.White  
117 - } else {  
118 - return this.currentNavIndex === index ? Color.Red : Color.Gray  
119 - }  
120 - }  
121 -  
122 @Builder 111 @Builder
123 tabBarBuilder(navItem: BottomNavDTO, index: number) { 112 tabBarBuilder(navItem: BottomNavDTO, index: number) {
124 Stack({ alignContent: Alignment.Bottom }) { 113 Stack({ alignContent: Alignment.Bottom }) {
@@ -126,37 +115,39 @@ export struct BottomNavigationComponent { @@ -126,37 +115,39 @@ export struct BottomNavigationComponent {
126 .height(CommonConstants.FULL_PARENT) 115 .height(CommonConstants.FULL_PARENT)
127 .padding({ bottom: 15, left: 10, right: 10, top: 2 }) 116 .padding({ bottom: 15, left: 10, right: 10, top: 2 })
128 .aspectRatio(this.ASPECT_RATIO_1_1) 117 .aspectRatio(this.ASPECT_RATIO_1_1)
  118 + .gesture(
  119 + TapGesture({ count: 2 })
  120 + .onAction((event: GestureEvent) => {
  121 + if (this.currentNavIndex === index) {
  122 + // 当前tab,双击事件
  123 + this.autoRefresh++
  124 + }
  125 + })
  126 + )
129 127
130 Text(navItem.name) 128 Text(navItem.name)
131 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) 129 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
132 .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal) 130 .fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal)
133 .textAlign(TextAlign.Center) 131 .textAlign(TextAlign.Center)
134 .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray) 132 .fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray)
135 - .fontColor(this.getFontColor(index)) 133 + .fontColor(this.currentNavIndex === index ? navItem.nameCColor : navItem.nameColor)
136 .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY) 134 .opacity(this.currentNavIndex === index ? this.FULL_OPACITY : this.SIXTY_OPACITY)
137 } 135 }
138 .height($r('app.float.bottom_navigation_barHeight')) 136 .height($r('app.float.bottom_navigation_barHeight'))
139 .hoverEffect(HoverEffect.Highlight) 137 .hoverEffect(HoverEffect.Highlight)
140 .onClick(() => { 138 .onClick(() => {
141 - if (this.currentNavIndex === index) {  
142 - // 当前tab,双击事件  
143 - this.doubleClick(() => {  
144 - Logger.info(TAG, 'tab double click ')  
145 - this.autoRefresh++  
146 - }) 139 + if (navItem.name === '我的') {
  140 + this.barBackgroundColor = Color.White
  141 + this.currentBottomNavInfo = {} as BottomNavDTO
147 } else { 142 } else {
148 - // 切换tab  
149 - this.currentNavIndex = index;  
150 - Logger.info(TAG, `onChange, index: ${index}`); 143 + this.currentBottomNavInfo = navItem
151 } 144 }
  145 +
  146 + this.currentNavIndex = index;
  147 + Logger.info(TAG, `onChange, index: ${index}`);
  148 +
152 }) 149 })
153 150
154 - // .justifyContent(FlexAlign.Center)  
155 - // .onClick(() => {  
156 - // Logger.info(TAG, `onClick, index: ${index}`);  
157 - // this.currentNavIndex = index ?? 0;  
158 - // this.navController.changeIndex(this.currentNavIndex);  
159 - // })  
160 } 151 }
161 152
162 // 底导切换函数 153 // 底导切换函数
@@ -199,17 +190,17 @@ export struct BottomNavigationComponent { @@ -199,17 +190,17 @@ export struct BottomNavigationComponent {
199 /** 190 /**
200 * 双击实现 191 * 双击实现
201 */ 192 */
202 - doubleClickTime: number = 0 193 + // doubleClickTime: number = 0
203 194
204 /** 195 /**
205 * 双击实现 196 * 双击实现
206 */ 197 */
207 - private doubleClick(fun: () => void) {  
208 - let now = DateTimeUtils.getTimeStamp()  
209 - if (now - this.doubleClickTime < 200) {  
210 - fun()  
211 - } else {  
212 - this.doubleClickTime = now  
213 - }  
214 - } 198 + // private doubleClick(fun: () => void) {
  199 + // let now = DateTimeUtils.getTimeStamp()
  200 + // if (now - this.doubleClickTime < 200) {
  201 + // fun()
  202 + // } else {
  203 + // this.doubleClickTime = now
  204 + // }
  205 + // }
215 } 206 }
@@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序' @@ -11,6 +11,7 @@ const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
11 const MORE_CHANNEL: string = '更多频道' 11 const MORE_CHANNEL: string = '更多频道'
12 const LOCAL_CHANNEL: string = '地方频道' 12 const LOCAL_CHANNEL: string = '地方频道'
13 13
  14 +const TAG: string = 'ChannelSubscriptionLayout'
14 15
15 @CustomDialog 16 @CustomDialog
16 struct ChannelDialog { 17 struct ChannelDialog {
1 -import { CompDTO, TopNavDTO } from 'wdBean'; 1 +import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
2 import { LazyDataSource, Logger } from 'wdKit'; 2 import { LazyDataSource, Logger } from 'wdKit';
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 import { PageComponent } from './PageComponent'; 4 import { PageComponent } from './PageComponent';
@@ -26,12 +26,14 @@ export struct TopNavigationComponent { @@ -26,12 +26,14 @@ export struct TopNavigationComponent {
26 @Consume isLayoutFullScreen: boolean 26 @Consume isLayoutFullScreen: boolean
27 @Consume bottomRectHeight: number 27 @Consume bottomRectHeight: number
28 @Consume topRectHeight: number 28 @Consume topRectHeight: number
  29 + @Consume @Watch('topOrBottomNavChange') currentBottomNavInfo: BottomNavDTO // 当前底导信息
  30 + @Consume barBackgroundColor: Color
29 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 31 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
30 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 32 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
31 - @Link barBackgroundColor: Color  
32 @Link _currentNavIndex?: number; 33 @Link _currentNavIndex?: number;
33 // 顶导当前选中/焦点下标 34 // 顶导当前选中/焦点下标
34 - @State currentTopNavSelectedIndex: number = 0; 35 + @State @Watch('topOrBottomNavChange') currentTopNavSelectedIndex: number = 0;
  36 + @State currentTopNavName: string = '';
35 // 顶导数据 37 // 顶导数据
36 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] 38 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
37 @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); 39 @State compList: LazyDataSource<CompDTO> = new LazyDataSource();
@@ -56,6 +58,21 @@ export struct TopNavigationComponent { @@ -56,6 +58,21 @@ export struct TopNavigationComponent {
56 // 当前底导index 58 // 当前底导index
57 @State navIndex: number = 0 59 @State navIndex: number = 0
58 60
  61 + topOrBottomNavChange() {
  62 + if (this.currentBottomNavName === this.currentBottomNavInfo?.name) {
  63 + this.setBarBackgroundColor()
  64 + }
  65 + }
  66 +
  67 + setBarBackgroundColor() {
  68 + console.error('setBarBackgroundColor', this.currentTopNavName, this.currentBottomNavInfo?.name)
  69 + if (this.currentTopNavName === '视频' && this.currentBottomNavInfo?.name === '视频') {
  70 + this.barBackgroundColor = Color.Black
  71 + } else {
  72 + this.barBackgroundColor = Color.White
  73 + }
  74 + }
  75 +
59 //处理新闻tab顶导频道数据 76 //处理新闻tab顶导频道数据
60 topNavListHandle() { 77 topNavListHandle() {
61 let _channelIds: number [] = [] 78 let _channelIds: number [] = []
@@ -126,10 +143,14 @@ export struct TopNavigationComponent { @@ -126,10 +143,14 @@ export struct TopNavigationComponent {
126 this.channelIds = _channelIds 143 this.channelIds = _channelIds
127 this.myChannelList = _myChannelList 144 this.myChannelList = _myChannelList
128 145
  146 + this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
  147 +
  148 +
129 //缓存首页频道 149 //缓存首页频道
130 let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId) 150 let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
131 if (index > -1) { 151 if (index > -1) {
132 this.currentTopNavSelectedIndex = index 152 this.currentTopNavSelectedIndex = index
  153 + this.currentTopNavName = this.myChannelList[index].name
133 } 154 }
134 } 155 }
135 156
@@ -196,7 +217,6 @@ export struct TopNavigationComponent { @@ -196,7 +217,6 @@ export struct TopNavigationComponent {
196 groupId: this.groupId + '', 217 groupId: this.groupId + '',
197 pageId: navItem.pageId + '', 218 pageId: navItem.pageId + '',
198 channelId: navItem.channelId + '', 219 channelId: navItem.channelId + '',
199 - barBackgroundColor: $barBackgroundColor  
200 }) 220 })
201 } else 221 } else
202 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { 222 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
@@ -216,9 +236,10 @@ export struct TopNavigationComponent { @@ -216,9 +236,10 @@ export struct TopNavigationComponent {
216 .barHeight($r('app.float.top_tab_bar_height')) 236 .barHeight($r('app.float.top_tab_bar_height'))
217 .barMode(BarMode.Scrollable) 237 .barMode(BarMode.Scrollable)
218 .vertical(false) 238 .vertical(false)
219 - // item.name === '视频' && this.currentTopNavSelectedIndex === 0 ?  
220 .barBackgroundColor(this.barBackgroundColor) 239 .barBackgroundColor(this.barBackgroundColor)
221 .onChange((index: number) => { 240 .onChange((index: number) => {
  241 + this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
  242 +
222 Logger.info(TAG, `onChange index : ${index}`); 243 Logger.info(TAG, `onChange index : ${index}`);
223 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 244 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
224 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 245 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
@@ -256,15 +277,11 @@ export struct TopNavigationComponent { @@ -256,15 +277,11 @@ export struct TopNavigationComponent {
256 } 277 }
257 278
258 /** 279 /**
259 - * TODO:更详细的判断视频频道 280 + * TODO:根据顶导配置获取颜色展示效果不对,待确认
260 */ 281 */
261 - getFontColor(item: TopNavDTO, index: number): Color | string {  
262 - if (this._currentNavIndex === 2) {  
263 - if (this.currentTopNavSelectedIndex == 0) {  
264 - return item.name === '视频' ? Color.White : '#e5e0e0'  
265 - } else {  
266 - return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999"  
267 - } 282 + getTopNavFontColor(item: TopNavDTO, index: number): Color | string {
  283 + if (item.name === '视频' && this.currentBottomNavInfo.name === '视频') {
  284 + return this.currentTopNavSelectedIndex === index ? Color.White : '#e5e0e0'
268 } else { 285 } else {
269 return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999" 286 return this.currentTopNavSelectedIndex === index ? Color.Black : "#999999"
270 } 287 }
@@ -276,9 +293,10 @@ export struct TopNavigationComponent { @@ -276,9 +293,10 @@ export struct TopNavigationComponent {
276 Text(item.name) 293 Text(item.name)
277 .fontSize($r('app.float.selected_text_size')) 294 .fontSize($r('app.float.selected_text_size'))
278 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) 295 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
279 - .fontColor(this.getFontColor(item, index))  
280 - .padding({ top: $r('app.float.top_tab_item_padding_top') , bottom: $r('app.float.top_tab_item_padding_bottom')}) 296 + .fontColor(this.getTopNavFontColor(item, index))
  297 + .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
281 .maxLines(this.MAX_LINE) 298 .maxLines(this.MAX_LINE)
  299 + // .backgroundImage(this.currentTopNavSelectedIndex === index ? item.iconCUrl : item.iconUrl)
282 if (this.currentTopNavSelectedIndex === index) { 300 if (this.currentTopNavSelectedIndex === index) {
283 Row() 301 Row()
284 .width(20) 302 .width(20)
@@ -292,18 +310,20 @@ export struct TopNavigationComponent { @@ -292,18 +310,20 @@ export struct TopNavigationComponent {
292 minWidth: $r('app.float.top_tab_item_min_width'), 310 minWidth: $r('app.float.top_tab_item_min_width'),
293 maxWidth: $r('app.float.top_tab_item_max_width') 311 maxWidth: $r('app.float.top_tab_item_max_width')
294 }) 312 })
295 - .backgroundColor(Color.Transparent) 313 + // .backgroundColor(Color.Transparent)
296 .padding({ 314 .padding({
297 left: $r('app.float.top_tab_item_padding_horizontal'), 315 left: $r('app.float.top_tab_item_padding_horizontal'),
298 right: $r('app.float.top_tab_item_padding_horizontal'), 316 right: $r('app.float.top_tab_item_padding_horizontal'),
299 }) 317 })
300 .id(`col_tabBar${index}`) 318 .id(`col_tabBar${index}`)
301 .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) 319 .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
  320 +
302 } 321 }
303 322
304 aboutToAppear() { 323 aboutToAppear() {
305 //处理新闻tab顶导频道数据 324 //处理新闻tab顶导频道数据
306 this.topNavListHandle() 325 this.topNavListHandle()
  326 + this.setBarBackgroundColor()
307 } 327 }
308 328
309 aboutToDisappear() { 329 aboutToDisappear() {
@@ -63,8 +63,4 @@ export struct SearchRelatedComponent { @@ -63,8 +63,4 @@ export struct SearchRelatedComponent {
63 .padding({ left: '31lpx', right: '31lpx' }) 63 .padding({ left: '31lpx', right: '31lpx' })
64 } 64 }
65 65
66 - test(){  
67 - let c = "12121212121"  
68 -  
69 - }  
70 } 66 }
@@ -36,7 +36,7 @@ export struct SearchResultComponent { @@ -36,7 +36,7 @@ export struct SearchResultComponent {
36 getSuggestData() { 36 getSuggestData() {
37 this.isLoading = true 37 this.isLoading = true
38 38
39 - let request: SearchSuggestRequestItem = new SearchSuggestRequestItem(2, "", "", HttpUrlUtils.getImei(), UserDataLocal.userId, 8, "") 39 + let request: SearchSuggestRequestItem = new SearchSuggestRequestItem(2, "", "", HttpUrlUtils.getImei(), UserDataLocal.getUserId(), 8, "")
40 40
41 SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => { 41 SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
42 value.forEach((item) => { 42 value.forEach((item) => {
@@ -9,7 +9,6 @@ export struct AboutPageUI { @@ -9,7 +9,6 @@ export struct AboutPageUI {
9 @State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议']; 9 @State listData: Array<string | Array<string>> = ['隐私授权协议', '软件许可及用户协议'];
10 @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.' 10 @State message: string = '京ICP备16066560号-6A Copyright © 人民日报客户端\nall rights reserved.'
11 @State version: string = '版本号:v' 11 @State version: string = '版本号:v'
12 - clickTimes: number = 0  
13 dialogController: CustomDialogController = new CustomDialogController({ 12 dialogController: CustomDialogController = new CustomDialogController({
14 builder: EnvironmentCustomDialog({ 13 builder: EnvironmentCustomDialog({
15 cancel: () => { 14 cancel: () => {
@@ -42,12 +41,12 @@ export struct AboutPageUI { @@ -42,12 +41,12 @@ export struct AboutPageUI {
42 .width('278lpx') 41 .width('278lpx')
43 .height('154lpx') 42 .height('154lpx')
44 .margin({ top: '173lpx', bottom: '154lpx' }) 43 .margin({ top: '173lpx', bottom: '154lpx' })
45 - .onClick(() => {  
46 - this.clickTimes++  
47 - if (this.clickTimes > 2) {  
48 - this.dialogController.open()  
49 - }  
50 - }) 44 + .gesture(
  45 + TapGesture({ count: 2 })
  46 + .onAction((event: GestureEvent) => {
  47 + this.dialogController.open()
  48 + })
  49 + )
51 // Row(){ 50 // Row(){
52 // 51 //
53 // }.backgroundColor(Color.Yellow) 52 // }.backgroundColor(Color.Yellow)
1 import { SPHelper } from 'wdKit/Index'; 1 import { SPHelper } from 'wdKit/Index';
2 -import { HttpUrlUtils } from 'wdNetwork/Index'; 2 +import { HostEnum, HostManager, HttpUrlUtils } from 'wdNetwork/Index';
3 3
4 @CustomDialog 4 @CustomDialog
5 export struct EnvironmentCustomDialog { 5 export struct EnvironmentCustomDialog {
6 - currentEnvironment: string = HttpUrlUtils.HOST_PRODUCT; 6 + @State currentEnvironment: string = HostManager.getHost();
7 controller: CustomDialogController 7 controller: CustomDialogController
8 cancel: () => void = () => { 8 cancel: () => void = () => {
9 } 9 }
@@ -21,12 +21,12 @@ export struct EnvironmentCustomDialog { @@ -21,12 +21,12 @@ export struct EnvironmentCustomDialog {
21 .margin({ top: 20 }) 21 .margin({ top: 20 })
22 Row() { 22 Row() {
23 Radio({ value: 'Radio1', group: 'radioGroup' }) 23 Radio({ value: 'Radio1', group: 'radioGroup' })
24 - .checked(true) 24 + .checked(this.currentEnvironment == HostEnum.HOST_SIT)
25 .height(20) 25 .height(20)
26 .width(20) 26 .width(20)
27 .onChange((isChecked: boolean) => { 27 .onChange((isChecked: boolean) => {
28 if (isChecked) { 28 if (isChecked) {
29 - this.currentEnvironment = HttpUrlUtils.HOST_SIT; 29 + this.currentEnvironment = HostEnum.HOST_SIT;
30 } 30 }
31 }) 31 })
32 Text('切换到SIT(测试)环境,重启应用生效') 32 Text('切换到SIT(测试)环境,重启应用生效')
@@ -37,12 +37,12 @@ export struct EnvironmentCustomDialog { @@ -37,12 +37,12 @@ export struct EnvironmentCustomDialog {
37 37
38 Row() { 38 Row() {
39 Radio({ value: 'Radio1', group: 'radioGroup' }) 39 Radio({ value: 'Radio1', group: 'radioGroup' })
40 - .checked(true) 40 + .checked(this.currentEnvironment == HostEnum.HOST_UAT)
41 .height(20) 41 .height(20)
42 .width(20) 42 .width(20)
43 .onChange((isChecked: boolean) => { 43 .onChange((isChecked: boolean) => {
44 if (isChecked) { 44 if (isChecked) {
45 - this.currentEnvironment = HttpUrlUtils.HOST_UAT; 45 + this.currentEnvironment = HostEnum.HOST_UAT;
46 } 46 }
47 }) 47 })
48 Text('切换到UAT(预发布)环境,重启应用生效') 48 Text('切换到UAT(预发布)环境,重启应用生效')
@@ -53,12 +53,12 @@ export struct EnvironmentCustomDialog { @@ -53,12 +53,12 @@ export struct EnvironmentCustomDialog {
53 53
54 Row() { 54 Row() {
55 Radio({ value: 'Radio1', group: 'radioGroup' }) 55 Radio({ value: 'Radio1', group: 'radioGroup' })
56 - .checked(true) 56 + .checked(this.currentEnvironment == HostEnum.HOST_PRODUCT)
57 .height(20) 57 .height(20)
58 .width(20) 58 .width(20)
59 .onChange((isChecked: boolean) => { 59 .onChange((isChecked: boolean) => {
60 if (isChecked) { 60 if (isChecked) {
61 - this.currentEnvironment = HttpUrlUtils.HOST_PRODUCT; 61 + this.currentEnvironment = HostEnum.HOST_PRODUCT;
62 } 62 }
63 }) 63 })
64 Text('切换到PROD(现网)环境,重启应用生效') 64 Text('切换到PROD(现网)环境,重启应用生效')
@@ -69,12 +69,12 @@ export struct EnvironmentCustomDialog { @@ -69,12 +69,12 @@ export struct EnvironmentCustomDialog {
69 69
70 Row() { 70 Row() {
71 Radio({ value: 'Radio1', group: 'radioGroup' }) 71 Radio({ value: 'Radio1', group: 'radioGroup' })
72 - .checked(true) 72 + .checked(this.currentEnvironment == HostEnum.HOST_DEV)
73 .height(20) 73 .height(20)
74 .width(20) 74 .width(20)
75 .onChange((isChecked: boolean) => { 75 .onChange((isChecked: boolean) => {
76 if (isChecked) { 76 if (isChecked) {
77 - this.currentEnvironment = HttpUrlUtils.HOST_DEV; 77 + this.currentEnvironment = HostEnum.HOST_DEV;
78 } 78 }
79 }) 79 })
80 Text('切换到DEV(开发)环境,重启应用生效') 80 Text('切换到DEV(开发)环境,重启应用生效')
@@ -29,7 +29,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { @@ -29,7 +29,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
29 .width(14) 29 .width(14)
30 .height(14) 30 .height(14)
31 } 31 }
32 - .visibility(this.compDTO?.objectType === '0' ? Visibility.None : Visibility.Visible) 32 + .visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
33 .onClick(() => { 33 .onClick(() => {
34 if (this.compDTO?.objectType === '11') { 34 if (this.compDTO?.objectType === '11') {
35 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string) 35 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
1 import { Logger } from 'wdKit/Index' 1 import { Logger } from 'wdKit/Index'
2 import { LikeViewModel } from '../../viewmodel/LikeViewModel' 2 import { LikeViewModel } from '../../viewmodel/LikeViewModel'
  3 +import { SPHelper } from 'wdKit';
  4 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  5 +import { SpConstants } from 'wdConstant/Index';
  6 +
3 7
4 const TAG = 'LikeComponent'; 8 const TAG = 'LikeComponent';
5 9
@@ -9,6 +13,8 @@ export struct LikeComponent { @@ -9,6 +13,8 @@ export struct LikeComponent {
9 viewModel: LikeViewModel = new LikeViewModel() 13 viewModel: LikeViewModel = new LikeViewModel()
10 @Prop data: Record<string, string> 14 @Prop data: Record<string, string>
11 enableBtn = true 15 enableBtn = true
  16 + componentType : number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式
  17 + @State likeCount: number = 0 //点赞数
12 18
13 //上层传值 样例 19 //上层传值 样例
14 // this.data['contentId'] = '30035444649' //必须 20 // this.data['contentId'] = '30035444649' //必须
@@ -23,34 +29,100 @@ export struct LikeComponent { @@ -23,34 +29,100 @@ export struct LikeComponent {
23 if (this.data) { 29 if (this.data) {
24 //获取点赞状态 30 //获取点赞状态
25 this.getLikeStatus() 31 this.getLikeStatus()
  32 + //获取点赞数
  33 + this.getLikeCount()
26 } 34 }
27 35
28 } 36 }
29 37
30 build() { 38 build() {
31 - Column() {  
32 - Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))  
33 - .width(24)  
34 - .height(24)  
35 - .onClick(() => {  
36 - if (!this.enableBtn) {  
37 - return  
38 - }  
39 - if (this.likeStatus) {  
40 - //1  
41 - this.executeLike('0')  
42 - } else {  
43 - //0  
44 - this.executeLike('1') 39 + if (this.componentType == 2){
  40 + //2: 新闻页中间位置样式
  41 + Column() {
  42 +
  43 + Button(){
  44 +
  45 + Row(){
  46 + Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
  47 + .width(20)
  48 + .height(20)
  49 + Text(this.likeCount.toString())
  50 + .height(20)
  51 + .margin({
  52 + right: 0,
  53 + left: 4
  54 + })
  55 + .fontColor(this.likeStatus ? '#ED2800' : '#222222')
  56 + .fontSize('16')
45 } 57 }
  58 + .justifyContent(FlexAlign.Center)
  59 + .width('100%')
  60 + .height('100%')
  61 +
  62 + }
  63 + .width('100%')
  64 + .height('100%')
  65 + .backgroundColor(Color.White)
  66 + .type(ButtonType.Capsule)
  67 + .borderColor('#EDEDED')
  68 + .borderRadius(20)
  69 + .borderWidth(1)
  70 + .onClick(()=>{
  71 +
  72 + this.clickButtonEvent()
  73 +
46 }) 74 })
47 - }.width(24).height(24) 75 +
  76 + }
  77 + .width(154)
  78 + .height(40)
  79 +
  80 +
  81 + }else {
  82 + //1: 底部栏目样式 默认样式
  83 + Column() {
  84 + Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
  85 + .width(24)
  86 + .height(24)
  87 + .onClick(() => {
  88 + this.clickButtonEvent()
  89 + })
  90 + }.width(24).height(24)
  91 + }
  92 +
  93 + }
  94 +
  95 + async clickButtonEvent(){
  96 + // 未登录,跳转登录
  97 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  98 + if (!user_id) {
  99 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  100 + return
  101 + }
  102 +
  103 + if (!this.enableBtn) {
  104 + return
  105 + }
  106 + if (this.likeStatus) {
  107 + //1
  108 + this.executeLike('0')
  109 + } else {
  110 + //0
  111 + this.executeLike('1')
  112 + }
  113 +
48 } 114 }
49 115
50 executeLike(status: string) { 116 executeLike(status: string) {
51 this.data['status'] = status 117 this.data['status'] = status
52 this.viewModel.executeLike2(this.data).then(() => { 118 this.viewModel.executeLike2(this.data).then(() => {
53 this.likeStatus = !this.likeStatus 119 this.likeStatus = !this.likeStatus
  120 + //点赞和取消点赞成功后更新点赞数
  121 + if(this.likeStatus){
  122 + this.likeCount ++
  123 + }else {
  124 + this.likeCount --
  125 + }
54 this.enableBtn = true 126 this.enableBtn = true
55 }).catch(() => { 127 }).catch(() => {
56 this.enableBtn = true 128 this.enableBtn = true
@@ -69,5 +141,19 @@ export struct LikeComponent { @@ -69,5 +141,19 @@ export struct LikeComponent {
69 }) 141 })
70 } 142 }
71 143
  144 + //获取点赞数
  145 + getLikeCount() {
  146 + this.viewModel.getLikeCount(this.data).then((data) => {
  147 + if (data && data['data']) {
  148 + this.likeCount = data['data']['likeNum']
  149 + }else {
  150 + this.likeCount = 0
  151 + }
  152 + }).catch(() => {
  153 + this.likeCount = 0
  154 + })
  155 + }
  156 +
  157 +
72 158
73 } 159 }
@@ -13,6 +13,10 @@ import router from '@ohos.router'; @@ -13,6 +13,10 @@ import router from '@ohos.router';
13 import inputMethod from '@ohos.inputMethod'; 13 import inputMethod from '@ohos.inputMethod';
14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'; 14 import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
15 import { LikeComponent } from './LikeComponent'; 15 import { LikeComponent } from './LikeComponent';
  16 +import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
  17 +import { publishCommentModel } from '../comment/model/PublishCommentModel'
  18 +
  19 +// import { CommentCustomDialog } from '../comment/view/CommentCustomDialog';
16 import { HttpUrlUtils } from 'wdNetwork/Index'; 20 import { HttpUrlUtils } from 'wdNetwork/Index';
17 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 21 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
18 import { PageRepository } from '../../repository/PageRepository'; 22 import { PageRepository } from '../../repository/PageRepository';
@@ -27,14 +31,17 @@ export interface OperationItem { @@ -27,14 +31,17 @@ export interface OperationItem {
27 31
28 const TAG = 'OperRowListView'; 32 const TAG = 'OperRowListView';
29 33
30 -@Preview 34 +// @Preview
  35 +@Entry
31 @Component 36 @Component
32 export struct OperRowListView { 37 export struct OperRowListView {
33 // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 38 // private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
34 - @Prop contentDetailData: ContentDetailDTO 39 + // @Prop contentDetailData: ContentDetailDTO
  40 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
35 @State interactData: InteractDataDTO = {} as InteractDataDTO 41 @State interactData: InteractDataDTO = {} as InteractDataDTO
36 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 42 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
37 @State likeBean: Record<string, string> = {} 43 @State likeBean: Record<string, string> = {}
  44 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
38 45
39 @State operationList: OperationItem[] = [ 46 @State operationList: OperationItem[] = [
40 { 47 {
@@ -71,19 +78,30 @@ export struct OperRowListView { @@ -71,19 +78,30 @@ export struct OperRowListView {
71 // this.data['channelId'] = "2059" //必须 78 // this.data['channelId'] = "2059" //必须
72 // this.data['status'] = "1" //必须 79 // this.data['status'] = "1" //必须
73 this.likeBean['contentId'] = this.contentDetailData.newsId + '' 80 this.likeBean['contentId'] = this.contentDetailData.newsId + ''
74 - this.likeBean['userName'] = this.contentDetailData.editorName + '' 81 + this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
75 this.likeBean['contentType'] = this.contentDetailData.newsType + '' 82 this.likeBean['contentType'] = this.contentDetailData.newsType + ''
76 this.likeBean['title'] = this.contentDetailData.newsTitle + '' 83 this.likeBean['title'] = this.contentDetailData.newsTitle + ''
77 - this.likeBean['userHeaderUrl'] = '' 84 + this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
78 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' 85 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
79 - this.likeBean['status'] = '' 86 + console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
  87 + console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
  88 + // 评论需要数据
  89 + this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
  90 + this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
  91 + this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
  92 + this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
  93 + this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
  94 + this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
  95 + this.publishCommentModel.targetType = this.contentDetailData.newsType + ''
  96 + this.publishCommentModel.totalCommentNumer = '10'
80 } 97 }
81 98
82 build() { 99 build() {
83 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems:ItemAlign.Center }){ 100 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems:ItemAlign.Center }){
84 Row() { 101 Row() {
85 Column() { 102 Column() {
86 - Image($r('app.media.icon_arrow_left_white')) 103 + // Image($r('app.media.icon_arrow_left_white'))
  104 + Image($r('app.media.icon_arrow_left'))
87 .width(24) 105 .width(24)
88 .height(24) 106 .height(24)
89 .aspectRatio(1) 107 .aspectRatio(1)
@@ -100,7 +118,17 @@ export struct OperRowListView { @@ -100,7 +118,17 @@ export struct OperRowListView {
100 .onClick(() => { 118 .onClick(() => {
101 router.back(); 119 router.back();
102 }) 120 })
103 - TextInput({placeholder:'说两句11...'}) 121 + Column() {
  122 + /*评论组件*/
  123 + /* CommentCustomDialog({
  124 + placeHolderText: '说两句'
  125 + })*/
  126 + if (this.publishCommentModel?.targetId) {
  127 + CommentTabComponent({publishCommentModel: this.publishCommentModel})
  128 + CommentIconComponent({publishCommentModel: this.publishCommentModel})
  129 + }
  130 + }
  131 + /*TextInput({placeholder:'说两句...'})
104 .placeholderColor('#999999') 132 .placeholderColor('#999999')
105 .placeholderFont( 133 .placeholderFont(
106 { 134 {
@@ -116,9 +144,9 @@ export struct OperRowListView { @@ -116,9 +144,9 @@ export struct OperRowListView {
116 .borderRadius(0) 144 .borderRadius(0)
117 .onClick(() => { 145 .onClick(() => {
118 this.buildInputMethod() 146 this.buildInputMethod()
119 - }) 147 + })*/
120 } 148 }
121 - .width('45.5%') 149 + // .width('45.5%')
122 .alignItems(VerticalAlign.Center) 150 .alignItems(VerticalAlign.Center)
123 .justifyContent(FlexAlign.Start) 151 .justifyContent(FlexAlign.Start)
124 Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) { 152 Flex({ justifyContent: FlexAlign.SpaceAround, alignItems:ItemAlign.Center }) {
@@ -129,8 +157,12 @@ export struct OperRowListView { @@ -129,8 +157,12 @@ export struct OperRowListView {
129 .width('54.5%') 157 .width('54.5%')
130 } 158 }
131 .width('100%') 159 .width('100%')
132 - .height(126)  
133 - .backgroundColor(Color.Black) 160 + .height(50)
  161 + // .backgroundColor(Color.Black)
  162 + .backgroundColor(Color.White)
  163 + .margin({
  164 + bottom: 20
  165 + })
134 } 166 }
135 /** 167 /**
136 * 组件项 168 * 组件项
@@ -141,9 +173,12 @@ export struct OperRowListView { @@ -141,9 +173,12 @@ export struct OperRowListView {
141 buildOperationItem(item: OperationItem, index: number) { 173 buildOperationItem(item: OperationItem, index: number) {
142 Column() { 174 Column() {
143 if (item.text === '点赞') { 175 if (item.text === '点赞') {
144 - LikeComponent({  
145 - data: this.likeBean  
146 - }) 176 + /*点赞组件*/
  177 + if (this.likeBean?.contentId) {
  178 + LikeComponent({
  179 + data: this.likeBean
  180 + })
  181 + }
147 182
148 /* RelativeContainer() { 183 /* RelativeContainer() {
149 Row() { 184 Row() {
@@ -191,6 +226,7 @@ export struct OperRowListView { @@ -191,6 +226,7 @@ export struct OperRowListView {
191 } 226 }
192 .id(`e_icon_${index}`)*/ 227 .id(`e_icon_${index}`)*/
193 } else if (item.text === '收藏') { 228 } else if (item.text === '收藏') {
  229 +
194 RelativeContainer() { 230 RelativeContainer() {
195 Row() { 231 Row() {
196 Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon) 232 Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)
@@ -236,7 +272,7 @@ export struct OperRowListView { @@ -236,7 +272,7 @@ export struct OperRowListView {
236 } 272 }
237 .id(`e_icon_${index}`) 273 .id(`e_icon_${index}`)
238 } else if (item.text === '评论') { 274 } else if (item.text === '评论') {
239 - RelativeContainer() { 275 + /* RelativeContainer() {
240 Row() { 276 Row() {
241 Image(item.icon) 277 Image(item.icon)
242 .width(24) 278 .width(24)
@@ -279,7 +315,7 @@ export struct OperRowListView { @@ -279,7 +315,7 @@ export struct OperRowListView {
279 .id(`e_row3_${index}`) 315 .id(`e_row3_${index}`)
280 } 316 }
281 } 317 }
282 - .id(`e_icon_${index}`) 318 + .id(`e_icon_${index}`)*/
283 } else { 319 } else {
284 RelativeContainer() { 320 RelativeContainer() {
285 Row() { 321 Row() {
@@ -43,5 +43,27 @@ export class LikeModel { @@ -43,5 +43,27 @@ export class LikeModel {
43 43
44 44
45 45
  46 + getLikeCount(data: Record<string, string>) {
  47 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  48 + let channelId : string = data['channelId']
  49 + let contentId : string = data['contentId']
  50 + let contentType : string = data['contentType']
  51 + let detail : string = '1'
  52 + let url = HttpUrlUtils.getLikeCount() + `?channelId=${channelId}&contentId=${contentId}&contentType=${contentType}&detail=${detail}`
  53 + return new Promise<object>((success, fail) => {
  54 + HttpBizUtil.get<ResponseDTO<object>>(url, headers).then((data: ResponseDTO<object>) => {
  55 + if (data.code != 0) {
  56 + fail(data.message)
  57 + return
  58 + }
  59 + success(data)
  60 + }, (error: Error) => {
  61 + fail(error.message)
  62 + Logger.debug("LoginViewModel:error ", error.toString())
  63 + })
  64 + })
  65 + }
  66 +
  67 +
46 68
47 } 69 }
1 import HashMap from '@ohos.util.HashMap'; 1 import HashMap from '@ohos.util.HashMap';
2 -import { UserDataLocal } from 'wdKit/Index';  
3 -import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';  
4 -import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 2 +import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';
5 3
6 export class LogoutModel{ 4 export class LogoutModel{
7 5
8 requestLogout(){ 6 requestLogout(){
9 let bean: Record<string, string> = {}; 7 let bean: Record<string, string> = {};
10 - bean['refreshToken'] = UserDataLocal.USER_REFRESH_TOKEN  
11 - bean['refreshToken'] = 'ddrqreeee' 8 + bean['refreshToken'] = HttpUrlUtils.getRefreshToken()
12 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 9 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
13 return new Promise<string>((success, fail) => { 10 return new Promise<string>((success, fail) => {
14 - HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => { 11 + HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
15 if (!data) { 12 if (!data) {
16 fail("数据为空") 13 fail("数据为空")
17 return 14 return
@@ -23,7 +20,6 @@ export class LogoutModel{ @@ -23,7 +20,6 @@ export class LogoutModel{
23 success(data.message) 20 success(data.message)
24 }, (error: Error) => { 21 }, (error: Error) => {
25 fail(error.message) 22 fail(error.message)
26 - // Logger.debug("LoginViewModel:error ", error.toString())  
27 }) 23 })
28 }) 24 })
29 } 25 }
@@ -19,7 +19,7 @@ const TAG = "SearcherAboutDataModel" @@ -19,7 +19,7 @@ const TAG = "SearcherAboutDataModel"
19 class SearcherAboutDataModel{ 19 class SearcherAboutDataModel{
20 private static instance: SearcherAboutDataModel; 20 private static instance: SearcherAboutDataModel;
21 public searchHistoryData:SearchHistoryItem[] = [] 21 public searchHistoryData:SearchHistoryItem[] = []
22 - public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" + UserDataLocal.userId 22 + public SEARCH_HISTORY_KEY:string = "SEARCH_HISTORY_KEY" + UserDataLocal.getUserId()
23 23
24 private constructor() { } 24 private constructor() { }
25 25
@@ -29,13 +29,11 @@ struct MineHomePage { @@ -29,13 +29,11 @@ struct MineHomePage {
29 registTime:number = 0//账号注册时间 29 registTime:number = 0//账号注册时间
30 @State registerTimeForDay:number = 0 30 @State registerTimeForDay:number = 0
31 31
32 - aboutToAppear(){ 32 + onPageShow(): void {
33 this.getUserInfo() 33 this.getUserInfo()
34 this.getUserLevel() 34 this.getUserLevel()
35 } 35 }
36 36
37 -  
38 -  
39 build() { 37 build() {
40 Stack({ alignContent: Alignment.Top }){ 38 Stack({ alignContent: Alignment.Top }){
41 Image($r('app.media.title_bg')) 39 Image($r('app.media.title_bg'))
@@ -65,9 +63,8 @@ struct MineHomePage { @@ -65,9 +63,8 @@ struct MineHomePage {
65 .height('130lpx') 63 .height('130lpx')
66 .objectFit(ImageFit.Cover) 64 .objectFit(ImageFit.Cover)
67 }.onClick(()=>{ 65 }.onClick(()=>{
68 - //TODO 显示头像  
69 - let params = {'userId': "531267787833221"} as Record<string, string>;  
70 - WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) 66 + let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>;
  67 + WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
71 }).width('135lpx') 68 }).width('135lpx')
72 .height('135lpx') 69 .height('135lpx')
73 70
@@ -370,6 +367,9 @@ struct MineHomePage { @@ -370,6 +367,9 @@ struct MineHomePage {
370 if(StringUtils.isNotEmpty(value.introduction)){ 367 if(StringUtils.isNotEmpty(value.introduction)){
371 this.desc = value.introduction 368 this.desc = value.introduction
372 this.isHasIntroduction = true 369 this.isHasIntroduction = true
  370 + }else{
  371 + this.desc = "点击添加简介,让大家认识你"
  372 + this.isHasIntroduction = false
373 } 373 }
374 this.browseNum = value.browseNum 374 this.browseNum = value.browseNum
375 this.commentNum = value.commentNum 375 this.commentNum = value.commentNum