|
|
|
@ -1,13 +1,21 @@ |
|
|
|
<template> |
|
|
|
<div class="header"> |
|
|
|
<div class="header_login"> |
|
|
|
<span> |
|
|
|
<template v-if="login_type==1"> |
|
|
|
您好,{{login_info.username}} |
|
|
|
<span class="header_login_span" @click="loginOut">退出登录</span> |
|
|
|
</template> |
|
|
|
</span> |
|
|
|
<div class="header_title"> |
|
|
|
<span v-if="login_type==0" @click="showLogin">用户登录</span> |
|
|
|
<span v-else @click="UserConsole(0,0)">交易平台首页</span> |
|
|
|
<span @click="UserConsole(1,0)">用户控制台</span> |
|
|
|
<span @click="UserConsole(1,0)" v-if="login_type==1">用户控制台</span> |
|
|
|
<span>联系客服</span> |
|
|
|
<span>帮助中心</span> |
|
|
|
<span>友情链接</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="header_content"> |
|
|
|
<img src="../../assets/img/header_logo.png" alt="" class="header_logo"> |
|
|
|
<div class="header_sidebar"> |
|
|
|
@ -24,19 +32,22 @@ |
|
|
|
</div> |
|
|
|
<el-dialog title="登录" :visible.sync="isshowLogin" width="30%" center> |
|
|
|
<el-form :model="param" :rules="rules" ref="login" label-width="0px" class="ms-content"> |
|
|
|
<el-form-item prop="username"> |
|
|
|
<el-input v-model="param.username" placeholder="username"> |
|
|
|
<el-form-item prop="phone"> |
|
|
|
<el-input v-model="param.phone" placeholder="请输入手机号码"> |
|
|
|
<el-button slot="prepend" icon="el-icon-user"></el-button> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="password"> |
|
|
|
<el-form-item prop="smscode"> |
|
|
|
<el-input |
|
|
|
type="password" |
|
|
|
placeholder="password" |
|
|
|
v-model="param.password" |
|
|
|
placeholder="请输入验证码 " |
|
|
|
v-model="param.smscode" |
|
|
|
@keyup.enter.native="submitForm()" |
|
|
|
> |
|
|
|
<el-button slot="prepend" icon="el-icon-lock"></el-button> |
|
|
|
<el-button slot="suffix" class="code_button" @click="sendSmsCode" :disabled="isVerCode"> |
|
|
|
<span v-if="!isVerCode">获取验证码</span> |
|
|
|
<span v-if="isVerCode">{{codeCount}}s</span> |
|
|
|
</el-button> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<div class="login-btn"> |
|
|
|
@ -48,7 +59,7 @@ |
|
|
|
|
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import {isOpenAccount} from '../../api/index' |
|
|
|
import {isOpenAccount,sendSmsCode,login} from '../../api/index' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@ -57,6 +68,7 @@ export default { |
|
|
|
login_type:0 , |
|
|
|
examine_type:0, |
|
|
|
examine_data:{}, |
|
|
|
sidebarListType:0, |
|
|
|
sidebarList:[ |
|
|
|
{name:'首页',url:'/index'}, |
|
|
|
// {name:'资产分类',url:'/AssetClassification'}, |
|
|
|
@ -67,18 +79,78 @@ export default { |
|
|
|
], |
|
|
|
isshowLogin:false, |
|
|
|
param:{ |
|
|
|
username: 'admin', |
|
|
|
password: '123123', |
|
|
|
phone: '', |
|
|
|
smscode: '', |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }], |
|
|
|
password: [{ required: true, message: '请输入密码', trigger: 'blur' }], |
|
|
|
phone: [{ required: true, message: '请输入手机号码', trigger: 'blur' }], |
|
|
|
smscode: [{ required: true, message: '请输入验证码', trigger: 'blur' }], |
|
|
|
}, |
|
|
|
isVerCode:false, |
|
|
|
codeCount:600, |
|
|
|
login_info:'' |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
loginOut(){ |
|
|
|
localStorage.removeItem('login_info') |
|
|
|
location.reload() |
|
|
|
}, |
|
|
|
submitForm(){ |
|
|
|
this.$refs['login'].validate(valid=>{ |
|
|
|
if (valid) { |
|
|
|
login(this.param).then(res=>{ |
|
|
|
console.info(res); |
|
|
|
if (res.code==200) { |
|
|
|
localStorage.setItem('login_info',JSON.stringify(res.data)) |
|
|
|
this.$message.success('登录成功~') |
|
|
|
this.isshowLogin=false, |
|
|
|
this.login_info=res.data; |
|
|
|
this.login_type=1 |
|
|
|
localStorage.setItem('login_type',this.login_type) |
|
|
|
}else{ |
|
|
|
this.$message.error(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//获取验证码 |
|
|
|
sendSmsCode(){ |
|
|
|
//axios请求 |
|
|
|
if (this.param.phone=='') { |
|
|
|
this.$message.error('请输入手机号码~') |
|
|
|
return false |
|
|
|
} |
|
|
|
sendSmsCode(this.param).then(res=>{ |
|
|
|
console.info(res); |
|
|
|
if (res.code==101) { |
|
|
|
this.$message.error(res.msg) |
|
|
|
return false |
|
|
|
}else{ |
|
|
|
this.$message.success(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
// 验证码倒计时 |
|
|
|
if (!this.timer) { |
|
|
|
this.codeCount = 600; |
|
|
|
this.isVerCode = true; |
|
|
|
this.timer = setInterval(() => { |
|
|
|
if (this.codeCount > 0 && this.codeCount <= 600) { |
|
|
|
this.codeCount--; |
|
|
|
} else { |
|
|
|
this.isVerCode = false; |
|
|
|
clearInterval(this.timer); |
|
|
|
this.timer = null; |
|
|
|
} |
|
|
|
}, 1000); |
|
|
|
} |
|
|
|
}, |
|
|
|
isOpenAccount(){ |
|
|
|
let data={user_id:10} |
|
|
|
if (this.sidebarListType==0) { |
|
|
|
return false |
|
|
|
} |
|
|
|
let data={user_id:this.login_info.id} |
|
|
|
// let data={user_id:8} |
|
|
|
isOpenAccount(data).then(res => { |
|
|
|
console.info(res) |
|
|
|
@ -115,17 +187,15 @@ export default { |
|
|
|
this.goPage(this.sidebarList[index].url) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
submitForm(){ |
|
|
|
|
|
|
|
}, |
|
|
|
//显示用户登录 |
|
|
|
showLogin(){ |
|
|
|
this.isshowLogin=true |
|
|
|
}, |
|
|
|
UserConsole(type,goType){ |
|
|
|
this.login_type=type; |
|
|
|
localStorage.setItem('login_type',this.login_type) |
|
|
|
// this.login_type=type; |
|
|
|
console.info(type) |
|
|
|
this.sidebarListType=type |
|
|
|
if(type==1){ |
|
|
|
this.sidebarList=[ |
|
|
|
{name:'摘牌方',url:''}, |
|
|
|
@ -160,7 +230,7 @@ export default { |
|
|
|
{name:'站内通知',url:'/StationNotice'}, |
|
|
|
] |
|
|
|
if(goType==0){ |
|
|
|
this.goPage('/') |
|
|
|
this.goPage('/index') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -174,10 +244,16 @@ export default { |
|
|
|
if(this.login_type==1){ |
|
|
|
this.isOpenAccount() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
created(){ |
|
|
|
// console.info(this.$route) |
|
|
|
this.login_info=JSON.parse(localStorage.getItem('login_info')); |
|
|
|
if (this.login_info==null) { |
|
|
|
this.login_type=0 |
|
|
|
localStorage.setItem('login_type',0) |
|
|
|
} |
|
|
|
console.info(this.login_info) |
|
|
|
this.activeClass=this.$route.path |
|
|
|
this.login_type=localStorage.getItem('login_type') |
|
|
|
let type=0; |
|
|
|
@ -209,13 +285,30 @@ export default { |
|
|
|
flex-direction: column; |
|
|
|
align-items: center; |
|
|
|
} |
|
|
|
.header_title{ |
|
|
|
.header_login{ |
|
|
|
font-size: 12px; |
|
|
|
color: #F6D79D; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: space-between; |
|
|
|
width: 1200px; |
|
|
|
line-height: 45px; |
|
|
|
height: 45px; |
|
|
|
} |
|
|
|
.header_login_span{ |
|
|
|
display: inline-block; |
|
|
|
margin-left: 20px; |
|
|
|
cursor: pointer; |
|
|
|
text-decoration: underline; |
|
|
|
} |
|
|
|
.code_button{ |
|
|
|
border-right: none; |
|
|
|
} |
|
|
|
.header_title{ |
|
|
|
text-align: right; |
|
|
|
line-height: 45px; |
|
|
|
color: #999; |
|
|
|
color: #F6D79D; |
|
|
|
font-size: 12px; |
|
|
|
width: 1200px; |
|
|
|
} |
|
|
|
.header_title>span{ |
|
|
|
display: inline-block; |
|
|
|
|