You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
1.9 KiB
100 lines
1.9 KiB
<template>
|
|
<view class="loginPage">
|
|
|
|
<view class="loginHeader">
|
|
<view class="loginHeaderTitle">欢迎使用巡查上报系统</view>
|
|
</view>
|
|
<view class="loginBox">
|
|
<u-field v-model="username" label-width=0 icon="account" placeholder="请填写登陆名">
|
|
</u-field>
|
|
<u-field v-model="password" label-width=0 icon="lock" :password="true" placeholder="请填写密码">
|
|
</u-field>
|
|
</view>
|
|
|
|
<view class="loginFoot">
|
|
<u-button :ripple="true" @click="loginBind" ripple-bg-color="#2979ff" type="primary">登陆</u-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
var util = require("../../utils/util.js");
|
|
export default {
|
|
data() {
|
|
return {
|
|
username: '',
|
|
password: ''
|
|
}
|
|
},
|
|
onLoad: function(options) {
|
|
|
|
|
|
},
|
|
methods: {
|
|
loginBind: function() {
|
|
let that = this;
|
|
|
|
if (that.username == "") {
|
|
util.alert("请输入登陆账号");
|
|
return false;
|
|
}
|
|
|
|
if (that.password == "") {
|
|
util.alert("请输入密码");
|
|
return false;
|
|
}
|
|
|
|
util.request({
|
|
api: '/api/mobile/auth/login',
|
|
method: 'POST',
|
|
data: {
|
|
'username': that.username,
|
|
'password': that.password
|
|
},
|
|
utilSuccess: function(res) {
|
|
console.log(res)
|
|
uni.setStorageSync('userInfo_token', res);
|
|
uni.redirectTo({
|
|
url: '/pages/index/index'
|
|
});
|
|
},
|
|
utilFail: function(res) {
|
|
console.log(res)
|
|
util.alert(res);
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.loginPage {}
|
|
|
|
.loginFoot {
|
|
padding: 40rpx;
|
|
margin-top: 100rpx;
|
|
}
|
|
|
|
.loginBox {
|
|
padding: 120rpx 40rpx;
|
|
background: #FFFFFF;
|
|
margin-top: -50rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 50rpx;
|
|
}
|
|
|
|
.loginHeaderTitle {
|
|
display: flex;
|
|
font-size: 40rpx;
|
|
padding: 80rpx 0;
|
|
color: #fff;
|
|
}
|
|
|
|
.loginHeader {
|
|
padding: 80rpx 40rpx;
|
|
background: #2979ff;
|
|
}
|
|
</style>
|