Commit 81f9ddd6 authored by 刘洪铨's avatar 刘洪铨

登录

parent 7a35ed48
...@@ -11,7 +11,7 @@ export function login(username, password, code, uuid) { ...@@ -11,7 +11,7 @@ export function login(username, password, code, uuid) {
return request({ return request({
url: '/auth/login', url: '/auth/login',
method: 'post', method: 'post',
data: data, params: data,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
......
...@@ -42,8 +42,8 @@ const user = { ...@@ -42,8 +42,8 @@ const user = {
// const uuid = userInfo.uuid // const uuid = userInfo.uuid
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password).then(res => { login(username, password).then(res => {
setToken(res.token) setToken(res.data)
commit('SET_TOKEN', res.token) commit('SET_TOKEN', res.data)
resolve() resolve()
}).catch(error => { }).catch(error => {
reject(error) reject(error)
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
> >
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input> </el-input>
<div class="login-code"> <!--<div class="login-code">
<img :src="codeUrl" @click="getCode"> <img :src="codeUrl" @click="getCode">
</div> </div>-->
</el-form-item> </el-form-item>
<el-form-item style="width:80%;margin-bottom: 20px"> <el-form-item style="width:80%;margin-bottom: 20px">
<el-button <el-button
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</template> </template>
<script> <script>
import { getCodeImg } from '@/api/login' // import { getCodeImg } from '@/api/login'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import { encrypt, decrypt } from '@/utils/jsencrypt' import { encrypt, decrypt } from '@/utils/jsencrypt'
...@@ -77,8 +77,8 @@ export default { ...@@ -77,8 +77,8 @@ export default {
codeUrl: '', codeUrl: '',
cookiePassword: '', cookiePassword: '',
loginForm: { loginForm: {
username: 'admin', username: 'guanliyuan',
password: 'admin123', password: '123456',
rememberMe: false, rememberMe: false,
code: '', code: '',
uuid: '' uuid: ''
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
} }
}, },
created() { created() {
this.getCode() // this.getCode()
this.getCookie() this.getCookie()
}, },
methods: { methods: {
...@@ -106,12 +106,12 @@ export default { ...@@ -106,12 +106,12 @@ export default {
query: this.$route.query query: this.$route.query
}) })
}, },
getCode() { /* getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {
this.codeUrl = 'data:image/gif;base64,' + res.img this.codeUrl = 'data:image/gif;base64,' + res.img
this.loginForm.uuid = res.uuid this.loginForm.uuid = res.uuid
}) })
}, },*/
getCookie() { getCookie() {
const username = Cookies.get('username') const username = Cookies.get('username')
const password = Cookies.get('password') const password = Cookies.get('password')
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
}) })
.catch(() => { .catch(() => {
this.loading = false this.loading = false
this.getCode() // this.getCode()
}) })
} }
}) })
...@@ -213,7 +213,7 @@ export default { ...@@ -213,7 +213,7 @@ export default {
width: 26.8vw; width: 26.8vw;
height: 40px; height: 40px;
border-radius: 4px; border-radius: 4px;
font-size: 18px; font-size: 18px;
} }
} }
.el-input { .el-input {
...@@ -255,10 +255,10 @@ export default { ...@@ -255,10 +255,10 @@ export default {
letter-spacing: 1px; letter-spacing: 1px;
} }
.buttons-content{ .buttons-content{
display: flex; display: flex;
width: 80%; width: 80%;
justify-content: space-between; justify-content: space-between;
padding: 0 14px; padding: 0 14px;
.rem-code span{ .rem-code span{
color: $font-dark; color: $font-dark;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment