| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <!--
- * @Author: liuzhenlin 461480418@qq.ocm
- * @Date: 2023-01-12 11:57:48
- * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-03-21 15:37:55
- * @Description: file content
- * @FilePath: \oms\pages\login\index.vue
- -->
- <template>
- <view class="login">
- <view class="nav">
- <view :style="{ paddingTop }">
- <view class="title" :style="[{ height }, { lineHeight: height }]">
- <text>OMS</text>
- </view>
- </view>
- </view>
- <view class="main">
- <view class="bg flex1">
- <view class="tips">欢迎使用OMS</view>
- <image class="login-img" src="../../static/images/login.png" mode="scaleToFill" />
- </view>
- <u-form :model="loginForm" :rules="rules" ref="loginForm" label-width="0">
- <u-form-item prop="username" customStyle="padding-top:38rpx;border-bottom:1px solid #CDCDCD">
- <u-input placeholder="请输⼊账号" v-model="loginForm.username" border="none" clearable></u-input>
- </u-form-item>
- <u-form-item prop="password" customStyle="padding-top:38rpx;border-bottom:1px solid #CDCDCD">
- <u-input
- placeholder="请输⼊密码"
- :password="true"
- v-model="loginForm.password"
- border="none"
- clearable></u-input>
- </u-form-item>
- </u-form>
- <view style="padding-top: 30rpx">
- <u-checkbox-group v-model="loginForm.rememberPassword">
- <u-checkbox shape="circle" label="记住密码" name="checked"></u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="protocol-wrap">
- <u-checkbox-group v-model="isAgreed">
- <u-checkbox shape="circle" label="我已阅读并同意" name="checked"></u-checkbox>
- </u-checkbox-group>
- <text class="btn" @click="openProrocol()">《用户隐私协议》</text>
- </view>
- <view class="login-btn" @click="handleLogin()">登录</view>
- <view class="footer">
- <u-text color="#646464" size="24rpx" align="center" text="由-青岛大数华创科技有限公司 提供技术支持"></u-text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapActions } from 'vuex'
- import to from 'await-to-js'
- export default {
- name: 'omsIndex',
- data() {
- return {
- isAgreed: false,
- height: '',
- paddingTop: '',
- loginForm: {
- username: '',
- password: '',
- rememberPassword: [],
- },
- rules: {
- username: {
- type: 'string',
- required: true,
- message: '请填写账号',
- trigger: ['blur'],
- },
- password: {
- type: 'string',
- required: true,
- message: '请填写密码',
- trigger: ['blur'],
- },
- },
- }
- },
- onLoad() {
- // 检查本地存储是否保存了用户名和密码
- const userInfo = uni.getStorageSync('userInfo')
- if (userInfo) {
- this.loginForm.username = userInfo.username
- this.loginForm.password = userInfo.password
- this.loginForm.rememberPassword = ['checked']
- }
- },
- created() {
- const navData = uni.getMenuButtonBoundingClientRect()
- this.height = navData.height + 'px'
- this.paddingTop = navData.top + 'px'
- },
- mounted() {},
- methods: {
- ...mapActions(['login']),
- async handleLogin() {
- if (!this.isAgreed) {
- uni.showToast({
- title: '请先阅读并同意用户协议和隐私协议',
- icon: 'none',
- })
- return
- }
- const [valid] = await to(this.$refs.loginForm.validate())
- if (valid !== null) return
- await this.login(this.loginForm)
- },
- async openProrocol() {
- const url = '/pages/login/protocol-user'
- console.log(url)
- uni.navigateTo({
- //保留当前页面,跳转到应用内的某个页面
- url,
- })
- },
- },
- }
- </script>
- <style>
- page {
- background: #fff;
- }
- </style>
- <style lang="scss" scoped>
- .login {
- padding-top: 188rpx;
- .nav {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- background: #ffffff;
- .title {
- position: relative;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- color: #000;
- .back {
- position: absolute;
- top: 0;
- bottom: 0;
- margin: auto;
- left: 70rpx;
- display: flex;
- }
- }
- }
- .main {
- position: absolute;
- width: 100%;
- height: calc(100vh - 188rpx);
- background: #ffffff;
- padding: 0 88rpx 0 90rpx;
- .bg {
- padding-top: 40rpx;
- .tips {
- font-size: 46rpx;
- font-weight: bold;
- color: #060606;
- }
- .login-img {
- width: 292rpx;
- height: 292rpx;
- }
- }
- .login-btn {
- margin-top: 42rpx;
- width: 100%;
- height: 92rpx;
- background: #3e7ef8;
- border-radius: 32rpx;
- font-size: 32rpx;
- color: #ffffff;
- text-align: center;
- line-height: 92rpx;
- }
- .footer {
- position: absolute;
- bottom: 100rpx;
- left: 0;
- right: 0;
- margin: auto;
- }
- }
- }
- .protocol-wrap {
- display: flex;
- align-items: center;
- margin-top: 30rpx;
- text {
- font-size: 26rpx;
- color: #646464;
- }
- .btn {
- color: #409eff;
- }
- }
- </style>
|