提交 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
}
}
...@@ -15,3 +15,7 @@ dist-ssr ...@@ -15,3 +15,7 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.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 @@ ...@@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script type="module" src="/src/main.ts"></script> <script type="module" src="/src/main.js"></script>
</body> </body>
</html> </html>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vue-tsc && vite build", "build": "vite build",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
...@@ -16,37 +16,35 @@ ...@@ -16,37 +16,35 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"echarts": "^5.4.3", "echarts": "^5.4.3",
"gm-crypt": "^0.0.2", "gm-crypt": "^0.0.2",
"gt-maputils": "^0.1.9",
"less": "^4.2.0", "less": "^4.2.0",
"mockjs": "^1.1.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.0", "pinia-plugin-persistedstate": "^3.2.0",
"vue": "^3.4.21", "vue": "^3.4.21",
"vue-router": "^4.2.5" "vue-router": "^4.2.5"
}, },
"devDependencies": { "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", "@types/node": "^18.7.8",
"@vitejs/plugin-vue": "^5.0.4", "@vitejs/plugin-vue": "^5.0.4",
"@vue/compiler-sfc": "^3.3.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", "sass": "^1.75.0",
"typescript": "^5.2.2", "typescript": "^5.4.5",
"unplugin-auto-import": "^0.11.2", "unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.22.7", "unplugin-vue-components": "^0.26.0",
"vite": "^5.2.0", "vite": "^5.2.0",
"vue-tsc": "^2.0.6" "vite-plugin-vue-devtools": "^7.0.27"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
......
<script setup lang="ts"></script> <script setup></script>
<template> <template>
<router-view></router-view> <router-view />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
import axios, { import axios from 'axios'
// AxiosRequestHeaders,
AxiosResponse,
InternalAxiosRequestConfig
} from 'axios'
// import { useUserStore } from '../store/user' // import { useUserStore } from '../store/user'
import { layer } from '@layui/layui-vue' import { layer } from '@layui/layui-vue'
import router from '../router' import router from '../router'
type TAxiosOption = { const config = {
timeout: number
baseURL: string
}
const config: TAxiosOption = {
timeout: 5000, timeout: 5000,
// baseURL: import.meta.env.VITE_APP_BASE_API // baseURL: import.meta.env.VITE_APP_BASE_API
baseURL: window.location.origin baseURL: window.location.origin
...@@ -20,12 +11,12 @@ const config: TAxiosOption = { ...@@ -20,12 +11,12 @@ const config: TAxiosOption = {
class Http { class Http {
service service
constructor(config: TAxiosOption) { constructor (config) {
this.service = axios.create(config) this.service = axios.create(config)
/* 请求拦截 */ /* 请求拦截 */
this.service.interceptors.request.use( this.service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => { (config) => {
// const userInfoStore = useUserStore(); // const userInfoStore = useUserStore();
// if (userInfoStore.token) { // if (userInfoStore.token) {
// (config.headers as AxiosRequestHeaders).token = userInfoStore.token as string // (config.headers as AxiosRequestHeaders).token = userInfoStore.token as string
...@@ -44,7 +35,7 @@ class Http { ...@@ -44,7 +35,7 @@ class Http {
/* 响应拦截 */ /* 响应拦截 */
this.service.interceptors.response.use( this.service.interceptors.response.use(
(response: AxiosResponse<never>) => { (response) => {
console.log(response) console.log(response)
switch (response.data.code) { switch (response.data.code) {
case 200: case 200:
...@@ -120,27 +111,43 @@ class Http { ...@@ -120,27 +111,43 @@ class Http {
) )
} }
/* GET 方法 */ /**
// eslint-disable-next-line no-unreachable * GET 方法
get(url: string, params?: object, _object = {}): Promise<never> { * @param url
* @param [params]
* @param [_object]
*/
get (url, params, _object = {}) {
return this.service.get(url, { params, ..._object }) return this.service.get(url, { params, ..._object })
} }
/* POST 方法 */ /**
// eslint-disable-next-line no-unreachable * POST 方法
post(url: string, params?: object, _object = {}): Promise<never> { * @param url
* @param [params]
* @param [_object]
*/
post (url, params, _object = {}) {
return this.service.post(url, params, _object) return this.service.post(url, params, _object)
} }
/* PUT 方法 */ /**
// eslint-disable-next-line no-unreachable * PUT 方法
put(url: string, params?: object, _object = {}): Promise<never> { * @param url
* @param [params]
* @param [_object]
*/
put (url, params, _object = {}) {
return this.service.put(url, params, _object) return this.service.put(url, params, _object)
} }
/* DELETE 方法 */ /**
// eslint-disable-next-line no-unreachable * DELETE 方法
delete(url: string, params?: never, _object = {}): Promise<never> { * @param url
* @param [params]
* @param [_object]
*/
delete (url, params, _object = {}) {
return this.service.delete(url, { params, ..._object }) return this.service.delete(url, { params, ..._object })
} }
} }
......
...@@ -3,6 +3,6 @@ import Http from '../http' ...@@ -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) return Http.post(url, data)
} }
...@@ -5,7 +5,7 @@ import Http from '../http' ...@@ -5,7 +5,7 @@ import Http from '../http'
* @param url * @param url
* @param data * @param data
*/ */
export const getLcInfo = function (url: string, data: object) { export const getLcInfo = function (url, data) {
return Http.get(url, data) return Http.get(url, data)
} }
...@@ -14,7 +14,7 @@ export const getLcInfo = function (url: string, data: object) { ...@@ -14,7 +14,7 @@ export const getLcInfo = function (url: string, data: object) {
* @param url * @param url
* @param data * @param data
*/ */
export const getConfigInfo = function (url: string, data: object) { export const getConfigInfo = function (url, data) {
return Http.get(url, data) return Http.get(url, data)
} }
...@@ -23,6 +23,6 @@ export const getConfigInfo = function (url: string, data: object) { ...@@ -23,6 +23,6 @@ export const getConfigInfo = function (url: string, data: object) {
* @param url * @param url
* @param data * @param data
*/ */
export const getZjDataFromDB = function (url: string, data: object) { export const getZjDataFromDB = function (url, data) {
return Http.get(url, data) return Http.get(url, data)
} }
...@@ -4,11 +4,11 @@ import Http from '../http' ...@@ -4,11 +4,11 @@ import Http from '../http'
* @param code 一个字符串,代表要获取的 JSON 文件的名称(不包含扩展名)。 * @param code 一个字符串,代表要获取的 JSON 文件的名称(不包含扩展名)。
* @returns 返回一个 Promise 对象,它解析为从指定路径加载的 JSON 数据。 * @returns 返回一个 Promise 对象,它解析为从指定路径加载的 JSON 数据。
*/ */
export const getJsonCode = function (code: string) { export const getJsonCode = function (code) {
// 使用 Http.get 方法请求指定路径的 JSON 数据 // 使用 Http.get 方法请求指定路径的 JSON 数据
return Http.get(`/src/data/${code}.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`) return Http.get(`/src/data/${url}.json`)
} }
import Http from '../http' import Http from '../http'
export const login = function (loginForm: any) { export const login = function (loginForm) {
return Http.post('/user/login', loginForm) return Http.post('/user/login', loginForm)
} }
//登录验证码 // 登录验证码
export const verificationImg = function () { export const verificationImg = function () {
return Http.get('/login/verificationImg') return Http.get('/login/verificationImg')
} }
//登录二维码 // 登录二维码
export const loginQrcode = function () { export const loginQrcode = function () {
return Http.get('/login/loginQrcode') return Http.get('/login/loginQrcode')
} }
......
...@@ -2,8 +2,6 @@ import { createApp } from 'vue' ...@@ -2,8 +2,6 @@ import { createApp } from 'vue'
import Router from './router' import Router from './router'
import Store from './store' import Store from './store'
import './style.css' import './style.css'
import Layui from '@layui/layui-vue'
import '@layui/layui-vue/lib/index.css'
import App from './App.vue' import App from './App.vue'
// 引入iconfont // 引入iconfont
...@@ -12,10 +10,8 @@ import '@/assets/iconfont/iconfont.css' ...@@ -12,10 +10,8 @@ import '@/assets/iconfont/iconfont.css'
const env = import.meta.env const env = import.meta.env
const app = createApp(App) const app = createApp(App)
app.use(Store) app.use(Store)
app.use(Router) app.use(Router)
app.use(Layui)
app.mount('#app') app.mount('#app')
import { createRouter, createWebHashHistory, NavigationGuardNext, RouteLocationNormalized } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import routes from './module/basicRoutes' import routes from './module/basicRoutes'
const router = createRouter({ const router = createRouter({
...@@ -16,7 +16,7 @@ const router = createRouter({ ...@@ -16,7 +16,7 @@ const router = createRouter({
* @param to 目标 * @param to 目标
* @param from 来至 * @param from 来至
*/ */
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => { router.beforeEach((to, from, next) => {
if (to.meta.requireAuth) { if (to.meta.requireAuth) {
next() next()
} else if (to.matched.length === 0) { } else if (to.matched.length === 0) {
......
/** /**
* 获取数据差异 * 获取数据差异
* *
* @param arr1 数组 * @param {any[]} arr1 数组
* @param arr2 数组 * @param {any[]} arr2 数组
*/ */
const diff = function (arr1: any[], arr2: any[]) { const diff = function (arr1, arr2) {
arr1 = Array.from(new Set(arr1)) arr1 = Array.from(new Set(arr1))
arr2 = Array.from(new Set(arr2)) arr2 = Array.from(new Set(arr2))
const mergeArr = arr1.concat(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 export default emitter
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @param list 集合 * @param list 集合
* @param id 节点编号 * @param id 节点编号
*/ */
export const getNode = function (list: any[], id: string): any { export const getNode = function (list, id) {
for (const i in list) { for (const i in list) {
const item = list[i] const item = list[i]
if (item.id === id) { if (item.id === id) {
...@@ -26,7 +26,7 @@ export const getNode = function (list: any[], id: string): any { ...@@ -26,7 +26,7 @@ export const getNode = function (list: any[], id: string): any {
* @param list 集合 * @param list 集合
* @param id 节点编号 * @param id 节点编号
*/ */
export const getParents = function (list: any[], id: string): any { export const getParents = function (list, id) {
for (const i in list) { for (const i in list) {
if (list[i].id === id) { if (list[i].id === id) {
return [list[i]] return [list[i]]
......
...@@ -7,12 +7,20 @@ ...@@ -7,12 +7,20 @@
> >
<template #extra> <template #extra>
<lay-button>刷新</lay-button> <lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button> <lay-button type="primary">
返回
</lay-button>
</template> </template>
</lay-exception> </lay-exception>
</lay-card> </lay-card>
</template> </template>
<script setup>
defineOptions({
name: '401Page'
})
</script>
<style> <style>
.error-page { .error-page {
padding-top: 200px; padding-top: 200px;
......
...@@ -7,12 +7,20 @@ ...@@ -7,12 +7,20 @@
> >
<template #extra> <template #extra>
<lay-button>刷新</lay-button> <lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button> <lay-button type="primary">
返回
</lay-button>
</template> </template>
</lay-exception> </lay-exception>
</lay-card> </lay-card>
</template> </template>
<script setup>
defineOptions({
name: '403Page'
})
</script>
<style> <style>
.error-page { .error-page {
padding-top: 200px; padding-top: 200px;
......
...@@ -7,12 +7,20 @@ ...@@ -7,12 +7,20 @@
> >
<template #extra> <template #extra>
<lay-button>刷新</lay-button> <lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button> <lay-button type="primary">
返回
</lay-button>
</template> </template>
</lay-exception> </lay-exception>
</lay-card> </lay-card>
</template> </template>
<script setup>
defineOptions({
name: '404Page'
})
</script>
<style> <style>
.error-page { .error-page {
padding-top: 200px; padding-top: 200px;
......
...@@ -7,12 +7,20 @@ ...@@ -7,12 +7,20 @@
> >
<template #extra> <template #extra>
<lay-button>刷新</lay-button> <lay-button>刷新</lay-button>
<lay-button type="primary">返回</lay-button> <lay-button type="primary">
返回
</lay-button>
</template> </template>
</lay-exception> </lay-exception>
</lay-card> </lay-card>
</template> </template>
<script setup>
defineOptions({
name: '500Page'
})
</script>
<style> <style>
.error-page { .error-page {
padding-top: 200px; 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 { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' 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' import path from 'path'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ 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: { resolve: {
alias: { alias: {
'@': path.resolve(__dirname, 'src') '@': path.resolve(__dirname, 'src')
} }
}, },
css: {
preprocessorOptions: {
scss: { charset: false },
less: {
javascriptEnabled: true
}
}
},
server: { server: {
port: 3000, port: 3000,
cors: true, cors: true,
proxy: {} proxy: {}
}, },
build: {
outDir: path.resolve(__dirname, '../dist')
},
envDir: path.resolve(__dirname, 'env') envDir: path.resolve(__dirname, 'env')
}) })
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论