Bladeren bron

[add] post editor 黑名单、关闭通知页

wenliming 2 jaren geleden
bovenliggende
commit
755134917c

+ 8 - 0
src/http/toolBoxApi.js

@@ -22,4 +22,12 @@ export function screenshotWebsite(params) {
         method: 'post',
         data: params
     })
+}
+
+export function checkInputUrlInBlacklist(params) {
+    return service({
+        url: `/post/editor/checkInputUrlInBlacklist`,
+        method: 'post',
+        data: params
+    })
 }

+ 6 - 0
src/iframe/tool-box-guide.js

@@ -1,7 +1,13 @@
 import { createApp } from 'vue'
 import App from '@/view/iframe/publish/tool-box/child/guide.vue'
 
+import "ant-design-vue/dist/antd.css"; // or 'ant-design-vue/dist/antd.less'
+
+import {message} from "ant-design-vue";
+
 const app = createApp(App);
+
+app.use(message);
 app.mount('#app');
 
 window.onload= () => {

+ 14 - 12
src/logic/background/denet.js

@@ -1,18 +1,20 @@
 import { getChromeStorage } from '@/uilts/chromeExtension.js'
+import { payAchNoticeUrl } from '@/http/configAPI'
 
 export const closeAchPayNoticeHandler = async () => {
-    let {id} = await getCurrentTab();
-
-    chrome.tabs.remove(
-        id, () => {
-            getChromeStorage('achPayInfo', (res) => {
-                chrome.storage.local.remove("achPayInfo");
-                if(res && res.tab) {
-                    chrome.tabs.highlight({ windowId: res.tab.windowId, tabs: res.tab.index })
-                }
-            })
-        }
-    )
+    let res = await getCurrentTab();
+    if(res.url.startsWith(payAchNoticeUrl)) {
+        chrome.tabs.remove(
+            res.id, () => {
+                getChromeStorage('achPayInfo', (res) => {
+                    chrome.storage.local.remove("achPayInfo");
+                    if(res && res.tab) {
+                        chrome.tabs.highlight({ windowId: res.tab.windowId, tabs: res.tab.index })
+                    }
+                })
+            }
+        )
+    }
 }
 
 const getCurrentTab = async () => {

+ 18 - 1
src/view/iframe/publish/tool-box/child/editor.vue

@@ -53,7 +53,7 @@
 import { ref, defineProps, defineEmits, onMounted } from "vue";
 import axios from 'axios';
 import { message } from "ant-design-vue";
-import { convertUrl, getAllPostEditorAppData } from "@/http/toolBoxApi";
+import { convertUrl, getAllPostEditorAppData, checkInputUrlInBlacklist } from "@/http/toolBoxApi";
 import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
 import { checkURL, debounce } from "@/uilts/help"
 
@@ -98,6 +98,23 @@ const searchHandler = async (_params) => {
     message.error('Page loading failed');
   }, 1000 * 15);
 
+  if(!_params) {
+    let blackListRes = await checkInputUrlInBlacklist({
+      params: {
+        url: siteUrl.value
+      }
+    })
+
+    if(blackListRes.code == 0) {
+      if(blackListRes.data) {
+        loadingHide();
+        clearTimeout(timer);
+        message.info('This site is not supported');
+        return;
+      }
+    }
+  }
+
   let siteRes = await axios.get(siteUrl.value);
 
   let currentApp = {

+ 16 - 0
src/view/iframe/publish/tool-box/child/guide.vue

@@ -28,6 +28,9 @@
 import { ref, reactive, onMounted } from "vue";
 import { checkURL } from "@/uilts/help"
 import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
+import { message } from "ant-design-vue";
+
+import { checkInputUrlInBlacklist } from "@/http/toolBoxApi";
 
 let siteUrl = ref('');
 
@@ -43,6 +46,19 @@ const confirm = async () => {
         return;
     }
 
+    let blackListRes = await checkInputUrlInBlacklist({
+        params: {
+            url: siteUrl.value
+        }
+    })
+
+    if(blackListRes.code == 0) {
+        if(blackListRes.data) {
+            message.info('This site is not supported');
+            return;
+        }
+    }
+
     let {list: windowList = []} = await getChromeStorage('guideAppWindowList') || {list: []};
 
     chrome.runtime.sendMessage({