|
@@ -53,8 +53,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="Layout" lang="jsx">
|
|
|
-import { ref, onMounted } from 'vue';
|
|
|
-import { useUserStore } from '@/store';
|
|
|
+import { ref, onMounted, watch } from 'vue';
|
|
|
+import { useUserStore, useWorkStore } from '@/store';
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
import LeftMenu from './left-menu.vue';
|
|
|
import { moduleMap } from '@/router/asyncRoutes';
|
|
@@ -63,6 +63,8 @@ import { ChevronDownIcon } from 'tdesign-icons-vue-next';
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const userStore = useUserStore();
|
|
|
+const workStore = useWorkStore();
|
|
|
+
|
|
|
const moduleChange = (name) => {
|
|
|
userStore.setCurPageModule(name);
|
|
|
router.push({ name });
|
|
@@ -86,6 +88,24 @@ const clickHandler = (data) => {
|
|
|
userStore.logout();
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => userStore.curPageModule,
|
|
|
+ (val) => {
|
|
|
+ if (val !== 'MyWorkbenches') return;
|
|
|
+ workStore.updateWorkCounts();
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ }
|
|
|
+);
|
|
|
+watch(
|
|
|
+ () => route.name,
|
|
|
+ () => {
|
|
|
+ if (userStore.curPageModule !== 'MyWorkbenches') return;
|
|
|
+ workStore.updateWorkCounts();
|
|
|
+ }
|
|
|
+);
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -206,6 +226,23 @@ const clickHandler = (data) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ :deep(.t-menu__content) {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ flex-grow: 2;
|
|
|
+ }
|
|
|
+ :deep(.t-menu__count) {
|
|
|
+ color: #fff;
|
|
|
+ padding: 0 3px;
|
|
|
+ background-color: var(--td-error-color);
|
|
|
+ line-height: 20px;
|
|
|
+ height: 20px;
|
|
|
+ border-radius: 3px;
|
|
|
+ min-width: 20px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
:deep(.t-menu__item .svg-icon) {
|
|
|
margin-right: 8px;
|
|
|
}
|