Login.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="login-container">
  3. <div class="layer">
  4. <div class="some-space">
  5. <div class="form">
  6. <h2>大数据可视化平台</h2>
  7. <div class="item">
  8. <i class="iconfont icon-user"></i>
  9. <input
  10. autocomplete="off"
  11. type="text"
  12. class="input"
  13. v-model="userName"
  14. placeholder="请输入用户名"
  15. />
  16. </div>
  17. <div class="item">
  18. <i class="iconfont icon-password"></i>
  19. <input
  20. autocomplete="off"
  21. type="password"
  22. class="input"
  23. v-model="userPwd"
  24. maxlength="20"
  25. @keyup.enter="login"
  26. placeholder="请输入密码"
  27. />
  28. </div>
  29. <button
  30. class="loginBtn"
  31. :disabled="isLoginAble"
  32. @click.stop="login">
  33. 立即登录
  34. </button>
  35. <div class="tip">
  36. 默认用户名:admin ,默认密码:123456
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <vue-particles
  42. color="#6495ED"
  43. :particleOpacity="0.7"
  44. :particlesNumber="80"
  45. shapeType="circle"
  46. :particleSize="4"
  47. linesColor="#6495ED"
  48. :linesWidth="1"
  49. :lineLinked="true"
  50. :lineOpacity="0.6"
  51. :linesDistance="150"
  52. :moveSpeed="3"
  53. :hoverEffect="true"
  54. hoverMode="grab"
  55. :clickEffect="true"
  56. clickMode="push"
  57. >
  58. </vue-particles>
  59. <bgAnimation />
  60. <modal
  61. title="提示"
  62. :content="modalContent"
  63. :visible.sync="visible"
  64. @confirm="confirm">
  65. </modal>
  66. </div>
  67. </template>
  68. <script>
  69. export default {
  70. name: 'Login',
  71. components: {},
  72. data() {
  73. return {
  74. userName: 'admin',
  75. userPwd: '123456',
  76. visible: false,
  77. modalContent: '这是一段信息'
  78. }
  79. },
  80. computed: {
  81. isLoginAble() {
  82. return !(this.userName && this.userPwd);
  83. }
  84. },
  85. created() {},
  86. mounted() {
  87. },
  88. methods: {
  89. login () {
  90. if (this.userName == 'admin' && this.userPwd == '123456') {
  91. this.$router.push({
  92. path: '/home'
  93. })
  94. } else {
  95. this.$Toast({
  96. content: '请输入正确的用户名和密码',
  97. type: 'error',
  98. // hasClose: true
  99. })
  100. }
  101. },
  102. confirm () {
  103. this.visible = false;
  104. console.log('点击确定')
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .login-container {
  111. .layer {
  112. position: absolute;
  113. height: 100%;
  114. width: 100%;
  115. }
  116. #particles-js {
  117. position: absolute;
  118. top: 0;
  119. left: 0;
  120. width: 100%;
  121. height: 100%;
  122. z-index: 1000;
  123. }
  124. .some-space {
  125. color: white;
  126. font-weight: 100;
  127. letter-spacing: 2px;
  128. position: absolute;
  129. top: 50%;
  130. left: 50%;
  131. z-index: 1001;
  132. -webkit-transform: translate3d(-50%, -50%, 0);
  133. transform: translate3d(-50%, -50%, 0);
  134. -ms-animation: cloud 2s 3s ease-in infinite alternate;
  135. -moz-animation: cloud 2s 3s ease-in infinite alternate;
  136. -webkit-animation: cloud 2s 3s ease-in infinite alternate;
  137. -o-animation: cloud 2s 3s ease-in infinite alternate;
  138. -webkit-animation: cloud 2s 3s ease-in infinite alternate;
  139. animation: cloud 2s 3s ease-in infinite alternate;
  140. .form {
  141. width: 460px;
  142. height: auto;
  143. background: rgba(36, 36, 85, .5);
  144. margin: 0 auto;
  145. padding: 35px 30px 25px;
  146. box-shadow: 0 0 25px rgb(72, 72, 85);
  147. border-radius: 10px;
  148. .item {
  149. display: flex;
  150. align-items: center;
  151. margin-bottom: 25px;
  152. border-bottom: 1px solid #d3d7f7;
  153. i {
  154. color: #d3d7f7;
  155. margin-right: 10px;
  156. }
  157. }
  158. h2 {
  159. text-align: center;
  160. font-weight: normal;
  161. font-size: 26px;
  162. color: #d3d7f7;
  163. padding-bottom: 35px;
  164. }
  165. .input {
  166. font-size: 16px;
  167. line-height: 30px;
  168. width: 100%;
  169. color: #d3d7f7;
  170. outline: none;
  171. border: none;
  172. background-color: rgba(0, 0, 0, 0);
  173. padding: 10px 0;
  174. }
  175. .loginBtn {
  176. width: 100%;
  177. padding: 12px 0;
  178. border: 1px solid #d3d7f7;
  179. font-size: 16px;
  180. color: #d3d7f7;
  181. cursor: pointer;
  182. background: transparent;
  183. border-radius: 4px;
  184. margin-top: 10px;
  185. &:hover {
  186. color: #fff;
  187. background: #0090ff;
  188. border-color: #0090ff;
  189. }
  190. }
  191. .tip {
  192. font-size: 12px;
  193. padding-top: 20px;
  194. }
  195. }
  196. }
  197. }
  198. input::-webkit-input-placeholder {
  199. color: #d3d7f7;
  200. }
  201. input::-moz-placeholder { /* Mozilla Firefox 19+ */
  202. color: #d3d7f7;
  203. }
  204. input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
  205. color: #d3d7f7;
  206. }
  207. input:-ms-input-placeholder { /* Internet Explorer 10-11 */
  208. color: #d3d7f7;
  209. }
  210. @-ms-keyframes cloud{
  211. 0%{
  212. -ms-transform: translate(-50%, -50%);
  213. }
  214. 40%{
  215. opacity: 1;
  216. }
  217. 60%{
  218. opacity: 1;
  219. }
  220. 100%{
  221. -ms-transform: translate(-50%, -40%);
  222. }
  223. }
  224. @-moz-keyframes cloud{
  225. 0%{
  226. -moz-transform: translate(-50%, -50%);
  227. }
  228. 40%{
  229. opacity: 1;
  230. }
  231. 60%{
  232. opacity: 1;
  233. }
  234. 100%{
  235. -moz-transform: translate(-50%, -40%);
  236. }
  237. }
  238. @-o-keyframes cloud{
  239. 0%{
  240. -o-transform: translate(-50%, -50%);
  241. }
  242. 40%{
  243. opacity: 1;
  244. }
  245. 60%{
  246. opacity: 1;
  247. }
  248. 100%{
  249. -o-transform: translate(-50%, -40%);
  250. }
  251. }
  252. @-webkit-keyframes cloud{
  253. 0%{
  254. -webkit-transform: translate(-50%, -50%);
  255. }
  256. 40%{
  257. opacity: 1;
  258. }
  259. 60%{
  260. opacity: 1;
  261. }
  262. 100%{
  263. -webkit-transform: translate(-50%, -40%);
  264. }
  265. }
  266. @keyframes cloud{
  267. 0%{
  268. transform: translate(-50%, -50%);
  269. }
  270. 40%{
  271. opacity: 1;
  272. }
  273. 60%{
  274. opacity: 1;
  275. }
  276. 100%{
  277. transform: translate(-50%, -40%);
  278. }
  279. }
  280. </style>