wangyujian_wd

Merge remote-tracking branch 'origin/main'

Showing 91 changed files with 1614 additions and 496 deletions
@@ -244,6 +244,30 @@ @@ -244,6 +244,30 @@
244 ] 244 ]
245 } 245 }
246 ] 246 ]
  247 + },
  248 + {
  249 + "name": "wdShareBase",
  250 + "srcPath": "./commons/wdShareBase",
  251 + "targets": [
  252 + {
  253 + "name": "default",
  254 + "applyToProducts": [
  255 + "default"
  256 + ]
  257 + }
  258 + ]
  259 + },
  260 + {
  261 + "name": "wdShare",
  262 + "srcPath": "./features/wdShare",
  263 + "targets": [
  264 + {
  265 + "name": "default",
  266 + "applyToProducts": [
  267 + "default"
  268 + ]
  269 + }
  270 + ]
247 } 271 }
248 ] 272 ]
249 } 273 }
@@ -34,6 +34,8 @@ export class SpConstants{ @@ -34,6 +34,8 @@ export class SpConstants{
34 //定位相关 34 //定位相关
35 static LOCATION_CITY_NAME = "location_city_name" //定位 35 static LOCATION_CITY_NAME = "location_city_name" //定位
36 static LOCATION_CITY_CODE = "location_city_code" //定位 36 static LOCATION_CITY_CODE = "location_city_code" //定位
  37 + static LOCATION_PROVINCE_CODE = "location_province_code" //定位,省份code
  38 + static LOCATION_DISTRICT_CODE = "location_district_code" //定位,区县,返回9位,如:合肥-瑶海区-310115114
37 static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位 39 static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位
38 40
39 //启动页数据存储key 41 //启动页数据存储key
@@ -7,7 +7,7 @@ export class CallBackMessage { @@ -7,7 +7,7 @@ export class CallBackMessage {
7 callbackId: string = ""; //callbackId 7 callbackId: string = ""; //callbackId
8 responseId: string = ""; //responseId 8 responseId: string = ""; //responseId
9 responseData: string = ""; //responseData 9 responseData: string = ""; //responseData
10 - data?: string; //data of message 10 + data?: object; //data of message
11 handlerName: string = ""; //name of handler 11 handlerName: string = ""; //name of handler
12 12
13 /** 13 /**
@@ -128,11 +128,11 @@ export class BridgeWebViewControl extends webview.WebviewController { @@ -128,11 +128,11 @@ export class BridgeWebViewControl extends webview.WebviewController {
128 * native 主动调用JSBridge方法 128 * native 主动调用JSBridge方法
129 * @param msg 129 * @param msg
130 */ 130 */
131 - callHandle(handlerName: string, data: string, callBack: Callback) { 131 + callHandle(handlerName: string, data: object, callBack: Callback) {
132 this.doSend(handlerName, data, callBack) 132 this.doSend(handlerName, data, callBack)
133 } 133 }
134 134
135 - private doSend(handlerName: string, data: string, callBack: Callback) { 135 + private doSend(handlerName: string, data: object, callBack: Callback) {
136 let msg: CallBackMessage = new CallBackMessage() 136 let msg: CallBackMessage = new CallBackMessage()
137 if (StringUtils.isNotEmpty(data)) { 137 if (StringUtils.isNotEmpty(data)) {
138 msg.data = data 138 msg.data = data
1 import data_preferences from '@ohos.data.preferences'; 1 import data_preferences from '@ohos.data.preferences';
  2 +import { Logger } from './Logger';
  3 +
  4 +const TAG = 'SPHelper'
2 5
3 /** 6 /**
4 * sp存储 7 * sp存储
5 - *  
6 - * 单例模式  
7 - * TODO 新增内存存储,避免频繁sp获取  
8 */ 8 */
9 -// SPHelper.default.get("key1", "defValue1").then((value1) => {  
10 -// this.message = value1.toString();  
11 -// })  
12 -  
13 -// let value2: string = await SPHelper.default.get("key2", "defValue2");  
14 -// this.message = result;  
15 export class SPHelper { 9 export class SPHelper {
16 private static context: Context; 10 private static context: Context;
17 private static spFilename: string = '__SPHelper'; 11 private static spFilename: string = '__SPHelper';
@@ -51,7 +45,11 @@ export class SPHelper { @@ -51,7 +45,11 @@ export class SPHelper {
51 saveSync(key: string, value: data_preferences.ValueType) { 45 saveSync(key: string, value: data_preferences.ValueType) {
52 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 46 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
53 preferences.putSync(key, value) 47 preferences.putSync(key, value)
54 - preferences.flush() // todo:Asynchronously 48 + preferences.flush().then(() => {
  49 + Logger.debug(TAG, 'saveSync flush success')
  50 + }).catch((error: object) => {
  51 + Logger.debug(TAG, 'saveSync flush failed: ' + JSON.stringify(error))
  52 + });
55 } 53 }
56 54
57 async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> { 55 async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> {
@@ -86,7 +84,11 @@ export class SPHelper { @@ -86,7 +84,11 @@ export class SPHelper {
86 deleteSync(key: string) { 84 deleteSync(key: string) {
87 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 85 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
88 preferences.deleteSync(key) 86 preferences.deleteSync(key)
89 - preferences.flush(); // todo:Asynchronously 87 + preferences.flush().then(() => {
  88 + Logger.debug(TAG, 'deleteSync flush success')
  89 + }).catch((error: object) => {
  90 + Logger.debug(TAG, 'deleteSync flush failed: ' + JSON.stringify(error))
  91 + });
90 } 92 }
91 93
92 async clearSync() { 94 async clearSync() {
@@ -98,12 +100,6 @@ export class SPHelper { @@ -98,12 +100,6 @@ export class SPHelper {
98 }); 100 });
99 } 101 }
100 102
101 - // clearSync() {  
102 - // let preferences: data_preferences.Preferences = this.getVideoPreferencesSync()  
103 - // preferences.clearSync()  
104 - // preferences.flush()  
105 - // }  
106 -  
107 public getPreferences() { 103 public getPreferences() {
108 let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename); 104 let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename);
109 return preferences; 105 return preferences;
@@ -25,15 +25,14 @@ export class HttpParams { @@ -25,15 +25,14 @@ export class HttpParams {
25 headers['imei'] = DeviceUtil.clientId() 25 headers['imei'] = DeviceUtil.clientId()
26 headers['Accept-Language'] = 'zh' 26 headers['Accept-Language'] = 'zh'
27 headers['timestamp'] = DateTimeUtils.getTimeStamp() + '' 27 headers['timestamp'] = DateTimeUtils.getTimeStamp() + ''
  28 + headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
28 HttpParams.setLocationHeader(headers) 29 HttpParams.setLocationHeader(headers)
29 - // // TODO 判断是否登录  
30 - headers['RMRB-X-TOKEN'] = HttpUtils.getXToken()  
31 - if (HttpUtils.getXToken() != '') {  
32 - headers['cookie'] = 'RMRB-X-TOKEN=' + HttpUtils.getXToken() 30 + if (HttpUtils.isLogin()) {
  31 + headers['RMRB-X-TOKEN'] = HttpUtils.getUserToken()
  32 + headers['cookie'] = 'RMRB-X-TOKEN=' + HttpUtils.getUserToken()
  33 + headers['userId'] = HttpUtils.getUserId()
  34 + headers['userType'] = HttpUtils.getUserType()
33 } 35 }
34 - headers['userId'] = HttpUtils.getUserId()  
35 - headers['userType'] = HttpUtils.getUserType()  
36 - headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'  
37 HttpParams.addSpecialHeaders(headers); 36 HttpParams.addSpecialHeaders(headers);
38 return headers; 37 return headers;
39 } 38 }
@@ -46,10 +46,6 @@ export class HttpUrlUtils { @@ -46,10 +46,6 @@ export class HttpUrlUtils {
46 */ 46 */
47 static readonly INTERACT_EXECUTELIKE: string = "/api/rmrb-interact/interact/zh/c/like/executeLike"; 47 static readonly INTERACT_EXECUTELIKE: string = "/api/rmrb-interact/interact/zh/c/like/executeLike";
48 /** 48 /**
49 - * 收藏、取消收藏  
50 - */  
51 - static readonly INTERACT_EXECUTECOLLECTRECORD: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";  
52 - /**  
53 * 关注号主 49 * 关注号主
54 */ 50 */
55 static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation"; 51 static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation";
@@ -651,7 +647,7 @@ export class HttpUrlUtils { @@ -651,7 +647,7 @@ export class HttpUrlUtils {
651 647
652 //获取点赞数 648 //获取点赞数
653 static getLikeCount() { 649 static getLikeCount() {
654 - let url = HttpUrlUtils.getHost() + "/api/rmrb-contact/contact/zh/c/v2/content/interactData"; 650 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_V2_DATA_PATH;
655 return url; 651 return url;
656 } 652 }
657 653
1 import { SpConstants } from 'wdConstant/Index'; 1 import { SpConstants } from 'wdConstant/Index';
2 import { DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index'; 2 import { DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index';
3 -import { HttpParams } from '../http/HttpCommonParams';  
4 import { HttpRequest } from '../http/HttpRequest'; 3 import { HttpRequest } from '../http/HttpRequest';
5 4
6 const TAG: string = '[HttpUtils]' 5 const TAG: string = '[HttpUtils]'
@@ -9,27 +8,6 @@ const TAG: string = '[HttpUtils]' @@ -9,27 +8,6 @@ const TAG: string = '[HttpUtils]'
9 * http相关工具类,对外暴露 8 * http相关工具类,对外暴露
10 */ 9 */
11 export class HttpUtils { 10 export class HttpUtils {
12 - private static userId = ''  
13 - private static userType = ''  
14 - private static token = ''  
15 -  
16 - /**  
17 - * 添加公共参数,如登录后,添加登录信息  
18 - */  
19 - static addCommonHeader() {  
20 - HttpRequest.addGlobalHeaderProvider(() => {  
21 - let headers: Record<string, string> = {};  
22 - return headers;  
23 - })  
24 - }  
25 -  
26 - /**  
27 - * 添加公共参数,如登出后,移除登录信息  
28 - */  
29 - static removeCommonHeader() {  
30 -  
31 - }  
32 -  
33 static getRefreshToken() { 11 static getRefreshToken() {
34 let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "") 12 let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "")
35 if (StringUtils.isNotEmpty(refreshToken)) { 13 if (StringUtils.isNotEmpty(refreshToken)) {
@@ -49,25 +27,27 @@ export class HttpUtils { @@ -49,25 +27,27 @@ export class HttpUtils {
49 * 定位,城市code 27 * 定位,城市code
50 */ 28 */
51 public static getCityCode(): string { 29 public static getCityCode(): string {
52 - // TODO  
53 // 城市编码 30 // 城市编码
54 - return '340100'; 31 + return SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string
55 } 32 }
56 33
57 /** 34 /**
58 * 定位,省份code 35 * 定位,省份code
59 */ 36 */
60 public static getProvinceCode(): string { 37 public static getProvinceCode(): string {
61 - // TODO  
62 - return '340000'; 38 + return SPHelper.default.getSync(SpConstants.LOCATION_PROVINCE_CODE, '') as string
63 } 39 }
64 40
65 /** 41 /**
66 * 定位,地区code 42 * 定位,地区code
67 */ 43 */
68 public static getDistrictCode(): string { 44 public static getDistrictCode(): string {
69 - // TODO  
70 - return '340103'; 45 + let districtCode = SPHelper.default.getSync(SpConstants.LOCATION_DISTRICT_CODE, '') as string
  46 + if (districtCode === '') {
  47 + return districtCode
  48 + }
  49 + // 截取前6位,如返回310115114,需要310115 (上海浦东)
  50 + return districtCode.substring(0, 6);
71 } 51 }
72 52
73 public static getImei(): string { 53 public static getImei(): string {
@@ -75,43 +55,22 @@ export class HttpUtils { @@ -75,43 +55,22 @@ export class HttpUtils {
75 } 55 }
76 56
77 public static getUserId(): string { 57 public static getUserId(): string {
78 - // TODO 对接登录  
79 - if (StringUtils.isNotEmpty(HttpUtils.userId)) {  
80 - return HttpUtils.userId  
81 - }  
82 - HttpUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string  
83 - return HttpUtils.userId; 58 + return SPHelper.default.getSync(SpConstants.USER_ID, "") as string
84 } 59 }
85 60
86 public static getUserType(): string { 61 public static getUserType(): string {
87 - if (StringUtils.isNotEmpty(HttpUtils.userType)) {  
88 - return HttpUtils.userType  
89 - }  
90 - HttpUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string  
91 - return HttpUtils.userType;  
92 - }  
93 -  
94 - static getXToken(): string {  
95 - if (StringUtils.isNotEmpty(HttpUtils.token)) {  
96 - return HttpUtils.token  
97 - }  
98 - HttpUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string  
99 - if (StringUtils.isNotEmpty(HttpUtils.token)) {  
100 - return HttpUtils.token  
101 - }  
102 - return '' 62 + return SPHelper.default.getSync(SpConstants.USER_Type, "") as string
103 } 63 }
104 64
105 - public static setUserId(userId: string) {  
106 - // TODO 优化赋值  
107 - HttpUtils.userId = userId; 65 + static getUserToken(): string {
  66 + return SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
108 } 67 }
109 68
110 - public static setUserType(userType: string) {  
111 - HttpUtils.userType = userType;  
112 - }  
113 -  
114 - public static setUserToken(token: string) {  
115 - HttpUtils.token = token; 69 + public static isLogin(): boolean {
  70 + let token = HttpUtils.getUserToken()
  71 + if (token == null || token == undefined || token.length <= 0) {
  72 + return false
  73 + }
  74 + return true
116 } 75 }
117 } 76 }
  1 +/node_modules
  2 +/oh_modules
  3 +/.preview
  4 +/build
  5 +/.cxx
  6 +/.test
  1 +export { WDShareObject, WDShareBase } from "./src/main/ets/WDShareBase"
  2 +
  3 +export { ShareContent, ShareScene, ShareType } from "./src/main/ets/Constant"
  1 +{
  2 + "apiType": "stageMode",
  3 + "buildOption": {
  4 + },
  5 + "buildOptionSet": [
  6 + {
  7 + "name": "release",
  8 + "arkOptions": {
  9 + "obfuscation": {
  10 + "ruleOptions": {
  11 + "enable": true,
  12 + "files": [
  13 + "./obfuscation-rules.txt"
  14 + ]
  15 + }
  16 + }
  17 + },
  18 + },
  19 + ],
  20 + "targets": [
  21 + {
  22 + "name": "default"
  23 + }
  24 + ]
  25 +}
  1 +import { hspTasks } from '@ohos/hvigor-ohos-plugin';
  2 +
  3 +export default {
  4 + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
  5 + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
  6 +}
  1 +# Define project specific obfuscation rules here.
  2 +# You can include the obfuscation configuration files in the current module's build-profile.json5.
  3 +#
  4 +# For more details, see
  5 +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
  6 +
  7 +# Obfuscation options:
  8 +# -disable-obfuscation: disable all obfuscations
  9 +# -enable-property-obfuscation: obfuscate the property names
  10 +# -enable-toplevel-obfuscation: obfuscate the names in the global scope
  11 +# -compact: remove unnecessary blank spaces and all line feeds
  12 +# -remove-log: remove all console.* statements
  13 +# -print-namecache: print the name cache that contains the mapping from the old names to new names
  14 +# -apply-namecache: reuse the given cache file
  15 +
  16 +# Keep options:
  17 +# -keep-property-name: specifies property names that you want to keep
  18 +# -keep-global-name: specifies names that you want to keep in the global scope
  1 +{
  2 + "name": "wdsharebase",
  3 + "version": "1.0.0",
  4 + "description": "Please describe the basic information.",
  5 + "main": "Index.ets",
  6 + "author": "",
  7 + "license": "Apache-2.0",
  8 + "packageType": "InterfaceHar",
  9 + "dependencies": {
  10 + }
  11 +}
  1 +
  2 +export const enum ShareType {
  3 + System = 0,
  4 + WeChat,
  5 + QQ,
  6 + Weibo,
  7 +
  8 +}
  9 +
  10 +export const enum ShareScene {
  11 + System = 0,
  12 +
  13 + WeChatSession,
  14 + WeChatTimeline,
  15 +
  16 + QQFriend,
  17 + QQZone,
  18 +
  19 + Weibo,
  20 +}
  21 +
  22 +export const enum ShareContentType {
  23 + PrueText = 1,
  24 + ImageAndText,
  25 + Link,
  26 +}
  27 +
  28 +export interface ShareContentText {
  29 + text: string
  30 +}
  31 +export interface ShareContentImageAndText {
  32 + title: string
  33 + desc?: string
  34 + imgURI: string
  35 +
  36 +}
  37 +export interface ShareContentLink {
  38 + title: string
  39 + desc?: string
  40 + link: string
  41 + icon?: string
  42 +}
  43 +
  44 +export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink
  1 +import { ShareContent, ShareContentImageAndText, ShareContentLink, ShareContentText,
  2 + ShareContentType,
  3 + ShareScene } from '../Constant';
  4 +import { WDShareInterface } from '../WDShareInterface';
  5 +import { AsyncCallback } from '@kit.BasicServicesKit';
  6 +import { common } from '@kit.AbilityKit';
  7 +import { systemShare } from '@kit.ShareKit';
  8 +import { uniformTypeDescriptor as utd } from '@kit.ArkData';
  9 +
  10 +export class WDSystemShare implements WDShareInterface {
  11 +
  12 + shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> {
  13 +
  14 + return new Promise((resolve, fail) => {
  15 + try {
  16 +
  17 + let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType));
  18 + let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
  19 +
  20 + controller.on('dismiss', () => {
  21 +
  22 + resolve("dismiss")
  23 + });
  24 +
  25 + controller.show(context, {
  26 + previewMode: systemShare.SharePreviewMode.DEFAULT,
  27 + selectionMode: systemShare.SelectionMode.SINGLE
  28 + });
  29 +
  30 + console.log("分享控制器调用完成")
  31 + } catch (e) {
  32 + fail(e)
  33 + }
  34 + })
  35 + }
  36 +
  37 + getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData {
  38 + if (contentType === ShareContentType.PrueText) {
  39 + let prueText = content as ShareContentText
  40 + console.log("分享纯文本")
  41 + return new systemShare.SharedData({
  42 + utd: utd.UniformDataType.PLAIN_TEXT,
  43 + content: prueText.text
  44 + });
  45 + }
  46 +
  47 + if (contentType === ShareContentType.ImageAndText) {
  48 + let imageAndText = content as ShareContentImageAndText
  49 + console.log("分享图片和文本")
  50 + let data: systemShare.SharedData = new systemShare.SharedData({
  51 + utd: utd.UniformDataType.PLAIN_TEXT,
  52 + content: imageAndText.title
  53 + });
  54 + data.addRecord({
  55 + utd: utd.UniformDataType.PNG,
  56 + uri: imageAndText.imgURI
  57 + });
  58 + return data
  59 + }
  60 +
  61 + console.log("分享链接和文本")
  62 + let link = content as ShareContentLink
  63 + let data: systemShare.SharedData = new systemShare.SharedData({
  64 + utd: utd.UniformDataType.PLAIN_TEXT,
  65 + content: link.title
  66 + });
  67 + data.addRecord({
  68 + utd: utd.UniformDataType.HYPERLINK,
  69 + uri: link.link
  70 + });
  71 + return data
  72 + }
  73 +
  74 +
  75 +}
  1 +import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constant'
  2 +import { HashMap } from '@kit.ArkTS'
  3 +import { WDShareInterface } from './WDShareInterface'
  4 +import { WDSystemShare } from './System/WDSystemShare'
  5 +
  6 +export interface WDShareObject {
  7 + to: ShareType,
  8 + scene: ShareScene,
  9 + type: ShareContentType,
  10 + obj: ShareContent
  11 +}
  12 +
  13 +export class WDShareBase {
  14 +
  15 + private static instance?: WDShareBase
  16 + static getInstance() : WDShareBase {
  17 + if (!WDShareBase.instance) {
  18 + WDShareBase.instance = new WDShareBase()
  19 + WDShareBase.instance.register()
  20 + }
  21 + return WDShareBase.instance
  22 + }
  23 +
  24 + private handles: HashMap<ShareType, WDShareInterface> = new HashMap()
  25 +
  26 + register() {
  27 + this.handles.set(ShareType.System, new WDSystemShare())
  28 + }
  29 +
  30 + share(obj: WDShareObject) : null | Promise<string> {
  31 + let shareHandler: WDShareInterface = this.handles.get(obj.to)
  32 + if (shareHandler) {
  33 + return shareHandler.shareContent(obj.scene, obj.obj, obj.type)
  34 + }
  35 + return null
  36 + }
  37 +
  38 +
  39 +
  40 +
  41 +}
  1 +import { ShareContent, ShareContentType, ShareScene } from './Constant'
  2 +import { AsyncCallback } from '@kit.BasicServicesKit'
  3 +
  4 +export interface WDShareInterface {
  5 + // shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void
  6 + shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string>
  7 +
  8 +
  9 +
  10 +}
  1 +@Entry
  2 +@Component
  3 +struct IndexPage {
  4 + @State message: string = 'Hello World';
  5 +
  6 + build() {
  7 + Row() {
  8 + Column() {
  9 + Text(this.message)
  10 + .fontSize(50)
  11 + .fontWeight(FontWeight.Bold)
  12 + }
  13 + .width('100%')
  14 + }
  15 + .height('100%')
  16 + }
  17 +}
  1 +{
  2 + "module": {
  3 + "name": "wdShareBase",
  4 + "type": "shared",
  5 + "description": "$string:shared_desc",
  6 + "deviceTypes": [
  7 + "phone",
  8 + "tablet",
  9 + "2in1"
  10 + ],
  11 + "deliveryWithInstall": true,
  12 + "pages": "$profile:main_pages"
  13 + }
  14 +}
  1 +{
  2 + "color": [
  3 + {
  4 + "name": "white",
  5 + "value": "#FFFFFF"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "string": [
  3 + {
  4 + "name": "shared_desc",
  5 + "value": "description"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "src": [
  3 + "pages/IndexPage"
  4 + ]
  5 +}
  1 +import localUnitTest from './LocalUnit.test';
  2 +
  3 +export default function testsuite() {
  4 + localUnitTest();
  5 +}
  1 +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
  2 +
  3 +export default function localUnitTest() {
  4 + describe('localUnitTest',() => {
  5 + // Defines a test suite. Two parameters are supported: test suite name and test suite function.
  6 + beforeAll(() => {
  7 + // Presets an action, which is performed only once before all test cases of the test suite start.
  8 + // This API supports only one parameter: preset action function.
  9 + });
  10 + beforeEach(() => {
  11 + // Presets an action, which is performed before each unit test case starts.
  12 + // The number of execution times is the same as the number of test cases defined by **it**.
  13 + // This API supports only one parameter: preset action function.
  14 + });
  15 + afterEach(() => {
  16 + // Presets a clear action, which is performed after each unit test case ends.
  17 + // The number of execution times is the same as the number of test cases defined by **it**.
  18 + // This API supports only one parameter: clear action function.
  19 + });
  20 + afterAll(() => {
  21 + // Presets a clear action, which is performed after all test cases of the test suite end.
  22 + // This API supports only one parameter: clear action function.
  23 + });
  24 + it('assertContain', 0, () => {
  25 + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
  26 + let a = 'abc';
  27 + let b = 'b';
  28 + // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
  29 + expect(a).assertContain(b);
  30 + expect(a).assertEqual(a);
  31 + });
  32 + });
  33 +}
This file is too large to display.
  1 +/**
  2 + * @Description: 广告扩展信息的解析模型
  3 + * @Author:
  4 + * @Email: liyubing@wondertek.com.cn
  5 + * @CreateDate:
  6 + * @UpdateRemark: 更新说明
  7 + * @Version: 1.0
  8 + */
  9 +export interface AdvExtraData {
  10 +
  11 +
  12 + itemTopImage: string;
  13 + itemMore: AdvExtraItemData;
  14 + item: AdvExtraItemData[]
  15 +
  16 +}
  17 +
  18 +export interface AdvExtraItemData {
  19 +/**
  20 + * 图片地址
  21 + */
  22 + image: string;
  23 + /**
  24 + * 标题
  25 + */
  26 + title: string ;
  27 + /**
  28 + * 跳转地址
  29 + */
  30 + linkUrl: string;
  31 + /**
  32 + * 跳转类型
  33 + */
  34 + linkType: string;
  35 +
  36 +}
@@ -2,11 +2,11 @@ @@ -2,11 +2,11 @@
2 * 批查接口查询互动相关数据,返回数据bean 2 * 批查接口查询互动相关数据,返回数据bean
3 */ 3 */
4 export interface InteractDataDTO { 4 export interface InteractDataDTO {
5 - collectNum: number | String;  
6 - commentNum: number | String; 5 + collectNum: number | string;
  6 + commentNum: number | string;
7 contentId: string; 7 contentId: string;
8 contentType: number; 8 contentType: number;
9 - likeNum: number | String; 9 + likeNum: number | string;
10 readNum: number; 10 readNum: number;
11 shareNum: number; 11 shareNum: number;
12 } 12 }
@@ -47,46 +47,64 @@ export struct CompParser { @@ -47,46 +47,64 @@ export struct CompParser {
47 // if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 47 // if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
48 if (compDTO.compStyle === CompStyle.Label_03) { 48 if (compDTO.compStyle === CompStyle.Label_03) {
49 LabelComponent({ compDTO: compDTO }) 49 LabelComponent({ compDTO: compDTO })
  50 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
50 } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { 51 } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
51 ZhCarouselLayout01({ compDTO: compDTO }) 52 ZhCarouselLayout01({ compDTO: compDTO })
  53 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
52 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) { 54 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {
53 LiveHorizontalCardComponent({ compDTO: compDTO }) 55 LiveHorizontalCardComponent({ compDTO: compDTO })
  56 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
54 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { 57 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
55 if (compDTO.operDataList.length > 1) { 58 if (compDTO.operDataList.length > 1) {
56 HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO }) 59 HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
57 } else { 60 } else {
58 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) 61 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
59 } 62 }
  63 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
60 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { 64 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
61 ZhSingleRow02({ compDTO }) 65 ZhSingleRow02({ compDTO })
  66 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
62 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { 67 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
63 ZhSingleRow03({ compDTO: compDTO }) 68 ZhSingleRow03({ compDTO: compDTO })
  69 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
64 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { 70 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
65 ZhGridLayout02({ compDTO: compDTO }) 71 ZhGridLayout02({ compDTO: compDTO })
  72 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
66 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { 73 } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
67 ZhGridLayout03({ compDTO: compDTO }) 74 ZhGridLayout03({ compDTO: compDTO })
  75 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
68 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { 76 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
69 ZhSingleRow04({ compDTO: compDTO }) 77 ZhSingleRow04({ compDTO: compDTO })
  78 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
70 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) { 79 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
71 ZhSingleRow05({ compDTO }) 80 ZhSingleRow05({ compDTO })
  81 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
72 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { 82 } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
73 ZhSingleRow06({ compDTO }) 83 ZhSingleRow06({ compDTO })
  84 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
74 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { 85 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
75 //头图卡 和comStyle 2相同, 86 //头图卡 和comStyle 2相同,
76 Card5Component({ contentDTO: compDTO.operDataList[0] }) 87 Card5Component({ contentDTO: compDTO.operDataList[0] })
  88 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
77 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { 89 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
78 // 大图卡 90 // 大图卡
79 Card2Component({ contentDTO: compDTO.operDataList[0] }) 91 Card2Component({ contentDTO: compDTO.operDataList[0] })
  92 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
80 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { 93 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
81 ZhSingleColumn04({ compDTO: compDTO }) 94 ZhSingleColumn04({ compDTO: compDTO })
  95 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
82 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { 96 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
83 - ZhSingleColumn05({ compDTO: compDTO }) 97 + // ZhSingleColumn05({ compDTO: compDTO })
  98 + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
84 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) { 99 } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
85 ZhSingleColumn09({ compDTO }) 100 ZhSingleColumn09({ compDTO })
  101 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
86 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 102 } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
87 AdvCardParser({compDTO}) 103 AdvCardParser({compDTO})
  104 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
88 } else if (!Number.isNaN(Number(compDTO.compStyle))) { 105 } else if (!Number.isNaN(Number(compDTO.compStyle))) {
89 CardParser({ contentDTO: compDTO.operDataList[0] }); 106 CardParser({ contentDTO: compDTO.operDataList[0] });
  107 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
90 } 108 }
91 else { 109 else {
92 Text(compDTO.compStyle) 110 Text(compDTO.compStyle)
@@ -97,8 +115,8 @@ export struct CompParser { @@ -97,8 +115,8 @@ export struct CompParser {
97 WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) 115 WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
98 } 116 }
99 }) 117 })
  118 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
100 } 119 }
101 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })  
102 } 120 }
103 121
104 // } 122 // }
@@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base'; @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base';
25 import { CommonConstants, SpConstants } from 'wdConstant/Index'; 25 import { CommonConstants, SpConstants } from 'wdConstant/Index';
26 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' 26 import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo'
27 import router from '@ohos.router'; 27 import router from '@ohos.router';
  28 +import { publishCommentModel } from './comment/model/PublishCommentModel';
  29 +import { CommentComponent } from './comment/view/CommentComponent';
  30 +
28 const TAG = 'DynamicDetailComponent' 31 const TAG = 'DynamicDetailComponent'
29 @Preview 32 @Preview
30 @Component 33 @Component
@@ -50,6 +53,8 @@ export struct DynamicDetailComponent { @@ -50,6 +53,8 @@ export struct DynamicDetailComponent {
50 //跳转 53 //跳转
51 private mJumpInfo: ContentDTO = {} as ContentDTO; 54 private mJumpInfo: ContentDTO = {} as ContentDTO;
52 55
  56 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  57 +
53 async aboutToAppear() { 58 async aboutToAppear() {
54 await this.getContentDetailData() 59 await this.getContentDetailData()
55 } 60 }
@@ -355,8 +360,14 @@ export struct DynamicDetailComponent { @@ -355,8 +360,14 @@ export struct DynamicDetailComponent {
355 //点赞操作 360 //点赞操作
356 this.toggleLikeStatus() 361 this.toggleLikeStatus()
357 }) 362 })
  363 + // 评论
  364 + if (this.contentDetailData?.openComment) {
  365 + Divider().strokeWidth(6).color('#f5f5f5')
  366 + CommentComponent({
  367 + publishCommentModel: this.publishCommentModel
  368 + })
  369 + }
358 Blank().layoutWeight(1) 370 Blank().layoutWeight(1)
359 - //fixme 评论组件  
360 } 371 }
361 } 372 }
362 .width(CommonConstants.FULL_WIDTH) 373 .width(CommonConstants.FULL_WIDTH)
@@ -365,42 +376,11 @@ export struct DynamicDetailComponent { @@ -365,42 +376,11 @@ export struct DynamicDetailComponent {
365 .scrollBar(BarState.Off) 376 .scrollBar(BarState.Off)
366 .alignSelf(ItemAlign.Start) 377 .alignSelf(ItemAlign.Start)
367 //底部交互区 378 //底部交互区
368 - Row() {  
369 - Image($r('app.media.icon_arrow_left'))  
370 - .width(24)  
371 - .height(24)  
372 - .onClick((event: ClickEvent) => {  
373 - router.back()  
374 - })  
375 -  
376 - Row() {  
377 - Image($r('app.media.icon_comment'))  
378 - .width(24)  
379 - .height(24)  
380 - .margin({ right: 24 })  
381 - .id('comment')  
382 -  
383 - Image($r('app.media.icon_star'))  
384 - .width(24)  
385 - .height(24)  
386 - .margin({ right: 24 })  
387 -  
388 - Image($r('app.media.icon_listen'))  
389 - .width(24)  
390 - .height(24)  
391 - .margin({ right: 24 })  
392 -  
393 - Image($r('app.media.icon_forward'))  
394 - .width(24)  
395 - .height(24)  
396 -  
397 - }  
398 - }  
399 - .width(CommonConstants.FULL_WIDTH)  
400 - .height(56)  
401 - .padding({ left: 15, right: 15, bottom: 50, top: 20 })  
402 - .justifyContent(FlexAlign.SpaceBetween)  
403 - .backgroundColor(Color.White) 379 + OperRowListView({ contentDetailData: this.contentDetailData
  380 + ,interactData:this.interactDataDTO
  381 + ,newsStatusOfUser:this.newsStatusOfUser
  382 + ,publishCommentModel: this.publishCommentModel
  383 + ,needLike:false})
404 } 384 }
405 } 385 }
406 .alignSelf(ItemAlign.Start) 386 .alignSelf(ItemAlign.Start)
@@ -419,6 +399,17 @@ export struct DynamicDetailComponent { @@ -419,6 +399,17 @@ export struct DynamicDetailComponent {
419 } catch (exception) { 399 } catch (exception) {
420 console.log('请求失败',JSON.stringify(exception)) 400 console.log('请求失败',JSON.stringify(exception))
421 } 401 }
  402 + if (this.contentDetailData.openComment) {
  403 + this.publishCommentModel = {
  404 + targetId: String(this.contentDetailData?.newsId || ''),
  405 + targetRelId: this.contentDetailData?.reLInfo?.relId,
  406 + targetTitle: this.contentDetailData?.newsTitle,
  407 + targetRelType: this.contentDetailData?.reLInfo?.relType,
  408 + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
  409 + keyArticle: String(this.contentDetailData?.keyArticle),
  410 + targetType: String(this.contentDetailData?.newsType),
  411 + } as publishCommentModel
  412 + }
422 this.getBatchAttentionStatus() 413 this.getBatchAttentionStatus()
423 this.getInteractDataStatus() 414 this.getInteractDataStatus()
424 this.makeJumpInfo() 415 this.makeJumpInfo()
@@ -38,7 +38,8 @@ export struct ImageAndTextPageComponent { @@ -38,7 +38,8 @@ export struct ImageAndTextPageComponent {
38 @State interactData: InteractDataDTO = {} as InteractDataDTO 38 @State interactData: InteractDataDTO = {} as InteractDataDTO
39 @State isPageEnd: boolean = false 39 @State isPageEnd: boolean = false
40 @State publishTime: string = '' 40 @State publishTime: string = ''
41 - @State publishCommentModel: publishCommentModel = {} as publishCommentModel 41 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  42 + @State operationButtonList: string[] = ['comment', 'collect', 'share']
42 43
43 build() { 44 build() {
44 Column() { 45 Column() {
@@ -142,7 +143,11 @@ export struct ImageAndTextPageComponent { @@ -142,7 +143,11 @@ export struct ImageAndTextPageComponent {
142 143
143 //底部交互区 144 //底部交互区
144 if (this.contentDetailData?.length) { 145 if (this.contentDetailData?.length) {
145 - OperRowListView({ contentDetailData: this.contentDetailData[0] }) 146 + OperRowListView({
  147 + contentDetailData: this.contentDetailData[0],
  148 + publishCommentModel: this.publishCommentModel,
  149 + operationButtonList: this.operationButtonList,
  150 + })
146 } 151 }
147 } 152 }
148 153
@@ -181,15 +186,16 @@ export struct ImageAndTextPageComponent { @@ -181,15 +186,16 @@ export struct ImageAndTextPageComponent {
181 this.queryContentInteractCount() 186 this.queryContentInteractCount()
182 } 187 }
183 if (this.contentDetailData[0]?.openComment) { 188 if (this.contentDetailData[0]?.openComment) {
184 - this.publishCommentModel = {  
185 - targetId: String(this.contentDetailData[0]?.newsId || ''),  
186 - targetRelId: this.contentDetailData[0]?.reLInfo?.relId,  
187 - targetTitle: this.contentDetailData[0]?.newsTitle,  
188 - targetRelType: this.contentDetailData[0]?.reLInfo?.relType,  
189 - targetRelObjectId: String(this.contentDetailData[0]?.reLInfo?.relObjectId),  
190 - keyArticle: String(this.contentDetailData[0]?.keyArticle),  
191 - targetType: String(this.contentDetailData[0]?.newsType),  
192 - } as publishCommentModel 189 + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
  190 + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
  191 + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
  192 + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
  193 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
  194 + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
  195 + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
  196 + }
  197 + if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) {
  198 + this.operationButtonList = ['comment', 'collect', 'listen', 'share']
193 } 199 }
194 } 200 }
195 } 201 }
@@ -197,11 +203,10 @@ export struct ImageAndTextPageComponent { @@ -197,11 +203,10 @@ export struct ImageAndTextPageComponent {
197 203
198 private async getRecommend() { 204 private async getRecommend() {
199 let params: postRecommendListParams = { 205 let params: postRecommendListParams = {
200 - // TODO ? imei: HttpUtils.getImei()  
201 - imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", 206 + imei: HttpUtils.getImei(),
202 userId: HttpUtils.getUserId(), 207 userId: HttpUtils.getUserId(),
203 contentId: String(this.contentDetailData[0]?.newsId), 208 contentId: String(this.contentDetailData[0]?.newsId),
204 - recType: 1, 209 + recType: Number(this.contentDetailData[0]?.reLInfo?.relType),
205 contentType: this.contentDetailData[0]?.newsType, 210 contentType: this.contentDetailData[0]?.newsType,
206 relId: this.contentDetailData[0]?.reLInfo?.relId, 211 relId: this.contentDetailData[0]?.reLInfo?.relId,
207 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId) 212 channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
@@ -119,7 +119,7 @@ export struct ImageAndTextWebComponent { @@ -119,7 +119,7 @@ export struct ImageAndTextWebComponent {
119 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { 119 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
120 Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData'); 120 Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
121 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, 121 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
122 - JSON.stringify(h5ReceiveAppData), (data: string) => { 122 + h5ReceiveAppData, (data: string) => {
123 Logger.debug('ImageAndTextWebComponent', "from js data = " + data); 123 Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
124 }) 124 })
125 } 125 }
@@ -152,6 +152,8 @@ export struct MorningEveningPaperComponent { @@ -152,6 +152,8 @@ export struct MorningEveningPaperComponent {
152 if (imageSource) { 152 if (imageSource) {
153 this.pickColor(imageSource) 153 this.pickColor(imageSource)
154 154
  155 + } else {
  156 + this.mixedBgColor = this.pageInfoBean.backgroundColor
155 } 157 }
156 158
157 } 159 }
@@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton' @@ -7,6 +7,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'
7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type'; 7 import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
8 import { OperRowListView } from './view/OperRowListView'; 8 import { OperRowListView } from './view/OperRowListView';
9 import DetailViewModel from '../viewmodel/DetailViewModel'; 9 import DetailViewModel from '../viewmodel/DetailViewModel';
  10 +import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
10 11
11 const TAG: string = 'SpacialTopicPageComponent' 12 const TAG: string = 'SpacialTopicPageComponent'
12 13
@@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent { @@ -21,6 +22,7 @@ export struct SpacialTopicPageComponent {
21 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 22 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
22 private webPrepared = false; 23 private webPrepared = false;
23 private dataPrepared = false; 24 private dataPrepared = false;
  25 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
24 26
25 private trySendData2H5() { 27 private trySendData2H5() {
26 if (!this.webPrepared || !this.dataPrepared) { 28 if (!this.webPrepared || !this.dataPrepared) {
@@ -37,7 +39,7 @@ export struct SpacialTopicPageComponent { @@ -37,7 +39,7 @@ export struct SpacialTopicPageComponent {
37 39
38 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) { 40 private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
39 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData, 41 this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
40 - JSON.stringify(h5ReceiveAppData), (data: string) => { 42 + h5ReceiveAppData, (data: string) => {
41 }) 43 })
42 } 44 }
43 45
@@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent { @@ -61,6 +63,15 @@ export struct SpacialTopicPageComponent {
61 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 63 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
62 if (detailBeans && detailBeans.length > 0) { 64 if (detailBeans && detailBeans.length > 0) {
63 this.contentDetailData = detailBeans; 65 this.contentDetailData = detailBeans;
  66 + if (this.contentDetailData[0]?.openComment) {
  67 + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
  68 + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
  69 + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
  70 + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
  71 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
  72 + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
  73 + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
  74 + }
64 this.trySendData2H5() 75 this.trySendData2H5()
65 } 76 }
66 } 77 }
@@ -80,13 +91,16 @@ export struct SpacialTopicPageComponent { @@ -80,13 +91,16 @@ export struct SpacialTopicPageComponent {
80 } 91 }
81 .width(CommonConstants.FULL_WIDTH) 92 .width(CommonConstants.FULL_WIDTH)
82 .height(CommonConstants.FULL_HEIGHT) 93 .height(CommonConstants.FULL_HEIGHT)
83 - .padding({ bottom: 126 }) 94 + // .padding({ bottom: 76 })
84 95
85 if (!this.isPageEnd) { 96 if (!this.isPageEnd) {
86 detailedSkeleton() 97 detailedSkeleton()
87 } 98 }
88 //底部交互区 99 //底部交互区
89 - OperRowListView({ contentDetailData: this.contentDetailData[0] }) 100 + OperRowListView({
  101 + contentDetailData: this.contentDetailData[0],
  102 + publishCommentModel: this.publishCommentModel
  103 + })
90 } 104 }
91 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 105 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
92 } 106 }
@@ -3,10 +3,12 @@ @@ -3,10 +3,12 @@
3 */ 3 */
4 import { RmhInfoDTO } from 'wdBean' 4 import { RmhInfoDTO } from 'wdBean'
5 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
  6 +import { DateTimeUtils } from 'wdKit';
6 7
7 @Component 8 @Component
8 export struct RmhTitle { 9 export struct RmhTitle {
9 @Prop rmhInfo: RmhInfoDTO 10 @Prop rmhInfo: RmhInfoDTO
  11 + @Prop publishTime: string | undefined
10 12
11 build() { 13 build() {
12 Flex() { 14 Flex() {
@@ -29,12 +31,22 @@ export struct RmhTitle { @@ -29,12 +31,22 @@ export struct RmhTitle {
29 .fontColor($r('app.color.color_222222')) 31 .fontColor($r('app.color.color_222222'))
30 .fontWeight(600) 32 .fontWeight(600)
31 .alignSelf(ItemAlign.Start) 33 .alignSelf(ItemAlign.Start)
32 - Text(this.rmhInfo.rmhDesc)  
33 - .fontSize($r("app.float.font_size_12"))  
34 - .fontColor($r("app.color.color_B0B0B0"))  
35 - .maxLines(1)  
36 - .alignSelf(ItemAlign.Start)  
37 - .textOverflow({ overflow: TextOverflow.Ellipsis }) 34 + Row() {
  35 + if (this.publishTime) {
  36 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
  37 + .fontSize($r("app.float.font_size_12"))
  38 + .fontColor($r("app.color.color_B0B0B0"))
  39 + Image($r('app.media.point'))
  40 + .width(16)
  41 + .height(16)
  42 + }
  43 + Text(this.rmhInfo.rmhDesc)
  44 + .fontSize($r("app.float.font_size_12"))
  45 + .fontColor($r("app.color.color_B0B0B0"))
  46 + .maxLines(1)
  47 + .alignSelf(ItemAlign.Start)
  48 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  49 + }
38 } 50 }
39 51
40 Blank() 52 Blank()
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean'; 1 +import { CompDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 2 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 4 +import { CardAdvBottom } from './CardAdvBottom';
7 5
8 const TAG: string = 'Card2Component'; 6 const TAG: string = 'Card2Component';
9 7
10 -/**  
11 - * @Description: 广告---大图卡  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 8 +/**
  9 + * @Description: 广告---大图卡
  10 + * @Author:
  11 + * @Email: liyubing@wondertek.com.cn
  12 + * @CreateDate:
  13 + * @UpdateRemark: 更新说明
  14 + * @Version: 1.0
17 */ 15 */
18 @Component 16 @Component
19 export struct CardAdvBigImageComponent { 17 export struct CardAdvBigImageComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 18 @State compDTO: CompDTO = {} as CompDTO
22 19
  20 +
23 aboutToAppear(): void { 21 aboutToAppear(): void {
24 22
25 console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----') 23 console.error('ZZZXXXXX', '----大图卡----aboutToAppear-----')
  24 +
  25 +
26 } 26 }
27 27
28 aboutToDisappear(): void { 28 aboutToDisappear(): void {
@@ -33,12 +33,21 @@ export struct CardAdvBigImageComponent { @@ -33,12 +33,21 @@ export struct CardAdvBigImageComponent {
33 build() { 33 build() {
34 34
35 Column() { 35 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 36 +
  37 + //新闻标题
  38 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
  39 + //大图
  40 + Image(this.compDTO.matInfo.matImageUrl[0])
  41 + .width(CommonConstants.FULL_WIDTH)
  42 + .aspectRatio(16 / 9)
  43 + .borderRadius(4)
  44 + .borderWidth(0.5)
  45 + .borderColor($r('app.color.color_0D000000'))
  46 + .width(CommonConstants.FULL_WIDTH)
  47 +
  48 + CardAdvBottom().margin({
  49 + top: 8,
  50 + })
42 } 51 }
43 .width(CommonConstants.FULL_WIDTH) 52 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 53 .padding({
@@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent { @@ -48,13 +57,21 @@ export struct CardAdvBigImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 57 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 58 })
50 .onClick((event: ClickEvent) => { 59 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 60 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 61 })
53 } 62 }
54 } 63 }
55 64
  65 +/*
  66 + 标题样式
  67 + */
56 @Extend(Text) 68 @Extend(Text)
57 function bottomTextStyle() { 69 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 70 + .fontSize('18fp')
  71 + .fontColor($r('app.color.color_222222'))
  72 + .maxLines(3)
  73 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  74 + .align(Alignment.Start)
  75 + .width('100%')
  76 + .lineHeight(25)
60 } 77 }
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
  3 +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
  4 +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
3 import { CommonConstants } from 'wdConstant/Index'; 5 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 6 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 7 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
@@ -7,22 +9,30 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' @@ -7,22 +9,30 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
7 9
8 const TAG: string = 'Card2Component'; 10 const TAG: string = 'Card2Component';
9 11
10 -/**  
11 - * @Description: 广告---冠名广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 12 +/**
  13 + * @Description: 广告---冠名广告
  14 + * @Author:
  15 + * @Email: liyubing@wondertek.com.cn
  16 + * @CreateDate:
  17 + * @UpdateRemark: 更新说明
  18 + * @Version: 1.0
17 */ 19 */
18 @Component 20 @Component
19 export struct CardAdvGanMiComponent { 21 export struct CardAdvGanMiComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 22 @State compDTO: CompDTO = {} as CompDTO
  23 + @State advExtraData: AdvExtraData = {} as AdvExtraData
  24 + @State advLength: number = 0;
22 25
23 aboutToAppear(): void { 26 aboutToAppear(): void {
24 27
25 console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----') 28 console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----')
  29 +
  30 + let extraData = this.compDTO.matInfo.extraData
  31 + let labelDTO = JSON.parse(extraData) as AdvExtraData
  32 + this.advExtraData = labelDTO
  33 + //this.advExtraData.item = [this.advExtraData.item[0]]
  34 + // this.advExtraData.item[2].title ="我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国我爱你中国"
  35 + this.advLength = this.advExtraData.item.length
26 } 36 }
27 37
28 aboutToDisappear(): void { 38 aboutToDisappear(): void {
@@ -33,28 +43,160 @@ export struct CardAdvGanMiComponent { @@ -33,28 +43,160 @@ export struct CardAdvGanMiComponent {
33 build() { 43 build() {
34 44
35 Column() { 45 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 46 +
  47 +
  48 + Row() {
  49 + Stack() {
  50 + //长图
  51 + Image(this.advExtraData.itemTopImage)
  52 + .width(CommonConstants.FULL_WIDTH)
  53 + .aspectRatio(343 / 40)
  54 + .borderRadius(4)
  55 + .borderWidth(0.5)
  56 + .borderColor($r('app.color.color_0D000000'))
  57 +
  58 + // 广告标签和删除功能
  59 + Row() {
  60 + Text($r('app.string.comp_advertisement'))
  61 + .fontSize('10fp')
  62 + .fontColor($r('app.color.white'))
  63 + .width(28)
  64 + .height(16)
  65 + .backgroundColor('#4D000000')
  66 + .borderRadius(3)
  67 + .textAlign(TextAlign.Center)
  68 +
  69 + Blank()
  70 +
  71 + Stack() {
  72 + Image($r('app.media.comp_adv_close_white'))
  73 + .width(9)
  74 + .height(9)
  75 + .borderRadius({
  76 + topLeft: '4vp',
  77 + topRight: '4vp',
  78 + bottomLeft: '4vp',
  79 + bottomRight: '4vp'
  80 + })
  81 + }
  82 + .width(18)
  83 + .height(14)
  84 + .backgroundColor('#4D000000')
  85 + .borderWidth(0.5)
  86 + .borderColor($r('app.color.white'))
  87 + .borderRadius(3)
  88 +
  89 + }.width('100%').padding({
  90 + top: 8,
  91 + left: 8,
  92 + right: 8
  93 + })
  94 + }
  95 + .alignContent(Alignment.Top)
  96 + .width(CommonConstants.FULL_WIDTH)
  97 + }.width('100%').padding({
  98 + left: $r('app.float.card_comp_pagePadding_lf'),
  99 + right: $r('app.float.card_comp_pagePadding_lf'),
  100 + })
  101 +
  102 +
  103 + //
  104 + List({ space: 8 }) {
  105 +
  106 + ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
  107 +
  108 + ListItem() {
  109 + // 广告列表信息
  110 + Column() {
  111 +
  112 + Image(content.image)
  113 + .width('100%')
  114 + .aspectRatio(150 / 84)
  115 + .borderWidth(0.5)
  116 + .borderColor($r('app.color.color_0D000000'))
  117 + .borderRadius(4)
  118 +
  119 + Text(content.title)
  120 + .fontSize('16fp')
  121 + .fontColor($r('app.color.color_222222'))
  122 + .fontSize('15fp')
  123 + .maxLines(3)
  124 + .lineHeight(20)
  125 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  126 + .width('100%')
  127 + .margin({ top: 8 })
  128 +
  129 + }.width(this.advLength >= 3 ? 150 : this.advLength == 2 ? 210 : '100%').onClick(() => {
  130 +
  131 + let matInfo: CompAdvMatInfoBean = {
  132 + linkUrl: content.linkUrl,
  133 + linkType: content.linkType
  134 + } as CompAdvMatInfoBean;
  135 + ProcessUtils.openAdvDetail(matInfo)
  136 +
  137 + })
  138 +
  139 + }
  140 +
  141 + })
  142 +
  143 + }
  144 + .width('100%')
  145 + .listDirection(Axis.Horizontal)
  146 + .edgeEffect(EdgeEffect.None)
  147 + .scrollBar(BarState.Off)
  148 + .contentStartOffset(this.advLength == 1 ? 0 : 16)
  149 + .contentEndOffset(this.advLength == 1 ? 0 : 16)
  150 + .margin({ top: 10, bottom: 10 })
  151 + .padding({
  152 + left: this.advLength == 1 ? 16 : 0,
  153 + right: this.advLength == 1 ? 16 : 0,
  154 + })
  155 +
  156 +
  157 + // 更多按钮
  158 + commonButton(this.advExtraData)
  159 +
42 } 160 }
43 .width(CommonConstants.FULL_WIDTH) 161 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 162 .padding({
45 - left: $r('app.float.card_comp_pagePadding_lf'),  
46 - right: $r('app.float.card_comp_pagePadding_lf'),  
47 top: $r('app.float.card_comp_pagePadding_tb'), 163 top: $r('app.float.card_comp_pagePadding_tb'),
48 bottom: $r('app.float.card_comp_pagePadding_tb') 164 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 165 })
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - }) 166 +
53 } 167 }
54 } 168 }
55 169
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 170 +/*
  171 + 标题样式
  172 + */
  173 +@Builder
  174 +function commonButton(advExtraData: AdvExtraData) {
  175 +
  176 +
  177 + Row() {
  178 + Row() {
  179 + Blank()
  180 + Text('查看更多').fontColor('#222222').fontSize('14fp')
  181 + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
  182 + Blank()
  183 +
  184 + }
  185 + .width('100%')
  186 + .backgroundColor('#F5F5F5')
  187 + .borderRadius(3)
  188 + .padding({ top: 10, bottom: 10, })
  189 + .onClick(() => {
  190 + let matInfo: CompAdvMatInfoBean = {
  191 + linkUrl: advExtraData.itemMore.linkUrl,
  192 + linkType: advExtraData.itemMore.linkType
  193 + } as CompAdvMatInfoBean;
  194 + ProcessUtils.openAdvDetail(matInfo)
  195 + })
  196 + }.width('100%').padding({
  197 + left: $r('app.float.card_comp_pagePadding_lf'),
  198 + right: $r('app.float.card_comp_pagePadding_lf'),
  199 +
  200 + })
  201 +
60 } 202 }
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 import { CompDTO, ContentDTO } from 'wdBean'; 2 import { CompDTO, ContentDTO } from 'wdBean';
3 -import { CommonConstants } from 'wdConstant/Index'; 3 +import { CommonConstants, CompStyle } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  7 +import { CardAdvBottom } from './CardAdvBottom';
7 8
8 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
9 10
10 -/**  
11 - * @Description: 广告---长通栏广告 和 顶部长通栏广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 11 +/**
  12 + * @Description: 广告---长通栏广告 和 顶部长通栏广告
  13 + * @Author:
  14 + * @Email: liyubing@wondertek.com.cn
  15 + * @CreateDate:
  16 + * @UpdateRemark: 更新说明
  17 + * @Version: 1.0
17 */ 18 */
18 @Component 19 @Component
19 export struct CardAdvLongImageComponent { 20 export struct CardAdvLongImageComponent {
20 21
  22 +
21 @State compDTO: CompDTO = {} as CompDTO 23 @State compDTO: CompDTO = {} as CompDTO
22 24
  25 + @State haveTitle : boolean = true
  26 +
23 aboutToAppear(): void { 27 aboutToAppear(): void {
24 28
25 console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----') 29 console.error('ZZZXXXXX', '--长通栏广告 和 顶部长通栏广告------aboutToAppear-----')
  30 +
  31 + this.haveTitle = this.compDTO.matInfo.advSubType === CompStyle.Card_Adv_7;
26 } 32 }
27 33
28 aboutToDisappear(): void { 34 aboutToDisappear(): void {
@@ -33,12 +39,23 @@ export struct CardAdvLongImageComponent { @@ -33,12 +39,23 @@ export struct CardAdvLongImageComponent {
33 build() { 39 build() {
34 40
35 Column() { 41 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 42 +
  43 + //新闻标题
  44 + if(this.haveTitle ){
  45 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle().margin({ bottom: 8, })
  46 + }
  47 +
  48 + //长图
  49 + Image(this.compDTO.matInfo.matImageUrl[0])
  50 + .width(CommonConstants.FULL_WIDTH)
  51 + .aspectRatio(343 / 96)
  52 + .borderRadius(4)
  53 + .borderWidth(0.5)
  54 + .borderColor($r('app.color.color_0D000000'))
  55 +
  56 + CardAdvBottom().margin({
  57 + top: 8,
  58 + })
42 } 59 }
43 .width(CommonConstants.FULL_WIDTH) 60 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 61 .padding({
@@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent { @@ -48,13 +65,20 @@ export struct CardAdvLongImageComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 65 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 66 })
50 .onClick((event: ClickEvent) => { 67 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 68 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 69 })
53 } 70 }
54 } 71 }
55 72
  73 +/*
  74 + 标题样式
  75 + */
56 @Extend(Text) 76 @Extend(Text)
57 function bottomTextStyle() { 77 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 78 + .fontSize('18fp')
  79 + .fontColor($r('app.color.color_222222'))
  80 + .maxLines(3)
  81 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  82 + .align(Alignment.Start)
  83 + .lineHeight(25)
60 } 84 }
@@ -62,6 +62,7 @@ export struct CardAdvSmallImageComponent { @@ -62,6 +62,7 @@ export struct CardAdvSmallImageComponent {
62 .borderWidth(0.5) 62 .borderWidth(0.5)
63 .borderColor($r('app.color.color_0D000000')) 63 .borderColor($r('app.color.color_0D000000'))
64 .borderRadius(4) 64 .borderRadius(4)
  65 + //.alt('wwww.baidu.com')
65 .alignRules({ 66 .alignRules({
66 top: { anchor: 'title_name', align: VerticalAlign.Top }, 67 top: { anchor: 'title_name', align: VerticalAlign.Top },
67 left: { anchor: 'title_name', align: HorizontalAlign.End }, 68 left: { anchor: 'title_name', align: HorizontalAlign.End },
1 //全标题 "appStyle":"2", 1 //全标题 "appStyle":"2",
2 -import { CompDTO, ContentDTO } from 'wdBean'; 2 +import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo' 5 import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo' 6 import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
  7 +import { CardAdvBottom } from './CardAdvBottom';
7 8
8 const TAG: string = 'Card2Component'; 9 const TAG: string = 'Card2Component';
9 10
10 -/**  
11 - * @Description: 广告---视频广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 11 +/**
  12 + * @Description: 广告---视频广告
  13 + * @Author:
  14 + * @Email: liyubing@wondertek.com.cn
  15 + * @CreateDate:
  16 + * @UpdateRemark: 更新说明
  17 + * @Version: 1.0
17 */ 18 */
18 @Component 19 @Component
19 export struct CardAdvVideoComponent { 20 export struct CardAdvVideoComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 21 @State compDTO: CompDTO = {} as CompDTO
  22 + @State contentDTO: ContentDTO = {} as ContentDTO
22 23
23 aboutToAppear(): void { 24 aboutToAppear(): void {
24 -  
25 console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----') 25 console.error('ZZZXXXXX', '--视频广告------aboutToAppear-----')
  26 +
  27 +
  28 + // this.contentDTO.objectType = '1'
  29 + // this.contentDTO.videoInfo = { videoDuration: 1000 } as VideoInfoDTO
26 } 30 }
27 31
28 aboutToDisappear(): void { 32 aboutToDisappear(): void {
@@ -33,12 +37,29 @@ export struct CardAdvVideoComponent { @@ -33,12 +37,29 @@ export struct CardAdvVideoComponent {
33 build() { 37 build() {
34 38
35 Column() { 39 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 40 +
  41 + //新闻标题
  42 + Text(this.compDTO.matInfo.advTitle).bottomTextStyle()
  43 + //大图
  44 + Stack() {
  45 + Image(this.compDTO.matInfo.matImageUrl[0])
  46 + .width(CommonConstants.FULL_WIDTH)
  47 + .aspectRatio(16 / 9)
  48 + .borderRadius(4)
  49 + .borderWidth(0.5)
  50 + .borderColor($r('app.color.color_0D000000'))
  51 + //播放状态+时长
  52 + CardMediaInfo({
  53 + contentDTO: this.contentDTO
  54 + })
  55 + }
  56 + .alignContent(Alignment.BottomEnd)
  57 + .width(CommonConstants.FULL_WIDTH)
  58 + .margin({ top: 8 })
  59 +
  60 + CardAdvBottom().margin({
  61 + top: 8,
  62 + })
42 } 63 }
43 .width(CommonConstants.FULL_WIDTH) 64 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 65 .padding({
@@ -48,13 +69,21 @@ export struct CardAdvVideoComponent { @@ -48,13 +69,21 @@ export struct CardAdvVideoComponent {
48 bottom: $r('app.float.card_comp_pagePadding_tb') 69 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 70 })
50 .onClick((event: ClickEvent) => { 71 .onClick((event: ClickEvent) => {
51 - //ProcessUtils.processPage(this.contentDTO) 72 + ProcessUtils.openAdvDetail(this.compDTO.matInfo)
52 }) 73 })
53 } 74 }
54 } 75 }
55 76
  77 +/*
  78 + 标题样式
  79 + */
56 @Extend(Text) 80 @Extend(Text)
57 function bottomTextStyle() { 81 function bottomTextStyle() {
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 82 + .fontSize('18fp')
  83 + .fontColor($r('app.color.color_222222'))
  84 + .maxLines(3)
  85 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  86 + .align(Alignment.Start)
  87 + .width('100%')
  88 + .lineHeight(25)
60 } 89 }
1 -//全标题 "appStyle":"2",  
2 -import { CompDTO, ContentDTO } from 'wdBean'; 1 +import { CompDTO } from 'wdBean';
  2 +import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
  3 +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
3 import { CommonConstants } from 'wdConstant/Index'; 4 import { CommonConstants } from 'wdConstant/Index';
4 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
5 -import { CardMediaInfo } from '../cardCommon/CardMediaInfo'  
6 -import { CardSourceInfo } from '../cardCommon/CardSourceInfo'  
7 6
8 const TAG: string = 'Card2Component'; 7 const TAG: string = 'Card2Component';
9 8
10 -/**  
11 - * @Description: 广告---冠名广告  
12 - * @Author:  
13 - * @Email: liyubing@wondertek.com.cn  
14 - * @CreateDate:  
15 - * @UpdateRemark: 更新说明  
16 - * @Version: 1.0 9 +/**
  10 + * @Description: 广告---展会广告
  11 + * @Author:
  12 + * @Email: liyubing@wondertek.com.cn
  13 + * @CreateDate:
  14 + * @UpdateRemark: 更新说明
  15 + * @Version: 1.0
17 */ 16 */
18 @Component 17 @Component
19 export struct CardAdvVideoExComponent { 18 export struct CardAdvVideoExComponent {
20 -  
21 @State compDTO: CompDTO = {} as CompDTO 19 @State compDTO: CompDTO = {} as CompDTO
  20 + @State advExtraData: AdvExtraData = {} as AdvExtraData
22 21
23 aboutToAppear(): void { 22 aboutToAppear(): void {
24 23
25 - console.error('ZZZXXXXX', '--冠名广告------aboutToAppear-----') 24 + console.error('ZZZXXXXX', '--展会广告------aboutToAppear-----')
  25 +
  26 + let extraData = this.compDTO.matInfo.extraData
  27 + let labelDTO = JSON.parse(extraData) as AdvExtraData
  28 + this.advExtraData = labelDTO
26 } 29 }
27 30
28 aboutToDisappear(): void { 31 aboutToDisappear(): void {
29 32
30 - console.error('ZZZXXXXX', '----冠名广告----aboutToDisappear-----') 33 + console.error('ZZZXXXXX', '----展会广告----aboutToDisappear-----')
31 } 34 }
32 35
33 build() { 36 build() {
34 37
35 Column() { 38 Column() {
36 - Text(this.compDTO.matInfo.advTitle)  
37 - .fontSize($r('app.float.font_size_17'))  
38 - .fontColor($r('app.color.color_222222'))  
39 - .maxLines(3)  
40 - .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。  
41 - .align(Alignment.Start) 39 +
  40 + Stack() {
  41 + //长图
  42 + Image(this.advExtraData.itemTopImage)
  43 + .width(CommonConstants.FULL_WIDTH)
  44 + .aspectRatio(343 / 80)
  45 + .borderRadius(4)
  46 + .borderWidth(0.5)
  47 + .borderColor($r('app.color.color_0D000000'))
  48 +
  49 +
  50 + Row() {
  51 +
  52 + Text($r('app.string.comp_advertisement'))
  53 + .fontSize('10fp')
  54 + .fontColor($r('app.color.white'))
  55 + .width(28)
  56 + .height(16)
  57 + .backgroundColor('#4D000000')
  58 + .borderRadius(4)
  59 + .textAlign(TextAlign.Center)
  60 +
  61 + Blank()
  62 +
  63 + Stack() {
  64 + Image($r('app.media.comp_adv_close_white'))
  65 + .width(9)
  66 + .height(9)
  67 + .borderRadius({
  68 + topLeft: '4vp',
  69 + topRight: '4vp',
  70 + bottomLeft: '4vp',
  71 + bottomRight: '4vp'
  72 + })
  73 + }
  74 + .width(18)
  75 + .height(14)
  76 + .backgroundColor('#4D000000')
  77 + .borderWidth(0.5)
  78 + .borderColor($r('app.color.white'))
  79 + .borderRadius(4)
  80 +
  81 + }.width('100%').padding({
  82 + top: 8,
  83 + left: 8,
  84 + right: 8
  85 + })
  86 + }
  87 + .alignContent(Alignment.Top)
  88 + .width(CommonConstants.FULL_WIDTH)
  89 +
  90 + //
  91 + List({ space: 10 }) {
  92 +
  93 + ForEach(this.advExtraData.item, (content: AdvExtraItemData) => {
  94 +
  95 + ListItem() {
  96 +
  97 + Text(content.title).fontSize('16fp').fontColor($r('app.color.color_222222')).width('100%').onClick(() => {
  98 + let matInfo: CompAdvMatInfoBean = {
  99 + linkUrl: content.linkUrl,
  100 + linkType: content.linkType
  101 + } as CompAdvMatInfoBean;
  102 + ProcessUtils.openAdvDetail(matInfo)
  103 + })
  104 + }
  105 +
  106 + })
  107 +
  108 + }.width('100%').listDirection(Axis.Vertical).margin({ top: 10, bottom: 10 })
  109 +
  110 + // 更多按钮
  111 + commonButton(this.advExtraData)
  112 +
42 } 113 }
43 .width(CommonConstants.FULL_WIDTH) 114 .width(CommonConstants.FULL_WIDTH)
44 .padding({ 115 .padding({
@@ -47,14 +118,33 @@ export struct CardAdvVideoExComponent { @@ -47,14 +118,33 @@ export struct CardAdvVideoExComponent {
47 top: $r('app.float.card_comp_pagePadding_tb'), 118 top: $r('app.float.card_comp_pagePadding_tb'),
48 bottom: $r('app.float.card_comp_pagePadding_tb') 119 bottom: $r('app.float.card_comp_pagePadding_tb')
49 }) 120 })
50 - .onClick((event: ClickEvent) => {  
51 - //ProcessUtils.processPage(this.contentDTO)  
52 - }) 121 +
53 } 122 }
54 } 123 }
55 124
56 -@Extend(Text)  
57 -function bottomTextStyle() {  
58 - .fontSize(12)  
59 - .fontColor('#B0B0B0') 125 +/*
  126 + 标题样式
  127 + */
  128 +@Builder
  129 +function commonButton(advExtraData: AdvExtraData) {
  130 +
  131 +
  132 + Row() {
  133 + Blank()
  134 + Text('查看更多').fontColor('#222222').fontSize('14fp')
  135 + Image($r('app.media.icon_comp_more_right_red')).width(16).height(16)
  136 + Blank()
  137 +
  138 + }
  139 + .width('100%')
  140 + .backgroundColor('#F5F5F5')
  141 + .borderRadius(3)
  142 + .padding({ top: 10, bottom: 10, })
  143 + .onClick(() => {
  144 + let matInfo: CompAdvMatInfoBean = {
  145 + linkUrl: advExtraData.itemMore.linkUrl,
  146 + linkType: advExtraData.itemMore.linkType
  147 + } as CompAdvMatInfoBean;
  148 + ProcessUtils.openAdvDetail(matInfo)
  149 + })
60 } 150 }
@@ -20,7 +20,7 @@ export struct Card12Component { @@ -20,7 +20,7 @@ export struct Card12Component {
20 Column() { 20 Column() {
21 // rmh信息 21 // rmh信息
22 if (this.contentDTO.rmhInfo) { 22 if (this.contentDTO.rmhInfo) {
23 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 23 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
24 } 24 }
25 // 标题 25 // 标题
26 if (this.contentDTO.newsTitle) { 26 if (this.contentDTO.newsTitle) {
@@ -52,7 +52,7 @@ export struct Card14Component { @@ -52,7 +52,7 @@ export struct Card14Component {
52 Column() { 52 Column() {
53 // rmh信息 53 // rmh信息
54 if (this.contentDTO.rmhInfo) { 54 if (this.contentDTO.rmhInfo) {
55 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 55 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
56 } 56 }
57 // 左标题,右图 57 // 左标题,右图
58 Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { 58 Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
@@ -58,7 +58,7 @@ export struct Card15Component { @@ -58,7 +58,7 @@ export struct Card15Component {
58 build() { 58 build() {
59 Column() { 59 Column() {
60 // rmh信息 60 // rmh信息
61 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 61 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
62 //新闻标题 62 //新闻标题
63 if (this.contentDTO.newsTitle) { 63 if (this.contentDTO.newsTitle) {
64 Text(this.contentDTO.newsTitle) 64 Text(this.contentDTO.newsTitle)
@@ -25,7 +25,7 @@ export struct Card16Component { @@ -25,7 +25,7 @@ export struct Card16Component {
25 Column() { 25 Column() {
26 // rmh信息 26 // rmh信息
27 if (this.contentDTO.rmhInfo) { 27 if (this.contentDTO.rmhInfo) {
28 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 28 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
29 } 29 }
30 // 标题 30 // 标题
31 if (this.contentDTO.newsTitle) { 31 if (this.contentDTO.newsTitle) {
@@ -77,7 +77,7 @@ export struct Card19Component { @@ -77,7 +77,7 @@ export struct Card19Component {
77 build() { 77 build() {
78 Column() { 78 Column() {
79 // rmh信息 79 // rmh信息
80 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 80 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
81 // 标题 81 // 标题
82 if (this.contentDTO.newsTitle) { 82 if (this.contentDTO.newsTitle) {
83 Text(this.contentDTO.newsTitle) 83 Text(this.contentDTO.newsTitle)
@@ -50,7 +50,7 @@ export struct Card20Component { @@ -50,7 +50,7 @@ export struct Card20Component {
50 build() { 50 build() {
51 Column() { 51 Column() {
52 // rmh信息 52 // rmh信息
53 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 53 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
54 // 标题 54 // 标题
55 if (this.contentDTO.newsTitle) { 55 if (this.contentDTO.newsTitle) {
56 Text(this.contentDTO.newsTitle) 56 Text(this.contentDTO.newsTitle)
@@ -16,7 +16,7 @@ export struct Card21Component { @@ -16,7 +16,7 @@ export struct Card21Component {
16 build() { 16 build() {
17 Column() { 17 Column() {
18 // 顶部 rmh信息 18 // 顶部 rmh信息
19 - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) 19 + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
20 // 中间内容 20 // 中间内容
21 Grid() { 21 Grid() {
22 GridItem() { 22 GridItem() {
@@ -10,6 +10,7 @@ import { CommentCustomDialog } from './CommentCustomDialog' @@ -10,6 +10,7 @@ import { CommentCustomDialog } from './CommentCustomDialog'
10 import { publishCommentModel } from '../model/PublishCommentModel'; 10 import { publishCommentModel } from '../model/PublishCommentModel';
11 import { ifaa } from '@kit.OnlineAuthenticationKit'; 11 import { ifaa } from '@kit.OnlineAuthenticationKit';
12 import { HttpUrlUtils } from 'wdNetwork/Index'; 12 import { HttpUrlUtils } from 'wdNetwork/Index';
  13 +import NoMoreLayout from '../../page/NoMoreLayout';
13 14
14 const TAG = 'CommentComponent'; 15 const TAG = 'CommentComponent';
15 16
@@ -19,6 +20,8 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 @@ -19,6 +20,8 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
19 @Preview 20 @Preview
20 @Component 21 @Component
21 export struct CommentComponent { 22 export struct CommentComponent {
  23 + @State hasMore: boolean = true;
  24 + @State currentPage: number = 1;
22 // @State private browSingModel: commentListModel = new commentListModel() 25 // @State private browSingModel: commentListModel = new commentListModel()
23 /*必传*/ 26 /*必传*/
24 @ObjectLink publishCommentModel: publishCommentModel 27 @ObjectLink publishCommentModel: publishCommentModel
@@ -167,7 +170,19 @@ export struct CommentComponent { @@ -167,7 +170,19 @@ export struct CommentComponent {
167 } 170 }
168 } 171 }
169 }, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString()) 172 }, (item: commentItemModel, index: number) => JSON.stringify(item) + index.toString())
  173 +
  174 + // 加载更多
  175 + ListItem() {
  176 + if (this.hasMore === false) NoMoreLayout()
  177 + }
170 } 178 }
  179 +
  180 + .onReachEnd(()=>{
  181 + if (this.hasMore) {
  182 + this.getData()
  183 + }
  184 +
  185 + })
171 .enableScrollInteraction(false) 186 .enableScrollInteraction(false)
172 } 187 }
173 188
@@ -175,10 +190,22 @@ export struct CommentComponent { @@ -175,10 +190,22 @@ export struct CommentComponent {
175 190
176 //获取数据 191 //获取数据
177 async getData() { 192 async getData() {
178 - commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType) 193 + commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, this.publishCommentModel.targetType)
179 .then(commentListModel => { 194 .then(commentListModel => {
180 - this.publishCommentModel.totalCommentNumer = commentListModel.totalCount + '' 195 + this.currentPage++
  196 +
  197 + if (Number.parseInt(commentListModel.totalCommentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
  198 + this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + ''
  199 + }
  200 +
  201 + if (commentListModel.hasNext === 0) {
  202 + this.hasMore = false;
  203 + } else {
  204 + this.hasMore = true;
  205 + }
  206 +
181 if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { 207 if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
  208 +
182 commentListModel.list.forEach(element => { 209 commentListModel.list.forEach(element => {
183 element.hasMore = Number.parseInt(element.childCommentNum) ? true : false 210 element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
184 let newModel = commentViewModel.deepCopyCommentItemModel(element) 211 let newModel = commentViewModel.deepCopyCommentItemModel(element)
@@ -189,6 +216,8 @@ export struct CommentComponent { @@ -189,6 +216,8 @@ export struct CommentComponent {
189 }); 216 });
190 217
191 218
  219 + }else{
  220 + this.hasMore = false
192 } 221 }
193 }) 222 })
194 223
@@ -6,7 +6,7 @@ import { ProcessUtils } from 'wdRouter'; @@ -6,7 +6,7 @@ import { ProcessUtils } from 'wdRouter';
6 import { HttpUtils } from 'wdNetwork/Index'; 6 import { HttpUtils } from 'wdNetwork/Index';
7 7
8 /** 8 /**
9 - * 小视频横划 9 + * 直播预约
10 * Zh_Single_Row-02 10 * Zh_Single_Row-02
11 */ 11 */
12 const TAG = 'Zh_Single_Row-03' 12 const TAG = 'Zh_Single_Row-03'
@@ -42,7 +42,7 @@ export struct ZhSingleRow03 { @@ -42,7 +42,7 @@ export struct ZhSingleRow03 {
42 Row() { 42 Row() {
43 Flex({justifyContent: FlexAlign.SpaceBetween}){ 43 Flex({justifyContent: FlexAlign.SpaceBetween}){
44 Row() { 44 Row() {
45 - Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5)) 45 + Text(item.liveInfo.liveStartTime.split(' ')[0].slice(5).split('-').join('月')+'日')
46 .margin({right: 6}) 46 .margin({right: 6})
47 .fontColor(0x000000) 47 .fontColor(0x000000)
48 .fontSize(13) 48 .fontSize(13)
@@ -390,6 +390,33 @@ export struct PaperSingleColumn999CardView { @@ -390,6 +390,33 @@ export struct PaperSingleColumn999CardView {
390 private item: ContentDTO = {} as ContentDTO; 390 private item: ContentDTO = {} as ContentDTO;
391 private index: number = -1; 391 private index: number = -1;
392 392
  393 + getPublishTime(): string {
  394 + const publishTimestamp = parseInt(this.item?.publishTime)
  395 + const currentTime = Date.now(); // 当前时间戳
  396 +
  397 + // 计算差异
  398 + const timeDifference = currentTime - publishTimestamp;
  399 +
  400 + // 转换为分钟、小时和天
  401 + const minutes = Math.floor(timeDifference / (1000 * 60));
  402 + const hours = Math.floor(timeDifference / (1000 * 60 * 60));
  403 + const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
  404 +
  405 + // 根据时间差返回对应的字符串
  406 + let result: string;
  407 +
  408 + if (minutes < 60) {
  409 + result = `${minutes}分钟前`;
  410 + } else if (hours < 24) {
  411 + result = `${hours}小时前`;
  412 + } else {
  413 + result = `${days}天前`;
  414 + }
  415 +
  416 + console.log(result);
  417 + return result
  418 + }
  419 +
393 build() { 420 build() {
394 Column() { 421 Column() {
395 Text(this.item?.newsTitle) 422 Text(this.item?.newsTitle)
@@ -429,14 +456,33 @@ export struct PaperSingleColumn999CardView { @@ -429,14 +456,33 @@ export struct PaperSingleColumn999CardView {
429 } 456 }
430 if (this.item?.visitorComment) { 457 if (this.item?.visitorComment) {
431 Row() { 458 Row() {
432 - Text(this.item?.visitorComment + "评")  
433 - .fontSize(12)  
434 - .fontColor(Color.Gray)  
435 - .margin({ left: 22 }) 459 + Row() {
  460 + Text(this.item?.source)
  461 + .fontSize(12)
  462 + .fontColor(Color.Gray)
  463 + .margin({ left: 22 })
  464 + Image($r('app.media.point'))
  465 + .width(16)
  466 + .height(16)
  467 + .margin({ top: 10, bottom: 10 })
  468 + Text(this.getPublishTime())
  469 + .fontSize(12)
  470 + .fontColor(Color.Gray)
  471 + Text(this.item?.visitorComment + "评")
  472 + .fontSize(12)
  473 + .fontColor(Color.Gray)
  474 + .margin({ left: 6 })
  475 + }
  476 + .justifyContent(FlexAlign.Start)
  477 +
436 Image($r('app.media.icon_forward')) 478 Image($r('app.media.icon_forward'))
437 .width(16) 479 .width(16)
438 .height(16) 480 .height(16)
439 .margin({ left: 10, right: 22, top: 10, bottom: 10 }) 481 .margin({ left: 10, right: 22, top: 10, bottom: 10 })
  482 + .alignRules({
  483 + center: { anchor: '__container__', align: VerticalAlign.Center },
  484 + right: { anchor: '__container__', align: HorizontalAlign.End }
  485 + })
440 }.width(CommonConstants.FULL_PARENT) 486 }.width(CommonConstants.FULL_PARENT)
441 .justifyContent(FlexAlign.SpaceBetween) 487 .justifyContent(FlexAlign.SpaceBetween)
442 } 488 }
@@ -250,10 +250,10 @@ struct ChannelDialog { @@ -250,10 +250,10 @@ struct ChannelDialog {
250 .fontSize(16) 250 .fontSize(16)
251 .fontWeight(600) 251 .fontWeight(600)
252 .margin({ right: 4 }) 252 .margin({ right: 4 })
253 - Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)  
254 - .fontSize(12)  
255 - .fontWeight(400)  
256 - .fontColor('#222222') 253 + // Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
  254 + // .fontSize(12)
  255 + // .fontWeight(400)
  256 + // .fontColor('#222222')
257 } 257 }
258 258
259 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) 259 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
@@ -276,9 +276,9 @@ struct ChannelDialog { @@ -276,9 +276,9 @@ struct ChannelDialog {
276 Row() { 276 Row() {
277 Text(item.name) 277 Text(item.name)
278 .fontSize(14) 278 .fontSize(14)
279 - .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) 279 + .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.headlinesOn === 1 || item.movePermitted === 0 ? '#999999' : '#222222'))
280 280
281 - if (this.isEditIng && item.delPermitted === 1) { 281 + if (this.isEditIng && item.delPermitted === 1 && item.movePermitted === 1) {
282 Image($r('app.media.icon_audio_close')) 282 Image($r('app.media.icon_audio_close'))
283 .width(12) 283 .width(12)
284 .margin({ left: 1 }) 284 .margin({ left: 1 })
@@ -287,12 +287,12 @@ struct ChannelDialog { @@ -287,12 +287,12 @@ struct ChannelDialog {
287 .width('100%') 287 .width('100%')
288 .height('100%') 288 .height('100%')
289 .justifyContent(FlexAlign.Center) 289 .justifyContent(FlexAlign.Center)
290 - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') 290 + .backgroundColor(item.headlinesOn === 1 || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
291 } 291 }
292 .width('23%') 292 .width('23%')
293 .height(40) 293 .height(40)
294 .border({ 294 .border({
295 - width: item.homeChannel === '1' ? 0 : 1, 295 + width: item.headlinesOn === 1 || item.movePermitted === 0 ? 0 : 1,
296 color: '#EDEDED', 296 color: '#EDEDED',
297 radius: 3 297 radius: 3
298 }) 298 })
@@ -303,7 +303,7 @@ struct ChannelDialog { @@ -303,7 +303,7 @@ struct ChannelDialog {
303 TapGesture() 303 TapGesture()
304 .onAction((event?: GestureEvent) => { 304 .onAction((event?: GestureEvent) => {
305 if (this.isEditIng) { 305 if (this.isEditIng) {
306 - if (item.delPermitted === 1) { 306 + if (item.delPermitted === 1 && item.movePermitted === 1) {
307 this.delChannelItem(index) 307 this.delChannelItem(index)
308 } 308 }
309 } else { 309 } else {
@@ -84,10 +84,10 @@ export struct PageComponent { @@ -84,10 +84,10 @@ export struct PageComponent {
84 // 加载更多 84 // 加载更多
85 ListItem() { 85 ListItem() {
86 if (this.pageModel.hasMore) { 86 if (this.pageModel.hasMore) {
87 - LoadMoreLayout({  
88 - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,  
89 - this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)  
90 - }) 87 + // LoadMoreLayout({
  88 + // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
  89 + // this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
  90 + // })
91 } else if (!this.pageModel.contentNeedScroll) { 91 } else if (!this.pageModel.contentNeedScroll) {
92 PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) 92 PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) })
93 } 93 }
@@ -59,7 +59,6 @@ export struct TopNavigationComponent { @@ -59,7 +59,6 @@ export struct TopNavigationComponent {
59 @State autoRefresh2Page: number = 0 59 @State autoRefresh2Page: number = 0
60 // 当前底导index 60 // 当前底导index
61 @State navIndex: number = 0 61 @State navIndex: number = 0
62 -  
63 @State animationDuration: number = 0 62 @State animationDuration: number = 0
64 @State indicatorLeftMargin: number = 0 63 @State indicatorLeftMargin: number = 0
65 @State indicatorWidth: number = 0 64 @State indicatorWidth: number = 0
@@ -93,7 +92,8 @@ export struct TopNavigationComponent { @@ -93,7 +92,8 @@ export struct TopNavigationComponent {
93 92
94 //defaultMyChannelList 93 //defaultMyChannelList
95 defaultList.forEach(item => { 94 defaultList.forEach(item => {
96 - if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || item.headlinesOn === 1) { 95 + if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 ||
  96 + item.headlinesOn === 1) {
97 defaultMyChannelList.push(item); 97 defaultMyChannelList.push(item);
98 } 98 }
99 if (item.defaultPermitted === 1) { 99 if (item.defaultPermitted === 1) {
@@ -136,13 +136,15 @@ export struct TopNavigationComponent { @@ -136,13 +136,15 @@ export struct TopNavigationComponent {
136 } 136 }
137 137
138 //频道分类 138 //频道分类
139 - if (item.myChannel === '1' && item.name !== '播报') {  
140 - _myChannelList.push(item)  
141 - _channelIds.push(item.channelId)  
142 - } else if (item.moreChannel === '1') {  
143 - this.moreChannelList.push(item)  
144 - } else if (item.localChannel === '1') {  
145 - this.localChannelList.push(item) 139 + if (item.name !== '播报') { //暂时隐藏播报
  140 + if (item.myChannel === '1') {
  141 + _myChannelList.push(item)
  142 + _channelIds.push(item.channelId)
  143 + } else if (item.moreChannel === '1') {
  144 + this.moreChannelList.push(item)
  145 + } else if (item.localChannel === '1') {
  146 + this.localChannelList.push(item)
  147 + }
146 } 148 }
147 149
148 }) 150 })
@@ -169,7 +171,6 @@ export struct TopNavigationComponent { @@ -169,7 +171,6 @@ export struct TopNavigationComponent {
169 return item.name === '版面' 171 return item.name === '版面'
170 } 172 }
171 173
172 -  
173 build() { 174 build() {
174 Column() { 175 Column() {
175 // 顶部搜索、日报logo、早晚报 176 // 顶部搜索、日报logo、早晚报
@@ -216,51 +217,51 @@ export struct TopNavigationComponent { @@ -216,51 +217,51 @@ export struct TopNavigationComponent {
216 // 频道分类list 217 // 频道分类list
217 Stack({ alignContent: Alignment.TopEnd }) { 218 Stack({ alignContent: Alignment.TopEnd }) {
218 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { 219 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
219 - ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {  
220 - TabContent() {  
221 - if (this.currentBottomNavName === '视频' && navItem.name === '视频') {  
222 - VideoChannelDetail({  
223 - bottomNavIndex: $_currentNavIndex,  
224 - topNavIndex: $currentTopNavSelectedIndex,  
225 - groupId: this.groupId + '',  
226 - pageId: navItem.pageId + '',  
227 - channelId: navItem.channelId + '',  
228 - })  
229 - }  
230 - else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {  
231 - PeopleShipMainComponent({  
232 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
233 - navIndex: index,  
234 - pageId: navItem.pageId + '',  
235 - channelId: navItem.channelId + '',  
236 - })  
237 - }  
238 - else  
239 - if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {  
240 - PageComponent({ 220 + ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList,
  221 + (navItem: TopNavDTO, index: number) => {
  222 + TabContent() {
  223 + if (this.currentBottomNavName === '视频' && navItem.name === '视频') {
  224 + VideoChannelDetail({
  225 + bottomNavIndex: $_currentNavIndex,
  226 + topNavIndex: $currentTopNavSelectedIndex,
  227 + groupId: this.groupId + '',
  228 + pageId: navItem.pageId + '',
  229 + channelId: navItem.channelId + '',
  230 + })
  231 + } else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
  232 + PeopleShipMainComponent({
241 currentTopNavSelectedIndex: $currentTopNavSelectedIndex, 233 currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
242 navIndex: index, 234 navIndex: index,
243 pageId: navItem.pageId + '', 235 pageId: navItem.pageId + '',
244 channelId: navItem.channelId + '', 236 channelId: navItem.channelId + '',
245 - autoRefresh: this.autoRefresh2Page  
246 }) 237 })
247 - }  
248 - }  
249 - .tabBar(this.tabBarBuilder(navItem, index)) 238 + } else
  239 + if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
  240 + PageComponent({
  241 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
  242 + navIndex: index,
  243 + pageId: navItem.pageId + '',
  244 + channelId: navItem.channelId + '',
  245 + autoRefresh: this.autoRefresh2Page
  246 + })
  247 + }
  248 + }
  249 + .tabBar(this.tabBarBuilder(navItem, index))
250 250
251 - }, (navItem: TopNavDTO) => JSON.stringify(navItem)); 251 + }, (navItem: TopNavDTO) => JSON.stringify(navItem));
252 } 252 }
253 .barHeight($r('app.float.top_tab_bar_height')) 253 .barHeight($r('app.float.top_tab_bar_height'))
254 .barMode(BarMode.Scrollable) 254 .barMode(BarMode.Scrollable)
255 .vertical(false) 255 .vertical(false)
256 .barBackgroundColor(this.barBackgroundColor) 256 .barBackgroundColor(this.barBackgroundColor)
257 - .onAreaChange((oldValue: Area,newValue: Area)=> { 257 + .onAreaChange((oldValue: Area, newValue: Area) => {
258 let width = Number.parseFloat(newValue.width.toString()) 258 let width = Number.parseFloat(newValue.width.toString())
259 this.tabsWidth = Number.isNaN(width) ? 0 : width 259 this.tabsWidth = Number.isNaN(width) ? 0 : width
260 }) 260 })
261 .animationDuration(this.animationDuration) 261 .animationDuration(this.animationDuration)
262 .onChange((index: number) => { 262 .onChange((index: number) => {
263 - this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name 263 + this.currentTopNavName =
  264 + this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
264 Logger.info(TAG, `onChange index : ${index}`); 265 Logger.info(TAG, `onChange index : ${index}`);
265 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 266 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
266 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 267 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
@@ -288,27 +289,27 @@ export struct TopNavigationComponent { @@ -288,27 +289,27 @@ export struct TopNavigationComponent {
288 let targetIndexInfo = this.getTextInfo(targetIndex) 289 let targetIndexInfo = this.getTextInfo(targetIndex)
289 this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width) 290 this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width)
290 }) 291 })
291 - .onAnimationEnd((index: number,event: TabsAnimationEvent) => { 292 + .onAnimationEnd((index: number, event: TabsAnimationEvent) => {
292 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 293 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
293 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 294 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
294 ) { 295 ) {
295 return 296 return
296 } 297 }
297 - // 切换动画结束时触发该回调。下划线动画停止。  
298 - let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event)  
299 - this.startAnimateTo(0,currentIndicatorInfo.left,currentIndicatorInfo.width) 298 + // 切换动画结束时触发该回调。下划线动画停止。
  299 + let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event)
  300 + this.startAnimateTo(0, currentIndicatorInfo.left, currentIndicatorInfo.width)
300 }) 301 })
301 - .onGestureSwipe((index: number,event: TabsAnimationEvent) => { 302 + .onGestureSwipe((index: number, event: TabsAnimationEvent) => {
302 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && 303 if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
303 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) 304 !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
304 ) { 305 ) {
305 return 306 return
306 } 307 }
307 - // 在页面跟手滑动过程中,逐帧触发该回调。  
308 - let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event)  
309 - this.currentTopNavSelectedIndex = currentIndicatorInfo.index  
310 - this.indicatorLeftMargin = currentIndicatorInfo.left  
311 - this.indicatorWidth = currentIndicatorInfo.width 308 + // 在页面跟手滑动过程中,逐帧触发该回调。
  309 + let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event)
  310 + this.currentTopNavSelectedIndex = currentIndicatorInfo.index
  311 + this.indicatorLeftMargin = currentIndicatorInfo.left
  312 + this.indicatorWidth = currentIndicatorInfo.width
312 }) 313 })
313 314
314 // 分类列表最右侧频道设置 315 // 分类列表最右侧频道设置
@@ -351,8 +352,9 @@ export struct TopNavigationComponent { @@ -351,8 +352,9 @@ export struct TopNavigationComponent {
351 .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) 352 .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
352 .maxLines(this.MAX_LINE) 353 .maxLines(this.MAX_LINE)
353 .id(index.toString()) 354 .id(index.toString())
354 - .onAreaChange((oldValue: Area,newValue: Area) => {  
355 - if (this.currentTopNavSelectedIndex === index && (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)){ 355 + .onAreaChange((oldValue: Area, newValue: Area) => {
  356 + if (this.currentTopNavSelectedIndex === index &&
  357 + (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
356 if (newValue.position.x != undefined) { 358 if (newValue.position.x != undefined) {
357 let positionX = Number.parseFloat(newValue.position.x.toString()) 359 let positionX = Number.parseFloat(newValue.position.x.toString())
358 this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX 360 this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
@@ -396,7 +398,8 @@ export struct TopNavigationComponent { @@ -396,7 +398,8 @@ export struct TopNavigationComponent {
396 } 398 }
397 399
398 onTopNavigationDataUpdated() { 400 onTopNavigationDataUpdated() {
399 - Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); 401 + Logger.info(TAG,
  402 + `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
400 } 403 }
401 404
402 onAutoRefresh() { 405 onAutoRefresh() {
@@ -505,7 +508,7 @@ export struct TopNavigationComponent { @@ -505,7 +508,7 @@ export struct TopNavigationComponent {
505 let indexInfo = this.getTextInfo(index) 508 let indexInfo = this.getTextInfo(index)
506 let nextIndexInfo = this.getTextInfo(nextIndex) 509 let nextIndexInfo = this.getTextInfo(nextIndex)
507 let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth) 510 let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)
508 - let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。 511 + let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。
509 let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio 512 let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio
510 let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio 513 let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio
511 return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth } 514 return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }
1 -import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'  
2 -import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';  
3 -import { ContentDTO } from 'wdBean'  
4 -import { CardParser } from '../CardParser'  
5 -  
6 -@Preview  
7 -@Component  
8 -export struct PeopleShipAttentionContentListComponent {  
9 -  
10 - @Prop followList: FollowListDetailItem[]  
11 -  
12 - @Prop attentionList: ContentDTO[]  
13 -  
14 - build() {  
15 - List(){  
16 - // 头部关注列表  
17 - ListItem(){  
18 - PeopleShipAttentionContentListTopComponent({  
19 - followList: this.followList  
20 - })  
21 - }  
22 - ForEach(this.attentionList, (item: ContentDTO) => {  
23 - ListItem() {  
24 - CardParser({ contentDTO: item })  
25 - }.width("100%")  
26 - .backgroundColor(Color.Transparent)  
27 -  
28 - }, (item: ContentDTO, index: number) => item.objectId + index.toString())  
29 - }  
30 - .scrollBar(BarState.Off)  
31 - .width('100%')  
32 - .height('100%')  
33 - }  
34 -}  
35 -  
  1 +import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent'
  2 +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
  3 +
  4 +@Component
  5 +export struct PeopleShipAttentionContentListHeadComponent {
  6 +
  7 + @State index: number = 0
  8 + @ObjectLink item: FollowListDetailItem
  9 + build() {
  10 + Column(){
  11 + // 头像
  12 + PeopleShipHomePageHeadComponent({
  13 + diameter: 48,
  14 + iconDiameter: 16,
  15 + headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') :
  16 + ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
  17 + this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')),
  18 + authIcon: this.index == 0 ? '' : this.item.authIcon
  19 + }).margin({
  20 + bottom: '8vp'
  21 + })
  22 +
  23 + Text(this.index == 0 ? '我的关注' : this.item.attentionUserName)
  24 + .fontColor($r('app.color.color_666666'))
  25 + .fontSize($r('app.float.vp_13'))
  26 + .fontWeight(400)
  27 + .height('18vp')
  28 + .lineHeight('18vp')
  29 + .maxLines(1)
  30 + .textOverflow({overflow: TextOverflow.Ellipsis})
  31 + .padding({
  32 + left: '2vp',
  33 + right: '2vp'
  34 + })
  35 + }
  36 + .alignItems(HorizontalAlign.Center)
  37 + .width('78vp')
  38 + .margin({
  39 + left: this.index == 0 ? '8vp' : '4vp',
  40 + top: '14vp',
  41 + bottom: '14vp'
  42 + })
  43 + }
  44 +}
  45 +
1 import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; 1 import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
2 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 2 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
3 import { ProcessUtils } from 'wdRouter'; 3 import { ProcessUtils } from 'wdRouter';
4 -import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent'  
5 - 4 +import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttentionContentListHeadComponent'
6 5
7 @Component 6 @Component
8 export struct PeopleShipAttentionContentListTopComponent { 7 export struct PeopleShipAttentionContentListTopComponent {
@@ -41,45 +40,3 @@ export struct PeopleShipAttentionContentListTopComponent { @@ -41,45 +40,3 @@ export struct PeopleShipAttentionContentListTopComponent {
41 } 40 }
42 } 41 }
43 } 42 }
44 -  
45 -@Component  
46 -struct PeopleShipAttentionContentListHeadComponent {  
47 -  
48 - @State index: number = 0  
49 - @ObjectLink item: FollowListDetailItem  
50 - build() {  
51 - Column(){  
52 - // 头像  
53 - PeopleShipHomePageHeadComponent({  
54 - diameter: 48,  
55 - iconDiameter: 16,  
56 - headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') :  
57 - ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?  
58 - this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')),  
59 - authIcon: this.index == 0 ? '' : this.item.authIcon  
60 - }).margin({  
61 - bottom: '8vp'  
62 - })  
63 -  
64 - Text(this.index == 0 ? '我的关注' : this.item.attentionUserName)  
65 - .fontColor($r('app.color.color_666666'))  
66 - .fontSize($r('app.float.vp_13'))  
67 - .fontWeight(400)  
68 - .height('18vp')  
69 - .lineHeight('18vp')  
70 - .maxLines(1)  
71 - .textOverflow({overflow: TextOverflow.Ellipsis})  
72 - .padding({  
73 - left: '2vp',  
74 - right: '2vp'  
75 - })  
76 - }  
77 - .alignItems(HorizontalAlign.Center)  
78 - .width('78vp')  
79 - .margin({  
80 - left: this.index == 0 ? '8vp' : '4vp',  
81 - top: '14vp',  
82 - bottom: '14vp'  
83 - })  
84 - }  
85 -}  
@@ -2,7 +2,14 @@ import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent'; @@ -2,7 +2,14 @@ import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent';
2 import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; 2 import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
3 import { HttpUtils } from 'wdNetwork/Index'; 3 import { HttpUtils } from 'wdNetwork/Index';
4 import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit'; 4 import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit';
5 -import { RmhRecommendDTO, ContentDTO, AttentionBatchDTO, CreatorDTO } from 'wdBean'; 5 +import {
  6 + RmhRecommendDTO,
  7 + ContentDTO,
  8 + AttentionBatchDTO,
  9 + CreatorDTO,
  10 + contentListParams,
  11 + InteractDataDTO
  12 +} from 'wdBean';
6 import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; 13 import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
7 import { channelSkeleton } from '../skeleton/channelSkeleton' 14 import { channelSkeleton } from '../skeleton/channelSkeleton'
8 import { EmptyComponent } from '../view/EmptyComponent'; 15 import { EmptyComponent } from '../view/EmptyComponent';
@@ -56,6 +63,13 @@ export struct PeopleShipMainComponent { @@ -56,6 +63,13 @@ export struct PeopleShipMainComponent {
56 this.LoadingLayout() 63 this.LoadingLayout()
57 } else if (this.viewType == ViewType.ERROR) { 64 } else if (this.viewType == ViewType.ERROR) {
58 ErrorComponent() 65 ErrorComponent()
  66 + .onTouch((event: TouchEvent | undefined) => {
  67 + if (event) {
  68 + if (this.viewType === ViewType.ERROR) {
  69 + this.getData()
  70 + }
  71 + }
  72 + })
59 } else if (this.viewType == ViewType.EMPTY) { 73 } else if (this.viewType == ViewType.EMPTY) {
60 EmptyComponent() 74 EmptyComponent()
61 } else { 75 } else {
@@ -155,11 +169,6 @@ export struct PeopleShipMainComponent { @@ -155,11 +169,6 @@ export struct PeopleShipMainComponent {
155 .scrollBar(BarState.Off) 169 .scrollBar(BarState.Off)
156 .width('100%') 170 .width('100%')
157 .height('100%') 171 .height('100%')
158 -  
159 - // PeopleShipAttentionContentListComponent({  
160 - // followList: this.followList,  
161 - // attentionList: this.attentionList  
162 - // })  
163 } 172 }
164 173
165 aboutToAppear() { 174 aboutToAppear() {
@@ -259,14 +268,6 @@ export struct PeopleShipMainComponent { @@ -259,14 +268,6 @@ export struct PeopleShipMainComponent {
259 // 获取列表数据 268 // 获取列表数据
260 let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime) 269 let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime)
261 Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`) 270 Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
262 -  
263 - if (resolve ) {  
264 - if (this.currentPage == 1) {  
265 - resolve('已更新至最新')  
266 - }else {  
267 - resolve('')  
268 - }  
269 - }  
270 if (listData && listData.list && listData.list.length > 0) { 271 if (listData && listData.list && listData.list.length > 0) {
271 if (listData.list.length === 20) { 272 if (listData.list.length === 20) {
272 this.hasMore = true; 273 this.hasMore = true;
@@ -276,14 +277,71 @@ export struct PeopleShipMainComponent { @@ -276,14 +277,71 @@ export struct PeopleShipMainComponent {
276 if (this.currentPage == 1) { 277 if (this.currentPage == 1) {
277 this.attentionList = [] 278 this.attentionList = []
278 } 279 }
279 - this.attentionList.push(...listData.list) 280 + //批量查询各类型内容动态数据接口
  281 + this.checkContentInteractData(listData.list, resolve)
  282 + } else {
  283 + this.resolveEnd(true, resolve)
280 } 284 }
281 - this.viewType = ViewType.LOADED  
282 - this.isLoading = false 285 +
283 } catch (exception) { 286 } catch (exception) {
  287 + this.resolveEnd(false, resolve)
  288 + }
  289 + }
  290 +
  291 + // 批量查询各类型内容动态数据接口
  292 + private async checkContentInteractData(list: ContentDTO[], resolve?: (value: string | PromiseLike<string>) => void) {
  293 + // 批量查询内容当前用户点赞、收藏状态
  294 + try {
  295 + // 获取列表数据
  296 + const params: contentListParams = {
  297 + contentList: []
  298 + }
  299 + list.forEach((item: ContentDTO) => {
  300 + params.contentList.push({
  301 + contentId: item.objectId,
  302 + contentType: Number(item.objectType ?? '1')
  303 + })
  304 + })
  305 +
  306 + let listData = await PeopleShipMainViewModel.getContentInteractInfo(params)
  307 + Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
  308 + this.resolveEnd(true, resolve)
  309 + list.forEach((element: ContentDTO) => {
  310 + // 获取 interactData 数据
  311 + if (listData && listData.length > 0) {
  312 + const objc = listData.find((interactModel: InteractDataDTO) => {
  313 + return element.objectId == interactModel.contentId
  314 + })
  315 + if (objc) {
  316 + element.interactData = objc
  317 + }
  318 + }
  319 + // 设置人民号都不可关注
  320 + if (element.rmhInfo) {
  321 + element.rmhInfo.cnIsAttention = 0
  322 + }
  323 + this.attentionList.push(element)
  324 + })
  325 +
  326 + } catch (exception) {
  327 + this.resolveEnd(false, resolve)
  328 + }
  329 + }
  330 +
  331 + private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) {
  332 + if (resolve) {
  333 + if (this.currentPage == 1 && isTop) {
  334 + resolve('已更新至最新')
  335 + }else {
  336 + resolve('')
  337 + }
  338 + }
  339 + if (this.currentPage == 1 && !isTop) {
284 this.viewType = ViewType.ERROR 340 this.viewType = ViewType.ERROR
285 - this.isLoading = false 341 + } else {
  342 + this.viewType = ViewType.LOADED
286 } 343 }
  344 + this.isLoading = false
287 } 345 }
288 346
289 // 说是首页必须要调用 347 // 说是首页必须要调用
@@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV
15 import { LikeComponent } from './LikeComponent'; 15 import { LikeComponent } from './LikeComponent';
16 import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent'; 16 import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
17 import { publishCommentModel } from '../comment/model/PublishCommentModel' 17 import { publishCommentModel } from '../comment/model/PublishCommentModel'
  18 +// import { AudioBarView } from '../MorningEveningPaper/AudioBarView'
18 import { HttpUrlUtils } from 'wdNetwork/Index'; 19 import { HttpUrlUtils } from 'wdNetwork/Index';
19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 20 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { PageRepository } from '../../repository/PageRepository'; 21 import { PageRepository } from '../../repository/PageRepository';
@@ -26,25 +27,28 @@ const TAG = 'OperRowListView'; @@ -26,25 +27,28 @@ const TAG = 'OperRowListView';
26 * 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享 27 * 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享
27 * 上层传值: 28 * 上层传值:
28 * 1、(必传) contentDetailData---稿件详情 29 * 1、(必传) contentDetailData---稿件详情
29 - * 2、(非必传) operationButtonList---组件展示条件,['comment', 'like', 'collect', 'share'],需要展示什么传什么  
30 - * comment--评论;like--点赞;collect--收藏;share--分享; 30 + * 2、(非必传) operationButtonList---组件展示条件,
  31 + * ['comment', 'like', 'collect', 'share'],需要展示什么传什么
  32 + * comment--评论;like--点赞;collect--收藏;listen--音频;share--分享;
31 * 33 *
32 * 传值示例: 34 * 传值示例:
33 - OperRowListView({  
34 - contentDetailData: this.contentDetailData[0],  
35 - operationButtonList: ['comment', 'like', 'collect', 'share']  
36 - }) 35 + OperRowListView({
  36 + contentDetailData: this.contentDetailData[0],
  37 + operationButtonList: ['comment', 'like', 'collect', 'listen', 'share']
  38 + })
37 */ 39 */
38 @Preview 40 @Preview
39 @Component 41 @Component
40 export struct OperRowListView { 42 export struct OperRowListView {
41 @Prop contentDetailData: ContentDetailDTO // 稿件详情 43 @Prop contentDetailData: ContentDetailDTO // 稿件详情
42 - @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件 44 + @Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件
  45 + @ObjectLink publishCommentModel: publishCommentModel
43 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 46 // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
44 @State interactData: InteractDataDTO = {} as InteractDataDTO 47 @State interactData: InteractDataDTO = {} as InteractDataDTO
45 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 48 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
46 @State likeBean: Record<string, string> = {} 49 @State likeBean: Record<string, string> = {}
47 - @State publishCommentModel: publishCommentModel = new publishCommentModel() 50 + @State audioUrl: string= ''
  51 + needLike: boolean = true
48 52
49 async aboutToAppear() { 53 async aboutToAppear() {
50 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 54 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
@@ -62,13 +66,18 @@ export struct OperRowListView { @@ -62,13 +66,18 @@ export struct OperRowListView {
62 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData)) 66 console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
63 console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean)) 67 console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
64 // 评论需要数据 68 // 评论需要数据
65 - this.publishCommentModel.targetId = this.contentDetailData.newsId + ''  
66 - this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''  
67 - this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''  
68 - this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''  
69 - this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''  
70 - this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''  
71 - this.publishCommentModel.targetType = this.contentDetailData.newsType + '' 69 + /* this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
  70 + this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
  71 + this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
  72 + this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
  73 + this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
  74 + this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
  75 + this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/
  76 + // 音频需要数据
  77 + if (this.operationButtonList?.includes('listen')) {
  78 + this.audioUrl = this.contentDetailData.audioList[0]?.audioUrl || ''
  79 + console.log(TAG, 'this.audioUrl+++', this.audioUrl)
  80 + }
72 } 81 }
73 82
74 build() { 83 build() {
@@ -90,10 +99,12 @@ export struct OperRowListView { @@ -90,10 +99,12 @@ export struct OperRowListView {
90 ForEach(this.operationButtonList, (item: string, index: number) => { 99 ForEach(this.operationButtonList, (item: string, index: number) => {
91 if (item == 'comment') { 100 if (item == 'comment') {
92 this.builderComment() 101 this.builderComment()
93 - } else if (item == 'like') { 102 + } else if (item == 'like' && this.needLike) {
94 this.builderLike() 103 this.builderLike()
95 } else if (item == 'collect') { 104 } else if (item == 'collect') {
96 this.builderCollect() 105 this.builderCollect()
  106 + } else if (item == 'listen') {
  107 + this.builderListen()
97 } else if (item == 'share') { 108 } else if (item == 'share') {
98 this.builderShare() 109 this.builderShare()
99 } else { 110 } else {
@@ -175,6 +186,25 @@ export struct OperRowListView { @@ -175,6 +186,25 @@ export struct OperRowListView {
175 } 186 }
176 187
177 /** 188 /**
  189 + * 音频组件
  190 + */
  191 + // this.audioUrl
  192 + @Builder
  193 + builderListen() {
  194 + Column() {
  195 + Image($r('app.media.icon_listen'))
  196 + .width(24)
  197 + .height(24)
  198 + .aspectRatio(1)
  199 + .interpolation(ImageInterpolation.High)
  200 + .onClick((event: ClickEvent) => {
  201 + ToastUtils.showToast('音频为公共方法,待开发', 1000);
  202 + })
  203 + }
  204 + .width(42)
  205 + }
  206 +
  207 + /**
178 * 分享组件 208 * 分享组件
179 */ 209 */
180 @Builder 210 @Builder
@@ -232,7 +262,6 @@ export struct OperRowListView { @@ -232,7 +262,6 @@ export struct OperRowListView {
232 262
233 } 263 }
234 PageRepository.postExecuteCollectRecord(params).then(res => { 264 PageRepository.postExecuteCollectRecord(params).then(res => {
235 - // console.log(TAG, '收藏、取消收藏', 'toggleLikeStatus==',)  
236 if (this.newsStatusOfUser) { 265 if (this.newsStatusOfUser) {
237 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 266 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
238 this.queryContentInteractCount() 267 this.queryContentInteractCount()
@@ -258,10 +287,13 @@ export struct OperRowListView { @@ -258,10 +287,13 @@ export struct OperRowListView {
258 this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum) 287 this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
259 this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum) 288 this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
260 // 评论组件需要数据 289 // 评论组件需要数据
261 - this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0' 290 + if (Number.parseInt(this.interactData.commentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
  291 + this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0'
  292 + }
262 } 293 }
263 // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) 294 // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res))
264 - console.log(TAG, 'this.interactData', JSON.stringify(this.interactData)) 295 + console.log(TAG, 'this.interactData44', JSON.stringify(this.interactData))
  296 + console.log(TAG, 'this.publishCommentModel', JSON.stringify(this.publishCommentModel))
265 }) 297 })
266 } 298 }
267 } 299 }
@@ -283,7 +283,7 @@ export class PageRepository { @@ -283,7 +283,7 @@ export class PageRepository {
283 * @returns 283 * @returns
284 */ 284 */
285 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> { 285 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
286 - let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD 286 + let url = HttpUrlUtils.getExecuteCollcetUrl()
287 return WDHttp.post(url, params) 287 return WDHttp.post(url, params)
288 } 288 }
289 289
@@ -35,7 +35,7 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, @@ -35,7 +35,7 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel,
35 touchUpPullRefresh(pageModel, pageAdvModel); 35 touchUpPullRefresh(pageModel, pageAdvModel);
36 } else { 36 } else {
37 // Fingers up, handle loading more. 37 // Fingers up, handle loading more.
38 - touchUpLoadMore(pageModel); 38 + // touchUpLoadMore(pageModel);
39 } 39 }
40 break; 40 break;
41 default: 41 default:
@@ -4,13 +4,18 @@ import PageHelper from '../viewmodel/PageHelper'; @@ -4,13 +4,18 @@ import PageHelper from '../viewmodel/PageHelper';
4 4
5 export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { 5 export function touchMoveLoadMore(model: PageModel, event: TouchEvent) {
6 // list size +1 6 // list size +1
7 - if (model.endIndex === model.compList.totalCount() || model.endIndex === model.compList.totalCount() + 1) {  
8 - model.offsetY = event.touches[0].y - model.downY;  
9 - if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) {  
10 - model.isCanLoadMore = true;  
11 - model.isVisiblePullUpLoad = true;  
12 - model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT;  
13 - } 7 + if (model.endIndex >= model.compList.totalCount()-3 && model.endIndex <= model.compList.totalCount()) {
  8 + // model.offsetY = event.touches[0].y - model.downY;
  9 + // if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) {
  10 + // model.isCanLoadMore = true;
  11 + // model.isVisiblePullUpLoad = true;
  12 + // model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT;
  13 + // }
  14 +
  15 + // 不用分页动画,直接预加载
  16 + model.isCanLoadMore = true;
  17 + model.isVisiblePullUpLoad = true;
  18 + touchUpLoadMore(model);
14 } 19 }
15 } 20 }
16 21
@@ -29,9 +29,6 @@ export class LogoutViewModel{ @@ -29,9 +29,6 @@ export class LogoutViewModel{
29 SPHelper.default.saveSync(SpConstants.USER_Type, '') 29 SPHelper.default.saveSync(SpConstants.USER_Type, '')
30 SPHelper.default.saveSync(SpConstants.USER_NAME, '') 30 SPHelper.default.saveSync(SpConstants.USER_NAME, '')
31 SPHelper.default.saveSync(SpConstants.USER_PHONE, '') 31 SPHelper.default.saveSync(SpConstants.USER_PHONE, '')
32 - HttpUtils.setUserId("")  
33 - HttpUtils.setUserType("")  
34 - HttpUtils.setUserToken('')  
35 UserDataLocal.clearUserData() 32 UserDataLocal.clearUserData()
36 } 33 }
37 } 34 }
1 import { Logger } from 'wdKit'; 1 import { Logger } from 'wdKit';
2 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 2 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
3 -import HashMap from '@ohos.util.HashMap';  
4 import { 3 import {
5 RmhRecommendDTO, 4 RmhRecommendDTO,
6 PeopleShipContentListDTO, 5 PeopleShipContentListDTO,
7 - AttentionBatchDTO 6 + AttentionBatchDTO,
  7 + contentListParams,
  8 + InteractDataDTO
8 } from 'wdBean'; 9 } from 'wdBean';
  10 +import { PageRepository } from '../repository/PageRepository'
9 11
10 const TAG = 'PeopleShipMainViewModel' 12 const TAG = 'PeopleShipMainViewModel'
11 13
@@ -103,5 +105,24 @@ export class PeopleShipMainViewModel { @@ -103,5 +105,24 @@ export class PeopleShipMainViewModel {
103 }) 105 })
104 } 106 }
105 107
  108 + static async getContentInteractInfo(params: contentListParams): Promise<InteractDataDTO[]> {
  109 + return new Promise<InteractDataDTO[]>((success, error) => {
  110 + Logger.debug(TAG, `getContentInteractInfo pageInfo start`);
  111 + PageRepository.getContentInteract(params)
  112 + .then((resDTO) => {
  113 + if (!resDTO.data || resDTO.code != 0) {
  114 + error(resDTO.message)
  115 + return
  116 + }
  117 + Logger.debug(TAG, "getContentInteractInfo then,navResDTO.timestamp:" + resDTO.timestamp);
  118 + success(resDTO.data);
  119 + })
  120 + .catch((err: Error) => {
  121 + Logger.error(TAG, `getContentInteractInfo catch, error.name : ${err.name}, error.message:${err.message}`);
  122 + error(err);
  123 + })
  124 + })
  125 + }
  126 +
106 127
107 } 128 }
@@ -288,7 +288,7 @@ export class ContentDetailRequest { @@ -288,7 +288,7 @@ export class ContentDetailRequest {
288 * @returns 288 * @returns
289 */ 289 */
290 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> { 290 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
291 - let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD 291 + let url = HttpUrlUtils.getExecuteCollcetUrl()
292 return WDHttp.post(url, params) 292 return WDHttp.post(url, params)
293 } 293 }
294 294
@@ -16,5 +16,6 @@ @@ -16,5 +16,6 @@
16 "wdConstant": "file:../../commons/wdConstant", 16 "wdConstant": "file:../../commons/wdConstant",
17 "wdDetailPlayApi": "file:../../features/wdDetailPlayApi", 17 "wdDetailPlayApi": "file:../../features/wdDetailPlayApi",
18 // "wdComponent": "file:../../features/wdComponent" 18 // "wdComponent": "file:../../features/wdComponent"
  19 + "wdShare": "file:../../features/wdShare"
19 } 20 }
20 } 21 }
@@ -11,6 +11,7 @@ import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit'; @@ -11,6 +11,7 @@ import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit';
11 import { WDPlayerController } from 'wdPlayer/Index'; 11 import { WDPlayerController } from 'wdPlayer/Index';
12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
13 import { SpConstants } from 'wdConstant/Index' 13 import { SpConstants } from 'wdConstant/Index'
  14 +import { WDShare } from "wdShare"
14 15
15 interface ILikeStyleResp { 16 interface ILikeStyleResp {
16 url: Resource; 17 url: Resource;
@@ -336,6 +337,8 @@ export struct PlayerRightView { @@ -336,6 +337,8 @@ export struct PlayerRightView {
336 .aspectRatio(1) 337 .aspectRatio(1)
337 .onClick((event: ClickEvent) => { 338 .onClick((event: ClickEvent) => {
338 ToastUtils.showToast('分享为公共方法,待开发', 1000); 339 ToastUtils.showToast('分享为公共方法,待开发', 1000);
  340 +
  341 + this.share()
339 }) 342 })
340 Text('分享') 343 Text('分享')
341 .width('100%') 344 .width('100%')
@@ -349,4 +352,9 @@ export struct PlayerRightView { @@ -349,4 +352,9 @@ export struct PlayerRightView {
349 } 352 }
350 .margin({ bottom: 20 }) 353 .margin({ bottom: 20 })
351 } 354 }
  355 +
  356 + share() {
  357 +
  358 + WDShare.shareContent(this.contentDetailData)
  359 + }
352 } 360 }
@@ -9,8 +9,6 @@ import { ResponseDTO } from 'wdNetwork/Index'; @@ -9,8 +9,6 @@ import { ResponseDTO } from 'wdNetwork/Index';
9 * 系统定位服务实现 9 * 系统定位服务实现
10 * */ 10 * */
11 export class HWLocationUtils { 11 export class HWLocationUtils {
12 -  
13 -  
14 static LOCATION: Permissions = 'ohos.permission.LOCATION' 12 static LOCATION: Permissions = 'ohos.permission.LOCATION'
15 static APPROXIMATELY_LOCATION: Permissions = 'ohos.permission.APPROXIMATELY_LOCATION' 13 static APPROXIMATELY_LOCATION: Permissions = 'ohos.permission.APPROXIMATELY_LOCATION'
16 14
@@ -115,17 +113,23 @@ export class HWLocationUtils { @@ -115,17 +113,23 @@ export class HWLocationUtils {
115 if (cityName == name) { 113 if (cityName == name) {
116 return 114 return
117 } 115 }
118 - let code = await HWLocationUtils.getCityCode(data[0].administrativeArea, data[0].subAdministrativeArea)  
119 - if (code) { 116 + // code=[省份code,城市code]
  117 + let code: string[] = await HWLocationUtils.getCityCode(data[0].administrativeArea, data[0].subAdministrativeArea)
  118 + if (code && code.length >= 2) {
120 SPHelper.default.save(SpConstants.LOCATION_CITY_NAME, cityName) 119 SPHelper.default.save(SpConstants.LOCATION_CITY_NAME, cityName)
121 - SPHelper.default.save(SpConstants.LOCATION_CITY_CODE, code) 120 + SPHelper.default.save(SpConstants.LOCATION_PROVINCE_CODE, code[0])
  121 + SPHelper.default.save(SpConstants.LOCATION_CITY_CODE, code[1])
  122 + }
  123 + if (data[0].descriptions && data[0].descriptions.length > 1) {
  124 + // 保存区县code,9位数字
  125 + let districtCode = data[0].descriptions[1] || ''
  126 + SPHelper.default.save(SpConstants.LOCATION_DISTRICT_CODE, districtCode)
122 } 127 }
123 } 128 }
124 } 129 }
125 }) 130 })
126 } 131 }
127 132
128 -  
129 //取消定位 133 //取消定位
130 static cancelLocation() { 134 static cancelLocation() {
131 // geoLocationManager.off('locationChange') 135 // geoLocationManager.off('locationChange')
@@ -143,10 +147,14 @@ export class HWLocationUtils { @@ -143,10 +147,14 @@ export class HWLocationUtils {
143 if (bean.code == 0 && bean.data) { 147 if (bean.code == 0 && bean.data) {
144 for (let i = 0; i < bean.data.length; i++) { 148 for (let i = 0; i < bean.data.length; i++) {
145 if (bean.data[i].label == administrativeArea) { 149 if (bean.data[i].label == administrativeArea) {
  150 + let str:string[] = []
  151 + let provinceCode = bean.data[i].code
  152 + str[0] = provinceCode
146 for (let j = 0; j < bean.data[i].children.length; j++) { 153 for (let j = 0; j < bean.data[i].children.length; j++) {
147 if (bean.data[i].children[j].label == cityName) { 154 if (bean.data[i].children[j].label == cityName) {
148 Logger.debug("huaw" + bean.data[i].children[j].code) 155 Logger.debug("huaw" + bean.data[i].children[j].code)
149 - return bean.data[i].children[j].code 156 + str[1] = bean.data[i].children[j].code
  157 + return str
150 } 158 }
151 } 159 }
152 } 160 }
@@ -155,7 +163,7 @@ export class HWLocationUtils { @@ -155,7 +163,7 @@ export class HWLocationUtils {
155 163
156 } 164 }
157 } 165 }
158 - return '' 166 + return []
159 } 167 }
160 168
161 // 通过省份code获取省份名称 169 // 通过省份code获取省份名称
@@ -55,9 +55,6 @@ export class LoginViewModel { @@ -55,9 +55,6 @@ export class LoginViewModel {
55 SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) 55 SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
56 SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) 56 SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
57 SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) 57 SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
58 - HttpUtils.setUserId(data.id+"")  
59 - HttpUtils.setUserType(data.userType+"")  
60 - HttpUtils.setUserToken(data.jwtToken)  
61 success(data) 58 success(data)
62 }).catch((error:string) => { 59 }).catch((error:string) => {
63 fail(error) 60 fail(error)
@@ -85,9 +82,6 @@ export class LoginViewModel { @@ -85,9 +82,6 @@ export class LoginViewModel {
85 SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) 82 SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status)
86 SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) 83 SPHelper.default.saveSync(SpConstants.USER_Type, data.userType)
87 SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) 84 SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName)
88 - HttpUtils.setUserId(data.id+"")  
89 - HttpUtils.setUserType(data.userType+"")  
90 - HttpUtils.setUserToken(data.jwtToken)  
91 success(data) 85 success(data)
92 }).catch((value: string) => { 86 }).catch((value: string) => {
93 fail(value) 87 fail(value)
@@ -163,9 +157,6 @@ export class LoginViewModel { @@ -163,9 +157,6 @@ export class LoginViewModel {
163 SPHelper.default.saveSync(SpConstants.USER_STATUS, '') 157 SPHelper.default.saveSync(SpConstants.USER_STATUS, '')
164 SPHelper.default.saveSync(SpConstants.USER_Type, '') 158 SPHelper.default.saveSync(SpConstants.USER_Type, '')
165 SPHelper.default.saveSync(SpConstants.USER_NAME, '') 159 SPHelper.default.saveSync(SpConstants.USER_NAME, '')
166 - HttpUtils.setUserId("")  
167 - HttpUtils.setUserType("")  
168 - HttpUtils.setUserToken('')  
169 success(data) 160 success(data)
170 }).catch((message: string) => { 161 }).catch((message: string) => {
171 fail(message) 162 fail(message)
@@ -43,8 +43,8 @@ export struct WDPlayerRenderView { @@ -43,8 +43,8 @@ export struct WDPlayerRenderView {
43 private xComponentController: XComponentController = new XComponentController(); 43 private xComponentController: XComponentController = new XComponentController();
44 private insId: string = "WDPlayRenderView" + insIndex; 44 private insId: string = "WDPlayRenderView" + insIndex;
45 onLoad?: ((event?: object) => void); 45 onLoad?: ((event?: object) => void);
46 - @State videoWidth: number = 0  
47 - @State videoHeight: number = 0 46 + @State videoWidth: number = 16
  47 + @State videoHeight: number = 9
48 @State selfSize: Size = new Size('100%', '100%'); 48 @State selfSize: Size = new Size('100%', '100%');
49 49
50 aboutToAppear() { 50 aboutToAppear() {
  1 +/node_modules
  2 +/oh_modules
  3 +/.preview
  4 +/build
  5 +/.cxx
  6 +/.test
  1 +
  2 +export { WDShare } from './src/main/ets/WDShare'
  3 +
  1 +{
  2 + "apiType": "stageMode",
  3 + "buildOption": {
  4 + },
  5 + "buildOptionSet": [
  6 + {
  7 + "name": "release",
  8 + "arkOptions": {
  9 + "obfuscation": {
  10 + "ruleOptions": {
  11 + "enable": true,
  12 + "files": [
  13 + "./obfuscation-rules.txt"
  14 + ]
  15 + }
  16 + }
  17 + },
  18 + },
  19 + ],
  20 + "targets": [
  21 + {
  22 + "name": "default"
  23 + }
  24 + ]
  25 +}
  1 +import { hspTasks } from '@ohos/hvigor-ohos-plugin';
  2 +
  3 +export default {
  4 + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
  5 + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
  6 +}
  1 +# Define project specific obfuscation rules here.
  2 +# You can include the obfuscation configuration files in the current module's build-profile.json5.
  3 +#
  4 +# For more details, see
  5 +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
  6 +
  7 +# Obfuscation options:
  8 +# -disable-obfuscation: disable all obfuscations
  9 +# -enable-property-obfuscation: obfuscate the property names
  10 +# -enable-toplevel-obfuscation: obfuscate the names in the global scope
  11 +# -compact: remove unnecessary blank spaces and all line feeds
  12 +# -remove-log: remove all console.* statements
  13 +# -print-namecache: print the name cache that contains the mapping from the old names to new names
  14 +# -apply-namecache: reuse the given cache file
  15 +
  16 +# Keep options:
  17 +# -keep-property-name: specifies property names that you want to keep
  18 +# -keep-global-name: specifies names that you want to keep in the global scope
  1 +{
  2 + "meta": {
  3 + "stableOrder": true
  4 + },
  5 + "lockfileVersion": 3,
  6 + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
  7 + "specifiers": {
  8 + "@ohos/axios@^2.1.1": "@ohos/axios@2.2.0",
  9 + "wdBean@../wdBean": "wdBean@../wdBean",
  10 + "wdConstant@../../commons/wdConstant": "wdConstant@../../commons/wdConstant",
  11 + "wdKit@../../commons/wdKit": "wdKit@../../commons/wdKit",
  12 + "wdNetwork@../../commons/wdNetwork": "wdNetwork@../../commons/wdNetwork",
  13 + "wdRouter@../../commons/wdRouter": "wdRouter@../../commons/wdRouter",
  14 + "wdShareBase@../../commons/wdShareBase": "wdShareBase@../../commons/wdShareBase"
  15 + },
  16 + "packages": {
  17 + "@ohos/axios@2.2.0": {
  18 + "name": "@ohos/axios",
  19 + "integrity": "sha512-v1QBWk6DfcN8wUW3D0ieFbHTR1taSI5cOgxp5l6B5cegXuNYhSc8ggKlAIXe6h/14LsfM+NW0ZGfSXcNEIM5yA==",
  20 + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/axios/-/axios-2.2.0.har",
  21 + "registryType": "ohpm"
  22 + },
  23 + "wdBean@../wdBean": {
  24 + "name": "wdbean",
  25 + "resolved": "../wdBean",
  26 + "registryType": "local"
  27 + },
  28 + "wdConstant@../../commons/wdConstant": {
  29 + "name": "wdconstant",
  30 + "resolved": "../../commons/wdConstant",
  31 + "registryType": "local"
  32 + },
  33 + "wdKit@../../commons/wdKit": {
  34 + "name": "wdkit",
  35 + "resolved": "../../commons/wdKit",
  36 + "registryType": "local"
  37 + },
  38 + "wdNetwork@../../commons/wdNetwork": {
  39 + "name": "wdnetwork",
  40 + "resolved": "../../commons/wdNetwork",
  41 + "registryType": "local",
  42 + "dependencies": {
  43 + "wdConstant": "file:../wdConstant",
  44 + "wdKit": "file:../wdKit",
  45 + "@ohos/axios": "^2.1.1"
  46 + }
  47 + },
  48 + "wdRouter@../../commons/wdRouter": {
  49 + "name": "wdrouter",
  50 + "resolved": "../../commons/wdRouter",
  51 + "registryType": "local",
  52 + "dependencies": {
  53 + "wdKit": "file:../wdKit",
  54 + "wdBean": "file:../../features/wdBean",
  55 + "wdNetwork": "file:../../commons/wdNetwork",
  56 + "wdConstant": "file:../../commons/wdConstant"
  57 + }
  58 + },
  59 + "wdShareBase@../../commons/wdShareBase": {
  60 + "name": "wdsharebase",
  61 + "resolved": "../../commons/wdShareBase",
  62 + "registryType": "local",
  63 + "packageType": "InterfaceHar"
  64 + }
  65 + }
  66 +}
  1 +{
  2 + "name": "wdshare",
  3 + "version": "1.0.0",
  4 + "description": "Please describe the basic information.",
  5 + "main": "Index.ets",
  6 + "author": "",
  7 + "license": "Apache-2.0",
  8 + "packageType": "InterfaceHar",
  9 + "dependencies": {
  10 + "wdKit": "file:../../commons/wdKit",
  11 + "wdBean": "file:../../features/wdBean",
  12 + "wdRouter": "file:../../commons/wdRouter",
  13 + "wdShareBase": "file:../../commons/wdShareBase"
  14 + }
  15 +}
  1 +import { ContentDetailDTO, ContentDTO, PageInfoDTO } from 'wdBean/Index';
  2 +import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index';
  3 +import { ShareContentType } from 'wdShareBase/src/main/ets/Constant';
  4 +
  5 +export class WDShare {
  6 +
  7 + static shareContent(content: ContentDetailDTO, pageName: string ="", pageId: string = "") {
  8 +
  9 + //TODO: 处理分享弹框交互和 海报逻辑
  10 +
  11 + WDShareBase.getInstance().share({
  12 + to: ShareType.System,
  13 + scene: ShareScene.System,
  14 + type: ShareContentType.Link,
  15 + obj: {
  16 + title: content.shareInfo.shareTitle,
  17 + desc: content.shareInfo.shareSummary,
  18 + link: content.shareInfo.shareUrl,
  19 + }
  20 + })
  21 + }
  22 +
  23 + static shareProgram(program: ContentDTO, pageName: string ="", pageId: string = "") {
  24 +
  25 + }
  26 +
  27 + static shareSubject(subject: PageInfoDTO) {
  28 +
  29 +
  30 + }
  31 +
  32 +}
  1 +@Entry
  2 +@Component
  3 +struct Index {
  4 + @State message: string = 'Hello World';
  5 +
  6 + build() {
  7 + Row() {
  8 + Column() {
  9 + Text(this.message)
  10 + .fontSize(50)
  11 + .fontWeight(FontWeight.Bold)
  12 + }
  13 + .width('100%')
  14 + }
  15 + .height('100%')
  16 + }
  17 +}
  1 +export function add(a:number, b:number) {
  2 + return a + b;
  3 +}
  1 +{
  2 + "module": {
  3 + "name": "wdShare",
  4 + "type": "shared",
  5 + "description": "$string:shared_desc",
  6 + "deviceTypes": [
  7 + "phone",
  8 + "tablet",
  9 + "2in1"
  10 + ],
  11 + "deliveryWithInstall": true,
  12 + "pages": "$profile:main_pages"
  13 + }
  14 +}
  1 +{
  2 + "color": [
  3 + {
  4 + "name": "white",
  5 + "value": "#FFFFFF"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "string": [
  3 + {
  4 + "name": "shared_desc",
  5 + "value": "description"
  6 + }
  7 + ]
  8 +}
  1 +{
  2 + "src": [
  3 + "pages/Index"
  4 + ]
  5 +}
  1 +import localUnitTest from './LocalUnit.test';
  2 +
  3 +export default function testsuite() {
  4 + localUnitTest();
  5 +}
  1 +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
  2 +
  3 +export default function localUnitTest() {
  4 + describe('localUnitTest',() => {
  5 + // Defines a test suite. Two parameters are supported: test suite name and test suite function.
  6 + beforeAll(() => {
  7 + // Presets an action, which is performed only once before all test cases of the test suite start.
  8 + // This API supports only one parameter: preset action function.
  9 + });
  10 + beforeEach(() => {
  11 + // Presets an action, which is performed before each unit test case starts.
  12 + // The number of execution times is the same as the number of test cases defined by **it**.
  13 + // This API supports only one parameter: preset action function.
  14 + });
  15 + afterEach(() => {
  16 + // Presets a clear action, which is performed after each unit test case ends.
  17 + // The number of execution times is the same as the number of test cases defined by **it**.
  18 + // This API supports only one parameter: clear action function.
  19 + });
  20 + afterAll(() => {
  21 + // Presets a clear action, which is performed after all test cases of the test suite end.
  22 + // This API supports only one parameter: clear action function.
  23 + });
  24 + it('assertContain', 0, () => {
  25 + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
  26 + let a = 'abc';
  27 + let b = 'b';
  28 + // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
  29 + expect(a).assertContain(b);
  30 + expect(a).assertEqual(a);
  31 + });
  32 + });
  33 +}
@@ -16,6 +16,7 @@ import { @@ -16,6 +16,7 @@ import {
16 } from 'wdKit'; 16 } from 'wdKit';
17 import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; 17 import { HostEnum, HostManager, WDHttp } from 'wdNetwork';
18 import { LoginModule } from 'wdLogin/src/main/ets/LoginModule'; 18 import { LoginModule } from 'wdLogin/src/main/ets/LoginModule';
  19 +import { ConfigurationConstant } from '@kit.AbilityKit';
19 20
20 export default class EntryAbility extends UIAbility { 21 export default class EntryAbility extends UIAbility {
21 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 22 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
@@ -29,7 +30,8 @@ export default class EntryAbility extends UIAbility { @@ -29,7 +30,8 @@ export default class EntryAbility extends UIAbility {
29 if (StringUtils.isNotEmpty(spHostUrl)) { 30 if (StringUtils.isNotEmpty(spHostUrl)) {
30 HostManager.changeHost(spHostUrl as HostEnum) 31 HostManager.changeHost(spHostUrl as HostEnum)
31 } 32 }
32 - 33 + // 还没深色模式需求,暂直接不跟随系统。
  34 + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
33 // 注册监听网络连接 35 // 注册监听网络连接
34 EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { 36 EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => {
35 let type: NetworkType | null = null 37 let type: NetworkType | null = null