Compare commits
No commits in common. "ccce5849f86b4da45e428bd4d4e30a0a8dcb8723" and "dfb3d478f020933922a9ae053f0e7389bde161b0" have entirely different histories.
ccce5849f8
...
dfb3d478f0
@ -1,13 +1,12 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 登录方法
|
||||
export function login(username, password, code, uuid,loginParam) {
|
||||
export function login(username, password, code, uuid) {
|
||||
const data = {
|
||||
username,
|
||||
password,
|
||||
code,
|
||||
uuid,
|
||||
loginParam
|
||||
uuid
|
||||
}
|
||||
return request({
|
||||
url: '/login',
|
||||
@ -29,17 +28,6 @@ export function loginAnonymous(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getLocalconfig(data) {
|
||||
return request({
|
||||
url: '/getLocalconfig',
|
||||
headers: {
|
||||
isToken: false
|
||||
},
|
||||
method: 'get',
|
||||
params: data,
|
||||
timeout: 20000
|
||||
})
|
||||
}
|
||||
// 注册方法
|
||||
export function register(data) {
|
||||
return request({
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 79 KiB |
@ -1,38 +1,27 @@
|
||||
<template>
|
||||
<div class="navbar">
|
||||
<!-- 侧边栏折叠按钮(保留原有功能) -->
|
||||
<hamburger
|
||||
id="hamburger-container"
|
||||
:is-active="appStore.sidebar.opened"
|
||||
class="hamburger-container"
|
||||
@toggleClick="toggleSideBar"
|
||||
/>
|
||||
<hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!settingsStore.topNav" />
|
||||
<top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
|
||||
|
||||
<!-- 核心改造:替换面包屑/顶部导航,改为产品名称 + 登录信息布局 -->
|
||||
<div class="custom-header-content">
|
||||
<!-- 左侧:APP产品名称 -->
|
||||
<div class="app-name">
|
||||
仙桃市第一人民医院检验系统 <!-- 替换为实际产品名 -->
|
||||
</div>
|
||||
|
||||
<!-- 右侧:功能按钮 + 登录信息 + 原生设置菜单 -->
|
||||
<div class="right-content">
|
||||
<!-- 保留原有功能按钮(搜索、全屏、布局大小)
|
||||
<div class="right-menu">
|
||||
<template v-if="appStore.device !== 'mobile'">
|
||||
<header-search id="header-search" class="right-menu-item" />
|
||||
|
||||
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip> -->
|
||||
|
||||
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip> -->
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
-->
|
||||
<!-- 登录人信息(姓名 + 角色) -->
|
||||
<div class="user-info" v-if="userStore.nickName">
|
||||
欢迎,{{ userStore.nickName }}({{ userStore.roleName }})
|
||||
</div>
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<!-- 原生个人信息/设置菜单(保留原有功能) -->
|
||||
<div class="avatar-container">
|
||||
<el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
@ -56,12 +45,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
// 引入原有组件
|
||||
import Breadcrumb from '@/components/Breadcrumb'
|
||||
import TopNav from '@/components/TopNav'
|
||||
import Hamburger from '@/components/Hamburger'
|
||||
@ -70,34 +57,14 @@ import SizeSelect from '@/components/SizeSelect'
|
||||
import HeaderSearch from '@/components/HeaderSearch'
|
||||
import RuoYiGit from '@/components/RuoYi/Git'
|
||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
||||
// 引入Store
|
||||
import useAppStore from '@/store/modules/app'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
// 引入图标和默认头像(可替换为你的默认头像)
|
||||
import {CaretBottom} from '@element-plus/icons-vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
// 处理角色名称(取第一个角色,多角色可自定义)
|
||||
const roleName = computed(() => {
|
||||
if (!userStore.roles || userStore.roles.length === 0) {
|
||||
return '普通用户'
|
||||
}
|
||||
// 角色编码映射表:key 是你的 roles 编码,value 是要显示的中文
|
||||
const roleMap = {
|
||||
'ROLE_DEFAULT': '普通用户',
|
||||
'admin': '管理员',
|
||||
'ROLE_ADMIN': '超级管理员',
|
||||
'ROLE_OPERATOR': '操作员' // 按你的实际角色编码添加
|
||||
}
|
||||
// 取第一个角色编码,映射为中文
|
||||
return roleMap[userStore.roles[0]] || userStore.roles[0]
|
||||
})
|
||||
|
||||
// 原有方法保留
|
||||
function toggleSideBar() {
|
||||
appStore.toggleSideBar()
|
||||
}
|
||||
@ -124,12 +91,10 @@ function logout() {
|
||||
userStore.logOut().then(() => {
|
||||
location.href = '/index';
|
||||
})
|
||||
}).catch(() => {
|
||||
});
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
||||
const emits = defineEmits(['setLayout'])
|
||||
|
||||
function setLayout() {
|
||||
emits('setLayout');
|
||||
}
|
||||
@ -137,20 +102,16 @@ function setLayout() {
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.navbar {
|
||||
height: 50px; /* 固定高度,与原有一致 */
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
//background: #fff;
|
||||
background: #0d9488;
|
||||
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.15);
|
||||
//box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||
display: flex; /* 改为flex布局,确保子元素对齐 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||
|
||||
.hamburger-container {
|
||||
line-height: 50px; /* 与导航栏高度一致 */
|
||||
line-height: 46px;
|
||||
height: 100%;
|
||||
padding: 0 16px;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
@ -160,50 +121,32 @@ function setLayout() {
|
||||
}
|
||||
}
|
||||
|
||||
/* 核心布局:产品名称 + 右侧内容容器 */
|
||||
.custom-header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: 1; /* 占满剩余宽度 */
|
||||
padding: 0 20px;
|
||||
.breadcrumb-container {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.topmenu-container {
|
||||
position: absolute;
|
||||
left: 50px;
|
||||
}
|
||||
|
||||
.errLog-container {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.right-menu {
|
||||
float: right;
|
||||
height: 100%;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
/* 产品名称样式 */
|
||||
.app-name {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #fff; /* 若依主题色,可替换为品牌色 */
|
||||
white-space: nowrap; /* 防止换行 */
|
||||
font-style: italic; /* 关键:字体倾斜 */
|
||||
/* 可选优化:增加倾斜角度控制(默认 italic 约 14 度,可自定义) */
|
||||
/* transform: skewX(-10deg); /* 向左倾斜 10 度,正负值控制倾斜方向 */
|
||||
}
|
||||
|
||||
/* 右侧内容容器(功能按钮 + 用户信息 + 头像菜单) */
|
||||
.right-content {
|
||||
line-height: 50px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px; /* 元素间距,可调整 */
|
||||
white-space: nowrap; /* 防止换行 */
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* 用户信息样式 */
|
||||
.user-info {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #e6f7f4;
|
||||
}
|
||||
|
||||
/* 原有右侧菜单样式调整 */
|
||||
.right-menu-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
@ -220,34 +163,29 @@ function setLayout() {
|
||||
}
|
||||
}
|
||||
|
||||
/* 头像容器样式调整 */
|
||||
.avatar-container {
|
||||
margin-right: 40px;
|
||||
|
||||
.avatar-wrapper {
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px; /* 头像与下拉图标间距 */
|
||||
|
||||
.user-avatar {
|
||||
cursor: pointer;
|
||||
width: 36px; /* 调整头像大小 */
|
||||
height: 36px;
|
||||
border-radius: 50%; /* 圆形头像,可改为10px保持原有风格 */
|
||||
object-fit: cover; /* 防止头像变形 */
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
i {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
top: 25px;
|
||||
font-size: 12px;
|
||||
color: #5a5e66;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 隐藏原有面包屑和顶部导航(已替换) */
|
||||
.breadcrumb-container,
|
||||
.topmenu-container {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,191 +0,0 @@
|
||||
<template>
|
||||
<div class="navbar">
|
||||
<hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
||||
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!settingsStore.topNav" />
|
||||
<top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
|
||||
|
||||
<div class="right-menu">
|
||||
<template v-if="appStore.device !== 'mobile'">
|
||||
<header-search id="header-search" class="right-menu-item" />
|
||||
|
||||
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
||||
</el-tooltip> -->
|
||||
|
||||
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">
|
||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
||||
</el-tooltip> -->
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<div class="avatar-container">
|
||||
<el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
<img :src="userStore.avatar" class="user-avatar" />
|
||||
<el-icon><caret-bottom /></el-icon>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<router-link to="/user/profile">
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
</router-link>
|
||||
<el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">
|
||||
<span>布局设置</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item divided command="logout">
|
||||
<span>退出登录</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import Breadcrumb from '@/components/Breadcrumb'
|
||||
import TopNav from '@/components/TopNav'
|
||||
import Hamburger from '@/components/Hamburger'
|
||||
import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
import HeaderSearch from '@/components/HeaderSearch'
|
||||
import RuoYiGit from '@/components/RuoYi/Git'
|
||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
||||
import useAppStore from '@/store/modules/app'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
function toggleSideBar() {
|
||||
appStore.toggleSideBar()
|
||||
}
|
||||
|
||||
function handleCommand(command) {
|
||||
switch (command) {
|
||||
case "setLayout":
|
||||
setLayout();
|
||||
break;
|
||||
case "logout":
|
||||
logout();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
userStore.logOut().then(() => {
|
||||
location.href = '/index';
|
||||
})
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
||||
const emits = defineEmits(['setLayout'])
|
||||
function setLayout() {
|
||||
emits('setLayout');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.navbar {
|
||||
height: 50px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||
|
||||
.hamburger-container {
|
||||
line-height: 46px;
|
||||
height: 100%;
|
||||
float: left;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, 0.025);
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumb-container {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.topmenu-container {
|
||||
position: absolute;
|
||||
left: 50px;
|
||||
}
|
||||
|
||||
.errLog-container {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.right-menu {
|
||||
float: right;
|
||||
height: 100%;
|
||||
line-height: 50px;
|
||||
display: flex;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.right-menu-item {
|
||||
display: inline-block;
|
||||
padding: 0 8px;
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
color: #5a5e66;
|
||||
vertical-align: text-bottom;
|
||||
|
||||
&.hover-effect {
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, 0.025);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
margin-right: 40px;
|
||||
|
||||
.avatar-wrapper {
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
|
||||
.user-avatar {
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
i {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
top: 25px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -17,8 +17,6 @@ const useUserStore = defineStore(
|
||||
token: getToken(),
|
||||
id: '',
|
||||
name: '',
|
||||
nickName: '',
|
||||
roleName: '',
|
||||
avatar: '',
|
||||
roles: [],
|
||||
permissions: []
|
||||
@ -48,9 +46,8 @@ const useUserStore = defineStore(
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const loginParam=userInfo.loginParam
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid,loginParam).then(res => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
setToken(res.token)
|
||||
this.token = res.token
|
||||
resolve()
|
||||
@ -64,10 +61,6 @@ const useUserStore = defineStore(
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
const rolelist = user.roles
|
||||
if (rolelist && rolelist.length > 0) {
|
||||
this.roleName=rolelist[0].roleName
|
||||
}
|
||||
const avatar = (user.avatar == "" || user.avatar == null) ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar;
|
||||
|
||||
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||
@ -78,7 +71,6 @@ const useUserStore = defineStore(
|
||||
}
|
||||
this.id = user.userId
|
||||
this.name = user.userName
|
||||
this.nickName= user.nickName
|
||||
this.avatar = avatar
|
||||
resolve(res)
|
||||
}).catch(error => {
|
||||
|
||||
@ -791,7 +791,6 @@ const shHandleCheck = () => {
|
||||
const unconfirmlogRef = ref();
|
||||
const unShHandle = () => {
|
||||
uncheck2({ ...tableKey.value, yhdh: props.labPat.yhdh }).then(res => {
|
||||
console.log('res',res);
|
||||
if (res.code == "4") {
|
||||
tableKey.value.problemId = res.problemId;
|
||||
reasonText.value = res.msg;
|
||||
|
||||
@ -1,81 +1,36 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginRef" class="login-form">
|
||||
<div class="login-header">
|
||||
<div class="login-logo">
|
||||
<img src="@/assets/images/logo_new.png" alt="系统Logo" />
|
||||
</div>
|
||||
<div class="login-split"></div>
|
||||
<div class="login-title">
|
||||
<h1>{{ oem.appname}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab切换容器 -->
|
||||
<el-tabs v-model="activeName" type="card" @tab-click="handleClick" class="login-tabs">
|
||||
<!-- 工号登录 Tab -->
|
||||
<el-tab-pane label="账号密码登录" name="first">
|
||||
<el-form-item label="医疗机构:" prop="loginYLJG"class="custom-select">
|
||||
<el-select
|
||||
v-model="loginForm.loginParam.loginYLJG"
|
||||
placeholder="请选择医疗机构"
|
||||
style="width: 100%"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="international" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
<el-option
|
||||
v-for="item in selectOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="用户代号:" prop="username">
|
||||
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">实验室管理系统</h3>
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="user" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="登录密码:" prop="password">
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
|
||||
@keyup.enter="handleLogin">
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="password" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 修复:移除空的el-form-item,验证码关闭时不渲染任何内容 -->
|
||||
<el-form-item prop="code" v-if="!captchaEnabled" size="large">
|
||||
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="code" label="验 证 码 :" v-if="captchaEnabled">
|
||||
<!-- <el-form-item prop="code" v-if="captchaEnabled">
|
||||
<el-input
|
||||
|
||||
v-model="loginForm.code"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 53%"
|
||||
style="width: 63%"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
</el-form-item> -->
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="large" type="primary" class="login-btn" style="width: 100%;" @click.prevent="handleLogin">
|
||||
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
@ -83,91 +38,66 @@
|
||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="扫码登录" name="second">
|
||||
<div class="tab-placeholder">
|
||||
<el-icon class="placeholder-icon"><Sms /></el-icon>
|
||||
<p>正在加载二维码...</p>
|
||||
<el-button type="success" icon="wechat" class="wechat-login-btn">刷新二维码</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="UKEY登录" name="third">
|
||||
<div class="tab-placeholder">
|
||||
<el-icon class="placeholder-icon"><Wechat /></el-icon>
|
||||
<p>UKEY登录功能开发中...</p>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>版权所有(R)2022-2026 {{ oem.compay}} 电话:{{oem.phone}} E-mail:{{oem.Email}} version:{{oem.version}}</span>
|
||||
<!-- <span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useFingerprint } from '@/utils/useFingerprint';
|
||||
import { getCodeImg, getInfo, getLocalconfig } from "@/api/login";
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
// 初始化响应式变量
|
||||
const activeName = ref('first');
|
||||
const userStore = useUserStore();
|
||||
const userStore = useUserStore()
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const oem = ref({
|
||||
appname: "实验室信息管理系统",
|
||||
phone: "",
|
||||
compay: "",
|
||||
version: "",
|
||||
Email: ""
|
||||
});
|
||||
const loginRef = ref(null); // 修复:直接用ref获取表单引用
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const loginForm = ref({
|
||||
username: "admin",
|
||||
password: "",
|
||||
password: "", //admin123
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: "",
|
||||
loginParam:{loginYLJG:"",localid:""}
|
||||
uuid: ""
|
||||
});
|
||||
const selectOptions = ref([{ id: '1', name: '总院' }]);
|
||||
const loginRules = ref({ // 修复:改为ref响应式,方便动态修改
|
||||
|
||||
const loginRules = {
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
// password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
hospid: [{ required: true, message: '请选择医疗机构', trigger: 'change' }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
});
|
||||
};
|
||||
|
||||
const codeUrl = ref("");
|
||||
const loading = ref(false);
|
||||
// 验证码开关
|
||||
const captchaEnabled = ref(true);
|
||||
// 注册开关
|
||||
const register = ref(false);
|
||||
const redirect = ref(undefined);
|
||||
|
||||
// 路由监听(优化版)
|
||||
watch(
|
||||
() => route.query.redirect,
|
||||
(newRedirect) => {
|
||||
if (redirect.value !== newRedirect) {
|
||||
redirect.value = newRedirect || '';
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: false }
|
||||
);
|
||||
watch(route, (newRoute) => {
|
||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||
}, { immediate: true });
|
||||
|
||||
// 登录方法(修复proxy.$refs问题)
|
||||
const handleLogin = async () => {
|
||||
loginForm.value.loginParam.loginYLJG
|
||||
function handleLogin() {
|
||||
proxy.$refs.loginRef.validate(valid => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
Cookies.set("czlis_username", loginForm.value.username, { expires: 30 });
|
||||
Cookies.set("czlis_loginYLJG", loginForm.value.loginParam.loginYLJG, {expires: 30});
|
||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||
if (loginForm.value.rememberMe) {
|
||||
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
||||
} else {
|
||||
// 否则移除
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
// 调用action的登录方法
|
||||
userStore.login(loginForm.value).then(() => {
|
||||
const query = route.query;
|
||||
@ -177,10 +107,7 @@ const handleLogin = async () => {
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
const targetPath = redirect.value || "/";
|
||||
if (route.path !== targetPath) {
|
||||
router.push({ path: targetPath, query: otherQueryParams });
|
||||
}
|
||||
router.push({ path: redirect.value || "/", query: otherQueryParams });
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
// 重新获取验证码
|
||||
@ -188,90 +115,33 @@ const handleLogin = async () => {
|
||||
getCode();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
const getCode = () => {
|
||||
function getCode() {
|
||||
getCodeImg().then(res => {
|
||||
captchaEnabled.value = res.captchaEnabled ?? true;
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
||||
if (captchaEnabled.value) {
|
||||
codeUrl.value = "data:image/gif;base64," + res.img;
|
||||
loginForm.value.uuid = res.uuid;
|
||||
}
|
||||
// 验证码关闭时移除校验规则,避免报错
|
||||
if (!captchaEnabled.value) {
|
||||
loginRules.value.code = [];
|
||||
} else {
|
||||
loginRules.value.code = [{required: true, trigger: "change", message: "请输入验证码"}];
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// 从Cookie获取账号密码
|
||||
const getCookie = () => {
|
||||
const cookieUsername = Cookies.get("czlis_username");
|
||||
const cookieloginYLJG = Cookies.get("czlis_loginYLJG");
|
||||
//console.log('cookieloginYLJG', cookieloginYLJG);
|
||||
if (cookieUsername !== undefined && cookieUsername !== null&& cookieUsername !=="") {
|
||||
loginForm.value.username = cookieUsername;
|
||||
}
|
||||
if (cookieloginYLJG !== undefined && cookieloginYLJG !== null&& cookieloginYLJG !=="") {
|
||||
loginForm.value.loginParam.loginYLJG = cookieloginYLJG;
|
||||
}
|
||||
//console.log('loginForm', loginForm);
|
||||
function getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get("rememberMe");
|
||||
loginForm.value = {
|
||||
username: username === undefined ? loginForm.value.username : username,
|
||||
password: password === undefined ? loginForm.value.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
|
||||
// 获取本地配置
|
||||
const Localconfig = (localid) => {
|
||||
getLocalconfig({localid}).then(res => {
|
||||
if (res) {
|
||||
const {localconfig, hosplist, oem: oemData} = res;
|
||||
// 修复:赋值oem数据,显示动态标题
|
||||
if (oemData) oem.value = oemData;
|
||||
// console.log('oemData', oemData);
|
||||
// console.log('oem', oem.value);
|
||||
// 修复:判重后更新下拉选项,避免递归
|
||||
if (JSON.stringify(selectOptions.value) !== JSON.stringify(hosplist)) {
|
||||
selectOptions.value = hosplist || [{id: '1', name: '总院'}];
|
||||
// 判重后赋值,避免重复修改触发更新
|
||||
if (!selectOptions.value.some(item => item.id === loginForm.value.hospid)) {
|
||||
loginForm.value.loginParam.loginYLJG = selectOptions.value[0]?.id || '1';
|
||||
}
|
||||
|
||||
getCode();
|
||||
getCookie();
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error("获取本地配置失败:", err);
|
||||
});
|
||||
};
|
||||
|
||||
// 获取指纹并加载配置
|
||||
const {getFingerprint} = useFingerprint();
|
||||
const refreshFingerprint = async () => {
|
||||
try {
|
||||
const res = await getFingerprint();
|
||||
loginForm.value.loginParam.localid=res.visitorId
|
||||
Localconfig(res.visitorId);
|
||||
} catch (err) {
|
||||
console.error("获取指纹失败:", err);
|
||||
Localconfig("default"); // 兜底使用默认ID
|
||||
}
|
||||
};
|
||||
|
||||
// Tab切换事件(移除activeName手动赋值,避免递归)
|
||||
const handleClick = (tab) => {
|
||||
console.log('当前Tab:', tab.name);
|
||||
// 仅在切回账号密码登录时刷新验证码
|
||||
if (tab.name === 'first' && captchaEnabled.value) {
|
||||
getCode();
|
||||
}
|
||||
};
|
||||
|
||||
// 页面挂载时初始化
|
||||
onMounted(() => {
|
||||
refreshFingerprint();
|
||||
getCode();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
@ -279,20 +149,22 @@ onMounted(() => {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
height: 100%;
|
||||
background-image: url("../assets/images/login-background.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.9);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
width: 480px;
|
||||
padding: 35px 35px 5px 35px;
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
|
||||
.el-input {
|
||||
height: 40px;
|
||||
@ -309,6 +181,12 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 40px;
|
||||
@ -317,9 +195,6 @@ onMounted(() => {
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,87 +211,8 @@ onMounted(() => {
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
/* Logo和标题样式 */
|
||||
.login-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.login-logo img {
|
||||
.login-code-img {
|
||||
height: 40px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.login-split {
|
||||
width: 1px;
|
||||
height: 30px;
|
||||
background-color: #ccc;
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.login-title h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
color: #1989fa;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Tab容器样式(修复冲突) */
|
||||
.login-tabs {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
padding: 1px 10px 10px;
|
||||
background: transparent;
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
background: transparent;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-prev),
|
||||
:deep(.el-tabs__nav-next) {
|
||||
display: none !important; // 隐藏Tab左右箭头
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap) {
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-select {
|
||||
margin-top: 20px; /* 可根据需求调整数值 */
|
||||
}
|
||||
|
||||
/* Tab占位样式 */
|
||||
.tab-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 0;
|
||||
color: #666;
|
||||
height: calc(100% - 40px); // 适配Tab容器高度
|
||||
|
||||
.placeholder-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 20px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.wechat-login-btn {
|
||||
margin-top: 20px;
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 隐藏必填项星号 */
|
||||
:deep(.el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap .el-form-item__asterisk) {
|
||||
display: none !important;
|
||||
padding-left: 12px;
|
||||
}
|
||||
</style>
|
||||
@ -1,448 +0,0 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginRef" class="login-form">
|
||||
<div class="login-header">
|
||||
<div class="login-logo">
|
||||
<img src="@/assets/images/logo_new.png" alt="系统Logo" />
|
||||
</div>
|
||||
<div class="login-split"></div>
|
||||
<div class="login-title">
|
||||
<h1>{{ oem.appname}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab切换容器 -->
|
||||
<el-tabs v-model="activeName" type="card" @tab-click="handleClick" class="login-tabs">
|
||||
<!-- 工号登录 Tab -->
|
||||
<el-tab-pane label="账号密码登录" name="first">
|
||||
<el-form-item label="医疗机构:" prop="hospid"class="custom-select">
|
||||
<el-select
|
||||
v-model="loginForm.hospid"
|
||||
placeholder="请选择医疗机构"
|
||||
style="width: 100%"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="international" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
<el-option
|
||||
v-for="item in selectOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="用户代号:" prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="user" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="登录密码:" prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
|
||||
@keyup.enter="handleLogin">
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="password" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 修复:移除空的el-form-item,验证码关闭时不渲染任何内容 -->
|
||||
<el-form-item prop="code" v-if="!captchaEnabled" size="large">
|
||||
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="code" label="验 证 码 :" v-if="captchaEnabled">
|
||||
<el-input
|
||||
|
||||
v-model="loginForm.code"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 53%"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon icon-class="validCode" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item style="width: 100%;">
|
||||
<el-button :loading="loading" size="large" type="primary" class="login-btn" style="width: 100%;" @click.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
<div style="float: right;" v-if="register">
|
||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="扫码登录" name="second">
|
||||
<div class="tab-placeholder">
|
||||
<el-icon class="placeholder-icon"><Sms /></el-icon>
|
||||
<p>正在加载二维码...</p>
|
||||
<el-button type="success" icon="wechat" class="wechat-login-btn">刷新二维码</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="UKEY登录" name="third">
|
||||
<div class="tab-placeholder">
|
||||
<el-icon class="placeholder-icon"><Wechat /></el-icon>
|
||||
<p>UKEY登录功能开发中...</p>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
|
||||
<div class="el-login-footer">
|
||||
<span>版权所有(R)2022-2026 {{ oem.compay}} 电话:{{oem.phone}} E-mail:{{oem.Email}} version:{{oem.version}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useFingerprint } from '@/utils/useFingerprint';
|
||||
import { getCodeImg, getInfo, getLocalconfig } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
||||
import useUserStore from '@/store/modules/user';
|
||||
|
||||
// 初始化响应式变量
|
||||
const activeName = ref('first');
|
||||
const userStore = useUserStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const oem = ref({
|
||||
appname: "实验室信息管理系统",
|
||||
phone: "",
|
||||
compay: "",
|
||||
version: "",
|
||||
Email: ""
|
||||
});
|
||||
const loginRef = ref(null); // 修复:直接用ref获取表单引用
|
||||
const loginForm = ref({
|
||||
username: "admin",
|
||||
password: "",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: "",
|
||||
hospid: "1"
|
||||
});
|
||||
const selectOptions = ref([{ id: '1', name: '总院' }]);
|
||||
const loginRules = ref({ // 修复:改为ref响应式,方便动态修改
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
hospid: [{ required: true, message: '请选择医疗机构', trigger: 'change' }],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
});
|
||||
const codeUrl = ref("");
|
||||
const loading = ref(false);
|
||||
const captchaEnabled = ref(true);
|
||||
const register = ref(false);
|
||||
const redirect = ref(undefined);
|
||||
|
||||
// 路由监听(优化版)
|
||||
watch(
|
||||
() => route.query.redirect,
|
||||
(newRedirect) => {
|
||||
if (redirect.value !== newRedirect) {
|
||||
redirect.value = newRedirect || '';
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: false }
|
||||
);
|
||||
|
||||
// 登录方法(修复proxy.$refs问题)
|
||||
const handleLogin = async () => {
|
||||
console.log("sss",loginForm.value)
|
||||
try {
|
||||
const valid = await loginRef.value.validate(); // 直接用ref.validate()
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
// 记住密码逻辑
|
||||
if (loginForm.value.rememberMe) {
|
||||
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
// 调用action的登录方法
|
||||
userStore.login(loginForm.value).then(() => {
|
||||
const query = route.query;
|
||||
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
||||
if (cur !== "redirect") {
|
||||
acc[cur] = query[cur];
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
if (route.path !== targetPath) {
|
||||
router.push({path: redirect.value || "/", query: otherQueryParams});
|
||||
}
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
// 重新获取验证码
|
||||
if (captchaEnabled.value) {
|
||||
getCode();
|
||||
}
|
||||
});
|
||||
/*
|
||||
// 调用登录接口
|
||||
await userStore.login(loginForm.value);
|
||||
// 路由跳转(防重复跳转)
|
||||
const query = route.query;
|
||||
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
||||
if (cur !== "redirect") acc[cur] = query[cur];
|
||||
return acc;
|
||||
}, {});
|
||||
const targetPath = redirect.value || "/";
|
||||
if (route.path !== targetPath) {
|
||||
router.push({ path: targetPath, query: otherQueryParams });
|
||||
}
|
||||
*/
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("登录验证失败:", err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
if (captchaEnabled.value) getCode(); // 失败后刷新验证码
|
||||
}
|
||||
};
|
||||
|
||||
// 获取验证码
|
||||
const getCode = () => {
|
||||
getCodeImg().then(res => {
|
||||
captchaEnabled.value = res.captchaEnabled ?? true;
|
||||
if (captchaEnabled.value) {
|
||||
codeUrl.value = "data:image/gif;base64," + res.img;
|
||||
loginForm.value.uuid = res.uuid;
|
||||
}
|
||||
// 验证码关闭时移除校验规则,避免报错
|
||||
if (!captchaEnabled.value) {
|
||||
loginRules.value.code = [];
|
||||
} else {
|
||||
loginRules.value.code = [{ required: true, trigger: "change", message: "请输入验证码" }];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 从Cookie获取账号密码
|
||||
const getCookie = () => {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get("rememberMe");
|
||||
loginForm.value = {
|
||||
...loginForm.value,
|
||||
username: username ?? loginForm.value.username,
|
||||
password: password ? decrypt(password) : loginForm.value.password,
|
||||
rememberMe: rememberMe ? Boolean(rememberMe) : false
|
||||
};
|
||||
};
|
||||
|
||||
// 获取本地配置
|
||||
const Localconfig = (localid) => {
|
||||
getLocalconfig({ localid }).then(res => {
|
||||
if (res) {
|
||||
const { localconfig, hosplist, oem: oemData } = res;
|
||||
console.log('本地配置:', localconfig, '医院列表:', hosplist);
|
||||
// 修复:赋值oem数据,显示动态标题
|
||||
if (oemData) oem.value = oemData;
|
||||
// 修复:判重后更新下拉选项,避免递归
|
||||
if (JSON.stringify(selectOptions.value) !== JSON.stringify(hosplist)) {
|
||||
selectOptions.value = hosplist || [{ id: '1', name: '总院' }];
|
||||
// 判重后赋值,避免重复修改触发更新
|
||||
if (!selectOptions.value.some(item => item.id === loginForm.value.hospid)) {
|
||||
loginForm.value.hospid = selectOptions.value[0]?.id || '1';
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error("获取本地配置失败:", err);
|
||||
});
|
||||
};
|
||||
|
||||
// 获取指纹并加载配置
|
||||
const { getFingerprint } = useFingerprint();
|
||||
const refreshFingerprint = async () => {
|
||||
try {
|
||||
const res = await getFingerprint();
|
||||
Localconfig(res.visitorId);
|
||||
} catch (err) {
|
||||
console.error("获取指纹失败:", err);
|
||||
Localconfig("default"); // 兜底使用默认ID
|
||||
}
|
||||
};
|
||||
|
||||
// Tab切换事件(移除activeName手动赋值,避免递归)
|
||||
const handleClick = (tab) => {
|
||||
console.log('当前Tab:', tab.name);
|
||||
// 仅在切回账号密码登录时刷新验证码
|
||||
if (tab.name === 'first' && captchaEnabled.value) {
|
||||
getCode();
|
||||
}
|
||||
};
|
||||
|
||||
// 页面挂载时初始化
|
||||
onMounted(() => {
|
||||
refreshFingerprint();
|
||||
getCode();
|
||||
getCookie();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background-image: url("../assets/images/login-background.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.9);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
width: 480px;
|
||||
padding: 35px 35px 5px 35px;
|
||||
|
||||
.el-input {
|
||||
height: 40px;
|
||||
|
||||
input {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 40px;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
/* Logo和标题样式 */
|
||||
.login-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.login-logo img {
|
||||
height: 40px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.login-split {
|
||||
width: 1px;
|
||||
height: 30px;
|
||||
background-color: #ccc;
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.login-title h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
color: #1989fa;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Tab容器样式(修复冲突) */
|
||||
.login-tabs {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
padding: 1px 10px 10px;
|
||||
background: transparent;
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
background: transparent;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-prev),
|
||||
:deep(.el-tabs__nav-next) {
|
||||
display: none !important; // 隐藏Tab左右箭头
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap) {
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
.custom-select {
|
||||
margin-top: 20px; /* 可根据需求调整数值 */
|
||||
}
|
||||
/* Tab占位样式 */
|
||||
.tab-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 0;
|
||||
color: #666;
|
||||
height: calc(100% - 40px); // 适配Tab容器高度
|
||||
|
||||
.placeholder-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 20px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.wechat-login-btn {
|
||||
margin-top: 20px;
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 隐藏必填项星号 */
|
||||
:deep(.el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap .el-form-item__asterisk) {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user