| | |
| | | <form class="login-form" @submit.prevent="handleSubmit"> |
| | | <view class="form-group"> |
| | | <text class="form-label">账号</text> |
| | | <input |
| | | type="text" |
| | | id="username" |
| | | v-model="username" |
| | | placeholder="请输入账号" |
| | | class="form-input" |
| | | autocapitalize="off" |
| | | autocomplete="username" |
| | | @keyup.enter="handleSubmit" |
| | | /> |
| | | <input type="text" id="username" v-model="username" placeholder="请输入账号" class="form-input" |
| | | autocapitalize="off" autocomplete="username" @keyup.enter="handleSubmit" /> |
| | | </view> |
| | | |
| | | <view class="form-group"> |
| | | <text class="form-label">密码</text> |
| | | <input |
| | | :type="showPassword ? 'text' : 'password'" |
| | | id="password" |
| | | v-model="password" |
| | | placeholder="请输入密码" |
| | | class="form-input" |
| | | autocomplete="current-password" |
| | | @keyup.enter="handleSubmit" |
| | | /> |
| | | <input :type="showPassword ? 'text' : 'password'" id="password" v-model="password" |
| | | placeholder="请输入密码" class="form-input" autocomplete="current-password" |
| | | @keyup.enter="handleSubmit" /> |
| | | <view class="password-toggles"> |
| | | <text class="show-password" @tap="toggleShowPassword"> |
| | | {{ showPassword ? '隐藏密码' : '显示密码' }} |
| | |
| | | this.showPassword = !this.showPassword; |
| | | }, |
| | | handleSubmit() { |
| | | |
| | | // uni.showToast({ |
| | | // title: '登录功能仅为演示', |
| | | // icon: 'none' |
| | |
| | | // username: this.username, |
| | | // password: this.password |
| | | // }).then(...) |
| | | console.log(this.username) |
| | | |
| | | if (!this.username) { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | |
| | | this.$loginInfo.chineseName = user.fname; |
| | | this.$loginInfo.id = user.fid; |
| | | this.$loginInfo.roleid=user.roleids; |
| | | |
| | | uni.setStorage({ |
| | | key: 'gs_mes_pad_userid', |
| | | data: this.username, |
| | | success: function() { |
| | | |
| | | } |
| | | }); |
| | | uni.setStorage({ |
| | | key: 'gs_mes_pad_userkey', |
| | | data: this.password, |
| | | success: function() { |
| | | |
| | | } |
| | | }); |
| | | this.$login(); |
| | | if (this.$loginInfo.forcedLogin) { |
| | | uni.reLaunch({ |
| | |
| | | } else { |
| | | uni.navigateBack(); |
| | | } |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | try { |
| | | const id = uni.getStorageSync('gs_mes_pad_userid'); |
| | | const pwd = uni.getStorageSync('gs_mes_pad_userkey'); |
| | | if(id){ |
| | | this.username=id; |
| | | } |
| | | if(pwd){ |
| | | this.password=pwd; |
| | | } |
| | | if (id&&pwd) { |
| | | |
| | | uni.showLoading({ |
| | | mask: true, |
| | | title: "登录中..." |
| | | }); |
| | | uni.request({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/login/login', |
| | | method: "POST", |
| | | header: { |
| | | 'content-type': "application/json" |
| | | }, |
| | | data: { |
| | | userID: id, |
| | | userPass: pwd |
| | | }, |
| | | success: res => { |
| | | if (res.data.status == 0) { |
| | | this.toMain(res.data.data.tbBillList[0]); |
| | | } else { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: res.data.message |
| | | }); |
| | | } |
| | | }, |
| | | fail(err) { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: "服务器断开" |
| | | }); |
| | | }, |
| | | complete: () => { |
| | | uni.hideLoading(); |
| | | } |
| | | }); |
| | | } |
| | | } catch (e) { |
| | | // error |
| | | } |
| | | } |
| | | } |
| | |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | |
| | | /* 手机样式 */ |
| | | @media (min-width: 300px) { |
| | | .login-content { |