wenliming 2 лет назад
Родитель
Сommit
9acdbafe2e

+ 3 - 2
src/view/iframe/publish/tool-box/child/editor.vue

@@ -113,8 +113,9 @@ const searchHandler = async () => {
   }
 
   if (siteRes) {
-    if (siteRes.headers['content-type'].indexOf('text/html') < 0 || siteRes.request.status > 399) {
-      // 提示
+    if (siteRes.headers['content-type'].indexOf('text/html') < 0 || siteRes.request.status > 403) {
+      loadingHide();
+      message.error('Page loading failed');
       return;
     }
     let urlObj = new URL(siteUrl.value);

+ 33 - 6
src/view/iframe/publish/tool-box/child/preview.vue

@@ -65,10 +65,11 @@
 </template>
 
 <script setup>
-import { ref, defineEmits, reactive, defineProps, onMounted, nextTick, onUnmounted } from "vue";
-import { postPublish } from "@/http/publishApi";
-import installCard from '@/view/content/tool-box/index.vue'
+import { ref, defineEmits, reactive, defineProps, onMounted, nextTick, onUnmounted, watch } from "vue";
+import { message } from "ant-design-vue";
 
+import installCard from '@/view/content/tool-box/index.vue'
+import { postPublish } from "@/http/publishApi";
 import { getChromeStorage, setChromeStorage } from "@/uilts/chromeExtension"
 import { getUser } from "@/http/publishApi"
 
@@ -83,6 +84,8 @@ let reviewCanvasParams = reactive({
 });
 let timer = ref(null);
 
+const loadingHide = null;
+
 const props = defineProps({
     previewData: {
         type: Object,
@@ -91,6 +94,17 @@ const props = defineProps({
             originUrl: '',
             appId: ''
         }
+    },
+    screenshot: {
+        type: String,
+        default: ''
+    }
+})
+
+watch(() => props.screenshot, (newVal) => {
+    let { appId } = props.previewData;
+    if(loadingHide && newVal && !appId) {
+        submitPublish();
     }
 })
 
@@ -146,13 +160,26 @@ const calcPreviewCanvasParams = () => {
 }
 
 const publishHandler = () => {
-    // 去 checkout 有没有封面图 loading ...
-    
-    if(submitIng.value) {
+    let { appId } = props.previewData;
+    if(loadingHide) {
         return;
     }
+
+    if(!appId && !props.screenshot) {
+        loadingHide = message.loading('loading...', 0);
+        return;
+    }
+
+    submitPublish();
+}
+
+const submitPublish = () => {
     let {convertUrl, originUrl, appId, currentApp} = props.previewData;
 
+    if(submitIng.value) {
+        return;
+    }
+
     setHistoryData(currentApp);
 
     let linkTitle = previewData.currentApp.defaultTit ? 'Install DeNet Plugin to Participate' : previewData.currentApp.name;