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-08-26 14:47:28 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
9083bf96172122c7331f13490fb07f83878b0b22
9083bf96
2 parents
e4720f61
40872056
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
167 additions
and
78 deletions
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleColumn09.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/OperationListView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchPage.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchPageModel.ets
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
View file @
9083bf9
...
...
@@ -44,6 +44,9 @@ export class SpConstants{
//启动页数据存储key
static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model'
//国殇模式数据存储key
static APP_MOURNS_INFO_DATA_MODEL = 'app_mourns_info_model'
//频道信息流页面左右挂角
static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhSingleColumn09.ets
View file @
9083bf9
...
...
@@ -14,7 +14,7 @@ const TAG = 'Zh_Single_Column-09'
@Entry
@Component
export struct ZhSingleColumn09 {
@State fullyTraversed: boolean = false;
@State fullyTraversed: boolean = false;
//换一换置灰标记
@State private pageModel: PageModel = new PageModel();
@State pageId: string = '';
@State pageName: string = '';
...
...
@@ -26,11 +26,46 @@ export struct ZhSingleColumn09 {
@State compIndex: number = 0;
@State currentOperDataListIndex: number = 0; //记录换一换点击次数
@State visitedIndices: Set<number> = new Set<number>();
private currentIndex: number = 0;
@State currentDataList: ContentDTO[] = []
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
// this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
this.operDataList = this.padData(this.compDTO?.operDataList)
this.currentOperDataListIndex = this.compDTO?.operDataList.length
this.currentDataList = this.getNextBatch()
}
/**
* 若数据不满足8个以上直接返回
* 若最后一屏不够补齐至8个
* */
private padData(data: ContentDTO[]): ContentDTO[] {
if (data.length < 9) {
return data
}
const remainder = data.length % 8;
if (remainder === 0) {
return data;
}
const paddingCount = 8 - remainder;
const padding = data.slice(0, paddingCount);
return [...data, ...padding];
}
/**
* 换一换切换数据
* */
public getNextBatch(): ContentDTO[] {
const batch = this.operDataList.slice(this.currentIndex, this.currentIndex + 8);
this.currentIndex += 8;
if (this.currentIndex >= this.operDataList.length) {
this.fullyTraversed = true //数据展现完毕,置灰标记
}
return batch;
}
trackClick(type: 'close_interest_card_click' | 'interest_card_selecting_click') {
...
...
@@ -142,8 +177,8 @@ export struct ZhSingleColumn09 {
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
Flex({wrap: FlexWrap.Wrap}) {
ForEach(this.operDataList.slice(0, 8), (item: ContentDTO, index: number) => {
Flex({ wrap: FlexWrap.Wrap }) {
ForEach(this.currentDataList, (item: ContentDTO, index: number) => {
Row() {
Stack({ alignContent: Alignment.TopEnd }) {
Image(this.loadImg ? item.coverUrl : '')
...
...
@@ -204,10 +239,14 @@ export struct ZhSingleColumn09 {
return
}
if (this.compDTO?.operDataList.length > 8) {
this.operDataList = this.shuffleArray(this.operDataList)
//
this.operDataList = this.shuffleArray(this.operDataList)
// if (this.pageModel) {
// this.pageModel.compList.deleteItem(this.compIndex)
// }
if (this.fullyTraversed) {
return; // 所有数据已取完
}
this.currentDataList = this.getNextBatch()
this.activeIndexs = [];
}
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
View file @
9083bf9
import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import { HttpUtils } from 'wdNetwork/Index';
import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils
, ToastUtils
} from 'wdKit';
import { autoRefresh, onActionEnd, onActionStart, onActionUpdate,closeRefresh } from '../../utils/NewPullDownRefresh';
import {
...
...
@@ -88,27 +88,31 @@ export struct PeopleShipMainComponent {
Column(){
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
//缺省页
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
} else if (this.viewType == ViewType.EMPTY) {
//缺省页
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
.grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
}else {
}
// else if (this.viewType == ViewType.ERROR) {
// //缺省页
// // EmptyComponent({
// // emptyType: this.pageModel.emptyType,
// // emptyButton: true,
// // retry: () => {
// // this.getData()
// // }
// // })
// // .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
//
// } else if (this.viewType == ViewType.EMPTY) {
// // //缺省页
// // EmptyComponent({
// // emptyType: this.pageModel.emptyType,
// // emptyButton: true,
// // retry: () => {
// // this.getData()
// // }
// // })
// // .grayscale(this.GrayManage.get().isRmhMourning(`${this.channelId}`) ? 1 : 0)
//
// }
else {
if (this.followList.length == 0) {
this.ListLayout()
} else {
...
...
@@ -328,7 +332,7 @@ export struct PeopleShipMainComponent {
// 获取用户关注人数
let object = new FollowListDetailRequestItem(-1, 20, 1)
let followInfo = await MinePageDatasModel.getMineFollowListData(object, getContext(this))
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`)
//
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`)
if (followInfo.list.length == 0) {
this.followList = []
...
...
@@ -347,6 +351,7 @@ export struct PeopleShipMainComponent {
} catch (exception) {
this.viewType = ViewType.ERROR
this.isLoading = false
ToastUtils.shortToast('加载失败,请稍后重试')
}
}
...
...
@@ -362,11 +367,14 @@ export struct PeopleShipMainComponent {
this.viewType = ViewType.LOADED
this.changeButton = false
this.isLoading = false
Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`)
//
Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`)
if (resolve) {
resolve('已更新至最新')
}
this.closeRefresh(true)
if(this.rmhList?.length! === 0) {
ToastUtils.shortToast('加载失败,请稍后重试')
}
} catch (exception) {
if (resolve) {
resolve('')
...
...
@@ -375,6 +383,7 @@ export struct PeopleShipMainComponent {
this.viewType = ViewType.ERROR
this.changeButton = false
this.isLoading = false
ToastUtils.shortToast('加载失败,请稍后重试')
}
}
...
...
@@ -390,7 +399,7 @@ export struct PeopleShipMainComponent {
try {
// 获取列表数据
let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime)
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
//
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
if (listData && listData.list && listData.list.length > 0) {
if (listData.list.length === 20) {
this.hasMore = true;
...
...
@@ -429,7 +438,7 @@ export struct PeopleShipMainComponent {
})
let listData = await PeopleShipMainViewModel.getContentInteractInfo(params)
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
//
Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`)
this.resolveEnd(true, resolve)
if (this.currentPage == 1) {
...
...
@@ -481,6 +490,7 @@ export struct PeopleShipMainComponent {
}
if (this.currentPage == 1 && !isTop) {
this.viewType = ViewType.ERROR
ToastUtils.shortToast('加载失败,请稍后重试')
} else {
this.viewType = ViewType.LOADED
}
...
...
@@ -489,8 +499,8 @@ export struct PeopleShipMainComponent {
// 说是首页必须要调用
async getInitData() {
Logger.debug('PeopleShipMainComponent',
`getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
// Logger.debug('PeopleShipMainComponent',
// `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
...
...
@@ -526,7 +536,7 @@ export struct PeopleShipMainComponent {
objects.creators.push(creator)
}
})
Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
//
Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`);
let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects)
this.oneKeyFollow = false
if (batchInfo.code === 0 || batchInfo.code.toString() === "0") {
...
...
@@ -556,7 +566,7 @@ export struct PeopleShipMainComponent {
return
}
// 当前页面,自动刷新数据
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
//
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
this.listScroller.scrollToIndex(0)
autoRefresh(this.pageModel,this.onRefresh)
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
View file @
9083bf9
...
...
@@ -159,6 +159,9 @@ export struct DetailPlayVLivePage {
} else {
// 直播暂停,仍然可以评论
if (this.liveState === 'pause') {
RelativeContainer()
.backgroundColor('#000000')
.opacity(0.5)
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
...
...
@@ -173,6 +176,9 @@ export struct DetailPlayVLivePage {
} else {
// 没有配置垫片资源
RelativeContainer()
.backgroundColor('#000000')
.opacity(0.5)
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
9083bf9
...
...
@@ -98,7 +98,7 @@ export struct DetailPlayShortVideoPage {
this.imageVisible = false
})
} else {
this.playerController.
pause
()
this.playerController.
stop
()
}
}
}
...
...
@@ -189,6 +189,7 @@ export struct DetailPlayShortVideoPage {
}
async aboutToAppear() {
this.isPlay = true
if (!this.onlyWifiLoadVideo) {
this.onlyWifiLoadVideo = await onlyWifiLoadVideo()
this.toastTextVisible = this.onlyWifiLoadVideo ? false : true
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/OperationListView.ets
View file @
9083bf9
...
...
@@ -88,7 +88,7 @@ export struct OperationListView {
} else {
this.interactData.likeNum = Number(this.interactData.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
//
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
// this.queryContentInteractCount()
}
...
...
@@ -124,7 +124,7 @@ export struct OperationListView {
} else {
this.interactData.collectNum = Number(this.interactData.collectNum) - 1
}
console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
//
console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
}
})
...
...
@@ -146,7 +146,7 @@ export struct OperationListView {
this.interactData.collectNum = res.data[0]?.collectNum
this.interactData.commentNum = res.data[0]?.commentNum
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
//
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
}
...
...
@@ -174,7 +174,7 @@ export struct OperationListView {
status: 1,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('关注号主==', JSON.stringify(res.data))
//
console.log('关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
9083bf9
...
...
@@ -87,21 +87,21 @@ export struct PlayerRightView {
relType: this.contentDetailData?.reLInfo?.relType || '' + '',
userHeaderUrl: this.contentDetailData?.userInfo?.headPhotoUrl || '' + '',
}
console.log(TAG, '点赞params', JSON.stringify(params))
//
console.log(TAG, '点赞params', JSON.stringify(params))
ContentDetailRequest.postExecuteLike(params).then(res => {
console.log(TAG, '点赞this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
//
console.log(TAG, '点赞this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus == '1') {
this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
TrackingContent.like(true, this.pageId, this.pageName, this.pageParam)
console.log(TAG, '点赞')
//
console.log(TAG, '点赞')
} else {
this.interactData.likeNum = Math.max(0, Number(this.interactData.likeNum || 0) - 1)
TrackingContent.like(false, this.pageId, this.pageName, this.pageParam)
console.log(TAG, '取消点赞')
//
console.log(TAG, '取消点赞')
}
console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
//
console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
// this.queryContentInteractCount()
}
...
...
@@ -135,13 +135,13 @@ export struct PlayerRightView {
if (this.newsStatusOfUser.collectStatus === 1) {
this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1
TrackingContent.collect(true, this.pageId, this.pageName, this.pageParam)
console.log(TAG, '收藏')
//
console.log(TAG, '收藏')
} else {
this.interactData.collectNum = Math.max(0, Number(this.interactData.collectNum || 0) - 1)
TrackingContent.collect(false, this.pageId, this.pageName, this.pageParam)
console.log(TAG, '取消收藏')
//
console.log(TAG, '取消收藏')
}
console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
//
console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
}
})
...
...
@@ -163,7 +163,7 @@ export struct PlayerRightView {
this.interactData.collectNum = res.data[0]?.collectNum || 0
this.interactData.commentNum = res.data[0]?.commentNum || 0
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
//
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
}
...
...
@@ -191,17 +191,18 @@ export struct PlayerRightView {
status: 1,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
//
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
this.followStatus = '1'
ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
if (res.data?.showToast) {
ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
}
})
console.log(TAG, '关注号主')
ContentDetailRequest.postPointLevelOperate({ operateType: 6 })
// .then((res) => {
// if (res.data?.showToast) {
// ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
// }
// })
// console.log(TAG, '关注号主')
TrackingContent.follow(true, this.followUserId, this.followUserName, this.pageId, this.pageName, this.pageParam)
}
})
...
...
@@ -302,8 +303,7 @@ export struct PlayerRightView {
}
transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') {
console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum,
this.interactData.commentNum)
// console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum,this.interactData.commentNum)
if (name === 'likeNum') {
return this.interactData.likeNum != 0 ?
NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : ''
...
...
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
View file @
9083bf9
...
...
@@ -32,7 +32,7 @@ struct MainPage {
upgradeDialogController?: CustomDialogController
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
//
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
aboutToAppear() {
...
...
@@ -41,14 +41,14 @@ struct MainPage {
this.breakpointSystem.register()
Logger.info(TAG, `aboutToAppear `);
//
Logger.info(TAG, `aboutToAppear `);
EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => {
LogoutViewModel.clearLoginInfo()
})
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_
LAUNCH_PAGE
_DATA_MODEL,'') as string
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_
MOURNS_INFO
_DATA_MODEL,'') as string
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
console.log(dataModelStr)
//
console.log(dataModelStr)
// 处理国殇模式数据
let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel
let GrayManage = new GrayManageModel()
...
...
@@ -63,22 +63,22 @@ struct MainPage {
aboutToDisappear() {
this.breakpointSystem.unregister()
Logger.info(TAG, 'aboutToDisappear');
//
Logger.info(TAG, 'aboutToDisappear');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
//
Logger.info(TAG, 'onPageHide');
this.pageHide = Math.random()
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
//
Logger.info(TAG, 'onPageShow');
this.pageShow = Math.random()
// 升级检查
// this.upgradeCheck()
Logger.debug('setBarBackgroundColor','Top onPageShow ')
//
Logger.debug('setBarBackgroundColor','Top onPageShow ')
}
upgradeCheck() {
...
...
@@ -104,8 +104,6 @@ struct MainPage {
})
this.upgradeDialogController?.open()
}
}).catch(() => {
})
}
...
...
@@ -115,13 +113,13 @@ struct MainPage {
// 拦截返回键,切到后台
const windowClass = WindowModel.shared.getWindowClass() as window.Window
windowClass.minimize().then(() => {
Logger.debug(TAG, 'Succeeded in minimizing the window.');
//
Logger.debug(TAG, 'Succeeded in minimizing the window.');
}).catch((err: BusinessError) => {
Logger.error(TAG, 'Failed to minimize the window. Cause: ' + JSON.stringify(err));
//
Logger.error(TAG, 'Failed to minimize the window. Cause: ' + JSON.stringify(err));
return false
});
} catch (err) {
Logger.error(TAG, 'Failed to minimize: ' + JSON.stringify(err));
//
Logger.error(TAG, 'Failed to minimize: ' + JSON.stringify(err));
return false
}
return true
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchPage.ets
View file @
9083bf9
...
...
@@ -105,16 +105,13 @@ struct LaunchPage {
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string
if (!dataModelStr) {
this.requestLaunchPageData()
//直接跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
return
}
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
console.log(dataModelStr)
//同意隐私协议后每次启动app请求启动页相关数据,并更新数据
this.requestLaunchPageData();
// console.log(dataModelStr)
if (dataModel.launchPageInfo || dataModel.launchAdInfo.length) {
//跳转广告页
...
...
@@ -126,6 +123,8 @@ struct LaunchPage {
//直接跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
}
//同意隐私协议后每次启动app请求启动页相关数据,并更新数据
this.requestLaunchPageData();
}
});
});
...
...
@@ -194,8 +193,15 @@ struct LaunchPage {
launchPageModel.getLaunchPageData()
}
requestMournsInfoData() {
//请求国殇模式数据并保存
let launchPageModel = new LaunchPageModel()
launchPageModel.getMournsInfoData()
}
aboutToAppear(): void {
this.requestAgreement()
this.requestMournsInfoData()
}
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/LaunchPageModel.ets
View file @
9083bf9
...
...
@@ -20,15 +20,41 @@ export class LaunchPageModel {
fail(data.message)
return
}
Logger.debug("LaunchPageModel获取启动相关数据获取成功:success ", JSON.stringify(data))
//
Logger.debug("LaunchPageModel获取启动相关数据获取成功:success ", JSON.stringify(data))
success(data.data);
//存储数据
let obj : string = JSON.stringify(data.data)
console.log('LaunchPageModel获取启动相关数据',
obj)
// console.log(
obj)
SPHelper.default.saveSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,obj)
}, (error: Error) => {
Logger.debug("LaunchPageModel获取启动相关数据获取失败:error ", error.toString())
// Logger.debug("LaunchPageModel获取启动相关数据获取失败:error ", error.toString())
fail(error.message)
})
})
}
getMournsInfoData(): Promise<LaunchDataModel> {
return new Promise<LaunchDataModel>((success, fail) => {
HttpRequest.get<ResponseDTO<LaunchDataModel>>(HttpUrlUtils.getLaunchPageDataUrl()).then((data: ResponseDTO<LaunchDataModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
// Logger.debug("LaunchPageModel获取启动相关数据获取成功:success ", JSON.stringify(data))
// 处理国殇模式数据
success(data.data);
//存储数据
let obj : string = JSON.stringify(data.data)
// console.log(obj)
SPHelper.default.saveSync(SpConstants.APP_MOURNS_INFO_DATA_MODEL,obj)
}, (error: Error) => {
// Logger.debug("LaunchPageModel获取启动相关数据获取失败:error ", error.toString())
fail(error.message)
})
})
...
...
Please
register
or
login
to post a comment