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,404 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<t-drawer
|
|
4
|
+
size="408px"
|
|
5
|
+
:footer="false"
|
|
6
|
+
:visible.sync="showSettingPanel"
|
|
7
|
+
header="页面配置"
|
|
8
|
+
:closeBtn="true"
|
|
9
|
+
:onCloseBtnClick="handleCloseDrawer"
|
|
10
|
+
class="setting-drawer-container"
|
|
11
|
+
>
|
|
12
|
+
<div class="setting-container">
|
|
13
|
+
<t-form :data="formData" size="large" ref="form" labelAlign="left" @reset="onReset" @submit="onSubmit">
|
|
14
|
+
<div class="setting-group-title">主题模式</div>
|
|
15
|
+
<t-radio-group v-model="formData.mode">
|
|
16
|
+
<div v-for="(item, index) in MODE_OPTIONS" :key="index" class="setting-layout-drawer">
|
|
17
|
+
<div>
|
|
18
|
+
<t-radio-button :key="index" :value="item.type"
|
|
19
|
+
><component :is="getModeIcon(item.type)"
|
|
20
|
+
/></t-radio-button>
|
|
21
|
+
<p :style="{ textAlign: 'center', marginTop: '8px' }">{{ item.text }}</p>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</t-radio-group>
|
|
25
|
+
<div class="setting-group-title">主题色</div>
|
|
26
|
+
<t-radio-group v-model="formData.brandTheme">
|
|
27
|
+
<div v-for="(item, index) in DEFAULT_COLOR_OPTIONS" :key="index" class="setting-layout-drawer">
|
|
28
|
+
<t-radio-button :key="index" :value="item" class="setting-layout-color-group">
|
|
29
|
+
<color-container :value="item" />
|
|
30
|
+
</t-radio-button>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="setting-layout-drawer">
|
|
33
|
+
<t-popup
|
|
34
|
+
destroy-on-close
|
|
35
|
+
expand-animation
|
|
36
|
+
placement="bottom-right"
|
|
37
|
+
trigger="click"
|
|
38
|
+
:visible="isColoPickerDisplay"
|
|
39
|
+
@visible-change="onPopupVisibleChange"
|
|
40
|
+
:overlayStyle="{ padding: 0 }"
|
|
41
|
+
>
|
|
42
|
+
<template #content>
|
|
43
|
+
<t-color-picker-panel
|
|
44
|
+
:on-change="changeColor"
|
|
45
|
+
:color-modes="['monochrome']"
|
|
46
|
+
format="HEX"
|
|
47
|
+
:swatch-colors="[]"
|
|
48
|
+
/></template>
|
|
49
|
+
<t-radio-button :value="dynamicColor" :class="['setting-layout-color-group', 'dynamic-color-btn']">
|
|
50
|
+
<color-container :value="dynamicColor" />
|
|
51
|
+
</t-radio-button>
|
|
52
|
+
</t-popup>
|
|
53
|
+
</div>
|
|
54
|
+
</t-radio-group>
|
|
55
|
+
<div class="setting-group-title">导航布局</div>
|
|
56
|
+
|
|
57
|
+
<t-radio-group v-model="formData.layout">
|
|
58
|
+
<div v-for="(item, index) in LAYOUT_OPTION" :key="index" class="setting-layout-drawer">
|
|
59
|
+
<t-radio-button :key="index" :value="item"><thumbnail :src="getThumbnailUrl(item)" /></t-radio-button>
|
|
60
|
+
</div>
|
|
61
|
+
</t-radio-group>
|
|
62
|
+
|
|
63
|
+
<t-form-item v-show="formData.layout === 'mix'" label="分割菜单(混合模式下有效)" name="splitMenu">
|
|
64
|
+
<t-switch v-model="formData.splitMenu"></t-switch>
|
|
65
|
+
</t-form-item>
|
|
66
|
+
|
|
67
|
+
<t-form-item v-show="formData.layout !== 'side'" label="固定 Header" name="isHeaderFixed">
|
|
68
|
+
<t-switch v-model="formData.isHeaderFixed"></t-switch>
|
|
69
|
+
</t-form-item>
|
|
70
|
+
<t-form-item v-show="formData.layout !== 'top'" label="固定 Sidebar" name="isSidebarFixed">
|
|
71
|
+
<t-switch v-model="formData.isSidebarFixed"></t-switch>
|
|
72
|
+
</t-form-item>
|
|
73
|
+
|
|
74
|
+
<div class="setting-group-title">元素开关</div>
|
|
75
|
+
<t-form-item label="显示 Header" name="showHeader" v-show="formData.layout === 'side'">
|
|
76
|
+
<t-switch v-model="formData.showHeader"></t-switch>
|
|
77
|
+
</t-form-item>
|
|
78
|
+
<t-form-item label="显示 Breadcrumbs" name="showBreadcrumb">
|
|
79
|
+
<t-switch v-model="formData.showBreadcrumb"></t-switch>
|
|
80
|
+
</t-form-item>
|
|
81
|
+
<t-form-item label="显示 Footer" name="showFooter">
|
|
82
|
+
<t-switch v-model="formData.showFooter"></t-switch>
|
|
83
|
+
</t-form-item>
|
|
84
|
+
<t-form-item label="使用 多标签Tab页" name="isUseTabsRouter">
|
|
85
|
+
<t-switch v-model="formData.isUseTabsRouter"></t-switch>
|
|
86
|
+
</t-form-item>
|
|
87
|
+
<t-form-item
|
|
88
|
+
label="footer 内收"
|
|
89
|
+
name="footerPosition"
|
|
90
|
+
v-show="formData.showFooter && !formData.isSidebarFixed"
|
|
91
|
+
>
|
|
92
|
+
<t-switch v-model="formData.isFooterAside"></t-switch>
|
|
93
|
+
</t-form-item>
|
|
94
|
+
</t-form>
|
|
95
|
+
<div class="setting-info">
|
|
96
|
+
<p>请复制后手动修改配置文件: /src/config/style.ts</p>
|
|
97
|
+
<t-button theme="primary" variant="text" @click="handleCopy"> 复制配置项 </t-button>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</t-drawer>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
<script lang="ts">
|
|
104
|
+
import { mapGetters } from 'vuex';
|
|
105
|
+
import { Color } from 'tvision-color';
|
|
106
|
+
import { PopupVisibleChangeContext } from 'tdesign-vue';
|
|
107
|
+
|
|
108
|
+
import STYLE_CONFIG from '@/config/style';
|
|
109
|
+
import { insertThemeStylesheet, generateColorMap } from '@/utils/color';
|
|
110
|
+
import { DEFAULT_COLOR_OPTIONS } from '@/config/color';
|
|
111
|
+
|
|
112
|
+
import Thumbnail from '@/components/thumbnail/index.vue';
|
|
113
|
+
import ColorContainer from '@/components/color/index.vue';
|
|
114
|
+
|
|
115
|
+
import SettingDarkIcon from '@/assets/assets-setting-dark.svg';
|
|
116
|
+
import SettingLightIcon from '@/assets/assets-setting-light.svg';
|
|
117
|
+
import SettingAutoIcon from '@/assets/assets-setting-auto.svg';
|
|
118
|
+
|
|
119
|
+
const LAYOUT_OPTION = ['side', 'top', 'mix'];
|
|
120
|
+
|
|
121
|
+
const MODE_OPTIONS = [
|
|
122
|
+
{ type: 'light', text: '明亮' },
|
|
123
|
+
{ type: 'dark', text: '暗黑' },
|
|
124
|
+
{ type: 'auto', text: '跟随系统' },
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
export default {
|
|
128
|
+
name: 'DefaultLayoutSetting',
|
|
129
|
+
components: { Thumbnail, ColorContainer },
|
|
130
|
+
data() {
|
|
131
|
+
return {
|
|
132
|
+
colors: {
|
|
133
|
+
hex: null,
|
|
134
|
+
},
|
|
135
|
+
MODE_OPTIONS,
|
|
136
|
+
LAYOUT_OPTION,
|
|
137
|
+
DEFAULT_COLOR_OPTIONS,
|
|
138
|
+
visible: false,
|
|
139
|
+
formData: { ...STYLE_CONFIG },
|
|
140
|
+
isColoPickerDisplay: false,
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
computed: {
|
|
144
|
+
...mapGetters('setting', ['showSettingBtn']),
|
|
145
|
+
showSettingPanel: {
|
|
146
|
+
get() {
|
|
147
|
+
return this.$store.state.setting.showSettingPanel;
|
|
148
|
+
},
|
|
149
|
+
set(newVal) {
|
|
150
|
+
this.$store.commit('setting/toggleSettingPanel', newVal);
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
iconName() {
|
|
154
|
+
return this.visible ? 'close' : 'setting';
|
|
155
|
+
},
|
|
156
|
+
showOthers() {
|
|
157
|
+
return (this.formData.showFooter && !this.formData.isSidebarFixed) || !this.formData.splitMenu;
|
|
158
|
+
},
|
|
159
|
+
dynamicColor() {
|
|
160
|
+
const isDynamic = DEFAULT_COLOR_OPTIONS.indexOf(this.formData.brandTheme) === -1;
|
|
161
|
+
return isDynamic ? this.formData.brandTheme : '';
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
watch: {
|
|
165
|
+
formData: {
|
|
166
|
+
handler(newVal) {
|
|
167
|
+
if (!newVal.brandTheme) return;
|
|
168
|
+
// 没有在formData中 需要从store中同步过来
|
|
169
|
+
const { isSidebarCompact } = this.$store.state.setting;
|
|
170
|
+
this.$store.dispatch('setting/changeTheme', { ...newVal, isSidebarCompact });
|
|
171
|
+
},
|
|
172
|
+
deep: true,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
mounted() {
|
|
176
|
+
document.querySelector('.dynamic-color-btn')?.addEventListener('click', () => {
|
|
177
|
+
this.isColoPickerDisplay = true;
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
methods: {
|
|
181
|
+
onPopupVisibleChange(visible: boolean, context: PopupVisibleChangeContext) {
|
|
182
|
+
if (!visible && context.trigger === 'document') this.isColoPickerDisplay = visible;
|
|
183
|
+
},
|
|
184
|
+
onReset(): void {
|
|
185
|
+
this.formData = {
|
|
186
|
+
...STYLE_CONFIG,
|
|
187
|
+
};
|
|
188
|
+
this.$message.success('已恢复初始设置');
|
|
189
|
+
},
|
|
190
|
+
onSubmit({ result, firstError, e }): void {
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
if (result === true) {
|
|
193
|
+
this.visible = false;
|
|
194
|
+
} else {
|
|
195
|
+
this.$message.warning(firstError);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
getModeIcon(mode: string) {
|
|
199
|
+
if (mode === 'light') {
|
|
200
|
+
return SettingLightIcon;
|
|
201
|
+
}
|
|
202
|
+
if (mode === 'dark') {
|
|
203
|
+
return SettingDarkIcon;
|
|
204
|
+
}
|
|
205
|
+
return SettingAutoIcon;
|
|
206
|
+
},
|
|
207
|
+
getThumbnailUrl(name: string) {
|
|
208
|
+
return `https://tdesign.gtimg.com/starter/setting/${name}.png`;
|
|
209
|
+
},
|
|
210
|
+
handleClick(): void {
|
|
211
|
+
this.$store.commit('setting/toggleSettingPanel', true);
|
|
212
|
+
},
|
|
213
|
+
handleCloseDrawer(): void {
|
|
214
|
+
this.$store.commit('setting/toggleSettingPanel', false);
|
|
215
|
+
},
|
|
216
|
+
handleCopy(): void {
|
|
217
|
+
const text = JSON.stringify(this.formData, null, 4);
|
|
218
|
+
this.$copyText(text).then(() => {
|
|
219
|
+
this.$message.closeAll();
|
|
220
|
+
this.$message.success('复制成功');
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
changeColor(hex: string) {
|
|
224
|
+
const { setting } = this.$store.state;
|
|
225
|
+
|
|
226
|
+
const { colors: newPalette, primary: brandColorIndex } = Color.getColorGradations({
|
|
227
|
+
colors: [hex],
|
|
228
|
+
step: 10,
|
|
229
|
+
remainInput: false, // 是否保留输入 不保留会矫正不合适的主题色
|
|
230
|
+
})[0];
|
|
231
|
+
|
|
232
|
+
const { mode } = this.$store.state.setting;
|
|
233
|
+
const colorMap = generateColorMap(hex, newPalette, mode, brandColorIndex);
|
|
234
|
+
this.formData.brandTheme = hex;
|
|
235
|
+
|
|
236
|
+
this.$store.commit('setting/addColor', { [hex]: colorMap });
|
|
237
|
+
this.$store.dispatch('setting/changeTheme', { ...setting, brandTheme: hex });
|
|
238
|
+
|
|
239
|
+
insertThemeStylesheet(hex, colorMap, mode);
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
</script>
|
|
244
|
+
<style lang="less">
|
|
245
|
+
@import '@/style/variables.less';
|
|
246
|
+
|
|
247
|
+
.tdesign-setting {
|
|
248
|
+
z-index: 100;
|
|
249
|
+
position: fixed;
|
|
250
|
+
bottom: 200px;
|
|
251
|
+
right: 0;
|
|
252
|
+
transition: transform 0.3s cubic-bezier(0.7, 0.3, 0.1, 1), visibility 0.3s cubic-bezier(0.7, 0.3, 0.1, 1);
|
|
253
|
+
height: 40px;
|
|
254
|
+
width: 40px;
|
|
255
|
+
border-radius: 20px 0 0 20px;
|
|
256
|
+
transition: all 0.3s;
|
|
257
|
+
|
|
258
|
+
.t-icon {
|
|
259
|
+
margin-left: 8px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.tdesign-setting-text {
|
|
263
|
+
font-size: 12px;
|
|
264
|
+
display: none;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&:hover {
|
|
268
|
+
width: 96px;
|
|
269
|
+
|
|
270
|
+
.tdesign-setting-text {
|
|
271
|
+
display: inline-block;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.setting-layout-color-group {
|
|
277
|
+
display: inline-flex;
|
|
278
|
+
justify-content: center;
|
|
279
|
+
align-items: center;
|
|
280
|
+
border-radius: 50% !important;
|
|
281
|
+
padding: 6px !important;
|
|
282
|
+
border: 2px solid transparent !important;
|
|
283
|
+
|
|
284
|
+
> .t-radio-button__label {
|
|
285
|
+
display: inline-flex;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.tdesign-setting-close {
|
|
290
|
+
position: fixed;
|
|
291
|
+
bottom: 200px;
|
|
292
|
+
right: 300px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.setting-group-title {
|
|
296
|
+
font-size: 14px;
|
|
297
|
+
line-height: 22px;
|
|
298
|
+
margin: 32px 0 24px 0;
|
|
299
|
+
text-align: left;
|
|
300
|
+
font-family: PingFang SC;
|
|
301
|
+
font-style: normal;
|
|
302
|
+
font-weight: 500;
|
|
303
|
+
color: var(--td-text-color-primary);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.setting-group-color {
|
|
307
|
+
position: relative;
|
|
308
|
+
|
|
309
|
+
> div {
|
|
310
|
+
position: absolute;
|
|
311
|
+
z-index: 2;
|
|
312
|
+
right: 0;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.setting-link {
|
|
317
|
+
cursor: pointer;
|
|
318
|
+
color: var(--td-brand-color);
|
|
319
|
+
margin-bottom: 8px;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.setting-info {
|
|
323
|
+
position: absolute;
|
|
324
|
+
padding: 24px;
|
|
325
|
+
bottom: 0;
|
|
326
|
+
left: 0;
|
|
327
|
+
line-height: 20px;
|
|
328
|
+
font-size: 12px;
|
|
329
|
+
text-align: center;
|
|
330
|
+
color: var(--td-text-color-placeholder);
|
|
331
|
+
width: 100%;
|
|
332
|
+
background: var(--td-bg-color-container);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.setting-drawer-container {
|
|
336
|
+
.setting-container {
|
|
337
|
+
padding-bottom: 100px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.t-radio-group.t-size-m {
|
|
341
|
+
min-height: 32px;
|
|
342
|
+
|
|
343
|
+
width: 100%;
|
|
344
|
+
height: auto;
|
|
345
|
+
justify-content: space-between;
|
|
346
|
+
align-items: center;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.setting-layout-drawer {
|
|
350
|
+
display: flex;
|
|
351
|
+
flex-direction: column;
|
|
352
|
+
align-items: center;
|
|
353
|
+
margin-bottom: 16px;
|
|
354
|
+
|
|
355
|
+
.t-radio-button {
|
|
356
|
+
display: inline-flex;
|
|
357
|
+
height: 100%;
|
|
358
|
+
max-height: 78px;
|
|
359
|
+
padding: 8px;
|
|
360
|
+
border-radius: var(--td-radius-default);
|
|
361
|
+
border: 2px solid var(--td-component-border);
|
|
362
|
+
height: auto;
|
|
363
|
+
|
|
364
|
+
> .t-radio-button__label {
|
|
365
|
+
display: inline-flex;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.t-is-checked {
|
|
370
|
+
border: 2px solid var(--td-brand-color) !important;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.t-form__controls-content {
|
|
374
|
+
justify-content: end;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.t-form__controls-content {
|
|
379
|
+
justify-content: end;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.setting-route-theme {
|
|
384
|
+
.t-form__label {
|
|
385
|
+
min-width: 310px !important;
|
|
386
|
+
color: var(--td-text-color-secondary);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.setting-color-theme {
|
|
391
|
+
.setting-layout-drawer {
|
|
392
|
+
.t-radio-button {
|
|
393
|
+
height: 32px;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
&:last-child {
|
|
397
|
+
margin-right: 0;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
.setting-drawer-container .t-radio-group.t-radio-group__outline.t-size-m .t-radio-button {
|
|
402
|
+
height: auto;
|
|
403
|
+
}
|
|
404
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import VueRouter from 'vue-router';
|
|
3
|
+
import { sync } from 'vuex-router-sync';
|
|
4
|
+
import TDesign from 'tdesign-vue';
|
|
5
|
+
import VueClipboard from 'vue-clipboard2';
|
|
6
|
+
import axiosInstance from '@/utils/request';
|
|
7
|
+
import App from './App.vue';
|
|
8
|
+
import router from './router';
|
|
9
|
+
import zhConfig from 'tdesign-vue/es/locale/zh_CN';
|
|
10
|
+
// import enConfig from 'tdesign-vue/es/locale/en_US'; // 英文多语言配置
|
|
11
|
+
|
|
12
|
+
import 'tdesign-vue/es/style/index.css';
|
|
13
|
+
import '@/style/index.less';
|
|
14
|
+
|
|
15
|
+
import './permission';
|
|
16
|
+
import store from './store';
|
|
17
|
+
|
|
18
|
+
Vue.use(VueRouter);
|
|
19
|
+
Vue.use(TDesign);
|
|
20
|
+
Vue.use(VueClipboard);
|
|
21
|
+
|
|
22
|
+
Vue.component('t-page-header');
|
|
23
|
+
|
|
24
|
+
Vue.prototype.$request = axiosInstance;
|
|
25
|
+
|
|
26
|
+
const originPush = VueRouter.prototype.push;
|
|
27
|
+
VueRouter.prototype.push = function push(location) {
|
|
28
|
+
return originPush.call(this, location).catch((err) => err);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const originReplace = VueRouter.prototype.replace;
|
|
32
|
+
VueRouter.prototype.replace = function replace(location) {
|
|
33
|
+
return originReplace.call(this, location).catch((err) => err);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Vue.config.productionTip = false;
|
|
37
|
+
sync(store, router);
|
|
38
|
+
new Vue({
|
|
39
|
+
router,
|
|
40
|
+
store,
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
+
render: (h) => (
|
|
43
|
+
<div>
|
|
44
|
+
{/* 可以通过config-provider提供全局(多语言、全局属性)配置,如
|
|
45
|
+
<t-config-provider globalConfig={enConfig}> */}
|
|
46
|
+
<t-config-provider globalConfig={zhConfig}>
|
|
47
|
+
<App />
|
|
48
|
+
</t-config-provider>
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
}).$mount('#app');
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<t-row :gutter="[16, 16]">
|
|
3
|
+
<t-col :xs="12" :xl="9">
|
|
4
|
+
<t-card title="统计数据" subtitle="(万元)" class="dashboard-chart-card" :bordered="false">
|
|
5
|
+
<template #actions>
|
|
6
|
+
<div class="dashboard-chart-title-container">
|
|
7
|
+
<t-date-range-picker
|
|
8
|
+
class="card-date-picker-container"
|
|
9
|
+
theme="primary"
|
|
10
|
+
mode="date"
|
|
11
|
+
:default-value="LAST_7_DAYS"
|
|
12
|
+
@change="onCurrencyChange"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<div
|
|
17
|
+
id="monitorContainer"
|
|
18
|
+
ref="monitorContainer"
|
|
19
|
+
:style="{ width: '100%', height: `${resizeTime * 326}px` }"
|
|
20
|
+
></div>
|
|
21
|
+
</t-card>
|
|
22
|
+
</t-col>
|
|
23
|
+
<t-col :xs="12" :xl="3">
|
|
24
|
+
<t-card title="销售渠道" :subtitle="currentMonth" class="dashboard-chart-card" :bordered="false">
|
|
25
|
+
<div
|
|
26
|
+
id="countContainer"
|
|
27
|
+
ref="countContainer"
|
|
28
|
+
:style="{ width: `${resizeTime * 326}px`, height: `${resizeTime * 326}px`, margin: '0 auto' }"
|
|
29
|
+
></div>
|
|
30
|
+
</t-card>
|
|
31
|
+
</t-col>
|
|
32
|
+
</t-row>
|
|
33
|
+
</template>
|
|
34
|
+
<script>
|
|
35
|
+
import { TooltipComponent, LegendComponent, GridComponent } from 'echarts/components';
|
|
36
|
+
import { PieChart, LineChart } from 'echarts/charts';
|
|
37
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
38
|
+
import * as echarts from 'echarts/core';
|
|
39
|
+
import { mapState } from 'vuex';
|
|
40
|
+
|
|
41
|
+
import { LAST_7_DAYS } from '@/utils/date';
|
|
42
|
+
|
|
43
|
+
import { getPieChartDataSet, getLineChartDataSet } from '../index';
|
|
44
|
+
import { changeChartsTheme } from '@/utils/color';
|
|
45
|
+
|
|
46
|
+
echarts.use([TooltipComponent, LegendComponent, PieChart, GridComponent, LineChart, CanvasRenderer]);
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
name: 'MiddleChart',
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
LAST_7_DAYS,
|
|
53
|
+
resizeTime: 1,
|
|
54
|
+
currentMonth: this.getThisMonth(),
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
computed: {
|
|
58
|
+
...mapState('setting', ['brandTheme', 'mode']), // 这里需要用到主题色和主题模式的全局配置
|
|
59
|
+
},
|
|
60
|
+
watch: {
|
|
61
|
+
brandTheme() {
|
|
62
|
+
changeChartsTheme([this.countChart, this.monitorChart]);
|
|
63
|
+
},
|
|
64
|
+
mode() {
|
|
65
|
+
[this.countChart, this.monitorChart].forEach((item) => {
|
|
66
|
+
item.dispose();
|
|
67
|
+
});
|
|
68
|
+
this.renderCharts();
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
mounted() {
|
|
72
|
+
this.$nextTick(() => {
|
|
73
|
+
this.updateContainer();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
window.addEventListener('resize', this.updateContainer, false);
|
|
77
|
+
this.renderCharts();
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
methods: {
|
|
81
|
+
/** 获取当前选中时间的短时间表达法 */
|
|
82
|
+
getThisMonth(checkedValues = '') {
|
|
83
|
+
let date;
|
|
84
|
+
if (!checkedValues || checkedValues.length === 0) {
|
|
85
|
+
date = new Date();
|
|
86
|
+
return `${date.getFullYear()}-${date.getMonth() + 1}`;
|
|
87
|
+
}
|
|
88
|
+
date = new Date(checkedValues[0]);
|
|
89
|
+
const date2 = new Date(checkedValues[1]);
|
|
90
|
+
const startMonth = date.getMonth() + 1 > 9 ? date.getMonth() + 1 : `0${date.getMonth() + 1}`;
|
|
91
|
+
const endMonth = date2.getMonth() + 1 > 9 ? date2.getMonth() + 1 : `0${date2.getMonth() + 1}`;
|
|
92
|
+
|
|
93
|
+
return `${date.getFullYear()}-${startMonth} 至 ${date2.getFullYear()}-${endMonth}`;
|
|
94
|
+
},
|
|
95
|
+
/** 资金走趋选择 */
|
|
96
|
+
onCurrencyChange(checkedValues) {
|
|
97
|
+
const { chartColors } = this.$store.state.setting;
|
|
98
|
+
|
|
99
|
+
this.currentMonth = this.getThisMonth(checkedValues);
|
|
100
|
+
this.monitorChart.setOption(getLineChartDataSet({ dateTime: checkedValues, ...chartColors }));
|
|
101
|
+
},
|
|
102
|
+
updateContainer() {
|
|
103
|
+
if (document.documentElement.clientWidth >= 1400 && document.documentElement.clientWidth < 1920) {
|
|
104
|
+
this.resizeTime = (document.documentElement.clientWidth / 2080).toFixed(2);
|
|
105
|
+
} else if (document.documentElement.clientWidth < 1080) {
|
|
106
|
+
this.resizeTime = (document.documentElement.clientWidth / 1080).toFixed(2);
|
|
107
|
+
} else {
|
|
108
|
+
this.resizeTime = 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this.countChart.resize({
|
|
112
|
+
// 根据父容器的大小设置大小
|
|
113
|
+
width: `${this.resizeTime * 326}px`,
|
|
114
|
+
height: `${this.resizeTime * 326}px`,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
this.monitorChart.resize({
|
|
118
|
+
// 根据父容器的大小设置大小
|
|
119
|
+
width: this.monitorContainer.clientWidth,
|
|
120
|
+
height: `${this.resizeTime * 326}px`,
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
renderCharts() {
|
|
124
|
+
const { chartColors } = this.$store.state.setting;
|
|
125
|
+
|
|
126
|
+
// 资金走势
|
|
127
|
+
if (!this.monitorContainer) {
|
|
128
|
+
this.monitorContainer = document.getElementById('monitorContainer');
|
|
129
|
+
}
|
|
130
|
+
this.monitorChart = echarts.init(this.monitorContainer);
|
|
131
|
+
this.monitorChart.setOption(getLineChartDataSet({ ...chartColors }));
|
|
132
|
+
|
|
133
|
+
// 销售合同占比
|
|
134
|
+
if (!this.countContainer) {
|
|
135
|
+
this.countContainer = document.getElementById('countContainer');
|
|
136
|
+
}
|
|
137
|
+
this.countChart = echarts.init(this.countContainer);
|
|
138
|
+
|
|
139
|
+
const option = getPieChartDataSet(chartColors);
|
|
140
|
+
this.countChart.setOption(option);
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
145
|
+
<style lang="less" scoped>
|
|
146
|
+
.dashboard-chart-card {
|
|
147
|
+
padding: 8px;
|
|
148
|
+
|
|
149
|
+
/deep/ .t-card__header {
|
|
150
|
+
padding-bottom: 24px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/deep/ .t-card__title {
|
|
154
|
+
font-size: 20px;
|
|
155
|
+
font-weight: 500;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
</style>
|