logo.vue
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<template>
<div class="logo">
<div class="logo-box">
<div class="img">
<img src="../assets/logo.png" class="img-box" alt="" />
</div>
<div class="yong-ping">
<div class="box-cont">
<div class="title">智慧数字物流管理平台</div>
<div class="shouji">
<div class="shoujivv">手机号</div>
<div class="shouinput">
<img src="../assets/Icon.png" class="iphone-img" alt="" />
<input
type="number"
placeholder="请输入手机号"
class="iphontiphone"
v-model="name"
/>
</div>
</div>
<div class="shouji">
<div class="shoujivv">密码</div>
<div class="shouinput">
<img src="../assets/Icon_1.png" class="iphone-img" alt="" />
<input
type="password"
placeholder="请输入密码"
class="iphontiphone"
v-model="pass"
/>
</div>
</div>
<div class="shouji">
<div class="shoujivv">验证码</div>
<div class="yanzheng">
<div class="shouinputt">
<img src="../assets/Icon_2.png" class="iphone-img" alt="" />
<input
type="text"
placeholder="请输入验证码"
class="iphontiphonet"
v-model="code"
/>
</div>
<img :src="imgs" class="yan-img" alt="" @click="qie" />
</div>
</div>
<div class="btna" @click="btn">登录</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
imgs: "",
uuid: "",
code: "",
name: "",
pass: "",
};
},
methods() {},
created() {
this.codes();
},
methods: {
//登录
btn() {
let that = this;
var url = "/api/auth/login";
let params = {
code: that.code,
password: that.pass,
username: that.name,
uuid: that.uuid,
};
that.$axios
.post(url, params)
.then(function (res) {
console.log(res);
that.$message({
message: "登录成功",
type: "success",
});
setTimeout(function () {
that.$router.push("./home");
}, 800);
sessionStorage.setItem("token", res.data.access_token);
})
.catch(function (err) {
console.log(err);
that.$message.error(err.msg)
that.codes();
});
},
//切换验证码
qie() {
this.codes();
},
//获取验证码接口
codes() {
let that = this;
var url = "/api/code";
let params = {};
that.$axios
.get(url)
.then(function (res) {
console.log(res)
that.imgs = "data:image/png;base64," + res.img;
that.uuid = res.uuid;
})
.catch(function (err) {
console.log(err);
});
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
@import "../css/logo.css";
</style>