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
张善主
2024-04-24 15:02:06 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ae2d66954e2b6a2a7118b68ad66a6875ac21b51c
ae2d6695
2 parents
df47c395
a38f85e9
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
186 additions
and
48 deletions
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/features/wdBean/Index.ets
sight_harmony/features/wdBean/src/main/ets/bean/component/extra/ExtraDTO.ts
sight_harmony/features/wdBean/src/main/ets/bean/content/commentInfo.ets
sight_harmony/features/wdBean/src/main/ets/bean/user/UserDetail.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailItemComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow06.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/EmptyComponent.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/AudioDialog.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
View file @
ae2d669
...
...
@@ -10,6 +10,10 @@ export class SpConstants{
static USER_STATUS="user_status"
static USER_TEMP_TOKEN="tempToken"
static USER_PHONE = "user_phone"
static USER_CREATOR_ID = "creatorId"
static USER_HEAD_PHOTO_URL = "headPhotoUrl"
static USER_SEX = "sex"
static USER_BIRTHDAY = "birthday"
//协议相关
static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
ae2d669
import { Action, ContentDTO, Params, PhotoListBean } from 'wdBean';
import { Action, ContentDTO, Params, PhotoListBean
, commentInfo
} from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Logger } from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
...
...
@@ -133,6 +133,24 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
static commentGotoWeb(content: commentInfo) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: content?.newsId,
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: content?.relType,
relId: content?.relId,
sourcePage: '5',
commentId: content?.commentId
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`);
}
private static gotoWeb(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
...
...
@@ -143,7 +161,8 @@ export class ProcessUtils {
relType: content?.relType,
relId: content?.relId,
channelId: content?.channelId,
sourcePage: '5'
sourcePage: '5',
commentId: content?.commentInfo?.commentId
} as ExtraDTO
} as Params,
};
...
...
sight_harmony/features/wdBean/Index.ets
View file @
ae2d669
...
...
@@ -15,6 +15,8 @@ export { ItemBean } from './src/main/ets/bean/ItemBean';
// Content
export { ContentDTO } from './src/main/ets/bean/content/ContentDTO';
export { commentInfo } from './src/main/ets/bean/content/commentInfo';
export { AudioDTO } from './src/main/ets/bean/content/AudioDTO';
export { Action } from './src/main/ets/bean/content/Action'
...
...
@@ -146,3 +148,8 @@ export {
InfluenceData
} from './src/main/ets/bean/peoples/PeopleShipUserDetailData';
export {
UserDetail,
UserExtend
} from './src/main/ets/bean/user/UserDetail';
...
...
sight_harmony/features/wdBean/src/main/ets/bean/component/extra/ExtraDTO.ts
View file @
ae2d669
...
...
@@ -15,4 +15,5 @@ export interface ExtraDTO extends ItemDTO {
relType
:
string
;
liveStreamType
?:
number
;
photoList
:
PhotoListBean
[];
commentId
?:
string
;
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/src/main/ets/bean/content/commentInfo.ets
View file @
ae2d669
...
...
@@ -3,5 +3,9 @@ export interface commentInfo {
newsTitle: string,
userName: string,
userHeaderUrl: string,
publishTime: number
publishTime: number,
commentId: string,
newsId: string,
relId: string;
relType: string;
}
\ No newline at end of file
...
...
sight_harmony/features/wdBean/src/main/ets/bean/user/UserDetail.ets
0 → 100644
View file @
ae2d669
export interface UserDetail{
createTime:string
headPhotoStatus:number
id:number
modifyNumber:number
phone:string
status:number
tenancy:number
userNameStatus:number
userType:number
userName:string
userExtend:UserExtend
}
export interface UserExtend{
airec:number
deviceId:string
lastLoginTime:string
sex:number
address:string
birthday:string
city:string
county:string
headPhotoUrl:string
introduction:string
province:string
sign:string
creatorId:string
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailItemComponent.ets
View file @
ae2d669
...
...
@@ -12,7 +12,7 @@ export struct MultiPictureDetailItemComponent {
async aboutToAppear() {
Logger.info(TAG, 'pictures preview')
//
Logger.info(TAG, 'pictures preview')
}
build() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailPageComponent.ets
View file @
ae2d669
import { Logger, SPHelper } from 'wdKit';
import {
NetworkUtil,
Logger,
NetworkType,
SPHelper,
} from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
...
...
@@ -61,7 +66,15 @@ export struct MultiPictureDetailPageComponent {
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
})
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if(netStatus) {
// 有网络
this.getContentDetailData()
} else {
// 无网络
this.netStatus = 1
}
}
aboutToDisappear() {
...
...
@@ -73,7 +86,7 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
Swiper(this.swiperController) {
Swiper(this.swiperController
Item
) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
}
.width('100%')
...
...
@@ -256,16 +269,15 @@ export struct MultiPictureDetailPageComponent {
})
.height(px2vp(this.titleHeight) + 64)
}
else {
}
if(this.netStatus !== undefined) {
EmptyComponent({ emptyType: this.netStatus
})
EmptyComponent({ emptyType: $netStatus, emptyButton:true, retry: () => {this.getContentDetailData()}
})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
}
OperRowListView({
contentDetailData: this.contentDetailData,
})
...
...
@@ -293,12 +305,9 @@ export struct MultiPictureDetailPageComponent {
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
private
getContentDetailData() {
getContentDetailData() {
try {
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
// Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`);
// Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`);
// Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`);
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
return
...
...
@@ -307,29 +316,25 @@ export struct MultiPictureDetailPageComponent {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
// this.contentDetailData.photoList = []
if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
if (HttpUrlUtils.getUserId()) {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
}).catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
/*// 请求失败处理
if (err.response) {
// 请求已发出,但服务器响应的状态码不在2xx范围内
console.error('请求失败,状态码:', err.response.status);
console.error('响应数据:', err.response.data);
} else if (err.request) {
// 请求已发出,但无响应(例如:网络故障)
console.error('请求已发出,但无响应:', err.request);
} else {
// 发生了其他类型的错误(如配置错误或拒绝权限等)
console.error('请求发生错误:', err.message);
}*/
// 内容获取失败
this.netStatus = 9
})
} catch (exception) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
View file @
ae2d669
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { ContentDTO, FullColumnImgUrlDTO
, PhotoListBean
} from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
...
...
@@ -92,8 +92,17 @@ export struct Card19Component {
}
// 图片-从无图到9图展示
createImg({ fullColumnImgUrls: this.contentDTO.fullColumnImgUrls })
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
.onClick(() => {
const photoList: PhotoListBean[] = this.contentDTO.fullColumnImgUrls.map(item => {
const photo: PhotoListBean = {
width: item.weight,
height: item.height,
picPath: item.fullUrl,
picDesc: ''
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList)
})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
...
...
@@ -103,6 +112,9 @@ export struct Card19Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleRow06.ets
View file @
ae2d669
import { CompDTO, ContentDTO, Params } from 'wdBean';
import {
commentInfo,
CompDTO, ContentDTO, Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
...
...
@@ -68,6 +68,9 @@ export struct ZhSingleRow06 {
.backgroundColor(0xf9f9f9)
.borderRadius(4)
.margin({bottom: 12})
.onClick(() => {
ProcessUtils.commentGotoWeb(this.compDTO.operDataList[0]?.commentInfo as commentInfo)
})
Row() {
Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime))
...
...
@@ -97,9 +100,6 @@ export struct ZhSingleRow06 {
.backgroundColor($r('app.color.white'))
.margin({ bottom: 8 })
.height(251)
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
})
}
@Builder
...
...
@@ -128,6 +128,9 @@ export struct ZhSingleRow06 {
.width(14)
.height(14)
}
.onClick(() => {
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
})
}
.margin({bottom: 10})
.justifyContent(FlexAlign.SpaceBetween)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/EmptyComponent.ets
View file @
ae2d669
...
...
@@ -52,7 +52,7 @@ export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@
State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default;
@
Link emptyType: number
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/AudioDialog.ets
View file @
ae2d669
...
...
@@ -113,6 +113,7 @@ export struct AudioDialog {
if (this.playerController) {
// this.onConfirm()
this.playerController.switchPlayOrPause()
this.AudioSuspension.playerController.get().switchPlayOrPause()
this.currentStatus = this.playerController.getStatus()
}
})
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginModel.ets
View file @
ae2d669
...
...
@@ -7,6 +7,7 @@ import { CheckVerifyBean } from './CheckVerifyBean';
import {
SpConstants
} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
import { UserDetail } from 'wdBean/Index';
const TAG = 'LoginModel'
...
...
@@ -302,5 +303,26 @@ export class LoginModel {
})
}
queryUserDetail() {
let bean: Record<string, string> = {};
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<UserDetail>((success, fail) => {
HttpBizUtil.get<ResponseDTO<UserDetail>>(HttpUrlUtils.queryUserDetail(), headers).then((data: ResponseDTO<UserDetail>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
})
})
}
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
ae2d669
...
...
@@ -321,13 +321,7 @@ struct LoginPage {
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
router.back({
params: { userName: data.userName,
userId:data.id},
url: `${WDRouterPage.getBundleInfo()}`
}
)
this.queryUserDetail()
}).catch((error:string)=>{
promptAction.showToast({ message: error })
})
...
...
@@ -339,12 +333,12 @@ struct LoginPage {
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
router.back({
params: { userName: data.userName,
userId:data.id},
url: `${WDRouterPage.getBundleInfo()}`
})
this.queryUserDetail()
// router.back({
// params: { userName: data.userName,
// userId:data.id},
// url: `${WDRouterPage.getBundleInfo()}`
// })
}).catch((value: string) => {
promptAction.showToast({ message: value })
})
...
...
@@ -352,6 +346,19 @@ struct LoginPage {
}
queryUserDetail(){
this.loginViewModel.queryUserDetail().then(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
}
)
}).catch(()=>{
router.back({
url: `${WDRouterPage.getBundleInfo()}`
})
})
}
//登录
loginSubmit() {
Logger.debug(TAG, "loginSubmit " + this.checkCodePage)
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginViewModel.ets
View file @
ae2d669
...
...
@@ -9,6 +9,7 @@ import { encryptMessage } from '../../utils/cryptoUtil'
import { HttpUrlUtils } from 'wdNetwork/src/main/ets/http/HttpUrlUtils'
import { SpConstants } from 'wdConstant/Index'
import { UserDetail } from 'wdBean/Index';
const TAG = "LoginViewModel"
...
...
@@ -213,4 +214,26 @@ export class LoginViewModel {
return bufferStr;
}
queryUserDetail(){
return new Promise<UserDetail>((success, fail) => {
this.loginModel.queryUserDetail().then((data: UserDetail) => {
//保存sp
if(data){
SPHelper.default.save(SpConstants.USER_NAME, data.userName)
SPHelper.default.save(SpConstants.USER_PHONE, data.phone)
}
if(data.userExtend){
SPHelper.default.save(SpConstants.USER_SEX, data.userExtend.sex)
SPHelper.default.save(SpConstants.USER_CREATOR_ID, data.userExtend.creatorId+"")
SPHelper.default.save(SpConstants.USER_HEAD_PHOTO_URL, data.userExtend.headPhotoUrl)
SPHelper.default.save(SpConstants.USER_BIRTHDAY, data.userExtend.birthday)
}
success(data)
}).catch(() => {
fail()
})
})
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment