index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <div class="login-container pull-height" @keyup.enter.native="handleLogin">
  3. <div class="login-weaper">
  4. <div class="login-left animated fadeInLeft">
  5. <div class="login-info">
  6. <h2 class="login-info-title">{{website.info.title}}</h2>
  7. <ul class="login-info-list">
  8. <li class="login-info-item" v-for="(item,index) in website.info.list" :key="index">
  9. <i class="el-icon-check"></i>
  10. &nbsp;{{item}}
  11. </li>
  12. </ul>
  13. <el-button type="primary" size="small" class="login-index">首页</el-button>
  14. </div>
  15. </div>
  16. <div class="login-border animated fadeInRight">
  17. <div class="login-main">
  18. <h4 class="login-title">
  19. <el-select
  20. class="login-select animated fadeIn"
  21. v-model="active"
  22. @change="handleCommand"
  23. placeholder="点击请选择租户"
  24. size="mini">
  25. <el-option label="租户1 用户登录" value="1"></el-option>
  26. <el-option label="租户2 用户登录" value="2"></el-option>
  27. </el-select>
  28. </h4>
  29. <userLogin v-if="activeName==='user'"></userLogin>
  30. <codeLogin v-else-if="activeName==='code'"></codeLogin>
  31. <thirdLogin v-else-if="activeName==='third'"></thirdLogin>
  32. </div>
  33. <div class="login-menu">
  34. <a href="#" @click.stop="activeName='user'">账号密码</a>
  35. <a href="#" @click.stop="activeName='code'">手机号登录</a>
  36. <a href="#" @click.stop="activeName='third'">第三方登录</a>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import userLogin from "./userlogin";
  44. import codeLogin from "./codelogin";
  45. import thirdLogin from "./thirdlogin";
  46. import topColor from "../index/top/top-color";
  47. import color from "@/mixins/color";
  48. import { setStore, getStore } from "@/util/store";
  49. import { mapGetters } from "vuex";
  50. import { validatenull } from "@/util/validate";
  51. export default {
  52. name: "login",
  53. mixins: [color()],
  54. components: {
  55. topColor,
  56. userLogin,
  57. codeLogin,
  58. thirdLogin
  59. },
  60. data() {
  61. return {
  62. active: "",
  63. activeName: "user"
  64. };
  65. },
  66. watch: {
  67. $route() {
  68. const params = this.$route.query;
  69. this.socialForm.state = params.state;
  70. this.socialForm.code = params.code;
  71. if (!validatenull(this.socialForm.state)) {
  72. const loading = this.$loading({
  73. lock: true,
  74. text: `登录中,请稍后。。。`,
  75. spinner: "el-icon-loading"
  76. });
  77. setTimeout(() => {
  78. loading.close();
  79. }, 2000);
  80. this.handleSocialLogin();
  81. }
  82. }
  83. },
  84. created() {
  85. this.active = getStore({ name: "tenantId" });
  86. },
  87. mounted() {},
  88. computed: {
  89. ...mapGetters(["website"])
  90. },
  91. props: [],
  92. methods: {
  93. handleCommand(command) {
  94. setStore({ name: "tenantId", content: command });
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss">
  100. .login-container {
  101. position: relative;
  102. width: 100%;
  103. height: 100%;
  104. margin: 0 auto;
  105. }
  106. .login-weaper {
  107. position: absolute;
  108. top: 22%;
  109. left: 0;
  110. width: 100%;
  111. }
  112. .login-container::before {
  113. z-index: -1024;
  114. content: "";
  115. position: absolute;
  116. left: 0;
  117. top: 0;
  118. width: 100%;
  119. height: 100%;
  120. background-image: url("/img/login.png");
  121. background-size: cover;
  122. }
  123. .login-left {
  124. float: left;
  125. width: 50%;
  126. position: relative;
  127. }
  128. .login-logo {
  129. position: absolute;
  130. top: 0;
  131. left: 0;
  132. padding-top: 50px;
  133. font-size: 24px;
  134. color: #333;
  135. }
  136. .login-info {
  137. padding-left: 140px;
  138. }
  139. .login-info-title {
  140. line-height: 90px;
  141. color: rgb(52, 58, 64);
  142. }
  143. .login-info-item {
  144. font-size: 14px;
  145. line-height: 2.5;
  146. color: rgb(33, 37, 41);
  147. }
  148. .login-border {
  149. width: 50%;
  150. float: left;
  151. box-sizing: border-box;
  152. }
  153. .login-main {
  154. margin: 0 auto;
  155. width: 50%;
  156. box-sizing: border-box;
  157. }
  158. .login-main > h3 {
  159. margin-bottom: 20px;
  160. }
  161. .login-main > p {
  162. color: #76838f;
  163. }
  164. .login-title {
  165. display: flex;
  166. justify-content: center;
  167. align-items: center;
  168. margin-bottom: 40px;
  169. font-weight: 500;
  170. font-size: 22px;
  171. text-align: center;
  172. letter-spacing: 4px;
  173. }
  174. .login-select {
  175. input {
  176. color: #333;
  177. font-size: 18px;
  178. font-weight: 400;
  179. border: none;
  180. text-align: center;
  181. }
  182. }
  183. .login-menu {
  184. width: 100%;
  185. text-align: center;
  186. a {
  187. color: rgb(153, 153, 153);
  188. font-size: 12px;
  189. margin: 0px 8px;
  190. }
  191. }
  192. .login-index {
  193. margin-top: 40px !important;
  194. width: 180px;
  195. height: 48px;
  196. text-align: center;
  197. border-radius: 50px !important;
  198. background: transparent !important;
  199. color: #333 !important;
  200. font-size: 16px !important;
  201. border: 1px solid rgb(152, 22, 244);
  202. }
  203. .login-submit {
  204. display: block !important;
  205. margin: 40px auto 10px auto !important;
  206. width: 200px;
  207. height: 48px;
  208. font-size: 14px !important;
  209. text-align: center;
  210. border-radius: 50px !important;
  211. border: 0px;
  212. box-shadow: rgba(152, 22, 244, 0.19) 0px 5px 10px 2px;
  213. }
  214. .login-form {
  215. margin: 10px 0;
  216. i {
  217. color: #999;
  218. }
  219. .el-form-item__content {
  220. width: 100%;
  221. }
  222. .el-form-item {
  223. margin-bottom: 12px;
  224. }
  225. .el-input {
  226. input {
  227. padding-bottom: 10px;
  228. text-indent: 5px;
  229. background: transparent;
  230. border: none;
  231. border-radius: 0;
  232. color: #333;
  233. border-bottom: 1px solid rgb(235, 237, 242);
  234. }
  235. .el-input__prefix {
  236. i {
  237. padding: 0 5px;
  238. font-size: 16px !important;
  239. }
  240. }
  241. }
  242. }
  243. .login-code {
  244. display: flex;
  245. align-items: center;
  246. justify-content: space-around;
  247. margin: 0 0 0 10px;
  248. }
  249. .login-code-img {
  250. margin-top: 2px;
  251. width: 100px;
  252. height: 38px;
  253. background-color: #fdfdfd;
  254. border: 1px solid #f0f0f0;
  255. color: #333;
  256. font-size: 14px;
  257. font-weight: bold;
  258. letter-spacing: 5px;
  259. line-height: 38px;
  260. text-indent: 5px;
  261. text-align: center;
  262. }
  263. </style>