Commit 8f1a2426 authored by 吴冠's avatar 吴冠

化验证码登录和官网部分功能

parent dfe4008f
......@@ -213,3 +213,11 @@ export function getSecond(data){
data:data
})
}
//手机验证码登录
export function phoneCode1(data){
return request({
url:'/phoneLogin',
method:'post',
data:data
})
}
\ No newline at end of file
......@@ -8,9 +8,15 @@
<nuxt-link to="/" class="head-title t1">首页</nuxt-link>
</div>
<div class="welcome t1">
<span>你好,{{userName}}</span>
<nuxt-link to="/login/user" class="login" v-show="showDefault">登录</nuxt-link>
<span>商家免费入住</span>
<el-dropdown size="mini">
<span>{{userName}}<i class="el-icon-arrow-down el-icon--right" v-if="isicon"></i> </span>
<el-dropdown-menu slot="dropdown">
<div v-if="isicon" size="mini" class="checkButton" @click="out">退出</div>
</el-dropdown-menu>
</el-dropdown>
<!-- <div class="checkout" v-show = "showButton" @mouseover="hover()">退出</div> -->
<nuxt-link to="/login/user" class="login" v-show="showDefault">请登录</nuxt-link>
<span style="color:blue;margin-left:30px" class="other" @click="loginOther">商家免费入住</span>
<button @click="jump" v-show="!showDefault" class="right-pos">跳转后台</button>
</div>
</div>
......@@ -24,25 +30,47 @@
</template>
<script>
import {getSecond} from '@/common/list.js'
export default {
created(){
},
mounted(){
let tokenStr = window.sessionStorage.getItem("token")
let tokenStr = sessionStorage.getItem("token")
console.log(tokenStr+"-------------")
if(tokenStr){
/* let a = sessionStorage.getItem("companyNameType")
if(a=="1"){
setTimeout(()=>{
location.reload()
sessionStorage.removeItem("companyNameType")
},10)
} */
this.getSecond()
this.showDefault = false
this.userName = window.sessionStorage.getItem("companyName")
this.isicon = true
}
},
data() {
return {
isicon:false,
input: '',
userName:'来到捷安采',
showDefault: true
userName:'欢迎来到捷安采,',
showDefault: true,
/* showButton:false */
}
},
methods: {
async getSecond(){
const {data} = await getSecond()
console.log(data+'------------------------')
this.userName = data.companyName
},
//商家管理后台
loginOther(){
this.$router.push("/login/examine")
},
//收藏按钮
addFavo() {
this.$message.success('同时按住ctrl+D收藏本站')
......@@ -55,8 +83,15 @@
}
/* window.location.href=`http://192.168.200.201:8082/#/purchaser/Home?token=${token}` */
},
getUserName(){
return window.sessionStorage.getItem("companyName");
/* hover(){
this.showButton = true
},
out(){
this.showButton = false
} */
out(){
sessionStorage.clear()
this.$router.push("/login/user")
}
},
......@@ -112,4 +147,24 @@
.t5{
cursor:pointer
}
.other{
cursor: pointer;
}
/* .checkout{
position: absolute;
left:365px;
top:40px;
font-size: 16px;
border: 1px solid black;
padding-left:15px;
padding-right: 15px;
border-top:none
} */
.checkButton{
/* padding-left:-50px;
padding-right: 50px; */
width:100px;
text-align: center;
cursor:pointer
}
</style>
......@@ -14,8 +14,9 @@
</div>
<div class="login-title">{{userName}}</div>
<div class="login-button" @click="loginuser" v-show="showDefault">用户登录</div>
<div class="login-button" @click="Merchant">商家入驻</div>
<div class="login-button" @click="checkout" v-show="!showDefault">退出</div>
<div class="login-button" @click="Merchant" v-show="showDefault">商家入驻</div>
<!-- <div class="login-button" @click="checkout" v-show="!showDefault">退出</div> -->
<div class="login-button" v-show="!showDefault" @click="pushH">管理后台</div>
</div>
</div>
<div class="content message">
......@@ -140,6 +141,8 @@ import {getSecond,getListSite,getListSite1,getListSite2} from '@/common/list.js'
sessionStorage.setItem("companyName",data.companyName)
sessionStorage.setItem("isSupplier",data.type)
this.userName = sessionStorage.getItem("companyName")
/* let type=1
sessionStorage.setItem("companyNameType",type) */
let A = sessionStorage.getItem("Id")
let B = sessionStorage.getItem("status")
if(B =="1"){
......@@ -172,6 +175,13 @@ import {getSecond,getListSite,getListSite1,getListSite2} from '@/common/list.js'
window.sessionStorage.clear()
this.$router.push("/login/user")
},
pushH(){
let token=window.sessionStorage.getItem("token")
if(token){
/* window.location.href="http://192.168.200.201:8082/#/purchaser/Home" */
window.location.href=`http://60.205.251.80:8082/#/purchaser/Home?token=${token}`
}
}
},
data() {
return {
......
......@@ -49,7 +49,7 @@
<script>
import {powerLogin} from '~/api/bid/login';
import {getSecond,sendSms,getVerifyPhone} from '@/common/list.js';
import {getSecond,sendSms,phoneCode1} from '@/common/list.js';
export default {
data() {
return {
......@@ -175,17 +175,12 @@
} = await powerLogin(this.param) */
//将手机号和手机验证码发送
let mess = {}
mess.phone = this.phone.phone
mess.verify = this.phone.phonecode
const {data,code,msg} = await getVerifyPhone(mess)
mess.account = this.phone.phone
mess.password = this.phone.phonecode
const {data,code,msg} = await phoneCode1(mess)
console.log(data,code)
if (code == 200) {
sessionStorage.setItem("token",data);
/* let A = sessionStorage.getItem("Id")
let B = sessionStorage.getItem("status")
if(A =="1"){
this.$router.push(A)
} */
this.$message({
message: msg,
type: 'success',
......
......@@ -7,8 +7,8 @@ import requestUrl from '../utils/Domain.js'
// 创建axios实例
const service = axios.create({
baseURL:'http://60.205.251.80:8082/apis',
/* baseURL: 'http://192.168.3.35:8085/apis' */
/* baseURL:'http://60.205.251.80:8082/apis', */
baseURL: 'http://192.168.3.35:8085/apis',
timeout: 35000 // 请求超时时间
})
......
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