Browse Source

Merge branch 'dev_v1.1.4' of https://git.yishihui.com/DeNet/de-net into dev_v1.1.4

zhangwei 2 năm trước cách đây
mục cha
commit
60a950cffd
1 tập tin đã thay đổi với 44 bổ sung15 xóa
  1. 44 15
      src/view/iframe/publish/tool-box/child/editor.vue

+ 44 - 15
src/view/iframe/publish/tool-box/child/editor.vue

@@ -23,7 +23,9 @@
           <div class="app-list">
             <div class="app" v-for="(app, idx) in historyList" :key="idx"
               @click="clickHistoryAppHandler(app)">
-              <img :src="app.iconPath" alt="" :onerror="imgOnError">
+              <div class="img-wrapper">
+                <img class="img" :class="{'small-img': !app.appId}" :src="app.iconPath" :onerror="imgOnError" />
+              </div>
               <div class="name">
                 {{ app.name }}
               </div>
@@ -36,7 +38,7 @@
           </div>
           <div class="app-list">
             <div class="app" v-for="(app, idx) in item.apps" :key="idx" @click="clickAppHandler(app)">
-              <img :src="app.iconPath" alt="">
+              <img class="app-img" :src="app.iconPath" alt="">
               <div class="name">
                 {{ app.name }}
               </div>
@@ -96,13 +98,15 @@ const searchHandler = async () => {
       // 提示
       return;
     }
+    let urlObj = new URL(siteUrl.value);
     if(siteRes.data) {
-      let arr = siteRes.data.match(/<title>(\S*)<\/title>/);
-      if(arr && arr.length > 1) {
-        siteTitle = arr[1];
-      }
+      siteTitle = getTitleByHtmlStr(siteRes.data);
+      if(!siteTitle) {
+        siteTitle = urlObj.hostname;
+      } 
+      console.log(siteTitle)
     }
-    favicon = new URL(siteUrl.value).origin + '/favicon.ico';
+    favicon = urlObj.origin + '/favicon.ico';
   } 
 
   let currentApp = {
@@ -129,6 +133,12 @@ const searchHandler = async () => {
   emits('changeShowCom', params)
 }
 
+const getTitleByHtmlStr = (str) => {
+  let index1 = str.indexOf('<title>') + 7;
+  let index2 = str.indexOf('</title>');
+  return str.substring(index1, index2) || '';
+};
+
 const clickHistoryAppHandler = (params) => {
   if(params.appId) {
     clickAppHandler(params);
@@ -294,14 +304,33 @@ onMounted(() => {
       padding: 36px 30px 20px 50px;
       box-sizing: border-box;
 
-      // .history-wrapper {
-      //   height: 110px !important;
-      //   overflow: hidden;
+      .history-wrapper {
 
-      //   .app-list {
-      //     flex-wrap: nowrap !important;
-      //   }
-      // }
+        .app-list {
+            .img-wrapper {
+              width: 60px;
+              height: 60px;
+              border-radius: 10px;
+              margin-bottom: 10px;
+              border: 1px solid #E5E5E5;
+              box-sizing: border-box;
+              display: flex;
+              align-items: center;
+              justify-content: center;
+
+              .img {
+                width: 100%;
+                height: 100%;
+                border-radius: 10px;
+              }
+
+              .small-img {
+                width: 25px;
+                height: 25px;
+              }
+            }
+        }
+      }
 
       .cate-item {
         min-height: 110px;
@@ -336,7 +365,7 @@ onMounted(() => {
             height: 110px;
             cursor: pointer;
 
-            img {
+            .app-img {
               width: 60px;
               height: 60px;
               border-radius: 10px;