11.00
This commit is contained in:
parent
d5955c0f71
commit
3c909ab7a5
1014
package-lock.json
generated
1014
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,12 +9,16 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.6.8",
|
||||
"element-plus": "^2.7.0",
|
||||
"vue": "^3.4.21",
|
||||
"vue-router": "^4.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.12.7",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"unplugin-auto-import": "^0.17.5",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^5.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
10
src/api/login.js
Normal file
10
src/api/login.js
Normal file
@ -0,0 +1,10 @@
|
||||
import request from './request'
|
||||
|
||||
// 用户登陆接口
|
||||
export function userLogin (query) {
|
||||
return request({
|
||||
url: 'http://192.168.1.107/api/login/account',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
13
src/api/request.js
Normal file
13
src/api/request.js
Normal file
@ -0,0 +1,13 @@
|
||||
import axios from 'axios'
|
||||
|
||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
const service = axios.create({
|
||||
baseURL: 'http://192.168.1.107:8052',
|
||||
timeout: 60000
|
||||
})
|
||||
|
||||
service.interceptors.response.use(res => {
|
||||
return res.data
|
||||
})
|
||||
|
||||
export default service
|
||||
BIN
src/assets/login.jpg
Normal file
BIN
src/assets/login.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
@ -2,7 +2,10 @@ import { createApp } from 'vue'
|
||||
// import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './/router'
|
||||
import ElementPlus from 'element-plus';
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
const app= createApp(App)
|
||||
app.use(router)
|
||||
app.use(ElementPlus);
|
||||
app.mount('#app')
|
||||
|
||||
@ -16,6 +16,7 @@ const routes = [
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const router = createRouter({
|
||||
routes,
|
||||
history:createWebHistory()
|
||||
|
||||
@ -1,13 +1,201 @@
|
||||
<template>
|
||||
<div>11</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<div class="loginbody">
|
||||
<div class="logindata">
|
||||
<div class="logintext">
|
||||
<h2>{{ create ? '注册' : '登陆' }}</h2>
|
||||
</div>
|
||||
<div class="formdata">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="form.username"
|
||||
clearable
|
||||
placeholder="请输入账号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="form.password"
|
||||
clearable
|
||||
placeholder="请输入密码"
|
||||
show-password
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="repassword" v-if="create">
|
||||
<el-input
|
||||
v-model="form.repassword"
|
||||
clearable
|
||||
placeholder="请重复密码"
|
||||
show-password
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="tool">
|
||||
<div>
|
||||
<el-checkbox v-model="checked" @change="remenber" v-if="!create"
|
||||
>记住密码</el-checkbox
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<span class="shou" @click="forgetpas" v-if="!create">忘记密码?</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="butt">
|
||||
<el-button type="primary" @click="login"
|
||||
>{{ create ? '注册' : '登陆' }}</el-button
|
||||
>
|
||||
<el-button class="shou" @click="register">{{ create ? '返回' : '注册' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userLogin } from '../api/login'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
create: false,
|
||||
form: {
|
||||
password: '',
|
||||
username: '',
|
||||
repassword: ''
|
||||
},
|
||||
query: {
|
||||
code: '',
|
||||
account: 'ddmt',
|
||||
password: '000000',
|
||||
scene: '1',
|
||||
terminal: '4'
|
||||
},
|
||||
checked: false,
|
||||
rules: {
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
||||
{ max: 10, message: '不能大于10个字符', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ max: 10, message: '不能大于10个字符', trigger: 'blur' }
|
||||
],
|
||||
repassword: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ max: 10, message: '不能大于10个字符', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (localStorage.getItem('news')) {
|
||||
this.form = JSON.parse(localStorage.getItem('news'))
|
||||
this.checked = true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login () {
|
||||
if (this.form.username === '' || this.form.password === '') {
|
||||
this.$message.error('账号或密码不能为空')
|
||||
} else {
|
||||
// this.$router.push('/index')
|
||||
this.query.account = this.form.username
|
||||
this.query.password = this.form.password
|
||||
userLogin(this.query).then(response => {
|
||||
console.log(response)
|
||||
this.$message({
|
||||
message: response.msg,
|
||||
type: 'success'
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
remenber (data) {
|
||||
this.checked = data
|
||||
if (this.checked) {
|
||||
localStorage.setItem('news', JSON.stringify(this.form))
|
||||
} else {
|
||||
localStorage.removeItem('news')
|
||||
}
|
||||
},
|
||||
forgetpas () {
|
||||
this.$message({
|
||||
message: '请联系管理员更改密码',
|
||||
type: 'warning'
|
||||
})
|
||||
},
|
||||
register () {
|
||||
this.create = !this.create
|
||||
this.$refs.form.clearValidate('username')
|
||||
this.$refs.form.clearValidate('password')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.loginbody {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 1000px;
|
||||
background-image: url("../assets/login.jpg");
|
||||
background-size: 100% 100%;
|
||||
background-position: center center;
|
||||
overflow: auto;
|
||||
background-repeat: no-repeat;
|
||||
position: fixed;
|
||||
line-height: 100%;
|
||||
padding-top: 150px;
|
||||
}
|
||||
|
||||
.logintext {
|
||||
margin-bottom: 20px;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
font-weight: bolder;
|
||||
color: white;
|
||||
text-shadow: 2px 2px 4px #000000;
|
||||
}
|
||||
|
||||
.logindata {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.3);
|
||||
width: 400px;
|
||||
height: 300px;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
transform: translate(-50%);
|
||||
margin-left: 70%;
|
||||
}
|
||||
|
||||
.tool {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.butt {
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.shou {
|
||||
cursor: pointer;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/*ui*/
|
||||
/* /deep/ .el-form-item__label {
|
||||
font-weight: bolder;
|
||||
font-size: 15px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/deep/ .el-button {
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
|
||||
} */
|
||||
</style>
|
||||
|
||||
@ -1,7 +1,18 @@
|
||||
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 { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
plugins: [
|
||||
vue(),
|
||||
AutoImport({
|
||||
resolvers: [ElementPlusResolver()],
|
||||
}),
|
||||
Components({
|
||||
resolvers: [ElementPlusResolver()],
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user