wenliming 2 anni fa
parent
commit
5a07880807

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

@@ -270,7 +270,7 @@ const submitPublish = () => {
         let allowContentTypes = props.contentTypeConfig.allowContentTypes || [];
         let isSupport = false;
 
-        if(props.resourceInfo.contentType) {
+        if(props.resourceInfo.loadSuccess) {
           for(let i = 0; i< allowContentTypes.length; i++){
             let idx = props.resourceInfo.contentType.indexOf(allowContentTypes[i]);
             if(idx > -1) {
@@ -279,7 +279,8 @@ const submitPublish = () => {
             }
           }
         } else {
-          isSupport = true;
+          message.error('Page loading failed');
+          return;
         }
 
         if(!isSupport) {

+ 3 - 0
src/view/iframe/publish/tool-box/index.vue

@@ -91,6 +91,7 @@ let resourceInfo = ref({
   statusCode: '',
   title: '',
   hasTitle: false,
+  loadSuccess: false
 });
 
 const changeShowCom = (params) => {
@@ -111,6 +112,7 @@ const changeShowCom = (params) => {
       statusCode: '',
       title: '',
       hasTitle: false,
+      loadSuccess: false
     };
 
     if(!params.appId || params.appId && !params.linkImagePath) {
@@ -151,6 +153,7 @@ const getResourceInfo = ({url}) => {
       resourceInfo.value.contentType = res.headers['content-type'];
       resourceInfo.value.statusCode = res.request.status;
       resourceInfo.value.hasTitle = resourceInfo.value.contentType.indexOf('text/html') > -1 ? true : false;
+      resourceInfo.value.loadSuccess = true;
 
       let siteTitle = '';
       if(resourceInfo.value.hasTitle) {