Compare commits
2 Commits
a77d4e8b03
...
4ff36fba20
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ff36fba20 | |||
| 04840fde0e |
@@ -267,6 +267,6 @@ public class LoginUser implements UserDetails {
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return null;
|
||||
return java.util.Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
<script lang="ts">
|
||||
/**
|
||||
* VxeTable 兼容层 — 归一化 vxe-table v4 事件参数,匹配 el-table 约定
|
||||
* VxeTable 归一化兼容层
|
||||
*
|
||||
* el-table: @cell-click(row, column, event)
|
||||
* vxe-table: @cell-click({ row, column, $event, ... })
|
||||
*
|
||||
* 归一化规则:
|
||||
* @cell-click → handler(row, column, $event)
|
||||
* @current-change → handler(newValue, oldValue)
|
||||
* 拦截 cell-click 和 current-change 事件,
|
||||
* 将 vxe-table 的对象参数归一化为 el-table 风格的平铺参数。
|
||||
*/
|
||||
import { ref, h, defineComponent } from 'vue'
|
||||
import { ref, h, defineComponent, Comment, Text, Fragment } from 'vue'
|
||||
import { VxeTable } from 'vxe-table'
|
||||
|
||||
// 需要归一化的事件映射:vxe-table params → el-table args
|
||||
const NORMALIZE_EVENTS: Record<string, (p: any) => any[]> = {
|
||||
'cell-click': (p) => [p?.row, p?.column, p?.$event],
|
||||
'current-change': (p) => [p?.newValue ?? p?.row, p?.oldValue],
|
||||
@@ -23,53 +18,45 @@ export default defineComponent({
|
||||
inheritAttrs: false,
|
||||
|
||||
setup(_props, { attrs, slots, expose }) {
|
||||
const tableRef = ref<any>(null)
|
||||
|
||||
// 构建代理后的事件监听器
|
||||
const proxiedAttrs: Record<string, any> = {}
|
||||
const innerRef = ref<any>(null)
|
||||
|
||||
// 将 attrs 中的 on* 监听器拆分处理
|
||||
const tableProps: Record<string, any> = {}
|
||||
for (const [key, value] of Object.entries(attrs)) {
|
||||
if (key.startsWith('on') && typeof value === 'function') {
|
||||
// onCellClick → cell-click
|
||||
const rawEvent = key.slice(2) // CellClick
|
||||
const rawEvent = key.slice(2)
|
||||
const eventName = rawEvent
|
||||
.replace(/([A-Z])/g, '-$1')
|
||||
.toLowerCase()
|
||||
.replace(/^-/, '') // cell-click
|
||||
.replace(/^-/, '')
|
||||
|
||||
if (eventName in NORMALIZE_EVENTS) {
|
||||
proxiedAttrs[key] = (vxeParams: any) => {
|
||||
const normalizer = NORMALIZE_EVENTS[eventName]
|
||||
const normalizedArgs = normalizer(vxeParams)
|
||||
;(value as Function)(...normalizedArgs)
|
||||
tableProps[key] = (vxeParams: any) => {
|
||||
const normalized = NORMALIZE_EVENTS[eventName](vxeParams)
|
||||
;(value as Function)(...normalized)
|
||||
}
|
||||
} else {
|
||||
proxiedAttrs[key] = value
|
||||
tableProps[key] = value
|
||||
}
|
||||
} else {
|
||||
proxiedAttrs[key] = value
|
||||
tableProps[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
expose({
|
||||
tableRef,
|
||||
clearCheckboxRow: () => tableRef.value?.clearCheckboxRow(),
|
||||
clearSelection: () => tableRef.value?.clearCheckboxRow(),
|
||||
setCurrentRow: (row: any) => tableRef.value?.setCurrentRow(row),
|
||||
clearCheckboxRow: () => innerRef.value?.clearCheckboxRow(),
|
||||
clearSelection: () => innerRef.value?.clearCheckboxRow(),
|
||||
setCurrentRow: (row: any) => innerRef.value?.setCurrentRow(row),
|
||||
toggleRowExpand: (row: any, expanded?: boolean) =>
|
||||
tableRef.value?.toggleRowExpand(row, expanded),
|
||||
innerRef.value?.toggleRowExpand(row, expanded),
|
||||
toggleRowExpansion: (row: any, expanded?: boolean) =>
|
||||
tableRef.value?.toggleRowExpand(row, expanded),
|
||||
getCheckboxRecords: () => tableRef.value?.getCheckboxRecords(),
|
||||
getSelectionRows: () => tableRef.value?.getCheckboxRecords(),
|
||||
innerRef.value?.toggleRowExpand(row, expanded),
|
||||
getCheckboxRecords: () => innerRef.value?.getCheckboxRecords(),
|
||||
getSelectionRows: () => innerRef.value?.getCheckboxRecords(),
|
||||
})
|
||||
|
||||
return () => {
|
||||
return h(
|
||||
VxeTable,
|
||||
{ ...proxiedAttrs, ref: tableRef },
|
||||
slots
|
||||
)
|
||||
return h(VxeTable, { ref: innerRef, ...tableProps }, slots)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -2,7 +2,6 @@ import {createApp, nextTick} from 'vue';
|
||||
|
||||
import VxeUIAll from 'vxe-table';
|
||||
import 'vxe-table/lib/style.css';
|
||||
import VxeTableCompat from '@/components/VxeTableCompat';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
// 导入 hiprint 并挂载到全局 window 对象
|
||||
@@ -123,8 +122,6 @@ app.use(ElementPlus, {
|
||||
size: Cookies.get('size') || 'default',
|
||||
});
|
||||
app.use(VxeUIAll);
|
||||
// 全局注册 vxe-table 兼容层:归一化 cell-click/current-change 事件参数
|
||||
app.component('vxe-table', VxeTableCompat);
|
||||
|
||||
// 导入公告帮助工具
|
||||
import { initNoticePopupAfterLogin } from '@/utils/noticeHelper'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Vite 插件:在构建时拦截依赖模块加载,返回兼容 Vue 3 的补丁版本。
|
||||
*
|
||||
* ⚠️ 不修改 node_modules 中的任何文件。
|
||||
@@ -6,10 +6,12 @@
|
||||
* 拦截清单:
|
||||
* 1. xe-utils/hasOwnProp.js — Vue 3 Proxy 兼容
|
||||
* 2. element-plus form-label-wrap.mjs — NaN 防护 + 生命周期守卫
|
||||
* 3. vxe-table table.js — cell-click/current-change 事件参数归一化
|
||||
*/
|
||||
|
||||
const VIRTUAL_HASOWNPROP = '\0patched:xe-utils/hasOwnProp'
|
||||
const VIRTUAL_FORM_LABEL = '\0patched:element-plus/form-label-wrap'
|
||||
const VIRTUAL_VXE_TABLE = '\0patched:vxe-table/table'
|
||||
|
||||
export default function patchDepsPlugin() {
|
||||
return {
|
||||
@@ -33,6 +35,13 @@ export default function patchDepsPlugin() {
|
||||
) {
|
||||
return VIRTUAL_FORM_LABEL
|
||||
}
|
||||
// 拦截 vxe-table table.js(主表格模块)
|
||||
if (
|
||||
source.includes('vxe-table') &&
|
||||
source.includes('table/src/table')
|
||||
) {
|
||||
return VIRTUAL_VXE_TABLE
|
||||
}
|
||||
},
|
||||
|
||||
// ── load: 对被拦截的模块返回补丁代码 ──
|
||||
@@ -43,6 +52,9 @@ export default function patchDepsPlugin() {
|
||||
if (id === VIRTUAL_FORM_LABEL) {
|
||||
return PATCHED_FORM_LABEL_WRAP
|
||||
}
|
||||
if (id === VIRTUAL_VXE_TABLE) {
|
||||
return getPatchedVxeTable()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -50,10 +62,6 @@ export default function patchDepsPlugin() {
|
||||
// ═══════════════════════════════════════════════
|
||||
// 补丁 1:xe-utils hasOwnProp — Proxy 兼容
|
||||
// ═══════════════════════════════════════════════
|
||||
// 根因:Object.prototype.hasOwnProperty.call(proxyObj, key)
|
||||
// 在 Vue 3 reactive Proxy 上触发 reactivity 拦截,
|
||||
// 抛出 "obj.hasOwnProperty is not a function"。
|
||||
// ═══════════════════════════════════════════════
|
||||
const PATCHED_HASOWNPROP = `
|
||||
function hasOwnProp(obj, key) {
|
||||
if (obj == null) return false
|
||||
@@ -70,13 +78,6 @@ export { hasOwnProp }
|
||||
// ═══════════════════════════════════════════════
|
||||
// 补丁 2:element-plus form-label-wrap
|
||||
// ═══════════════════════════════════════════════
|
||||
// 根因:vxe-table 展开行收起时 el-form 组件已卸载,
|
||||
// 但 nextTick/onUpdated 回调仍访问已销毁的 formContext,
|
||||
// 导致 NaN width 和 teardown 错误。
|
||||
//
|
||||
// 策略:从原始文件读取内容,在运行时用正则替换。
|
||||
// 这样不依赖 node_modules 中的修改。
|
||||
// ═══════════════════════════════════════════════
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
@@ -98,12 +99,10 @@ function getFormLabelWrapCode() {
|
||||
const code = fs.readFileSync(filePath, 'utf-8')
|
||||
|
||||
cachedFormLabelWrap = code
|
||||
// NaN 防护
|
||||
.replace(
|
||||
'return Math.ceil(Number.parseFloat(width))',
|
||||
'return Math.ceil(Number.parseFloat(width)) || 0'
|
||||
)
|
||||
// _isMounted 守卫
|
||||
.replace(
|
||||
'const updateLabelWidth = (action = "update") => {',
|
||||
'let _isMounted = true;\n const updateLabelWidth = (action = "update") => {'
|
||||
@@ -140,4 +139,48 @@ function getFormLabelWrapCode() {
|
||||
return cachedFormLabelWrap
|
||||
}
|
||||
|
||||
const PATCHED_FORM_LABEL_WRAP = getFormLabelWrapCode()
|
||||
const PATCHED_FORM_LABEL_WRAP = getFormLabelWrapCode()
|
||||
|
||||
// ═══════════════════════════════════════════════
|
||||
// 补丁 3:vxe-table cell-click/current-change 事件归一化
|
||||
// ═══════════════════════════════════════════════
|
||||
// 根因:el-table @cell-click 直接传 (row, column, event)
|
||||
// vxe-table @cell-click 传 ({ row, column, $event, ... })
|
||||
// 126 个 handler 用 el-table 风格 (row) 签名,全部失效。
|
||||
//
|
||||
// 策略:在 dispatchEvent 调用前注入一行代码,
|
||||
// 将 params 对象自身赋值给 params.row,
|
||||
// 使 ({ row }) 解构和 row.xxx 直接访问都能工作。
|
||||
// ═══════════════════════════════════════════════
|
||||
let cachedVxeTable = null
|
||||
|
||||
function getPatchedVxeTable() {
|
||||
if (cachedVxeTable) return cachedVxeTable
|
||||
|
||||
const filePath = path.resolve(
|
||||
process.cwd(),
|
||||
'node_modules/vxe-table/es/table/src/table.js'
|
||||
)
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.warn('[patch-deps] vxe-table table.js not found, skipping')
|
||||
return null
|
||||
}
|
||||
|
||||
let code = fs.readFileSync(filePath, 'utf-8')
|
||||
|
||||
// 修补 cell-click:在 dispatchEvent 前注入参数归一化
|
||||
code = code.replace(
|
||||
"dispatchEvent('cell-click', params, evnt);",
|
||||
`params.row = params; params.column = params.column; dispatchEvent('cell-click', params, evnt);`
|
||||
)
|
||||
|
||||
// 修补 current-change:在 dispatchEvent 前注入参数归一化
|
||||
code = code.replace(
|
||||
"dispatchEvent('current-change', Object.assign({ oldValue, newValue }, params), evnt);",
|
||||
`var _ccp = Object.assign({ oldValue, newValue }, params); _ccp.newValue = _ccp; _ccp.oldValue = oldValue; dispatchEvent('current-change', _ccp, evnt);`
|
||||
)
|
||||
|
||||
cachedVxeTable = code
|
||||
return cachedVxeTable
|
||||
}
|
||||
1543
openhis-ui-vue3/src/views/index.vue.bak
Normal file
1543
openhis-ui-vue3/src/views/index.vue.bak
Normal file
File diff suppressed because it is too large
Load Diff
720
openhis-ui-vue3/src/views/login.vue.bak
Normal file
720
openhis-ui-vue3/src/views/login.vue.bak
Normal file
@@ -0,0 +1,720 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<!-- 顶部 -->
|
||||
<el-form
|
||||
ref="loginRef"
|
||||
:model="loginForm"
|
||||
:rules="loginRules"
|
||||
class="login-form"
|
||||
>
|
||||
<div class="el-login-top">
|
||||
<el-image :src="logoNew" />
|
||||
</div>
|
||||
<h1 class="title">
|
||||
{{ currentTenantName || settings.systemName }}信息管理系统
|
||||
</h1>
|
||||
<p class="login-subtitle">
|
||||
请使用您的账号密码安全登录系统
|
||||
</p>
|
||||
<el-form-item prop="username">
|
||||
<p class="label">
|
||||
用户名
|
||||
</p>
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="账号"
|
||||
@input="handleUsernameChange"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon
|
||||
icon-class="user"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<p class="label">
|
||||
密码
|
||||
</p>
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
:type="passwordVisible ? 'text' : '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 #suffix>
|
||||
<span
|
||||
class="password-toggle"
|
||||
style="cursor: pointer; color: #606266; font-size: 14px; padding: 0 10px;"
|
||||
@click="togglePasswordVisibility"
|
||||
>
|
||||
{{ passwordVisible ? '隐藏' : '显示' }}
|
||||
</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="tenantId">
|
||||
<p class="label">
|
||||
医疗机构
|
||||
</p>
|
||||
<el-select
|
||||
v-model="loginForm.tenantId"
|
||||
size="large"
|
||||
placeholder="请选择医疗机构"
|
||||
clearable
|
||||
filterable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in tenantOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="tenantId">
|
||||
<span
|
||||
class="descriptions-item-label"
|
||||
style="margin: 0 10px 0 0"
|
||||
>连接医保</span>
|
||||
<el-switch
|
||||
v-model="loginForm.invokeYb"
|
||||
size="large"
|
||||
@change="topNavChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!--<el-form-item prop="code" v-if="captchaEnabled">
|
||||
<el-input
|
||||
v-model="loginForm.code"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 63%"
|
||||
@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-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"
|
||||
style="width: 100%"
|
||||
@click.prevent="handleLogin"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else-if="!signIng">登 录 中...</span>
|
||||
<span v-else>连接医保中...</span>
|
||||
</el-button>
|
||||
<div
|
||||
v-if="register"
|
||||
style="float: right"
|
||||
>
|
||||
<router-link
|
||||
class="link-type"
|
||||
:to="'/register'"
|
||||
>
|
||||
立即注册
|
||||
</router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div class="footer">
|
||||
© 2025 {{ currentTenantName || settings.systemName }}信息管理系统
|
||||
| 前端版本 {{ formattedFrontendVersion }}
|
||||
<span v-if="backendVersion">
|
||||
| 后端版本 {{ formattedBackendVersion }}
|
||||
</span>
|
||||
<!-- 公司版权信息(新增) -->
|
||||
<div class="company-copyright">
|
||||
技术支持:上海经创贺联信息技术有限公司
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<!-- 底部 -->
|
||||
|
||||
<div class="el-login-footer">
|
||||
<span>
|
||||
<el-link
|
||||
:underline="false"
|
||||
href="https://open.tntlinking.com/communityTreaty"
|
||||
target="_blank"
|
||||
>
|
||||
Copyright © 2025 湖北天天数链技术有限公司 本系统软件源代码许可来源于
|
||||
天天开源软件(社区版)许可协议 https://open.tntlinking.com/communityTreaty
|
||||
</el-link>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {computed, getCurrentInstance, onMounted, ref, watch, nextTick} from 'vue';
|
||||
import settings from '@/settings';
|
||||
import {getCodeImg, getUserBindTenantList, sign} from '@/api/login';
|
||||
import {invokeYbPlugin5001} from '@/api/public';
|
||||
import Cookies from 'js-cookie';
|
||||
import {decrypt, encrypt} from '@/utils/jsencrypt';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import {ElMessage} from 'element-plus';
|
||||
import {getSystemVersion} from '@/api/system/info';
|
||||
import logoNew from '@/assets/logo/LOGO.jpg';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const env = import.meta.env.MODE;
|
||||
const loginVersion = import.meta.env.VITE_APP_BUILD_VERSION;
|
||||
const backendVersion = ref('');
|
||||
|
||||
const formattedFrontendVersion = computed(() => {
|
||||
if (!loginVersion) return '';
|
||||
// 期望格式:YYYYMMDDHHmmss -> 显示 YYYY-MM-DD
|
||||
if (loginVersion.length >= 8) {
|
||||
const y = loginVersion.substring(0, 4);
|
||||
const m = loginVersion.substring(4, 6);
|
||||
const d = loginVersion.substring(6, 8);
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
return loginVersion;
|
||||
});
|
||||
|
||||
const formattedBackendVersion = computed(() => {
|
||||
if (!backendVersion.value) return '';
|
||||
if (backendVersion.value.length >= 8) {
|
||||
const y = backendVersion.value.substring(0, 4);
|
||||
const m = backendVersion.value.substring(4, 6);
|
||||
const d = backendVersion.value.substring(6, 8);
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
return backendVersion.value;
|
||||
});
|
||||
|
||||
const loginForm = ref({
|
||||
username: '',
|
||||
password: '',
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
uuid: '',
|
||||
tenantId: '',
|
||||
});
|
||||
|
||||
const tenantOptions = ref([]);
|
||||
const currentTenantName = ref('');
|
||||
|
||||
const loginRules = {
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
|
||||
code: [{ required: true, trigger: 'change', message: '请输入验证码' }],
|
||||
};
|
||||
|
||||
const codeUrl = ref('');
|
||||
const loading = ref(false);
|
||||
const signIng = ref(false);
|
||||
// 验证码开关
|
||||
const captchaEnabled = ref(true);
|
||||
// 注册开关
|
||||
const register = ref(false);
|
||||
const redirect = ref(undefined);
|
||||
const passwordVisible = ref(false);
|
||||
|
||||
function togglePasswordVisibility() {
|
||||
passwordVisible.value = !passwordVisible.value;
|
||||
}
|
||||
|
||||
// 处理忘记密码功能
|
||||
function handleForgotPassword() {
|
||||
// 这里可以添加忘记密码的逻辑,例如跳转到忘记密码页面或显示忘记密码弹窗
|
||||
// 目前先显示一个提示
|
||||
ElMessage({
|
||||
message: '忘记密码功能正在开发中',
|
||||
type: 'info'
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
route,
|
||||
(newRoute) => {
|
||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 页面加载时从 localStorage 获取 invokeYb 的值和从 Cookies 获取记住的登录信息
|
||||
onMounted(() => {
|
||||
const storedInvokeYb = localStorage.getItem('invokeYb');
|
||||
if (storedInvokeYb !== null) {
|
||||
loginForm.value.invokeYb = storedInvokeYb === 'true';
|
||||
} else {
|
||||
// 如果 localStorage 中没有值,则设置默认值为关闭并保存
|
||||
localStorage.setItem('invokeYb', 'false');
|
||||
loginForm.value.invokeYb = false;
|
||||
}
|
||||
|
||||
// 从 Cookies 中恢复记住的登录信息
|
||||
const rememberMe = Cookies.get('rememberMe');
|
||||
if (rememberMe && rememberMe === 'true') {
|
||||
const username = Cookies.get('username');
|
||||
const password = Cookies.get('password');
|
||||
if (username) {
|
||||
loginForm.value.username = username;
|
||||
loginForm.value.rememberMe = true;
|
||||
// 解密密码
|
||||
if (password) {
|
||||
try {
|
||||
loginForm.value.password = decrypt(password);
|
||||
} catch (e) {
|
||||
console.error('密码解密失败:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取医疗机构列表
|
||||
if (loginForm.value.username) {
|
||||
getUserBindTenantList(loginForm.value.username).then((res) => {
|
||||
tenantOptions.value = res.data.map(item => ({
|
||||
label: item.tenantName,
|
||||
value: item.id
|
||||
}));
|
||||
// 如果只有一个医疗机构,自动选中
|
||||
if (tenantOptions.value.length === 1) {
|
||||
loginForm.value.tenantId = tenantOptions.value[0].value;
|
||||
currentTenantName.value = tenantOptions.value[0].label;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取后端版本号
|
||||
getSystemVersion().then((res) => {
|
||||
if (res && res.backendVersion) {
|
||||
backendVersion.value = res.backendVersion;
|
||||
}
|
||||
}).catch(() => {
|
||||
backendVersion.value = '';
|
||||
});
|
||||
});
|
||||
|
||||
function handleLogin() {
|
||||
proxy.$refs.loginRef.validate((valid) => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
// 勾选了需要记住密码设置在 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(async () => {
|
||||
const query = route.query;
|
||||
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
||||
if (cur !== 'redirect') {
|
||||
acc[cur] = query[cur];
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
if (env === 'development' || !loginForm.value.invokeYb) {
|
||||
router.push({ path: redirect.value || '/', query: otherQueryParams });
|
||||
} else {
|
||||
signIng.value = true;
|
||||
userStore.getInfo();
|
||||
GetMacString();
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
// 重新获取验证码
|
||||
if (captchaEnabled.value) {
|
||||
//getCode();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 获取MAC 加密地址
|
||||
async function GetMacString() {
|
||||
// if (window.CefSharp === undefined) {
|
||||
// } else {
|
||||
try {
|
||||
// 必须参数
|
||||
const data = {
|
||||
FunctionId: 5,
|
||||
IP: 'ddjk.jlhs.gov.cn',
|
||||
PORT: 20215,
|
||||
TIMEOUT: 2000,
|
||||
LOG_PATH: 'C:/neu_log/',
|
||||
SFZ_DRIVER_TYPE: 0,
|
||||
};
|
||||
// 获取 mac 地址
|
||||
// let result = await window.chrome.webview.hostObjects.CSharpAccessor.GetMacString(
|
||||
// JSON.stringify(data)
|
||||
// );
|
||||
// 获取IP地址
|
||||
// let ip = await window.chrome.webview.hostObjects.CSharpAccessor.GetIpString();
|
||||
|
||||
// 获取 mac 地址 兼容win7 start--------------------------------------
|
||||
let result = undefined;
|
||||
// await CefSharp.BindObjectAsync('boundAsync');
|
||||
// console.log(boundAsync);
|
||||
|
||||
// await boundAsync.getMacString(JSON.stringify(data)).then((res) => {
|
||||
// result = res
|
||||
// });
|
||||
await invokeYbPlugin5001(data).then((res) => {
|
||||
result = res.data;
|
||||
if (result === undefined || result === '' || result === ' ') {
|
||||
throw new Error('获取 mac 地址失败');
|
||||
}
|
||||
});
|
||||
// 获取ip地址
|
||||
let ip = undefined;
|
||||
// await boundAsync.getIpString().then((res) => {
|
||||
// ip = res;
|
||||
// });
|
||||
await invokeYbPlugin5001({ FunctionId: 6 }).then((res) => {
|
||||
ip = res.data;
|
||||
if (ip === undefined || ip === '' || ip === ' ') {
|
||||
throw new Error('获取 ip 地址失败');
|
||||
}
|
||||
});
|
||||
// 医保签到
|
||||
signIn(result, ip);
|
||||
// end--------------------------------------
|
||||
// 解析返回的结果
|
||||
// let cardInfo = JSON.parse(jsonResult);
|
||||
} catch (error) {
|
||||
console.error('调用失败:', error);
|
||||
}
|
||||
// }
|
||||
}
|
||||
function getCode() {
|
||||
getCodeImg().then((res) => {
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
||||
if (captchaEnabled.value) {
|
||||
codeUrl.value = 'data:image/gif;base64,' + res.img;
|
||||
loginForm.value.uuid = res.uuid;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 监听租户选择变化
|
||||
watch(() => loginForm.value.tenantId, (newTenantId) => {
|
||||
const selectedTenant = tenantOptions.value.find(item => item.value === newTenantId);
|
||||
if (selectedTenant) {
|
||||
currentTenantName.value = selectedTenant.label;
|
||||
}
|
||||
});
|
||||
|
||||
// 切换医保连接开关时更新 localStorage
|
||||
function topNavChange(value) {
|
||||
localStorage.setItem('invokeYb', value.toString());
|
||||
}
|
||||
|
||||
//账号变化时
|
||||
function handleUsernameChange(newVal) {
|
||||
getTenantList(newVal);
|
||||
}
|
||||
|
||||
//查询租户列表
|
||||
function getTenantList(username) {
|
||||
if (!username) {
|
||||
return;
|
||||
}
|
||||
getUserBindTenantList(username).then((res) => {
|
||||
loginForm.value.tenantId = '';
|
||||
if (res.code == 200) {
|
||||
if (res.data.length > 0) {
|
||||
tenantOptions.value = res.data.map((item) => ({
|
||||
value: item.id,
|
||||
label: item.tenantName,
|
||||
}));
|
||||
loginForm.value.tenantId = tenantOptions.value[0].value; //默认选中第一个
|
||||
currentTenantName.value = tenantOptions.value[0].label;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* description: 签到方法
|
||||
* @param practitionerId 参与者 id
|
||||
* @param mac 用户 mac 地址
|
||||
* @param ip 签到的 IP 地址
|
||||
*/
|
||||
async function signIn(mac, ip) {
|
||||
// 用户 id
|
||||
const practitionerId = userStore.practitionerId;
|
||||
console.log('userStore', userStore);
|
||||
// 签到的 IP 地址
|
||||
try {
|
||||
const response = await sign(practitionerId, mac, ip);
|
||||
if (response.code !== 200) {
|
||||
throw new Error('签到失败,错误信息:' + response.msg);
|
||||
}
|
||||
signIng.value = false;
|
||||
loading.value = false;
|
||||
const query = route.query;
|
||||
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
||||
if (cur !== 'redirect') {
|
||||
acc[cur] = query[cur];
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
userStore.removeRoles();
|
||||
router.push({ path: redirect.value || '/', query: otherQueryParams });
|
||||
console.log('签到成功:', response);
|
||||
} catch (error) {
|
||||
userStore.logOut();
|
||||
signIng.value = false;
|
||||
loading.value = false;
|
||||
proxy.$message.error('医保签到失败');
|
||||
console.error('签到失败:', error);
|
||||
}
|
||||
}
|
||||
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),
|
||||
};
|
||||
}
|
||||
|
||||
function handleUserName(value) {
|
||||
let user = {
|
||||
admin: {
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
},
|
||||
doctor: {
|
||||
username: 'gjlin',
|
||||
password: 'wi123456',
|
||||
},
|
||||
drug: {
|
||||
username: 'mqyk',
|
||||
password: 'mqyk123',
|
||||
},
|
||||
nurse: {
|
||||
username: 'nmhs',
|
||||
password: 'nmhs123',
|
||||
},
|
||||
charge: {
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
},
|
||||
};
|
||||
loginForm.value.username = user[value].username;
|
||||
loginForm.value.password = user[value].password;
|
||||
handleLogin();
|
||||
}
|
||||
|
||||
//getCode();
|
||||
getCookie();
|
||||
|
||||
// 只有当 username 存在时才获取租户列表
|
||||
if (loginForm.value.username) {
|
||||
getTenantList(loginForm.value.username);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
height: auto;
|
||||
min-height: 100vh;
|
||||
overflow-y: auto;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background: #f8f9fa;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 100px; /* 为底部固定footer留出空间 */
|
||||
//background-image: url("../assets/images/login-background.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
.title {
|
||||
margin: 10px auto 15px auto;
|
||||
text-align: center;
|
||||
color: #000;
|
||||
font-family: 'Microsoft Yahei,STHeiti,Simsun,STSong,Helvetica Neue,Helvetica,Arial,sans-serif';
|
||||
}
|
||||
.label{
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.login-options {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 8px 0 10px 0;
|
||||
width: 100%; /* 确保容器占满宽度 */
|
||||
}
|
||||
|
||||
.remember-me {
|
||||
margin: 0;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.forgot-password {
|
||||
font-size: 14px;
|
||||
color: var(--primary);
|
||||
cursor: pointer;
|
||||
text-align: right; /* 确保文本右对齐 */
|
||||
margin-left: auto; /* 确保元素右对齐 */
|
||||
}
|
||||
.footer {
|
||||
margin-top: 32px;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.login-subtitle {
|
||||
font-size: 14px;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.login-form {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 12px var(--shadow);
|
||||
border: 1px solid var(--border);
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
padding: 40px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
text-align: center;
|
||||
.el-input {
|
||||
height: 50px; // 修改输入框高度
|
||||
input {
|
||||
height: 50px; // 修改输入框高度
|
||||
font-size: 18px; // 修改输入框内文字大小
|
||||
}
|
||||
}
|
||||
.input-icon {
|
||||
height: 49px; // 调整图标高度以适应输入框高度
|
||||
width: 14px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
}
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 50px; // 调整验证码区域高度以适应输入框高度
|
||||
float: right;
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.el-login-top {
|
||||
text-align: center;
|
||||
margin: 0 auto 10px;
|
||||
.el-image {
|
||||
max-width: 120px;
|
||||
max-height: 120px;
|
||||
}
|
||||
}
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 30px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #000;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
background-color: #f1f1f1;
|
||||
z-index: 100; /* 确保footer在最上层 */
|
||||
span {
|
||||
margin: 0 10px;
|
||||
}
|
||||
}
|
||||
.login-code-img {
|
||||
height: 50px; // 调整验证码图片高度以适应输入框高度
|
||||
padding-left: 12px;
|
||||
}
|
||||
:deep(.el-input__wrapper) {
|
||||
background-color: #f5f7fa !important;
|
||||
border-color: #e4e7ed !important;
|
||||
border-radius: 10px !important;
|
||||
font-size: 18px !important;
|
||||
height: 50px !important; // 修改输入框高度
|
||||
}
|
||||
:deep(.el-button--large) {
|
||||
font-size: 20px !important; // 增加按钮内文字大小
|
||||
height: 50px !important; // 增加按钮高度
|
||||
padding: 10px 20px !important; // 调整按钮内边距
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
:deep(.el-input__suffix-inner .el-input__icon) {
|
||||
width: 24px !important; // 调整图标的宽度
|
||||
height: 24px !important; // 调整图标的高度
|
||||
font-size: 24px !important; // 调整图标的字体大小
|
||||
color: #606266 !important; // 确保图标颜色可见
|
||||
cursor: pointer !important; // 确保鼠标悬停时显示指针
|
||||
}
|
||||
|
||||
:deep(.password-toggle) {
|
||||
line-height: 50px !important; // 确保文字垂直居中
|
||||
user-select: none; // 禁止选中文字
|
||||
}
|
||||
:deep(.el-select__wrapper) {
|
||||
background-color: #f5f7fa !important;
|
||||
border-color: #e4e7ed !important;
|
||||
border-radius: 10px !important;
|
||||
font-size: 18px !important;
|
||||
height: 50px !important; // 修改输入框高度
|
||||
}
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 15px !important; // 减小输入框之间的距离
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user