| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view style="height: 100vh;">
- <view class="status_bar"></view>
- <view class="logo">
- <image src="../../static/image/login/8eef2e54055a5b072a5dc000919a7ae.png" mode=""></image>
- </view>
- <form @submit="formSubmit">
- <view class="uni-form-item uni-column">
- <view class="username">
- <u-icon name="account" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
- <u-input class="uni-input" name="username" v-model="formdata.username" placeholder-class="icon iconfont icon-bianji1"
- placeholder="请输入用户名" @blur="blur"/>
- </view>
- <view class="passwold">
- <u-icon name="lock" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
- <u-input v-model="formdata.passwold" type="password" :password-icon="true" :clearable="false" placeholder="请输入密码"
- @confirm="formSubmit" @input="passwoldddata" />
- </view>
- <view class="aboutpass">
- <u-checkbox-group>
- <u-checkbox v-model="checked" :label-disabled="false" size="22" @change="rempass">记住密码</u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="uni-btn-v">
- <button form-type="submit">登 录</button>
- </view>
- </view>
- </form>
- <view class="bg">
- <image src="../../static/image/login/850c9307f4ef2d7dc6db1049711ab55.jpg" mode=""></image>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- checked: false,
- formdata: {
- username: '',
- passwold: ''
- }
- }
- },
- onLoad() {
- uni.getStorage({
- key: 'user_pass',
- success: (res) => {
- if(res.data){
- this.formdata.passwold = res.data
- this.checked =true
- }else{
- this.checked =false
- }
- }
- })
- uni.getStorage({
- key: 'user_name',
- success: (res) => {
- this.formdata.username = res.data
- }
- })
- },
- methods: {
- async formSubmit() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=user.login.login_user',
- data: {
- username: this.formdata.username,
- password: this.formdata.passwold
- }
- })
- let session_key = res.session_key
- uni.setStorage({
- key: 'session_key',
- data: session_key,
- success: () => {
- uni.switchTab({
- url: "../index/index"
- })
- }
- })
- },
- passwoldddata() {
- this.formdata.passwold = this.formdata.passwold.replace(/[\u4E00-\u9FA5]/g, '')
- },
- rempass(val) {
- if(val.value){
- uni.setStorage({
- key: 'user_pass',
- data: this.formdata.passwold,
- success: function() {
- console.log('success');
- }
- })
- }else{
- uni.removeStorage({
- key: 'user_pass',
- success: function() {
- console.log('success');
- }
- })
- }
- },
- blur(val){
- uni.setStorage({
- key: 'user_name',
- data: val,
- success: function() {
- console.log('success');
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .logo {
- width: 100%;
- height: 340rpx;
- text-align: center;
- display: flex;
- align-items: center;
- padding-top: 240rpx;
- image {
- width: 280rpx;
- margin: 0 auto;
- height: 120rpx;
- }
- }
- .bg {
- width: 100%;
- position: fixed;
- bottom: 0;
- z-index: -1;
- image {
- width: 100%;
- }
- }
- /deep/.u-input__right-icon {
- line-height: 35px !important;
- }
- .uni-form-item {
- width: 100%;
- .username {
- width: 80%;
- margin: 0 auto;
- display: flex;
- margin-bottom: 40rpx;
- padding-bottom: 10rpx;
- border-bottom: 2rpx solid #C3C3C3;
- }
- .passwold {
- width: 80%;
- margin: 0 auto;
- display: flex;
- margin-bottom: 40rpx;
- padding-bottom: 10rpx;
- border-bottom: 2rpx solid #C3C3C3;
- }
- .aboutpass {
- width: 80%;
- margin: 0 auto;
- display: flex;
- justify-content: flex-end;
- p {
- color: #C0C0C0;
- font-size: 28rpx;
- }
- /deep/.u-checkbox__label {
- font-size: 28rpx;
- color: #C0C0C0;
- margin-right: 0;
- }
- }
- .uni-btn-v {
- width: 80%;
- margin: 112rpx auto 0;
- position: relative;
- z-index: 100;
- button {
- width: 100%;
- height: 72rpx;
- line-height: 75rpx;
- background-color: #5DC18B;
- color: #FFFFFF;
- border-radius: 36rpx;
- font-size: 28rpx;
- }
- }
- }
- </style>
|