login.vue 3.1 KB
<template>
  <el-row class="login-box">
    <div v-if="flag">
      <h1>团 体 会 员 登 录</h1>
      <div class="login-form">
        <el-tabs
          v-model="activeName"
        >
          <el-tab-pane label="密码登录" name="user" />
          <el-tab-pane label="短信登录" name="phone" />
          <!-- <el-tab-pane label="微信登录" name="wx" /> -->
        </el-tabs>
        <user v-if="activeName=='user'" @submit="login" @forgetPassword="flag=!flag" />
        <phone v-if="activeName=='phone'" @submit="login" />
        <weixin v-if="activeName=='wx'" @submit="login" />
      </div>
    </div>
    <div v-if="!flag">
      <h1>找 回 密 码</h1>
      <forgetPassword @login="flag=!flag" />
    </div>
  </el-row>
</template>

<script setup>
import { onMounted, ref, watch } from 'vue'
import _ from 'lodash'
import { useRoute, useRouter } from 'vue-router'
import cache from '@/plugins/cache'
import User from './components/user'
import Phone from './components/phone'
import Weixin from './components/weixin'
import forgetPassword from './components/forgetPassword'

const route = useRoute()
const router = useRouter()
const activeName = ref('user')
const flag = ref(true)

let redirect, query
onMounted(() => {
  redirect = route.query.redirect || '/'
  if (redirect && redirect.indexOf('?') > -1) {
    const temp = redirect.split('?')
    redirect = temp[0]
    query = {}
    _.each(temp[1].split('&'), (q) => {
      const t = q.split('=')
      query[t[0]] = t[1]
    })
  }

  if (cache.local.get('activeName')) {
    activeName.value = cache.local.get('activeName')
  }
})

watch(activeName, (val) => {
  cache.local.set('activeName', val)
})

function login() {
  router.push({ path: redirect, query: query })
}

</script>

<style lang="scss" scoped>
.login-box {
  display: flex;
  justify-content: center;
  align-items: center;
}
.text-center {
  color: #fff;
  font-size: 40px;
  font-weight: 700;
  margin-right: 40px;
}
.login-form {
  width: 580px;
  height: 450px;
  background: #FFFFFF;
  box-shadow: 0px 0px 38px 0px rgba(30,98,151,0.73);
  border-radius: 15px;
  padding: 30px 40px;
  :deep(.el-input) {
    height: 40px;
    input {
      height: 40px;
    }
  }
  :deep(.input-icon) {
    height: 39px;
    width: 14px;
    margin-left: 0px;
  }
}
.login-tip {
  font-size: 13px;
  text-align: center;
  color: #bfbfbf;
}

.h3{
  font-size: 36px;
  font-family: Source Han Sans CN;
  font-weight: bold;
  color: #FFFFFF;
  text-align: center;
}
.wxBox{
  position: relative;display: flex;align-items: center;
}
.img{
  height: 20px;
}
.wx{
  font-size: 16px;margin-left: 6px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #29343C;
}

// :deep(.el-form-item){
//   width: 440px;
//   height: 60px;
//   background: #F6F6F6;
//   border: 1px solid #EBEBEB;
//   border-radius: 2px;
//   margin-top: 20px;
//   padding: 0;
// }


// :deep(.el-form-item){
//   height: 60px;
// }
// :deep(.el-form-item__content){
//   height: 60px;
// }
// :deep(.login-form .el-input){
//   height: 60px;
// }
// :deep(.el-input__wrapper){
//   background: #F6F6F6;

// }
h1{text-align: center;    color: #fff;}

</style>