Login.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="innerBox">
  3. <div class="video">
  4. <video id="myVideo"
  5. class="video-js vjs-default-skin vjs-big-play-centered"
  6. autoplay
  7. loop
  8. >
  9. <!-- <source src="https://video.699pic.com/videos/27/79/49/b_Ktm3pE7sabvX1556277949.mp4" type="video/mp4" > //视频地址 -->
  10. <source :src="videourl" type="video/mp4" >
  11. <!-- <source src="http://www.yfzhwlw.com/static/flash/cbd.mp4" type="video/mp4" > -->
  12. </video>
  13. </div>
  14. <div class="login_box">
  15. <div class="tit-box">
  16. <div class="tit-con">
  17. <p class="tit">高标准农田智慧管理平台</p>
  18. <p class="txt">High standard farmland intelligent management platform</p>
  19. </div>
  20. </div>
  21. <div class="f-box">
  22. <ul class="loginItems">
  23. <li>
  24. <i class="iconfont icon-yonghu1"></i>
  25. <input
  26. autocomplete="off"
  27. type="text"
  28. @keyup="fillPass()"
  29. id="username"
  30. v-model="username"
  31. placeholder="请输入用户名"
  32. />
  33. </li>
  34. <li>
  35. <i class="iconfont icon-mima1"></i>
  36. <input
  37. autocomplete="off"
  38. type="password"
  39. id="password"
  40. @keyup.enter="submit()"
  41. v-model="pass"
  42. placeholder="请输入密码"
  43. />
  44. </li>
  45. <li>
  46. <div class="pass">
  47. <input type="checkbox" id="brand" v-model="cState" />
  48. <label for="brand">
  49. <span>
  50. <i class="el-icon-check"></i>
  51. </span>
  52. 记住密码
  53. </label>
  54. <!-- <a>忘记密码?</a> -->
  55. </div>
  56. </li>
  57. <li class="loginBtn">
  58. <button class="logon-btn" @click="submit()">登录设备管理系统</button>
  59. <button class="logon-btn" @click="submit('jiangan')">登录数据监管系统</button>
  60. </li>
  61. </ul>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. videourl:require('../../static/images/loginMp3.mp4'),
  71. bjImage: '/static/images/login/login_bg.jpg',
  72. username: '管理员',
  73. pass: 'yfadmin',
  74. cState: false
  75. }
  76. },
  77. methods: {
  78. submit(flag) {
  79. if (this.username == '' || this.pass == '') {
  80. this.$message.error('请输入用户名和密码!')
  81. return
  82. }
  83. this.$axios({
  84. method: 'POST',
  85. url: '/api/api_gateway?method=user.login.login_user',
  86. data: this.qs.stringify({
  87. username: this.username,
  88. password: this.pass
  89. })
  90. }).then((res) => {
  91. if (res.data.message == '') {
  92. if(res.data.data.user_type == 1){
  93. localStorage.setItem('setHomepage', '/baseAll')
  94. }else{
  95. localStorage.setItem('setHomepage', '/base')
  96. }
  97. if (this.cState == true) {
  98. //是否记住密码
  99. localStorage.setItem('username', this.username)
  100. localStorage.setItem('password', this.pass)
  101. } else {
  102. localStorage.removeItem(username, password)
  103. }
  104. localStorage.setItem('isLogin', true)
  105. let selHome = sessionStorage.getItem('selHome')
  106. if(flag){
  107. var routeUrl = this.$router.resolve({
  108. path: '/bHome'
  109. })
  110. window.open(routeUrl.href, '_blank')
  111. this.$router.push('/plantGuard')
  112. }else{
  113. if (selHome) {
  114. this.$router.push(selHome) //登录后默认选择首页
  115. } else {
  116. this.$router.push('/plantGuard')
  117. }
  118. }
  119. localStorage.setItem('cUsername',res.data.params.username)
  120. } else {
  121. this.$message.error(res.data.message)
  122. }
  123. })
  124. },
  125. fillPass() {
  126. let username = localStorage.getItem('username')
  127. if (username == this.username) {
  128. this.pass = localStorage.getItem('password')
  129. }
  130. }
  131. },
  132. mounted(){
  133. window.sessionStorage.removeItem("menuTabs");
  134. window.sessionStorage.removeItem("menuTabsValue");
  135. }
  136. }
  137. </script>
  138. <style lang='less' scoped>
  139. .innerBox{
  140. background: #000;
  141. width: 100%;
  142. height: 100vh;
  143. .video,#myVideo{
  144. width: 100%;
  145. height: 100%;
  146. }
  147. .login_box{
  148. position: absolute;
  149. width: 460px;
  150. height: 340px;
  151. left: 50%;
  152. margin-left: -230px;
  153. top: 50%;
  154. margin-top: -170px;
  155. text-align: center;
  156. .tit:nth-child(1){
  157. font-size: 31px;
  158. color: #fff;
  159. letter-spacing: 9px;
  160. font-weight: 700;
  161. line-height: 54px;
  162. }
  163. .txt:nth-child(2){
  164. font-size: 12px;
  165. color: #fff;
  166. letter-spacing: 2px;
  167. margin-bottom: 20px;
  168. }
  169. .loginItems{
  170. li{
  171. width: 80%;
  172. margin: 0 auto;
  173. text-align: left;
  174. position: relative;
  175. margin-bottom: 20px;
  176. i{
  177. position: absolute;
  178. line-height: 35px;
  179. left: 5px;
  180. color: #12555d;
  181. }
  182. input{
  183. display: block;
  184. line-height: 33px;
  185. height: 33px;
  186. width: 100%;
  187. padding-left: 25px;
  188. box-sizing: border-box;
  189. color: #12555d;
  190. outline: none;
  191. border: 1px solid #12555d;
  192. }
  193. .pass{
  194. text-align: left;
  195. color: #fff;
  196. i{
  197. color: #fff;
  198. }
  199. input{
  200. width: inherit;
  201. vertical-align: middle;
  202. display: none;
  203. }
  204. span{
  205. display: inline-block;
  206. width: 16px;
  207. height: 16px;
  208. border-radius: 3px;
  209. border: 1px solid #b5b5b5;
  210. float: left;
  211. margin-right: 10px;
  212. margin-top: 3px;
  213. }
  214. input[type="checkbox"] {
  215. display: none;
  216. }
  217. input[type="checkbox"] + label span {
  218. display: inline-block;
  219. width: 16px;
  220. height: 16px;
  221. border-radius: 3px;
  222. border: 1px solid #b5b5b5;
  223. float: left;
  224. margin-right: 10px;
  225. i {
  226. display: none;
  227. }
  228. }
  229. input[type="checkbox"]:checked + label span {
  230. background: #2f3945;
  231. i {
  232. display: block;
  233. font-size: 15px;
  234. color: #fff;
  235. line-height: 15px;
  236. left: 2px;
  237. }
  238. i:before {
  239. font-weight: 800;
  240. }
  241. }
  242. }
  243. }
  244. .loginBtn{
  245. display: flex;
  246. justify-content: space-between;
  247. button{
  248. background: #eb959b;
  249. border: none;
  250. color: #fff;
  251. line-height: 33px;
  252. padding: 3px 34px;
  253. cursor: pointer;
  254. }
  255. button:nth-child(2){
  256. // margin-left: 14px;
  257. background: #15b6b4;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. </style>