Showing
38 changed files
with
818 additions
and
545 deletions
| @@ -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 HashMap from '@ohos.util.HashMap'; | ||
| 2 | +import { SpConstants } from 'wdConstant'; | ||
| 3 | +import { SPHelper, StringUtils } from 'wdKit'; | ||
| 4 | +import { HostEnum, HostManager } from './HttpHostManager'; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 网络请求参数工具类 | ||
| 8 | + */ | ||
| 9 | +export class HttpParams { | ||
| 10 | + private static userId = '' | ||
| 11 | + private static userType = '' | ||
| 12 | + private static token = '' | ||
| 13 | + | ||
| 14 | + static getCommonHeaders(): HashMap<string, string> { | ||
| 15 | + let headers: HashMap<string, string> = new HashMap<string, string>() | ||
| 16 | + headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)') | ||
| 17 | + headers.set('channel', HttpParams.getChannel()) | ||
| 18 | + //headers.set('appCode', ConfigConstants.appCode) | ||
| 19 | + headers.set('plat', HttpParams.getPlat()) | ||
| 20 | + //headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a') | ||
| 21 | + headers.set('Content-Type', 'application/json; charset=utf-8') | ||
| 22 | + headers.set('timestamp', HttpParams.getTimestamp()) | ||
| 23 | + headers.set('RMRB-X-TOKEN', HttpParams.getXToken()) | ||
| 24 | + headers.set('device_id', HttpParams.getDeviceId()) | ||
| 25 | + if (HttpParams.getXToken() != '') { | ||
| 26 | + headers.set('cookie', 'RMRB-X-TOKEN=' + HttpParams.getXToken()) | ||
| 27 | + } | ||
| 28 | + headers.set('build_version', HttpParams.getVersion()) | ||
| 29 | + headers.set('adcode', HttpParams.getAdCode()) | ||
| 30 | + headers.set('os_version', HttpParams.getOsVersion()) | ||
| 31 | + //headers.set('X-Ca-Stage', 'PRE') | ||
| 32 | + headers.set('versionCode', HttpParams.getVersionCode()) | ||
| 33 | + headers.set('system', HttpParams.getTerminalId()) | ||
| 34 | + headers.set('version_name', HttpParams.getVersionName()) | ||
| 35 | + headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A') | ||
| 36 | + headers.set('imei', HttpParams.getImei()) | ||
| 37 | + headers.set('Accept-Language', 'zh') | ||
| 38 | + HttpParams.setLocationHeader(headers) | ||
| 39 | + // TODO 判断是否登录 | ||
| 40 | + headers.set('userId', HttpParams.getUserId()) | ||
| 41 | + headers.set('userType', HttpParams.getUserType()) | ||
| 42 | + | ||
| 43 | + headers.set('mpassid', 'ZbHTMeTsfaYDAHqt8ZHIzcPs') | ||
| 44 | + HttpParams.addSpecialHeaders(headers); | ||
| 45 | + // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** '); | ||
| 46 | + // headers.forEach((v,k)=>{ | ||
| 47 | + // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v); | ||
| 48 | + // }) | ||
| 49 | + // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** '); | ||
| 50 | + return headers; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + static addSpecialHeaders(headers: HashMap<string, string>) { | ||
| 54 | + switch (HostManager.getHost()) { | ||
| 55 | + case HostEnum.HOST_UAT: | ||
| 56 | + // TODO 待优化到常量类里 | ||
| 57 | + headers.set('X-Ca-Stage', 'PRE'); | ||
| 58 | + headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a'); | ||
| 59 | + headers.set('appCode', '83092caa603a421aa0222308b3f6b27a'); | ||
| 60 | + break | ||
| 61 | + case HostEnum.HOST_SIT: | ||
| 62 | + headers.set('X-Ca-Stage', 'TEST'); | ||
| 63 | + headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07'); | ||
| 64 | + headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07'); | ||
| 65 | + break | ||
| 66 | + case HostEnum.HOST_PRODUCT: | ||
| 67 | + headers.set('X-Ca-Stage', 'RELEASE'); | ||
| 68 | + headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'); | ||
| 69 | + headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6'); | ||
| 70 | + break | ||
| 71 | + case HostEnum.HOST_DEV: | ||
| 72 | + headers.set('X-Ca-Stage', 'TEST'); | ||
| 73 | + headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9'); | ||
| 74 | + headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9'); | ||
| 75 | + break | ||
| 76 | + default: | ||
| 77 | + break | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + static setLocationHeader(headers: HashMap<string, string>) { | ||
| 82 | + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 83 | + if (StringUtils.isNotEmpty(cityName)) { | ||
| 84 | + headers.set('city', encodeURI(cityName)) | ||
| 85 | + } | ||
| 86 | + let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string | ||
| 87 | + if (StringUtils.isNotEmpty(cityCode)) { | ||
| 88 | + headers.set('city_dode', encodeURI(cityCode)) | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + private static getCity() { | ||
| 93 | + // TODO 对接定位 | ||
| 94 | + return '%E5%90%88%E8%82%A5%E5%B8%82'; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + private static getChannel() { | ||
| 98 | + // TODO 对接配置 | ||
| 99 | + return 'rmrb_china_0000'; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + private static getPlat() { | ||
| 103 | + return 'Phone'; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + private static getTimestamp() { | ||
| 107 | + // return DateTimeUtils.getCurrentTime() + ''; | ||
| 108 | + // TODO 暂时写死,有些page 真实时间戳 返回数据为空 | ||
| 109 | + return '155203523'; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + private static getXToken() { | ||
| 113 | + if (StringUtils.isNotEmpty(HttpParams.token)) { | ||
| 114 | + return HttpParams.token | ||
| 115 | + } | ||
| 116 | + HttpParams.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string | ||
| 117 | + if (StringUtils.isNotEmpty(HttpParams.token)) { | ||
| 118 | + return HttpParams.token | ||
| 119 | + } | ||
| 120 | + // return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; | ||
| 121 | + return '' | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + static getRefreshToken(): string { | ||
| 125 | + let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "") | ||
| 126 | + if (StringUtils.isNotEmpty(refreshToken)) { | ||
| 127 | + return refreshToken as string; | ||
| 128 | + } | ||
| 129 | + return ''; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public static getDeviceId() { | ||
| 133 | + // TODO | ||
| 134 | + return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + private static getVersion() { | ||
| 138 | + // TODO | ||
| 139 | + return '202401242103'; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + private static getVersionCode() { | ||
| 143 | + // TODO | ||
| 144 | + return '7301'; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + private static getVersionName() { | ||
| 148 | + // TODO | ||
| 149 | + return '7.3.0.1'; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + private static getAdCode() { | ||
| 153 | + return '340000'; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + private static getOsVersion() { | ||
| 157 | + // TODO | ||
| 158 | + return '12'; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public static getCityCode() { | ||
| 162 | + // TODO | ||
| 163 | + return '340100'; | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + public static getProvinceCode() { | ||
| 167 | + // TODO | ||
| 168 | + return '340000'; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * 地区code | ||
| 173 | + */ | ||
| 174 | + public static getDistrictCode() { | ||
| 175 | + // TODO | ||
| 176 | + return '340103'; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + private static getTerminalId() { | ||
| 180 | + return 'Android'; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public static getImei() { | ||
| 184 | + // TODO | ||
| 185 | + return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public static getUserId(): string { | ||
| 189 | + // TODO 对接登录 | ||
| 190 | + if (StringUtils.isNotEmpty(HttpParams.userId)) { | ||
| 191 | + return HttpParams.userId | ||
| 192 | + } | ||
| 193 | + HttpParams.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 194 | + return HttpParams.userId; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public static getUserType() { | ||
| 198 | + if (StringUtils.isNotEmpty(HttpParams.userType)) { | ||
| 199 | + return HttpParams.userType | ||
| 200 | + } | ||
| 201 | + HttpParams.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string | ||
| 202 | + return HttpParams.userType; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + public static setUserId(userId: string) { | ||
| 206 | + HttpParams.userId = userId; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + public static setUserType(userType: string) { | ||
| 210 | + HttpParams.userType = userType; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + public static setUserToken(token: string) { | ||
| 214 | + HttpParams.token = token; | ||
| 215 | + } | ||
| 216 | +} |
| 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 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 |
| @@ -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 | }; |
| @@ -99,6 +99,7 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -99,6 +99,7 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 99 | case '3': | 99 | case '3': |
| 100 | let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}") | 100 | let imgListData: IImgListData = JSON.parse(data?.data?.imgListData || "{}") |
| 101 | let imgArr = imgListData?.imgArr || [] | 101 | let imgArr = imgListData?.imgArr || [] |
| 102 | + let swiperIndex = imgListData?.imgIndex | ||
| 102 | if (imgArr.length > 0) { | 103 | if (imgArr.length > 0) { |
| 103 | const photoList: PhotoListBean[] = imgArr.map(item => { | 104 | const photoList: PhotoListBean[] = imgArr.map(item => { |
| 104 | const photo: PhotoListBean = { | 105 | const photo: PhotoListBean = { |
| @@ -109,7 +110,7 @@ function handleJsCallReceiveH5Data(data: Message) { | @@ -109,7 +110,7 @@ function handleJsCallReceiveH5Data(data: Message) { | ||
| 109 | } | 110 | } |
| 110 | return photo | 111 | return photo |
| 111 | }) | 112 | }) |
| 112 | - ProcessUtils.gotoMultiPictureListPage(photoList) | 113 | + ProcessUtils.gotoMultiPictureListPage(photoList,swiperIndex) |
| 113 | } | 114 | } |
| 114 | break; | 115 | break; |
| 115 | case '5': | 116 | case '5': |
| @@ -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 | } |
| @@ -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" |
| @@ -211,7 +211,7 @@ export struct DynamicDetailComponent { | @@ -211,7 +211,7 @@ export struct DynamicDetailComponent { | ||
| 211 | } | 211 | } |
| 212 | } | 212 | } |
| 213 | .onClick((event: ClickEvent) => { | 213 | .onClick((event: ClickEvent) => { |
| 214 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | 214 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) |
| 215 | }) | 215 | }) |
| 216 | } else { | 216 | } else { |
| 217 | GridCol({ | 217 | GridCol({ |
| @@ -228,7 +228,7 @@ export struct DynamicDetailComponent { | @@ -228,7 +228,7 @@ export struct DynamicDetailComponent { | ||
| 228 | }) | 228 | }) |
| 229 | } | 229 | } |
| 230 | .onClick((event: ClickEvent) => { | 230 | .onClick((event: ClickEvent) => { |
| 231 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | 231 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) |
| 232 | }) | 232 | }) |
| 233 | } | 233 | } |
| 234 | } else if (this.contentDetailData.photoList.length === 4) { | 234 | } else if (this.contentDetailData.photoList.length === 4) { |
| @@ -240,7 +240,7 @@ export struct DynamicDetailComponent { | @@ -240,7 +240,7 @@ export struct DynamicDetailComponent { | ||
| 240 | .borderRadius(this.caclImageRadius(index)) | 240 | .borderRadius(this.caclImageRadius(index)) |
| 241 | } | 241 | } |
| 242 | .onClick((event: ClickEvent) => { | 242 | .onClick((event: ClickEvent) => { |
| 243 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | 243 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) |
| 244 | }) | 244 | }) |
| 245 | } else { | 245 | } else { |
| 246 | GridCol({ | 246 | GridCol({ |
| @@ -251,7 +251,7 @@ export struct DynamicDetailComponent { | @@ -251,7 +251,7 @@ export struct DynamicDetailComponent { | ||
| 251 | .borderRadius(this.caclImageRadius(index)) | 251 | .borderRadius(this.caclImageRadius(index)) |
| 252 | } | 252 | } |
| 253 | .onClick((event: ClickEvent) => { | 253 | .onClick((event: ClickEvent) => { |
| 254 | - ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | 254 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index) |
| 255 | }) | 255 | }) |
| 256 | } | 256 | } |
| 257 | }) | 257 | }) |
| @@ -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(); |
sight_harmony/features/wdComponent/src/main/ets/components/ImageSwiperComponent.ets
deleted
100644 → 0
| 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 | -} |
| @@ -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 | } |
| @@ -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 | } |
| @@ -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(开发)环境,重启应用生效') |
| 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 | } |
| @@ -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 | } |
| @@ -7,7 +7,7 @@ export class LogoutModel{ | @@ -7,7 +7,7 @@ export class LogoutModel{ | ||
| 7 | 7 | ||
| 8 | requestLogout(){ | 8 | requestLogout(){ |
| 9 | let bean: Record<string, string> = {}; | 9 | let bean: Record<string, string> = {}; |
| 10 | - bean['refreshToken'] = UserDataLocal.USER_REFRESH_TOKEN | 10 | + bean['refreshToken'] = HttpUrlUtils.getRefreshToken() |
| 11 | bean['refreshToken'] = 'ddrqreeee' | 11 | bean['refreshToken'] = 'ddrqreeee' |
| 12 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 12 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 13 | return new Promise<string>((success, fail) => { | 13 | return new Promise<string>((success, fail) => { |
| @@ -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 |
| 1 | import { PhotoListBean } from 'wdBean/Index'; | 1 | import { PhotoListBean } from 'wdBean/Index'; |
| 2 | import { display, router } from '@kit.ArkUI'; | 2 | import { display, router } from '@kit.ArkUI'; |
| 3 | -import { Logger } from 'wdKit/Index'; | ||
| 4 | import { ImageItemView } from '../components/view/ImageItemView'; | 3 | import { ImageItemView } from '../components/view/ImageItemView'; |
| 5 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; |
| 6 | import { Action } from 'wdBean'; | 5 | import { Action } from 'wdBean'; |
| @@ -10,7 +9,6 @@ const TAG = 'MultiPictureListPage'; | @@ -10,7 +9,6 @@ const TAG = 'MultiPictureListPage'; | ||
| 10 | @Entry | 9 | @Entry |
| 11 | @Component | 10 | @Component |
| 12 | export struct MultiPictureListPage { | 11 | export struct MultiPictureListPage { |
| 13 | - @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | ||
| 14 | private scroller: Scroller = new Scroller() | 12 | private scroller: Scroller = new Scroller() |
| 15 | @State swiperIndex: number = 0; | 13 | @State swiperIndex: number = 0; |
| 16 | photoList: PhotoListBean[] = []; | 14 | photoList: PhotoListBean[] = []; |
| @@ -20,17 +18,10 @@ export struct MultiPictureListPage { | @@ -20,17 +18,10 @@ export struct MultiPictureListPage { | ||
| 20 | private picWidth: number = 0 | 18 | private picWidth: number = 0 |
| 21 | @State picHeight: number = 0 | 19 | @State picHeight: number = 0 |
| 22 | @State isEnableSwipe: boolean = true; | 20 | @State isEnableSwipe: boolean = true; |
| 21 | + @State currentUrl: string = '' | ||
| 23 | 22 | ||
| 24 | // @Provide bgc: Color = Color.White; | 23 | // @Provide bgc: Color = Color.White; |
| 25 | 24 | ||
| 26 | - //watch监听页码回调 | ||
| 27 | - onCurrentPageNumUpdated(): void { | ||
| 28 | - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,) | ||
| 29 | - let _swiperIndex = Number.parseInt(this.currentPageNum) | ||
| 30 | - Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | ||
| 31 | - this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | aboutToAppear(): void { | 25 | aboutToAppear(): void { |
| 35 | //获取宽高尺寸 | 26 | //获取宽高尺寸 |
| 36 | this.screenWidth = this.displayTool.width | 27 | this.screenWidth = this.displayTool.width |
| @@ -40,6 +31,8 @@ export struct MultiPictureListPage { | @@ -40,6 +31,8 @@ export struct MultiPictureListPage { | ||
| 40 | let par: Action = router.getParams() as Action; | 31 | let par: Action = router.getParams() as Action; |
| 41 | let params = par?.params; | 32 | let params = par?.params; |
| 42 | this.photoList = params?.extra?.photoList || []; | 33 | this.photoList = params?.extra?.photoList || []; |
| 34 | + this.swiperIndex = params?.extra?.swiperIndex || 0; | ||
| 35 | + this.currentUrl = this.photoList[this.swiperIndex]?.picPath | ||
| 43 | } | 36 | } |
| 44 | 37 | ||
| 45 | build() { | 38 | build() { |
| @@ -80,6 +73,7 @@ export struct MultiPictureListPage { | @@ -80,6 +73,7 @@ export struct MultiPictureListPage { | ||
| 80 | }) | 73 | }) |
| 81 | .onChange((index: number) => { | 74 | .onChange((index: number) => { |
| 82 | this.swiperIndex = index | 75 | this.swiperIndex = index |
| 76 | + this.currentUrl = this.photoList[index]?.picPath | ||
| 83 | }) | 77 | }) |
| 84 | 78 | ||
| 85 | Row() { | 79 | Row() { |
| @@ -121,7 +115,7 @@ export struct MultiPictureListPage { | @@ -121,7 +115,7 @@ export struct MultiPictureListPage { | ||
| 121 | }) | 115 | }) |
| 122 | } | 116 | } |
| 123 | 117 | ||
| 124 | - ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath }) | 118 | + ImageDownloadComponent({ url: this.currentUrl }) |
| 125 | .alignRules({ | 119 | .alignRules({ |
| 126 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 120 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 127 | right: { anchor: "__container__", align: HorizontalAlign.End } | 121 | right: { anchor: "__container__", align: HorizontalAlign.End } |
| @@ -48,5 +48,19 @@ export class LikeViewModel { | @@ -48,5 +48,19 @@ export class LikeViewModel { | ||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | + //点赞数 | ||
| 52 | + getLikeCount(bean: Record<string, string>) { | ||
| 53 | + | ||
| 54 | + return new Promise<object>((success, fail) => { | ||
| 55 | + this.likeModel.getLikeCount(bean).then((data) => { | ||
| 56 | + success(data) | ||
| 57 | + }).catch((error: string) => { | ||
| 58 | + fail(error) | ||
| 59 | + }) | ||
| 60 | + }) | ||
| 61 | + | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + | ||
| 51 | 65 | ||
| 52 | } | 66 | } |
| @@ -20,15 +20,15 @@ export class LogoutViewModel{ | @@ -20,15 +20,15 @@ export class LogoutViewModel{ | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | static clearLoginInfo() { | 22 | static clearLoginInfo() { |
| 23 | - SPHelper.default.save(SpConstants.USER_FIRST_MARK, '') | ||
| 24 | - SPHelper.default.save(SpConstants.USER_ID, '') | ||
| 25 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '') | ||
| 26 | - SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '') | ||
| 27 | - SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, '') | ||
| 28 | - SPHelper.default.save(SpConstants.USER_STATUS, '') | ||
| 29 | - SPHelper.default.save(SpConstants.USER_Type, '') | ||
| 30 | - SPHelper.default.save(SpConstants.USER_NAME, '') | ||
| 31 | - SPHelper.default.save(SpConstants.USER_PHONE, '') | 23 | + SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, '') |
| 24 | + SPHelper.default.saveSync(SpConstants.USER_ID, '') | ||
| 25 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, '') | ||
| 26 | + SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '') | ||
| 27 | + SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, '') | ||
| 28 | + SPHelper.default.saveSync(SpConstants.USER_STATUS, '') | ||
| 29 | + SPHelper.default.saveSync(SpConstants.USER_Type, '') | ||
| 30 | + SPHelper.default.saveSync(SpConstants.USER_NAME, '') | ||
| 31 | + SPHelper.default.saveSync(SpConstants.USER_PHONE, '') | ||
| 32 | HttpUrlUtils.setUserId("") | 32 | HttpUrlUtils.setUserId("") |
| 33 | HttpUrlUtils.setUserType("") | 33 | HttpUrlUtils.setUserType("") |
| 34 | HttpUrlUtils.setUserToken('') | 34 | HttpUrlUtils.setUserToken('') |
| 1 | -import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } from 'wdKit'; | 3 | import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| 5 | import PageModel from './PageModel'; | 5 | import PageModel from './PageModel'; |
| 6 | import PageViewModel from './PageViewModel'; | 6 | import PageViewModel from './PageViewModel'; |
| 7 | import { promptAction } from '@kit.ArkUI'; | 7 | import { promptAction } from '@kit.ArkUI'; |
| 8 | -import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; | 8 | +import { CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean'; |
| 9 | import PageAdModel from './PageAdvModel'; | 9 | import PageAdModel from './PageAdvModel'; |
| 10 | import { ArrayList } from '@kit.ArkTS'; | 10 | import { ArrayList } from '@kit.ArkTS'; |
| 11 | import { WDViewDefaultType } from '../components/view/EmptyComponent'; | 11 | import { WDViewDefaultType } from '../components/view/EmptyComponent'; |
| @@ -104,7 +104,11 @@ export class PageHelper { | @@ -104,7 +104,11 @@ export class PageHelper { | ||
| 104 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 104 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 105 | pageModel.viewType = ViewType.LOADED; | 105 | pageModel.viewType = ViewType.LOADED; |
| 106 | let sizeBefore: number = pageModel.compList.size(); | 106 | let sizeBefore: number = pageModel.compList.size(); |
| 107 | - pageModel.currentPage++; | 107 | + if (isLastGroup) { |
| 108 | + // 认为分页只会在最后一个group里 | ||
| 109 | + pageModel.currentPage++; | ||
| 110 | + } | ||
| 111 | + // pageModel.currentPage++; | ||
| 108 | pageModel.hasMore = true; | 112 | pageModel.hasMore = true; |
| 109 | 113 | ||
| 110 | //移除音频 和 活动 | 114 | //移除音频 和 活动 |
| @@ -32,15 +32,15 @@ export struct DetailPlayLivePage { | @@ -32,15 +32,15 @@ export struct DetailPlayLivePage { | ||
| 32 | 32 | ||
| 33 | aboutToAppear(): void { | 33 | aboutToAppear(): void { |
| 34 | Logger.info(TAG, `wyj-aboutToAppear`) | 34 | Logger.info(TAG, `wyj-aboutToAppear`) |
| 35 | - this.listener?.on("change", (mediaQueryResult) => { | ||
| 36 | - Logger.info(TAG, `change;${mediaQueryResult.matches}`) | ||
| 37 | - if (mediaQueryResult?.matches) { | ||
| 38 | - this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL | ||
| 39 | - } else { | ||
| 40 | - this.displayDirection = DisplayDirection.VERTICAL | ||
| 41 | - } | ||
| 42 | - WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL) | ||
| 43 | - }) | 35 | + // this.listener?.on("change", (mediaQueryResult) => { |
| 36 | + // Logger.info(TAG, `change;${mediaQueryResult.matches}`) | ||
| 37 | + // if (mediaQueryResult?.matches) { | ||
| 38 | + // this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL | ||
| 39 | + // } else { | ||
| 40 | + // this.displayDirection = DisplayDirection.VERTICAL | ||
| 41 | + // } | ||
| 42 | + // WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL) | ||
| 43 | + // }) | ||
| 44 | this.getLiveDetails() | 44 | this.getLiveDetails() |
| 45 | this.getLiveRoomData() | 45 | this.getLiveRoomData() |
| 46 | } | 46 | } |
| @@ -67,7 +67,7 @@ export struct DetailPlayLivePage { | @@ -67,7 +67,7 @@ export struct DetailPlayLivePage { | ||
| 67 | 67 | ||
| 68 | onPageShowCus(): void { | 68 | onPageShowCus(): void { |
| 69 | Logger.info(TAG, `wyj-onPageShowCus`) | 69 | Logger.info(TAG, `wyj-onPageShowCus`) |
| 70 | - // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); | 70 | + // WindowModel.shared.setPreferredOrientation(window.Orientation.LOCKED); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | onPageHideCus(): void { | 73 | onPageHideCus(): void { |
| @@ -100,7 +100,7 @@ export struct TabLiveItemComponent { | @@ -100,7 +100,7 @@ export struct TabLiveItemComponent { | ||
| 100 | picDesc: '' | 100 | picDesc: '' |
| 101 | }) | 101 | }) |
| 102 | } | 102 | } |
| 103 | - this.gotoMultipleListImagePage() | 103 | + this.gotoMultipleListImagePage(index) |
| 104 | }) | 104 | }) |
| 105 | }) | 105 | }) |
| 106 | } | 106 | } |
| @@ -187,13 +187,14 @@ export struct TabLiveItemComponent { | @@ -187,13 +187,14 @@ export struct TabLiveItemComponent { | ||
| 187 | * 大图列表页 | 187 | * 大图列表页 |
| 188 | * @param content | 188 | * @param content |
| 189 | * */ | 189 | * */ |
| 190 | - gotoMultipleListImagePage() { | 190 | + gotoMultipleListImagePage(index: number) { |
| 191 | let taskAction: Action = { | 191 | let taskAction: Action = { |
| 192 | type: 'JUMP_DETAIL_PAGE', | 192 | type: 'JUMP_DETAIL_PAGE', |
| 193 | params: { | 193 | params: { |
| 194 | detailPageType: 18, | 194 | detailPageType: 18, |
| 195 | extra: { | 195 | extra: { |
| 196 | - photoList: this.photoList | 196 | + photoList: this.photoList, |
| 197 | + swiperIndex: index, | ||
| 197 | } as ExtraDTO | 198 | } as ExtraDTO |
| 198 | } as Params, | 199 | } as Params, |
| 199 | }; | 200 | }; |
| @@ -191,12 +191,15 @@ export struct PlayUIComponent { | @@ -191,12 +191,15 @@ export struct PlayUIComponent { | ||
| 191 | 191 | ||
| 192 | @Builder | 192 | @Builder |
| 193 | getMiddleUIComponent() { | 193 | getMiddleUIComponent() { |
| 194 | - Stack() | ||
| 195 | - .layoutWeight(1) | ||
| 196 | - .width('100%') | ||
| 197 | - .onClick(() => { | ||
| 198 | - this.isMenuVisible = !this.isMenuVisible | ||
| 199 | - }) | 194 | + Stack() { |
| 195 | + Text('播放功能暂时关闭') | ||
| 196 | + .fontColor(Color.White) | ||
| 197 | + }.alignContent(Alignment.Center) | ||
| 198 | + .layoutWeight(1) | ||
| 199 | + .width('100%') | ||
| 200 | + .onClick(() => { | ||
| 201 | + this.isMenuVisible = !this.isMenuVisible | ||
| 202 | + }) | ||
| 200 | } | 203 | } |
| 201 | 204 | ||
| 202 | @Builder | 205 | @Builder |
| @@ -13,7 +13,7 @@ export struct TopPlayComponent { | @@ -13,7 +13,7 @@ export struct TopPlayComponent { | ||
| 13 | aboutToAppear(): void { | 13 | aboutToAppear(): void { |
| 14 | if (this.playerController) { | 14 | if (this.playerController) { |
| 15 | this.playerController.onCanplay = () => { | 15 | this.playerController.onCanplay = () => { |
| 16 | - this.playerController?.play() | 16 | + // this.playerController?.play() |
| 17 | } | 17 | } |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| @@ -31,7 +31,7 @@ export struct TopPlayComponent { | @@ -31,7 +31,7 @@ export struct TopPlayComponent { | ||
| 31 | } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { | 31 | } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { |
| 32 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri | 32 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri |
| 33 | } | 33 | } |
| 34 | - this.playerController?.firstPlay(playUrl); | 34 | + // this.playerController?.firstPlay(playUrl); |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | 37 |
| @@ -47,14 +47,14 @@ export class LoginViewModel { | @@ -47,14 +47,14 @@ export class LoginViewModel { | ||
| 47 | 47 | ||
| 48 | return new Promise<LoginBean>((success, fail) => { | 48 | return new Promise<LoginBean>((success, fail) => { |
| 49 | this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { | 49 | this.loginModel.appLogin(phone, loginType, verificationCode).then((data: LoginBean) => { |
| 50 | - SPHelper.default.save(SpConstants.USER_FIRST_MARK, data.firstMark) | ||
| 51 | - SPHelper.default.save(SpConstants.USER_ID, data.id) | ||
| 52 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 53 | - SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 54 | - SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 55 | - SPHelper.default.save(SpConstants.USER_STATUS, data.status) | ||
| 56 | - SPHelper.default.save(SpConstants.USER_Type, data.userType) | ||
| 57 | - SPHelper.default.save(SpConstants.USER_NAME, data.userName) | 50 | + SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) |
| 51 | + SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | ||
| 52 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 53 | + SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 54 | + SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 55 | + SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | ||
| 56 | + SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | ||
| 57 | + SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 58 | HttpUrlUtils.setUserId(data.id+"") | 58 | HttpUrlUtils.setUserId(data.id+"") |
| 59 | HttpUrlUtils.setUserType(data.userType+"") | 59 | HttpUrlUtils.setUserType(data.userType+"") |
| 60 | HttpUrlUtils.setUserToken(data.jwtToken) | 60 | HttpUrlUtils.setUserToken(data.jwtToken) |
| @@ -71,14 +71,14 @@ export class LoginViewModel { | @@ -71,14 +71,14 @@ export class LoginViewModel { | ||
| 71 | let passwordNew = await this.doMd(password) | 71 | let passwordNew = await this.doMd(password) |
| 72 | Logger.debug(TAG, "PASSWORD:" + passwordNew) | 72 | Logger.debug(TAG, "PASSWORD:" + passwordNew) |
| 73 | this.loginModel.appLoginByPassword(phone, loginType, passwordNew, oldPassword).then((data: LoginBean) => { | 73 | this.loginModel.appLoginByPassword(phone, loginType, passwordNew, oldPassword).then((data: LoginBean) => { |
| 74 | - SPHelper.default.save(SpConstants.USER_FIRST_MARK, data.firstMark) | ||
| 75 | - SPHelper.default.save(SpConstants.USER_ID, data.id) | ||
| 76 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 77 | - SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 78 | - SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 79 | - SPHelper.default.save(SpConstants.USER_STATUS, data.status) | ||
| 80 | - SPHelper.default.save(SpConstants.USER_Type, data.userType) | ||
| 81 | - SPHelper.default.save(SpConstants.USER_NAME, data.userName) | 74 | + SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, data.firstMark) |
| 75 | + SPHelper.default.saveSync(SpConstants.USER_ID, data.id) | ||
| 76 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 77 | + SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, data.longTimeNoLoginMark) | ||
| 78 | + SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, data.refreshToken) | ||
| 79 | + SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | ||
| 80 | + SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | ||
| 81 | + SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | ||
| 82 | HttpUrlUtils.setUserId(data.id+"") | 82 | HttpUrlUtils.setUserId(data.id+"") |
| 83 | HttpUrlUtils.setUserType(data.userType+"") | 83 | HttpUrlUtils.setUserType(data.userType+"") |
| 84 | HttpUrlUtils.setUserToken(data.jwtToken) | 84 | HttpUrlUtils.setUserToken(data.jwtToken) |
| @@ -94,8 +94,8 @@ export class LoginViewModel { | @@ -94,8 +94,8 @@ export class LoginViewModel { | ||
| 94 | return new Promise<CheckVerifyBean>((success, reject) => { | 94 | return new Promise<CheckVerifyBean>((success, reject) => { |
| 95 | this.loginModel.checkVerifyCode(phone, verifyCode).then((data: CheckVerifyBean) => { | 95 | this.loginModel.checkVerifyCode(phone, verifyCode).then((data: CheckVerifyBean) => { |
| 96 | //todo 保存数据 | 96 | //todo 保存数据 |
| 97 | - SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.tempToken) | ||
| 98 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) | 97 | + SPHelper.default.saveSync(SpConstants.USER_TEMP_TOKEN, data.tempToken) |
| 98 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 99 | success(data) | 99 | success(data) |
| 100 | 100 | ||
| 101 | }, (value: string) => { | 101 | }, (value: string) => { |
| @@ -107,8 +107,8 @@ export class LoginViewModel { | @@ -107,8 +107,8 @@ export class LoginViewModel { | ||
| 107 | return new Promise<CheckVerifyBean>((success, reject) => { | 107 | return new Promise<CheckVerifyBean>((success, reject) => { |
| 108 | this.loginModel.checkVerifyCodeByToken(verifyCode).then((data: CheckVerifyBean) => { | 108 | this.loginModel.checkVerifyCodeByToken(verifyCode).then((data: CheckVerifyBean) => { |
| 109 | //todo 保存数据 | 109 | //todo 保存数据 |
| 110 | - SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.tempToken) | ||
| 111 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) | 110 | + SPHelper.default.saveSync(SpConstants.USER_TEMP_TOKEN, data.tempToken) |
| 111 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, data.jwtToken) | ||
| 112 | success(data) | 112 | success(data) |
| 113 | 113 | ||
| 114 | }, (value: string) => { | 114 | }, (value: string) => { |
| @@ -149,14 +149,14 @@ export class LoginViewModel { | @@ -149,14 +149,14 @@ export class LoginViewModel { | ||
| 149 | this.loginModel.logOut().then((data) => { | 149 | this.loginModel.logOut().then((data) => { |
| 150 | //清除登录状态以及token、userid等信息 | 150 | //清除登录状态以及token、userid等信息 |
| 151 | 151 | ||
| 152 | - SPHelper.default.save(SpConstants.USER_FIRST_MARK, '') | ||
| 153 | - SPHelper.default.save(SpConstants.USER_ID, '') | ||
| 154 | - SPHelper.default.save(SpConstants.USER_JWT_TOKEN, '') | ||
| 155 | - SPHelper.default.save(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '') | ||
| 156 | - SPHelper.default.save(SpConstants.USER_REFRESH_TOKEN, '') | ||
| 157 | - SPHelper.default.save(SpConstants.USER_STATUS, '') | ||
| 158 | - SPHelper.default.save(SpConstants.USER_Type, '') | ||
| 159 | - SPHelper.default.save(SpConstants.USER_NAME, '') | 152 | + SPHelper.default.saveSync(SpConstants.USER_FIRST_MARK, '') |
| 153 | + SPHelper.default.saveSync(SpConstants.USER_ID, '') | ||
| 154 | + SPHelper.default.saveSync(SpConstants.USER_JWT_TOKEN, '') | ||
| 155 | + SPHelper.default.saveSync(SpConstants.USER_LONG_TIME_NO_LOGIN_MARK, '') | ||
| 156 | + SPHelper.default.saveSync(SpConstants.USER_REFRESH_TOKEN, '') | ||
| 157 | + SPHelper.default.saveSync(SpConstants.USER_STATUS, '') | ||
| 158 | + SPHelper.default.saveSync(SpConstants.USER_Type, '') | ||
| 159 | + SPHelper.default.saveSync(SpConstants.USER_NAME, '') | ||
| 160 | HttpUrlUtils.setUserId("") | 160 | HttpUrlUtils.setUserId("") |
| 161 | HttpUrlUtils.setUserType("") | 161 | HttpUrlUtils.setUserType("") |
| 162 | HttpUrlUtils.setUserToken('') | 162 | HttpUrlUtils.setUserToken('') |
| @@ -218,14 +218,14 @@ export class LoginViewModel { | @@ -218,14 +218,14 @@ export class LoginViewModel { | ||
| 218 | this.loginModel.queryUserDetail().then((data: UserDetail) => { | 218 | this.loginModel.queryUserDetail().then((data: UserDetail) => { |
| 219 | //保存sp | 219 | //保存sp |
| 220 | if(data){ | 220 | if(data){ |
| 221 | - SPHelper.default.save(SpConstants.USER_NAME, data.userName) | ||
| 222 | - SPHelper.default.save(SpConstants.USER_PHONE, data.phone) | 221 | + SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) |
| 222 | + SPHelper.default.saveSync(SpConstants.USER_PHONE, data.phone) | ||
| 223 | } | 223 | } |
| 224 | if(data.userExtend){ | 224 | if(data.userExtend){ |
| 225 | - SPHelper.default.save(SpConstants.USER_SEX, data.userExtend.sex) | ||
| 226 | - SPHelper.default.save(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"") | ||
| 227 | - SPHelper.default.save(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl) | ||
| 228 | - SPHelper.default.save(SpConstants.USER_BIRTHDAY, data.userExtend.birthday) | 225 | + SPHelper.default.saveSync(SpConstants.USER_SEX, data.userExtend.sex) |
| 226 | + SPHelper.default.saveSync(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"") | ||
| 227 | + SPHelper.default.saveSync(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl) | ||
| 228 | + SPHelper.default.saveSync(SpConstants.USER_BIRTHDAY, data.userExtend.birthday) | ||
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | success(data) | 231 | success(data) |
| @@ -14,7 +14,7 @@ import { | @@ -14,7 +14,7 @@ import { | ||
| 14 | StringUtils, | 14 | StringUtils, |
| 15 | WindowModel | 15 | WindowModel |
| 16 | } from 'wdKit'; | 16 | } from 'wdKit'; |
| 17 | -import { HttpUrlUtils, WDHttp } from 'wdNetwork'; | 17 | +import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; |
| 18 | 18 | ||
| 19 | export default class EntryAbility extends UIAbility { | 19 | export default class EntryAbility extends UIAbility { |
| 20 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 20 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| @@ -25,7 +25,7 @@ export default class EntryAbility extends UIAbility { | @@ -25,7 +25,7 @@ export default class EntryAbility extends UIAbility { | ||
| 25 | WDHttp.initHttpHeader() | 25 | WDHttp.initHttpHeader() |
| 26 | const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string | 26 | const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string |
| 27 | if (StringUtils.isNotEmpty(spHostUrl)) { | 27 | if (StringUtils.isNotEmpty(spHostUrl)) { |
| 28 | - HttpUrlUtils.hostUrl = spHostUrl | 28 | + HostManager.changeHost(spHostUrl as HostEnum) |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | // 注册监听网络连接 | 31 | // 注册监听网络连接 |
-
Please register or login to post a comment