提交 63297dac authored 作者: ZvonimirSun's avatar ZvonimirSun

chore: 调整配置,移除ts文件

上级 4301b95c
{
"globals": {
"Component": true,
"ComponentPublicInstance": true,
"ComputedRef": true,
"EffectScope": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true,
"InjectionKey": true,
"PropType": true,
"Ref": true,
"VNode": true,
"WritableComputedRef": true,
"acceptHMRUpdate": true,
"computed": true,
"createApp": true,
"createPinia": true,
"customRef": true,
"defineAsyncComponent": true,
"defineComponent": true,
"defineStore": true,
"effectScope": true,
"getActivePinia": true,
"getCurrentInstance": true,
"getCurrentScope": true,
"h": true,
"inject": true,
"isProxy": true,
"isReactive": true,
"isReadonly": true,
"isRef": true,
"mapActions": true,
"mapGetters": true,
"mapState": true,
"mapStores": true,
"mapWritableState": true,
"markRaw": true,
"nextTick": true,
"onActivated": true,
"onBeforeMount": true,
"onBeforeRouteLeave": true,
"onBeforeRouteUpdate": true,
"onBeforeUnmount": true,
"onBeforeUpdate": true,
"onDeactivated": true,
"onErrorCaptured": true,
"onMounted": true,
"onRenderTracked": true,
"onRenderTriggered": true,
"onScopeDispose": true,
"onServerPrefetch": true,
"onUnmounted": true,
"onUpdated": true,
"provide": true,
"reactive": true,
"readonly": true,
"ref": true,
"resolveComponent": true,
"setActivePinia": true,
"setMapStoreSuffix": true,
"shallowReactive": true,
"shallowReadonly": true,
"shallowRef": true,
"storeToRefs": true,
"toRaw": true,
"toRef": true,
"toRefs": true,
"toValue": true,
"triggerRef": true,
"unref": true,
"useAttrs": true,
"useCssModule": true,
"useCssVars": true,
"useLink": true,
"useRoute": true,
"useRouter": true,
"useSlots": true,
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true,
"diff": true,
"getNode": true,
"getParents": true,
"mitt": true,
"renameKeys": true
}
}
......@@ -14,4 +14,8 @@ dist-ssr
*.ntvs*
*.njsproj
*.sln
*.sw?
\ No newline at end of file
*.sw?
pnpm-lock.yaml
yarn.lock
package-lock.json
差异被折叠。
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
declare module 'vue' {
export interface GlobalComponents {
LayCascader: typeof import('@layui/layui-vue')['LayCascader']
LayCheckbox: typeof import('@layui/layui-vue')['LayCheckbox']
LayInput: typeof import('@layui/layui-vue')['LayInput']
LayLine: typeof import('@layui/layui-vue')['LayLine']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
import globals from 'globals'
import pluginVue from 'eslint-plugin-vue'
import path from 'path'
import { fileURLToPath } from 'url'
import { FlatCompat } from '@eslint/eslintrc'
import pluginJs from '@eslint/js'
import autoImport from './.eslintrc-auto-import.json' assert {type: 'json'}
// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({ baseDirectory: __dirname, recommendedConfig: pluginJs.configs.recommended })
export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...autoImport.globals
}
}
},
...compat.extends('standard'),
...pluginVue.configs['flat/recommended'],
{
rules: {
'import/export': 0,
'no-unused-vars': 0,
'vue/multi-word-component-names': 0
}
}
]
......@@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main.js"></script>
</body>
</html>
......@@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
......@@ -16,37 +16,35 @@
"core-js": "^3.6.5",
"echarts": "^5.4.3",
"gm-crypt": "^0.0.2",
"gt-maputils": "^0.1.9",
"less": "^4.2.0",
"mockjs": "^1.1.0",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.0",
"vue": "^3.4.21",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@babel/core": "^7.23.3",
"@babel/eslint-parser": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "^9.0.0",
"@types/node": "^18.7.8",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/compiler-sfc": "^3.3.4",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.24.0",
"globals": "^15.0.0",
"sass": "^1.75.0",
"typescript": "^5.2.2",
"unplugin-auto-import": "^0.11.2",
"unplugin-vue-components": "^0.22.7",
"typescript": "^5.4.5",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.2.0",
"vue-tsc": "^2.0.6"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
"vite-plugin-vue-devtools": "^7.0.27"
},
"browserslist": [
"> 1%",
......
<script setup lang="ts"></script>
<script setup></script>
<template>
<router-view></router-view>
<router-view />
</template>
<style scoped lang="scss">
......
import axios, {
// AxiosRequestHeaders,
AxiosResponse,
InternalAxiosRequestConfig
} from 'axios'
import axios from 'axios'
// import { useUserStore } from '../store/user'
import { layer } from '@layui/layui-vue'
import router from '../router'
type TAxiosOption = {
timeout: number
baseURL: string
}
const config: TAxiosOption = {
const config = {
timeout: 5000,
// baseURL: import.meta.env.VITE_APP_BASE_API
baseURL: window.location.origin
......@@ -20,12 +11,12 @@ const config: TAxiosOption = {
class Http {
service
constructor(config: TAxiosOption) {
constructor (config) {
this.service = axios.create(config)
/* 请求拦截 */
this.service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
(config) => {
// const userInfoStore = useUserStore();
// if (userInfoStore.token) {
// (config.headers as AxiosRequestHeaders).token = userInfoStore.token as string
......@@ -44,7 +35,7 @@ class Http {
/* 响应拦截 */
this.service.interceptors.response.use(
(response: AxiosResponse<never>) => {
(response) => {
console.log(response)
switch (response.data.code) {
case 200:
......@@ -120,27 +111,43 @@ class Http {
)
}
/* GET 方法 */
// eslint-disable-next-line no-unreachable
get(url: string, params?: object, _object = {}): Promise<never> {
/**
* GET 方法
* @param url
* @param [params]
* @param [_object]
*/
get (url, params, _object = {}) {
return this.service.get(url, { params, ..._object })
}
/* POST 方法 */
// eslint-disable-next-line no-unreachable
post(url: string, params?: object, _object = {}): Promise<never> {
/**
* POST 方法
* @param url
* @param [params]
* @param [_object]
*/
post (url, params, _object = {}) {
return this.service.post(url, params, _object)
}
/* PUT 方法 */
// eslint-disable-next-line no-unreachable
put(url: string, params?: object, _object = {}): Promise<never> {
/**
* PUT 方法
* @param url
* @param [params]
* @param [_object]
*/
put (url, params, _object = {}) {
return this.service.put(url, params, _object)
}
/* DELETE 方法 */
// eslint-disable-next-line no-unreachable
delete(url: string, params?: never, _object = {}): Promise<never> {
/**
* DELETE 方法
* @param url
* @param [params]
* @param [_object]
*/
delete (url, params, _object = {}) {
return this.service.delete(url, { params, ..._object })
}
}
......
......@@ -3,6 +3,6 @@ import Http from '../http'
/**
* 保存质检、变更状态
*/
export const saveStatus = function (url: string, data: object) {
export const saveStatus = function (url, data) {
return Http.post(url, data)
}
......@@ -5,7 +5,7 @@ import Http from '../http'
* @param url
* @param data
*/
export const getLcInfo = function (url: string, data: object) {
export const getLcInfo = function (url, data) {
return Http.get(url, data)
}
......@@ -14,7 +14,7 @@ export const getLcInfo = function (url: string, data: object) {
* @param url
* @param data
*/
export const getConfigInfo = function (url: string, data: object) {
export const getConfigInfo = function (url, data) {
return Http.get(url, data)
}
......@@ -23,6 +23,6 @@ export const getConfigInfo = function (url: string, data: object) {
* @param url
* @param data
*/
export const getZjDataFromDB = function (url: string, data: object) {
export const getZjDataFromDB = function (url, data) {
return Http.get(url, data)
}
......@@ -4,11 +4,11 @@ import Http from '../http'
* @param code 一个字符串,代表要获取的 JSON 文件的名称(不包含扩展名)。
* @returns 返回一个 Promise 对象,它解析为从指定路径加载的 JSON 数据。
*/
export const getJsonCode = function (code: string) {
export const getJsonCode = function (code) {
// 使用 Http.get 方法请求指定路径的 JSON 数据
return Http.get(`/src/data/${code}.json`)
}
export const getList = function (url: string) {
export const getList = function (url) {
return Http.get(`/src/data/${url}.json`)
}
import Http from '../http'
export const login = function (loginForm: any) {
export const login = function (loginForm) {
return Http.post('/user/login', loginForm)
}
//登录验证码
// 登录验证码
export const verificationImg = function () {
return Http.get('/login/verificationImg')
}
//登录二维码
// 登录二维码
export const loginQrcode = function () {
return Http.get('/login/loginQrcode')
}
......
......@@ -2,8 +2,6 @@ import { createApp } from 'vue'
import Router from './router'
import Store from './store'
import './style.css'
import Layui from '@layui/layui-vue'
import '@layui/layui-vue/lib/index.css'
import App from './App.vue'
// 引入iconfont
......@@ -12,10 +10,8 @@ import '@/assets/iconfont/iconfont.css'
const env = import.meta.env
const app = createApp(App)
app.use(Store)
app.use(Router)
app.use(Layui)
app.mount('#app')
import { createRouter, createWebHashHistory, NavigationGuardNext, RouteLocationNormalized } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import routes from './module/basicRoutes'
const router = createRouter({
......@@ -16,7 +16,7 @@ const router = createRouter({
* @param to 目标
* @param from 来至
*/
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => {
router.beforeEach((to, from, next) => {
if (to.meta.requireAuth) {
next()
} else if (to.matched.length === 0) {
......
/**
* 获取数据差异
*
* @param arr1 数组
* @param arr2 数组
* @param {any[]} arr1 数组
* @param {any[]} arr2 数组
*/
const diff = function (arr1: any[], arr2: any[]) {
const diff = function (arr1, arr2) {
arr1 = Array.from(new Set(arr1))
arr2 = Array.from(new Set(arr2))
const mergeArr = arr1.concat(arr2)
......
import mitt from 'mitt'
import Mitt from 'mitt'
const emitter = new mitt()
const emitter = new Mitt()
export default emitter
......@@ -4,7 +4,7 @@
* @param list 集合
* @param id 节点编号
*/
export const getNode = function (list: any[], id: string): any {
export const getNode = function (list, id) {
for (const i in list) {
const item = list[i]
if (item.id === id) {
......@@ -26,7 +26,7 @@ export const getNode = function (list: any[], id: string): any {
* @param list 集合
* @param id 节点编号
*/
export const getParents = function (list: any[], id: string): any {
export const getParents = function (list, id) {
for (const i in list) {
if (list[i].id === id) {
return [list[i]]
......
......@@ -7,12 +7,20 @@
>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
<lay-button type="primary">
返回
</lay-button>
</template>
</lay-exception>
</lay-card>
</template>
<script setup>
defineOptions({
name: '401Page'
})
</script>
<style>
.error-page {
padding-top: 200px;
......
......@@ -7,12 +7,20 @@
>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
<lay-button type="primary">
返回
</lay-button>
</template>
</lay-exception>
</lay-card>
</template>
<script setup>
defineOptions({
name: '403Page'
})
</script>
<style>
.error-page {
padding-top: 200px;
......
......@@ -7,12 +7,20 @@
>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
<lay-button type="primary">
返回
</lay-button>
</template>
</lay-exception>
</lay-card>
</template>
<script setup>
defineOptions({
name: '404Page'
})
</script>
<style>
.error-page {
padding-top: 200px;
......
......@@ -7,12 +7,20 @@
>
<template #extra>
<lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button>
<lay-button type="primary">
返回
</lay-button>
</template>
</lay-exception>
</lay-card>
</template>
<script setup>
defineOptions({
name: '500Page'
})
</script>
<style>
.error-page {
padding-top: 200px;
......
差异被折叠。
/// <reference types="vite/client" />
{
"compilerOptions": {
"target": "ESNext",
"jsx": "preserve",
"jsxImportSource": "vue",
"lib": ["DOM", "ESNext"],
"baseUrl": ".",
"module": "ESNext",
"moduleResolution": "node",
"paths": {
"@/*": ["src/*"]
},
"resolveJsonModule": true,
"types": [
"vitest",
"vite/client",
"vite-plugin-pwa/vue"
],
"allowJs": true,
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"skipLibCheck": true
},
"exclude": ["dist", "node_modules", "cypress"]
}
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { LayuiVueResolver } from 'unplugin-vue-components/resolvers'
import VueDevTools from 'vite-plugin-vue-devtools'
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [
vue(),
VueDevTools(),
AutoImport({
resolvers: [LayuiVueResolver()],
imports: [
'vue',
'pinia',
'vue-router'
],
dirs: [
'./src/utils'
],
eslintrc: {
enabled: true
},
vueTemplate: true
}),
Components({
resolvers: [LayuiVueResolver()]
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
css: {
preprocessorOptions: {
scss: { charset: false },
less: {
javascriptEnabled: true
}
}
},
server: {
port: 3000,
cors: true,
proxy: {}
},
build: {
outDir: path.resolve(__dirname, '../dist')
},
envDir: path.resolve(__dirname, 'env')
})
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论