fix/eslint (merge request !3)

Squash merge branch 'fix/eslint' into 'develop'
fix eslint error

Co-author: pengYYYYY <pengyue970715@gmail.com>
This commit is contained in:
pengYYYYY 2021-09-01 11:26:19 +08:00
parent 063ba99491
commit f4c4cf7d9f
13 changed files with 137 additions and 43 deletions

View File

@ -25,12 +25,21 @@
</card> </card>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent, PropType } from 'vue';
import Card from '@/components/card/index.vue'; import Card from '@/components/card/index.vue';
export default defineComponent({ export default defineComponent({
name: 'Result', name: 'Result',
components: { Card }, components: { Card },
props: ['bgUrl', 'tip', 'linkUrl', 'pageHeader'], props: {
bgUrl: {
type: String as PropType<string>,
default: '',
},
tip: {
type: String as PropType<string>,
default: '',
},
},
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,11 +1,11 @@
export const prefix = 'tdesign-pro'; export const Prefix = 'tdesign-pro';
export const theme = 'light'; export const Theme = 'light';
// 登录方式设定authenticationMethod取值有smartProxy(走智能网关内网登录,要求.oa.co../.woa.co.. 等域名,且要求域名申请接入智能网关) // 登录方式设定authenticationMethod取值有smartProxy(走智能网关内网登录,要求.oa.co../.woa.co.. 等域名,且要求域名申请接入智能网关)
// customize(自定义登录,外网域名,统一重定向到登录页面) // customize(自定义登录,外网域名,统一重定向到登录页面)
// export const authenticationMethod = 'smartProxy'; // export const authenticationMethod = 'smartProxy';
export const authenticationMethod = 'customize'; export const AuthenticationMethod = 'customize';
export default { export default {
prefix, Prefix,
theme, Theme,
authenticationMethod, AuthenticationMethod,
}; };

View File

@ -46,11 +46,9 @@ export function constructInitDataset(dateTime: Array<string> = []) {
// console.log('dateAbsTime..', dateAbsTime, enhandTime); // console.log('dateAbsTime..', dateAbsTime, enhandTime);
timeArray.push(dayjs(enhandTime).format('YYYY-MM-DD')); timeArray.push(dayjs(enhandTime).format('YYYY-MM-DD'));
} else { } else {
timeArray.push( timeArray.push(dayjs()
dayjs() .subtract(divideNum - i, 'day')
.subtract(divideNum - i, 'day') .format('YYYY-MM-DD'));
.format('YYYY-MM-DD'),
);
} }
inArray.push(getRandomNum().toString()); inArray.push(getRandomNum().toString());
@ -192,7 +190,7 @@ export function getAreaChartDataSet(text = ''): any {
area: { area: {
smooth: true, smooth: true,
}, },
injectOption: (option) => ({ ...option, color: chartListColor }), injectOption: option => ({ ...option, color: chartListColor }),
}; };
} }
@ -222,7 +220,7 @@ export function getColumnChartDataSet(isMonth = false): any {
getRandomNum(Math.random() * 100), getRandomNum(Math.random() * 100),
], ],
], ],
injectOption: (option) => ({ ...option, color: chartListColor }), injectOption: option => ({ ...option, color: chartListColor }),
}; };
} }
return { return {
@ -242,7 +240,7 @@ export function getColumnChartDataSet(isMonth = false): any {
getRandomNum(Math.random() * 100), getRandomNum(Math.random() * 100),
], ],
], ],
injectOption: (option) => ({ ...option, color: chartListColor }), injectOption: option => ({ ...option, color: chartListColor }),
}; };
} }
@ -262,7 +260,7 @@ export function getPieChartDataSet(radius = 42): any {
['状态', '审核中', '待履行', '履行中', '已完成'], ['状态', '审核中', '待履行', '履行中', '已完成'],
['数量', 67, 45, radius, 36], ['数量', 67, 45, radius, 36],
], ],
injectOption: (option) => ({ ...option, color: chartListColor }), injectOption: option => ({ ...option, color: chartListColor }),
pie: { pie: {
radius: ['45%', '60%'], // 设置内圆和外圆半径 radius: ['45%', '60%'], // 设置内圆和外圆半径
}, },

View File

@ -210,7 +210,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import model from './index'; import model from './index';
import { prefix } from '@/config/global'; import { Prefix as prefix } from '@/config/global';
// //
import './index.less'; import './index.less';

View File

@ -64,7 +64,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { prefix } from '@/config/global'; import { Prefix as prefix } from '@/config/global';
import model from './index'; import model from './index';
import './index.less'; import './index.less';

View File

@ -225,7 +225,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import { prefix } from '@/config/global'; import { Prefix as prefix } from '@/config/global';
// //
import './index.less'; import './index.less';

View File

@ -306,7 +306,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { prefix } from '@/config/global'; import { Prefix as prefix } from '@/config/global';
// //
import './index.less'; import './index.less';

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import routeConfig from '@/config/routes'; import routeConfig from '@/config/routes';
const layoutModules = import.meta.glob('../layouts/*'); const layoutModules = import.meta.glob('../layouts/*');
@ -35,13 +35,13 @@ const routes: Array<RouteRecordRaw> = [
const router = createRouter({ const router = createRouter({
history: createWebHistory(''), history: createWebHistory(''),
routes, routes,
scrollBehavior(to, from, savedPosition) { scrollBehavior() {
return { return {
el: '#app', el: '#app',
top: 0, top: 0,
behavior: 'smooth', behavior: 'smooth',
} };
}, },
}) });
export default router export default router;

6
src/shims-vue.d.ts vendored
View File

@ -1,6 +1,6 @@
declare module '*.vue' { declare module '*.vue' {
import { DefineComponent } from 'vue' import { DefineComponent } from 'vue';
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any> const component: DefineComponent<{}, {}, any>;
export default component export default component;
} }

View File

@ -1,5 +1,5 @@
import { InjectionKey } from 'vue' import { InjectionKey } from 'vue';
import { createStore, Store } from 'vuex' import { createStore, Store } from 'vuex';
import user from './modules/user'; import user from './modules/user';
import notification from './modules/notification'; import notification from './modules/notification';
import setting from './modules/setting'; import setting from './modules/setting';
@ -7,7 +7,7 @@ export interface State {
count: number count: number
} }
export const key: InjectionKey<Store<State>> = Symbol() export const key: InjectionKey<Store<State>> = Symbol();
export const store = createStore<State>({ export const store = createStore<State>({
modules: { modules: {
@ -15,6 +15,6 @@ export const store = createStore<State>({
setting, setting,
notification, notification,
}, },
}) });
export default store; export default store;

View File

@ -53,8 +53,8 @@ const mutations = {
}; };
const getters = { const getters = {
unreadMsg: (state) => state.msgData.filter((item) => item.status), unreadMsg: state => state.msgData.filter(item => item.status),
readMsg: (state) => state.msgData.filter((item) => !item.status), readMsg: state => state.msgData.filter(item => !item.status),
}; };
const actions = {}; const actions = {};

View File

@ -0,0 +1,87 @@
import STYLE_CONFIG from '@/config/style';
import MENU_CONFIG from '@/config/routes';
// 定义的state初始值
const state = {
...STYLE_CONFIG,
};
// 定义的state的初始值方法传入state或者额外的方法然后利用vuex的双向数据驱动进行值的改变
// 可通过this.$store.commit(' ')调用,但是触发的是同步事件
const mutations = {
update(state, payload) {
// eslint-disable-next-line no-param-reassign
state.showBreadcrumb = payload.showBreadcrumb;
state.theme = payload.theme;
state.layout = payload.layout;
state.isSidebarCompact = payload.isSidebarCompact;
state.logoPosition = payload.logoPosition;
state.splitMenu = payload.splitMenu;
state.isFooterAside = payload.isFooterAside;
state.isSidebarFixed = payload.isSidebarFixed;
state.isHeaderFixed = payload.isHeaderFixed;
state.showHeader = payload.showHeader;
},
toggleSidebarCompact(state) {
state.isSidebarCompact = !state.isSidebarCompact;
},
showSidebarCompact(state, payload) {
state.isSidebarCompact = payload;
},
};
const getters = {
showHeader: state => state.showHeader,
showSidebar: state => state.layout !== 'top',
showSidebarLogo: state => state.layout === 'side',
showHeaderLogo: state => state.layout !== 'side',
headerMenu: (state) => {
if (state.layout === 'mix') {
if (state.splitMenu) {
return MENU_CONFIG.map(menu => ({
...menu,
children: [],
}));
}
return [];
}
return MENU_CONFIG;
},
sideMenu: (state, getters, rootState) => {
if (state.layout === 'mix' && state.splitMenu) {
let index;
for (index = 0; index < MENU_CONFIG.length; index++) {
const item = MENU_CONFIG[index];
if (item.children && item.children.length > 0) {
if (rootState.route.path.indexOf(item.path) === 0) {
return item.children.map(menuRouter => ({ ...menuRouter, path: `${item.path}/${menuRouter.path}` }));
}
}
}
}
return MENU_CONFIG;
},
showAsideFooter: (state) => {
if (state.layout === 'mix' && !state.isSidebarFixed) {
return state.showFooter && state.isAsideFooter;
}
return state.showFooter;
},
showMainFooter: (state) => {
if (state.layout === 'mix' && !state.isSidebarFixed) {
return state.showFooter && !state.isAsideFooter;
}
return false;
},
};
const actions = {};
export default {
namespaced: true,
state,
mutations,
actions,
getters,
};

View File

@ -1,12 +1,12 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite';
import { viteMockServe } from 'vite-plugin-mock'; // import { viteMockServe } from 'vite-plugin-mock';
const HttpProxyAgent = require('http-proxy-agent');
import vueJsx from '@vitejs/plugin-vue-jsx'; import vueJsx from '@vitejs/plugin-vue-jsx';
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue';
const path = require('path');
import proxy from './src/config/proxy'; // import proxy from './src/config/proxy';
// const HttpProxyAgent = require('http-proxy-agent');
const path = require('path');
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
@ -19,9 +19,9 @@ export default defineConfig({
}, },
plugins: [ plugins: [
vue(), vue(),
vueJsx() vueJsx(),
], ],
server: { server: {
port: 3002, port: 3002,
}, },
}) });