|
@@ -8,6 +8,7 @@
|
|
{{ isPhone ? '短信、密码登录/注册' : '微信扫码快速登录' }}
|
|
{{ isPhone ? '短信、密码登录/注册' : '微信扫码快速登录' }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div v-if="loginType" class="loginType">企业登录</div>
|
|
</div>
|
|
</div>
|
|
<div class="right mr-2 mt-3" v-if="showClose">
|
|
<div class="right mr-2 mt-3" v-if="showClose">
|
|
<v-icon color="grey" size="30">mdi-close</v-icon>
|
|
<v-icon color="grey" size="30">mdi-close</v-icon>
|
|
@@ -54,11 +55,13 @@ import phoneFrom from '@/components/VerificationCode'
|
|
import qrCode from './components/qrCode.vue'
|
|
import qrCode from './components/qrCode.vue'
|
|
|
|
|
|
import { useUserStore } from '@/store/user'
|
|
import { useUserStore } from '@/store/user'
|
|
-import { useRouter } from 'vue-router'
|
|
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
defineOptions({ name: 'login-index' })
|
|
defineOptions({ name: 'login-index' })
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
+const route = useRoute()
|
|
|
|
+const loginType = ref(route.query?.loginType - 0 || null)
|
|
|
|
|
|
const phone = ref()
|
|
const phone = ref()
|
|
let isPhone = ref(false)
|
|
let isPhone = ref(false)
|
|
@@ -78,11 +81,13 @@ const handleLogin = async () => {
|
|
const { valid } = tab.value ? await phoneRef.value.phoneForm.validate() : await passRef.value.passwordForm.validate()
|
|
const { valid } = tab.value ? await phoneRef.value.phoneForm.validate() : await passRef.value.passwordForm.validate()
|
|
if (!valid) return
|
|
if (!valid) return
|
|
loginLoading.value = true
|
|
loginLoading.value = true
|
|
- // type: 1验证码登录 0密码登录
|
|
|
|
- const type = tab.value ? 1 : 0
|
|
|
|
- const query = tab.value ? phoneRef.value.loginData : passRef.value.loginData
|
|
|
|
try {
|
|
try {
|
|
- await userStore.handleTypeLogin(type, query)
|
|
|
|
|
|
+ const type = loginType.value
|
|
|
|
+ if (tab.value === 1) {
|
|
|
|
+ await userStore.handleSmsLogin({ ...phoneRef.value.loginData, type })
|
|
|
|
+ } else {
|
|
|
|
+ await userStore.handlePasswordLogin({ ...passRef.value.loginData, type })
|
|
|
|
+ }
|
|
Snackbar.success('登录成功')
|
|
Snackbar.success('登录成功')
|
|
router.push({ path: '/home' })
|
|
router.push({ path: '/home' })
|
|
}
|
|
}
|
|
@@ -101,6 +106,17 @@ const handlePrivacyPolicy = () => {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.loginType {
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 10px;
|
|
|
|
+ right: 0;
|
|
|
|
+ // width: 100%;
|
|
|
|
+ color: #fff;
|
|
|
|
+ padding: 10px 30px;
|
|
|
|
+ border-radius: 8px 0 0 8px;
|
|
|
|
+ background-color: #ffba5d;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+}
|
|
.login-box {
|
|
.login-box {
|
|
position: relative;
|
|
position: relative;
|
|
width: 100%;
|
|
width: 100%;
|