first commit
commit
eee91e0792
|
@ -0,0 +1,23 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
|
@ -0,0 +1,19 @@
|
|||
# ProjectManagement
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "ProjectManagement",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons": "^0.0.11",
|
||||
"axios": "^0.24.0",
|
||||
"core-js": "^3.6.5",
|
||||
"element-plus": "^1.2.0-beta.5",
|
||||
"moment": "^2.29.1",
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.0-0",
|
||||
"vuex": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-router": "~4.5.0",
|
||||
"@vue/cli-plugin-typescript": "~4.5.0",
|
||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"@vue/compiler-sfc": "^3.0.0",
|
||||
"sass": "^1.27.0",
|
||||
"sass-loader": "^10.0.4",
|
||||
"typescript": "~4.1.5",
|
||||
"vue-cli-plugin-element-plus": "~0.0.13"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>logo.ico">
|
||||
<title>项目管理系统</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,27 @@
|
|||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#app {
|
||||
height:100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
html{
|
||||
height:100%;
|
||||
max-height: 100%;
|
||||
|
||||
}
|
||||
body{
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
Write your variables here. All available variables can be
|
||||
found in element-plus/packages/theme-chalk/src/common/var.scss.
|
||||
For example, to overwrite the theme color:
|
||||
*/
|
||||
$--color-primary: hotpink;
|
||||
|
||||
/* icon font path, required */
|
||||
$--font-path: '~element-plus/lib/theme-chalk/fonts';
|
||||
|
||||
@import "~element-plus/packages/theme-chalk/src/index";
|
|
@ -0,0 +1,9 @@
|
|||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(ElementPlus, {locale: zhCn,}).use(router).mount('#app')
|
|
@ -0,0 +1,11 @@
|
|||
import ElementPlus from 'element-plus'
|
||||
import '../element-variables.scss'
|
||||
import locale from 'element-plus/lib/locale/lang/zh-cn'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
|
||||
export default (app) => {
|
||||
//app.use(ElementPlus, { locale })
|
||||
app.use(ElementPlus, {
|
||||
locale: zhCn,
|
||||
})
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import Home from '@/views/Home.vue'
|
||||
import {createWebHistory} from "vue-router/dist/vue-router.esm-browser"
|
||||
import Login from "@/views/Login.vue"
|
||||
import Project from "@/views/Project.vue";
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: Home,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: Project,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: Login,
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
|
@ -0,0 +1,6 @@
|
|||
/* eslint-disable */
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import { createStore } from 'vuex'
|
||||
|
||||
const store = createStore({
|
||||
state () {
|
||||
return {
|
||||
token: ''
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setToken(state,value) {
|
||||
state.token = value
|
||||
},
|
||||
clearToken(state) {
|
||||
state.token = ''
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
export default store
|
|
@ -0,0 +1,3 @@
|
|||
const baseUrl = "http://localhost:8090/"
|
||||
//const baseUrl = "http://192.168.31.113:8090/"
|
||||
export default baseUrl;
|
|
@ -0,0 +1,46 @@
|
|||
import router from '@/router'
|
||||
import baseUrl from "@/utils/baseUrl"
|
||||
const axios = require('axios').default
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: baseUrl,
|
||||
timeout: 5000,
|
||||
})
|
||||
request.interceptors.request.use(
|
||||
config => {
|
||||
console.log(config)
|
||||
if (localStorage.getItem('token')) {
|
||||
config.headers.token = localStorage.getItem('token')
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error)
|
||||
})
|
||||
request.interceptors.response.use(
|
||||
function (response) {
|
||||
// 2xx 范围内的状态码都会触发该函数。
|
||||
console.log("success")
|
||||
if(localStorage.getItem('expire'))
|
||||
{
|
||||
let time = new Date().getTime() - Number(localStorage.getItem('expire'))
|
||||
if(time > 30*60*1000)
|
||||
{
|
||||
request({
|
||||
url: '/api/refreshToken',
|
||||
method: 'get',
|
||||
}).then(response => {
|
||||
console.log(response.data)
|
||||
localStorage.setItem('token', response.data)
|
||||
localStorage.setItem('expire', new Date().getTime().toString())
|
||||
})
|
||||
}
|
||||
}
|
||||
return response
|
||||
}, function (error) {
|
||||
console.log( error.response.status)
|
||||
//if(error.response.status===403)
|
||||
//router.push({path: '/login'})
|
||||
return Promise.reject(error)
|
||||
});
|
||||
export default request
|
|
@ -0,0 +1,41 @@
|
|||
<template>
|
||||
<div class="home">
|
||||
<div>项目管理</div>
|
||||
<router-view></router-view>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
</script>
|
||||
<script>
|
||||
// @ is an alias to /src
|
||||
|
||||
import request from "@/utils/request";
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Home',
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.home {
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -0,0 +1,92 @@
|
|||
<template>
|
||||
|
||||
<el-form class="login-box" ref="formRef" :model="loginForm" label-width="auto">
|
||||
<h3 class="login-title">登录</h3>
|
||||
<el-form-item>
|
||||
<el-input v-model="loginForm.username" placeholder="用户名" :prefix-icon="User"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input v-model="loginForm.password" placeholder="密码" :prefix-icon="Key"
|
||||
type="password" show-password></el-input>
|
||||
</el-form-item>
|
||||
<el-alert v-if="showAlert" title="用户名或密码错误" type="error" show-icon @close="showAlert=false" style="margin-bottom: 16px"> </el-alert>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import {User, Key} from '@element-plus/icons'
|
||||
import {reactive, ref} from 'vue'
|
||||
import request from '@/utils/request'
|
||||
import router from '@/router'
|
||||
import baseUrl from "@/utils/baseUrl";
|
||||
|
||||
const axios = require("axios");
|
||||
|
||||
const showAlert = ref(false)
|
||||
|
||||
const loginForm = reactive({
|
||||
username: '',
|
||||
password: ''
|
||||
})
|
||||
console.log(localStorage.getItem('token'))
|
||||
|
||||
const onSubmit = () => {
|
||||
let param = new FormData()
|
||||
param.append('id', loginForm.username.trim())
|
||||
param.append('password', loginForm.password.trim())
|
||||
axios.post(baseUrl+'api/login', param).then(function (response) {
|
||||
if (response.data === 'error') {
|
||||
console.log(response.data)
|
||||
showAlert.value=true
|
||||
} else {
|
||||
localStorage.setItem('seller_id', param.get('id'))
|
||||
localStorage.setItem('token', response.data)
|
||||
localStorage.setItem('expire', new Date().getTime().toString())
|
||||
if(param.get('id')==='admin')
|
||||
router.push({path: '/TrainManage'})
|
||||
else
|
||||
router.push({path: '/'})
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
export default {
|
||||
name: "Login",
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
border: 1px solid #DCDFE6;
|
||||
width: 350px;
|
||||
margin: 180px auto;
|
||||
padding: 35px 35px 15px 35px;
|
||||
border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
box-shadow: 0 0 25px #909399;
|
||||
}
|
||||
.el-form-item__content{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
text-align: center;
|
||||
margin: 0 auto 40px auto;
|
||||
color: #303133;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,34 @@
|
|||
<template>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import moment from "moment";
|
||||
import axios from "axios";
|
||||
import baseUrl from "@/utils/baseUrl";
|
||||
import router from "@/router";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
export default {
|
||||
name: "Project",
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"importHelpers": true,
|
||||
"moduleResolution": "node",
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"types": [
|
||||
"webpack-env"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"tests/**/*.ts",
|
||||
"tests/**/*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue