Login 页面改写完成
This commit is contained in:
parent
0e2f35a021
commit
1996d90a67
|
@ -1,27 +1,3 @@
|
||||||
$themeColor = rgb(128,51,134);
|
|
||||||
$fontColor = rgb(77,9,86)
|
|
||||||
|
|
||||||
Button()
|
|
||||||
background linear-gradient(135deg,#fa2c19 0%,#fa6419 100%)
|
|
||||||
color white
|
|
||||||
padding 10px
|
|
||||||
width 85%
|
|
||||||
text-align center
|
|
||||||
border-radius 25px
|
|
||||||
border: 1px solid transparent
|
|
||||||
|
|
||||||
hint()
|
|
||||||
width 100%
|
|
||||||
box-sizing border-box
|
|
||||||
position absolute
|
|
||||||
text-indent 2em
|
|
||||||
z-index 9999
|
|
||||||
padding 10px
|
|
||||||
background rgba(255,255,255,0.8)
|
|
||||||
color rgb(0,133,208)
|
|
||||||
font-size 12px
|
|
||||||
line-height 1.4em
|
|
||||||
|
|
||||||
.home-wrap
|
.home-wrap
|
||||||
overflow hidden
|
overflow hidden
|
||||||
height: 100vh
|
height: 100vh
|
||||||
|
@ -44,7 +20,7 @@ hint()
|
||||||
color: white
|
color: white
|
||||||
text-align: center
|
text-align: center
|
||||||
margin-top: 15vh
|
margin-top: 15vh
|
||||||
.info-card
|
.card
|
||||||
position relative
|
position relative
|
||||||
width 90%
|
width 90%
|
||||||
box-shadow: 0 4px 10px #00000012
|
box-shadow: 0 4px 10px #00000012
|
||||||
|
@ -55,7 +31,6 @@ hint()
|
||||||
padding 30px
|
padding 30px
|
||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
position relative
|
position relative
|
||||||
// z-index 999
|
|
||||||
.van-cell-group
|
.van-cell-group
|
||||||
margin: 30px auto
|
margin: 30px auto
|
||||||
.van-cell
|
.van-cell
|
||||||
|
@ -78,7 +53,6 @@ hint()
|
||||||
.main
|
.main
|
||||||
width 100vw
|
width 100vw
|
||||||
position relative
|
position relative
|
||||||
z-index 800
|
|
||||||
.hint
|
.hint
|
||||||
width 70%
|
width 70%
|
||||||
border-radius 10px
|
border-radius 10px
|
||||||
|
|
|
@ -12,7 +12,7 @@ const service = axios.create({
|
||||||
// request interceptor(请求拦截器)
|
// request interceptor(请求拦截器)
|
||||||
service.interceptors.request.use(
|
service.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
vm.$Loading.show()
|
// vm.$Loading.show()
|
||||||
// 给config统一配置属性
|
// 给config统一配置属性
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
|
@ -24,7 +24,7 @@ service.interceptors.request.use(
|
||||||
//response (响应拦截器)
|
//response (响应拦截器)
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
response => {
|
response => {
|
||||||
vm.$Loading.hidden()
|
// vm.$Loading.hidden()
|
||||||
const res = response.data
|
const res = response.data
|
||||||
const code = response.status
|
const code = response.status
|
||||||
if (code !== 200) {
|
if (code !== 200) {
|
||||||
|
@ -38,7 +38,7 @@ service.interceptors.response.use(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
vm.$Loading.hidden()
|
// vm.$Loading.hidden()
|
||||||
if (error.response.status && error.response.status == 401) { //拦截401,代表登陆失效,触发页面刷新后再触发路由拦截,拦截到重新登录
|
if (error.response.status && error.response.status == 401) { //拦截401,代表登陆失效,触发页面刷新后再触发路由拦截,拦截到重新登录
|
||||||
// 401一般是权限问题或者登录失效
|
// 401一般是权限问题或者登录失效
|
||||||
// router.push('/login') //如果项目存在登录验证,应该在这里返回登录页面重新登录;
|
// router.push('/login') //如果项目存在登录验证,应该在这里返回登录页面重新登录;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="top-brand-wrap">
|
<div class="top-brand-wrap">
|
||||||
<h1 class="title">5G 赛道</h1>
|
<h1 class="title">5G 赛道</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-card flex-container">
|
<div class="card flex-container">
|
||||||
<van-form>
|
<van-form>
|
||||||
<van-cell-group inset>
|
<van-cell-group inset>
|
||||||
<van-field required v-model="formData.Name" name="姓名" label="姓名" clearable placeholder="请输入姓名" />
|
<van-field required v-model="formData.Name" name="姓名" label="姓名" clearable placeholder="请输入姓名" />
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
import { Form, Field, Toast, CellGroup, Dialog, Button, Col, Row } from 'vant'
|
import { Form, Field, Toast, CellGroup, Dialog, Button, Col, Row } from 'vant'
|
||||||
import { Login } from 'api/home'
|
import { Login } from 'api/home'
|
||||||
|
|
||||||
import imgs1 from '@/assets/image/imgs-01.jpg'
|
// import imgs1 from '@/assets/image/imgs-01.jpg'
|
||||||
import imgs2 from '@/assets/image/imgs-02.jpg'
|
// import imgs2 from '@/assets/image/imgs-02.jpg'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name:'Home',
|
name:'Home',
|
||||||
|
@ -38,7 +38,7 @@ export default {
|
||||||
[Dialog.name]:Dialog,
|
[Dialog.name]:Dialog,
|
||||||
[Button.name]:Button,
|
[Button.name]:Button,
|
||||||
[Col.name]:Col,
|
[Col.name]:Col,
|
||||||
[Row.name]:Row
|
[Row.name]:Row,
|
||||||
},
|
},
|
||||||
activated(){
|
activated(){
|
||||||
|
|
||||||
|
@ -61,25 +61,30 @@ export default {
|
||||||
methods:{
|
methods:{
|
||||||
onLogin(){
|
onLogin(){
|
||||||
if (!this.formData.Name){
|
if (!this.formData.Name){
|
||||||
this.$Toast.error('请填写姓名!')
|
Toast.fail('请填写姓名!')
|
||||||
return
|
return
|
||||||
} else if (!this.formData.Phone || this.formData.Phone.length != 11){
|
} else if (!this.formData.Phone || this.formData.Phone.length != 11){
|
||||||
this.$Toast.error('请填写正确的手机号!')
|
Toast.fail('请填写正确的手机号!')
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
this.$Loading.show('正在登陆...')
|
Toast.loading({
|
||||||
|
message: '正在登录……',
|
||||||
|
forbidClick: true,
|
||||||
|
});
|
||||||
|
console.log(this.formData)
|
||||||
Login(this.formData).then(res => {
|
Login(this.formData).then(res => {
|
||||||
if (res.code === 0){
|
if (res.code === 0){
|
||||||
this.$Toast.success('登陆成功!')
|
Toast.success('登陆成功!')
|
||||||
this.$router.push('/photos')
|
this.$router.push('/photos')
|
||||||
localStorage.images = JSON.stringify(res.data)
|
localStorage.images = JSON.stringify(res.data)
|
||||||
// localStorage.images = JSON.stringify([imgs1,imgs2,imgs1,imgs2])
|
// localStorage.images = JSON.stringify([imgs1,imgs2,imgs1,imgs2])
|
||||||
} else {
|
} else {
|
||||||
this.$Toast.error('登陆失败:' + res.msg)
|
Toast.fail('登陆失败:' + res.msg)
|
||||||
}
|
}
|
||||||
this.$Loading.hidden()
|
Toast.clear()
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$Loading.hidden()
|
Toast.fail('登陆失败:' + err)
|
||||||
|
Toast.clear()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue