yurong/.svn/pristine/51/51db56ae82b369cf18c0e6c0127...

158 lines
4.7 KiB
Plaintext

<template>
<view>
<view class="rowsc rowsw pt-96">
<image class="headimg" src="/static/logo.jpg"></image>
<view class="fs-32 fw-600 w100 tct pt-160">账号密码登录</view>
<view style="width: 650rpx;height: 104rpx;margin-top: 68rpx; border: 2rpx solid #f1f1f1;" class="rows rowsm br-20">
<image class="pho_calsfd absolute" src="/static/icon-shoujihaoma.png" mode=""></image>
<input v-model="phone" maxlength="11" type="number" class="inpi_celadd col888 fs-28" placeholder="请输入您的手机号码"
placeholder-style="color:#999999;" />
</view>
<view style="width: 650rpx;height: 104rpx;margin-top: 26rpx; border: 2rpx solid #f1f1f1;" class="rows rowsm br-20">
<image class="pho_calsfd absolute" src="/static/icon-shoujihaoma.png" mode=""></image>
<input v-model="password" maxlength="11" type="password" class="inpi_celadd col888 fs-28" placeholder="请输入您的密码"
placeholder-style="color:#999999;" @confirm="isSubmit()" />
</view>
<view @click="isSubmit" class="logis_dsfg bg colfff fs34 tct">登录</view>
<view class="rowsb pt-30 fs-24 pt-40 " style="width: 580rpx; color: #FF5D5C;">
<view @click="jumpPage(1)">立即注册</view>
<view @click="jumpPage(2)">忘记密码</view>
</view>
<view class="w-650 rows rowsm fixed" style="height: 80rpx; bottom: 30rpx; left: 80rpx;">
<image @click="showXie=!showXie" :src="showXie?'/static/xuanzhonghou-1.png':'/static/xuanzhonghou.png'"
style="width: 30rpx;height: 30rpx;" mode=""></image>
<view class="fs-24 col999 pdlft20 ml-20">
<text @click="showXie=!showXie">注册登录即表示同意</text>
<text style="color: #FF5D5C" @tap="goXieYi(0)">《用户协议》</text>及
<text style="color: #FF5D5C" @tap="goXieYi(1)">《隐私政策》</text>
<!-- <text class="col_0ECE93">《隐私政策》</text> -->
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
// #ifdef APP-PLUS
phone: '', //手机号
password: '', //密码
// #endif
// #ifndef APP-PLUS
phone: '13184129096', //手机号
password: '123456', //密码
// #endif
showXie: false
}
},
onLoad() {
uni.hideTabBar()
},
methods: {
goXieYi(type) {
this.$tools.goNext(`/pages/login/loginText/loginText?type=${type}`)
},
isSubmit() {
if (!this.showXie) {
return this.showtt('请先阅读并同意用户协议及隐私政策')
}
if (!(/^1[3456789]\d{9}$/.test(this.phone))) {
this.$tools.showtt('手机号格式不正确')
return false
}
if (!this.password && this.cursor == 1) {
this.$tools.showtt('请输入密码')
return false
}
this.loginPass();
},
loginPass() { //密码登录
let obj = {
mobile: this.phone, //手机号
password: this.password, //密码
}
this.axiosFromToken('POST', 'user/login', obj).then(res => {
if (one.code == 1) {
getApp().globalData.token = one.data
this.getUserInfo(one.data)
} else {
this.$tools.showtt(one.msg)
this.password = '';
}
})
},
getUserInfo(token) {//获取用户信息
this.axiosFromToken('POST','user/getUserInfo', {token}, '加载中').then(res => {
this.loginCall(res.data,token)
})
},
loginCall(data,token) {//处理登录数据
getApp().globalData.token = token
getApp().globalData.userInfo = data
uni.setStorageSync("token",token)
uni.setStorageSync("userInfo",data)
this.$tools.goSwitchTab('/pages/index/index')
},
jumpPage(event) {
if (event == 1) {
this.$tools.goNext(`/pages/login/reg/reg`); //注册页面跳转
} else if (event == 2) {
this.$tools.goNext(`/pages/login/forget/forget`); //忘记密码页面跳转
}
},
}
}
</script>
<style>
.lo_calsd {
width: 600rpx;
height: 90rpx;
line-height: 90rpx;
background-color: #3DCA9A;
border-radius: 100rpx;
}
.logis_dsfg {
height: 100rpx;
width: 600rpx;
line-height: 100rpx;
border-radius: 100rpx;
margin-top: 80rpx;
background-image: linear-gradient(#FF5D5C,#fa3327);
}
.pho_calsfd {
width: 32rpx;
height: 32rpx;
/* background-color: #EEEEEE; */
}
.inpi_celadd {
width: 650rpx;
padding-left: 60rpx;
}
.headimg {
width: 186rpx;
height: 186rpx;
background-color: #eee;
opacity: 1;
border-radius: 38rpx;
}
.get_corasd {
position: absolute;
bottom: 15rpx;
right: 0rpx;
width: 180rpx;
height: 60rpx;
background-image: linear-gradient(#acdcd9,#399b9d);
border-radius: 100rpx;
line-height: 60rpx;
}
</style>