Login.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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 sanwei 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. sanwei
  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. //需要修改,像数据库发送账号密码,根据返回值判断
  88. // let password = this.$md5(this.loginForm.password)
  89. // this.$http.get('/getTableList', {
  90. // tableName: 'base_sys_user',
  91. // sqlWhere: "username = '" + this.loginForm.username + "' and password = '" + password + "'",
  92. // orderByField: ''
  93. // }).then(res => {
  94. // if (res.data.length > 0) {
  95. // this.loginForm.id = res.data[0].id
  96. // store.realName = res.data[0].name;
  97. // this.storageAndgoTo()
  98. // } else {
  99. // ElMessage.error('账号或密码输入错误!')
  100. // }
  101. // })
  102. this.storageAndgoTo()
  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. if (
  132. window.navigator.userAgent.match(
  133. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  134. )
  135. ) {
  136. store.userport = 'APP'
  137. } else {
  138. store.userport = 'PC'
  139. }
  140. store.roleId = 1
  141. this.$router.replace({
  142. path: '/home'
  143. })
  144. let userInfo = {
  145. account: this.loginForm.username,
  146. password: this.loginForm.password,
  147. id: this.loginForm.id
  148. }
  149. localStorage.setItem('person', JSON.stringify(userInfo))
  150. //登陆成功判断是否记住密码,设置本地存储账号信息,isRemeber存储是否记住密码状态
  151. if (!this.loginForm.remember) {
  152. localStorage.setItem('isRemeber', false)
  153. } else {
  154. localStorage.setItem('isRemeber', true)
  155. }
  156. },
  157. },
  158. mounted() {
  159. //本地获取判断是否记住密码信息
  160. let isRemeber = localStorage.getItem('isRemeber')
  161. if (isRemeber == 'true') {
  162. //获取账户信息
  163. let person = JSON.parse(localStorage.getItem('person'))
  164. this.loginForm.username = person.account
  165. this.loginForm.password = person.password
  166. } else if (isRemeber == 'false') {
  167. this.loginForm.remember = false
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. ::v-deep .el-input__wrapper {
  174. padding-left: 56rem !important;
  175. }
  176. ::v-deep .is-checked .el-switch__core .el-switch__action {
  177. margin-left: calc(-1rem - 14rem);
  178. }
  179. el-switch {
  180. margin: 3rem 0rem;
  181. width: 36rem !important;
  182. }
  183. ::v-deep .el-switch__core .el-switch__action {
  184. width: 16rem !important;
  185. height: 16rem !important;
  186. }
  187. ::v-deep .el-switch__core .el-switch__action {
  188. top: 1rem;
  189. }
  190. ::v-deep .el-switch__core {
  191. width: 40rem !important;
  192. height: 20rem !important;
  193. }
  194. /* 账号密码输入框样式设置 */
  195. ::v-deep .el-input__wrapper {
  196. background-color: rgba(0, 0, 0, 0) !important;
  197. box-shadow: 0 0 0 0 !important;
  198. border: 1rem solid #0055ff !important;
  199. width: 340rem;
  200. height: 43rem;
  201. padding-left: 56rem;
  202. border-radius: 3rem;
  203. line-height: inherit;
  204. background-color: rgba(255, 255, 255, 0.5);
  205. }
  206. ::v-deep .el-input__wrapper.is-focus {
  207. border: 1rem solid rgb(255, 85, 0) !important;
  208. }
  209. .el-input {
  210. position: static !important;
  211. box-sizing: inherit !important;
  212. }
  213. /* 页面背景样式 */
  214. .login-container {
  215. border: 0rem solid red !important;
  216. width: calc(100vw - 0rem);
  217. height: calc(100vh - 0rem);
  218. background: url(@/assets/images/login/login-bg-1.webp) 0rem no-repeat;
  219. background-size: 100% 100%;
  220. background-repeat: no-repeat;
  221. user-select: none;
  222. animation: switch 10s infinite;
  223. height: calc(100vh - 0rem);
  224. position: relative;
  225. }
  226. @keyframes switch {
  227. 50% {
  228. background: url(@/assets/images/login/login-bg.webp) 0rem no-repeat;
  229. background-size: 100% 100%;
  230. background-repeat: no-repeat;
  231. }
  232. }
  233. /* 页面顶部标题栏样式 */
  234. .logoinTop {
  235. width: calc(100% - 0rem);
  236. height: 70rem;
  237. line-height: 70rem;
  238. background: url(@/assets/images/login/ZHNYlogo.png) 0rem no-repeat, linear-gradient(100deg, rgba(16, 96, 210, .2) 30%, rgba(16, 106, 250, .1) 70%);
  239. background-size: 510rem 70rem, 100% 70rem;
  240. background-repeat: no-repeat;
  241. user-select: none;
  242. position: absolute;
  243. top: 0;
  244. }
  245. /* 页面底部样式 */
  246. .loginBottom {
  247. position: absolute;
  248. width: calc(100% - 0rem);
  249. height: 110rem;
  250. bottom: -40rem;
  251. background: linear-gradient(100deg, rgba(16, 96, 210, .1) 20%, rgba(16, 106, 250, .1) 40%);
  252. background-size: 100% 110rem;
  253. background-repeat: no-repeat;
  254. font-size: 13rem;
  255. text-align: center;
  256. color: #ffffff;
  257. overflow: hidden;
  258. user-select: none;
  259. padding: 10rem 0rem;
  260. }
  261. .loginBottom>p {
  262. height: 25rem;
  263. line-height: 25rem;
  264. margin: 5rem;
  265. }
  266. .loginBottom>p>a {
  267. color: red;
  268. }
  269. /* 登录框 容器样式 */
  270. .loginbox {
  271. position: absolute;
  272. width: 446rem; //400
  273. height: 423rem; //420
  274. padding: 0rem 90rem;
  275. top: calc(50% - 220rem);
  276. left: calc(50% - 300rem);
  277. background-color: rgba(235, 209, 249, 0.7);
  278. box-shadow: 8rem 16rem 16rem #27496d;
  279. user-select: none;
  280. border-radius: 15rem;
  281. }
  282. /* 登录框标题样式 */
  283. .loginbox-title {
  284. height: 70rem;
  285. line-height: 70rem;
  286. font-size: 30rem;
  287. font-weight: 600;
  288. color: #ffffff;
  289. text-align: center;
  290. margin-top: 30rem;
  291. padding: 0rem;
  292. /* 字间距 */
  293. letter-spacing: 2rem;
  294. font-family: "Alimama_ShuHeiTi_Bold";
  295. }
  296. /* 登录框 用户名密码输入框样式 */
  297. .loginbox-input {
  298. width: calc(100%);
  299. height: 45rem;
  300. margin: 0 auto;
  301. padding: 15rem 0rem;
  302. background-size: 30rem 30rem;
  303. position: relative;
  304. }
  305. .loginbox-input span {
  306. position: absolute;
  307. top: 28rem;
  308. left: 20rem;
  309. font-size: 20rem;
  310. color: #0099f0;
  311. }
  312. /* 记住账号复选框样式 */
  313. .loginbox-checkbox {
  314. width: calc(100% - 0rem);
  315. height: 40rem;
  316. line-height: 40rem;
  317. /* 字间距 */
  318. letter-spacing: 2rem;
  319. color: #ffffff;
  320. font-size: 14rem;
  321. }
  322. /* 记住账号复选框样式 */
  323. .loginbox-checkbox span {
  324. height: 40rem;
  325. line-height: 40rem;
  326. vertical-align: middle;
  327. float: left;
  328. }
  329. /* 记住账号复选框样式 */
  330. .loginbox-checkbox span input[type="checkbox"] {
  331. height: 18rem;
  332. width: 18rem;
  333. margin-right: 10rem;
  334. cursor: pointer;
  335. vertical-align: middle;
  336. }
  337. /* 登录按钮样式 */
  338. .loginbox-btn div {
  339. width: calc(100% - 0rem);
  340. height: 40rem;
  341. line-height: 40rem;
  342. background-color: rgba(0, 153, 240, 0.8);
  343. outline: none;
  344. border-radius: 50rem;
  345. /* 字间距 */
  346. letter-spacing: 2rem;
  347. font-size: 16rem;
  348. font-weight: 600;
  349. color: rgba(255, 255, 255, 1);
  350. // box-shadow: 0 3rem 5rem 1rem#27496d;
  351. cursor: pointer;
  352. margin: 10rem 0rem;
  353. }
  354. //输入框样式
  355. ::v-deep .el-input__wrapper {
  356. background-color: rgba(255, 255, 255, 0.3) !important;
  357. border-radius: 40rem;
  358. border: 0rem !important;
  359. height: 43rem;
  360. }
  361. ::v-deep .el-input__inner {
  362. color: #000 !important;
  363. font-size: 16rem;
  364. }
  365. //获取焦点样式
  366. ::v-deep .el-input__wrapper.is-focus {
  367. border: 0rem !important;
  368. }
  369. //后置图标颜色
  370. ::v-deep .el-icon svg {
  371. color: #ffffff;
  372. height: 10rem;
  373. width: 10rem;
  374. }
  375. .loginbox-btn div:hover {
  376. background-color: lighten(#0099f0, 10%);
  377. font-weight: 600;
  378. transition: all .5s;
  379. // box-shadow: 0 2rem 4rem 0rem #27496d;
  380. }
  381. .disabled {
  382. cursor: not-allowed !important;
  383. }
  384. //占位符样式
  385. ::v-deep .el-input__inner::-webkit-input-placeholder {
  386. /* WebKit browsers */
  387. color: rgba(255, 255, 255, 0.8) !important;
  388. font-size: 16rem;
  389. }
  390. ::v-deep .el-input__inner::placeholder {
  391. color: rgba(255, 255, 255, 0.8) !important;
  392. font-size: 16rem;
  393. }
  394. /* 谷歌 */
  395. ::v-deep .el-input__inner::-webkit-input-placeholder {
  396. color: rgba(255, 255, 255, 0.8) !important;
  397. font-size: 16rem;
  398. }
  399. </style>