调整部分框架

This commit is contained in:
aixianling
2022-05-30 18:46:49 +08:00
parent 16beb074f6
commit 8e9a7de387
7 changed files with 112 additions and 59 deletions

View File

@@ -1,31 +1,40 @@
<template>
<section class="login">
<div v-if="appPath" class="gotoApp">
<b v-text="appPath"/>
<div>正在登录...</div>
</div>
<u-form :model="form" ref="loginForm" label-width="140" :rules="rules">
<u-form-item label="账号" prop="username">
<u-input v-model="form.username" placeholder="请输入手机号"/>
<input v-model="form.username" placeholder="请输入手机号"/>
</u-form-item>
<u-form-item label="密码" prop="password">
<u-input type="password" v-model="form.password" placeholder="请输入密码"/>
<input type="password" v-model="form.password" placeholder="请输入密码" @confirm="handleLogin"/>
</u-form-item>
</u-form>
<div bottom>
<u-button type="primary" @tap="handleLogin">登录</u-button>
</div>
<div class="btn" @tap="handleLogin">登录</div>
</section>
</template>
<script>
import {mapActions, mapMutations} from "vuex";
import {mapActions, mapMutations, mapState} from "vuex";
export default {
name: "login",
inject: ['root'],
computed: {
...mapState(['apps']),
rules() {
return {
username: [{required: true, message: "请输入 手机号"}],
password: [{required: true, message: "请输入 密码"}],
}
},
target() {
return decodeURIComponent(this.$route.query.back) || ""
},
appPath() {
let app = this.apps.find(e => this.target.indexOf(e.libPath) > -1)
return app?.label || ""
}
},
data() {
@@ -40,7 +49,7 @@ export default {
this.$refs.loginForm.validate(v => {
if (v) {
this.getToken(this.form).then(() => {
uni.navigateBack({})
this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({})
}).catch(() => 0)
}
})
@@ -60,9 +69,29 @@ export default {
box-sizing: border-box;
height: 100%;
.vcode {
color: $uni-color-primary;
cursor: pointer;
.btn {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
background: $uni-color-primary;
color: #fff;
text-align: center;
line-height: 96px;
font-size: 32px;
}
.gotoApp {
background: #fff;
text-align: center;
padding: 32px;
b {
display: block;
font-size: 40px;
margin-bottom: 8px;
}
}
}
</style>