| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <view class="content">
- <view class="header">
- <image src="/static/img/inspection_00.png" style="height: 80px;width: 80px;"></image>
- </view>
- <view class="list">
- <view class="list-call">
- <uni-icons type="person" size="28"></uni-icons>
- <input class="sl-input" v-model="account" type="text" maxlength="32" placeholder="请输入账号" />
- </view>
- <view class="list-call">
- <uni-icons type="eye" size="28"></uni-icons>
- <input class="sl-input" v-model="password" type="text" maxlength="32" placeholder="请输入密码"
- password="true" />
- </view>
- </view>
- <view class="button-login" hover-class="button-hover" @click="bindLogin()">
- <text>登录</text>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- account: '',
- password: ''
- };
- },
- methods: {
- bindLogin() {
- let that = this;
- if (this.account.length==0) {
- uni.showToast({
- icon: 'none',
- title: '请输入账号'
- });
- return;
- }
- if (this.password.length==0) {
- uni.showToast({
- icon: 'none',
- title: '请输入密码'
- });
- return;
- }
-
-
- var data={
- UserId: this.account,
- Password:this.password
- }
- this.$api.passwordLogin(data).then(res=>{
- if(!res.isSuccess){
- uni.showToast({
- icon: 'none',
- title: res.errMsg
- });
- return
- }
-
- this.$store.commit('setData', res.data.user)
- uni.setStorageSync('token',res.tnToken.tokenStr)
- //登录成功跳转
- uni.navigateTo({
- url:'/pages/index/home'
- });
-
- });
- },
-
- }
- }
- </script>
- <style>
- page {
- background-color: #fff;
- }
- .content {
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .header {
- width: 161rpx;
- height: 161rpx;
- border-radius: 50%;
- margin-top: 30rpx;
- margin-left: auto;
- margin-right: auto;
- }
- .header image {
- width: 161rpx;
- height: 161rpx;
- border-radius: 50%;
- }
- .list {
- display: flex;
- flex-direction: column;
- padding-top: 50rpx;
- padding-left: 70rpx;
- padding-right: 70rpx;
- }
- .list-call {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- height: 100rpx;
- color: #333333;
- border-bottom: 0.5px solid #e2e2e2;
- margin-top:10px
- }
- .list-call .sl-input {
- flex: 1;
- text-align: left;
- font-size: 18px;
- margin-left: 8px;
- }
- .button-login {
- color: #FFFFFF;
- font-size:18px;
- width: 235px;
- height: 50px;
- background: #1989fa;
- border-radius:5px;
- line-height: 50px;
- text-align: center;
- margin-left: auto;
- margin-right: auto;
- margin-top: 50px;
- }
- </style>
|