login.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <div class="appmian">
  3. <!-- <v-scale-screen width="1920" height="1080" style="margin: 0;"> -->
  4. <el-container>
  5. <el-header>
  6. <loginheader ref="loginheaderref" :name="headerobj.name" />
  7. </el-header>
  8. <el-main> </el-main>
  9. <div class="bgk3" v-show="bgk2false">
  10. <div class="bgk4"></div>
  11. <div class="bgk2">
  12. <div class="bjgg">
  13. <el-image :src="dtu" fit="contain"></el-image>
  14. <!-- 添加登录框 -->
  15. <div class="login-form-container">
  16. <div
  17. class="dialog_class bgcolor "
  18. style="width: 100%; height: 100%; padding: 20px 30px;"
  19. >
  20. <span >煤矿灾害态势推演系统</span>
  21. <el-form :model="form" label-width="60px" >
  22. <el-form-item label="用户名:" >
  23. <el-input
  24. v-model="loginform.username"
  25. placeholder="请输入用户名"
  26. ></el-input>
  27. </el-form-item>
  28. <el-form-item label="密码:" >
  29. <el-input
  30. v-model="loginform.password"
  31. placeholder="请输入密码"
  32. type="password"
  33. show-password
  34. ></el-input>
  35. </el-form-item>
  36. <div style="margin-top: 30px;">
  37. <el-button
  38. size="large"
  39. class="loginbtn"
  40. @click="login"
  41. style="width: 100%;"
  42. :loading="loading"
  43. :disabled="loading"
  44. >{{ loading ? '登录中...' : '登录' }}</el-button
  45. >
  46. </div>
  47. </el-form>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 底部按钮三个页面 -->
  54. </el-container>
  55. <!-- </v-scale-screen> -->
  56. </div>
  57. </template>
  58. <script setup>
  59. import { ref, onMounted, reactive, nextTick } from "vue"
  60. import { RouterView, RouterLink, useRouter } from "vue-router"
  61. import VScaleScreen from "v-scale-screen"
  62. import "@/utils/flexible"
  63. import { request,enPassword } from "@/utils/request"
  64. import logo from "@/assets/logo.png"
  65. import {
  66. ElMessage,
  67. ElButton,
  68. ElDialog,
  69. ElSelect,
  70. formEmits
  71. } from "element-plus"
  72. // import configurator from "./components/configurator.vue"
  73. import reheader from "@/components/header.vue"
  74. import loginheader from "@/components/loginheader.vue"
  75. import result from "./result.vue"
  76. import Vector from "@/assets/img/Vector.png"
  77. import s1 from "@/assets/img/s1.png"
  78. import dtu from "@/assets/img/Group1317.png"
  79. import s2 from "@/assets/img/s2.png"
  80. import s3 from "@/assets/img/s3.png"
  81. import s4 from "@/assets/img/s4.png"
  82. import b from "@/assets/img/Group1317.png"
  83. import { timestampToTime, formatTime } from "@/js/lindex.js"
  84. import emitter from "@/utils/emitter"
  85. import { getToken, setToken, setUserId,setLoginflag,getLoginflag } from "@/utils/token"
  86. import router from "@/router"
  87. // import { vtkmodel2 } from "@/control/vtkModel.js";
  88. let activeIndeximg = ref(null)
  89. let reheaderref = ref()
  90. let loginheaderref = ref()
  91. let lliudialog = ref()
  92. let sourcedis = ref()
  93. let classradio = ref()
  94. let boundary = ref()
  95. let tanimation = ref()
  96. let state = ref()
  97. let menumine = ref()
  98. let menusen = ref()
  99. let indexref = ref()
  100. let configuratorref = ref()
  101. let bkmodel = ref(false)
  102. let modelshow = ref(true)
  103. const title = "灾情推演软件"
  104. const activeIndex = ref("1")
  105. const activeIndex2 = ref("1")
  106. let titlefalse = ref(false)
  107. let headertime = ref({
  108. timing: null,
  109. loading: true,
  110. dateDay: null,
  111. dateYear: null,
  112. dateWeek: null,
  113. weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]
  114. })
  115. let bgk2false = ref(true)
  116. let headerobj = ref({
  117. time: "",
  118. name: ""
  119. })
  120. onMounted(() => {
  121. timeFn()
  122. // childfun();
  123. })
  124. // 登录相关
  125. let loginform = ref({
  126. username: "",
  127. password: "",
  128. captcha: "",
  129. })
  130. let loading = ref(false)
  131. const codeId = ref("") // 验证码ID
  132. const imageUrl = ref("") // 验证码图片 URL
  133. const login = () => {
  134. if (loginform.value.username == "" || loginform.value.username == undefined){
  135. ElMessage.error("用户名不能为空")
  136. return
  137. }
  138. if (loginform.value.password == "" || loginform.value.password == undefined){
  139. ElMessage.error("密码不能为空")
  140. return
  141. }
  142. loading.value = true
  143. const params = {
  144. transCode: "A00002",
  145. loginName: loginform.value.username,
  146. password: enPassword(loginform.value.password),
  147. type: "",
  148. }
  149. console.log(params)
  150. request(params)
  151. .then((res) => {
  152. setToken(res.clientToken)
  153. setUserId(res.userId)
  154. setLoginflag('1')
  155. console.log('loginflag:',getLoginflag())
  156. router.push({ path: "/" })
  157. })
  158. .catch((err) => {
  159. console.error('错误信息:',err);
  160. ElMessage.error(err.returnMsg);
  161. })
  162. .finally(() => {
  163. loading.value = false
  164. });
  165. }
  166. const register = () => {
  167. const params = {
  168. transCode: "A00003",
  169. userName: form.value.username,
  170. password: form.value.password,
  171. mailOrPhone: "123456",
  172. verificationCode: "",
  173. channel: "1"
  174. }
  175. request(params)
  176. .then((res) => {
  177. console.log(res)
  178. })
  179. .catch((err) => {
  180. ElMessage.error(err.returnMsg)
  181. })
  182. }
  183. const getcode = () => {
  184. }
  185. // 当前时间
  186. const timeFn = () => {
  187. headertime.value.timing = setInterval(() => {
  188. headertime.value.dateDay = formatTime(new Date(), "HH: mm: ss")
  189. headertime.value.dateYear = formatTime(new Date(), "yyyy-MM-dd")
  190. headertime.value.dateWeek = headertime.value.weekday[new Date().getDay()]
  191. }, 1000)
  192. }
  193. onUnmounted(() => {})
  194. </script>
  195. <style>
  196. @import "../../src/style/style.css";
  197. </style>
  198. <style lang="scss" scoped>
  199. .appmian {
  200. .el-main {
  201. --el-main-padding: 0px !important;
  202. }
  203. .el-container {
  204. padding: 0;
  205. margin: 0;
  206. width: 100%;
  207. position: absolute;
  208. z-index: 206;
  209. top: 0;
  210. background-image: url(../../src/assets/img/BJ.png) !important;
  211. background-size: 100% 100%;
  212. background-repeat: no-repeat;
  213. }
  214. }
  215. .ve_menu_logo {
  216. width: 100%;
  217. height: 70px;
  218. background: #0d1639;
  219. white-space: nowrap;
  220. text-align: left;
  221. overflow: hidden;
  222. display: flex;
  223. background: #0d1639;
  224. box-shadow: inset 0px 0px 17px 5px rgba(12, 97, 197, 0.2);
  225. border-radius: 0px 0px 0px 0px;
  226. border-bottom: 1px solid;
  227. box-sizing: border-box;
  228. border-image: linear-gradient(
  229. 28deg,
  230. rgba(31, 107, 255, 1),
  231. rgba(31, 107, 255, 0)
  232. )
  233. 1 1;
  234. .ve_title {
  235. }
  236. .ve_logo_img {
  237. padding-left: 30px;
  238. padding-right: 30px;
  239. display: inline-block;
  240. box-sizing: border-box;
  241. vertical-align: middle;
  242. padding: 15px;
  243. }
  244. .ve_logo_title {
  245. width: 160px;
  246. white-space: nowrap;
  247. overflow: hidden;
  248. text-overflow: ellipsis;
  249. display: inline-block;
  250. margin: 0;
  251. vertical-align: middle;
  252. color: #68adff;
  253. font-size: 20px;
  254. }
  255. .el-menu-demo {
  256. width: 60% !important;
  257. height: 70px;
  258. border: none !important;
  259. background: rgba(12, 97, 197, 0);
  260. .el-menu-item {
  261. position: relative;
  262. width: 97px;
  263. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  264. font-weight: bold;
  265. font-size: 13px;
  266. color: #68adff;
  267. line-height: 15px;
  268. text-align: center;
  269. font-style: normal;
  270. text-transform: none;
  271. width: 110px;
  272. height: 70px;
  273. border-radius: 0px 0px 0px 0px;
  274. border: none;
  275. }
  276. .is-active {
  277. width: 110px;
  278. height: 70px;
  279. background: radial-gradient(
  280. ellipse at 54px 0px,
  281. #3aa0ff -37%,
  282. #123066 53%
  283. );
  284. border-radius: 0px 0px 0px 0px;
  285. border: 1px solid;
  286. border-left: 1px solid rgba(16, 92, 240, 1);
  287. border-right: 1px solid rgba(18, 48, 102, 1);
  288. border-image: linear-gradient(
  289. 347deg,
  290. rgba(16, 92, 240, 1),
  291. rgba(18, 48, 102, 1)
  292. )
  293. 1 1;
  294. &:after {
  295. width: 24px;
  296. height: 1px;
  297. background-color: #fff;
  298. -webkit-transition: all ease-out 0.2s;
  299. transition: all ease-out 0.2s;
  300. content: "";
  301. position: absolute;
  302. left: 50%;
  303. bottom: 15px;
  304. webkit-transform: translate(-50%, 0%);
  305. -moz-transform: translate(-50%, 0%);
  306. transform: translate(-50%, 0%);
  307. }
  308. }
  309. }
  310. .ve_right {
  311. // width: 350px;
  312. height: 70px;
  313. overflow: hidden;
  314. position: absolute;
  315. right: 0;
  316. display: flex;
  317. .ve_time {
  318. width: 190px;
  319. height: 55px;
  320. padding-top: 15px;
  321. height: 70px;
  322. overflow: hidden;
  323. border-radius: 0px 0px 0px 0px;
  324. border-left: 2px solid rgba(12, 97, 197, 0.2);
  325. border-right: 2px solid rgba(12, 97, 197, 0.2);
  326. box-sizing: border-box;
  327. padding: 15px 5px;
  328. // border-image: linear-gradient(347deg, rgba(31, 107, 255, 1), rgba(164, 195, 255, 1)) 1 1;
  329. span {
  330. display: block;
  331. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  332. color: #ffffff;
  333. text-align: center;
  334. font-style: normal;
  335. text-transform: none;
  336. }
  337. .l_huoqing {
  338. font-size: 13px;
  339. line-height: 15px;
  340. font-weight: bold;
  341. line-height: 2;
  342. white-space: nowrap;
  343. overflow: hidden;
  344. text-overflow: ellipsis;
  345. }
  346. .l_time {
  347. font-size: 12px;
  348. line-height: 14px;
  349. font-weight: 400;
  350. }
  351. }
  352. .ve_timeioc {
  353. width: 150px;
  354. height: 70px;
  355. // border-radius: 0px 0px 0px 0px;
  356. // border: 1px solid;
  357. // border-image: linear-gradient(347deg, rgba(16, 92, 240, 1), rgba(164, 195, 255, 1)) 1 1;
  358. font-family: Microsoft YaHei UI, Microsoft YaHei UI;
  359. font-weight: bold;
  360. font-size: 13px;
  361. color: #68adff;
  362. line-height: 15px;
  363. text-align: center;
  364. font-style: normal;
  365. text-transform: none;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. span {
  370. padding-left: 15px;
  371. }
  372. }
  373. }
  374. }
  375. .login-form-container {
  376. position: absolute;
  377. width: 400px;
  378. height: 280px; /* 增加高度以容纳表单元素 */
  379. top: 45%;
  380. left: 50%;
  381. transform: translate(-50%, -50%); /* 将登录框居中 */
  382. background-color: rgba(255, 255, 255, 0.85); /* 轻微透明背景 */
  383. border-radius: 12px; /* 圆角效果 */
  384. box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15); /* 更柔和的阴影 */
  385. backdrop-filter: blur(10px); /* 给背景加个模糊效果 */
  386. display: flex;
  387. flex-direction: column;
  388. justify-content: space-between;
  389. }
  390. .login-form-container .el-form-item {
  391. margin-bottom: 20px ; /* 增加表单项之间的间距 */
  392. }
  393. .login-form-container .el-form-item__label {
  394. color: #fff; /* 表单项标签颜色 */
  395. font-size: 16px; /* 表单项标签字体大小 */
  396. font-weight: bold; /* 表单项标签字体粗细 */
  397. }
  398. .loginbtn {
  399. width: 100%;
  400. background-color: rgba(61, 219, 252, 0.20) !important;
  401. box-sizing: border-box;
  402. border: none;
  403. border-radius: 8px; /* 圆角按钮 */
  404. padding: 12px; /* 增加按钮内边距 */
  405. font-size: 16px;
  406. font-weight: bold; /* 增加字体粗细 */
  407. transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s; /* 平滑过渡 */
  408. }
  409. .loginbtn:hover {
  410. background-color: rgba(61, 219, 252, 0.35); /* 鼠标悬停时背景色变深 */
  411. transform: scale(1.05); /* 鼠标悬停时轻微放大按钮 */
  412. box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2); /* 鼠标悬停时增加按钮的阴影 */
  413. }
  414. .loginbtn:disabled {
  415. background-color: rgba(61, 219, 252, 0.10) !important; /* 禁用时的按钮背景色 */
  416. cursor: not-allowed; /* 禁用时鼠标样式 */
  417. }
  418. /* 为标题添加样式 */
  419. .login-form-container span {
  420. font-size: 20px;
  421. font-weight: bold;
  422. color: #2c3e50;
  423. display: block;
  424. text-align: center;
  425. margin-bottom: 20px; /* 上下间距 */
  426. padding: 10px;
  427. color: white;
  428. border-radius: 5px;
  429. box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
  430. font-family: 'Arial', sans-serif;
  431. }
  432. </style>
  433. <style>
  434. .vtkmodel1 {
  435. position: absolute;
  436. z-index: 100;
  437. width: 100%;
  438. height: 100vh;
  439. }
  440. body {
  441. width: 100%;
  442. height: 100vh;
  443. background: #161a2a;
  444. /* background:#b2bac7; */
  445. }
  446. button:focus,
  447. button:focus-visible {
  448. outline: none;
  449. }
  450. .l_Dialog {
  451. position: relative;
  452. }
  453. .main-conyeny {
  454. position: absolute;
  455. z-index: 206;
  456. top: 70px;
  457. }
  458. .L_aside {
  459. margin-top: 10px;
  460. overflow: hidden;
  461. }
  462. </style>