index.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233
  1. <template>
  2. <div :class="prefixCls" class="authorization-page">
  3. <AppHeader />
  4. <div class="authorization-content">
  5. <section class="left-pane">
  6. <div class="left-pane__content">
  7. <div class="left-pane__header">
  8. <div class="left-pane__badge">
  9. <SafetyCertificateOutlined />
  10. <span>{{ pageBadge }}</span>
  11. </div>
  12. <h1 class="left-pane__title">{{ pageTitle }}</h1>
  13. <p class="left-pane__subtitle">{{ pageSubtitle }}</p>
  14. </div>
  15. <div class="left-pane__visual">
  16. <div class="device-illustration">
  17. <div class="device-illustration__screen-shell">
  18. <div class="device-illustration__screen-dots">
  19. <span></span>
  20. <span></span>
  21. <span></span>
  22. </div>
  23. <div class="device-illustration__screen-body">
  24. <div class="device-illustration__line device-illustration__line--lg"></div>
  25. <div class="device-illustration__line device-illustration__line--md"></div>
  26. <div class="device-illustration__chart">
  27. <span></span>
  28. <span></span>
  29. <span></span>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="device-illustration__stand"></div>
  34. <div class="device-illustration__shadow"></div>
  35. <div class="floating-card floating-card--left">
  36. <div class="floating-card__icon">
  37. <DesktopOutlined />
  38. </div>
  39. <div class="floating-card__content">
  40. <div class="floating-card__label">对象画像</div>
  41. <div class="floating-card__title">多源归集</div>
  42. </div>
  43. </div>
  44. <div class="floating-card floating-card--right">
  45. <div class="floating-card__icon floating-card__icon--indigo">
  46. <ApartmentOutlined />
  47. </div>
  48. <div class="floating-card__content">
  49. <div class="floating-card__label">关系分析</div>
  50. <div class="floating-card__title">图谱联动</div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="left-pane__features">
  56. <div v-for="item in leftFeatures" :key="item.title" class="feature-item">
  57. <div class="feature-item__icon">
  58. <component :is="item.icon" />
  59. </div>
  60. <div class="feature-item__content">
  61. <h3 class="feature-item__title">{{ item.title }}</h3>
  62. <p class="feature-item__desc">{{ item.desc }}</p>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="left-pane__footer">
  67. <p class="left-pane__footer-line">{{ productSetting.copyright }}</p>
  68. <p class="left-pane__footer-line">联系电话:{{ productSetting.companyPhone }}</p>
  69. </div>
  70. </div>
  71. </section>
  72. <section class="right-pane">
  73. <svg class="right-pane__curve" preserveAspectRatio="none" viewBox="0 0 100 100">
  74. <path d="M100,0 Q-40,50 100,100 Z" fill="currentColor" />
  75. </svg>
  76. <div class="right-pane__scroll">
  77. <!--
  78. 服务地址卡片:与授权 / 登录共用同一个大页面,按条件切换。
  79. 未绑定、或上次绑定的地址连不通时展示,此时其它校验都无从谈起。
  80. -->
  81. <div v-if="viewMode === 'server'" class="auth-card auth-card--server">
  82. <div class="auth-card__header">
  83. <h2 class="auth-card__title">连接后端服务</h2>
  84. <div v-if="serverWarning" class="auth-card__warning">{{ serverWarning }}</div>
  85. </div>
  86. <ServerAddressPanel :show-footer-tip="false" />
  87. <div class="auth-card__server-foot">
  88. <span class="auth-card__server-tip">地址保存在本机,下次启动自动复用</span>
  89. <Button
  90. v-if="showServerBack"
  91. type="link"
  92. size="small"
  93. class="auth-card__server-back-btn"
  94. @click="handleBackFromServer"
  95. >
  96. 返回登录
  97. </Button>
  98. </div>
  99. </div>
  100. <div v-else-if="viewMode === 'license'" class="auth-card">
  101. <div class="auth-card__header">
  102. <h2 class="auth-card__title">未授权时请先完成离线授权</h2>
  103. <div v-if="authorizationWarningMessage" class="auth-card__warning">
  104. {{ authorizationWarningMessage }}
  105. </div>
  106. </div>
  107. <div class="auth-card__steps">
  108. <div v-for="(item, index) in authorizationSteps" :key="item.title" class="step-card">
  109. <div class="step-card__index">{{ index + 1 }}</div>
  110. <h4 class="step-card__title">{{ item.title }}</h4>
  111. <p class="step-card__desc">{{ item.desc }}</p>
  112. <RightOutlined v-if="index < authorizationSteps.length - 1" class="step-card__arrow" />
  113. </div>
  114. </div>
  115. <div class="auth-card__section">
  116. <div class="auth-card__section-head">
  117. <h3 class="auth-card__section-title">获取机器码</h3>
  118. <span class="auth-card__section-tip">用于申请当前设备的离线授权文件</span>
  119. </div>
  120. <div class="machine-panel">
  121. <div class="machine-panel__value">
  122. {{ machineCode || '点击“获取机器码”后显示当前设备机器码' }}
  123. </div>
  124. <div class="machine-panel__actions">
  125. <Button class="ui-btn ui-btn--ghost" :loading="machineCodeLoading" @click="handleGetMachineCode">
  126. 获取机器码
  127. </Button>
  128. <Button class="ui-btn ui-btn--ghost" :disabled="!machineCode" @click="handleCopyMachineCode">
  129. <CopyOutlined />
  130. <span>复制</span>
  131. </Button>
  132. </div>
  133. </div>
  134. </div>
  135. <div class="auth-card__section">
  136. <div class="auth-card__section-head">
  137. <h3 class="auth-card__section-title">上传授权文件</h3>
  138. <span class="auth-card__section-tip">选择本地授权文件后执行离线授权</span>
  139. </div>
  140. <div class="upload-panel">
  141. <!-- Web 化:直接选择本机文件上传,不再通过 Electron 读取本机路径 -->
  142. <input
  143. ref="licenseFileInputRef"
  144. class="upload-panel__file-input"
  145. type="file"
  146. accept=".xlts"
  147. @change="handleLicenseFileChange"
  148. />
  149. <div
  150. class="upload-panel__dropzone"
  151. :class="{ 'upload-panel__dropzone--has-file': !!licenseFile }"
  152. role="button"
  153. tabindex="0"
  154. @click="openLicenseFilePicker"
  155. @keydown.enter.prevent="openLicenseFilePicker"
  156. @keydown.space.prevent="openLicenseFilePicker"
  157. >
  158. <UploadOutlined class="upload-panel__dropzone-icon" />
  159. <span class="upload-panel__dropzone-text">
  160. {{ licenseFileName || '请选择离线授权文件' }}
  161. </span>
  162. </div>
  163. <div class="upload-panel__actions">
  164. <Button class="ui-btn ui-btn--ghost" @click="openLicenseFilePicker">选择授权文件</Button>
  165. <Button
  166. type="primary"
  167. class="ui-btn ui-btn--primary"
  168. :loading="offlineAuthorizationLoading"
  169. :disabled="!licenseFile"
  170. @click="handleOfflineAuthorization"
  171. >
  172. 离线授权
  173. </Button>
  174. </div>
  175. </div>
  176. </div>
  177. <div class="auth-card__server">
  178. <LinkOutlined />
  179. <span class="auth-card__server-label">服务地址</span>
  180. <span class="auth-card__server-value">{{ serverOrigin }}</span>
  181. <Button type="link" size="small" class="auth-card__server-action" @click="goServerSetup">切换</Button>
  182. </div>
  183. </div>
  184. <div v-else-if="viewMode === 'login'" class="auth-card auth-card--login">
  185. <div class="auth-card__header">
  186. <span class="auth-card__eyebrow">账号登录</span>
  187. <h2 class="auth-card__title">登录进入案件工作台</h2>
  188. </div>
  189. <div v-if="hasAuthorizationSummary" class="license-summary">
  190. <div class="license-summary__head">
  191. <SafetyCertificateOutlined />
  192. <span>当前设备授权信息</span>
  193. </div>
  194. <dl class="license-summary__list">
  195. <div v-if="authorizationUnit" class="license-summary__row">
  196. <dt>授权单位</dt>
  197. <dd>{{ authorizationUnit }}</dd>
  198. </div>
  199. <div v-if="authorizationOverDateTime" class="license-summary__row">
  200. <dt>授权到期</dt>
  201. <dd>{{ authorizationOverDateTime }}</dd>
  202. </div>
  203. </dl>
  204. </div>
  205. <Form :model="loginForm" layout="vertical" class="login-form" @submit.prevent>
  206. <FormItem name="username" :rules="[{ required: true, message: '请输入用户名' }]">
  207. <label class="login-form__label" for="login-username">用户名</label>
  208. <Input
  209. id="login-username"
  210. v-model:value="loginForm.username"
  211. placeholder="请输入用户名"
  212. autocomplete="username"
  213. allow-clear
  214. />
  215. </FormItem>
  216. <FormItem name="password" :rules="[{ required: true, message: '请输入密码' }]">
  217. <label class="login-form__label" for="login-password">密码</label>
  218. <Input.Password
  219. id="login-password"
  220. v-model:value="loginForm.password"
  221. placeholder="请输入密码"
  222. autocomplete="current-password"
  223. @press-enter="handleLoginSubmit"
  224. />
  225. </FormItem>
  226. <Button
  227. type="primary"
  228. block
  229. class="login-form__submit"
  230. :loading="loginLoading"
  231. @click="handleLoginSubmit"
  232. >
  233. 登录
  234. </Button>
  235. </Form>
  236. <p class="login-form__tip">账号由管理员创建,如需开通请联系管理员</p>
  237. <div class="auth-card__server">
  238. <LinkOutlined />
  239. <span class="auth-card__server-label">服务地址</span>
  240. <span class="auth-card__server-value">{{ serverOrigin }}</span>
  241. <Button type="link" size="small" class="auth-card__server-action" @click="goServerSetup">切换</Button>
  242. </div>
  243. </div>
  244. </div>
  245. </section>
  246. </div>
  247. </div>
  248. </template>
  249. <script lang="ts" setup>
  250. import { computed, onMounted, reactive, ref } from 'vue';
  251. import { useRoute, useRouter } from 'vue-router';
  252. import { Button, Form, FormItem, Input, Modal } from 'ant-design-vue';
  253. import {
  254. ApartmentOutlined,
  255. CopyOutlined,
  256. DatabaseOutlined,
  257. DesktopOutlined,
  258. LinkOutlined,
  259. LockOutlined,
  260. LoginOutlined,
  261. NotificationOutlined,
  262. RightOutlined,
  263. SafetyCertificateOutlined,
  264. UploadOutlined,
  265. } from '@ant-design/icons-vue';
  266. import { PageEnum } from '@/core/enums/pageEnum';
  267. import { getApiOrigin, getBoundServerOrigin, isServerSetupMissing } from '@/core/settings/serverSetting';
  268. import { AppHeader } from '@/core/components/Application';
  269. import ServerAddressPanel from '@/core/components/ServerAddress/ServerAddressPanel.vue';
  270. import { authorizationInfoApi, checkAuthApi, machineCodeApi, offlineAuthorizationApi } from '@/core/api/sys/login';
  271. import { LOGIN_ACCOUNT_IN_USE } from '@/core/api/auth/authApi';
  272. import { useCopyToClipboard } from '@/core/hooks/web/useCopyToClipboard';
  273. import { useDesign } from '@/core/hooks/web/useDesign';
  274. import { productSetting } from '@/core/settings/productSetting';
  275. import { useMessage } from '@/core/hooks/web/useMessage';
  276. import { useAccountStore } from '@/core/store/modules/account';
  277. import { useUserStore } from '@/core/store/modules/case';
  278. import { getToken } from '@/core/utils/auth';
  279. import { initGlobalCaseConfig } from '@/core/logics/caseConfigGuide';
  280. import {
  281. extractAuthorizationCache,
  282. getAuthorizationExpiredMessage,
  283. isAuthorizationExpired,
  284. } from '@/core/utils/license';
  285. const router = useRouter();
  286. const route = useRoute();
  287. const { prefixCls } = useDesign('authorization-entry');
  288. const { showMessage } = useMessage();
  289. const { clipboardRef, isSuccessRef } = useCopyToClipboard();
  290. const userStore = useUserStore();
  291. const accountStore = useAccountStore();
  292. /** 当前生效的后端地址。切换地址会整页重载,所以取一次即可。 */
  293. const serverOrigin = getBoundServerOrigin() || getApiOrigin() || '未配置';
  294. /** 服务地址卡片的告警:上次地址连不通时由启动流程带 ?error=unreachable 过来 */
  295. const serverWarning = ref('');
  296. const serverUnreachable = ref(false);
  297. /**
  298. * 切到服务地址卡片(不换页面)。
  299. *
  300. * <p>绑错地址时业务页进不去、设置抽屉也打不开,本页是唯一的自救入口。
  301. */
  302. function goServerSetup() {
  303. serverUnreachable.value = false;
  304. serverWarning.value = '';
  305. viewMode.value = 'server';
  306. }
  307. /** 从服务地址卡片回到登录 / 授权卡片;未绑定或上次连不通时不给这个出口 */
  308. async function handleBackFromServer() {
  309. viewMode.value = '';
  310. await resolveEntryMode();
  311. }
  312. /**
  313. * 页面形态。
  314. *
  315. * <p>`server` = 还没绑定后端地址(或上次地址连不通)→ 展示服务地址卡片;
  316. * `license` = 设备未授权(或授权已过期)→ 展示离线授权卡片;
  317. * `login` = 设备已授权但未登录 → 展示登录卡片;
  318. * `''` = 尚未判定,此时右侧不渲染卡片,避免先闪一下错误的形态。
  319. */
  320. type ViewMode = 'server' | 'license' | 'login';
  321. const viewMode = ref<ViewMode | ''>('');
  322. const machineCode = ref('');
  323. const machineCodeLoading = ref(false);
  324. const offlineAuthorizationLoading = ref(false);
  325. /** 用户选择的授权文件(Web 化:直接上传文件内容,不再传服务端路径) */
  326. const licenseFile = ref<File | null>(null);
  327. const licenseFileInputRef = ref<HTMLInputElement | null>(null);
  328. const licenseFileName = computed(() => licenseFile.value?.name || '');
  329. const authorizationWarningMessage = ref('');
  330. const loginForm = reactive({ username: '', password: '' });
  331. const loginLoading = ref(false);
  332. /** 登录卡片上的授权摘要(授权单位 / 到期时间),来源与授权页一致 */
  333. const authorizationUnit = computed(() => String(userStore.getPageCacheByKey('authorizationUnit', '') || ''));
  334. const authorizationOverDateTime = computed(() =>
  335. String(userStore.getPageCacheByKey('licenseOverDateTime', '') || ''),
  336. );
  337. const hasAuthorizationSummary = computed(() => !!(authorizationUnit.value || authorizationOverDateTime.value));
  338. const capabilityList = [
  339. {
  340. title: '多源数据融合',
  341. desc: '整合资金流水、话单、基站轨迹等异构数据,提升数据归集效率。',
  342. icon: DatabaseOutlined,
  343. },
  344. {
  345. title: '关系图谱分析',
  346. desc: '围绕对象、团伙与行为链路开展多端关联研判,快速定位关键关系。',
  347. icon: ApartmentOutlined,
  348. },
  349. {
  350. title: '专题预警支撑',
  351. desc: '结合时序分析与规则配置,辅助线索核查、案件推进和复盘总结。',
  352. icon: NotificationOutlined,
  353. },
  354. ];
  355. /** 登录态的左侧说明。刻意不复述卡片上的内容(授权信息、账号来源提示都在卡片里)。 */
  356. const loginTips = [
  357. {
  358. title: '账号来源',
  359. desc: '账号由管理员统一创建,忘记密码请联系管理员重置。',
  360. icon: SafetyCertificateOutlined,
  361. },
  362. {
  363. title: '案件隔离',
  364. desc: '不同案件的数据源相互独立,切换案件会重新加载对应数据源。',
  365. icon: DatabaseOutlined,
  366. },
  367. {
  368. title: '会话保护',
  369. desc: '长时间无操作会自动锁屏,需重新验证身份后继续。',
  370. icon: LockOutlined,
  371. },
  372. ];
  373. /** 绑定地址时的左侧说明:三步走,让首次启动的人知道后面还会发生什么 */
  374. const serverSteps = [
  375. {
  376. title: '绑定服务地址',
  377. desc: '填写管理员提供的地址,测试连通性。',
  378. icon: LinkOutlined,
  379. },
  380. {
  381. title: '完成授权校验',
  382. desc: '校验当前设备授权是否有效。',
  383. icon: SafetyCertificateOutlined,
  384. },
  385. {
  386. title: '登录进入系统',
  387. desc: '使用管理员分配的账号登录。',
  388. icon: LoginOutlined,
  389. },
  390. ];
  391. const isLoginView = computed(() => viewMode.value === 'login');
  392. const isServerView = computed(() => viewMode.value === 'server');
  393. /** 左侧文案随形态切换:地址绑定是首次启动的第一屏,需要说明接下来还有两步 */
  394. const pageBadge = computed(() =>
  395. isServerView.value ? '系统接入' : isLoginView.value ? '已授权设备' : '系统授权入口',
  396. );
  397. const pageTitle = computed(() =>
  398. isServerView.value ? '连接研判后端' : isLoginView.value ? '欢迎回来' : '智能研判分析平台',
  399. );
  400. const pageSubtitle = computed(() => {
  401. if (isServerView.value) {
  402. return '后端服务独立部署,首次启动需要绑定服务地址。连接通过后进入设备授权校验与账号登录。';
  403. }
  404. if (isLoginView.value) {
  405. return '请使用管理员分配的账号登录,登录后即可进入案件工作台,开展线索梳理与关系研判。';
  406. }
  407. return '面向案件管理、对象关联和多源数据研判的专业系统,帮助团队更高效地完成线索梳理、关系挖掘与专题分析。';
  408. });
  409. const leftFeatures = computed(() =>
  410. isServerView.value ? serverSteps : isLoginView.value ? loginTips : capabilityList,
  411. );
  412. /** 未绑定、或上次地址连不通时,服务卡片不能后退,否则会回到必然失败的校验流程 */
  413. const showServerBack = computed(
  414. () => viewMode.value === 'server' && !isServerSetupMissing() && !serverUnreachable.value,
  415. );
  416. const authorizationSteps = [
  417. {
  418. title: '获取机器码',
  419. desc: '提取当前设备机器码,并提交给授权方生成对应的离线授权文件。',
  420. },
  421. {
  422. title: '选择授权文件',
  423. desc: '从本地导入授权文件,系统会自动进行授权校验。',
  424. },
  425. {
  426. title: '执行离线授权',
  427. desc: '授权成功后即可进入系统。',
  428. },
  429. ];
  430. function syncAuthorizationCache(source?: unknown) {
  431. const { authorizationLabel, overDateTime, authorizationUnit } = extractAuthorizationCache(source);
  432. userStore.setPageCache('authorizationLabel', authorizationLabel);
  433. userStore.setPageCache('licenseOverDateTime', overDateTime);
  434. userStore.setPageCache('authorizationUnit', authorizationUnit);
  435. return {
  436. authorizationLabel,
  437. overDateTime,
  438. authorizationUnit,
  439. };
  440. }
  441. function clearAuthorizationCache() {
  442. syncAuthorizationCache();
  443. }
  444. async function resolveAuthorizationCache(source?: unknown) {
  445. const cache = syncAuthorizationCache(source);
  446. if (cache.overDateTime) {
  447. return cache;
  448. }
  449. try {
  450. const res = await authorizationInfoApi();
  451. return syncAuthorizationCache(res);
  452. } catch {
  453. return cache;
  454. }
  455. }
  456. function showExpiredAuthorizationMessage(overDateTime?: unknown) {
  457. authorizationWarningMessage.value = getAuthorizationExpiredMessage(overDateTime);
  458. showMessage(authorizationWarningMessage.value, 'warning');
  459. }
  460. async function loadMachineCode() {
  461. machineCodeLoading.value = true;
  462. try {
  463. const data = await machineCodeApi();
  464. machineCode.value = data || '';
  465. } catch (error) {
  466. machineCode.value = '';
  467. } finally {
  468. machineCodeLoading.value = false;
  469. }
  470. }
  471. function handleCopyMachineCode() {
  472. if (!machineCode.value) return;
  473. clipboardRef.value = machineCode.value;
  474. if (isSuccessRef.value) {
  475. showMessage('机器码复制成功', 'success');
  476. }
  477. }
  478. async function handleGetMachineCode() {
  479. await loadMachineCode();
  480. if (machineCode.value) {
  481. showMessage('机器码获取成功', 'success');
  482. }
  483. }
  484. /** 统一入口:dropzone 点击 / 键盘、以及「选择授权文件」按钮都走这里 */
  485. function openLicenseFilePicker() {
  486. licenseFileInputRef.value?.click();
  487. }
  488. function handleLicenseFileChange(event: Event) {
  489. const input = event.target as HTMLInputElement;
  490. const file = input.files?.[0] || null;
  491. input.value = '';
  492. if (!file) return;
  493. if (!file.name.toLowerCase().endsWith('.xlts')) {
  494. showMessage('请选择 .xlts 结尾的授权文件');
  495. return;
  496. }
  497. licenseFile.value = file;
  498. }
  499. async function handleOfflineAuthorization() {
  500. if (!licenseFile.value) {
  501. showMessage('请先选择授权文件');
  502. return;
  503. }
  504. offlineAuthorizationLoading.value = true;
  505. try {
  506. const res = await offlineAuthorizationApi(licenseFile.value);
  507. authorizationWarningMessage.value = '';
  508. if (res?.code === 200) {
  509. showMessage('离线授权成功', 'success');
  510. // 授权成功后不再直接进业务页:先刷新授权摘要,再按登录态决定去哪
  511. await resolveAuthorizationCache();
  512. if (getToken()) {
  513. await initGlobalCaseConfig();
  514. await router.replace(getPostLoginTarget());
  515. } else {
  516. viewMode.value = 'login';
  517. }
  518. } else {
  519. showMessage(res?.message || '离线授权失败');
  520. }
  521. } catch (error: any) {
  522. showMessage(error?.message || '离线授权失败,请稍后重试');
  523. } finally {
  524. offlineAuthorizationLoading.value = false;
  525. }
  526. }
  527. /**
  528. * 判定当前设备的授权状态。
  529. *
  530. * <p>判定方式与合并前**完全一致**(`checkAuthApi()` + `isAuthorizationExpired()`),
  531. * 只是不再负责跳转:这里只回答「授权是否有效」,展示哪张卡片由 `resolveEntryMode()` 决定。
  532. */
  533. async function isDeviceAuthorized(): Promise<boolean> {
  534. try {
  535. const res = await checkAuthApi();
  536. if (res?.code === 200) {
  537. const cache = await resolveAuthorizationCache(res);
  538. if (isAuthorizationExpired(cache.overDateTime)) {
  539. showExpiredAuthorizationMessage(cache.overDateTime);
  540. return false;
  541. }
  542. return true;
  543. }
  544. clearAuthorizationCache();
  545. return false;
  546. } catch (error: any) {
  547. const status = error?.response?.status || error?.status;
  548. if (status !== 401) {
  549. showMessage(error?.message || '授权校验失败,请稍后重试!');
  550. }
  551. clearAuthorizationCache();
  552. return false;
  553. }
  554. }
  555. /**
  556. * 登录 / 已登录后的固定落点:案件管理页。
  557. *
  558. * <p>不再回跳 `redirect`:登录态过期后重新登录时,回跳会把用户直接带回上一个业务页
  559. * (例如 /data/index,继而进入已打开的案件)。按产品要求,每次登录都必须先落到
  560. * 案件管理页,由用户自己选择要打开的案件。
  561. */
  562. function getPostLoginTarget(): string {
  563. return PageEnum.BASE_CASE;
  564. }
  565. /**
  566. * 决定入口页展示哪张卡片。
  567. *
  568. * <p>· 未绑定地址 / 上次地址连不通:先展示服务地址卡片,其它校验都无从谈起;
  569. * <p>· 带 `forceAuth` / `skipAuthCheck`:授权已被明确判定失效,直接进授权态;
  570. * <p>· 已授权 + 有 token:直接进业务页;
  571. * <p>· 已授权 + 无 token:登录卡片;
  572. * <p>· 未授权:授权卡片。
  573. */
  574. async function resolveEntryMode() {
  575. if (isServerSetupMissing() || serverUnreachable.value) {
  576. viewMode.value = 'server';
  577. return;
  578. }
  579. if (route.query.forceAuth === '1' || route.query.skipAuthCheck === '1') {
  580. viewMode.value = 'license';
  581. return;
  582. }
  583. const authorized = await isDeviceAuthorized();
  584. if (!authorized) {
  585. viewMode.value = 'license';
  586. return;
  587. }
  588. if (getToken()) {
  589. await initGlobalCaseConfig();
  590. await router.replace(getPostLoginTarget());
  591. return;
  592. }
  593. viewMode.value = 'login';
  594. }
  595. /**
  596. * 账号正在使用:确认后才带 force 重新登录。
  597. *
  598. * <p>「正在使用」= 该账号有有效会话且最近半小时内活跃过(后端判定)。
  599. * 确认登录会踢掉旧会话,旧会话打开的案件由后端会话监听释放。
  600. */
  601. function confirmForceLogin(username: string) {
  602. Modal.confirm({
  603. title: '账号正在使用中',
  604. content: '该账号最近半小时内在其他设备上有操作。继续登录会使对方下线,是否继续?',
  605. okText: '继续登录',
  606. cancelText: '取消',
  607. // Ant Design 的弹框默认从顶部 100px 处展开;登录页是独立的全屏入口,
  608. // 跟随页面居中显示更稳(窗口矮的时候也不会被顶到边缘)
  609. centered: true,
  610. onOk: async () => {
  611. try {
  612. const outcome = await accountStore.login({
  613. username,
  614. password: loginForm.password,
  615. force: true,
  616. });
  617. if (!outcome.ok) {
  618. showMessage(outcome.message || '登录失败');
  619. return;
  620. }
  621. await router.replace(getPostLoginTarget());
  622. } catch {
  623. // HTTP 层错误(网络/密码校验失败)已由 defHttp 统一提示
  624. }
  625. },
  626. });
  627. }
  628. async function handleLoginSubmit() {
  629. // 防重入:重复登录会因 is-concurrent=false 把前一个 token 顶掉,导致刚拿到的凭据立即失效
  630. if (loginLoading.value) {
  631. return;
  632. }
  633. const username = loginForm.username.trim();
  634. if (!username || !loginForm.password) {
  635. return;
  636. }
  637. loginLoading.value = true;
  638. try {
  639. const outcome = await accountStore.login({ username, password: loginForm.password });
  640. if (!outcome.ok) {
  641. // 账号占用是正常分支:弹确认框,确认后带 force 重新登录
  642. if (outcome.code === LOGIN_ACCOUNT_IN_USE) {
  643. confirmForceLogin(username);
  644. return;
  645. }
  646. showMessage(outcome.message || '登录失败');
  647. return;
  648. }
  649. await router.replace(getPostLoginTarget());
  650. } catch {
  651. // 错误提示已由 defHttp 统一弹出,这里只负责不跳转
  652. } finally {
  653. loginLoading.value = false;
  654. }
  655. }
  656. onMounted(async () => {
  657. // 启动时健康检查失败会带这个参数过来:地址已保存但服务不可达,先让人改地址
  658. if (route.query.error === 'unreachable') {
  659. serverUnreachable.value = true;
  660. serverWarning.value = '上次保存的服务地址无法连接,请确认后端服务已启动,或重新填写地址。';
  661. }
  662. if (route.query.expired === '1') {
  663. authorizationWarningMessage.value = String(
  664. route.query.message || '当前授权已过期,请重新导入有效授权文件或联系管理员。',
  665. );
  666. showMessage(authorizationWarningMessage.value, 'warning');
  667. }
  668. await resolveEntryMode();
  669. });
  670. </script>
  671. <style lang="less">
  672. @prefix-cls: ~'jeesite-authorization-entry';
  673. .@{prefix-cls} {
  674. height: 100vh;
  675. width: 100%;
  676. display: flex;
  677. flex-direction: column;
  678. overflow: hidden;
  679. background: #f4f7f9;
  680. font-family:
  681. -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  682. .authorization-page {
  683. position: relative;
  684. display: flex;
  685. width: 100%;
  686. height: 100vh;
  687. overflow: hidden;
  688. }
  689. .authorization-content {
  690. flex: 1;
  691. display: flex;
  692. min-height: 0;
  693. }
  694. .left-pane {
  695. position: relative;
  696. z-index: 0;
  697. display: none;
  698. flex-direction: column;
  699. width: 40%;
  700. padding: 32px 40px 24px;
  701. color: #fff;
  702. background: #165dff;
  703. min-height: 0;
  704. overflow: hidden;
  705. &__content {
  706. position: relative;
  707. z-index: 1;
  708. display: flex;
  709. flex: 1;
  710. min-height: 0;
  711. flex-direction: column;
  712. justify-content: space-between;
  713. gap: clamp(12px, 2vh, 24px);
  714. width: 100%;
  715. max-width: 520px;
  716. margin: 0 auto;
  717. }
  718. &__header {
  719. flex-shrink: 0;
  720. margin-top: 4px;
  721. }
  722. &__badge {
  723. display: none;
  724. align-items: center;
  725. gap: 6px;
  726. padding: 6px 12px;
  727. margin-bottom: 24px;
  728. font-size: 13px;
  729. font-weight: 500;
  730. color: #fff;
  731. letter-spacing: 0.04em;
  732. background: rgba(255, 255, 255, 0.1);
  733. border: 1px solid rgba(255, 255, 255, 0.12);
  734. border-radius: 999px;
  735. box-shadow: none;
  736. }
  737. &__title {
  738. margin: 0 0 16px;
  739. font-size: 36px;
  740. font-weight: 700;
  741. line-height: 1.18;
  742. letter-spacing: -0.02em;
  743. color: #fff;
  744. text-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  745. }
  746. &__subtitle {
  747. max-width: 430px;
  748. margin: 0;
  749. font-size: 15px;
  750. font-weight: 500;
  751. line-height: 1.8;
  752. color: rgba(219, 234, 254, 0.92);
  753. }
  754. &__visual {
  755. display: flex;
  756. flex: 1 1 auto;
  757. align-items: center;
  758. justify-content: center;
  759. min-height: 60px;
  760. max-height: 200px;
  761. padding: 4px 0;
  762. }
  763. &__features {
  764. display: flex;
  765. flex-shrink: 0;
  766. flex-direction: column;
  767. gap: 18px;
  768. padding-bottom: 0;
  769. }
  770. &__footer {
  771. flex-shrink: 0;
  772. padding: 12px 0 0;
  773. }
  774. &__footer-line {
  775. margin: 0;
  776. font-size: 12px;
  777. line-height: 1.8;
  778. color: rgba(255, 255, 255, 0.5);
  779. }
  780. }
  781. .device-illustration {
  782. position: relative;
  783. width: 100%;
  784. max-width: 340px;
  785. aspect-ratio: 1 / 1;
  786. &__screen-shell {
  787. position: absolute;
  788. top: 50%;
  789. left: 50%;
  790. display: flex;
  791. flex-direction: column;
  792. width: 280px;
  793. height: 180px;
  794. padding: 20px;
  795. background: rgba(255, 255, 255, 0.1);
  796. border: 2px solid rgba(255, 255, 255, 0.2);
  797. border-radius: 18px;
  798. box-shadow: 0 24px 54px rgba(7, 24, 66, 0.24);
  799. backdrop-filter: blur(14px);
  800. transform: translate(-50%, -50%);
  801. }
  802. &__screen-dots {
  803. display: flex;
  804. gap: 8px;
  805. margin-bottom: 16px;
  806. span {
  807. width: 10px;
  808. height: 10px;
  809. background: rgba(255, 255, 255, 0.3);
  810. border-radius: 999px;
  811. }
  812. }
  813. &__screen-body {
  814. display: flex;
  815. flex: 1;
  816. flex-direction: column;
  817. gap: 10px;
  818. padding: 14px;
  819. background: rgba(255, 255, 255, 0.05);
  820. border: 1px solid rgba(255, 255, 255, 0.1);
  821. border-radius: 12px;
  822. }
  823. &__line {
  824. height: 10px;
  825. background: rgba(255, 255, 255, 0.2);
  826. border-radius: 999px;
  827. &--lg {
  828. width: 75%;
  829. }
  830. &--md {
  831. width: 50%;
  832. }
  833. }
  834. &__chart {
  835. display: flex;
  836. gap: 8px;
  837. align-items: center;
  838. justify-content: center;
  839. width: 100%;
  840. height: 54px;
  841. margin-top: auto;
  842. background: rgba(255, 255, 255, 0.1);
  843. border: 1px solid rgba(255, 255, 255, 0.1);
  844. border-radius: 10px;
  845. span {
  846. width: 16px;
  847. height: 16px;
  848. background: rgba(96, 165, 250, 0.5);
  849. border-radius: 4px;
  850. }
  851. }
  852. &__stand {
  853. position: absolute;
  854. bottom: calc(50% - 126px);
  855. left: 50%;
  856. width: 96px;
  857. height: 24px;
  858. background: rgba(255, 255, 255, 0.1);
  859. backdrop-filter: blur(12px);
  860. transform: translateX(-50%);
  861. &::before {
  862. content: '';
  863. position: absolute;
  864. bottom: -10px;
  865. left: 50%;
  866. width: 144px;
  867. height: 8px;
  868. background: rgba(255, 255, 255, 0.2);
  869. border-radius: 999px;
  870. filter: blur(2px);
  871. transform: translateX(-50%);
  872. }
  873. }
  874. &__shadow {
  875. position: absolute;
  876. inset: auto 22px 42px;
  877. height: 110px;
  878. background: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 72%);
  879. filter: blur(22px);
  880. }
  881. }
  882. .floating-card {
  883. position: absolute;
  884. z-index: 2;
  885. display: flex;
  886. gap: 12px;
  887. align-items: center;
  888. padding: 16px;
  889. color: #165dff;
  890. background: #fff;
  891. border-radius: 16px;
  892. box-shadow: 0 18px 36px rgba(10, 22, 70, 0.18);
  893. &--left {
  894. top: 25%;
  895. left: -40px;
  896. animation: float-bounce-left 4s infinite;
  897. }
  898. &--right {
  899. right: -48px;
  900. bottom: 32%;
  901. animation: float-bounce-right 5s infinite 0.5s;
  902. }
  903. &__icon {
  904. display: flex;
  905. align-items: center;
  906. justify-content: center;
  907. width: 36px;
  908. height: 36px;
  909. font-size: 20px;
  910. color: #165dff;
  911. background: #eff6ff;
  912. border-radius: 12px;
  913. &--indigo {
  914. color: #4f46e5;
  915. background: #eef2ff;
  916. }
  917. }
  918. &__label {
  919. margin-bottom: 2px;
  920. font-size: 12px;
  921. font-weight: 500;
  922. color: #6b7280;
  923. }
  924. &__title {
  925. font-size: 14px;
  926. font-weight: 700;
  927. color: #111827;
  928. }
  929. }
  930. .feature-item {
  931. display: flex;
  932. gap: 16px;
  933. align-items: flex-start;
  934. &__icon {
  935. display: flex;
  936. align-items: center;
  937. justify-content: center;
  938. flex-shrink: 0;
  939. width: 48px;
  940. height: 48px;
  941. font-size: 24px;
  942. color: #fff;
  943. background: rgba(255, 255, 255, 0.1);
  944. border: 1px solid rgba(255, 255, 255, 0.1);
  945. border-radius: 14px;
  946. box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  947. }
  948. &__title {
  949. margin: 0 0 4px;
  950. font-size: 16px;
  951. font-weight: 600;
  952. letter-spacing: 0.02em;
  953. color: #fff;
  954. }
  955. &__desc {
  956. max-width: 320px;
  957. margin: 0;
  958. font-size: 14px;
  959. line-height: 1.7;
  960. color: rgba(219, 234, 254, 0.82);
  961. }
  962. }
  963. .right-pane {
  964. position: relative;
  965. z-index: 10;
  966. display: flex;
  967. flex: 1;
  968. align-items: center;
  969. justify-content: center;
  970. padding: 24px;
  971. background: transparent;
  972. box-sizing: border-box;
  973. min-height: 0;
  974. overflow: visible;
  975. &__curve {
  976. position: absolute;
  977. top: 0;
  978. left: 0;
  979. z-index: 0;
  980. display: none;
  981. width: 120px;
  982. height: 100%;
  983. color: #f4f7f9;
  984. transform: translateX(-99%);
  985. pointer-events: none;
  986. }
  987. &__scroll {
  988. position: relative;
  989. z-index: 1;
  990. display: flex;
  991. flex: 1;
  992. align-items: center;
  993. justify-content: center;
  994. height: 100%;
  995. min-height: 0;
  996. overflow-y: auto;
  997. overflow-x: visible;
  998. scrollbar-width: none;
  999. &::-webkit-scrollbar {
  1000. width: 0;
  1001. height: 0;
  1002. }
  1003. }
  1004. }
  1005. .auth-card {
  1006. position: relative;
  1007. z-index: 10;
  1008. width: 100%;
  1009. max-width: 540px;
  1010. padding: 16px;
  1011. margin: auto 0;
  1012. background: #fff;
  1013. border: 1px solid #f3f4f6;
  1014. border-radius: 18px;
  1015. box-shadow: 0 8px 40px -12px rgba(0, 0, 0, 0.08);
  1016. &__header {
  1017. margin-bottom: 14px;
  1018. }
  1019. &__eyebrow {
  1020. display: inline-block;
  1021. padding: 1px 8px;
  1022. margin-bottom: 6px;
  1023. font-size: 11px;
  1024. line-height: 18px;
  1025. font-weight: 700;
  1026. letter-spacing: 0.04em;
  1027. color: #2563eb;
  1028. background: #eff6ff;
  1029. border: 1px solid #dbeafe;
  1030. border-radius: 6px;
  1031. }
  1032. &__title {
  1033. margin: 0 0 4px;
  1034. font-size: 20px;
  1035. font-weight: 700;
  1036. letter-spacing: -0.02em;
  1037. color: #111827;
  1038. }
  1039. &__warning {
  1040. padding: 10px 12px;
  1041. margin-bottom: 8px;
  1042. font-size: 13px;
  1043. font-weight: 700;
  1044. line-height: 1.6;
  1045. color: #b91c1c;
  1046. background: #fef2f2;
  1047. border: 1px solid #fecaca;
  1048. border-radius: 10px;
  1049. }
  1050. &__steps {
  1051. display: grid;
  1052. grid-template-columns: 1fr;
  1053. gap: 6px;
  1054. margin-bottom: 10px;
  1055. }
  1056. &__section {
  1057. margin-bottom: 8px;
  1058. }
  1059. &__section-head {
  1060. display: flex;
  1061. justify-content: space-between;
  1062. gap: 8px;
  1063. align-items: baseline;
  1064. margin-bottom: 3px;
  1065. }
  1066. &__section-title {
  1067. margin: 0;
  1068. font-size: 16px;
  1069. font-weight: 700;
  1070. color: #111827;
  1071. }
  1072. &__section-tip {
  1073. font-size: 12px;
  1074. font-weight: 500;
  1075. color: #9ca3af;
  1076. }
  1077. // 卡片底部的服务地址入口:绑错地址时唯一的自救通道
  1078. &__server {
  1079. display: flex;
  1080. gap: 6px;
  1081. align-items: center;
  1082. padding-top: 12px;
  1083. margin-top: 16px;
  1084. font-size: 12px;
  1085. line-height: 1.6;
  1086. color: #9ca3af;
  1087. border-top: 1px solid #f3f4f6;
  1088. }
  1089. &__server-label {
  1090. flex: none;
  1091. }
  1092. &__server-value {
  1093. flex: 1;
  1094. min-width: 0;
  1095. overflow: hidden;
  1096. color: #6b7280;
  1097. text-overflow: ellipsis;
  1098. white-space: nowrap;
  1099. }
  1100. &__server-action {
  1101. flex: none;
  1102. height: auto;
  1103. padding: 0 4px;
  1104. font-size: 12px;
  1105. }
  1106. }
  1107. // ---------- 服务地址卡片(未绑定 / 上次地址连不通) ----------
  1108. .auth-card.auth-card--server {
  1109. max-width: 560px;
  1110. .auth-card__header {
  1111. margin-bottom: 22px;
  1112. }
  1113. }
  1114. .auth-card__server-foot {
  1115. display: flex;
  1116. gap: 8px;
  1117. align-items: center;
  1118. justify-content: space-between;
  1119. padding-top: 14px;
  1120. margin-top: 18px;
  1121. border-top: 1px solid #f3f4f6;
  1122. }
  1123. .auth-card__server-tip {
  1124. font-size: 12px;
  1125. line-height: 1.6;
  1126. color: #9ca3af;
  1127. }
  1128. .auth-card__server-back-btn {
  1129. flex: none;
  1130. height: auto;
  1131. padding: 0 4px;
  1132. font-size: 12px;
  1133. }
  1134. // ---------- 登录卡片(设备已授权、但未登录) ----------
  1135. // 用 .auth-card.auth-card--login 提权,压住后面媒体查询里的 .auth-card 规则
  1136. .auth-card.auth-card--login {
  1137. max-width: 480px;
  1138. .auth-card__header {
  1139. margin-bottom: 18px;
  1140. }
  1141. }
  1142. .license-summary {
  1143. padding: 12px 14px;
  1144. margin-bottom: 20px;
  1145. background: #f8fafc;
  1146. border: 1px solid #e5e7eb;
  1147. border-radius: 12px;
  1148. &__head {
  1149. display: flex;
  1150. gap: 6px;
  1151. align-items: center;
  1152. margin-bottom: 9px;
  1153. font-size: 11px;
  1154. font-weight: 700;
  1155. letter-spacing: 0.04em;
  1156. color: #6b7280;
  1157. }
  1158. &__list {
  1159. display: grid;
  1160. gap: 7px;
  1161. margin: 0;
  1162. }
  1163. &__row {
  1164. display: flex;
  1165. gap: 12px;
  1166. align-items: baseline;
  1167. font-size: 12.5px;
  1168. line-height: 1.5;
  1169. dt {
  1170. flex: none;
  1171. width: 58px;
  1172. color: #9ca3af;
  1173. }
  1174. dd {
  1175. margin: 0;
  1176. font-weight: 600;
  1177. color: #374151;
  1178. word-break: break-all;
  1179. }
  1180. }
  1181. }
  1182. .login-form {
  1183. .ant-form-item {
  1184. margin-bottom: 16px;
  1185. }
  1186. &__label {
  1187. display: block;
  1188. margin-bottom: 7px;
  1189. font-size: 12.5px;
  1190. font-weight: 500;
  1191. color: #4b5563;
  1192. cursor: pointer;
  1193. }
  1194. .ant-input,
  1195. .ant-input-affix-wrapper {
  1196. height: 42px;
  1197. padding: 0 12px;
  1198. font-size: 13.5px;
  1199. color: #111827;
  1200. background: #fff;
  1201. border: 1px solid #d1d5db;
  1202. border-radius: 9px;
  1203. box-shadow: none;
  1204. transition:
  1205. border-color 0.18s ease-out,
  1206. box-shadow 0.18s ease-out;
  1207. &::placeholder {
  1208. color: #9ca3af;
  1209. }
  1210. &:hover {
  1211. border-color: #93c5fd;
  1212. }
  1213. &:focus,
  1214. &:focus-within,
  1215. &-focused {
  1216. border-color: #165dff;
  1217. box-shadow: 0 0 0 3px rgb(22 93 255 / 12%);
  1218. }
  1219. }
  1220. // 外壳与内层 input 叠加会重复画边框,这里抹平
  1221. .ant-input-affix-wrapper > .ant-input {
  1222. height: auto;
  1223. padding: 0;
  1224. color: inherit;
  1225. background: transparent;
  1226. border: 0;
  1227. border-radius: 0;
  1228. box-shadow: none;
  1229. &:hover,
  1230. &:focus {
  1231. background: transparent;
  1232. border: 0;
  1233. box-shadow: none;
  1234. }
  1235. }
  1236. .ant-input-clear-icon,
  1237. .ant-input-suffix .anticon {
  1238. color: #9ca3af;
  1239. &:hover {
  1240. color: #6b7280;
  1241. }
  1242. }
  1243. .ant-form-item-explain-error {
  1244. padding-top: 3px;
  1245. font-size: 12px;
  1246. }
  1247. &__submit {
  1248. &.ant-btn {
  1249. height: 44px;
  1250. padding: 0 18px;
  1251. margin-top: 4px;
  1252. font-size: 14px;
  1253. font-weight: 600;
  1254. border-radius: 9px;
  1255. box-shadow: none;
  1256. }
  1257. &.ant-btn.ant-btn-primary {
  1258. color: #fff;
  1259. background: #165dff;
  1260. border-color: #165dff;
  1261. &:hover:not([disabled]) {
  1262. background: #0f56f0;
  1263. border-color: #0f56f0;
  1264. box-shadow: 0 10px 22px -10px rgb(22 93 255 / 60%);
  1265. }
  1266. }
  1267. }
  1268. &__tip {
  1269. margin: 14px 0 0;
  1270. font-size: 12px;
  1271. line-height: 1.6;
  1272. color: #9ca3af;
  1273. text-align: center;
  1274. }
  1275. }
  1276. .step-card {
  1277. position: relative;
  1278. padding: 8px;
  1279. background: #f8fafc;
  1280. border: 1px solid #f3f4f6;
  1281. border-radius: 10px;
  1282. transition:
  1283. background-color 0.2s ease,
  1284. border-color 0.2s ease,
  1285. transform 0.2s ease;
  1286. &:hover {
  1287. background: rgba(239, 246, 255, 0.6);
  1288. border-color: #bfdbfe;
  1289. transform: translateY(-1px);
  1290. .step-card__index {
  1291. transform: scale(1.1);
  1292. }
  1293. }
  1294. &__index {
  1295. display: flex;
  1296. align-items: center;
  1297. justify-content: center;
  1298. width: 18px;
  1299. height: 18px;
  1300. margin-bottom: 4px;
  1301. font-size: 9px;
  1302. font-weight: 700;
  1303. color: #fff;
  1304. background: #2563eb;
  1305. border-radius: 999px;
  1306. box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  1307. transition: transform 0.2s ease;
  1308. }
  1309. &__title {
  1310. margin: 0 0 2px;
  1311. font-size: 13px;
  1312. font-weight: 700;
  1313. color: #111827;
  1314. }
  1315. &__desc {
  1316. margin: 0;
  1317. font-size: 12px;
  1318. line-height: 1.45;
  1319. color: #6b7280;
  1320. }
  1321. &__arrow {
  1322. position: absolute;
  1323. top: 18px;
  1324. right: -10px;
  1325. z-index: 10;
  1326. display: none;
  1327. font-size: 14px;
  1328. color: #d1d5db;
  1329. }
  1330. }
  1331. .machine-panel,
  1332. .upload-panel {
  1333. padding: 7px;
  1334. background: #f8fafc;
  1335. border: 1px solid #e5e7eb;
  1336. border-radius: 10px;
  1337. box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  1338. }
  1339. .machine-panel {
  1340. &__value {
  1341. min-height: 40px;
  1342. margin-bottom: 6px;
  1343. padding: 7px 9px;
  1344. font-family: Consolas, 'Courier New', monospace;
  1345. font-size: 12px;
  1346. line-height: 1.5;
  1347. color: #4b5563;
  1348. word-break: break-all;
  1349. background: #fff;
  1350. border: 1px solid #e5e7eb;
  1351. border-radius: 8px;
  1352. box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  1353. }
  1354. &__actions {
  1355. display: flex;
  1356. justify-content: flex-end;
  1357. gap: 4px;
  1358. }
  1359. }
  1360. .upload-panel {
  1361. // 原生 file 控件只用于触发选择,视觉上完全由下方 dropzone 承担。
  1362. // 注意:选择器必须挂在 .upload-panel 下(曾经误挂在 .auth-card 里,
  1363. // 编译成 .auth-card__file-input 永远匹配不到,导致原生控件裸露在页面上)。
  1364. &__file-input {
  1365. display: none;
  1366. }
  1367. &__dropzone {
  1368. display: flex;
  1369. flex-direction: column;
  1370. align-items: center;
  1371. justify-content: center;
  1372. gap: 2px;
  1373. min-height: 64px;
  1374. padding: 8px;
  1375. margin-bottom: 6px;
  1376. text-align: center;
  1377. cursor: pointer;
  1378. background: #fff;
  1379. border: 2px dashed #d1d5db;
  1380. border-radius: 8px;
  1381. transition:
  1382. background-color 0.2s ease,
  1383. border-color 0.2s ease,
  1384. transform 0.2s ease;
  1385. &:hover {
  1386. background: rgba(239, 246, 255, 0.6);
  1387. border-color: #93c5fd;
  1388. .upload-panel__dropzone-icon {
  1389. transform: scale(1.1);
  1390. }
  1391. .upload-panel__dropzone-text {
  1392. color: #3b82f6;
  1393. }
  1394. }
  1395. }
  1396. &__dropzone-icon {
  1397. font-size: 18px;
  1398. color: #3b82f6;
  1399. transition: transform 0.2s ease;
  1400. }
  1401. &__dropzone-text {
  1402. font-size: 12px;
  1403. font-weight: 500;
  1404. line-height: 1.45;
  1405. color: #9ca3af;
  1406. word-break: break-all;
  1407. transition: color 0.2s ease;
  1408. }
  1409. // 已选中文件:实线蓝框 + 文件名高亮,给出明确的选中反馈
  1410. &__dropzone--has-file {
  1411. background: #f8fbff;
  1412. border-color: #93c5fd;
  1413. border-style: solid;
  1414. .upload-panel__dropzone-text {
  1415. font-weight: 600;
  1416. color: #2563eb;
  1417. }
  1418. }
  1419. &__actions {
  1420. display: flex;
  1421. justify-content: flex-end;
  1422. gap: 4px;
  1423. }
  1424. }
  1425. .ui-btn {
  1426. display: inline-flex;
  1427. gap: 4px;
  1428. align-items: center;
  1429. justify-content: center;
  1430. height: auto;
  1431. padding: 4px 9px;
  1432. font-size: 12px;
  1433. font-weight: 500;
  1434. border-radius: 8px;
  1435. transition:
  1436. background-color 0.2s ease,
  1437. border-color 0.2s ease,
  1438. color 0.2s ease,
  1439. box-shadow 0.2s ease,
  1440. transform 0.2s ease;
  1441. &.ant-btn {
  1442. box-shadow: none;
  1443. }
  1444. &.ant-btn > span {
  1445. display: inline-flex;
  1446. gap: 4px;
  1447. align-items: center;
  1448. }
  1449. &:active {
  1450. transform: scale(0.99);
  1451. }
  1452. &--ghost {
  1453. color: #374151;
  1454. background: #fff;
  1455. border-color: #d1d5db;
  1456. box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  1457. &:hover,
  1458. &:focus {
  1459. color: #374151;
  1460. background: #f9fafb;
  1461. border-color: #d1d5db;
  1462. }
  1463. }
  1464. &--primary {
  1465. color: #fff;
  1466. background: #165dff;
  1467. border-color: #165dff;
  1468. box-shadow: 0 6px 18px rgba(22, 93, 255, 0.28);
  1469. &:hover,
  1470. &:focus,
  1471. &.ant-btn-primary:hover,
  1472. &.ant-btn-primary:focus {
  1473. color: #fff;
  1474. background: #0f56f0;
  1475. border-color: #0f56f0;
  1476. }
  1477. &.ant-btn-primary,
  1478. &.ant-btn-color-primary,
  1479. &.ant-btn-variant-solid {
  1480. color: #fff;
  1481. background: #165dff;
  1482. border-color: #165dff;
  1483. }
  1484. &.ant-btn-primary:disabled,
  1485. &.ant-btn-primary[disabled],
  1486. &.ant-btn-color-primary:disabled,
  1487. &.ant-btn-color-primary[disabled],
  1488. &.ant-btn-variant-solid:disabled,
  1489. &.ant-btn-variant-solid[disabled] {
  1490. color: rgba(255, 255, 255, 0.88);
  1491. background: rgba(22, 93, 255, 0.55);
  1492. border-color: rgba(22, 93, 255, 0.55);
  1493. box-shadow: none;
  1494. opacity: 1;
  1495. }
  1496. }
  1497. }
  1498. @keyframes float-bounce-left {
  1499. 0%,
  1500. 100% {
  1501. transform: translate3d(0, 0, 0);
  1502. }
  1503. 50% {
  1504. transform: translate3d(0, -12px, 0);
  1505. }
  1506. }
  1507. @keyframes float-bounce-right {
  1508. 0%,
  1509. 100% {
  1510. transform: translate3d(0, 0, 0);
  1511. }
  1512. 50% {
  1513. transform: translate3d(0, -10px, 0);
  1514. }
  1515. }
  1516. }
  1517. @media screen and (min-width: 992px) {
  1518. .@{prefix-cls} {
  1519. .auth-card {
  1520. padding: 40px;
  1521. }
  1522. }
  1523. }
  1524. @media screen and (min-width: 1280px) {
  1525. .@{prefix-cls} {
  1526. .left-pane {
  1527. display: flex;
  1528. }
  1529. .right-pane {
  1530. padding: 48px;
  1531. &__curve {
  1532. display: block;
  1533. }
  1534. }
  1535. .auth-card {
  1536. &__steps {
  1537. grid-template-columns: repeat(3, minmax(0, 1fr));
  1538. }
  1539. }
  1540. .step-card {
  1541. &__arrow {
  1542. display: block;
  1543. }
  1544. }
  1545. }
  1546. }
  1547. @media screen and (min-width: 1536px) {
  1548. .@{prefix-cls} {
  1549. .left-pane {
  1550. width: 45%;
  1551. padding: 56px;
  1552. &__title {
  1553. font-size: 42px;
  1554. }
  1555. &__subtitle {
  1556. font-size: 16px;
  1557. }
  1558. }
  1559. .right-pane__curve {
  1560. width: 160px;
  1561. }
  1562. .device-illustration {
  1563. max-width: 340px;
  1564. &__screen-shell {
  1565. width: 280px;
  1566. height: 180px;
  1567. }
  1568. }
  1569. .floating-card {
  1570. padding: 16px;
  1571. }
  1572. .feature-item {
  1573. &__icon {
  1574. width: 48px;
  1575. height: 48px;
  1576. font-size: 24px;
  1577. }
  1578. &__title {
  1579. font-size: 16px;
  1580. }
  1581. &__desc {
  1582. font-size: 14px;
  1583. }
  1584. }
  1585. }
  1586. }
  1587. @media screen and (max-width: 1279px) {
  1588. .@{prefix-cls} {
  1589. .left-pane {
  1590. display: none;
  1591. }
  1592. .right-pane {
  1593. align-items: center;
  1594. padding: 24px 20px;
  1595. }
  1596. .right-pane__scroll {
  1597. align-items: center;
  1598. }
  1599. .auth-card {
  1600. margin: auto 0;
  1601. }
  1602. }
  1603. }
  1604. @media screen and (max-width: 767px) {
  1605. .@{prefix-cls} {
  1606. .right-pane {
  1607. padding: 16px;
  1608. align-items: flex-start;
  1609. }
  1610. .right-pane__scroll {
  1611. align-items: flex-start;
  1612. }
  1613. .auth-card {
  1614. padding: 22px 18px;
  1615. margin: 0;
  1616. &__header {
  1617. margin-bottom: 24px;
  1618. }
  1619. &__section-head {
  1620. flex-direction: column;
  1621. align-items: flex-start;
  1622. }
  1623. }
  1624. .machine-panel__actions,
  1625. .upload-panel__actions {
  1626. flex-wrap: wrap;
  1627. }
  1628. .machine-panel__actions > *,
  1629. .upload-panel__actions > * {
  1630. flex: 1 1 calc(50% - 5px);
  1631. }
  1632. }
  1633. }
  1634. @media screen and (max-width: 1366px) and (min-width: 1280px) and (max-height: 768px) {
  1635. .@{prefix-cls} {
  1636. .left-pane {
  1637. width: 37%;
  1638. padding: 20px 24px 16px;
  1639. &__content {
  1640. max-width: 420px;
  1641. gap: 14px;
  1642. }
  1643. &__header {
  1644. margin-top: 2px;
  1645. }
  1646. &__badge {
  1647. margin-bottom: 14px;
  1648. padding: 5px 10px;
  1649. font-size: 12px;
  1650. }
  1651. &__title {
  1652. margin-bottom: 10px;
  1653. font-size: 28px;
  1654. line-height: 1.14;
  1655. }
  1656. &__subtitle {
  1657. max-width: 360px;
  1658. font-size: 13px;
  1659. line-height: 1.6;
  1660. }
  1661. &__visual {
  1662. min-height: 40px;
  1663. padding: 2px 0;
  1664. }
  1665. &__features {
  1666. gap: 10px;
  1667. padding-bottom: 0;
  1668. }
  1669. }
  1670. .device-illustration {
  1671. max-width: 236px;
  1672. &__screen-shell {
  1673. width: 208px;
  1674. height: 136px;
  1675. padding: 14px;
  1676. border-radius: 16px;
  1677. }
  1678. &__screen-dots {
  1679. gap: 6px;
  1680. margin-bottom: 12px;
  1681. span {
  1682. width: 8px;
  1683. height: 8px;
  1684. }
  1685. }
  1686. &__screen-body {
  1687. gap: 8px;
  1688. padding: 10px;
  1689. }
  1690. &__line {
  1691. height: 8px;
  1692. }
  1693. &__chart {
  1694. height: 40px;
  1695. span {
  1696. width: 13px;
  1697. height: 13px;
  1698. }
  1699. }
  1700. &__stand {
  1701. bottom: calc(50% - 94px);
  1702. width: 78px;
  1703. height: 18px;
  1704. &::before {
  1705. bottom: -8px;
  1706. width: 112px;
  1707. height: 6px;
  1708. }
  1709. }
  1710. &__shadow {
  1711. inset: auto 18px 32px;
  1712. height: 72px;
  1713. }
  1714. }
  1715. .floating-card {
  1716. gap: 10px;
  1717. padding: 10px 12px;
  1718. border-radius: 14px;
  1719. &--left {
  1720. top: 23%;
  1721. left: -12px;
  1722. }
  1723. &--right {
  1724. right: -16px;
  1725. bottom: 27%;
  1726. }
  1727. &__icon {
  1728. width: 30px;
  1729. height: 30px;
  1730. font-size: 16px;
  1731. border-radius: 10px;
  1732. }
  1733. &__label {
  1734. font-size: 10px;
  1735. }
  1736. &__title {
  1737. font-size: 13px;
  1738. }
  1739. }
  1740. .feature-item {
  1741. gap: 10px;
  1742. &__icon {
  1743. width: 36px;
  1744. height: 36px;
  1745. font-size: 18px;
  1746. border-radius: 12px;
  1747. }
  1748. &__title {
  1749. margin-bottom: 2px;
  1750. font-size: 14px;
  1751. }
  1752. &__desc {
  1753. max-width: 280px;
  1754. font-size: 12px;
  1755. line-height: 1.45;
  1756. }
  1757. }
  1758. .right-pane {
  1759. align-items: center;
  1760. padding: 14px 18px;
  1761. }
  1762. .right-pane__scroll {
  1763. align-items: center;
  1764. }
  1765. .auth-card {
  1766. max-width: 522px;
  1767. padding: 20px 20px 18px;
  1768. border-radius: 18px;
  1769. &__header {
  1770. margin-bottom: 18px;
  1771. }
  1772. &__eyebrow {
  1773. margin-bottom: 10px;
  1774. font-size: 11px;
  1775. }
  1776. &__title {
  1777. margin-bottom: 8px;
  1778. font-size: 18px;
  1779. }
  1780. &__steps {
  1781. gap: 8px;
  1782. margin-bottom: 18px;
  1783. }
  1784. &__section {
  1785. margin-bottom: 14px;
  1786. }
  1787. &__section-head {
  1788. margin-bottom: 6px;
  1789. }
  1790. &__section-title {
  1791. font-size: 13px;
  1792. }
  1793. &__section-tip {
  1794. font-size: 11px;
  1795. }
  1796. &__footer {
  1797. padding-top: 14px;
  1798. margin-top: 18px;
  1799. }
  1800. }
  1801. .step-card {
  1802. padding: 12px 10px;
  1803. border-radius: 12px;
  1804. &__index {
  1805. width: 22px;
  1806. height: 22px;
  1807. margin-bottom: 8px;
  1808. font-size: 10px;
  1809. }
  1810. &__title {
  1811. margin-bottom: 5px;
  1812. font-size: 12px;
  1813. }
  1814. &__desc {
  1815. font-size: 11px;
  1816. line-height: 1.5;
  1817. }
  1818. &__arrow {
  1819. top: 23px;
  1820. right: -7px;
  1821. font-size: 14px;
  1822. }
  1823. }
  1824. .machine-panel,
  1825. .upload-panel {
  1826. padding: 10px;
  1827. border-radius: 12px;
  1828. }
  1829. .machine-panel {
  1830. &__value {
  1831. min-height: 54px;
  1832. margin-bottom: 10px;
  1833. padding: 10px 12px;
  1834. font-size: 11px;
  1835. line-height: 1.6;
  1836. border-radius: 10px;
  1837. }
  1838. &__actions {
  1839. gap: 8px;
  1840. }
  1841. }
  1842. .upload-panel {
  1843. &__dropzone {
  1844. min-height: 84px;
  1845. padding: 12px;
  1846. margin-bottom: 10px;
  1847. }
  1848. &__dropzone-icon {
  1849. font-size: 22px;
  1850. }
  1851. &__dropzone-text {
  1852. font-size: 12px;
  1853. line-height: 1.5;
  1854. }
  1855. &__actions {
  1856. gap: 8px;
  1857. }
  1858. }
  1859. .ui-btn {
  1860. padding: 7px 14px;
  1861. font-size: 12px;
  1862. border-radius: 9px;
  1863. }
  1864. }
  1865. }
  1866. @media screen and (max-height: 860px) and (min-width: 1280px) {
  1867. .@{prefix-cls} {
  1868. .left-pane {
  1869. padding: 24px 32px 16px;
  1870. &__content {
  1871. gap: 18px;
  1872. }
  1873. &__title {
  1874. margin-bottom: 10px;
  1875. font-size: 30px;
  1876. }
  1877. &__subtitle {
  1878. font-size: 14px;
  1879. line-height: 1.6;
  1880. }
  1881. &__visual {
  1882. min-height: 80px;
  1883. padding: 4px 0;
  1884. }
  1885. &__features {
  1886. gap: 14px;
  1887. }
  1888. }
  1889. .device-illustration {
  1890. max-width: 290px;
  1891. &__screen-shell {
  1892. width: 244px;
  1893. height: 160px;
  1894. padding: 16px;
  1895. }
  1896. &__screen-body {
  1897. padding: 12px;
  1898. gap: 8px;
  1899. }
  1900. &__chart {
  1901. height: 48px;
  1902. }
  1903. }
  1904. .floating-card {
  1905. padding: 12px 14px;
  1906. &--left {
  1907. left: -22px;
  1908. }
  1909. &--right {
  1910. right: -28px;
  1911. }
  1912. }
  1913. .feature-item {
  1914. gap: 12px;
  1915. &__icon {
  1916. width: 42px;
  1917. height: 42px;
  1918. font-size: 20px;
  1919. }
  1920. &__title {
  1921. font-size: 15px;
  1922. }
  1923. &__desc {
  1924. font-size: 13px;
  1925. line-height: 1.6;
  1926. }
  1927. }
  1928. .right-pane {
  1929. align-items: flex-start;
  1930. padding-top: 18px;
  1931. padding-bottom: 18px;
  1932. }
  1933. .right-pane__scroll {
  1934. align-items: flex-start;
  1935. }
  1936. .auth-card {
  1937. padding: 26px 26px 22px;
  1938. }
  1939. .auth-card__steps {
  1940. margin-bottom: 28px;
  1941. }
  1942. .step-card {
  1943. padding: 14px;
  1944. }
  1945. }
  1946. }
  1947. // 窄窗口下左侧栏只有 ~470px,两张固定宽度的浮动卡片会压在设备图中间,
  1948. // 把设备图里的图表盖住。这里直接收起装饰卡片,保留设备示意本身。
  1949. @media screen and (max-width: 1439px) {
  1950. .@{prefix-cls} .floating-card {
  1951. display: none;
  1952. }
  1953. }
  1954. </style>