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

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

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