|
@@ -7,10 +7,10 @@
|
|
|
<image :src="`../../static/${theme}/logo.png`" class="logo"></image>
|
|
|
<form class="login-form" @submit="AndroidCheckUpdate">
|
|
|
<view class="form-item">
|
|
|
- <u-input v-model="form.username" :custom-style="{fontSize:'34upx'}" height="110" type="number" clearable maxlength="11" placeholder="请输入手机号/用户名" />
|
|
|
+ <u-input v-model="form.username" :custom-style="{fontSize:'34upx'}" height="110" type="text" clearable placeholder="请输入用户账号" />
|
|
|
</view>
|
|
|
<view class="form-item">
|
|
|
- <u-input v-model="form.password" :custom-style="{fontSize:'34upx'}" height="110" type="password" :password-icon="true" maxlength="12" placeholder="请输入密码"/>
|
|
|
+ <u-input v-model="form.password" :custom-style="{fontSize:'34upx'}" height="110" type="password" :password-icon="true" maxlength="50" placeholder="请输入密码"/>
|
|
|
</view>
|
|
|
<view class="flex-box mt20">
|
|
|
<view class="remember-pass">
|
|
@@ -43,7 +43,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { checkVersionToLoadUpdate, setStorageForAppVersion,clzConfirm } from '@/libs/tools'
|
|
|
-import { isvalidPhone } from '@/libs/validate.js';
|
|
|
+import { isvalidNumLetter } from '@/libs/validate.js';
|
|
|
import { login } from '@/api/user.js';
|
|
|
import { getSysVersion } from '@/api/data.js'
|
|
|
export default {
|
|
@@ -88,17 +88,18 @@ export default {
|
|
|
methods: {
|
|
|
// 版本更新
|
|
|
AndroidCheckUpdate(){
|
|
|
- let _this = this
|
|
|
- let version = getApp().globalData.version
|
|
|
- uni.showLoading({
|
|
|
- title: '正在登录...'
|
|
|
- });
|
|
|
- getSysVersion({versionType:version.platform=='android'?'ANDROID':'IOS'}).then(ret => {
|
|
|
- if(ret.status == 200){
|
|
|
- this.$store.state.vuex_versionInfo = ret.data
|
|
|
- checkVersionToLoadUpdate(ret.data,0,_this.formSubmit);
|
|
|
- }
|
|
|
- })
|
|
|
+ // let _this = this
|
|
|
+ // let version = getApp().globalData.version
|
|
|
+ // uni.showLoading({
|
|
|
+ // title: '正在登录...'
|
|
|
+ // });
|
|
|
+ // getSysVersion({versionType:version.platform=='android'?'ANDROID':'IOS'}).then(ret => {
|
|
|
+ // if(ret.status == 200){
|
|
|
+ // this.$store.state.vuex_versionInfo = ret.data
|
|
|
+ // checkVersionToLoadUpdate(ret.data,0,_this.formSubmit);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ this.formSubmit()
|
|
|
},
|
|
|
// 过滤权限code
|
|
|
fiterAuthCode(data) {
|
|
@@ -110,19 +111,19 @@ export default {
|
|
|
const _this = this;
|
|
|
// 表单校验
|
|
|
if (_this.form.username == '') {
|
|
|
- uni.showToast({ icon: 'none', title: '请输入用户名' });
|
|
|
+ uni.showToast({ icon: 'none', title: '请输入用户账号' });
|
|
|
return;
|
|
|
}
|
|
|
- if (!isvalidPhone(_this.form.username)) {
|
|
|
- uni.showToast({ icon: 'none', title: '请输入正确的手机号码' });
|
|
|
+ if (!isvalidNumLetter(_this.form.username)) {
|
|
|
+ uni.showToast({ icon: 'none', title: '用户账号为数字或大小写字母组成!' });
|
|
|
return;
|
|
|
}
|
|
|
if (_this.form.password == '') {
|
|
|
uni.showToast({ icon: 'none', title: '请输入密码' });
|
|
|
return;
|
|
|
}
|
|
|
- if (_this.form.password.length < 6 || _this.form.password.length > 12) {
|
|
|
- uni.showToast({ icon: 'none', title: '请输入6-12位密码' });
|
|
|
+ if (_this.form.password.length < 6 || _this.form.password.length > 50) {
|
|
|
+ uni.showToast({ icon: 'none', title: '请输入6-50位密码' });
|
|
|
return;
|
|
|
}
|
|
|
if (!_this.isAuthuserYs) {
|
|
@@ -134,22 +135,24 @@ export default {
|
|
|
login(_this.form).then(res => {
|
|
|
uni.hideLoading();
|
|
|
if (res.status == 200) {
|
|
|
- // _this.$u.vuex('vuex_token', 'Bearer ' + res.access_token);
|
|
|
- // _this.$u.vuex('vuex_userData', _this.fiterAuthCode(res.auth_user));
|
|
|
- // getApp().globalData.token = 'Bearer ' + res.access_token;
|
|
|
- // //登录成功将用户名密码存储到用户本地
|
|
|
- // if (_this.isRemember) {
|
|
|
- // //用户勾选“记住密码”
|
|
|
- // _this.$u.vuex('vuex_user.account', _this.form.username);
|
|
|
- // _this.$u.vuex('vuex_user.password', _this.form.password);
|
|
|
- // } else {
|
|
|
- // //用户没有勾选“记住密码”
|
|
|
- // _this.$u.vuex('vuex_user.account', '');
|
|
|
- // _this.$u.vuex('vuex_user.password', '');
|
|
|
- // _this.form.username = '';
|
|
|
- // _this.form.password = '';
|
|
|
- // }
|
|
|
- // uni.setStorageSync('loginTimeOut', 'NO');
|
|
|
+ // _this.$u.vuex('vuex_token', 'Bearer ' + res.data.access_token);
|
|
|
+ // _this.$u.vuex('vuex_userData', _this.fiterAuthCode(res.data.auth_user));
|
|
|
+ // getApp().globalData.token = 'Bearer ' + res.data.access_token;
|
|
|
+ _this.$u.vuex('vuex_token', res.data.access_token);
|
|
|
+ getApp().globalData.token = res.data.access_token;
|
|
|
+ //登录成功将用户名密码存储到用户本地
|
|
|
+ if (_this.isRemember) {
|
|
|
+ //用户勾选“记住密码”
|
|
|
+ _this.$u.vuex('vuex_user.account', _this.form.username);
|
|
|
+ _this.$u.vuex('vuex_user.password', _this.form.password);
|
|
|
+ } else {
|
|
|
+ //用户没有勾选“记住密码”
|
|
|
+ _this.$u.vuex('vuex_user.account', '');
|
|
|
+ _this.$u.vuex('vuex_user.password', '');
|
|
|
+ _this.form.username = '';
|
|
|
+ _this.form.password = '';
|
|
|
+ }
|
|
|
+ uni.setStorageSync('loginTimeOut', 'NO');
|
|
|
_this.toMain();
|
|
|
} else {
|
|
|
uni.showToast({ icon: 'none', title: res.message });
|
|
@@ -157,7 +160,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
toMain() {
|
|
|
- console.log('toMain')
|
|
|
// 跳转到首页
|
|
|
uni.switchTab({
|
|
|
url: '/pages/index/index'
|