Login.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <script setup>
  2. import {
  3. useRoute,
  4. useRouter
  5. }
  6. from 'vue-router';
  7. import BgLayout from '@/views/Login/components/BgLayout.vue'
  8. import {
  9. ElMessage,
  10. } from 'element-plus';
  11. import {
  12. Store
  13. } from '@/store/index'
  14. store = Store()
  15. import zhnylogin from '@/assets/video/zhnylogin.mp4'
  16. let route = undefined;
  17. let router = undefined;
  18. </script>
  19. <template>
  20. <div class="login-container">
  21. <bg-layout :list="bgList"></bg-layout>
  22. <div class="logoinTop"></div>
  23. <!-- 页面底部 -->
  24. <div class="loginBottom">
  25. <p>技术支持:山东金田集团CIM事业部</p>
  26. <!-- <p>地址:济南市历城区唐冶西路888号东八区企业公馆A21楼</p> -->
  27. <!-- <p>建议使用<a href="downLoad/360csex_setup.exe">360极速浏览器</a>在1920*1080及以上分辨率下查看</p> -->
  28. <p>copyright©2022 金田产业发展(山东)集团有限公司 All Right Reserved</p>
  29. </div>
  30. <!-- 登录框 -->
  31. <div class="loginbox">
  32. <div class="loginbox-title">
  33. 用户登录
  34. </div>
  35. <div class="loginbox-input">
  36. <span class='iconfont icon-yonghu'></span>
  37. <el-input v-model="loginForm.username" type="text" clearable placeholder="请输入用户名" />
  38. </div>
  39. <div class="loginbox-input">
  40. <span class='iconfont icon-mima1'></span>
  41. <el-input v-model="loginForm.password" type="password" clearable show-password placeholder="请输入密码"
  42. @keyup.enter="onLoginClick" />
  43. </div>
  44. <div class="loginbox-checkbox">
  45. <span>
  46. <!-- <input id="sfjzzh" type="checkbox" title="记住账号" :checked="loginForm.remember" @click="remeberPerson"
  47. @keyup.enter="onLoginClick" /> -->
  48. <el-switch change="remeberPerson" @keyup.enter="onLoginClick" width="40rem" size="default"
  49. v-model="loginForm.remember"></el-switch>
  50. 记住账号密码
  51. </span>
  52. </div>
  53. <div class="loginbox-btn" @click="onLoginClick">
  54. <div :class="disabled?'disabled':''">登录</div>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. let store = undefined;
  61. export default {
  62. /* 数据 */
  63. data() {
  64. return {
  65. loginForm: {
  66. username: '',
  67. account: '', //账号
  68. password: '', //密码,
  69. remember: true, //记住密码,
  70. },
  71. disabled: false, //控制鼠标样式
  72. // 背景图片列表
  73. bgList: [
  74. zhnylogin
  75. ],
  76. }
  77. },
  78. /* 方法 */
  79. methods: {
  80. //记住账号密码,true设置本地存储,否则不设置
  81. remeberPerson() {
  82. this.loginForm.remember = !this.loginForm.remember
  83. },
  84. //登录按钮
  85. onLoginClick() {
  86. this.disabled = true //修改鼠标样式
  87. this.storageAndgoTo()
  88. //需要修改,像数据库发送账号密码,根据返回值判断
  89. // let password = this.$md5(this.loginForm.password)
  90. // this.$http.get('/getTableList', {
  91. // tableName: 'base_sys_user',
  92. // sqlWhere: "username = '" + this.loginForm.username + "' and password = '" + password + "'",
  93. // orderByField: ''
  94. // }).then(res => {
  95. // if (res.data.length > 0) {
  96. // this.loginForm.id = res.data[0].id
  97. // store.realName = res.data[0].name;
  98. // this.storageAndgoTo()
  99. // } else {
  100. // ElMessage.error('账号或密码输入错误!')
  101. // }
  102. // })
  103. },
  104. //本地储存与跳转
  105. storageAndgoTo() {
  106. //存储用户权限id
  107. // this.$http.get('/getTableList', {
  108. // tableName: 'base_sys_user_role', //
  109. // sqlWhere: '"userId"' + " = " + this.loginForm.id, //+ this.loginForm.id
  110. // orderByField: ''
  111. // }).then(res => {
  112. // //存储用户ID
  113. // let _this = this
  114. // console.log(res)
  115. // store.roleId = res.data[0].roleid
  116. // console.log(store.roleId)
  117. // if (
  118. // window.navigator.userAgent.match(
  119. // /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  120. // )
  121. // ) {
  122. // store.userport = 'APP'
  123. // } else {
  124. // store.userport = 'PC'
  125. // }
  126. // //跳转到Main3D页面
  127. // this.$router.replace({
  128. // path: '/home'
  129. // })
  130. // })
  131. store.roleId=2
  132. this.$router.replace({
  133. path: '/home'
  134. })
  135. let userInfo = {
  136. account: this.loginForm.username,
  137. password: this.loginForm.password,
  138. id: this.loginForm.id
  139. }
  140. console.log(" userInfo" , userInfo)
  141. localStorage.setItem('person', JSON.stringify(userInfo))
  142. //登陆成功判断是否记住密码,设置本地存储账号信息,isRemeber存储是否记住密码状态
  143. if (!this.loginForm.remember) {
  144. localStorage.setItem('isRemeber', false)
  145. } else {
  146. localStorage.setItem('isRemeber', true)
  147. }
  148. },
  149. },
  150. mounted() {
  151. //本地获取判断是否记住密码信息
  152. let isRemeber = localStorage.getItem('isRemeber')
  153. if (isRemeber == 'true') {
  154. //获取账户信息
  155. let person = JSON.parse(localStorage.getItem('person'))
  156. this.loginForm.username = person.account
  157. this.loginForm.password = person.password
  158. } else if (isRemeber == 'false') {
  159. this.loginForm.remember = false
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. ::v-deep .el-input__wrapper {
  166. padding-left: 56rem !important;
  167. }
  168. ::v-deep .is-checked .el-switch__core .el-switch__action {
  169. margin-left: calc(-1rem - 14rem);
  170. }
  171. el-switch {
  172. margin: 3rem 0rem;
  173. width: 36rem !important;
  174. }
  175. ::v-deep .el-switch__core .el-switch__action {
  176. width: 16rem !important;
  177. height: 16rem !important;
  178. }
  179. ::v-deep .el-switch__core .el-switch__action {
  180. top: 1rem;
  181. }
  182. ::v-deep .el-switch__core {
  183. width: 40rem !important;
  184. height: 20rem !important;
  185. }
  186. /* 账号密码输入框样式设置 */
  187. ::v-deep .el-input__wrapper {
  188. background-color: rgba(0, 0, 0, 0) !important;
  189. box-shadow: 0 0 0 0 !important;
  190. border: 1rem solid #0055ff !important;
  191. width: 340rem;
  192. height: 43rem;
  193. padding-left: 56rem;
  194. border-radius: 3rem;
  195. line-height: inherit;
  196. background-color: rgba(255, 255, 255, 0.5);
  197. }
  198. ::v-deep .el-input__wrapper.is-focus {
  199. border: 1rem solid rgb(255, 85, 0) !important;
  200. }
  201. .el-input {
  202. position: static !important;
  203. box-sizing: inherit !important;
  204. }
  205. /* 页面背景样式 */
  206. .login-container {
  207. border: 0rem solid red !important;
  208. width: calc(100vw - 0rem);
  209. height: calc(100vh - 0rem);
  210. background: url(@/assets/images/login/login-bg-1.webp) 0rem no-repeat;
  211. background-size: 100% 100%;
  212. background-repeat: no-repeat;
  213. user-select: none;
  214. animation: switch 10s infinite;
  215. height: calc(100vh - 0rem);
  216. position: relative;
  217. }
  218. @keyframes switch {
  219. 50% {
  220. background: url(@/assets/images/login/login-bg.webp) 0rem no-repeat;
  221. background-size: 100% 100%;
  222. background-repeat: no-repeat;
  223. }
  224. }
  225. /* 页面顶部标题栏样式 */
  226. .logoinTop {
  227. width: calc(100% - 0rem);
  228. height: 70rem;
  229. line-height: 70rem;
  230. background: url(@/assets/images/login/zhny-title.png) 0rem no-repeat, linear-gradient(100deg, rgba(16, 96, 210, .2) 30%, rgba(16, 106, 250, .1) 70%);
  231. background-size: 510rem 70rem, 100% 70rem;
  232. background-repeat: no-repeat;
  233. user-select: none;
  234. position: absolute;
  235. top: 0;
  236. }
  237. /* 页面底部样式 */
  238. .loginBottom {
  239. position: absolute;
  240. width: calc(100% - 0rem);
  241. height: 110rem;
  242. bottom: -40rem;
  243. background: linear-gradient(100deg, rgba(16, 96, 210, .1) 20%, rgba(16, 106, 250, .1) 40%);
  244. background-size: 100% 110rem;
  245. background-repeat: no-repeat;
  246. font-size: 13rem;
  247. text-align: center;
  248. color: #ffffff;
  249. overflow: hidden;
  250. user-select: none;
  251. padding: 10rem 0rem;
  252. }
  253. .loginBottom>p {
  254. height: 25rem;
  255. line-height: 25rem;
  256. margin: 5rem;
  257. }
  258. .loginBottom>p>a {
  259. color: red;
  260. }
  261. /* 登录框 容器样式 */
  262. .loginbox {
  263. position: absolute;
  264. width: 446rem; //400
  265. height: 423rem; //420
  266. padding: 0rem 90rem;
  267. top: calc(50% - 220rem);
  268. left: calc(50% - 300rem);
  269. background-color: rgba(235, 209, 249, 0.7);
  270. box-shadow: 8rem 16rem 16rem #27496d;
  271. user-select: none;
  272. border-radius: 15rem;
  273. }
  274. /* 登录框标题样式 */
  275. .loginbox-title {
  276. height: 70rem;
  277. line-height: 70rem;
  278. font-size: 30rem;
  279. font-weight: 600;
  280. color: #ffffff;
  281. text-align: center;
  282. margin-top: 30rem;
  283. padding: 0rem;
  284. /* 字间距 */
  285. letter-spacing: 2rem;
  286. font-family: "Alimama_ShuHeiTi_Bold";
  287. }
  288. /* 登录框 用户名密码输入框样式 */
  289. .loginbox-input {
  290. width: calc(100%);
  291. height: 45rem;
  292. margin: 0 auto;
  293. padding: 15rem 0rem;
  294. background-size: 30rem 30rem;
  295. position: relative;
  296. }
  297. .loginbox-input span {
  298. position: absolute;
  299. top: 28rem;
  300. left: 20rem;
  301. font-size: 20rem;
  302. color: #0099f0;
  303. }
  304. /* 记住账号复选框样式 */
  305. .loginbox-checkbox {
  306. width: calc(100% - 0rem);
  307. height: 40rem;
  308. line-height: 40rem;
  309. /* 字间距 */
  310. letter-spacing: 2rem;
  311. color: #ffffff;
  312. font-size: 14rem;
  313. }
  314. /* 记住账号复选框样式 */
  315. .loginbox-checkbox span {
  316. height: 40rem;
  317. line-height: 40rem;
  318. vertical-align: middle;
  319. float: left;
  320. }
  321. /* 记住账号复选框样式 */
  322. .loginbox-checkbox span input[type="checkbox"] {
  323. height: 18rem;
  324. width: 18rem;
  325. margin-right: 10rem;
  326. cursor: pointer;
  327. vertical-align: middle;
  328. }
  329. /* 登录按钮样式 */
  330. .loginbox-btn div {
  331. width: calc(100% - 0rem);
  332. height: 40rem;
  333. line-height: 40rem;
  334. background-color: rgba(0, 153, 240, 0.8);
  335. outline: none;
  336. border-radius: 50rem;
  337. /* 字间距 */
  338. letter-spacing: 2rem;
  339. font-size: 16rem;
  340. font-weight: 600;
  341. color: rgba(255, 255, 255, 1);
  342. // box-shadow: 0 3rem 5rem 1rem#27496d;
  343. cursor: pointer;
  344. margin: 10rem 0rem;
  345. }
  346. //输入框样式
  347. ::v-deep .el-input__wrapper {
  348. background-color: rgba(255, 255, 255, 0.3) !important;
  349. border-radius: 40rem;
  350. border: 0rem !important;
  351. height: 43rem;
  352. }
  353. ::v-deep .el-input__inner {
  354. color: #000 !important;
  355. font-size: 16rem;
  356. }
  357. //获取焦点样式
  358. ::v-deep .el-input__wrapper.is-focus {
  359. border: 0rem !important;
  360. }
  361. //后置图标颜色
  362. ::v-deep .el-icon svg {
  363. color: #ffffff;
  364. height: 10rem;
  365. width: 10rem;
  366. }
  367. .loginbox-btn div:hover {
  368. background-color: lighten(#0099f0, 10%);
  369. font-weight: 600;
  370. transition: all .5s;
  371. // box-shadow: 0 2rem 4rem 0rem #27496d;
  372. }
  373. .disabled {
  374. cursor: not-allowed !important;
  375. }
  376. //占位符样式
  377. ::v-deep .el-input__inner::-webkit-input-placeholder {
  378. /* WebKit browsers */
  379. color: rgba(255, 255, 255, 0.8) !important;
  380. font-size: 16rem;
  381. }
  382. ::v-deep .el-input__inner::placeholder {
  383. color: rgba(255, 255, 255, 0.8) !important;
  384. font-size: 16rem;
  385. }
  386. /* 谷歌 */
  387. ::v-deep .el-input__inner::-webkit-input-placeholder {
  388. color: rgba(255, 255, 255, 0.8) !important;
  389. font-size: 16rem;
  390. }
  391. </style>