init
这个提交包含在:
父节点
dbf220ad70
当前提交
a091e51f7e
38
im-admin/.eslintrc.json
普通文件
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
自动生成的
3508
im-admin/package-lock.json
自动生成的
文件差异内容过多而无法显示
加载差异
@ -11,12 +11,17 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"element-plus": "^2.3.9",
|
"element-plus": "^2.3.9",
|
||||||
"pinia": "^2.1.6",
|
"pinia": "^2.1.6",
|
||||||
|
"pinia-plugin-persist": "^1.0.0",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-router": "^4.0.13"
|
"vue-router": "^4.0.13"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.0",
|
"@types/node": "^20.5.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
||||||
|
"@typescript-eslint/parser": "^6.4.0",
|
||||||
"@vitejs/plugin-vue": "^4.2.3",
|
"@vitejs/plugin-vue": "^4.2.3",
|
||||||
|
"eslint": "^8.47.0",
|
||||||
|
"eslint-plugin-vue": "^9.17.0",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2",
|
||||||
"vite": "^4.4.5",
|
"vite": "^4.4.5",
|
||||||
"vue-tsc": "^1.8.5"
|
"vue-tsc": "^1.8.5"
|
||||||
|
|||||||
@ -1,14 +1,24 @@
|
|||||||
import { createApp } from 'vue'
|
import {createApp} from "vue";
|
||||||
import { createPinia } from 'pinia'
|
import {createPinia} from "pinia";
|
||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from "element-plus";
|
||||||
import 'element-plus/dist/index.css'
|
import "element-plus/dist/index.css";
|
||||||
import App from './App.vue'
|
import App from "./App.vue";
|
||||||
import router from './router'
|
import router from "./router";
|
||||||
|
import piniaPersist from "pinia-plugin-persist";
|
||||||
|
import { useTenantStore } from "./store/useTenantStore";
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App);
|
||||||
const pinia = createPinia()
|
const pinia = createPinia();
|
||||||
|
pinia.use(piniaPersist);
|
||||||
|
|
||||||
app.use(ElementPlus)
|
|
||||||
app.use(pinia)
|
router.beforeEach((to) => {
|
||||||
app.use(router)
|
const tenant = useTenantStore(pinia);
|
||||||
app.mount('#app')
|
|
||||||
|
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 { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
|
||||||
import Home from '@/views/Home.vue'
|
import Home from "@/views/HomeView.vue";
|
||||||
|
import Login from "@/views/LoginView.vue";
|
||||||
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: "/",
|
||||||
component: Home
|
component: Home,
|
||||||
|
meta: {
|
||||||
|
requiresAuth: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
]
|
{
|
||||||
|
path: "/login",
|
||||||
|
component: Login
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
routes
|
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("--------------");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
1
im-admin/src/types/pinia-plugin-persist.d.ts
vendored
普通文件
1
im-admin/src/types/pinia-plugin-persist.d.ts
vendored
普通文件
@ -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>
|
|
||||||
18
im-admin/src/views/HomeView.vue
普通文件
18
im-admin/src/views/HomeView.vue
普通文件
@ -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>
|
||||||
15
im-admin/src/views/LoginView.vue
普通文件
15
im-admin/src/views/LoginView.vue
普通文件
@ -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",
|
"target": "ES2020",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": [
|
||||||
|
"ES2020",
|
||||||
|
"DOM",
|
||||||
|
"DOM.Iterable"
|
||||||
|
],
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
@ -13,10 +16,11 @@
|
|||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"],
|
"@/*": [
|
||||||
|
"src/*"
|
||||||
|
]
|
||||||
// "/@build/*": ["build/*"],
|
// "/@build/*": ["build/*"],
|
||||||
// "/#/*": ["types/*"],
|
// "/#/*": ["types/*"],
|
||||||
// "_pinia/*": ["src/pinia/*"]
|
// "_pinia/*": ["src/pinia/*"]
|
||||||
@ -25,8 +29,21 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"typeRoots": [
|
||||||
|
"./node_modules/@types",
|
||||||
|
"./src/types"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
"include": [
|
||||||
"references": [{ "path": "./tsconfig.node.json" }]
|
"src/**/*.ts",
|
||||||
|
"src/**/*.d.ts",
|
||||||
|
"src/**/*.tsx",
|
||||||
|
"src/**/*.vue"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.node.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,5 +6,7 @@
|
|||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": [
|
||||||
|
"vite.config.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户