张善主

Merge remote-tracking branch 'origin/main'

... ... @@ -39,14 +39,14 @@ class AppLoginAuthInfo {
}
interface IDataJson {
jumpType:number
jumpUrl:string
newsId:string
newsObjectLevel:string
newsObjectType:number
newsRelId:string
newsTitle:string
pageId:string
jumpType: number
jumpUrl: string
newsId: string
newsObjectLevel: string
newsObjectType: number
newsRelId: string
newsTitle: string
pageId: string
}
/**
... ... @@ -209,6 +209,11 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
let creatorId = urlParams.get('creatorId') || ''
ProcessUtils.gotoPeopleShipHomePage(creatorId)
break;
case 'app':
if (urlParams.get('subType') === 'login') {
ProcessUtils.gotoLoginPage()
}
break;
default:
break;
}
... ...
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
import { WDHttp, HttpUrlUtils } from 'wdNetwork';
const TAG = 'JsCallAppService'
export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
if (data?.data?.method === 'get') {
let queryString: string = ''
let parameters = data?.data?.parameters
if (parameters) {
queryString = Object.keys(parameters)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters?.[key])}`)
.join('&');
}
let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if (queryString) {
url = url + `?${queryString}`
}
console.log('yzl', queryString, url)
WDHttp.get(url).then((res) => {
callback(JSON.stringify({
netError: '0',
responseMap
} as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
responseMap: res
}))
})
}
if (data?.data?.method === 'post') {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
// if (data?.data?.method === 'get') {
// WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
// callback(JSON.stringify(res))
// })
// }
if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
h5ReceiveDataJson.responseMap = res
callback(JSON.stringify(h5ReceiveDataJson))
WDHttp.post(url, data?.data?.parameters).then((res) => {
callback(JSON.stringify({
netError: '0',
responseMap: res
}))
})
}
}
... ...
... ... @@ -9,4 +9,5 @@ export interface commentInfo {
relId: string;
relType: string;
userId: string;
newsType?: string
}
\ No newline at end of file
... ...
/**
* 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
*/
import {
ContentDetailRequest,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { RmhInfoDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils, SPHelper } from 'wdKit';
import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit';
import { SpConstants } from 'wdConstant/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import router from '@ohos.router'
import { postBatchAttentionStatusParams } from 'wdBean/Index';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'
@Component
export struct RmhTitle {
@Prop rmhInfo: RmhInfoDTO
@Prop publishTime: string | undefined
/**
* 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏
*/
@Prop hideTime: boolean
/**
* 默认未关注 点击去关注
*/
@State followStatus: String = '0';
async appointReq() {
/**
* 关注号主
*/
async handleAccention() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params2: postInteractAccentionOperateParams = {
attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
this.followStatus = '1'
// 弹窗样式与何时调用待确认
ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
console.log('关注号主获取积分==', JSON.stringify(res.data))
if (res.data?.showToast) {
ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
}
})
}
})
}
/**
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
}
}
aboutToAppear(): void {
... ... @@ -28,6 +81,8 @@ export struct RmhTitle {
if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
this.hideTime = true;
}
this.getBatchAttentionStatus()
}
getDaysBetweenDates(date: number) {
... ... @@ -88,17 +143,20 @@ export struct RmhTitle {
Blank()
if (this.rmhInfo.cnIsAttention) {
Row() {
if (this.followStatus === '0') {
Image($r('app.media.rmh_follow'))
.width(16)
.height(16)
Text('关注')
}
Text(this.followStatus === '0' ? '关注' : '已关注')
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_ED2800'))
}
.flexShrink(0)
.alignSelf(ItemAlign.Center)
.onClick(() => {
this.appointReq();
this.handleAccention();
})
}
}
... ...
import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean';
import { commentInfo, CompDTO, ContentDTO, Params, batchLikeAndCollectResult } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { DateTimeUtils, SPHelper } from 'wdKit/Index';
import { DateTimeUtils, SPHelper, Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import { SpConstants } from 'wdConstant/Index'
import {
batchLikeAndCollectParams,
ContentDetailRequest,
contentListParams,
postExecuteCollectRecordParams,
postExecuteLikeParams,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
/**
* 精选评论卡
* Zh_Single_Row-06
*/
const TAG = 'Zh_Single_Row-06'
// interface commentInfo {
// commentTitle: string,
// newsTitle: string,
// userName: string,
// userHeaderUrl: string,
// publishTime: number
// }
// interface operDataListItem {
// commentInfo: commentInfo
// }
// interface CommentData{
// operDataList: Array<operDataListItem>
// }
@Entry
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
@State likeBl: boolean = false;
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
aboutToAppear(): void {
this.getInteractDataStatus()
}
async likeAction() {
/**
* 点赞、取消点赞
*/
async toggleLikeStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
}
ContentDetailRequest.postExecuteLike(params).then(res => {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
})
}
if (this.likeBl) {
this.likeBl = false;
} else {
this.likeBl = true;
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
}
]
}
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, 'ZhSingleRow06-data', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `ZhSingleRow06-newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
}
... ... @@ -95,7 +124,7 @@ export struct ZhSingleRow06 {
.fontColor(0x999999)
Row(){
Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
Image(this.newsStatusOfUser?.likeStatus == '1' ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
.width(16)
.height(16)
.margin({right: 3})
... ... @@ -103,9 +132,11 @@ export struct ZhSingleRow06 {
Text('点赞')
.fontSize(15)
.fontColor(0x999999)
.onClick(() => {
})
}
.onClick(() => {
this.likeAction()
this.toggleLikeStatus()
})
}
.justifyContent(FlexAlign.SpaceBetween)
... ...
... ... @@ -42,7 +42,8 @@ export default struct MinePagePersonFunctionUI {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}else {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
let params: Record<string, string> = {'comment': "1"};
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params)
}
break;
}
... ...
... ... @@ -50,7 +50,7 @@ export struct SearchResultContentComponent{
getNewSearchResultData(){
this.isLoading = true
if(this.hasMore){
SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
SearcherAboutDataModel.getSearchResultListData("10",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
this.hasMore = false
this.isLoading = false
... ...
... ... @@ -31,10 +31,19 @@ struct MineHomePage {
registTime:number = 0//账号注册时间
@State registerTimeForDay:number = 0
scroller: Scroller = new Scroller();
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@State isCommentEnter:string = "";
onPageShow(): void {
this.getUserInfo()
let intervalID = setInterval(() => {
this.isCommentEnter = this.params?.['comment'];
if(StringUtils.isNotEmpty(this.isCommentEnter)){
this.scroller.scrollEdge(Edge.Bottom)
}
clearInterval(intervalID);
}, 200);
}
build() {
... ...