Parcourir la source

商家登录后,上方已打开的标签显示服务中台中的页面,显示商户头像,缺少“展开”功能

zhuli il y a 1 mois
Parent
commit
64b43b8021

+ 13 - 0
src/layouts/components/Tabs/index.vue

@@ -22,14 +22,19 @@ import { ref, computed, watch, onMounted } from "vue";
 import { useRoute, useRouter } from "vue-router";
 import { useGlobalStore } from "@/stores/modules/global";
 import { useTabsStore } from "@/stores/modules/tabs";
+import { useKeepAliveStore } from "@/stores/modules/keepAlive";
 import { useAuthStore } from "@/stores/modules/auth";
 import { TabsPaneContext, TabPaneName } from "element-plus";
 import MoreButton from "./components/MoreButton.vue";
 import { HOME_URL } from "@/config";
+import { localGet } from "@/utils";
+
+const TABS_OWNER_KEY = "geeker-tabs-owner";
 
 const route = useRoute();
 const router = useRouter();
 const tabStore = useTabsStore();
+const keepAliveStore = useKeepAliveStore();
 const authStore = useAuthStore();
 const globalStore = useGlobalStore();
 
@@ -38,6 +43,14 @@ const tabsMenuList = computed(() => tabStore.tabsMenuList);
 const tabsIcon = computed(() => globalStore.tabsIcon);
 
 onMounted(() => {
+  // 若当前用户与持久化标签所属用户不一致,清空标签,避免展示其它系统的标签
+  const currentUserId = String(localGet("geeker-user")?.userInfo?.id ?? "");
+  const storedOwner = window.localStorage.getItem(TABS_OWNER_KEY) ?? "";
+  if (currentUserId && currentUserId !== storedOwner) {
+    tabStore.setTabs([]);
+    keepAliveStore.setKeepAliveName([]);
+    window.localStorage.setItem(TABS_OWNER_KEY, currentUserId);
+  }
   tabsDrop();
   initTabs();
 });

+ 7 - 2
src/views/dynamicManagement/index.vue

@@ -156,9 +156,14 @@
                 </div>
               </div>
             </div>
-
+            <div style=" padding-bottom: 10px;color: #ffffff">
+              {{ currentDetail.title }}
+            </div>
             <div class="detail-description">
-              <p :class="{ 'text-ellipsis': !isDescriptionExpanded }">
+              <p
+                v-if="isDescriptionExpanded || (currentDetail.context && currentDetail.context.length >= 20)"
+                :class="{ 'text-ellipsis': !isDescriptionExpanded }"
+              >
                 {{ currentDetail.context }}
               </p>
               <span v-if="currentDetail.context" class="expand-btn" @click="toggleDescription">

+ 9 - 3
src/views/dynamicManagement/myDynamic.vue

@@ -222,11 +222,17 @@
               </div>
             </div>
 
+            <div style=" padding-bottom: 10px;color: #ffffff">
+              {{ currentDetail.title }}
+            </div>
             <div class="detail-description">
-              <p :class="{ 'text-ellipsis': !isDescriptionExpanded }">
-                {{ currentDetail.description }}
+              <p
+                v-if="isDescriptionExpanded || (currentDetail.context && currentDetail.context.length >= 20)"
+                :class="{ 'text-ellipsis': !isDescriptionExpanded }"
+              >
+                {{ currentDetail.context }}
               </p>
-              <span v-if="currentDetail.description" class="expand-btn" @click="toggleDescription">
+              <span v-if="currentDetail.context" class="expand-btn" @click="toggleDescription">
                 {{ isDescriptionExpanded ? "收起" : "展开" }}
               </span>
             </div>