Commit eb83ea77 authored by wxk's avatar wxk

登录页面接口ok

parent 33f4b64c
......@@ -10,7 +10,16 @@ module.exports = {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
proxyTable: {
'/asset_monitor': {
target: 'http://47.91.221.203:46656', // 接口的域名
// secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: {
'^/api': ''
}
}
},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
......
......@@ -3,19 +3,32 @@
<span class="title">机器人监控</span>
<div class="contain">
<span class="username">{{username}}</span>
<span class="loginout">退出</span>
<span class="loginout" @click="exitLogin">退出</span>
</div>
</div>
</template>
<script>
export default {
name: "pre-header",
data(){
return{
username: 'wxk@33.cn',
username: localStorage.getItem("username"),
}
},
methods: {
//退出登录
exitLogin(){
this.$router.push({
path: '/'
});
this.$notify({
title: '提示',
message: "退出成功",
type: 'success',
duration:'2000',
});
}
}
}
</script>
......
const baseUrl = "/asset_monitor";
const Api = {
Login: baseUrl + "/login",//登录
Register: baseUrl + "/register",//注册
ResetPassword: baseUrl + "/resetPassword",//重置密码
SendEmailVcode: baseUrl + "/sendEmailVcode",//发送验证码
GetMatchRobots: baseUrl + "/accountlist",//获取符合条件的机器人
GetRobotStatus: baseUrl + "/robotStatus",//机器人预警状态查询
GetPlatformInfo: baseUrl + "/platform",//交易所及匹配的交易对、目标币信息查询
}
export default Api;
......@@ -11,7 +11,7 @@
</div>
<div class="groupcom inputpwd">
<i class="iicon pwd"></i>
<input type="password" placeholder="请输入密码" class="usercom" v-model="loginBody.password" @keyup.enter="login('/login')">
<input type="password" placeholder="请输入密码" class="usercom" v-model="loginBody.password" @keyup.enter="Login">
</div>
<div class="ground">
<span class="ground-right">
......@@ -22,7 +22,7 @@
<input type="checkbox" name="记住用户密码" class="rember" v-model="isSaveLoginInfo">
<span>记住用户名</span>
</div>
<el-button type="primary" class="loginget" @click="login('/login')">立刻登录</el-button>
<el-button type="primary" class="loginget" @click="Login">立刻登录</el-button>
</div>
</div>
<!-- 注册 -->
......@@ -44,7 +44,7 @@
<div class="inputyzm inputpwd">
<i class="iicon pwd"></i>
<input type="text" placeholder="请输入验证码" class="usercomyzm" v-model="regist_yzm">
<el-button type="primary" class="getyzm" @click="getYZM('/sendEmailVcode')" :disabled='!show'>
<el-button type="primary" class="getyzm" @click="getYZM('regist')" :disabled='!show'>
<span v-show = "show">获取验证码</span>
<span v-show = "!show" class="count">还剩下{{count}} s</span>
</el-button>
......@@ -55,7 +55,7 @@
<span @click="goShowPanel(1)" class="bluepoint">马上登录</span>
</span>
</div>
<el-button type="primary" class="loginget" @click="registered('/register')">立刻注册</el-button>
<el-button type="primary" class="loginget" @click="registered">立刻注册</el-button>
</div>
</div>
<!-- 找回密码 -->
......@@ -69,7 +69,7 @@
<div class="inputyzm inputpwd">
<i class="iicon pwd"></i>
<input type="text" placeholder="请输入验证码" class="usercomyzm" v-model="forget_yzm">
<el-button type="primary" class="getyzm" @click="getYZM2('/sendEmailVcode')" :disabled='!show'>
<el-button type="primary" class="getyzm" @click="getYZM('forgetpassword')" :disabled='!show'>
<span v-show = "show">获取验证码</span>
<span v-show = "!show" class="count">还剩下{{count}} s</span>
</el-button>
......@@ -88,7 +88,7 @@
<span @click="goShowPanel(1)" class="bluepoint">马上登录</span>
</span>
</div>
<el-button type="primary" class="loginget" @click="forgetpassword('/resetPassword')">找回密码</el-button>
<el-button type="primary" class="loginget" @click="forgetpassword">找回密码</el-button>
</div>
</div>
</div>
......@@ -99,7 +99,7 @@ const regEmail2 = /^[a-z0-9]+([._\\-]*[a-z0-9])*@disanbo.com+$/;
const regPwd = /[a-zA-Z0-9_]{8,16}/;
const TIME_COUNT = 60;
import axios from 'axios';
// import api from "../api";
import ApiConfig from "../config/api-config";
export default {
data(){
return {
......@@ -137,9 +137,10 @@ export default {
this.isSaveLoginInfo = '';
this.show = true;
},
//注册获取验证码
getYZM(url){
if(this.regist_email == '' || !(regEmail.test(this.regist_email) || regEmail2.test(this.regist_email))){
//获取验证码
getYZM(type){
const Email = type === 'regist' ? this.regist_email : this.forget_email;
if(Email == '' || !(regEmail.test(Email) || regEmail2.test(Email))){
this.$notify({
title: '提示',
message: "请输入正确的邮箱",
......@@ -160,8 +161,8 @@ export default {
this.timer = null;
}
}, 1000)
axios.post(api.config.URL+url,{"user":this.regist_email}).then(res => {
console.log(res)
axios.post(ApiConfig.SendEmailVcode,{"user":Email}).then(res => {
// console.log(res)
if(res.status == 200&& res.data == "emailsend success"){//发送成功并且注册成功
this.$notify({
title: '提示',
......@@ -189,7 +190,7 @@ export default {
});
},
//找回密码获取验证码
getYZM2(url){
/* getYZM2(){
if(this.forget_email == '' || ! (regEmail.test(this.forget_email) || regEmail2.test(this.forget_email))){
this.$notify({
title: '提示',
......@@ -211,7 +212,7 @@ export default {
this.timer = null;
}
}, 1000)
axios.post(api.config.URL+url,{"user":this.forget_email}).then(res => {
axios.post(ApiConfig.SendEmailVcode,{"user":this.forget_email}).then(res => {
console.log(res)
if(res.status == 200&& res.data == "emailsend success"){//发送成功并且注册成功
this.$notify({
......@@ -238,9 +239,9 @@ export default {
duration:'2000',
});
});
},
},*/
//注册
registered(url){
registered(){
//console.log(this.regist_email)
//console.log(this.regist_password)
if(this.regist_password == '' || this.regist_rppassword == '' || this.regist_password!=this.regist_rppassword){//密码格式不对
......@@ -261,8 +262,8 @@ export default {
});
return;
}
axios.post(api.config.URL+url,{"user":this.regist_email,"password":this.regist_password,"emailvcode":this.regist_yzm}).then(res => {
console.log(res)
axios.post(ApiConfig.Register,{"user":this.regist_email,"password":this.regist_password,"emailvcode":this.regist_yzm}).then(res => {
// console.log(res)
if(res.data == 'register success'){
this.$notify({
title: '提示',
......@@ -294,7 +295,7 @@ export default {
})
},
//登录
login(url){
Login(){
if(this.loginBody.email==''||this.loginBody.password==''){
this.$notify({
title: '提示',
......@@ -304,10 +305,9 @@ export default {
});
return;
}
axios.post(api.config.URL+url,{"user":this.loginBody.email,"password":this.loginBody.password}).then(res => {
console.log(res)
axios.post(ApiConfig.Login,{"user":this.loginBody.email,"password":this.loginBody.password}).then(res => {
// console.log(res)
if(res.data == "login success"){
sessionStorage.setItem("login_success", 'hzyhbk');
this.$notify({
title: '提示',
message: "登陆成功",
......@@ -357,7 +357,7 @@ export default {
}
},
//找回密码
forgetpassword(url){
forgetpassword(){
//console.log(this.regist_email)
//console.log(this.regist_password)
if(this.forget_password == '' || this.forget_rppassword == ''){//密码格式不对
......@@ -387,8 +387,8 @@ export default {
});
return;
}
axios.post(api.config.URL+url,{"user":this.forget_email,"password":this.forget_password,"emailvcode":this.forget_yzm}).then(res => {
console.log(res)
axios.post(ApiConfig.ResetPassword,{"user":this.forget_email,"password":this.forget_password,"emailvcode":this.forget_yzm}).then(res => {
// console.log(res)
if(res.data == 'reset passwords success'){
this.$notify({
title: '提示',
......@@ -424,7 +424,8 @@ export default {
<style scoped>
.whole{
min-width: 1120px;
min-height: 100vh;
height: 100%;
min-height: 700px;
background: #7792A7;
}
.top-title{
......
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