张善主

Merge remote-tracking branch 'origin/main'

@@ -39,14 +39,14 @@ class AppLoginAuthInfo { @@ -39,14 +39,14 @@ class AppLoginAuthInfo {
39 } 39 }
40 40
41 interface IDataJson { 41 interface IDataJson {
42 - jumpType:number  
43 - jumpUrl:string  
44 - newsId:string  
45 - newsObjectLevel:string  
46 - newsObjectType:number  
47 - newsRelId:string  
48 - newsTitle:string  
49 - pageId:string 42 + jumpType: number
  43 + jumpUrl: string
  44 + newsId: string
  45 + newsObjectLevel: string
  46 + newsObjectType: number
  47 + newsRelId: string
  48 + newsTitle: string
  49 + pageId: string
50 } 50 }
51 51
52 /** 52 /**
@@ -159,59 +159,64 @@ function handleJsCallAppInnerLinkMethod(data: Message) { @@ -159,59 +159,64 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
159 content.objectType = ''; 159 content.objectType = '';
160 content.linkUrl = encodeURI(urlParams.get('url') || ''); 160 content.linkUrl = encodeURI(urlParams.get('url') || '');
161 switch (urlParams.get('type')) { 161 switch (urlParams.get('type')) {
162 - case 'video':  
163 - content.objectType = ContentConstants.TYPE_VOD  
164 - ProcessUtils.processPage(content)  
165 - break;  
166 - case 'live':  
167 - content.objectType = ContentConstants.TYPE_LIVE  
168 - ProcessUtils.processPage(content)  
169 - break;  
170 - case 'article':  
171 - content.objectType = ContentConstants.TYPE_TELETEXT  
172 - ProcessUtils.processPage(content)  
173 - break;  
174 - case 'picture':  
175 - content.objectType = ContentConstants.TYPE_NINE  
176 - ProcessUtils.processPage(content)  
177 - break;  
178 - case 'audio':  
179 - content.objectType = ContentConstants.TYPE_AUDIO 162 + case 'video':
  163 + content.objectType = ContentConstants.TYPE_VOD
  164 + ProcessUtils.processPage(content)
  165 + break;
  166 + case 'live':
  167 + content.objectType = ContentConstants.TYPE_LIVE
  168 + ProcessUtils.processPage(content)
  169 + break;
  170 + case 'article':
  171 + content.objectType = ContentConstants.TYPE_TELETEXT
  172 + ProcessUtils.processPage(content)
  173 + break;
  174 + case 'picture':
  175 + content.objectType = ContentConstants.TYPE_NINE
  176 + ProcessUtils.processPage(content)
  177 + break;
  178 + case 'audio':
  179 + content.objectType = ContentConstants.TYPE_AUDIO
  180 + ProcessUtils.processPage(content)
  181 + break;
  182 + case 'h5':
  183 + if (urlParams.get('skipType') === '1') {
  184 + content.objectType = ContentConstants.TYPE_LINK
180 ProcessUtils.processPage(content) 185 ProcessUtils.processPage(content)
181 - break;  
182 - case 'h5':  
183 - if (urlParams.get('skipType') === '1') {  
184 - content.objectType = ContentConstants.TYPE_LINK  
185 - ProcessUtils.processPage(content)  
186 - }  
187 - if (urlParams.get('skipType') === '4') {  
188 - content.objectType = ContentConstants.TYPE_LINK  
189 - ProcessUtils.jumpExternalWebPage(content.linkUrl)  
190 - }  
191 - break;  
192 - case 'topic':  
193 - if (urlParams.get('subType') === 'h5') {  
194 - content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC  
195 - ProcessUtils.processPage(content)  
196 - }  
197 - if (urlParams.get('subType') === 'moring_evening_news') {  
198 - ProcessUtils.gotoMorningEveningPaper()  
199 - }  
200 - if (urlParams.get('subType') === 'electronic_newspapers') {  
201 - ProcessUtils.gotoENewsPaper()  
202 - }  
203 - break;  
204 - case 'dynamic':  
205 - content.objectType = ContentConstants.TYPE_FOURTEEN 186 + }
  187 + if (urlParams.get('skipType') === '4') {
  188 + content.objectType = ContentConstants.TYPE_LINK
  189 + ProcessUtils.jumpExternalWebPage(content.linkUrl)
  190 + }
  191 + break;
  192 + case 'topic':
  193 + if (urlParams.get('subType') === 'h5') {
  194 + content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC
206 ProcessUtils.processPage(content) 195 ProcessUtils.processPage(content)
207 - break;  
208 - case 'owner_page':  
209 - let creatorId = urlParams.get('creatorId') || ''  
210 - ProcessUtils.gotoPeopleShipHomePage(creatorId)  
211 - break;  
212 - default:  
213 - break;  
214 - } 196 + }
  197 + if (urlParams.get('subType') === 'moring_evening_news') {
  198 + ProcessUtils.gotoMorningEveningPaper()
  199 + }
  200 + if (urlParams.get('subType') === 'electronic_newspapers') {
  201 + ProcessUtils.gotoENewsPaper()
  202 + }
  203 + break;
  204 + case 'dynamic':
  205 + content.objectType = ContentConstants.TYPE_FOURTEEN
  206 + ProcessUtils.processPage(content)
  207 + break;
  208 + case 'owner_page':
  209 + let creatorId = urlParams.get('creatorId') || ''
  210 + ProcessUtils.gotoPeopleShipHomePage(creatorId)
  211 + break;
  212 + case 'app':
  213 + if (urlParams.get('subType') === 'login') {
  214 + ProcessUtils.gotoLoginPage()
  215 + }
  216 + break;
  217 + default:
  218 + break;
  219 + }
215 220
216 } 221 }
217 222
1 import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; 1 import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
2 -import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';  
3 -import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork'; 2 +import { WDHttp, HttpUrlUtils } from 'wdNetwork';
4 3
5 const TAG = 'JsCallAppService' 4 const TAG = 'JsCallAppService'
6 5
7 6
8 export function handleJsCallAppService(data: Message, callback: (res: string) => void) { 7 export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
9 - let url: string = HttpUrlUtils.getHost() + data?.data?.url 8 + if (data?.data?.method === 'get') {
  9 + let queryString: string = ''
  10 + let parameters = data?.data?.parameters
  11 + if (parameters) {
  12 + queryString = Object.keys(parameters)
  13 + .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters?.[key])}`)
  14 + .join('&');
  15 + }
10 16
11 - let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>  
12 -  
13 - let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {  
14 - netError: '0',  
15 - responseMap  
16 - } as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> 17 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
  18 + if (queryString) {
  19 + url = url + `?${queryString}`
  20 + }
  21 + console.log('yzl', queryString, url)
  22 + WDHttp.get(url).then((res) => {
  23 + callback(JSON.stringify({
  24 + netError: '0',
  25 + responseMap: res
  26 + }))
  27 + })
  28 + }
  29 + if (data?.data?.method === 'post') {
  30 + let url: string = HttpUrlUtils.getHost() + data?.data?.url
17 31
18 - // if (data?.data?.method === 'get') {  
19 - // WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {  
20 - // callback(JSON.stringify(res))  
21 - // })  
22 - // }  
23 - if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {  
24 - WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {  
25 - h5ReceiveDataJson.responseMap = res  
26 - callback(JSON.stringify(h5ReceiveDataJson)) 32 + WDHttp.post(url, data?.data?.parameters).then((res) => {
  33 + callback(JSON.stringify({
  34 + netError: '0',
  35 + responseMap: res
  36 + }))
27 }) 37 })
28 } 38 }
29 } 39 }
@@ -9,4 +9,5 @@ export interface commentInfo { @@ -9,4 +9,5 @@ export interface commentInfo {
9 relId: string; 9 relId: string;
10 relType: string; 10 relType: string;
11 userId: string; 11 userId: string;
  12 + newsType?: string
12 } 13 }
1 /** 1 /**
2 * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等 2 * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
3 */ 3 */
  4 +import {
  5 + ContentDetailRequest,
  6 + postInteractAccentionOperateParams
  7 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
4 import { RmhInfoDTO } from 'wdBean' 8 import { RmhInfoDTO } from 'wdBean'
5 import { CommonConstants } from 'wdConstant/Index'; 9 import { CommonConstants } from 'wdConstant/Index';
6 -import { DateTimeUtils, SPHelper } from 'wdKit'; 10 +import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit';
7 import { SpConstants } from 'wdConstant/Index' 11 import { SpConstants } from 'wdConstant/Index'
8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 12 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
9 import router from '@ohos.router' 13 import router from '@ohos.router'
  14 +import { postBatchAttentionStatusParams } from 'wdBean/Index';
  15 +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'
10 16
11 @Component 17 @Component
12 export struct RmhTitle { 18 export struct RmhTitle {
13 @Prop rmhInfo: RmhInfoDTO 19 @Prop rmhInfo: RmhInfoDTO
14 @Prop publishTime: string | undefined 20 @Prop publishTime: string | undefined
  21 + /**
  22 + * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏
  23 + */
15 @Prop hideTime: boolean 24 @Prop hideTime: boolean
  25 + /**
  26 + * 默认未关注 点击去关注
  27 + */
  28 + @State followStatus: String = '0';
16 29
17 - async appointReq() { 30 + /**
  31 + * 关注号主
  32 + */
  33 + async handleAccention() {
18 // 未登录,跳转登录 34 // 未登录,跳转登录
19 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 35 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
20 if (!user_id) { 36 if (!user_id) {
21 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 37 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
22 return 38 return
23 } 39 }
  40 +
  41 + const params2: postInteractAccentionOperateParams = {
  42 + attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  43 + attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id
  44 + attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id
  45 + status: this.followStatus == '0' ? 1 : 0,
  46 + }
  47 + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
  48 + console.log('关注号主==', JSON.stringify(res.data))
  49 + if (this.followStatus == '1') {
  50 + this.followStatus = '0'
  51 + } else {
  52 + this.followStatus = '1'
  53 + // 弹窗样式与何时调用待确认
  54 + ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
  55 + console.log('关注号主获取积分==', JSON.stringify(res.data))
  56 + if (res.data?.showToast) {
  57 + ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
  58 + }
  59 + })
  60 + }
  61 + })
  62 + }
  63 + /**
  64 + * 查询当前登录用户是否关注作品号主
  65 + * */
  66 + private async getBatchAttentionStatus() {
  67 + try {
  68 + const params: postBatchAttentionStatusParams = {
  69 + creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }]
  70 + }
  71 + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
  72 + this.followStatus = data[0]?.status;
  73 + Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`)
  74 + } catch (exception) {
  75 +
  76 + }
24 } 77 }
25 78
26 aboutToAppear(): void { 79 aboutToAppear(): void {
@@ -28,6 +81,8 @@ export struct RmhTitle { @@ -28,6 +81,8 @@ export struct RmhTitle {
28 if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { 81 if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
29 this.hideTime = true; 82 this.hideTime = true;
30 } 83 }
  84 +
  85 + this.getBatchAttentionStatus()
31 } 86 }
32 87
33 getDaysBetweenDates(date: number) { 88 getDaysBetweenDates(date: number) {
@@ -88,17 +143,20 @@ export struct RmhTitle { @@ -88,17 +143,20 @@ export struct RmhTitle {
88 Blank() 143 Blank()
89 if (this.rmhInfo.cnIsAttention) { 144 if (this.rmhInfo.cnIsAttention) {
90 Row() { 145 Row() {
91 - Image($r('app.media.rmh_follow'))  
92 - .width(16)  
93 - .height(16)  
94 - Text('关注') 146 + if (this.followStatus === '0') {
  147 + Image($r('app.media.rmh_follow'))
  148 + .width(16)
  149 + .height(16)
  150 + }
  151 +
  152 + Text(this.followStatus === '0' ? '关注' : '已关注')
95 .fontSize($r('app.float.font_size_13')) 153 .fontSize($r('app.float.font_size_13'))
96 .fontColor($r('app.color.color_ED2800')) 154 .fontColor($r('app.color.color_ED2800'))
97 } 155 }
98 .flexShrink(0) 156 .flexShrink(0)
99 .alignSelf(ItemAlign.Center) 157 .alignSelf(ItemAlign.Center)
100 .onClick(() => { 158 .onClick(() => {
101 - this.appointReq(); 159 + this.handleAccention();
102 }) 160 })
103 } 161 }
104 } 162 }
1 -import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; 1 +import { commentInfo, CompDTO, ContentDTO, Params, batchLikeAndCollectResult } from 'wdBean';
2 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 2 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
3 -import { DateTimeUtils, SPHelper } from 'wdKit/Index'; 3 +import { DateTimeUtils, SPHelper, Logger } from 'wdKit/Index';
4 import { ProcessUtils } from 'wdRouter'; 4 import { ProcessUtils } from 'wdRouter';
5 import { SpConstants } from 'wdConstant/Index' 5 import { SpConstants } from 'wdConstant/Index'
  6 +import {
  7 + batchLikeAndCollectParams,
  8 + ContentDetailRequest,
  9 + contentListParams,
  10 + postExecuteCollectRecordParams,
  11 + postExecuteLikeParams,
  12 + postInteractAccentionOperateParams
  13 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
  14 +import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
6 15
7 /** 16 /**
8 * 精选评论卡 17 * 精选评论卡
9 * Zh_Single_Row-06 18 * Zh_Single_Row-06
10 */ 19 */
11 const TAG = 'Zh_Single_Row-06' 20 const TAG = 'Zh_Single_Row-06'
12 -  
13 -// interface commentInfo {  
14 -// commentTitle: string,  
15 -// newsTitle: string,  
16 -// userName: string,  
17 -// userHeaderUrl: string,  
18 -// publishTime: number  
19 -// }  
20 -// interface operDataListItem {  
21 -// commentInfo: commentInfo  
22 -// }  
23 -// interface CommentData{  
24 -// operDataList: Array<operDataListItem>  
25 -// }  
26 -  
27 @Entry 21 @Entry
28 @Component 22 @Component
29 export struct ZhSingleRow06 { 23 export struct ZhSingleRow06 {
30 @State compDTO: CompDTO = {} as CompDTO 24 @State compDTO: CompDTO = {} as CompDTO
31 - @State likeBl: boolean = false; 25 + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
  26 +
  27 + aboutToAppear(): void {
  28 + this.getInteractDataStatus()
  29 + }
32 30
33 - async likeAction() { 31 + /**
  32 + * 点赞、取消点赞
  33 + */
  34 + async toggleLikeStatus() {
  35 + // 未登录,跳转登录
34 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 36 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
35 if (!user_id) { 37 if (!user_id) {
36 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 38 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
37 return 39 return
38 } 40 }
  41 + const params: postExecuteLikeParams = {
  42 + status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
  43 + contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
  44 + contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
  45 + }
  46 + ContentDetailRequest.postExecuteLike(params).then(res => {
  47 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
  48 + })
  49 + }
39 50
40 - if (this.likeBl) {  
41 - this.likeBl = false;  
42 - } else {  
43 - this.likeBl = true; 51 + // 已登录->查询用户对作品点赞、收藏状态
  52 + private async getInteractDataStatus() {
  53 + // 未登录,跳转登录
  54 + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
  55 + if (!user_id) {
  56 + return
  57 + }
  58 + try {
  59 + const params: batchLikeAndCollectParams = {
  60 + contentList: [
  61 + {
  62 + contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
  63 + contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
  64 + }
  65 + ]
  66 + }
  67 + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
  68 + console.error(TAG, 'ZhSingleRow06-data', JSON.stringify(data))
  69 + this.newsStatusOfUser = data[0];
  70 + Logger.info(TAG, `ZhSingleRow06-newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
  71 + } catch (exception) {
  72 + console.error(TAG, JSON.stringify(exception))
44 } 73 }
45 } 74 }
46 75
@@ -95,7 +124,7 @@ export struct ZhSingleRow06 { @@ -95,7 +124,7 @@ export struct ZhSingleRow06 {
95 .fontColor(0x999999) 124 .fontColor(0x999999)
96 125
97 Row(){ 126 Row(){
98 - Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like')) 127 + Image(this.newsStatusOfUser?.likeStatus == '1' ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
99 .width(16) 128 .width(16)
100 .height(16) 129 .height(16)
101 .margin({right: 3}) 130 .margin({right: 3})
@@ -103,9 +132,11 @@ export struct ZhSingleRow06 { @@ -103,9 +132,11 @@ export struct ZhSingleRow06 {
103 Text('点赞') 132 Text('点赞')
104 .fontSize(15) 133 .fontSize(15)
105 .fontColor(0x999999) 134 .fontColor(0x999999)
  135 + .onClick(() => {
  136 + })
106 } 137 }
107 .onClick(() => { 138 .onClick(() => {
108 - this.likeAction() 139 + this.toggleLikeStatus()
109 }) 140 })
110 } 141 }
111 .justifyContent(FlexAlign.SpaceBetween) 142 .justifyContent(FlexAlign.SpaceBetween)
@@ -42,7 +42,8 @@ export default struct MinePagePersonFunctionUI { @@ -42,7 +42,8 @@ export default struct MinePagePersonFunctionUI {
42 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 42 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
43 return 43 return
44 }else { 44 }else {
45 - WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage) 45 + let params: Record<string, string> = {'comment': "1"};
  46 + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params)
46 } 47 }
47 break; 48 break;
48 } 49 }
@@ -50,7 +50,7 @@ export struct SearchResultContentComponent{ @@ -50,7 +50,7 @@ export struct SearchResultContentComponent{
50 getNewSearchResultData(){ 50 getNewSearchResultData(){
51 this.isLoading = true 51 this.isLoading = true
52 if(this.hasMore){ 52 if(this.hasMore){
53 - SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{ 53 + SearcherAboutDataModel.getSearchResultListData("10",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
54 if (!this.data || value.list.length == 0){ 54 if (!this.data || value.list.length == 0){
55 this.hasMore = false 55 this.hasMore = false
56 this.isLoading = false 56 this.isLoading = false
@@ -31,10 +31,19 @@ struct MineHomePage { @@ -31,10 +31,19 @@ struct MineHomePage {
31 registTime:number = 0//账号注册时间 31 registTime:number = 0//账号注册时间
32 @State registerTimeForDay:number = 0 32 @State registerTimeForDay:number = 0
33 scroller: Scroller = new Scroller(); 33 scroller: Scroller = new Scroller();
  34 + @State params:Record<string, string> = router.getParams() as Record<string, string>;
  35 + @State isCommentEnter:string = "";
34 36
35 onPageShow(): void { 37 onPageShow(): void {
36 this.getUserInfo() 38 this.getUserInfo()
37 39
  40 + let intervalID = setInterval(() => {
  41 + this.isCommentEnter = this.params?.['comment'];
  42 + if(StringUtils.isNotEmpty(this.isCommentEnter)){
  43 + this.scroller.scrollEdge(Edge.Bottom)
  44 + }
  45 + clearInterval(intervalID);
  46 + }, 200);
38 } 47 }
39 48
40 build() { 49 build() {