From 004176924ce35c96600f5c18e85478944de8bec6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 14 一月 2023 16:46:50 +0800 Subject: [PATCH] 2023-01-14 --- src/tabviews/custom/components/carousel/data-card/index.jsx | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 8829c61..966e472 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -117,7 +117,7 @@ } componentDidMount () { - const { config } = this.state + const { config, sync } = this.state MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) @@ -127,6 +127,21 @@ this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { this.loadData('timer') + }) + } + + if (config.$cache && (config.setting.sync !== 'true' || sync)) { + Api.getLCacheConfig(config.uuid).then(res => { + if (!res) return + + let _data = res.map((item, index) => { + item.key = index + item.$$uuid = item[config.setting.primaryKey] || '' + item.$Index = index + 1 + '' + return item + }) + + this.setState({data: _data}) }) } } @@ -276,6 +291,10 @@ let result = await Api.genericInterface(param) if (result.status) { + if (config.$cache) { + Api.writeCacheConfig(config.uuid, result.data || '') + } + this.setState({ data: result.data.map((item, index) => { item.key = index -- Gitblit v1.8.0