Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.setState({
book,
chapter,
chapterList
});
this.scrollToTop();
this.drawer.closeDrawer();
// 自动缓存后5章
this.onCache(5);
} else {
this.setState({
book,
chapter,
chapterList
});
Modal.alert("缺少资源", JSON.stringify(chapter, null, 2));
}
}
})
onReset = () => {
Modal.alert(
'还原阅读设置',
'字体大小、纸张模式等还原到默认模式,是否确定?',
[
{ text: '取消' },
{
text: '确定',
onPress: () => {
Storage.remove('readSetup')
},
},
]
)
}
submitExchange = () => {
const { originType, originUrl } = this.state;
if (!originType || !originUrl) {
Modal.alert('请将数据请写完整');
return false;
}
Modal.alert('确定使用此数据源?', '', [
{ text: '再想想' },
{
text: '确定使用',
onPress: () => {
this.setState({ visible: false });
Toast.loading("加载中...", 0);
this.props.dispatch(createAction("book/customizeOrigin")({
book: this.book,
dlWay: this.state.dlWay,
origin: originType,
url: originUrl,
...this.afterCallback()
}))
onError: () => {
Modal.alert("此来源缺少数据", "是否切换下载源?", [
{ text: "不用", style: "cancel" },
{
text: "切换",
onPress: () => {
this.props.dispatch(
NavigationActions.navigate({ routeName: "Switching", params: { book: item, dlWay: "all" } })
);
}
}
]);
}
})
submitExchange = () => {
const { originType, originUrl } = this.state;
if (!originType || !originUrl) {
Modal.alert('请将数据请写完整');
return false;
}
Modal.alert('确定使用此数据源?', '', [
{ text: '再想想' },
{
text: '确定使用',
onPress: () => {
this.setState({ visible: false });
Toast.loading("加载中...", 0);
this.props.dispatch(createAction("book/customizeOrigin")({
book: this.book,
dlWay: this.state.dlWay,
origin: originType,
url: originUrl,
...this.afterCallback()
}))
}
},
]);
onClearData = () => {
Modal.alert(
'清空书架',
'删除书架里的所有书本,包括章节、内容等,是否确定?',
[
{ text: '取消' },
{
text: '确定',
onPress: () => {
this.props.dispatch(createAction('book/clear')({}))
},
},
]
)
}