Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
douaojie
2024-05-15 17:19:47 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
5e6392ba69bc740391805abef7807b087eae17bf
5e6392ba
2 parents
cbe6ea27
42aa9c08
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
80 additions
and
84 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/AccountManagerUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow06.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentComponentPage.ets
sight_harmony/commons/wdKit/src/main/ets/utils/AccountManagerUtils.ets
View file @
5e6392b
...
...
@@ -2,46 +2,30 @@ import { StringUtils } from './StringUtils';
import { SPHelper } from './SPHelper';
import { Logger } from './Logger';
const KEY_USER_TOKEN = 'userToken';
const TAG: string = 'AccountManagerUtils';
// 是否已登录hadLogin
let hasLogin: boolean = false;
export class AccountManagerUtils {
// 是否已登录hadLogin
// private static hasLogin: boolean = undefined;
// 这里需要和其他模块value值一致 !!!!
// TODO: 以前清楚谁写的遗留代码,后续考虑删除
static readonly USER_ID = "userId"
constructor() {
}
static async getUserToken(): Promise<string> {
let userToken = await SPHelper.default.get(KEY_USER_TOKEN, '') as string;
static async getUserId(): Promise<string> {
let userId = await SPHelper.default.get(AccountManagerUtils.USER_ID, '') as string;
// Logger.info(TAG, 'getUserToken UserToken.' + userToken);
return user
Token
;
return user
Id
;
}
static getUserTokenSync(): string {
let userToken = SPHelper.default.getSync(KEY_USER_TOKEN, '') as string;
static getUserIdSync(): string {
let userId = SPHelper.default.getSync(AccountManagerUtils.USER_ID, '') as string;
// Logger.info(TAG, 'getUserToken UserToken.' + userToken);
return userToken;
}
static async putUserToken(value: string) {
await SPHelper.default.save(KEY_USER_TOKEN, value);
}
static putUserTokenSync(value: string) {
SPHelper.default.saveSync(KEY_USER_TOKEN, value);
}
static async deleteUserToken() {
await SPHelper.default.delete(KEY_USER_TOKEN);
}
static deleteUserTokenSync() {
SPHelper.default.deleteSync(KEY_USER_TOKEN);
return userId;
}
/**
...
...
@@ -51,7 +35,7 @@ export class AccountManagerUtils {
*/
static async isLogin() {
Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin);
let lastUserToken = await AccountManagerUtils.getUser
Token
()
let lastUserToken = await AccountManagerUtils.getUser
Id
()
Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken);
if (StringUtils.isEmpty(lastUserToken)) {
hasLogin = false;
...
...
@@ -72,7 +56,7 @@ export class AccountManagerUtils {
*/
static isLoginSync() {
Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin);
let lastUserToken = AccountManagerUtils.getUser
Token
Sync()
let lastUserToken = AccountManagerUtils.getUser
Id
Sync()
Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken);
if (StringUtils.isEmpty(lastUserToken)) {
hasLogin = false;
...
...
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
5e6392b
...
...
@@ -70,6 +70,7 @@ export struct DynamicDetailComponent {
@State isPageEnd: boolean = false
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
@State operationButtonList: string[] = []
async aboutToAppear() {
await this.getContentDetailData()
...
...
@@ -532,15 +533,7 @@ export struct DynamicDetailComponent {
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
CommentComponent({
publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
targetRelId: this.contentDetailData?.reLInfo?.relId,
targetTitle: this.contentDetailData?.newsTitle,
targetRelType: this.contentDetailData?.reLInfo?.relType,
targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId),
keyArticle: String(this.contentDetailData?.keyArticle),
targetType: String(this.contentDetailData?.newsType),
} as publishCommentModel
publishCommentModel: this.publishCommentModel
})
}
Blank().layoutWeight(1)
...
...
@@ -557,7 +550,7 @@ export struct DynamicDetailComponent {
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList:
['comment', 'collect', 'share']
,
operationButtonList:
this.operationButtonList
,
styleType: 1,
})
...
...
@@ -574,13 +567,6 @@ export struct DynamicDetailComponent {
* */
private async getContentDetailData() {
this.isNetConnected = NetworkUtil.isNetConnected()
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.isPageEnd = true;
...
...
@@ -590,6 +576,20 @@ export struct DynamicDetailComponent {
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
console.log('动态详情', JSON.stringify(this.contentDetailData))
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
this.operationButtonList = ['comment', 'collect', 'share']
} catch (exception) {
console.log('请求失败', JSON.stringify(exception))
this.isPageEnd = true;
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
5e6392b
...
...
@@ -234,13 +234,13 @@ export struct ImageAndTextPageComponent {
}
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId
|| ''
)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
this.contentDetailData?.audioList[0].audioUrl) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
View file @
5e6392b
...
...
@@ -445,13 +445,13 @@ export struct MultiPictureDetailPageComponent {
// }
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId
|| ''
)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
View file @
5e6392b
...
...
@@ -72,13 +72,13 @@ export struct SpacialTopicPageComponent {
this.contentDetailData = detailBeans[0];
// if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId
|| ''
)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
// }
this.trySendData2H5()
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
View file @
5e6392b
...
...
@@ -81,7 +81,7 @@ export struct Card6Component {
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
}
.height("75%")
}
.justifyContent(FlexAlign.Start)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
View file @
5e6392b
...
...
@@ -93,6 +93,9 @@ export struct CommentComponent {
}
});
}
if (model) {
this.isComments = true
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
View file @
5e6392b
...
...
@@ -164,7 +164,7 @@ class CommentViewModel {
publishComment(model: publishCommentModel) {
return new Promise<commentItemModel>((success, fail) => {
const visitorMode = model.visitorComment == "1" &&
AccountManagerUtils.isLoginSync
() == false
const visitorMode = model.visitorComment == "1" &&
HttpUtils.isLogin
() == false
let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
let bean: Record<string, string> = {};
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow06.ets
View file @
5e6392b
...
...
@@ -9,6 +9,7 @@ import {
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import commentViewModel from '../../components/comment/viewmodel/CommentViewModel';
import { commentItemModel } from '../../components/comment/model/CommentModel'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 精选评论卡
...
...
@@ -22,9 +23,11 @@ export struct ZhSingleRow06 {
@State newsStatusOfUser: batchLikeAndCollectResult = {
likeStatus: '0'
} as batchLikeAndCollectResult // 点赞、收藏状态
@State loadImg: boolean = false;
a
boutToAppear(): void
{
a
sync aboutToAppear(): Promise<void>
{
this.getInteractDataStatus()
this.loadImg = await onlyWifiLoadImg();
}
/**
...
...
@@ -160,7 +163,12 @@ export struct ZhSingleRow06 {
CompHeader(item: CompDTO) {
Row() {
Row() {
Image(item.operDataList[0]?.commentInfo?.userHeaderUrl ? item.operDataList[0].commentInfo.userHeaderUrl : $r('app.media.default_head'))
Image(
this.loadImg
? item.operDataList[0]?.commentInfo?.userHeaderUrl
? item.operDataList[0].commentInfo.userHeaderUrl
: $r('app.media.default_head')
: '')
.width(32)
.height(32)
.borderRadius(16)
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
View file @
5e6392b
...
...
@@ -64,13 +64,13 @@ export struct DetailPlayLiveCommon {
// if (this.contentDetailData.openComment === 1) {
console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment)
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId
|| ''
)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
this.publishCommentModel.commentContent = ''
// }
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
5e6392b
...
...
@@ -166,12 +166,13 @@ export struct DetailPlayShortVideoPage {
this.queryNewsInfoOfUser()
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId
|| ''
)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
this.publishCommentModel.commentContent = ''
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentComponentPage.ets
View file @
5e6392b
...
...
@@ -17,13 +17,13 @@ export struct CommentComponentPage {
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId
|| ''
)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
build() {
...
...
Please
register
or
login
to post a comment