这个提交包含在:
xuqm 2023-09-07 14:16:55 +08:00
父节点 dbf220ad70
当前提交 a091e51f7e
共有 12 个文件被更改,包括 3164 次插入567 次删除

38
im-admin/.eslintrc.json 普通文件
查看文件

@ -0,0 +1,38 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:vue/vue3-essential"
],
"parserOptions": {
"ecmaVersion": "latest",
"parser": "@typescript-eslint/parser",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"vue"
],
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"windows"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
}

3508
im-admin/package-lock.json 自动生成的

文件差异内容过多而无法显示 加载差异

查看文件

@ -11,12 +11,17 @@
"dependencies": {
"element-plus": "^2.3.9",
"pinia": "^2.1.6",
"pinia-plugin-persist": "^1.0.0",
"vue": "^3.3.4",
"vue-router": "^4.0.13"
},
"devDependencies": {
"@types/node": "^20.5.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@vitejs/plugin-vue": "^4.2.3",
"eslint": "^8.47.0",
"eslint-plugin-vue": "^9.17.0",
"typescript": "^5.0.2",
"vite": "^4.4.5",
"vue-tsc": "^1.8.5"

查看文件

@ -1,14 +1,24 @@
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import {createApp} from "vue";
import {createPinia} from "pinia";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import App from "./App.vue";
import router from "./router";
import piniaPersist from "pinia-plugin-persist";
import { useTenantStore } from "./store/useTenantStore";
const app = createApp(App)
const pinia = createPinia()
const app = createApp(App);
const pinia = createPinia();
pinia.use(piniaPersist);
app.use(ElementPlus)
app.use(pinia)
app.use(router)
app.mount('#app')
router.beforeEach((to) => {
const tenant = useTenantStore(pinia);
if (to.meta.requiresAuth && !tenant.isLogin) return "/login";
});
app.use(ElementPlus);
app.use(pinia);
app.use(router);
app.mount("#app");

查看文件

@ -1,16 +1,24 @@
import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
import Home from '@/views/Home.vue'
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Home from "@/views/HomeView.vue";
import Login from "@/views/LoginView.vue";
const routes: Array<RouteRecordRaw> = [
{
path: '/',
component: Home
path: "/",
component: Home,
meta: {
requiresAuth: true
}
},
]
{
path: "/login",
component: Login
},
];
const router = createRouter({
history: createWebHistory(),
routes
})
});
export default router
export default router;

查看文件

@ -0,0 +1,28 @@
import {defineStore} from "pinia";
export const useTenantStore = defineStore("tenant", {
state: () => ({
tenantNo: "",
tenantName: "",
updateTime: new Date()
}),
getters: {
isLogin: (state) => state.tenantNo !== "" && state.tenantName !== ""
},
persist: {
enabled: true
},
actions: {
login() {
this.tenantNo = "123456";
this.tenantName = "123456";
this.updateTime = new Date();
},
logout() {
this.tenantNo = "";
this.tenantName = "";
this.updateTime = new Date();
console.log("--------------");
}
},
});

查看文件

@ -0,0 +1 @@
declare module "@/types/pinia-plugin-persist";

查看文件

@ -1,13 +0,0 @@
<script setup lang="ts">
</script>
<template>
<div>
<el-button>中文</el-button>
</div>
</template>
<style scoped>
</style>

查看文件

@ -0,0 +1,18 @@
<script setup lang="ts">
import { useTenantStore } from "@/store/useTenantStore.js";
const tenant = useTenantStore();
</script>
<template>
<div>
<el-button
@click="tenant.logout"
>注销</el-button
>
</div>
</template>
<style scoped>
</style>

查看文件

@ -0,0 +1,15 @@
<template>
<div>
<el-button @click="tenant.login">登录</el-button>
<div>{{ tenant.tenantName }}</div>
</div>
</template>
<script setup lang="ts">
import { useTenantStore } from "@/store/useTenantStore.js";
const tenant = useTenantStore();
</script>
<style scoped></style>

查看文件

@ -3,9 +3,12 @@
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
@ -13,20 +16,34 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
// "/@build/*": ["build/*"],
// "/#/*": ["types/*"],
// "_pinia/*": ["src/pinia/*"]
"@/*": [
"src/*"
]
// "/@build/*": ["build/*"],
// "/#/*": ["types/*"],
// "_pinia/*": ["src/pinia/*"]
},
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"typeRoots": [
"./node_modules/@types",
"./src/types"
]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

查看文件

@ -6,5 +6,7 @@
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
"include": [
"vite.config.ts"
]
}