|
@@ -1,34 +1,31 @@
|
|
|
<template>
|
|
|
- <ion-page v-if="isDev">
|
|
|
+ <ion-page>
|
|
|
<ion-content>
|
|
|
<div class="login-top"></div>
|
|
|
<div class="login-content">
|
|
|
- <div class="login-logo">
|
|
|
- <img/>
|
|
|
- </div>
|
|
|
- <div class="login-system">
|
|
|
- <img/>
|
|
|
+ <div class="login-item">
|
|
|
+ <ion-item>
|
|
|
+ <!-- <ion-icon :icon="personOutline" mode="md"></ion-icon>-->
|
|
|
+ <ion-input v-model="state.formInline.username" type="text" placeholder="请输入用户名"></ion-input>
|
|
|
+ </ion-item>
|
|
|
</div>
|
|
|
- <ion-item :class="['login-item',v$.username.$error?'ion-invalid':'ion-valid']">
|
|
|
- <ion-icon :icon="personOutline" mode="md"></ion-icon>
|
|
|
- <ion-input v-model="state.formInline.username" type="text" placeholder="请输入用户名"></ion-input>
|
|
|
- <ion-note slot="error">用户名不能为空</ion-note>
|
|
|
- </ion-item>
|
|
|
- <ion-item :class="['login-item',v$.password.$error?'ion-invalid':'ion-valid']">
|
|
|
- <ion-icon :icon="lockClosedOutline" mode="md"></ion-icon>
|
|
|
- <ion-input v-model="state.formInline.password" type="password" placeholder="请输入密码"></ion-input>
|
|
|
- <ion-note slot="error">密码不能为空</ion-note>
|
|
|
- </ion-item>
|
|
|
<div class="login-item">
|
|
|
+ <ion-item>
|
|
|
+ <!-- <ion-icon :icon="lockClosedOutline" mode="md"></ion-icon>-->
|
|
|
+ <ion-input v-model="state.formInline.password" type="password" placeholder="请输入密码"></ion-input>
|
|
|
+ </ion-item>
|
|
|
+ </div>
|
|
|
+ <div class="login-btn">
|
|
|
<ion-buttons>
|
|
|
<ion-button @click="handleSubmit()">
|
|
|
登录
|
|
|
</ion-button>
|
|
|
</ion-buttons>
|
|
|
</div>
|
|
|
- <ion-label v-if="errorShow">
|
|
|
- <p>
|
|
|
- {{ msg }}
|
|
|
+ <ion-label class="error-label" v-show="state.errorShow || v$.username.$error || v$.password.$error">
|
|
|
+ <p v-if="v$.username.$error || v$.password.$error" >用户名或密码不能为空</p>
|
|
|
+ <p v-if="state.errorShow && !(v$.username.$error || v$.password.$error)">
|
|
|
+ {{ state.msg }}
|
|
|
</p>
|
|
|
</ion-label>
|
|
|
<ion-loading
|
|
@@ -39,21 +36,16 @@
|
|
|
</ion-loading>
|
|
|
</div>
|
|
|
</ion-content>
|
|
|
-
|
|
|
</ion-page>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import {reactive, ref, toRef, computed, onMounted, getCurrentInstance, onUpdated} from 'vue';
|
|
|
+import {reactive, ref, toRef, computed, onMounted, getCurrentInstance} from 'vue';
|
|
|
import {alertController} from '@ionic/vue';
|
|
|
import {useUserStore} from '@/store/modules/user';
|
|
|
import router from '../router';
|
|
|
-import {personOutline, lockClosedOutline} from 'ionicons/icons';
|
|
|
import {useVuelidate} from '@vuelidate/core'
|
|
|
import {required, minLength} from '@vuelidate/validators'
|
|
|
-import {getConfig} from "@/utils/config";
|
|
|
-import {getUrlParams} from "@/utils/urlUtils";
|
|
|
-import {getOAuthUrl} from "@/api/oauth";
|
|
|
|
|
|
const {appContext: {config: {globalProperties}}} = getCurrentInstance();
|
|
|
|
|
@@ -66,6 +58,8 @@ const state = reactive({
|
|
|
verifyCode: '',
|
|
|
captchaId: '',
|
|
|
},
|
|
|
+ errorShow:false,
|
|
|
+ msg:''
|
|
|
});
|
|
|
|
|
|
const rules = computed(() => {
|
|
@@ -98,7 +92,8 @@ const presentAlert = async (data: any) => {
|
|
|
}
|
|
|
|
|
|
const handleSubmit = async () => {
|
|
|
-
|
|
|
+ state.errorShow=false;
|
|
|
+ state.msg="";
|
|
|
globalProperties.$routeActive = true;
|
|
|
|
|
|
const {username, password, verifyCode} = state.formInline;
|
|
@@ -108,89 +103,20 @@ const handleSubmit = async () => {
|
|
|
if (!isFormCorrect) {
|
|
|
return null;
|
|
|
}
|
|
|
- /*
|
|
|
- if (username.trim() == '' || password.trim() == '') {
|
|
|
- return null;
|
|
|
- }*/
|
|
|
-
|
|
|
- /*if (!verifyCode) {
|
|
|
- return message.warning('请输入验证码!');
|
|
|
- }*/
|
|
|
-
|
|
|
state.loading = true;
|
|
|
|
|
|
const userReq = userStore.login(state.formInline);
|
|
|
userReq.then((data: any) => {
|
|
|
- //setTimeout(() => router.replace((route.query.redirect as string) ?? '/'));
|
|
|
state.loading = false;
|
|
|
state.formInline.password = '';
|
|
|
- /*switch (parseInt(data.userInfo.userTypeId)) {
|
|
|
- case 1:
|
|
|
- router.push('/tapp/tabMain');
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- router.push('/tabs/tabMain');
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- presentAlert("企业端用户未配置首页!");
|
|
|
- break;
|
|
|
- }*/
|
|
|
router.push('/tabs/tabMain');
|
|
|
-
|
|
|
}, (err) => {
|
|
|
state.loading = false;
|
|
|
- //presentAlert(err);
|
|
|
+ state.errorShow=true;
|
|
|
+ state.msg=err.message;
|
|
|
});
|
|
|
-
|
|
|
};
|
|
|
|
|
|
-const oauthLogin = function () {
|
|
|
- getConfig().then((res: any) => {
|
|
|
- if (!res.isDev) {
|
|
|
- const ticket = getUrlParams()["ticket"];
|
|
|
- const tm = getUrlParams()["tm"];
|
|
|
- if (!ticket) {
|
|
|
- getOAuthUrl("cas").then(res => {
|
|
|
- if (res)
|
|
|
- window.location.href = res;
|
|
|
- else
|
|
|
- isDev.value = true;
|
|
|
- }, () => {
|
|
|
- isDev.value = true;
|
|
|
- });
|
|
|
- } else {
|
|
|
- userStore.oauthLogin("cas", ticket, tm).then(data => {
|
|
|
- if (data) {
|
|
|
- globalProperties.$routeActive = true;
|
|
|
- switch (parseInt(data.userInfo.userTypeId)) {
|
|
|
- case 1:
|
|
|
- router.push('/tapp/tabWork');
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- router.push('/tabs/tabMain');
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- isDev.value = true;
|
|
|
- }
|
|
|
- }, () => {
|
|
|
- isDev.value = true;
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- isDev.value = true;
|
|
|
- }
|
|
|
- }, () => {
|
|
|
- isDev.value = true;
|
|
|
- })
|
|
|
-};
|
|
|
-if (location.href.indexOf("loginType=1")>=0) {
|
|
|
- isDev.value = true;
|
|
|
-}else {
|
|
|
- oauthLogin();
|
|
|
-}
|
|
|
|
|
|
onMounted(() => {
|
|
|
globalProperties.$routeActive = false;
|
|
@@ -200,12 +126,12 @@ onMounted(() => {
|
|
|
|
|
|
<style lang="less">
|
|
|
ion-content {
|
|
|
- --background: #fafafa !important;
|
|
|
+ --background: #ffffff !important;
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
.login-top {
|
|
|
- background-image: url("./../assets/icon/login-bg.jpg");
|
|
|
+ background-image: url("./../assets/icon/login-bg.png");
|
|
|
width: 100%;
|
|
|
height: 35%;
|
|
|
background-size: 100% 100%;
|
|
@@ -213,13 +139,11 @@ ion-content {
|
|
|
|
|
|
.login-content {
|
|
|
position: relative;
|
|
|
- padding: 20px 20px;
|
|
|
- top: -50px;
|
|
|
- border-radius: 20px;
|
|
|
+ padding: 40px 40px;
|
|
|
+ top: -35px;
|
|
|
+ border-radius: 30px;
|
|
|
background: #ffffff;
|
|
|
- margin: 0 20px;
|
|
|
- opacity: 0.9;
|
|
|
- box-shadow: 0 0px 2px rgba(0, 0, 0, .2);
|
|
|
+ /*margin: 0 20px;*/
|
|
|
|
|
|
.login-logo {
|
|
|
margin-bottom: 15px;
|
|
@@ -242,52 +166,51 @@ ion-content {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .login-item {
|
|
|
+ .login-item{
|
|
|
margin-bottom: 15px;
|
|
|
- --border-color: #d0d1d3;
|
|
|
- /*margin: 15px 0;
|
|
|
-
|
|
|
- ion-label {
|
|
|
- color: #C0C7CD;
|
|
|
- margin: 10px 0;
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
+ ion-item {
|
|
|
+ --inner-border-width: 0px;
|
|
|
+ --background: #F3F3F3;
|
|
|
+ border-radius: 30px;
|
|
|
|
|
|
- ion-input {
|
|
|
- background: #F5F5F5;
|
|
|
- border-radius: 8px;
|
|
|
- margin-top: 5px;
|
|
|
- }*/
|
|
|
+ ion-icon {
|
|
|
+ color: #b7b8bb;
|
|
|
+ }
|
|
|
|
|
|
- ion-icon {
|
|
|
- color: #b7b8bb;
|
|
|
- }
|
|
|
+ ion-input {
|
|
|
+ color: #7a7b80;
|
|
|
+ }
|
|
|
|
|
|
- ion-input {
|
|
|
- margin-left: 10px;
|
|
|
- color: #7a7b80;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ .login-btn {
|
|
|
+ border: none;
|
|
|
}
|
|
|
|
|
|
ion-item::part(native) {
|
|
|
padding: 0 30px 0 30px;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
ion-buttons {
|
|
|
- margin: 30px 20px;
|
|
|
+ margin: 30px 0px;
|
|
|
|
|
|
ion-button {
|
|
|
width: 100%;
|
|
|
+ color: white;
|
|
|
--background: #39A9FF !important;
|
|
|
--box-shadow: 0px 1px 5px #39A9FF;
|
|
|
- color: white;
|
|
|
- --border-radius: 18px !important;
|
|
|
+ --border-radius: 30px !important;
|
|
|
height: 40px;
|
|
|
font-size: 18px;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ .error-label{
|
|
|
+ text-align: center;
|
|
|
+ p{
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|