index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div class="login-container"
  3. @keyup.enter.native="handleLogin">
  4. <div class="login-weaper animated bounceInDown">
  5. <div class="login-left">
  6. <div class="login-time">
  7. {{time}}
  8. </div>
  9. <img class="img"
  10. src="/img/logo.png"
  11. alt="">
  12. <p class="title">{{website.infoTitle}}</p>
  13. <p>v 2.6.0</p>
  14. </div>
  15. <div class="login-border">
  16. <div class="login-main">
  17. <h4 class="login-title">
  18. <el-select
  19. class="login-select animated fadeIn"
  20. v-model="active"
  21. @change="handleCommand"
  22. placeholder="点击请选择租户"
  23. size="mini">
  24. <el-option label="租户1 用户登录" value="1"></el-option>
  25. <el-option label="租户2 用户登录" value="2"></el-option>
  26. </el-select>
  27. </h4>
  28. <userLogin v-if="activeName==='user'"></userLogin>
  29. <codeLogin v-else-if="activeName==='code'"></codeLogin>
  30. <thirdLogin v-else-if="activeName==='third'"></thirdLogin>
  31. <div class="login-menu">
  32. <a href="#"
  33. @click.stop="activeName='user'">账号密码</a>
  34. <a href="#"
  35. @click.stop="activeName='code'">手机号登录</a>
  36. <a href="#"
  37. @click.stop="activeName='third'">第三方登录</a>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <top-color v-show="false"></top-color>
  43. </div>
  44. </template>
  45. <script>
  46. import userLogin from "./userlogin";
  47. import codeLogin from "./codelogin";
  48. import thirdLogin from "./thirdlogin";
  49. import {mapGetters} from "vuex";
  50. import {getStore, setStore} from "@/util/store";
  51. import {dateFormat} from "@/util/date";
  52. import {validatenull} from "@/util/validate";
  53. import topColor from "@/page/index/top/top-color";
  54. export default {
  55. name: "login",
  56. components: {
  57. userLogin,
  58. codeLogin,
  59. thirdLogin,
  60. topColor
  61. },
  62. data() {
  63. return {
  64. time: "",
  65. active: "",
  66. activeName: "user",
  67. socialForm: {}
  68. };
  69. },
  70. watch: {
  71. $route: {
  72. handler() {
  73. const params = this.$route.query
  74. if (validatenull(params.state) && validatenull(params.code)) return
  75. this.socialForm.state = params.state
  76. this.socialForm.code = params.code
  77. const loading = this.$loading({
  78. lock: true,
  79. text: `登录中,请稍后。。。`,
  80. spinner: 'el-icon-loading'
  81. })
  82. this.$store.dispatch('LoginBySocial', this.socialForm).then(
  83. () => {
  84. loading.close()
  85. this.$router.push({path: this.tagWel.value});
  86. }).catch(() => {
  87. loading.close()
  88. })
  89. },
  90. immediate: true
  91. }
  92. },
  93. created() {
  94. this.active = getStore({name: "tenantId"});
  95. this.getTime();
  96. setInterval(() => {
  97. this.getTime();
  98. }, 1000);
  99. },
  100. mounted() {
  101. },
  102. computed: {
  103. ...mapGetters(["website",'tagWel'])
  104. },
  105. props: [],
  106. methods: {
  107. handleCommand(command) {
  108. setStore({name: "tenantId", content: command});
  109. },
  110. getTime() {
  111. this.time = dateFormat(new Date());
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss">
  117. .login-container {
  118. display: flex;
  119. align-items: center;
  120. position: relative;
  121. width: 100%;
  122. height: 100%;
  123. margin: 0 auto;
  124. background: url("http://www.17sucai.com/preview/242158/2015-01-10/%E7%99%BB%E5%BD%95/images/cloud.jpg") 0 bottom repeat-x #049ec4;
  125. animation: animate-cloud 20s linear infinite;
  126. }
  127. .login-weaper {
  128. margin: 0 auto;
  129. width: 1000px;
  130. box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
  131. }
  132. .login-left,
  133. .login-border {
  134. position: relative;
  135. min-height: 500px;
  136. align-items: center;
  137. display: flex;
  138. }
  139. .login-left {
  140. border-top-left-radius: 5px;
  141. border-bottom-left-radius: 5px;
  142. justify-content: center;
  143. flex-direction: column;
  144. background-color: #409EFF;
  145. color: #fff;
  146. float: left;
  147. width: 50%;
  148. position: relative;
  149. }
  150. .login-left .img {
  151. width: 140px;
  152. }
  153. .login-time {
  154. position: absolute;
  155. left: 25px;
  156. top: 25px;
  157. width: 100%;
  158. color: #fff;
  159. font-weight: 200;
  160. opacity: 0.9;
  161. font-size: 18px;
  162. overflow: hidden;
  163. }
  164. .login-left .title {
  165. margin-top: 60px;
  166. text-align: center;
  167. color: #fff;
  168. font-weight: 300;
  169. letter-spacing: 2px;
  170. font-size: 25px;
  171. }
  172. .login-border {
  173. border-left: none;
  174. border-top-right-radius: 5px;
  175. border-bottom-right-radius: 5px;
  176. color: #fff;
  177. background-color: #fff;
  178. width: 50%;
  179. float: left;
  180. box-sizing: border-box;
  181. }
  182. .login-main {
  183. margin: 0 auto;
  184. width: 65%;
  185. box-sizing: border-box;
  186. }
  187. .login-main > h3 {
  188. margin-bottom: 20px;
  189. }
  190. .login-main > p {
  191. color: #76838f;
  192. }
  193. .login-title {
  194. color: #333;
  195. margin-bottom: 40px;
  196. font-weight: 500;
  197. font-size: 22px;
  198. text-align: center;
  199. letter-spacing: 4px;
  200. }
  201. .login-select {
  202. input {
  203. color: #333;
  204. font-size: 18px;
  205. font-weight: 400;
  206. border: none;
  207. text-align: center;
  208. }
  209. }
  210. .login-menu {
  211. margin-top: 40px;
  212. width: 100%;
  213. text-align: center;
  214. a {
  215. color: #999;
  216. font-size: 12px;
  217. margin: 0px 8px;
  218. }
  219. }
  220. .login-submit {
  221. width: 100%;
  222. height: 45px;
  223. border: 1px solid #409eff;
  224. background: none;
  225. font-size: 18px;
  226. letter-spacing: 2px;
  227. font-weight: 300;
  228. color: #409eff;
  229. cursor: pointer;
  230. margin-top: 30px;
  231. font-family: "neo";
  232. transition: 0.25s;
  233. }
  234. .login-form {
  235. margin: 10px 0;
  236. i {
  237. color: #333;
  238. }
  239. .el-form-item__content {
  240. width: 100%;
  241. }
  242. .el-form-item {
  243. margin-bottom: 12px;
  244. }
  245. .el-input {
  246. input {
  247. padding-bottom: 10px;
  248. text-indent: 5px;
  249. background: transparent;
  250. border: none;
  251. border-radius: 0;
  252. color: #333;
  253. border-bottom: 1px solid rgb(235, 237, 242);
  254. }
  255. .el-input__prefix {
  256. i {
  257. padding: 0 5px;
  258. font-size: 16px !important;
  259. }
  260. }
  261. }
  262. }
  263. .login-code {
  264. display: flex;
  265. align-items: center;
  266. justify-content: space-around;
  267. margin: 0 0 0 10px;
  268. }
  269. .login-code-img {
  270. margin-top: 2px;
  271. width: 100px;
  272. height: 38px;
  273. background-color: #fdfdfd;
  274. border: 1px solid #f0f0f0;
  275. color: #333;
  276. font-size: 14px;
  277. font-weight: bold;
  278. letter-spacing: 5px;
  279. line-height: 38px;
  280. text-indent: 5px;
  281. text-align: center;
  282. }
  283. </style>