congmao-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/index.js +20 -0
- package/package.json +42 -0
- package/src/commands/create.js +171 -0
- package/src/commands/mcp.js +157 -0
- package/src/mcp/CURSOR_SETUP.md +259 -0
- package/src/mcp/README.md +134 -0
- package/src/mcp/USAGE_EXAMPLES.md +181 -0
- package/src/mcp/get-cursor-config.js +58 -0
- package/src/mcp/package.json +23 -0
- package/src/mcp/pnpm-lock.yaml +2441 -0
- package/src/mcp/src/handlers.js +211 -0
- package/src/mcp/src/http-server.js +332 -0
- package/src/mcp/src/index.js +195 -0
- package/src/mcp/src/schemas.js +54 -0
- package/src/mcp/test-create-project.js +49 -0
- package/src/mcp/test-mcp.js +89 -0
- package/src/mcp/test-show-tree.js +66 -0
- package/src/template/Uni-app/README.md +19 -0
- package/src/template/Uni-app/babel.config.js +81 -0
- package/src/template/Uni-app/package.json +107 -0
- package/src/template/Uni-app/postcss.config.js +27 -0
- package/src/template/Uni-app/public/index.html +25 -0
- package/src/template/Uni-app/shims-uni.d.ts +11 -0
- package/src/template/Uni-app/shims-vue.d.ts +4 -0
- package/src/template/Uni-app/src/App.vue +17 -0
- package/src/template/Uni-app/src/main.js +12 -0
- package/src/template/Uni-app/src/manifest.json +75 -0
- package/src/template/Uni-app/src/pages/index/index.vue +49 -0
- package/src/template/Uni-app/src/pages.json +16 -0
- package/src/template/Uni-app/src/static/logo.png +0 -0
- package/src/template/Uni-app/src/uni.promisify.adaptor.js +13 -0
- package/src/template/Uni-app/src/uni.scss +76 -0
- package/src/template/Uni-app/yarn.lock +11466 -0
- package/src/template/Vue2/.editorconfig +14 -0
- package/src/template/Vue2/.env +2 -0
- package/src/template/Vue2/.env.development +2 -0
- package/src/template/Vue2/.env.site +2 -0
- package/src/template/Vue2/.prettierrc.js +39 -0
- package/src/template/Vue2/.stylelintignore +8 -0
- package/src/template/Vue2/README-zh_CN.md +115 -0
- package/src/template/Vue2/commitlint.config.js +1 -0
- package/src/template/Vue2/docs/docs-starter.png +0 -0
- package/src/template/Vue2/docs/docs-startup.png +0 -0
- package/src/template/Vue2/docs/docs-structure.png +0 -0
- package/src/template/Vue2/globals.d.ts +13 -0
- package/src/template/Vue2/index.html +27 -0
- package/src/template/Vue2/jsx.d.ts +13 -0
- package/src/template/Vue2/mock/index.ts +147 -0
- package/src/template/Vue2/package.json +91 -0
- package/src/template/Vue2/package.json.ejs +91 -0
- package/src/template/Vue2/public/favicon.ico +0 -0
- package/src/template/Vue2/shims-vue.d.ts +5 -0
- package/src/template/Vue2/src/App.vue +19 -0
- package/src/template/Vue2/src/assets/assets-login-bg-black.png +0 -0
- package/src/template/Vue2/src/assets/assets-login-bg-white.png +0 -0
- package/src/template/Vue2/src/assets/assets-logo-full.svg +39 -0
- package/src/template/Vue2/src/assets/assets-product-1.svg +5 -0
- package/src/template/Vue2/src/assets/assets-product-2.svg +5 -0
- package/src/template/Vue2/src/assets/assets-product-3.svg +5 -0
- package/src/template/Vue2/src/assets/assets-product-4.svg +5 -0
- package/src/template/Vue2/src/assets/assets-result-403.svg +32 -0
- package/src/template/Vue2/src/assets/assets-result-404.svg +36 -0
- package/src/template/Vue2/src/assets/assets-result-500.svg +32 -0
- package/src/template/Vue2/src/assets/assets-result-ie.svg +33 -0
- package/src/template/Vue2/src/assets/assets-result-maintenance.svg +49 -0
- package/src/template/Vue2/src/assets/assets-result-wifi.svg +23 -0
- package/src/template/Vue2/src/assets/assets-setting-auto.svg +13 -0
- package/src/template/Vue2/src/assets/assets-setting-dark.svg +5 -0
- package/src/template/Vue2/src/assets/assets-setting-light.svg +13 -0
- package/src/template/Vue2/src/assets/assets-t-logo.svg +41 -0
- package/src/template/Vue2/src/assets/assets-tencent-logo.png +0 -0
- package/src/template/Vue2/src/components/color/index.vue +35 -0
- package/src/template/Vue2/src/components/product-card/index.vue +121 -0
- package/src/template/Vue2/src/components/result/index.vue +118 -0
- package/src/template/Vue2/src/components/thumbnail/index.vue +49 -0
- package/src/template/Vue2/src/components/trend/index.vue +105 -0
- package/src/template/Vue2/src/config/color.ts +30 -0
- package/src/template/Vue2/src/config/global.ts +2 -0
- package/src/template/Vue2/src/config/host.ts +26 -0
- package/src/template/Vue2/src/config/style.ts +14 -0
- package/src/template/Vue2/src/constants/index.ts +46 -0
- package/src/template/Vue2/src/interface.ts +39 -0
- package/src/template/Vue2/src/layouts/blank.vue +12 -0
- package/src/template/Vue2/src/layouts/components/Breadcrumb.vue +39 -0
- package/src/template/Vue2/src/layouts/components/Content.vue +43 -0
- package/src/template/Vue2/src/layouts/components/Footer.vue +27 -0
- package/src/template/Vue2/src/layouts/components/Header.vue +321 -0
- package/src/template/Vue2/src/layouts/components/LayoutContent.vue +168 -0
- package/src/template/Vue2/src/layouts/components/LayoutHeader.vue +52 -0
- package/src/template/Vue2/src/layouts/components/LayoutSidebar.vue +51 -0
- package/src/template/Vue2/src/layouts/components/MenuContent.vue +108 -0
- package/src/template/Vue2/src/layouts/components/Notice.vue +221 -0
- package/src/template/Vue2/src/layouts/components/Search.vue +134 -0
- package/src/template/Vue2/src/layouts/components/SideNav.vue +150 -0
- package/src/template/Vue2/src/layouts/index.vue +100 -0
- package/src/template/Vue2/src/layouts/setting.vue +404 -0
- package/src/template/Vue2/src/main.js +9 -0
- package/src/template/Vue2/src/main.jsx +51 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/MiddleChart.vue +158 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/OutputOverview.vue +189 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/RankList.vue +111 -0
- package/src/template/Vue2/src/pages/dashboard/base/components/TopPanel.vue +246 -0
- package/src/template/Vue2/src/pages/dashboard/base/index.ts +702 -0
- package/src/template/Vue2/src/pages/dashboard/base/index.vue +44 -0
- package/src/template/Vue2/src/pages/dashboard/detail/index.ts +267 -0
- package/src/template/Vue2/src/pages/dashboard/detail/index.vue +242 -0
- package/src/template/Vue2/src/pages/detail/advanced/components/Product.vue +167 -0
- package/src/template/Vue2/src/pages/detail/advanced/index.less +74 -0
- package/src/template/Vue2/src/pages/detail/advanced/index.vue +219 -0
- package/src/template/Vue2/src/pages/detail/base/index.less +105 -0
- package/src/template/Vue2/src/pages/detail/base/index.vue +46 -0
- package/src/template/Vue2/src/pages/detail/deploy/index.ts +204 -0
- package/src/template/Vue2/src/pages/detail/deploy/index.vue +224 -0
- package/src/template/Vue2/src/pages/detail/secondary/index.less +71 -0
- package/src/template/Vue2/src/pages/detail/secondary/index.vue +131 -0
- package/src/template/Vue2/src/pages/form/base/index.less +57 -0
- package/src/template/Vue2/src/pages/form/base/index.vue +254 -0
- package/src/template/Vue2/src/pages/form/step/index.less +37 -0
- package/src/template/Vue2/src/pages/form/step/index.vue +259 -0
- package/src/template/Vue2/src/pages/frame/doc/index.vue +86 -0
- package/src/template/Vue2/src/pages/frame/tdesign/index.vue +86 -0
- package/src/template/Vue2/src/pages/list/base/index.vue +267 -0
- package/src/template/Vue2/src/pages/list/card/index.vue +221 -0
- package/src/template/Vue2/src/pages/list/components/CommonTable.vue +313 -0
- package/src/template/Vue2/src/pages/list/filter/index.vue +15 -0
- package/src/template/Vue2/src/pages/list/tree/index.vue +174 -0
- package/src/template/Vue2/src/pages/login/components/components-header.vue +74 -0
- package/src/template/Vue2/src/pages/login/components/components-login.vue +154 -0
- package/src/template/Vue2/src/pages/login/components/components-register.vue +144 -0
- package/src/template/Vue2/src/pages/login/index.less +202 -0
- package/src/template/Vue2/src/pages/login/index.vue +53 -0
- package/src/template/Vue2/src/pages/nest-menu/Index.vue +10 -0
- package/src/template/Vue2/src/pages/result/403/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/404/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/500/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/browser-incompatible/index.vue +77 -0
- package/src/template/Vue2/src/pages/result/fail/index.vue +57 -0
- package/src/template/Vue2/src/pages/result/maintenance/index.vue +14 -0
- package/src/template/Vue2/src/pages/result/network-error/index.vue +24 -0
- package/src/template/Vue2/src/pages/result/success/index.vue +59 -0
- package/src/template/Vue2/src/pages/user/index.less +148 -0
- package/src/template/Vue2/src/pages/user/index.ts +157 -0
- package/src/template/Vue2/src/pages/user/index.vue +204 -0
- package/src/template/Vue2/src/permission.js +56 -0
- package/src/template/Vue2/src/router/index.js +43 -0
- package/src/template/Vue2/src/router/modules/base.ts +29 -0
- package/src/template/Vue2/src/router/modules/components.ts +175 -0
- package/src/template/Vue2/src/router/modules/others.ts +55 -0
- package/src/template/Vue2/src/service/service-advance.ts +233 -0
- package/src/template/Vue2/src/service/service-base.ts +205 -0
- package/src/template/Vue2/src/service/service-detail-base.ts +84 -0
- package/src/template/Vue2/src/service/service-detail-deploy.ts +234 -0
- package/src/template/Vue2/src/service/service-detail.ts +57 -0
- package/src/template/Vue2/src/service/service-user.ts +64 -0
- package/src/template/Vue2/src/store/index.ts +22 -0
- package/src/template/Vue2/src/store/modules/notification.ts +90 -0
- package/src/template/Vue2/src/store/modules/permission.ts +66 -0
- package/src/template/Vue2/src/store/modules/setting.ts +122 -0
- package/src/template/Vue2/src/store/modules/tab-router.ts +83 -0
- package/src/template/Vue2/src/store/modules/user.ts +98 -0
- package/src/template/Vue2/src/style/font-family.less +6 -0
- package/src/template/Vue2/src/style/index.less +5 -0
- package/src/template/Vue2/src/style/layout.less +201 -0
- package/src/template/Vue2/src/style/reset.less +78 -0
- package/src/template/Vue2/src/style/variables.less +27 -0
- package/src/template/Vue2/src/utils/charts.ts +38 -0
- package/src/template/Vue2/src/utils/color.ts +118 -0
- package/src/template/Vue2/src/utils/date.ts +12 -0
- package/src/template/Vue2/src/utils/request.ts +60 -0
- package/src/template/Vue2/stylelint.config.js +5 -0
- package/src/template/Vue2/tsconfig.json +26 -0
- package/src/template/Vue2/vite.config.js +58 -0
- package/src/template/Vue3/package.json.ejs +8 -0
- package/src/template/Vue3/pages.json +10 -0
- package/src/template/Vue3/src/main.js +7 -0
- package/src/utils/copy.js +17 -0
- package/src/utils/eslint.js +205 -0
- package/src/utils/logo.js +18 -0
- package/src/utils/render.js +20 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="layoutCls">
|
|
3
|
+
<t-head-menu :class="menuCls" :theme="theme" expandType="popup" :value="active">
|
|
4
|
+
<template #logo>
|
|
5
|
+
<span v-if="showLogo" class="header-logo-container" @click="handleNav('/dashboard/base')">
|
|
6
|
+
<logo-full class="t-logo" />
|
|
7
|
+
</span>
|
|
8
|
+
<div v-else class="header-operate-left">
|
|
9
|
+
<t-button theme="default" shape="square" variant="text" @click="changeCollapsed">
|
|
10
|
+
<view-list-icon class="collapsed-icon" />
|
|
11
|
+
</t-button>
|
|
12
|
+
<search :layout="layout" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
<menu-content v-show="layout !== 'side'" class="header-menu" :navData="menu" />
|
|
16
|
+
<template #operations>
|
|
17
|
+
<div class="operations-container">
|
|
18
|
+
<!-- 搜索框 -->
|
|
19
|
+
<search v-if="layout !== 'side'" :layout="layout" />
|
|
20
|
+
|
|
21
|
+
<!-- 全局通知 -->
|
|
22
|
+
<notice />
|
|
23
|
+
|
|
24
|
+
<t-tooltip placement="bottom" content="代码仓库">
|
|
25
|
+
<t-button theme="default" shape="square" variant="text" @click="navToGitHub">
|
|
26
|
+
<logo-github-icon />
|
|
27
|
+
</t-button>
|
|
28
|
+
</t-tooltip>
|
|
29
|
+
<t-tooltip placement="bottom" content="帮助文档">
|
|
30
|
+
<t-button theme="default" shape="square" variant="text" @click="navToHelper">
|
|
31
|
+
<help-circle-icon />
|
|
32
|
+
</t-button>
|
|
33
|
+
</t-tooltip>
|
|
34
|
+
<t-dropdown :min-column-width="125" trigger="click">
|
|
35
|
+
<template #dropdown>
|
|
36
|
+
<t-dropdown-menu>
|
|
37
|
+
<t-dropdown-item class="operations-dropdown-container-item" @click="handleNav('/user/index')">
|
|
38
|
+
<user-circle-icon />个人中心
|
|
39
|
+
</t-dropdown-item>
|
|
40
|
+
<t-dropdown-item class="operations-dropdown-container-item" @click="handleLogout">
|
|
41
|
+
<poweroff-icon />退出登录
|
|
42
|
+
</t-dropdown-item>
|
|
43
|
+
</t-dropdown-menu>
|
|
44
|
+
</template>
|
|
45
|
+
<t-button class="header-user-btn" theme="default" variant="text">
|
|
46
|
+
<template #icon>
|
|
47
|
+
<user-circle-icon class="header-user-avatar" />
|
|
48
|
+
</template>
|
|
49
|
+
<div class="header-user-account">Tencent</div>
|
|
50
|
+
<template #suffix>
|
|
51
|
+
<chevron-down-icon />
|
|
52
|
+
</template>
|
|
53
|
+
</t-button>
|
|
54
|
+
</t-dropdown>
|
|
55
|
+
<t-tooltip placement="bottom" content="系统设置">
|
|
56
|
+
<t-button theme="default" shape="square" variant="text" @click="toggleSettingPanel">
|
|
57
|
+
<setting-icon />
|
|
58
|
+
</t-button>
|
|
59
|
+
</t-tooltip>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
</t-head-menu>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
import Vue from 'vue';
|
|
68
|
+
import {
|
|
69
|
+
ViewListIcon,
|
|
70
|
+
LogoGithubIcon,
|
|
71
|
+
HelpCircleIcon,
|
|
72
|
+
UserCircleIcon,
|
|
73
|
+
PoweroffIcon,
|
|
74
|
+
SettingIcon,
|
|
75
|
+
ChevronDownIcon,
|
|
76
|
+
} from 'tdesign-icons-vue';
|
|
77
|
+
import { prefix } from '@/config/global';
|
|
78
|
+
import LogoFull from '@/assets/assets-logo-full.svg';
|
|
79
|
+
|
|
80
|
+
import Notice from './Notice.vue';
|
|
81
|
+
import Search from './Search.vue';
|
|
82
|
+
import MenuContent from './MenuContent.vue';
|
|
83
|
+
|
|
84
|
+
export default Vue.extend({
|
|
85
|
+
components: {
|
|
86
|
+
MenuContent,
|
|
87
|
+
LogoFull,
|
|
88
|
+
Notice,
|
|
89
|
+
Search,
|
|
90
|
+
ViewListIcon,
|
|
91
|
+
LogoGithubIcon,
|
|
92
|
+
HelpCircleIcon,
|
|
93
|
+
UserCircleIcon,
|
|
94
|
+
PoweroffIcon,
|
|
95
|
+
SettingIcon,
|
|
96
|
+
ChevronDownIcon,
|
|
97
|
+
},
|
|
98
|
+
props: {
|
|
99
|
+
theme: String,
|
|
100
|
+
layout: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: 'top',
|
|
103
|
+
},
|
|
104
|
+
showLogo: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: true,
|
|
107
|
+
},
|
|
108
|
+
menu: {
|
|
109
|
+
type: Array,
|
|
110
|
+
},
|
|
111
|
+
isFixed: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false,
|
|
114
|
+
},
|
|
115
|
+
isCompact: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: false,
|
|
118
|
+
},
|
|
119
|
+
maxLevel: {
|
|
120
|
+
type: Number,
|
|
121
|
+
default: 3,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
data() {
|
|
125
|
+
return {
|
|
126
|
+
prefix,
|
|
127
|
+
visibleNotice: false,
|
|
128
|
+
isSearchFocus: false,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
computed: {
|
|
132
|
+
active() {
|
|
133
|
+
if (!this.$route.path) {
|
|
134
|
+
return '';
|
|
135
|
+
}
|
|
136
|
+
return this.$route.path
|
|
137
|
+
.split('/')
|
|
138
|
+
.filter((item, index) => index <= this.maxLevel && index > 0)
|
|
139
|
+
.map((item) => `/${item}`)
|
|
140
|
+
.join('');
|
|
141
|
+
},
|
|
142
|
+
showMenu() {
|
|
143
|
+
return !(this.layout === 'mix' && this.showLogo === 'side');
|
|
144
|
+
},
|
|
145
|
+
layoutCls() {
|
|
146
|
+
return [`${this.prefix}-header-layout`];
|
|
147
|
+
},
|
|
148
|
+
menuCls() {
|
|
149
|
+
return [
|
|
150
|
+
{
|
|
151
|
+
[`${this.prefix}-header-menu`]: !this.isFixed,
|
|
152
|
+
[`${this.prefix}-header-menu-fixed`]: this.isFixed,
|
|
153
|
+
[`${this.prefix}-header-menu-fixed-side`]: this.layout === 'side' && this.isFixed,
|
|
154
|
+
[`${this.prefix}-header-menu-fixed-side-compact`]: this.layout === 'side' && this.isFixed && this.isCompact,
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
methods: {
|
|
160
|
+
toggleSettingPanel() {
|
|
161
|
+
this.$store.commit('setting/toggleSettingPanel', true);
|
|
162
|
+
},
|
|
163
|
+
handleLogout() {
|
|
164
|
+
this.$router.push(`/login?redirect=${this.$router.history.current.fullPath}`);
|
|
165
|
+
},
|
|
166
|
+
changeCollapsed() {
|
|
167
|
+
this.$store.commit('setting/toggleSidebarCompact');
|
|
168
|
+
},
|
|
169
|
+
handleNav(url) {
|
|
170
|
+
this.$router.push(url);
|
|
171
|
+
},
|
|
172
|
+
navToGitHub() {
|
|
173
|
+
window.open('https://github.com/Tencent/tdesign-vue-starter');
|
|
174
|
+
},
|
|
175
|
+
navToHelper() {
|
|
176
|
+
window.open('http://tdesign.tencent.com/starter/docs/get-started');
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
</script>
|
|
181
|
+
<style lang="less">
|
|
182
|
+
@import '@/style/variables.less';
|
|
183
|
+
|
|
184
|
+
.header-menu {
|
|
185
|
+
flex: 1 1 1;
|
|
186
|
+
display: inline-flex;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.operations-container {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
margin-right: 12px;
|
|
193
|
+
|
|
194
|
+
.t-popup__reference {
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
justify-content: center;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.t-button {
|
|
201
|
+
margin: 0 8px;
|
|
202
|
+
|
|
203
|
+
&.header-user-btn {
|
|
204
|
+
margin: 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.t-icon {
|
|
209
|
+
font-size: 20px;
|
|
210
|
+
|
|
211
|
+
&.general {
|
|
212
|
+
margin-right: 16px;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.header-operate-left {
|
|
218
|
+
display: flex;
|
|
219
|
+
margin-left: 20px;
|
|
220
|
+
align-items: normal;
|
|
221
|
+
line-height: 0;
|
|
222
|
+
|
|
223
|
+
.collapsed-icon {
|
|
224
|
+
font-size: 20px;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.header-logo-container {
|
|
229
|
+
width: 184px;
|
|
230
|
+
height: 26px;
|
|
231
|
+
display: flex;
|
|
232
|
+
margin-left: 24px;
|
|
233
|
+
color: var(--td-text-color-primary);
|
|
234
|
+
|
|
235
|
+
.t-logo {
|
|
236
|
+
width: 100%;
|
|
237
|
+
height: 100%;
|
|
238
|
+
|
|
239
|
+
&:hover {
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&:hover {
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.header-user-account {
|
|
250
|
+
display: inline-flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
color: var(--td-text-color-primary);
|
|
253
|
+
|
|
254
|
+
.t-icon {
|
|
255
|
+
margin-left: 4px;
|
|
256
|
+
font-size: 16px;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.t-head-menu__inner {
|
|
261
|
+
border-bottom: 1px solid var(--td-border-level-1-color);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.t-menu--light {
|
|
265
|
+
.header-user-account {
|
|
266
|
+
color: var(--td-text-color-primary);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.t-menu--dark {
|
|
271
|
+
.t-head-menu__inner {
|
|
272
|
+
border-bottom: 1px solid var(--td-gray-color-10);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.header-user-account {
|
|
276
|
+
color: rgba(255, 255, 255, 0.55);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.t-button {
|
|
280
|
+
--ripple-color: var(--td-gray-color-10) !important;
|
|
281
|
+
|
|
282
|
+
&:hover {
|
|
283
|
+
background: var(--td-gray-color-12) !important;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.operations-dropdown-container-item {
|
|
289
|
+
width: 100%;
|
|
290
|
+
display: flex;
|
|
291
|
+
align-items: center;
|
|
292
|
+
|
|
293
|
+
.t-icon {
|
|
294
|
+
margin-right: 8px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.t-dropdown__item {
|
|
298
|
+
.t-dropdown__item__content {
|
|
299
|
+
display: flex;
|
|
300
|
+
justify-content: center;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.t-dropdown__item__content__text {
|
|
304
|
+
display: flex;
|
|
305
|
+
align-items: center;
|
|
306
|
+
font-size: 14px;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.t-dropdown__item {
|
|
311
|
+
width: 100%;
|
|
312
|
+
margin-bottom: 0px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&:last-child {
|
|
316
|
+
.t-dropdown__item {
|
|
317
|
+
margin-bottom: 8px;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
</style>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<t-layout :class="[`${prefix}-layout`]">
|
|
3
|
+
<t-tabs
|
|
4
|
+
v-if="isUseTabsRouter"
|
|
5
|
+
theme="card"
|
|
6
|
+
:class="`${prefix}-layout-tabs-nav`"
|
|
7
|
+
:value="$route.path"
|
|
8
|
+
@change="handleChangeCurrentTab"
|
|
9
|
+
:style="{ position: 'sticky', top: 0, width: '100%' }"
|
|
10
|
+
>
|
|
11
|
+
<t-tab-panel
|
|
12
|
+
v-for="(route, idx) in tabRouterList"
|
|
13
|
+
:value="route.path"
|
|
14
|
+
:key="`${route.path}_${idx}`"
|
|
15
|
+
:removable="!route.isHome"
|
|
16
|
+
@remove="() => handleRemove(route.path, idx)"
|
|
17
|
+
>
|
|
18
|
+
<template #label>
|
|
19
|
+
<t-dropdown
|
|
20
|
+
trigger="context-menu"
|
|
21
|
+
:minColumnWidth="128"
|
|
22
|
+
:popupProps="{
|
|
23
|
+
overlayClassName: 'route-tabs-dropdown',
|
|
24
|
+
onVisibleChange: (visible, ctx) => handleTabMenuClick(visible, ctx, route.path),
|
|
25
|
+
visible: activeTabPath === route.path,
|
|
26
|
+
}"
|
|
27
|
+
>
|
|
28
|
+
<template v-if="!route.isHome">
|
|
29
|
+
{{ route.title }}
|
|
30
|
+
</template>
|
|
31
|
+
<home-icon v-else />
|
|
32
|
+
<template #dropdown>
|
|
33
|
+
<t-dropdown-menu>
|
|
34
|
+
<t-dropdown-item @click="() => handleRefresh(route.path, idx)">
|
|
35
|
+
<refresh-icon />
|
|
36
|
+
刷新
|
|
37
|
+
</t-dropdown-item>
|
|
38
|
+
<t-dropdown-item v-if="idx > 0" @click="() => handleCloseAhead(route.path, idx)">
|
|
39
|
+
<arrow-left-icon />
|
|
40
|
+
关闭左侧
|
|
41
|
+
</t-dropdown-item>
|
|
42
|
+
<t-dropdown-item
|
|
43
|
+
v-if="idx < tabRouterList.length - 1"
|
|
44
|
+
@click="() => handleCloseBehind(route.path, idx)"
|
|
45
|
+
>
|
|
46
|
+
<arrow-right-icon />
|
|
47
|
+
关闭右侧
|
|
48
|
+
</t-dropdown-item>
|
|
49
|
+
<t-dropdown-item @click="() => handleCloseOther(route.path, idx)">
|
|
50
|
+
<close-circle-icon />
|
|
51
|
+
关闭其它
|
|
52
|
+
</t-dropdown-item>
|
|
53
|
+
</t-dropdown-menu>
|
|
54
|
+
</template>
|
|
55
|
+
</t-dropdown>
|
|
56
|
+
</template>
|
|
57
|
+
</t-tab-panel>
|
|
58
|
+
</t-tabs>
|
|
59
|
+
<t-content :class="`${prefix}-content-layout`">
|
|
60
|
+
<layout-breadcrumb v-if="setting.showBreadcrumb" />
|
|
61
|
+
<common-content />
|
|
62
|
+
</t-content>
|
|
63
|
+
<t-footer v-if="showFooter" :class="`${prefix}-footer-layout`">
|
|
64
|
+
<layout-footer />
|
|
65
|
+
</t-footer>
|
|
66
|
+
</t-layout>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script lang="ts">
|
|
70
|
+
import Vue from 'vue';
|
|
71
|
+
import { mapGetters } from 'vuex';
|
|
72
|
+
import { RefreshIcon, ArrowLeftIcon, ArrowRightIcon, HomeIcon, CloseCircleIcon } from 'tdesign-icons-vue';
|
|
73
|
+
|
|
74
|
+
import CommonContent from './Content.vue';
|
|
75
|
+
import LayoutBreadcrumb from './Breadcrumb.vue';
|
|
76
|
+
import LayoutFooter from './Footer.vue';
|
|
77
|
+
|
|
78
|
+
import { prefix } from '@/config/global';
|
|
79
|
+
import { SettingType } from '@/interface';
|
|
80
|
+
|
|
81
|
+
export default Vue.extend({
|
|
82
|
+
name: 'LayoutContent',
|
|
83
|
+
components: {
|
|
84
|
+
CommonContent,
|
|
85
|
+
LayoutFooter,
|
|
86
|
+
LayoutBreadcrumb,
|
|
87
|
+
RefreshIcon,
|
|
88
|
+
ArrowLeftIcon,
|
|
89
|
+
ArrowRightIcon,
|
|
90
|
+
HomeIcon,
|
|
91
|
+
CloseCircleIcon,
|
|
92
|
+
},
|
|
93
|
+
data() {
|
|
94
|
+
return {
|
|
95
|
+
prefix,
|
|
96
|
+
activeTabPath: '',
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
computed: {
|
|
100
|
+
...mapGetters({
|
|
101
|
+
showFooter: 'setting/showFooter',
|
|
102
|
+
mode: 'setting/mode',
|
|
103
|
+
isUseTabsRouter: 'setting/isUseTabsRouter',
|
|
104
|
+
menuRouters: 'permission/routers',
|
|
105
|
+
tabRouterList: 'tabRouter/tabRouterList',
|
|
106
|
+
}),
|
|
107
|
+
setting(): SettingType {
|
|
108
|
+
return this.$store.state.setting;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
handleRemove(path: string, routeIdx: number) {
|
|
113
|
+
const nextRouter = this.tabRouterList[routeIdx + 1] || this.tabRouterList[routeIdx - 1];
|
|
114
|
+
|
|
115
|
+
this.$store.commit('tabRouter/subtractCurrentTabRouter', { path, routeIdx });
|
|
116
|
+
if (path === this.$router.history?.current?.path) {
|
|
117
|
+
this.$router.push(nextRouter.path);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
handleChangeCurrentTab(path: string) {
|
|
121
|
+
this.$router.push(path);
|
|
122
|
+
},
|
|
123
|
+
handleRefresh(currentPath: string, routeIdx: number) {
|
|
124
|
+
this.$store.commit('tabRouter/toggleTabRouterAlive', routeIdx);
|
|
125
|
+
this.$nextTick(() => {
|
|
126
|
+
this.$store.commit('tabRouter/toggleTabRouterAlive', routeIdx);
|
|
127
|
+
this.$router.replace({ path: currentPath });
|
|
128
|
+
});
|
|
129
|
+
this.activeTabPath = null;
|
|
130
|
+
},
|
|
131
|
+
handleCloseAhead(path: string, routeIdx: number) {
|
|
132
|
+
this.$store.commit('tabRouter/subtractTabRouterAhead', { path, routeIdx });
|
|
133
|
+
this.handleOperationEffect('ahead', routeIdx);
|
|
134
|
+
},
|
|
135
|
+
handleCloseBehind(path: string, routeIdx: number) {
|
|
136
|
+
this.$store.commit('tabRouter/subtractTabRouterBehind', { path, routeIdx });
|
|
137
|
+
this.handleOperationEffect('behind', routeIdx);
|
|
138
|
+
},
|
|
139
|
+
handleCloseOther(path: string, routeIdx: number) {
|
|
140
|
+
this.$store.commit('tabRouter/subtractTabRouterOther', { path, routeIdx });
|
|
141
|
+
this.handleOperationEffect('other', routeIdx);
|
|
142
|
+
},
|
|
143
|
+
handleOperationEffect(type: 'other' | 'ahead' | 'behind', routeIndex: number) {
|
|
144
|
+
const currentPath = this.$router.history?.current?.path;
|
|
145
|
+
const tabRouters = this.tabRouterList;
|
|
146
|
+
const currentIdx = tabRouters.findIndex((i: { path: string }) => i.path === currentPath);
|
|
147
|
+
// 存在三种情况需要刷新当前路由
|
|
148
|
+
// 点击非当前路由的关闭其他、点击非当前路由的关闭左侧且当前路由小于触发路由、点击非当前路由的关闭右侧且当前路由大于触发路由
|
|
149
|
+
const needRefreshRouter =
|
|
150
|
+
(type === 'other' && currentIdx !== routeIndex) ||
|
|
151
|
+
(type === 'ahead' && currentIdx < routeIndex) ||
|
|
152
|
+
(type === 'behind' && currentIdx === -1);
|
|
153
|
+
if (needRefreshRouter) {
|
|
154
|
+
const nextRouteIdx = type === 'behind' ? tabRouters.length - 1 : 1;
|
|
155
|
+
const nextRouter = this.tabRouterList[nextRouteIdx];
|
|
156
|
+
|
|
157
|
+
this.$router.push(nextRouter.path);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.activeTabPath = null;
|
|
161
|
+
},
|
|
162
|
+
handleTabMenuClick(visible: boolean, ctx, path: string) {
|
|
163
|
+
if (ctx?.trigger === 'document') this.activeTabPath = null;
|
|
164
|
+
if (visible) this.activeTabPath = path;
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<common-header
|
|
3
|
+
v-if="showHeader"
|
|
4
|
+
:showLogo="showHeaderLogo"
|
|
5
|
+
:theme="mode"
|
|
6
|
+
:layout="setting.layout"
|
|
7
|
+
:isFixed="setting.isHeaderFixed"
|
|
8
|
+
:menu="headerMenu"
|
|
9
|
+
:isCompact="setting.isSidebarCompact"
|
|
10
|
+
:maxLevel="setting.splitMenu ? 1 : 3"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import Vue from 'vue';
|
|
16
|
+
import { mapGetters } from 'vuex';
|
|
17
|
+
import CommonHeader from './Header.vue';
|
|
18
|
+
|
|
19
|
+
import { SettingType } from '@/interface';
|
|
20
|
+
|
|
21
|
+
export default Vue.extend({
|
|
22
|
+
name: 'LayoutHeader',
|
|
23
|
+
components: {
|
|
24
|
+
CommonHeader,
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
...mapGetters({
|
|
28
|
+
showHeader: 'setting/showHeader',
|
|
29
|
+
showHeaderLogo: 'setting/showHeaderLogo',
|
|
30
|
+
mode: 'setting/mode',
|
|
31
|
+
menuRouters: 'permission/routers',
|
|
32
|
+
}),
|
|
33
|
+
setting(): SettingType {
|
|
34
|
+
return this.$store.state.setting;
|
|
35
|
+
},
|
|
36
|
+
headerMenu() {
|
|
37
|
+
const { layout, splitMenu } = this.$store.state.setting;
|
|
38
|
+
const { menuRouters } = this;
|
|
39
|
+
if (layout === 'mix') {
|
|
40
|
+
if (splitMenu) {
|
|
41
|
+
return menuRouters.map((menu) => ({
|
|
42
|
+
...menu,
|
|
43
|
+
children: [],
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
return menuRouters;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<side-nav
|
|
3
|
+
v-if="showSidebar"
|
|
4
|
+
:showLogo="showSidebarLogo"
|
|
5
|
+
:layout="setting.layout"
|
|
6
|
+
:isFixed="setting.isSidebarFixed"
|
|
7
|
+
:menu="sideMenu"
|
|
8
|
+
:theme="mode"
|
|
9
|
+
:isCompact="setting.isSidebarCompact"
|
|
10
|
+
:maxLevel="setting.splitMenu ? 2 : 3"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import Vue from 'vue';
|
|
16
|
+
import { mapGetters } from 'vuex';
|
|
17
|
+
import SideNav from './SideNav.vue';
|
|
18
|
+
|
|
19
|
+
import { SettingType } from '@/interface';
|
|
20
|
+
|
|
21
|
+
export default Vue.extend({
|
|
22
|
+
name: 'LayoutSidebar',
|
|
23
|
+
components: {
|
|
24
|
+
SideNav,
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
...mapGetters({
|
|
28
|
+
showSidebar: 'setting/showSidebar',
|
|
29
|
+
showSidebarLogo: 'setting/showSidebarLogo',
|
|
30
|
+
mode: 'setting/mode',
|
|
31
|
+
menuRouters: 'permission/routers',
|
|
32
|
+
}),
|
|
33
|
+
setting(): SettingType {
|
|
34
|
+
return this.$store.state.setting;
|
|
35
|
+
},
|
|
36
|
+
sideMenu() {
|
|
37
|
+
const { layout, splitMenu } = this.$store.state.setting;
|
|
38
|
+
let { menuRouters } = this;
|
|
39
|
+
if (layout === 'mix' && splitMenu) {
|
|
40
|
+
menuRouters.forEach((menu) => {
|
|
41
|
+
if (this.$route.path.indexOf(menu.path) === 0) {
|
|
42
|
+
menuRouters = menu.children.map((subMenu) => ({ ...subMenu, path: `${menu.path}/${subMenu.path}` }));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return menuRouters;
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
<style lang="less" scoped></style>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<template v-for="item in list">
|
|
4
|
+
<template v-if="!item.children || !item.children.length || item.meta?.single">
|
|
5
|
+
<t-menu-item
|
|
6
|
+
v-if="getHref(item)"
|
|
7
|
+
:key="`href${item.path}`"
|
|
8
|
+
:href="getHref(item)?.[0]"
|
|
9
|
+
:name="item.path"
|
|
10
|
+
:value="item.meta?.single ? item.redirect : item.path"
|
|
11
|
+
>
|
|
12
|
+
<template #icon>
|
|
13
|
+
<t-icon v-if="typeof item.icon === 'string' && item.icon" :name="item.icon" />
|
|
14
|
+
<renderFnIcon :item="item" />
|
|
15
|
+
</template>
|
|
16
|
+
{{ item.title }}
|
|
17
|
+
</t-menu-item>
|
|
18
|
+
<t-menu-item
|
|
19
|
+
v-else
|
|
20
|
+
:key="`${item.path}`"
|
|
21
|
+
:to="item.path"
|
|
22
|
+
:name="item.path"
|
|
23
|
+
:value="item.meta?.single ? item.redirect : item.path"
|
|
24
|
+
>
|
|
25
|
+
<template #icon>
|
|
26
|
+
<t-icon v-if="typeof item.icon === 'string' && item.icon" :name="item.icon" />
|
|
27
|
+
<renderFnIcon :item="item" />
|
|
28
|
+
</template>
|
|
29
|
+
{{ item.title }}
|
|
30
|
+
</t-menu-item>
|
|
31
|
+
</template>
|
|
32
|
+
<t-submenu v-else :name="item.path" :value="item.path" :title="item.title" :key="item.path">
|
|
33
|
+
<template #icon>
|
|
34
|
+
<t-icon v-if="typeof item.icon === 'string' && item.icon" :name="item.icon" />
|
|
35
|
+
<renderFnIcon :item="item" />
|
|
36
|
+
</template>
|
|
37
|
+
<menu-content v-if="item.children" :nav-data="item.children" />
|
|
38
|
+
</t-submenu>
|
|
39
|
+
</template>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script lang="ts">
|
|
44
|
+
import Vue, { PropType } from 'vue';
|
|
45
|
+
|
|
46
|
+
import { prefix } from '@/config/global';
|
|
47
|
+
import { MenuRoute } from '@/interface';
|
|
48
|
+
|
|
49
|
+
const getMenuList = (list: MenuRoute[], basePath?: string): MenuRoute[] => {
|
|
50
|
+
if (!list) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return list
|
|
55
|
+
.map((item) => {
|
|
56
|
+
const path = basePath && !item.path.includes(basePath) ? `${basePath}/${item.path}` : item.path;
|
|
57
|
+
return {
|
|
58
|
+
path,
|
|
59
|
+
title: item.meta?.title,
|
|
60
|
+
icon: item.meta?.icon || '',
|
|
61
|
+
children: getMenuList(item.children, path),
|
|
62
|
+
meta: item.meta,
|
|
63
|
+
redirect: item.redirect,
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
.filter((item) => item.meta && item.meta.hidden !== true);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Vue.component('renderFnIcon', {
|
|
70
|
+
props: {
|
|
71
|
+
item: {
|
|
72
|
+
type: Object as PropType<MenuRoute>,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
// 遵循最小改动的原则,这里仍然使用 createElement
|
|
77
|
+
render(createElement) {
|
|
78
|
+
if (typeof this.item.icon === 'function' || (this.item.icon && typeof this.item.icon.render === 'function')) {
|
|
79
|
+
return createElement(this.item.icon, {
|
|
80
|
+
class: 't-icon',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export default Vue.extend({
|
|
88
|
+
name: 'MenuContent',
|
|
89
|
+
props: {
|
|
90
|
+
navData: Array,
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
prefix,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
computed: {
|
|
98
|
+
list(): Array<MenuRoute> {
|
|
99
|
+
return getMenuList(this.navData);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
getHref(item: MenuRoute) {
|
|
104
|
+
return item.path.match(/(http|https):\/\/([\w.]+\/?)\S*/);
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
</script>
|