pull/1395/head
gedoor 3 years ago
parent 3d13f25225
commit a3c777ba7d
  1. 10
      app/src/main/assets/web/rssSource/index.js

@ -204,7 +204,7 @@ $('.menu').addEventListener('click', e => {
case 'push': case 'push':
$$('#RuleList>label>div').forEach(item => { item.className = ''; }); $$('#RuleList>label>div').forEach(item => { item.className = ''; });
(async () => { (async () => {
await HttpPost(`/saveSources`, RuleSources).then(json => { await HttpPost(`/saveRssSources`, RuleSources).then(json => {
if (json.isSuccess) { if (json.isSuccess) {
let okData = json.data; let okData = json.data;
if (Array.isArray(okData)) { if (Array.isArray(okData)) {
@ -232,7 +232,7 @@ $('.menu').addEventListener('click', e => {
case 'pull': case 'pull':
showTab('书源列表'); showTab('书源列表');
(async () => { (async () => {
await HttpGet(`/getSources`).then(json => { await HttpGet(`/getRssSources`).then(json => {
if (json.isSuccess) { if (json.isSuccess) {
$('#RuleList').innerHTML = '' $('#RuleList').innerHTML = ''
localStorage.setItem('RssSources', JSON.stringify(RuleSources = json.data)); localStorage.setItem('RssSources', JSON.stringify(RuleSources = json.data));
@ -278,7 +278,7 @@ $('.menu').addEventListener('click', e => {
let DebugInfos = $('#DebugConsole'); let DebugInfos = $('#DebugConsole');
function DebugPrint(msg) { DebugInfos.value += `\n${msg}`; DebugInfos.scrollTop = DebugInfos.scrollHeight; } function DebugPrint(msg) { DebugInfos.value += `\n${msg}`; DebugInfos.scrollTop = DebugInfos.scrollHeight; }
let saveRule = [rule2json()]; let saveRule = [rule2json()];
HttpPost(`/saveSources`, saveRule).then(sResult => { HttpPost(`/saveRssSources`, saveRule).then(sResult => {
if (sResult.isSuccess) { if (sResult.isSuccess) {
let sKey = DebugKey.value ? DebugKey.value : '我的'; let sKey = DebugKey.value ? DebugKey.value : '我的';
$('#DebugConsole').value = `书源《${saveRule[0].bookSourceName}》保存成功!使用搜索关键字“${sKey}”开始调试...`; $('#DebugConsole').value = `书源《${saveRule[0].bookSourceName}》保存成功!使用搜索关键字“${sKey}”开始调试...`;
@ -306,7 +306,7 @@ $('.menu').addEventListener('click', e => {
case 'accept': case 'accept':
(async () => { (async () => {
let saveRule = [rule2json()]; let saveRule = [rule2json()];
await HttpPost(`/saveSources`, saveRule).then(json => { await HttpPost(`/saveRssSources`, saveRule).then(json => {
alert(json.isSuccess ? `书源《${saveRule[0].bookSourceName}》已成功保存到「阅读3.0APP」` : `书源《${saveRule[0].bookSourceName}》保存失败!\nErrorMsg: ${json.errorMsg}`); alert(json.isSuccess ? `书源《${saveRule[0].bookSourceName}》已成功保存到「阅读3.0APP」` : `书源《${saveRule[0].bookSourceName}》保存失败!\nErrorMsg: ${json.errorMsg}`);
setRule(saveRule[0]); setRule(saveRule[0]);
}).catch(err => { alert(`保存书源失败,无法连接到「阅读3.0APP」!\n${err}`); }); }).catch(err => { alert(`保存书源失败,无法连接到「阅读3.0APP」!\n${err}`); });
@ -419,7 +419,7 @@ $('.tab3>.titlebar').addEventListener('click', e => {
let selectRuleUrl = selectRule.id; let selectRuleUrl = selectRule.id;
let deleteSources = RuleSources.filter(item => item.bookSourceUrl == selectRuleUrl); // 提取待删除的书源 let deleteSources = RuleSources.filter(item => item.bookSourceUrl == selectRuleUrl); // 提取待删除的书源
let laveSources = RuleSources.filter(item => !(item.bookSourceUrl == selectRuleUrl)); // 提取待留下的书源 let laveSources = RuleSources.filter(item => !(item.bookSourceUrl == selectRuleUrl)); // 提取待留下的书源
HttpPost(`/deleteSources`, deleteSources).then(json => { HttpPost(`/deleteRssSources`, deleteSources).then(json => {
if (json.isSuccess) { if (json.isSuccess) {
let selectNode = document.getElementById(selectRuleUrl).parentNode; let selectNode = document.getElementById(selectRuleUrl).parentNode;
selectNode.parentNode.removeChild(selectNode); selectNode.parentNode.removeChild(selectNode);

Loading…
Cancel
Save