Эх сурвалжийг харах

feat: 新增返回首页判断

zhangyuhan 5 сар өмнө
parent
commit
234f0251be

+ 28 - 12
apps/mobile/src/views/ai-search/index.vue

@@ -34,9 +34,18 @@ const rightAction = ref({
   ]
 })
 
+const canShowDoBackHome = ref(true)
+function doBackHome () {
+  location.href = '/'
+}
+
 function doBack() {
   trickClick(`退出页面`)
-  that.$router.back()
+  if (history.length === 1) {
+    location.href = '/'
+  } else {
+    that.$router.back()
+  }
 }
 
 function onSelectRightAction(action) {
@@ -923,20 +932,26 @@ init()
           </div>
         </div>
       </div>
-      <Popover
-        v-model="rightAction.show"
-        placement="bottom-end"
-        :offset="[-16, 12]"
-        trigger="click"
-        :actions="rightAction.actions"
-        @select="onSelectRightAction"
-      >
-        <template #reference>
+      <div>
+        <span v-if='canShowDoBackHome' class="back-icon" style='margin-right: 2px;padding-right: 6px;' @click='doBackHome'>
+          <i class="iconfont icon-nav_un_home" />
+        </span>
+        <Popover
+          v-model="rightAction.show"
+          placement="bottom-end"
+          :offset="[-16, 12]"
+          trigger="click"
+          :actions="rightAction.actions"
+          @select="onSelectRightAction"
+        >
+          <template #reference>
           <span class="right-icon">
             <i class="iconfont icon-gengduo-shuxiang" />
           </span>
-        </template>
-      </Popover>
+          </template>
+        </Popover>
+      </div>
+
     </div>
 
     <div class="ai-search--content j-main" ref="contentEl">
@@ -1566,6 +1581,7 @@ init()
     }
     .right-icon {
       padding: 10px 12px;
+      padding-left: 6px;
       i {
         display: inline-block;
         font-size: 24px;