|
@@ -14,7 +14,7 @@ import { ConfigManager } from '../common/util/ConfigManager'
|
|
|
import { UIUtil } from '../common/util/UIUtil'
|
|
import { UIUtil } from '../common/util/UIUtil'
|
|
|
import { PrintBiddingTokenUtils } from '../common/util/PrintBiddintTokenUtils'
|
|
import { PrintBiddingTokenUtils } from '../common/util/PrintBiddintTokenUtils'
|
|
|
import { DemoConstants } from '../entryability/DemoConstants'
|
|
import { DemoConstants } from '../entryability/DemoConstants'
|
|
|
-import { AppUtil, Base64Util, FileUtil, LogUtil, StrUtil, ToastUtil } from '@pura/harmony-utils'
|
|
|
|
|
|
|
+import { AppUtil, Base64Util, FileUtil, LogUtil, PreferencesUtil, StrUtil, ToastUtil } from '@pura/harmony-utils'
|
|
|
import { Utility } from '../common/util/Utility'
|
|
import { Utility } from '../common/util/Utility'
|
|
|
import { VideoItem } from '../viewmodel/VideoItem'
|
|
import { VideoItem } from '../viewmodel/VideoItem'
|
|
|
import { fileIo, fileUri, picker, ReadTextOptions } from '@kit.CoreFileKit'
|
|
import { fileIo, fileUri, picker, ReadTextOptions } from '@kit.CoreFileKit'
|
|
@@ -131,9 +131,7 @@ struct SplashIndex{
|
|
|
|
|
|
|
|
@State rootPath:string = ''
|
|
@State rootPath:string = ''
|
|
|
@State currentPath:string = ''
|
|
@State currentPath:string = ''
|
|
|
- @State videoLocalList: Array<VideoItem> = []
|
|
|
|
|
- @State fileList: Array<String> = []
|
|
|
|
|
- @State dirList: Array<VideoItem> = []
|
|
|
|
|
|
|
+ @State videoLocalList: VideoItem[] = []
|
|
|
@State expireDate:string = ''
|
|
@State expireDate:string = ''
|
|
|
async mkDownLoadDir(){
|
|
async mkDownLoadDir(){
|
|
|
|
|
|
|
@@ -142,9 +140,12 @@ struct SplashIndex{
|
|
|
let download_path = new fileUri.FileUri(documentSaveResult[0]).path
|
|
let download_path = new fileUri.FileUri(documentSaveResult[0]).path
|
|
|
this.rootPath = download_path
|
|
this.rootPath = download_path
|
|
|
let vPath = download_path + '/'+ STR_LOCK_VIDEO+ '/' + VIP_FILEPATH
|
|
let vPath = download_path + '/'+ STR_LOCK_VIDEO+ '/' + VIP_FILEPATH
|
|
|
|
|
+
|
|
|
this.expireDate = this.readDataFromFile(vPath)
|
|
this.expireDate = this.readDataFromFile(vPath)
|
|
|
Utility.setNoble(this.expireDate)
|
|
Utility.setNoble(this.expireDate)
|
|
|
- this.doMain()
|
|
|
|
|
|
|
+ // 载入首页文件夹的缓存
|
|
|
|
|
+ this.loadCacheFromStorage(this.rootPath)
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -209,6 +210,30 @@ struct SplashIndex{
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 缓存机制
|
|
|
|
|
+ private cache: Map<string, Array<VideoItem>> = new Map();
|
|
|
|
|
+ //查找缓存
|
|
|
|
|
+ private findCache(key: string): Array<VideoItem> | undefined {
|
|
|
|
|
+ return this.cache.get(key);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 载入首页文件夹的缓存
|
|
|
|
|
+ async loadCacheFromStorage(curPath:string) {
|
|
|
|
|
+ const cacheString = await PreferencesUtil.getStringSync('music_cache', '');
|
|
|
|
|
+ if (cacheString) {
|
|
|
|
|
+ const cacheArray: [string, Array<VideoItem>][] = JSON.parse(cacheString);
|
|
|
|
|
+ this.cache = new Map(cacheArray);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const cachedValue = this.findCache(curPath);
|
|
|
|
|
+ // 合并文件夹和文件,文件夹在前,文件在后
|
|
|
|
|
+ if(cachedValue)
|
|
|
|
|
+ this.videoLocalList = cachedValue;
|
|
|
|
|
+ console.log(" onecold 欢迎页面 this.videoLocalList.length = " + this.videoLocalList.length);
|
|
|
|
|
+ this.doMain()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//初始化SDK
|
|
//初始化SDK
|
|
|
async initCSJSDK(){
|
|
async initCSJSDK(){
|
|
|
await this.initAppConfig();
|
|
await this.initAppConfig();
|
|
@@ -353,8 +378,8 @@ struct SplashIndex{
|
|
|
|
|
|
|
|
|
|
|
|
|
junpToMain(){
|
|
junpToMain(){
|
|
|
- console.info('onecold SplashIndex junpToMain ' )
|
|
|
|
|
- router.replace({
|
|
|
|
|
|
|
+ console.info('onecold SplashIndex junpToMain length= '+this.videoLocalList.length )
|
|
|
|
|
+ this.getUIContext().getRouter().replaceUrl({
|
|
|
url: 'pages/NewIndex',
|
|
url: 'pages/NewIndex',
|
|
|
params: {
|
|
params: {
|
|
|
videoList: this.videoLocalList
|
|
videoList: this.videoLocalList
|
|
@@ -423,4 +448,5 @@ struct SplashIndex{
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|