| | |
| | | <template> |
| | | <view class="bodyView"> |
| | | <view class="topView"> |
| | | <cover-image src="/static/img/login_top.png"> |
| | | </cover-image> |
| | | <image src="/static/img/login_top.png" mode="aspectFill"> |
| | | </image> |
| | | </view> |
| | | <view class="logoView"> |
| | | <cover-image src="/static/img/newLogo.png"> |
| | | </cover-image> |
| | | <image src="/static/img/newLogo.png" mode="aspectFit"> |
| | | </image> |
| | | </view> |
| | | <view class="bottomView"> |
| | | <view class="itemView" style="margin-bottom: 40px;"> |
| | |
| | | </view> |
| | | </view> |
| | | <view class="itemView"> |
| | | <button class="loadingButton" :loading="loading">{{btnText}}</button> |
| | | <button class="loadingButton" @click="onLogin()" :loading="loading">{{btnText}}</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | uni.onLocaleChange((e) => { |
| | | this.applicationLocale = e.locale; |
| | | }) |
| | | |
| | | this.user = uni.getStorageSync('user') |
| | | if (!this.user) { |
| | | this.user = { |
| | | userName: '', |
| | | password: '' |
| | | } |
| | | } |
| | | }, |
| | | methods:{ |
| | | async onLogin() { |
| | | const { |
| | | code, |
| | | data, |
| | | msg |
| | | } = await request('/login', { |
| | | username: this.user.userName, |
| | | password: this.user.password, |
| | | }) |
| | | if (code === 200) { |
| | | this.loading = true; |
| | | this.loginButton = 'login.loging'; |
| | | uni.setStorageSync('token', data.accessToken); |
| | | uni.setStorageSync('userData', data.user); |
| | | if (this.remberPassword) { |
| | | uni.setStorageSync('user', this.user); |
| | | } else { |
| | | uni.removeStorageSync('user'); |
| | | } |
| | | this.goHome() |
| | | } else { |
| | | uni.showToast({ |
| | | title: msg |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | goHome() { |
| | | setTimeout(() => { |
| | | // this.getAuth2() |
| | | this.getFields() |
| | | uni.showToast({ |
| | | title: '登录成功' |
| | | }) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '../home/index' |
| | | }); |
| | | }, 300) |
| | | }, 700) |
| | | }, |
| | | async getFields() { |
| | | const { |
| | | code, |
| | | data, |
| | | msg |
| | | } = await request('/dynamic/fields', {}, 'get') |
| | | if (code === 200) { |
| | | this.$store.commit('user/setFields', data) |
| | | } else { |
| | | uni.showToast({ |
| | | title: msg |
| | | }) |
| | | } |
| | | }, |
| | | remberChange(e) { |
| | | this.remberPassword = !this.remberPassword |
| | | }, |
| | |
| | | color: #ababab; |
| | | } |
| | | .textType3{ |
| | | font-family: a3; |
| | | font-family: a4; |
| | | } |
| | | .bodyView{ |
| | | display: flex; |
| | |
| | | .topView{ |
| | | flex: 7; |
| | | } |
| | | .topView cover-image{ |
| | | .topView image{ |
| | | width: 100%; |
| | | height: 100%; |
| | | |
| | | object-fit: cover; |
| | | } |
| | | .logoView{ |
| | | flex: 1; |
| | |
| | | align-items: center; |
| | | |
| | | } |
| | | .logoView cover-image{ |
| | | width: 33%; |
| | | height: 35px; |
| | | object-fit: cover; |
| | | .logoView image{ |
| | | width: 33%; |
| | | height: 50px; |
| | | margin-right: 20px; |
| | | } |
| | | .bottomView{ |
| | |
| | | } |
| | | .loadingButton{ |
| | | background-color: #ffda1e; |
| | | |
| | | font-family: a1; |
| | | } |
| | | .check { |
| | | |