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

View File

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

View File

@ -46,11 +46,9 @@ export function constructInitDataset(dateTime: Array<string> = []) {
// console.log('dateAbsTime..', dateAbsTime, enhandTime);
timeArray.push(dayjs(enhandTime).format('YYYY-MM-DD'));
} else {
timeArray.push(
dayjs()
timeArray.push(dayjs()
.subtract(divideNum - i, 'day')
.format('YYYY-MM-DD'),
);
.format('YYYY-MM-DD'));
}
inArray.push(getRandomNum().toString());
@ -192,7 +190,7 @@ export function getAreaChartDataSet(text = ''): any {
area: {
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),
],
],
injectOption: (option) => ({ ...option, color: chartListColor }),
injectOption: option => ({ ...option, color: chartListColor }),
};
}
return {
@ -242,7 +240,7 @@ export function getColumnChartDataSet(isMonth = false): any {
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],
],
injectOption: (option) => ({ ...option, color: chartListColor }),
injectOption: option => ({ ...option, color: chartListColor }),
pie: {
radius: ['45%', '60%'], // 设置内圆和外圆半径
},

View File

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

View File

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

View File

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

View File

@ -306,7 +306,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { prefix } from '@/config/global';
import { Prefix as prefix } from '@/config/global';
//
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';
const layoutModules = import.meta.glob('../layouts/*');
@ -35,13 +35,13 @@ const routes: Array<RouteRecordRaw> = [
const router = createRouter({
history: createWebHistory(''),
routes,
scrollBehavior(to, from, savedPosition) {
scrollBehavior() {
return {
el: '#app',
top: 0,
behavior: 'smooth',
}
};
},
})
export default router
});
export default router;

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

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

View File

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

View File

@ -53,8 +53,8 @@ const mutations = {
};
const getters = {
unreadMsg: (state) => state.msgData.filter((item) => item.status),
readMsg: (state) => state.msgData.filter((item) => !item.status),
unreadMsg: state => state.msgData.filter(item => item.status),
readMsg: state => state.msgData.filter(item => !item.status),
};
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 { viteMockServe } from 'vite-plugin-mock';
const HttpProxyAgent = require('http-proxy-agent');
import { defineConfig } from 'vite';
// import { viteMockServe } from 'vite-plugin-mock';
import vueJsx from '@vitejs/plugin-vue-jsx';
import vue from '@vitejs/plugin-vue'
const path = require('path');
import vue from '@vitejs/plugin-vue';
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/
export default defineConfig({
@ -19,9 +19,9 @@ export default defineConfig({
},
plugins: [
vue(),
vueJsx()
vueJsx(),
],
server: {
port: 3002,
},
})
});