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
xugenyuan
2024-08-28 16:52:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
380d762f4ec659296dc6c3b7d78a6dd66da352a3
380d762f
1 parent
c55a93cb
fix |> 空串解析json报错
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
View file @
380d762
...
...
@@ -13,6 +13,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
import { BottomNavigationComponent } from './view/BottomNavigationComponent';
import LaunchDataModel from './viewModel/LaunchDataModel';
import { LaunchPageModel } from './viewModel/LaunchPageModel';
import { JSON } from '@kit.ArkTS';
const TAG = 'MainPage';
...
...
@@ -46,14 +47,19 @@ struct MainPage {
LogoutViewModel.clearLoginInfo()
})
let GrayManage = new GrayManageModel()
let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_MOURNS_INFO_DATA_MODEL,'') as string
let dataModel : LaunchDataModel = JSON.parse(dataModelStr)
// console.log(dataModelStr)
try {
if (dataModelStr && dataModelStr.length > 0) {
let dataModel : LaunchDataModel = JSON.parse(dataModelStr) as LaunchDataModel
// 处理国殇模式数据
let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel
let GrayManage = new GrayManageModel()
GrayManage.setMourning(mourns)
}
AppStorage.setOrCreate('GrayManage', GrayManage)
} catch (e) {
Logger.error(TAG, `Unexpected Text in JSON ??` + JSON.stringify(e) +" " + dataModelStr);
}
}
pageTransition() {
...
...
Please
register
or
login
to post a comment