mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-23 20:44:58 +08:00
登录调试通了
This commit is contained in:
parent
e42ec83d42
commit
2c3acbcaaf
13
index.html
13
index.html
|
@ -1,12 +1,13 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="referrer" content="no-referrer"/>
|
||||||
<title>瑞鞍星医疗科技</title>
|
<title>瑞鞍星医疗科技</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
"vant": "^4.8.3",
|
"vant": "^4.8.3",
|
||||||
"vue": "^3.2.45",
|
"vue": "^3.2.45",
|
||||||
"vue-router": "^4.1.6",
|
"vue-router": "^4.1.6",
|
||||||
"xlsx": "^0.18.5"
|
"xlsx": "^0.18.5",
|
||||||
|
"crypto-js": "4.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import axios from "axios";
|
||||||
|
import * as other from "@/utils/other";
|
||||||
|
import {HOST} from "@/utils/request";
|
||||||
|
|
||||||
|
const FORM_CONTENT_TYPE = 'application/x-www-form-urlencoded';
|
||||||
|
|
||||||
|
export const login = (data: any) => {
|
||||||
|
|
||||||
|
const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_PWD_ENC_KEY);
|
||||||
|
|
||||||
|
let encPassword = data.password;
|
||||||
|
|
||||||
|
encPassword = other.encryption(data.password, "thanks,rax");
|
||||||
|
data.grant_type = 'password';
|
||||||
|
data.scope = 'server';
|
||||||
|
return axios.request({
|
||||||
|
url: '/api/admin/oauth2/token',
|
||||||
|
method: 'post',
|
||||||
|
data: {...data, password: encPassword},
|
||||||
|
headers: {
|
||||||
|
skipToken: true,
|
||||||
|
Authorization: basicAuth,
|
||||||
|
'Content-Type': FORM_CONTENT_TYPE,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,33 @@
|
||||||
|
// @ts-ignore
|
||||||
|
import * as CryptoJS from 'crypto-js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*加密处理
|
||||||
|
*/
|
||||||
|
export function encryption(src: string, keyWord: string) {
|
||||||
|
const key = CryptoJS.enc.Utf8.parse(keyWord);
|
||||||
|
// 加密
|
||||||
|
var encrypted = CryptoJS.AES.encrypt(src, key, {
|
||||||
|
iv: key,
|
||||||
|
mode: CryptoJS.mode.CFB,
|
||||||
|
padding: CryptoJS.pad.NoPadding,
|
||||||
|
});
|
||||||
|
return encrypted.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密
|
||||||
|
* @param {*} params 参数列表
|
||||||
|
* @returns 明文
|
||||||
|
*/
|
||||||
|
export function decryption(src: string, keyWord: string) {
|
||||||
|
const key = CryptoJS.enc.Utf8.parse(keyWord);
|
||||||
|
// 解密逻辑
|
||||||
|
var decryptd = CryptoJS.AES.decrypt(src, key, {
|
||||||
|
iv: key,
|
||||||
|
mode: CryptoJS.mode.CFB,
|
||||||
|
padding: CryptoJS.pad.NoPadding,
|
||||||
|
});
|
||||||
|
|
||||||
|
return decryptd.toString(CryptoJS.enc.Utf8);
|
||||||
|
}
|
|
@ -1,139 +1,142 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login-page">
|
<div class="login-page">
|
||||||
<div class="left-content move_4"></div>
|
<div class="left-content move_4"></div>
|
||||||
<div class="right-content">
|
<div class="right-content">
|
||||||
<div class="select-hospital-box">
|
<div class="select-hospital-box">
|
||||||
<el-select class="select-hospital" v-model="currentHospital" size="small" @change="selectHospital">
|
<el-select class="select-hospital" v-model="currentHospital" size="small" @change="selectHospital">
|
||||||
<el-option v-for="item in hospitals" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in hospitals" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<img v-show="!isShowRegister" class="logo move_2" src="@/assets/imgs/logo.png">
|
|
||||||
<div v-if="!isShowRegister" class="login-block move_2">
|
|
||||||
<div class="login-way">
|
|
||||||
<span :class="passwordLogin && 'active'" @click="passwordLogin = true">密码登录</span>
|
|
||||||
<span :class="!passwordLogin && 'active'" @click="passwordLogin = false">验证码登录</span>
|
|
||||||
</div>
|
|
||||||
<el-form ref="loginFormRef" :model="loginParams" :rules="loginRules" label-width="0" size="small">
|
|
||||||
<div class="login-form password-login" v-if="passwordLogin">
|
|
||||||
<el-form-item prop="account">
|
|
||||||
<el-input v-model="loginParams.account" placeholder="请输入用户名">
|
|
||||||
<template #prepend>
|
|
||||||
<el-icon>
|
|
||||||
<User/>
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item prop="password">
|
|
||||||
<el-input v-model="loginParams.password" type="password" show-password placeholder="请输入密码">
|
|
||||||
<template #prepend>
|
|
||||||
<el-icon>
|
|
||||||
<Lock/>
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-button :loading="loading" class="login-btn" type="primary" @click="login('password')">登录</el-button>
|
|
||||||
<span class="register-btn" @click="getCaptchaCode()">注册账号</span>
|
|
||||||
</div>
|
|
||||||
<div class="login-form code-login" v-else>
|
|
||||||
<el-form-item prop="phone">
|
|
||||||
<el-input v-model="loginParams.phone" placeholder="请输入手机号">
|
|
||||||
<template #prepend>
|
|
||||||
<div @click.stop style="display: flex;align-items: center;">
|
|
||||||
<el-dropdown @command="selectPhoneArea">
|
|
||||||
<span style="color: #909399;">{{ loginParams.phoneArea }}<el-icon>
|
|
||||||
<DCaret />
|
|
||||||
</el-icon></span>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item v-for="item in phoneAreas" :command="item">{{ item
|
|
||||||
}}</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item prop="code">
|
|
||||||
<el-input v-model="loginParams.code" placeholder="请输入6位短信验证码">
|
|
||||||
<template #append>
|
|
||||||
<span class="send-btn" @click="sendCode">{{ loginParams.sendText }}</span>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-button class="login-btn" type="primary" @click="login('code')">登录</el-button>
|
|
||||||
</div>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
<div v-else class="register-block move_2">
|
|
||||||
<div class="header-box">
|
|
||||||
<span class="title">新用户申请</span>
|
|
||||||
<el-icon @click="isShowRegister = false">
|
|
||||||
<Close />
|
|
||||||
</el-icon>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-form ref="registerFormRef" :model="registerParams" :rules="registerRules" label-width="100">
|
|
||||||
<el-form-item label="用户名" prop="account">
|
|
||||||
<el-input v-model="registerParams.account" placeholder="请输入用户名"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="密码" prop="password">
|
|
||||||
<el-input v-model="registerParams.password" type="password" show-password
|
|
||||||
placeholder="请输入密码"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="姓名" prop="name">
|
|
||||||
<el-input v-model="registerParams.name" placeholder="请输入姓名"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="手机号" prop="phone">
|
|
||||||
<el-input v-model="registerParams.phone" placeholder="请输入手机号"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="医院" prop="hospital">
|
|
||||||
<el-select v-model="registerParams.hospital" style="width: 100%;">
|
|
||||||
<el-option v-for="item in hospitals" :key="item.value" :label="item.label"
|
|
||||||
:value="item.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="性别" prop="sex">
|
|
||||||
<el-radio-group v-model="registerParams.sex">
|
|
||||||
<el-radio label="男" />
|
|
||||||
<el-radio label="女" />
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="验证码" prop="code">
|
|
||||||
<el-input v-model="registerParams.code" placeholder="请输入验证码"
|
|
||||||
style="width: calc(100% - 110px);"></el-input>
|
|
||||||
<img width="100" height="32" style="margin-left: 10px;" :src="captchaImgUrl" />
|
|
||||||
<a class="change_img" @click="refreshImg" href="#">看不清?</a>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
<div class="footer-box">
|
|
||||||
<el-button type="primary" @click="register">注 册</el-button>
|
|
||||||
<span @click="isShowRegister = false">已有账号?</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<img v-show="!isShowRegister" class="logo move_2" src="@/assets/imgs/logo.png">
|
||||||
|
<div v-if="!isShowRegister" class="login-block move_2">
|
||||||
|
<div class="login-way">
|
||||||
|
<span :class="passwordLogin && 'active'" @click="passwordLogin = true">密码登录</span>
|
||||||
|
<span :class="!passwordLogin && 'active'" @click="passwordLogin = false">验证码登录</span>
|
||||||
</div>
|
</div>
|
||||||
|
<el-form ref="loginFormRef" :model="loginParams" :rules="loginRules" label-width="0" size="small">
|
||||||
|
<div class="login-form password-login" v-if="passwordLogin">
|
||||||
|
<el-form-item prop="account">
|
||||||
|
<el-input v-model="loginParams.account" placeholder="请输入用户名">
|
||||||
|
<template #prepend>
|
||||||
|
<el-icon>
|
||||||
|
<User/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="password">
|
||||||
|
<el-input v-model="loginParams.password" type="password" show-password placeholder="请输入密码">
|
||||||
|
<template #prepend>
|
||||||
|
<el-icon>
|
||||||
|
<Lock/>
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-button :loading="loading" class="login-btn" type="primary" @click="login('password')">登录</el-button>
|
||||||
|
<span class="register-btn" @click="getCaptchaCode()">注册账号</span>
|
||||||
|
</div>
|
||||||
|
<div class="login-form code-login" v-else>
|
||||||
|
<el-form-item prop="phone">
|
||||||
|
<el-input v-model="loginParams.phone" placeholder="请输入手机号">
|
||||||
|
<template #prepend>
|
||||||
|
<div @click.stop style="display: flex;align-items: center;">
|
||||||
|
<el-dropdown @command="selectPhoneArea">
|
||||||
|
<span style="color: #909399;">{{ loginParams.phoneArea }}<el-icon>
|
||||||
|
<DCaret/>
|
||||||
|
</el-icon></span>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item v-for="item in phoneAreas" :command="item">{{
|
||||||
|
item
|
||||||
|
}}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="code">
|
||||||
|
<el-input v-model="loginParams.code" placeholder="请输入6位短信验证码">
|
||||||
|
<template #append>
|
||||||
|
<span class="send-btn" @click="sendCode">{{ loginParams.sendText }}</span>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-button class="login-btn" type="primary" @click="login('code')">登录</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div v-else class="register-block move_2">
|
||||||
|
<div class="header-box">
|
||||||
|
<span class="title">新用户申请</span>
|
||||||
|
<el-icon @click="isShowRegister = false">
|
||||||
|
<Close/>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-form ref="registerFormRef" :model="registerParams" :rules="registerRules" label-width="100">
|
||||||
|
<el-form-item label="用户名" prop="account">
|
||||||
|
<el-input v-model="registerParams.account" placeholder="请输入用户名"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="密码" prop="password">
|
||||||
|
<el-input v-model="registerParams.password" type="password" show-password
|
||||||
|
placeholder="请输入密码"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="姓名" prop="name">
|
||||||
|
<el-input v-model="registerParams.name" placeholder="请输入姓名"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号" prop="phone">
|
||||||
|
<el-input v-model="registerParams.phone" placeholder="请输入手机号"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="医院" prop="hospital">
|
||||||
|
<el-select v-model="registerParams.hospital" style="width: 100%;">
|
||||||
|
<el-option v-for="item in hospitals" :key="item.value" :label="item.label"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="性别" prop="sex">
|
||||||
|
<el-radio-group v-model="registerParams.sex">
|
||||||
|
<el-radio label="男"/>
|
||||||
|
<el-radio label="女"/>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="验证码" prop="code">
|
||||||
|
<el-input v-model="registerParams.code" placeholder="请输入验证码"
|
||||||
|
style="width: calc(100% - 110px);"></el-input>
|
||||||
|
<img width="100" height="32" style="margin-left: 10px;" :src="captchaImgUrl"/>
|
||||||
|
<a class="change_img" @click="refreshImg" href="#">看不清?</a>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<div class="footer-box">
|
||||||
|
<el-button type="primary" @click="register">注 册</el-button>
|
||||||
|
<span @click="isShowRegister = false">已有账号?</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<SliderVerify v-model:isShowSelf="sliderVConf.isShowSelf" :width="sliderVConf.width" :imgUrl="sliderImgUrl"
|
</div>
|
||||||
:height="sliderVConf.height" @success="toHome"></SliderVerify>
|
<SliderVerify v-model:isShowSelf="sliderVConf.isShowSelf" :width="sliderVConf.width" :imgUrl="sliderImgUrl"
|
||||||
|
:height="sliderVConf.height" @success="sliderSuccess"></SliderVerify>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { ElNotification } from 'element-plus';
|
import {ElNotification} from 'element-plus';
|
||||||
//引入获取当前时间的函数
|
//引入获取当前时间的函数
|
||||||
import { getTime } from '@/utils/time';
|
import {getTime} from '@/utils/time';
|
||||||
import {onMounted, reactive, ref, toRefs, watch} from 'vue'
|
import {onMounted, reactive, ref, toRefs, watch} from 'vue'
|
||||||
import {useRouter,useRoute} from 'vue-router'
|
import {useRouter, useRoute} from 'vue-router'
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import {useLoginStore} from '@/stores/user-info-store'
|
import {useLoginStore} from '@/stores/user-info-store'
|
||||||
import {getHospitalsData, getPhoneAreasData} from '@/static-data/core'
|
import {getHospitalsData, getPhoneAreasData} from '@/static-data/core'
|
||||||
import {v4} from "uuid";
|
import {v4} from "uuid";
|
||||||
import {HOST} from "@/utils/request";
|
import {HOST, post} from "@/utils/request";
|
||||||
import SliderVerify from "@/components/SliderVerify/index.vue";
|
import SliderVerify from "@/components/SliderVerify/index.vue";
|
||||||
|
import * as loginApi from "@/api/acl/login";
|
||||||
|
|
||||||
|
|
||||||
//引入用户相关的小仓库
|
//引入用户相关的小仓库
|
||||||
|
@ -144,7 +147,7 @@ const router = useRouter()
|
||||||
|
|
||||||
const hospitals = ref([] as any)
|
const hospitals = ref([] as any)
|
||||||
getHospitalsData().then((res: any) => {
|
getHospitalsData().then((res: any) => {
|
||||||
hospitals.value = res
|
hospitals.value = res
|
||||||
})
|
})
|
||||||
const phoneAreas: any = getPhoneAreasData()
|
const phoneAreas: any = getPhoneAreasData()
|
||||||
|
|
||||||
|
@ -189,38 +192,38 @@ const validatorPhone = (rule: any, value: any, callback: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginRules = reactive({
|
const loginRules = reactive({
|
||||||
account: [
|
account: [
|
||||||
{ required: true, validator: validatorUserName, trigger: 'change' },
|
{required: true, validator: validatorUserName, trigger: 'change'},
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, validator: validatorPassword, trigger: 'change' },
|
{required: true, validator: validatorPassword, trigger: 'change'},
|
||||||
],
|
],
|
||||||
phone: [
|
phone: [
|
||||||
{ required: true, validator:validatorPhone, trigger: 'blur' },
|
{required: true, validator: validatorPhone, trigger: 'blur'},
|
||||||
],
|
],
|
||||||
code: [
|
code: [
|
||||||
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
{required: true, message: '请输入验证码', trigger: 'blur'},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
const registerRules = reactive({
|
const registerRules = reactive({
|
||||||
account: [
|
account: [
|
||||||
{ required: true, validator: validatorUserName, trigger: 'change' },
|
{required: true, validator: validatorUserName, trigger: 'change'},
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, validator: validatorUserName, trigger: 'change' },
|
{required: true, validator: validatorUserName, trigger: 'change'},
|
||||||
],
|
],
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
{required: true, message: '请输入用户名', trigger: 'blur'},
|
||||||
],
|
],
|
||||||
phone: [
|
phone: [
|
||||||
{ required: true, validator:validatorPhone, trigger: 'change' },
|
{required: true, validator: validatorPhone, trigger: 'change'},
|
||||||
],
|
],
|
||||||
hospital: [
|
hospital: [
|
||||||
{ required: true, message: '请选择医院', trigger: 'blur' },
|
{required: true, message: '请选择医院', trigger: 'blur'},
|
||||||
],
|
],
|
||||||
code: [
|
code: [
|
||||||
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
{required: true, message: '请输入验证码', trigger: 'blur'},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
//获取路由器
|
//获取路由器
|
||||||
|
@ -234,109 +237,110 @@ const currentHospital = ref(useLoginStore().getlogin().hospital)
|
||||||
const isShowRegister = ref(false)
|
const isShowRegister = ref(false)
|
||||||
const passwordLogin = ref(true)
|
const passwordLogin = ref(true)
|
||||||
const loginParams = ref({
|
const loginParams = ref({
|
||||||
account: 'admin',
|
account: 'admin',
|
||||||
name: '',
|
name: '',
|
||||||
password: '123456',
|
password: '123456',
|
||||||
phone: '',
|
phone: '',
|
||||||
phoneArea: phoneAreas[0],
|
phoneArea: phoneAreas[0],
|
||||||
code: '',
|
code: '',
|
||||||
isSendCode: false,
|
isSendCode: false,
|
||||||
sendTimer: 0,
|
sendTimer: 0,
|
||||||
sendText: '获取短信验证码'
|
sendText: '获取短信验证码'
|
||||||
})
|
})
|
||||||
const registerParams = ref({
|
const registerParams = ref({
|
||||||
account: '',
|
account: '',
|
||||||
password: '',
|
password: '',
|
||||||
name: '',
|
name: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
hospital: '',
|
hospital: '',
|
||||||
sex: '',
|
sex: '',
|
||||||
code: ''
|
code: ''
|
||||||
})
|
})
|
||||||
const sliderVConf = ref({
|
const sliderVConf = ref({
|
||||||
isShowSelf: false,
|
isShowSelf: false,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 200
|
height: 200
|
||||||
})
|
})
|
||||||
|
|
||||||
const captchaImgUrl = ref('')
|
const captchaImgUrl = ref('')
|
||||||
const sliderImgUrl = ref('')
|
const sliderImgUrl = ref('')
|
||||||
|
|
||||||
const selectHospital = (e: string) => {
|
const selectHospital = (e: string) => {
|
||||||
// console.log(e)
|
// console.log(e)
|
||||||
}
|
}
|
||||||
const register = async () => {
|
const register = async () => {
|
||||||
await registerFormRef.value.validate((valid: any, fields: any) => {
|
await registerFormRef.value.validate((valid: any, fields: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'注册成功,是否登录?',
|
'注册成功,是否登录?',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
draggable: true
|
draggable: true
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
loginParams.value.account = registerFormRef.value.account
|
loginParams.value.account = registerFormRef.value.account
|
||||||
loginParams.value.name = registerFormRef.value.name
|
loginParams.value.name = registerFormRef.value.name
|
||||||
currentHospital.value = registerFormRef.value.hospital
|
currentHospital.value = registerFormRef.value.hospital
|
||||||
toHome()
|
toHome()
|
||||||
}).catch(() => { })
|
}).catch(() => {
|
||||||
} else {
|
})
|
||||||
// console.log('error submit!', fields)
|
} else {
|
||||||
}
|
// console.log('error submit!', fields)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const selectPhoneArea = (e: string) => {
|
const selectPhoneArea = (e: string) => {
|
||||||
loginParams.value.phoneArea = e
|
loginParams.value.phoneArea = e
|
||||||
}
|
}
|
||||||
const sendCode = () => {
|
const sendCode = () => {
|
||||||
if (loginParams.value.isSendCode) return
|
if (loginParams.value.isSendCode) return
|
||||||
let num = 60
|
let num = 60
|
||||||
ElMessage.success('发送成功!')
|
ElMessage.success('发送成功!')
|
||||||
loginParams.value.isSendCode = true
|
loginParams.value.isSendCode = true
|
||||||
loginParams.value.sendText = '请' + num + '秒后重新发送'
|
loginParams.value.sendText = '请' + num + '秒后重新发送'
|
||||||
loginParams.value.sendTimer = setInterval(() => {
|
loginParams.value.sendTimer = setInterval(() => {
|
||||||
num--
|
num--
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
loginParams.value.sendText = '请' + num + '秒后重新发送'
|
loginParams.value.sendText = '请' + num + '秒后重新发送'
|
||||||
} else {
|
} else {
|
||||||
loginParams.value.isSendCode = false
|
loginParams.value.isSendCode = false
|
||||||
loginParams.value.sendText = '重新获取短信验证码'
|
loginParams.value.sendText = '重新获取短信验证码'
|
||||||
clearInterval(loginParams.value.sendTimer)
|
clearInterval(loginParams.value.sendTimer)
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
const login = async (type: string) => {
|
const login = async (type: string) => {
|
||||||
const obj = loginParams.value
|
const obj = loginParams.value
|
||||||
if (!currentHospital.value) {
|
if (!currentHospital.value) {
|
||||||
ElMessage.warning('请在右上角选择院区')
|
ElMessage.warning('请在右上角选择院区')
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
await loginFormRef.value.validate((valid: any, fields: any) => {
|
||||||
|
if (valid) {
|
||||||
|
// console.log('submit!')
|
||||||
|
sliderVConf.value.isShowSelf = true
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// console.log('error submit!', fields)
|
||||||
}
|
}
|
||||||
await loginFormRef.value.validate((valid: any, fields: any) => {
|
|
||||||
if (valid) {
|
|
||||||
// console.log('submit!')
|
|
||||||
sliderVConf.value.isShowSelf = true
|
|
||||||
|
|
||||||
} else {
|
//加载效果:开始加载
|
||||||
// console.log('error submit!', fields)
|
loading.value = true;
|
||||||
}
|
|
||||||
|
|
||||||
//加载效果:开始加载
|
/*try {
|
||||||
loading.value = true;
|
//保证登录成功
|
||||||
|
await useStore.userLogin(loginFormRef);
|
||||||
|
//编程式导航跳转到展示数据首页
|
||||||
|
//判断登录的时候,路由路径当中是否有query参数,如果有就往query参数挑战,没有跳转到首页
|
||||||
|
let redirect: any = $route.query.redirect;
|
||||||
|
$router.push({ path: redirect || '/' });
|
||||||
|
|
||||||
/*try {
|
//登录成功加载效果也消失
|
||||||
//保证登录成功
|
loading.value = false;
|
||||||
await useStore.userLogin(loginFormRef);
|
}*/
|
||||||
//编程式导航跳转到展示数据首页
|
|
||||||
//判断登录的时候,路由路径当中是否有query参数,如果有就往query参数挑战,没有跳转到首页
|
|
||||||
let redirect: any = $route.query.redirect;
|
|
||||||
$router.push({ path: redirect || '/' });
|
|
||||||
|
|
||||||
//登录成功加载效果也消失
|
|
||||||
loading.value = false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
/*} catch (error) {
|
/*} catch (error) {
|
||||||
|
@ -348,7 +352,7 @@ const login = async (type: string) => {
|
||||||
message: (error as Error).message
|
message: (error as Error).message
|
||||||
})*/
|
})*/
|
||||||
|
|
||||||
})
|
})
|
||||||
//登录成功加载效果也消失
|
//登录成功加载效果也消失
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
@ -363,6 +367,18 @@ function refreshImg() {
|
||||||
captchaImgUrl.value = HOST + '/admin/code/textImage?randomStr=' + randomStr
|
captchaImgUrl.value = HOST + '/admin/code/textImage?randomStr=' + randomStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sliderSuccess() {
|
||||||
|
loginApi.login({
|
||||||
|
username: loginParams.value.account, // 用户名
|
||||||
|
password: loginParams.value.password, // 密码
|
||||||
|
randomStr: v4()
|
||||||
|
}).then((data: any) => {
|
||||||
|
console.log(data);
|
||||||
|
})
|
||||||
|
|
||||||
|
// toHome()
|
||||||
|
}
|
||||||
|
|
||||||
const toHome = () => {
|
const toHome = () => {
|
||||||
|
|
||||||
ElNotification({
|
ElNotification({
|
||||||
|
@ -372,186 +388,193 @@ const toHome = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const getPermissions = () => {
|
const getPermissions = () => {
|
||||||
let permissions = '普通用户'
|
let permissions = '普通用户'
|
||||||
switch (loginParams.value.account) {
|
switch (loginParams.value.account) {
|
||||||
|
|
||||||
case 'admin':
|
case 'admin':
|
||||||
permissions = '超级管理员'
|
permissions = '超级管理员'
|
||||||
break;
|
break;
|
||||||
case 'dev1':
|
case 'dev1':
|
||||||
permissions = '高级管理员'
|
permissions = '高级管理员'
|
||||||
break;
|
break;
|
||||||
case 'dev2':
|
case 'dev2':
|
||||||
permissions = '中级管理员'
|
permissions = '中级管理员'
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
return permissions
|
|
||||||
}
|
}
|
||||||
useLoginStore().setlogin('isLogin', true)
|
return permissions
|
||||||
useLoginStore().setlogin('account', loginParams.value.account)
|
}
|
||||||
useLoginStore().setlogin('name', loginParams.value.name || '暂未设置姓名')
|
useLoginStore().setlogin('isLogin', true)
|
||||||
useLoginStore().setlogin('hospital', currentHospital.value)
|
useLoginStore().setlogin('account', loginParams.value.account)
|
||||||
useLoginStore().setlogin('permissions', getPermissions())
|
useLoginStore().setlogin('name', loginParams.value.name || '暂未设置姓名')
|
||||||
router.push('/home')
|
useLoginStore().setlogin('hospital', currentHospital.value)
|
||||||
|
useLoginStore().setlogin('permissions', getPermissions())
|
||||||
|
router.push('/home')
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.login-page {
|
.login-page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
|
||||||
|
.left-content {
|
||||||
|
width: 50%;
|
||||||
|
height: 100%;
|
||||||
|
background: url(@/assets/imgs/login/login_bck.png) no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-content {
|
||||||
|
position: relative;
|
||||||
|
width: 50%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #F8F8F8;
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.left-content {
|
.select-hospital-box {
|
||||||
width: 50%;
|
position: absolute;
|
||||||
height: 100%;
|
top: 25px;
|
||||||
background: url(@/assets/imgs/login/login_bck.png) no-repeat;
|
right: 25px;
|
||||||
background-size: cover;
|
|
||||||
}
|
}
|
||||||
.right-content {
|
|
||||||
position: relative;
|
.logo {
|
||||||
width: 50%;
|
height: 70px;
|
||||||
height: 100%;
|
}
|
||||||
|
|
||||||
|
.login-block {
|
||||||
|
width: 65%;
|
||||||
|
height: 430px;
|
||||||
|
min-width: 500px;
|
||||||
|
min-height: 300px;
|
||||||
|
padding: 50px;
|
||||||
|
margin-top: 20px;
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
.login-way {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #909399;
|
||||||
|
|
||||||
|
span {
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
color: $main-color;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form {
|
||||||
|
:deep(.el-input) {
|
||||||
|
font-size: 16px;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
.el-input-group__prepend,
|
||||||
|
.el-input__wrapper,
|
||||||
|
.el-input-group__append {
|
||||||
|
box-shadow: none;
|
||||||
|
border-bottom: 1px solid $border-color;
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-group__prepend,
|
||||||
|
.el-input-group__append {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 16px;
|
||||||
|
top: calc(50% - 8px);
|
||||||
|
right: 0;
|
||||||
|
background-color: $border-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-group__append::after {
|
||||||
|
right: auto;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.send-btn {
|
||||||
|
cursor: pointer;
|
||||||
|
color: $main-color;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-btn {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 40px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 25px 0 25px 0.3em;
|
||||||
|
border-radius: 0px;
|
||||||
|
letter-spacing: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-btn {
|
||||||
|
cursor: pointer;
|
||||||
|
float: right;
|
||||||
|
color: $main-color;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-block {
|
||||||
|
width: 65%;
|
||||||
|
min-width: 500px;
|
||||||
|
min-height: 300px;
|
||||||
|
padding: 50px;
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
.header-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
justify-content: space-between;
|
||||||
justify-content: center;
|
margin-bottom: 30px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 20px;
|
||||||
|
color: $main-color;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-icon {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-box {
|
||||||
|
padding-left: 100px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.select-hospital-box {
|
.el-button {
|
||||||
position: absolute;
|
font-size: 16px;
|
||||||
top: 25px;
|
padding: 5px 50px;
|
||||||
right: 25px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
& > span {
|
||||||
height: 70px;
|
cursor: pointer;
|
||||||
}
|
font-size: 18px;
|
||||||
|
color: #909399;
|
||||||
.login-block {
|
|
||||||
width: 65%;
|
|
||||||
height: 430px;
|
|
||||||
min-width: 500px;
|
|
||||||
min-height: 300px;
|
|
||||||
padding: 50px;
|
|
||||||
margin-top: 20px;
|
|
||||||
background: white;
|
|
||||||
|
|
||||||
.login-way {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #909399;
|
|
||||||
|
|
||||||
span {
|
|
||||||
cursor: pointer;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active {
|
|
||||||
color: $main-color;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-form {
|
|
||||||
:deep(.el-input) {
|
|
||||||
font-size: 16px;
|
|
||||||
margin-top: 20px;
|
|
||||||
|
|
||||||
.el-input-group__prepend,
|
|
||||||
.el-input__wrapper,
|
|
||||||
.el-input-group__append {
|
|
||||||
box-shadow: none;
|
|
||||||
border-bottom: 1px solid $border-color;
|
|
||||||
background-color: transparent;
|
|
||||||
padding: 10px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-input-group__prepend,
|
|
||||||
.el-input-group__append {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 1px;
|
|
||||||
height: 16px;
|
|
||||||
top: calc(50% - 8px);
|
|
||||||
right: 0;
|
|
||||||
background-color: $border-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-input-group__append::after {
|
|
||||||
right: auto;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.send-btn {
|
|
||||||
cursor: pointer;
|
|
||||||
color: $main-color;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-btn {
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 40px;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 600;
|
|
||||||
padding: 25px 0 25px 0.3em;
|
|
||||||
border-radius: 0px;
|
|
||||||
letter-spacing: 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.register-btn {
|
|
||||||
cursor: pointer;
|
|
||||||
float: right;
|
|
||||||
color: $main-color;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.register-block {
|
|
||||||
width: 65%;
|
|
||||||
min-width: 500px;
|
|
||||||
min-height: 300px;
|
|
||||||
padding: 50px;
|
|
||||||
background: white;
|
|
||||||
.header-box {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
.title {
|
|
||||||
font-size: 20px;
|
|
||||||
color: $main-color;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
.el-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.footer-box {
|
|
||||||
padding-left: 100px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
.el-button {
|
|
||||||
font-size: 16px;
|
|
||||||
padding: 5px 50px;
|
|
||||||
}
|
|
||||||
&>span {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -19,5 +19,15 @@ export default defineConfig({
|
||||||
additionalData: '@import "./src/assets/css/variable.scss";' //引入scss文件
|
additionalData: '@import "./src/assets/css/variable.scss";' //引入scss文件
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://localhost:9999', // 目标服务器地址
|
||||||
|
ws: true, // 是否启用 WebSocket
|
||||||
|
changeOrigin: true, // 是否修改请求头中的 Origin 字段
|
||||||
|
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user