Merge branch 'develop' of github.com:Tencent/tdesign-vue-next-starter

This commit is contained in:
Uyarn 2023-04-13 16:11:14 +08:00
commit fa1746b2bb
70 changed files with 273 additions and 216 deletions

View File

@ -17,7 +17,7 @@
"defineProps": "readonly", "defineProps": "readonly",
"defineEmits": "readonly" "defineEmits": "readonly"
}, },
"plugins": ["vue", "@typescript-eslint"], "plugins": ["vue", "@typescript-eslint", "simple-import-sort"],
"parserOptions": { "parserOptions": {
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"sourceType": "module", "sourceType": "module",
@ -65,7 +65,9 @@
"@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off", "@typescript-eslint/ban-types": "off",
"class-methods-use-this": "off" // 因为AxiosCancel必须实例化而能静态化所以加的规则如果有办法解决可以取消 "class-methods-use-this": "off", // 因为AxiosCancel必须实例化而能静态化所以加的规则如果有办法解决可以取消
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
}, },
"overrides": [ "overrides": [
{ {

View File

@ -1,5 +1,5 @@
import { MockMethod } from 'vite-plugin-mock';
import Mock from 'mockjs'; import Mock from 'mockjs';
import { MockMethod } from 'vite-plugin-mock';
export default [ export default [
{ {
@ -221,6 +221,7 @@ export default [
component: '/form/step/index', component: '/form/step/index',
meta: { meta: {
title: '分步表单页', title: '分步表单页',
keepAlive: false,
}, },
}, },
], ],

View File

@ -1,6 +1,6 @@
{ {
"name": "tdesign-vue-next-starter", "name": "tdesign-vue-next-starter",
"version": "0.7.3", "version": "0.7.4",
"scripts": { "scripts": {
"dev:mock": "vite --open --mode mock", "dev:mock": "vite --open --mode mock",
"dev": "vite --open --mode development", "dev": "vite --open --mode development",
@ -19,20 +19,19 @@
"test:coverage": "echo \"no test:coverage specified,work in process\"" "test:coverage": "echo \"no test:coverage specified,work in process\""
}, },
"dependencies": { "dependencies": {
"@types/nprogress": "^0.2.0", "axios": "^1.3.4",
"axios": "^1.2.6",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"echarts": "5.1.2", "echarts": "5.1.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.0.28", "pinia": "^2.0.33",
"pinia-plugin-persistedstate": "^3.0.2", "pinia-plugin-persistedstate": "^3.1.0",
"qrcode.vue": "^3.3.3", "qrcode.vue": "^3.3.4",
"qs": "^6.11.0", "qs": "^6.11.1",
"tdesign-icons-vue-next": "^0.1.7", "tdesign-icons-vue-next": "^0.1.8",
"tdesign-vue-next": "^1.0.8", "tdesign-vue-next": "^1.2.2",
"tvision-color": "^1.5.0", "tvision-color": "^1.5.0",
"vue": "^3.2.45", "vue": "^3.2.47",
"vue-clipboard3": "^2.0.0", "vue-clipboard3": "^2.0.0",
"vue-router": "~4.1.6" "vue-router": "~4.1.6"
}, },
@ -41,13 +40,13 @@
"@commitlint/config-conventional": "^17.3.0", "@commitlint/config-conventional": "^17.3.0",
"@types/echarts": "^4.9.16", "@types/echarts": "^4.9.16",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/nprogress": "^0.2.0",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.47.1", "@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1", "@typescript-eslint/parser": "^5.47.1",
"@vitejs/plugin-vue": "^3.2.0", "@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^1.1.7", "@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/compiler-sfc": "^3.2.45", "@vue/compiler-sfc": "^3.2.47",
"@vue/eslint-config-typescript": "^11.0.2", "@vue/eslint-config-typescript": "^11.0.2",
"commitizen": "^4.2.4", "commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0", "cz-conventional-changelog": "^3.3.0",
@ -56,6 +55,7 @@
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-vue": "^9.8.0", "eslint-plugin-vue": "^9.8.0",
"eslint-plugin-vue-scoped-css": "^2.2.0", "eslint-plugin-vue-scoped-css": "^2.2.0",
"husky": "^8.0.2", "husky": "^8.0.2",
@ -69,11 +69,11 @@
"stylelint-config-prettier": "~9.0.4", "stylelint-config-prettier": "~9.0.4",
"stylelint-less": "1.0.6", "stylelint-less": "1.0.6",
"stylelint-order": "~6.0.1", "stylelint-order": "~6.0.1",
"typescript": "~4.9.4", "typescript": "~4.9.5",
"vite": "^3.0.3", "vite": "^3.2.5",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-svg-loader": "^4.0.0", "vite-svg-loader": "^4.0.0",
"vue-tsc": "^1.0.19" "vue-tsc": "^1.2.0"
}, },
"config": { "config": {
"commitizen": { "commitizen": {

View File

@ -3,6 +3,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import { computed } from 'vue';
import { useSettingStore } from '@/store'; import { useSettingStore } from '@/store';
const store = useSettingStore(); const store = useSettingStore();

View File

@ -1,5 +1,5 @@
import { request } from '@/utils/request';
import type { ProjectListResult, PurchaseListResult } from '@/api/model/detailModel'; import type { ProjectListResult, PurchaseListResult } from '@/api/model/detailModel';
import { request } from '@/utils/request';
const Api = { const Api = {
PurchaseList: '/get-purchase-list', PurchaseList: '/get-purchase-list',

View File

@ -1,5 +1,5 @@
import { request } from '@/utils/request';
import type { CardListResult, ListResult } from '@/api/model/listModel'; import type { CardListResult, ListResult } from '@/api/model/listModel';
import { request } from '@/utils/request';
const Api = { const Api = {
BaseList: '/get-list', BaseList: '/get-list',

View File

@ -26,4 +26,7 @@ export interface RouteMeta {
hidden?: boolean; hidden?: boolean;
hiddenBreadcrumb?: boolean; hiddenBreadcrumb?: boolean;
single?: boolean; single?: boolean;
keepAlive?: boolean;
frameSrc?: string;
frameBlank?: boolean;
} }

View File

@ -1,5 +1,5 @@
import { request } from '@/utils/request';
import type { MenuListResult } from '@/api/model/permissionModel'; import type { MenuListResult } from '@/api/model/permissionModel';
import { request } from '@/utils/request';
const Api = { const Api = {
MenuList: '/get-menu-list', MenuList: '/get-menu-list',

View File

@ -3,6 +3,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import { computed } from 'vue';
import { DEFAULT_COLOR_OPTIONS } from '@/config/color'; import { DEFAULT_COLOR_OPTIONS } from '@/config/color';
const panelColor = const panelColor =

View File

@ -55,16 +55,16 @@
</t-card> </t-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { PropType } from 'vue';
import { import {
ShopIcon, AddIcon,
CalendarIcon, CalendarIcon,
ServiceIcon,
UserAvatarIcon,
LaptopIcon, LaptopIcon,
MoreIcon, MoreIcon,
AddIcon, ServiceIcon,
ShopIcon,
UserAvatarIcon,
} from 'tdesign-icons-vue-next'; } from 'tdesign-icons-vue-next';
import type { PropType } from 'vue';
export interface CardProductType { export interface CardProductType {
type: number; type: number;

View File

@ -10,12 +10,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import { computed } from 'vue';
import Result403Icon from '@/assets/assets-result-403.svg?component'; import Result403Icon from '@/assets/assets-result-403.svg?component';
import Result404Icon from '@/assets/assets-result-404.svg?component'; import Result404Icon from '@/assets/assets-result-404.svg?component';
import Result500Icon from '@/assets/assets-result-500.svg?component'; import Result500Icon from '@/assets/assets-result-500.svg?component';
import ResultIeIcon from '@/assets/assets-result-ie.svg?component'; import ResultIeIcon from '@/assets/assets-result-ie.svg?component';
import ResultWifiIcon from '@/assets/assets-result-wifi.svg?component';
import ResultMaintenanceIcon from '@/assets/assets-result-maintenance.svg?component'; import ResultMaintenanceIcon from '@/assets/assets-result-maintenance.svg?component';
import ResultWifiIcon from '@/assets/assets-result-wifi.svg?component';
const props = defineProps({ const props = defineProps({
bgUrl: String, bgUrl: String,

View File

@ -1,5 +1,5 @@
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import { onUnmounted, onMounted } from 'vue'; import { onMounted, onUnmounted } from 'vue';
interface WindowSizeOptions { interface WindowSizeOptions {
immediate?: boolean; immediate?: boolean;

View File

@ -1,5 +1,5 @@
import { ref, Ref, onUnmounted, onMounted } from 'vue';
import * as echarts from 'echarts/core'; import * as echarts from 'echarts/core';
import { onMounted, onUnmounted, Ref, ref } from 'vue';
/** /**
* eChart hook * eChart hook

View File

@ -10,10 +10,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import isBoolean from 'lodash/isBoolean';
import isUndefined from 'lodash/isUndefined';
import type { ComputedRef } from 'vue'; import type { ComputedRef } from 'vue';
import { useTabsRouterStore } from '@/store'; import { computed } from 'vue';
import FramePage from '@/layouts/frame/index.vue'; import FramePage from '@/layouts/frame/index.vue';
import { useTabsRouterStore } from '@/store';
// <suspense>使 // <suspense>使
// /page/1=> /page/2 使activeRouteFullPath key // /page/1=> /page/2 使activeRouteFullPath key
@ -30,8 +33,13 @@ import FramePage from '@/layouts/frame/index.vue';
const aliveViews = computed(() => { const aliveViews = computed(() => {
const tabsRouterStore = useTabsRouterStore(); const tabsRouterStore = useTabsRouterStore();
const { tabRouters } = tabsRouterStore; const { tabRouters } = tabsRouterStore;
return tabRouters
return tabRouters.filter((route) => route.isAlive).map((route) => route.name); .filter((route) => {
const keepAliveConfig = route.meta?.keepAlive;
const isRouteKeepAlive = isUndefined(keepAliveConfig) || (isBoolean(keepAliveConfig) && keepAliveConfig); // keepalive
return route.isAlive && isRouteKeepAlive;
})
.map((route) => route.name);
}) as ComputedRef<string[]>; }) as ComputedRef<string[]>;
const isRefreshing = computed(() => { const isRefreshing = computed(() => {

View File

@ -6,10 +6,11 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { CSSProperties, watch, ref, unref, computed } from 'vue';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'; import { computed, CSSProperties, ref, unref, watch } from 'vue';
import { prefix } from '@/config/global'; import { prefix } from '@/config/global';
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn';
import { useSettingStore } from '@/store'; import { useSettingStore } from '@/store';
defineProps({ defineProps({

View File

@ -64,18 +64,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue';
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import { computed } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useSettingStore } from '@/store';
import { getActive } from '@/router';
import { prefix } from '@/config/global';
import LogoFull from '@/assets/assets-logo-full.svg?component'; import LogoFull from '@/assets/assets-logo-full.svg?component';
import { prefix } from '@/config/global';
import { getActive } from '@/router';
import { useSettingStore } from '@/store';
import type { MenuRoute } from '@/types/interface'; import type { MenuRoute } from '@/types/interface';
import MenuContent from './MenuContent.vue';
import Notice from './Notice.vue'; import Notice from './Notice.vue';
import Search from './Search.vue'; import Search from './Search.vue';
import MenuContent from './MenuContent.vue';
const props = defineProps({ const props = defineProps({
theme: { theme: {

View File

@ -16,6 +16,7 @@
:key="`${routeItem.path}_${index}`" :key="`${routeItem.path}_${index}`"
:value="routeItem.path" :value="routeItem.path"
:removable="!routeItem.isHome" :removable="!routeItem.isHome"
:draggable="!routeItem.isHome"
> >
<template #label> <template #label>
<t-dropdown <t-dropdown
@ -69,14 +70,15 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, ref, computed } from 'vue'; import { computed, nextTick, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useSettingStore, useTabsRouterStore } from '@/store';
import { prefix } from '@/config/global'; import { prefix } from '@/config/global';
import { useSettingStore, useTabsRouterStore } from '@/store';
import type { TRouterInfo } from '@/types/interface'; import type { TRouterInfo } from '@/types/interface';
import LContent from './Content.vue';
import LBreadcrumb from './Breadcrumb.vue'; import LBreadcrumb from './Breadcrumb.vue';
import LContent from './Content.vue';
import LFooter from './Footer.vue'; import LFooter from './Footer.vue';
const route = useRoute(); const route = useRoute();

View File

@ -11,9 +11,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { usePermissionStore, useSettingStore } from '@/store'; import { usePermissionStore, useSettingStore } from '@/store';
import LHeader from './Header.vue'; import LHeader from './Header.vue';
const permissionStore = usePermissionStore(); const permissionStore = usePermissionStore();

View File

@ -11,10 +11,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { storeToRefs } from 'pinia';
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { storeToRefs } from 'pinia';
import { usePermissionStore, useSettingStore } from '@/store'; import { usePermissionStore, useSettingStore } from '@/store';
import LSideNav from './SideNav.vue'; import LSideNav from './SideNav.vue';
const route = useRoute(); const route = useRoute();

View File

@ -25,10 +25,11 @@
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { computed } from 'vue';
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import type { MenuRoute } from '@/types/interface'; import { computed } from 'vue';
import { getActive } from '@/router'; import { getActive } from '@/router';
import type { MenuRoute } from '@/types/interface';
type ListItemType = MenuRoute & { icon?: string }; type ListItemType = MenuRoute & { icon?: string };
@ -38,7 +39,6 @@ const props = defineProps({
default: () => [], default: () => [],
}, },
}); });
const active = computed(() => getActive()); const active = computed(() => getActive());
const list = computed(() => { const list = computed(() => {
@ -85,9 +85,16 @@ const getHref = (item: MenuRoute) => {
}; };
const getPath = (item: ListItemType) => { const getPath = (item: ListItemType) => {
if (active.value.startsWith(item.path)) { const activeLevel = active.value.split('/').length;
const pathLevel = item.path.split('/').length;
if (activeLevel > pathLevel && active.value.startsWith(item.path)) {
return active.value; return active.value;
} }
if (active.value === item.path) {
return active.value;
}
return item.meta?.single ? item.redirect : item.path; return item.meta?.single ? item.redirect : item.path;
}; };

View File

@ -47,8 +47,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { useRouter } from 'vue-router';
import { useNotificationStore } from '@/store'; import { useNotificationStore } from '@/store';
import type { NotificationItem } from '@/types/interface'; import type { NotificationItem } from '@/types/interface';

View File

@ -16,19 +16,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted } from 'vue';
import type { PropType } from 'vue';
import { useRouter } from 'vue-router';
import union from 'lodash/union'; import union from 'lodash/union';
import type { PropType } from 'vue';
import { computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useSettingStore } from '@/store';
import { prefix } from '@/config/global';
import pgk from '../../../package.json';
import type { MenuRoute } from '@/types/interface';
import { getActive, getRoutesExpanded } from '@/router';
import AssetLogo from '@/assets/assets-t-logo.svg?component';
import AssetLogoFull from '@/assets/assets-logo-full.svg?component'; import AssetLogoFull from '@/assets/assets-logo-full.svg?component';
import AssetLogo from '@/assets/assets-t-logo.svg?component';
import { prefix } from '@/config/global';
import { getActive, getRoutesExpanded } from '@/router';
import { useSettingStore } from '@/store';
import type { MenuRoute } from '@/types/interface';
import pgk from '../../../package.json';
import MenuContent from './MenuContent.vue'; import MenuContent from './MenuContent.vue';
const MIN_POINT = 992 - 1; const MIN_POINT = 992 - 1;

View File

@ -6,9 +6,9 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, unref, computed } from 'vue'; import { computed, defineComponent, unref } from 'vue';
import FrameContent from '../components/FrameContent.vue';
import FrameContent from '../components/FrameContent.vue';
import { useFrameKeepAlive } from './useFrameKeepAlive'; import { useFrameKeepAlive } from './useFrameKeepAlive';
export default defineComponent({ export default defineComponent({

View File

@ -1,6 +1,7 @@
import { computed, toRaw, unref } from 'vue';
import uniqBy from 'lodash/uniqBy'; import uniqBy from 'lodash/uniqBy';
import { computed, toRaw, unref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useSettingStore, useTabsRouterStore } from '@/store'; import { useSettingStore, useTabsRouterStore } from '@/store';
import type { MenuRoute } from '@/types/interface'; import type { MenuRoute } from '@/types/interface';

View File

@ -24,19 +24,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, watch } from 'vue'; import '@/style/layout.less';
import { storeToRefs } from 'pinia';
import { useRoute } from 'vue-router';
import { useSettingStore, useTabsRouterStore } from '@/store';
import SettingCom from './setting.vue'; import { storeToRefs } from 'pinia';
import LayoutHeader from './components/LayoutHeader.vue'; import { computed, onMounted, watch } from 'vue';
import LayoutContent from './components/LayoutContent.vue'; import { useRoute } from 'vue-router';
import LayoutSideNav from './components/LayoutSideNav.vue';
import { prefix } from '@/config/global'; import { prefix } from '@/config/global';
import { useSettingStore, useTabsRouterStore } from '@/store';
import '@/style/layout.less'; import LayoutContent from './components/LayoutContent.vue';
import LayoutHeader from './components/LayoutHeader.vue';
import LayoutSideNav from './components/LayoutSideNav.vue';
import SettingCom from './setting.vue';
const route = useRoute(); const route = useRoute();
const settingStore = useSettingStore(); const settingStore = useSettingStore();

View File

@ -92,21 +92,19 @@
</t-drawer> </t-drawer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted, watchEffect } from 'vue';
import { MessagePlugin } from 'tdesign-vue-next';
import type { PopupVisibleChangeContext } from 'tdesign-vue-next'; import type { PopupVisibleChangeContext } from 'tdesign-vue-next';
import { MessagePlugin } from 'tdesign-vue-next';
import { computed, onMounted, ref, watchEffect } from 'vue';
import useClipboard from 'vue-clipboard3'; import useClipboard from 'vue-clipboard3';
import { useSettingStore } from '@/store'; import SettingAutoIcon from '@/assets/assets-setting-auto.svg';
import Thumbnail from '@/components/thumbnail/index.vue';
import ColorContainer from '@/components/color/index.vue';
import STYLE_CONFIG from '@/config/style';
import { DEFAULT_COLOR_OPTIONS } from '@/config/color';
import SettingDarkIcon from '@/assets/assets-setting-dark.svg'; import SettingDarkIcon from '@/assets/assets-setting-dark.svg';
import SettingLightIcon from '@/assets/assets-setting-light.svg'; import SettingLightIcon from '@/assets/assets-setting-light.svg';
import SettingAutoIcon from '@/assets/assets-setting-auto.svg'; import ColorContainer from '@/components/color/index.vue';
import Thumbnail from '@/components/thumbnail/index.vue';
import { DEFAULT_COLOR_OPTIONS } from '@/config/color';
import STYLE_CONFIG from '@/config/style';
import { useSettingStore } from '@/store';
const settingStore = useSettingStore(); const settingStore = useSettingStore();

View File

@ -1,12 +1,13 @@
import { createApp } from 'vue';
import TDesign from 'tdesign-vue-next';
import 'tdesign-vue-next/es/style/index.css'; import 'tdesign-vue-next/es/style/index.css';
import { store } from './store';
import router from './router';
import '@/style/index.less'; import '@/style/index.less';
import './permission'; import './permission';
import TDesign from 'tdesign-vue-next';
import { createApp } from 'vue';
import App from './App.vue'; import App from './App.vue';
import router from './router';
import { store } from './store';
const app = createApp(App); const app = createApp(App);

View File

@ -35,17 +35,17 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, watch, ref, onUnmounted, nextTick, computed, onDeactivated } from 'vue'; import { LineChart, PieChart } from 'echarts/charts';
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components';
import * as echarts from 'echarts/core'; import * as echarts from 'echarts/core';
import { TooltipComponent, LegendComponent, GridComponent } from 'echarts/components';
import { PieChart, LineChart } from 'echarts/charts';
import { CanvasRenderer } from 'echarts/renderers'; import { CanvasRenderer } from 'echarts/renderers';
import { useSettingStore } from '@/store'; import { computed, nextTick, onDeactivated, onMounted, onUnmounted, ref, watch } from 'vue';
import { LAST_7_DAYS } from '@/utils/date';
import { changeChartsTheme } from '@/utils/color';
import { getPieChartDataSet, getLineChartDataSet } from '../index'; import { useSettingStore } from '@/store';
import { changeChartsTheme } from '@/utils/color';
import { LAST_7_DAYS } from '@/utils/date';
import { getLineChartDataSet, getPieChartDataSet } from '../index';
echarts.use([TooltipComponent, LegendComponent, PieChart, GridComponent, LineChart, CanvasRenderer]); echarts.use([TooltipComponent, LegendComponent, PieChart, GridComponent, LineChart, CanvasRenderer]);

View File

@ -67,18 +67,18 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, watch, ref, onUnmounted, nextTick, computed } from 'vue';
import * as echarts from 'echarts/core';
import { TooltipComponent, LegendComponent, GridComponent } from 'echarts/components';
import { LineChart } from 'echarts/charts'; import { LineChart } from 'echarts/charts';
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components';
import * as echarts from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers'; import { CanvasRenderer } from 'echarts/renderers';
import { useSettingStore } from '@/store'; import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
import { LAST_7_DAYS } from '@/utils/date';
import { changeChartsTheme } from '@/utils/color';
// //
import Trend from '@/components/trend/index.vue'; import Trend from '@/components/trend/index.vue';
import { useSettingStore } from '@/store';
import { changeChartsTheme } from '@/utils/color';
import { LAST_7_DAYS } from '@/utils/date';
import { constructInitDataset } from '../index'; import { constructInitDataset } from '../index';
echarts.use([TooltipComponent, LegendComponent, GridComponent, LineChart, CanvasRenderer]); echarts.use([TooltipComponent, LegendComponent, GridComponent, LineChart, CanvasRenderer]);

View File

@ -55,7 +55,7 @@
// //
import Trend from '@/components/trend/index.vue'; import Trend from '@/components/trend/index.vue';
import { SALE_TEND_LIST, BUY_TEND_LIST, SALE_COLUMNS, BUY_COLUMNS } from '../constants'; import { BUY_COLUMNS, BUY_TEND_LIST, SALE_COLUMNS, SALE_TEND_LIST } from '../constants';
const rehandleClickOp = (val: MouseEvent) => { const rehandleClickOp = (val: MouseEvent) => {
console.log(val); console.log(val);

View File

@ -55,20 +55,19 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, watch, ref, onUnmounted, nextTick } from 'vue'; import { BarChart, LineChart } from 'echarts/charts';
import * as echarts from 'echarts/core'; import * as echarts from 'echarts/core';
import { LineChart, BarChart } from 'echarts/charts';
import { CanvasRenderer } from 'echarts/renderers'; import { CanvasRenderer } from 'echarts/renderers';
import { UsergroupIcon, FileIcon } from 'tdesign-icons-vue-next'; import { FileIcon, UsergroupIcon } from 'tdesign-icons-vue-next';
import { useSettingStore } from '@/store'; import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
import { changeChartsTheme } from '@/utils/color';
// //
import Trend from '@/components/trend/index.vue'; import Trend from '@/components/trend/index.vue';
import { constructInitDashboardDataset } from '../index'; import { useSettingStore } from '@/store';
import { changeChartsTheme } from '@/utils/color';
import { PANE_LIST } from '../constants'; import { PANE_LIST } from '../constants';
import { constructInitDashboardDataset } from '../index';
echarts.use([LineChart, BarChart, CanvasRenderer]); echarts.use([LineChart, BarChart, CanvasRenderer]);

View File

@ -1,7 +1,8 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { TChartColor } from '@/config/color'; import { TChartColor } from '@/config/color';
import { getChartListColor } from '@/utils/color';
import { getRandomArray } from '@/utils/charts'; import { getRandomArray } from '@/utils/charts';
import { getChartListColor } from '@/utils/color';
/** 首页 dashboard 折线图 */ /** 首页 dashboard 折线图 */
export function constructInitDashboardDataset(type: string) { export function constructInitDashboardDataset(type: string) {

View File

@ -18,10 +18,10 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import TopPanel from './components/TopPanel.vue';
import MiddleChart from './components/MiddleChart.vue'; import MiddleChart from './components/MiddleChart.vue';
import RankList from './components/RankList.vue';
import OutputOverview from './components/OutputOverview.vue'; import OutputOverview from './components/OutputOverview.vue';
import RankList from './components/RankList.vue';
import TopPanel from './components/TopPanel.vue';
</script> </script>
<style scoped> <style scoped>

View File

@ -1,7 +1,8 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { TChartColor } from '@/config/color'; import { TChartColor } from '@/config/color';
import { getDateArray, getRandomArray } from '@/utils/charts';
import { getChartListColor } from '@/utils/color'; import { getChartListColor } from '@/utils/color';
import { getRandomArray, getDateArray } from '@/utils/charts';
/** /**
* *

View File

@ -65,21 +65,20 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, onMounted, onUnmounted, watch, computed, onDeactivated } from 'vue';
import * as echarts from 'echarts/core';
import { GridComponent, TooltipComponent, LegendComponent } from 'echarts/components';
import { LineChart, ScatterChart } from 'echarts/charts'; import { LineChart, ScatterChart } from 'echarts/charts';
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components';
import * as echarts from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers'; import { CanvasRenderer } from 'echarts/renderers';
import ProductCard from '@/components/product-card/index.vue'; import { computed, nextTick, onDeactivated, onMounted, onUnmounted, watch } from 'vue';
import { getFolderLineDataSet, getScatterDataSet } from './index'; import ProductCard from '@/components/product-card/index.vue';
import { PANE_LIST_DATA, PRODUCT_LIST } from './constants'; import Trend from '@/components/trend/index.vue';
import { LAST_7_DAYS } from '@/utils/date';
import { useSettingStore } from '@/store'; import { useSettingStore } from '@/store';
import { changeChartsTheme } from '@/utils/color'; import { changeChartsTheme } from '@/utils/color';
import { LAST_7_DAYS } from '@/utils/date';
import Trend from '@/components/trend/index.vue'; import { PANE_LIST_DATA, PRODUCT_LIST } from './constants';
import { getFolderLineDataSet, getScatterDataSet } from './index';
echarts.use([GridComponent, LegendComponent, TooltipComponent, LineChart, ScatterChart, CanvasRenderer]); echarts.use([GridComponent, LegendComponent, TooltipComponent, LineChart, ScatterChart, CanvasRenderer]);

View File

@ -125,12 +125,13 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { onMounted, ref } from 'vue';
import { prefix } from '@/config/global';
import { BASE_INFO_DATA, TABLE_COLUMNS_DATA as columns, PRODUCT_LIST } from './constants';
import { getPurchaseList } from '@/api/detail'; import { getPurchaseList } from '@/api/detail';
import { prefix } from '@/config/global';
import Product from './components/Product.vue'; import Product from './components/Product.vue';
import { BASE_INFO_DATA, PRODUCT_LIST, TABLE_COLUMNS_DATA as columns } from './constants';
const data = ref([]); const data = ref([]);
const pagination = ref({ const pagination = ref({

View File

@ -1,6 +1,6 @@
import { TChartColor } from '@/config/color'; import { TChartColor } from '@/config/color';
import { getDateArray, getRandomArray } from '@/utils/charts';
import { getChartListColor } from '@/utils/color'; import { getChartListColor } from '@/utils/color';
import { getRandomArray, getDateArray } from '@/utils/charts';
/** 平滑图数据 */ /** 平滑图数据 */
export function getSmoothLineDataSet({ export function getSmoothLineDataSet({

View File

@ -77,20 +77,19 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUnmounted, ref, watch, computed } from 'vue';
import * as echarts from 'echarts/core';
import { TitleComponent, ToolboxComponent, TooltipComponent, GridComponent, LegendComponent } from 'echarts/components';
import { BarChart, LineChart } from 'echarts/charts'; import { BarChart, LineChart } from 'echarts/charts';
import { GridComponent, LegendComponent, TitleComponent, ToolboxComponent, TooltipComponent } from 'echarts/components';
import * as echarts from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers'; import { CanvasRenderer } from 'echarts/renderers';
import { useSettingStore } from '@/store'; import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { getSmoothLineDataSet, get2ColBarChartDataSet } from './index'; import { getProjectList } from '@/api/detail';
import { BASE_INFO_DATA, TABLE_COLUMNS as columns } from './constants'; import { prefix } from '@/config/global';
import { useSettingStore } from '@/store';
import { changeChartsTheme } from '@/utils/color'; import { changeChartsTheme } from '@/utils/color';
import { prefix } from '@/config/global'; import { BASE_INFO_DATA, TABLE_COLUMNS as columns } from './constants';
import { getProjectList } from '@/api/detail'; import { get2ColBarChartDataSet, getSmoothLineDataSet } from './index';
echarts.use([ echarts.use([
TitleComponent, TitleComponent,

View File

@ -57,12 +57,13 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { NOTIFICATION_TYPES } from '@/constants'; import { computed, ref } from 'vue';
import type { NotificationItem } from '@/types/interface';
import EmptyIcon from '@/assets/assets-empty.svg?component'; import EmptyIcon from '@/assets/assets-empty.svg?component';
import { NOTIFICATION_TYPES } from '@/constants';
import { useNotificationStore } from '@/store'; import { useNotificationStore } from '@/store';
import type { NotificationItem } from '@/types/interface';
const TAB_LIST = [ const TAB_LIST = [
{ {

View File

@ -164,9 +164,10 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import { MessagePlugin } from 'tdesign-vue-next'; import { MessagePlugin } from 'tdesign-vue-next';
import { FORM_RULES, INITIAL_DATA, TYPE_OPTIONS, PARTY_A_OPTIONS, PARTY_B_OPTIONS } from './constants'; import { ref } from 'vue';
import { FORM_RULES, INITIAL_DATA, PARTY_A_OPTIONS, PARTY_B_OPTIONS, TYPE_OPTIONS } from './constants';
const formData = ref({ ...INITIAL_DATA }); const formData = ref({ ...INITIAL_DATA });

View File

@ -147,18 +147,18 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue'; import { Data, SubmitContext } from 'tdesign-vue-next';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { SubmitContext, Data } from 'tdesign-vue-next';
import { import {
FORM_RULES,
NAME_OPTIONS,
TYPE_OPTIONS,
ADDRESS_OPTIONS, ADDRESS_OPTIONS,
FORM_RULES,
INITIAL_DATA1, INITIAL_DATA1,
INITIAL_DATA2, INITIAL_DATA2,
INITIAL_DATA3, INITIAL_DATA3,
NAME_OPTIONS,
TYPE_OPTIONS,
} from './constants'; } from './constants';
const formData1 = ref({ ...INITIAL_DATA1 }); const formData1 = ref({ ...INITIAL_DATA1 });

View File

@ -74,16 +74,16 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, computed } from 'vue';
import { useRouter } from 'vue-router';
import { SearchIcon } from 'tdesign-icons-vue-next'; import { SearchIcon } from 'tdesign-icons-vue-next';
import { MessagePlugin } from 'tdesign-vue-next'; import { MessagePlugin } from 'tdesign-vue-next';
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { CONTRACT_STATUS, CONTRACT_TYPES, CONTRACT_PAYMENT_TYPES } from '@/constants';
import Trend from '@/components/trend/index.vue';
import { getList } from '@/api/list'; import { getList } from '@/api/list';
import { useSettingStore } from '@/store'; import Trend from '@/components/trend/index.vue';
import { prefix } from '@/config/global'; import { prefix } from '@/config/global';
import { CONTRACT_PAYMENT_TYPES, CONTRACT_STATUS, CONTRACT_TYPES } from '@/constants';
import { useSettingStore } from '@/store';
import { COLUMNS } from './constants'; import { COLUMNS } from './constants';

View File

@ -35,8 +35,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Data, FormRule, MessagePlugin, SubmitContext } from 'tdesign-vue-next';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { MessagePlugin, FormRule, SubmitContext, Data } from 'tdesign-vue-next';
const INITIAL_DATA = { const INITIAL_DATA = {
name: '', name: '',

View File

@ -68,12 +68,14 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { SearchIcon } from 'tdesign-icons-vue-next'; import { SearchIcon } from 'tdesign-icons-vue-next';
import { MessagePlugin } from 'tdesign-vue-next'; import { MessagePlugin } from 'tdesign-vue-next';
import ProductCard from '@/components/product-card/index.vue'; import { computed, onMounted, ref } from 'vue';
import DialogForm from './components/DialogForm.vue';
import { getCardList } from '@/api/list'; import { getCardList } from '@/api/list';
import ProductCard from '@/components/product-card/index.vue';
import DialogForm from './components/DialogForm.vue';
const INITIAL_DATA = { const INITIAL_DATA = {
name: '', name: '',

View File

@ -105,20 +105,20 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted } from 'vue'; import { MessagePlugin, PageInfo, PrimaryTableCol, TableRowData } from 'tdesign-vue-next';
import { MessagePlugin, PrimaryTableCol, TableRowData, PageInfo } from 'tdesign-vue-next'; import { computed, onMounted, ref } from 'vue';
import Trend from '@/components/trend/index.vue';
import { getList } from '@/api/list';
import { useSettingStore } from '@/store';
import { prefix } from '@/config/global';
import { getList } from '@/api/list';
import Trend from '@/components/trend/index.vue';
import { prefix } from '@/config/global';
import { import {
CONTRACT_PAYMENT_TYPES,
CONTRACT_STATUS, CONTRACT_STATUS,
CONTRACT_STATUS_OPTIONS, CONTRACT_STATUS_OPTIONS,
CONTRACT_TYPES,
CONTRACT_TYPE_OPTIONS, CONTRACT_TYPE_OPTIONS,
CONTRACT_PAYMENT_TYPES, CONTRACT_TYPES,
} from '@/constants'; } from '@/constants';
import { useSettingStore } from '@/store';
const store = useSettingStore(); const store = useSettingStore();

View File

@ -23,11 +23,11 @@ export default {
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import { SearchIcon } from 'tdesign-icons-vue-next'; import { SearchIcon } from 'tdesign-icons-vue-next';
import { ref } from 'vue';
import { TREE_DATA } from './constants';
import CommonTable from '../components/CommonTable.vue'; import CommonTable from '../components/CommonTable.vue';
import { TREE_DATA } from './constants';
const filterByText = ref(); const filterByText = ref();
const filterText = ref(); const filterText = ref();

View File

@ -79,11 +79,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import QrcodeVue from 'qrcode.vue';
import type { FormInstanceFunctions, FormRule } from 'tdesign-vue-next';
import { MessagePlugin } from 'tdesign-vue-next';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import QrcodeVue from 'qrcode.vue';
import { MessagePlugin } from 'tdesign-vue-next';
import type { FormInstanceFunctions, FormRule } from 'tdesign-vue-next';
import { useCounter } from '@/hooks'; import { useCounter } from '@/hooks';
import { useUserStore } from '@/store'; import { useUserStore } from '@/store';

View File

@ -71,8 +71,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { FormRule, MessagePlugin } from 'tdesign-vue-next';
import { ref } from 'vue'; import { ref } from 'vue';
import { MessagePlugin, FormRule } from 'tdesign-vue-next';
import { useCounter } from '@/hooks'; import { useCounter } from '@/hooks';
const INITIAL_DATA = { const INITIAL_DATA = {

View File

@ -30,10 +30,11 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import TdesignSetting from '@/layouts/setting.vue';
import LoginHeader from './components/Header.vue';
import Login from './components/Login.vue'; import Login from './components/Login.vue';
import Register from './components/Register.vue'; import Register from './components/Register.vue';
import LoginHeader from './components/Header.vue';
import TdesignSetting from '@/layouts/setting.vue';
const type = ref('login'); const type = ref('login');
const switchType = (val: string) => { const switchType = (val: string) => {

View File

@ -1,6 +1,6 @@
import { TChartColor } from '@/config/color'; import { TChartColor } from '@/config/color';
import { getDateArray, getRandomArray } from '@/utils/charts';
import { getChartListColor } from '@/utils/color'; import { getChartListColor } from '@/utils/color';
import { getRandomArray, getDateArray } from '@/utils/charts';
/** 折线图数据 */ /** 折线图数据 */
export function getFolderLineDataSet({ export function getFolderLineDataSet({

View File

@ -94,21 +94,22 @@ export default {
}; };
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
import { nextTick, onMounted, onUnmounted, watch, computed } from 'vue';
import * as echarts from 'echarts/core';
import { GridComponent, TooltipComponent, LegendComponent } from 'echarts/components';
import { LineChart } from 'echarts/charts'; import { LineChart } from 'echarts/charts';
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components';
import * as echarts from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers'; import { CanvasRenderer } from 'echarts/renderers';
import { useSettingStore } from '@/store'; import { computed, nextTick, onMounted, onUnmounted, watch } from 'vue';
import { LAST_7_DAYS } from '@/utils/date';
import { USER_INFO_LIST, TEAM_MEMBERS, PRODUCT_LIST } from './constants';
import { getFolderLineDataSet } from './index';
import ProductAIcon from '@/assets/assets-product-1.svg'; import ProductAIcon from '@/assets/assets-product-1.svg';
import ProductBIcon from '@/assets/assets-product-2.svg'; import ProductBIcon from '@/assets/assets-product-2.svg';
import ProductCIcon from '@/assets/assets-product-3.svg'; import ProductCIcon from '@/assets/assets-product-3.svg';
import ProductDIcon from '@/assets/assets-product-4.svg'; import ProductDIcon from '@/assets/assets-product-4.svg';
import { useSettingStore } from '@/store';
import { changeChartsTheme } from '@/utils/color'; import { changeChartsTheme } from '@/utils/color';
import { LAST_7_DAYS } from '@/utils/date';
import { PRODUCT_LIST, TEAM_MEMBERS, USER_INFO_LIST } from './constants';
import { getFolderLineDataSet } from './index';
echarts.use([GridComponent, TooltipComponent, LineChart, CanvasRenderer, LegendComponent]); echarts.use([GridComponent, TooltipComponent, LineChart, CanvasRenderer, LegendComponent]);

View File

@ -1,10 +1,11 @@
import { MessagePlugin } from 'tdesign-vue-next';
import NProgress from 'nprogress'; // progress bar
import 'nprogress/nprogress.css'; // progress bar style import 'nprogress/nprogress.css'; // progress bar style
import NProgress from 'nprogress'; // progress bar
import { MessagePlugin } from 'tdesign-vue-next';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import { getPermissionStore, getUserStore } from '@/store';
import router from '@/router'; import router from '@/router';
import { getPermissionStore, getUserStore } from '@/store';
import { PAGE_NOT_FOUND_ROUTE } from '@/utils/route/constant'; import { PAGE_NOT_FOUND_ROUTE } from '@/utils/route/constant';
NProgress.configure({ showSpinner: false }); NProgress.configure({ showSpinner: false });

View File

@ -1,5 +1,5 @@
import { useRoute, createRouter, RouteRecordRaw, createWebHistory } from 'vue-router';
import uniq from 'lodash/uniq'; import uniq from 'lodash/uniq';
import { createRouter, createWebHistory, RouteRecordRaw, useRoute } from 'vue-router';
const env = import.meta.env.MODE || 'development'; const env = import.meta.env.MODE || 'development';

View File

@ -1,5 +1,6 @@
import { DashboardIcon } from 'tdesign-icons-vue-next'; import { DashboardIcon } from 'tdesign-icons-vue-next';
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
import Layout from '@/layouts/index.vue'; import Layout from '@/layouts/index.vue';
export default [ export default [

View File

@ -1,5 +1,6 @@
import { LogoutIcon } from 'tdesign-icons-vue-next'; import { LogoutIcon } from 'tdesign-icons-vue-next';
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
import Layout from '@/layouts/index.vue'; import Layout from '@/layouts/index.vue';
export default [ export default [

View File

@ -8,8 +8,8 @@ export { store };
export * from './modules/notification'; export * from './modules/notification';
export * from './modules/permission'; export * from './modules/permission';
export * from './modules/user';
export * from './modules/setting'; export * from './modules/setting';
export * from './modules/tabs-router'; export * from './modules/tabs-router';
export * from './modules/user';
export default store; export default store;

View File

@ -1,4 +1,5 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import type { NotificationItem } from '@/types/interface'; import type { NotificationItem } from '@/types/interface';
const msgData = [ const msgData = [

View File

@ -3,6 +3,7 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import router, { allRoutes } from '@/router'; import router, { allRoutes } from '@/router';
import { store } from '@/store'; import { store } from '@/store';

View File

@ -1,9 +1,10 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import router, { fixedRouterList, homepageRouterList } from '@/router';
import { store } from '@/store';
import { RouteItem } from '@/api/model/permissionModel'; import { RouteItem } from '@/api/model/permissionModel';
import { getMenuList } from '@/api/permission'; import { getMenuList } from '@/api/permission';
import router, { fixedRouterList, homepageRouterList } from '@/router';
import { store } from '@/store';
import { transformObjectToRoute } from '@/utils/route'; import { transformObjectToRoute } from '@/utils/route';
export const usePermissionStore = defineStore('permission', { export const usePermissionStore = defineStore('permission', {

View File

@ -1,10 +1,11 @@
import keys from 'lodash/keys';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { Color } from 'tvision-color'; import { Color } from 'tvision-color';
import keys from 'lodash/keys';
import { LIGHT_CHART_COLORS, DARK_CHART_COLORS } from '@/config/color'; import { DARK_CHART_COLORS, LIGHT_CHART_COLORS } from '@/config/color';
import { insertThemeStylesheet, generateColorMap } from '@/utils/color';
import STYLE_CONFIG from '@/config/style'; import STYLE_CONFIG from '@/config/style';
import { store } from '@/store'; import { store } from '@/store';
import { generateColorMap, insertThemeStylesheet } from '@/utils/color';
const state = { const state = {
...STYLE_CONFIG, ...STYLE_CONFIG,

View File

@ -1,6 +1,7 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import type { TRouterInfo, TTabRouterType } from '@/types/interface';
import { store } from '@/store'; import { store } from '@/store';
import type { TRouterInfo, TTabRouterType } from '@/types/interface';
const homeRoute: Array<TRouterInfo> = [ const homeRoute: Array<TRouterInfo> = [
{ {

View File

@ -1,4 +1,5 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { TOKEN_NAME } from '@/config/global'; import { TOKEN_NAME } from '@/config/global';
import { store, usePermissionStore } from '@/store'; import { store, usePermissionStore } from '@/store';

View File

@ -1,4 +1,5 @@
import { RouteRecordName, LocationQueryRaw } from 'vue-router'; import { LocationQueryRaw, RouteRecordName } from 'vue-router';
import STYLE_CONFIG from '@/config/style'; import STYLE_CONFIG from '@/config/style';
export interface MenuRoute { export interface MenuRoute {

View File

@ -1,6 +1,7 @@
import { Color } from 'tvision-color';
import * as echarts from 'echarts/core'; import * as echarts from 'echarts/core';
import trim from 'lodash/trim'; import trim from 'lodash/trim';
import { Color } from 'tvision-color';
import { TColorToken } from '@/config/color'; import { TColorToken } from '@/config/color';
/** /**

View File

@ -1,11 +1,13 @@
import axios, { AxiosRequestConfig, InternalAxiosRequestConfig, AxiosInstance, AxiosResponse, AxiosError } from 'axios'; import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
import { stringify } from 'qs';
import isFunction from 'lodash/isFunction';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { CreateAxiosOptions } from './AxiosTransform'; import isFunction from 'lodash/isFunction';
import { AxiosCanceler } from './AxiosCancel'; import { stringify } from 'qs';
import { AxiosRequestConfigRetry, RequestOptions, Result } from '@/types/axios';
import { ContentTypeEnum } from '@/constants'; import { ContentTypeEnum } from '@/constants';
import { AxiosRequestConfigRetry, RequestOptions, Result } from '@/types/axios';
import { AxiosCanceler } from './AxiosCancel';
import { CreateAxiosOptions } from './AxiosTransform';
// Axios模块 // Axios模块
export class VAxios { export class VAxios {
@ -93,7 +95,7 @@ export class VAxios {
// 响应错误处理 // 响应错误处理
if (responseInterceptorsCatch && isFunction(responseInterceptorsCatch)) { if (responseInterceptorsCatch && isFunction(responseInterceptorsCatch)) {
this.instance.interceptors.response.use(undefined, responseInterceptorsCatch); this.instance.interceptors.response.use(undefined, (error) => responseInterceptorsCatch(error, this.instance));
} }
} }

View File

@ -1,5 +1,6 @@
import type { AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'; import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import type { RequestOptions, Result } from '@/types/axios'; import type { RequestOptions, Result } from '@/types/axios';
// 创建Axios选项 // 创建Axios选项
@ -33,5 +34,5 @@ export abstract class AxiosTransform {
requestInterceptorsCatch?: (error: AxiosError) => void; requestInterceptorsCatch?: (error: AxiosError) => void;
// 请求后的拦截器错误处理 // 请求后的拦截器错误处理
responseInterceptorsCatch?: (error: AxiosError) => void; responseInterceptorsCatch?: (error: AxiosError, instance: AxiosInstance) => void;
} }

View File

@ -1,13 +1,15 @@
// axios配置 可自行根据项目进行更改,只需更改该文件即可,其他文件可以不动 // axios配置 可自行根据项目进行更改,只需更改该文件即可,其他文件可以不动
import type { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
import isString from 'lodash/isString'; import isString from 'lodash/isString';
import merge from 'lodash/merge'; import merge from 'lodash/merge';
import type { InternalAxiosRequestConfig } from 'axios';
import type { AxiosTransform, CreateAxiosOptions } from './AxiosTransform';
import { VAxios } from './Axios';
import { joinTimestamp, formatRequestDate, setObjToUrlParams } from './utils';
import { TOKEN_NAME } from '@/config/global'; import { TOKEN_NAME } from '@/config/global';
import { ContentTypeEnum } from '@/constants'; import { ContentTypeEnum } from '@/constants';
import { VAxios } from './Axios';
import type { AxiosTransform, CreateAxiosOptions } from './AxiosTransform';
import { formatRequestDate, joinTimestamp, setObjToUrlParams } from './utils';
const env = import.meta.env.MODE || 'development'; const env = import.meta.env.MODE || 'development';
// 如果是mock模式 或 没启用直连代理 就不配置host 会走本地Mock拦截 或 Vite 代理 // 如果是mock模式 或 没启用直连代理 就不配置host 会走本地Mock拦截 或 Vite 代理
@ -127,7 +129,7 @@ const transform: AxiosTransform = {
}, },
// 响应错误处理 // 响应错误处理
responseInterceptorsCatch: (error: any) => { responseInterceptorsCatch: (error: any, instance: AxiosInstance) => {
const { config } = error; const { config } = error;
if (!config || !config.requestOptions.retry) return Promise.reject(error); if (!config || !config.requestOptions.retry) return Promise.reject(error);
@ -143,7 +145,7 @@ const transform: AxiosTransform = {
}, config.requestOptions.retry.delay || 1); }, config.requestOptions.retry.delay || 1);
}); });
config.headers = { ...config.headers, 'Content-Type': ContentTypeEnum.Json }; config.headers = { ...config.headers, 'Content-Type': ContentTypeEnum.Json };
return backoff.then((config) => request.request(config)); return backoff.then((config) => instance.request(config));
}, },
}; };

View File

@ -1,5 +1,5 @@
import isString from 'lodash/isString';
import isObject from 'lodash/isObject'; import isObject from 'lodash/isObject';
import isString from 'lodash/isString';
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'; const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';

View File

@ -1,13 +1,14 @@
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { shallowRef } from 'vue'; import { shallowRef } from 'vue';
import { RouteItem, RouteMeta } from '@/api/model/permissionModel'; import { RouteItem, RouteMeta } from '@/api/model/permissionModel';
import { import {
BLANK_LAYOUT, BLANK_LAYOUT,
LAYOUT,
IFRAME,
EXCEPTION_COMPONENT, EXCEPTION_COMPONENT,
PARENT_LAYOUT, IFRAME,
LAYOUT,
PAGE_NOT_FOUND_ROUTE, PAGE_NOT_FOUND_ROUTE,
PARENT_LAYOUT,
} from '@/utils/route/constant'; } from '@/utils/route/constant';
// vite 3+ support dynamic import from node_modules // vite 3+ support dynamic import from node_modules

View File

@ -1,10 +1,9 @@
import { ConfigEnv, UserConfig, loadEnv } from 'vite';
import { viteMockServe } from 'vite-plugin-mock';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx'; import vueJsx from '@vitejs/plugin-vue-jsx';
import svgLoader from 'vite-svg-loader';
import path from 'path'; import path from 'path';
import { ConfigEnv, loadEnv, UserConfig } from 'vite';
import { viteMockServe } from 'vite-plugin-mock';
import svgLoader from 'vite-svg-loader';
const CWD = process.cwd(); const CWD = process.cwd();