修改
This commit is contained in:
@@ -1,30 +1,20 @@
|
||||
<template>
|
||||
<view class="zd_content bg">
|
||||
<view class="p1">欢迎来到</view>
|
||||
<view class="p2">立讯手持系统!</view>
|
||||
<view class="input-box">
|
||||
<input class="large-input" type="text" placeholder="请输入用户名" v-model="user">
|
||||
</view>
|
||||
<div class="input-box">
|
||||
<input class="large-input" :password="!showPassword" placeholder="请输入密码" v-model="password">
|
||||
<span class="iconfont icon_eye_close" :class="[showPassword ? 'icon_eye_active' : '']" @tap="changePassword"></span>
|
||||
</div>
|
||||
<view class="radio-box">
|
||||
<view class="radio-wrap">
|
||||
<span class="iconfont icon_unchecked" :class="{'icon_checked': saveUser}" @tap="toSaveUser"></span>
|
||||
<text class="radio-label">记住用户名</text>
|
||||
<view class="p2">恒森ACS手持系统!</view>
|
||||
<view class="input-box" style="margin-bottom: 20px">
|
||||
<view class="input-wrap">
|
||||
<view class="input-label">服务器地址</view>
|
||||
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model="addrip">
|
||||
</view>
|
||||
<text class="setup-text" @tap="setup">设置</text>
|
||||
<text class="setup-text" @tap="isUpdate">升级版本</text>
|
||||
</view>
|
||||
<button class="login-btn" :disabled="disabled" @tap="toLogin">确认登录</button>
|
||||
<button class="login-btn" @tap="toLogin">进入</button>
|
||||
<view v-if="version !== ''" class="version-name">v{{version}}</view>
|
||||
<Up-grade v-if="grade === true" @closeUpdate="closeUpdate" :androidUrl="androidUrl"></up-grade>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { RSAencrypt } from '@/utils/jsencrypt.js'
|
||||
import {handLogin, pdaUpdate} from '@/utils/getData2.js'
|
||||
import UpGrade from './upgrade.vue'
|
||||
export default {
|
||||
@@ -33,11 +23,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
user: this.$store.getters.loginName ? this.$store.getters.loginName : '',
|
||||
password: '',
|
||||
showPassword: false,
|
||||
saveUser: this.$store.getters.loginName ? true : false,
|
||||
disabled: false,
|
||||
addrip: this.$store.getters.baseUrl,
|
||||
version: '',
|
||||
versionCode: '',
|
||||
grade: false,
|
||||
@@ -55,58 +41,19 @@
|
||||
//#endif
|
||||
},
|
||||
methods: {
|
||||
isUpdate () {
|
||||
this._pdaUpdate()
|
||||
},
|
||||
toSaveUser() {
|
||||
this.saveUser = !this.saveUser
|
||||
},
|
||||
changePassword() {
|
||||
this.showPassword = !this.showPassword
|
||||
},
|
||||
setup () {
|
||||
toLogin() {
|
||||
if (this.addrip === '') {
|
||||
uni.showToast({
|
||||
title: '服务器地址不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$store.dispatch('setConfig',{baseUrl: this.addrip})
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/setup'
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
},
|
||||
async toLogin() {
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/home/home'
|
||||
// })
|
||||
this.disabled = true
|
||||
if (this.user === '') {
|
||||
uni.showToast({
|
||||
title: '用户名不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
if (this.password === '') {
|
||||
uni.showToast({
|
||||
title: '密码不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await handLogin(this.user, RSAencrypt(this.password))
|
||||
if (this.saveUser) {
|
||||
this.$store.dispatch('saveLoginName', this.user)
|
||||
} else {
|
||||
this.$store.dispatch('delLoginName', '')
|
||||
}
|
||||
this.$store.dispatch('saveUserInfo', JSON.stringify(res.result))
|
||||
// this.$store.dispatch('saveToken', res.token)
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
async _pdaUpdate () {
|
||||
let res = await pdaUpdate()
|
||||
if (res.versionName === this.version) {
|
||||
@@ -129,37 +76,27 @@
|
||||
<style lang="stylus" scoped>
|
||||
@import '../../common/style/mixin.styl';
|
||||
.p1
|
||||
_font(60rpx,75rpx,#444)
|
||||
_font(60rpx,75rpx,#222)
|
||||
padding-top: 90rpx
|
||||
.p2
|
||||
_font(50rpx,1,#444)
|
||||
_font(50rpx,1,#222)
|
||||
padding: 40rpx 0 25rpx
|
||||
.input-box
|
||||
_fj()
|
||||
margin-top 68rpx
|
||||
height 75rpx
|
||||
border-bottom 1rpx solid #e2e2e2
|
||||
.large-input
|
||||
_wh(calc(100% - 40rpx), 74rpx)
|
||||
_font(32rpx,74rpx,#999)
|
||||
padding-left 10rpx
|
||||
.radio-box
|
||||
_fj()
|
||||
margin: 25rpx 0 70rpx 0
|
||||
height: 34rpx
|
||||
.radio-wrap
|
||||
_fj(flex-start)
|
||||
height: 34rpx
|
||||
flex: 2
|
||||
.radio-label
|
||||
_font(28rpx, 28rpx,#333)
|
||||
padding-left: 10rpx
|
||||
.setup-text
|
||||
_font(28rpx, 28rpx,$red,,right)
|
||||
padding-left 25rpx
|
||||
margin-bottom 10vh
|
||||
.input-wrap
|
||||
width 100%
|
||||
margin-bottom 10vh
|
||||
.input-label
|
||||
_font(30rpx,70rpx,#333)
|
||||
margin-bottom 2vh
|
||||
.setup-input
|
||||
height 70rpx
|
||||
background #fff
|
||||
_font(30rpx,70rpx,#787878)
|
||||
border-bottom 1px solid #eeeeee
|
||||
.bg
|
||||
background-color: #fff;
|
||||
_bis('../../static/image/login_bg.png', 100%,,bottom)
|
||||
padding: 92rpx 30rpx 82rpx 30rpx;
|
||||
.login-btn
|
||||
width 100%
|
||||
border-radius 46rpx
|
||||
|
||||
Reference in New Issue
Block a user