login.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div id="login">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <div class="w_1200">
  6. <el-col :span="24" class="one">
  7. <el-col :span="24" class="title">环南湖科创先导区双创服务平台</el-col>
  8. <el-col :span="24" class="info">
  9. <el-tabs v-model="activeName" :stretch="true">
  10. <el-tab-pane label="管理登录" name="first">
  11. <el-col :span="24" class="form">
  12. <el-form ref="form" :model="form">
  13. <el-form-item>
  14. <el-input v-model="form.phone" prefix-icon="el-icon-user-solid" maxlength="11" placeholder="请输入服务机构账号"></el-input>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-input v-model="form.passwd" prefix-icon="el-icon-lock" placeholder="请输入账号密码" show-password></el-input>
  18. </el-form-item>
  19. <el-col :span="24" class="btn">
  20. <el-button type="danger" @click="resetBtn">取消登录</el-button>
  21. <el-button type="primary" @click="thrSubmit">提交登录</el-button>
  22. </el-col>
  23. </el-form>
  24. </el-col>
  25. </el-tab-pane>
  26. <el-tab-pane label="企业登录" name="second">
  27. <el-col :span="24" class="form">
  28. <el-form ref="form" :model="form">
  29. <el-form-item>
  30. <el-input v-model="form.phone" prefix-icon="el-icon-user-solid" placeholder="请输入企业账号"></el-input>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-input v-model="form.passwd" prefix-icon="el-icon-lock" placeholder="请输入账号密码" show-password></el-input>
  34. </el-form-item>
  35. <el-col :span="24" class="btn">
  36. <el-button type="danger" @click="resetBtn">取消登录</el-button>
  37. <el-button type="primary" @click="oneSubmit">提交登录</el-button>
  38. </el-col>
  39. </el-form>
  40. </el-col>
  41. </el-tab-pane>
  42. <el-tab-pane label="机构登录" name="third">
  43. <el-col :span="24" class="form">
  44. <el-form ref="form" :model="form">
  45. <el-form-item>
  46. <el-input v-model="form.phone" prefix-icon="el-icon-user-solid" maxlength="11" placeholder="请输入中介机构账号"></el-input>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-input v-model="form.passwd" prefix-icon="el-icon-lock" placeholder="请输入账号密码" show-password></el-input>
  50. </el-form-item>
  51. <el-col :span="24" class="btn">
  52. <el-button type="danger" @click="resetBtn">取消登录</el-button>
  53. <el-button type="primary" @click="twoSubmit">提交登录</el-button>
  54. </el-col>
  55. </el-form>
  56. </el-col>
  57. </el-tab-pane>
  58. <el-tab-pane label="专家登录" name="fourth">
  59. <el-col :span="24" class="form">
  60. <el-form ref="form" :model="form">
  61. <el-form-item>
  62. <el-input v-model="form.phone" prefix-icon="el-icon-user-solid" maxlength="11" placeholder="请输入专家账号"></el-input>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-input v-model="form.passwd" prefix-icon="el-icon-lock" placeholder="请输入账号密码" show-password></el-input>
  66. </el-form-item>
  67. <el-col :span="24" class="btn">
  68. <el-button type="danger" @click="resetBtn">取消登录</el-button>
  69. <el-button type="primary" @click="fourSubmit">提交登录</el-button>
  70. </el-col>
  71. </el-form>
  72. </el-col>
  73. </el-tab-pane>
  74. </el-tabs>
  75. </el-col>
  76. </el-col>
  77. </div>
  78. </el-col>
  79. </el-row>
  80. </div>
  81. </template>
  82. <script>
  83. const _ = require('lodash');
  84. import { mapState, createNamespacedHelpers } from 'vuex';
  85. const { mapActions: adminLogin } = createNamespacedHelpers('login');
  86. const { mapActions: organization } = createNamespacedHelpers('organization');
  87. const { mapActions: mechanism } = createNamespacedHelpers('mechanism');
  88. const { mapActions: expertLogin } = createNamespacedHelpers('expert');
  89. export default {
  90. name: 'login',
  91. props: {},
  92. components: {},
  93. data: function () {
  94. return {
  95. activeName: 'first',
  96. loginBj: require('@a/loginBj.jpg'),
  97. form: {},
  98. // // 管理登录
  99. // adminForm: {},
  100. // // 企业登录
  101. // form: {},
  102. // // 机构登录
  103. // interForm: {},
  104. // // 专家登录
  105. // expertForm: {},
  106. };
  107. },
  108. created() {},
  109. methods: {
  110. // 管理登录
  111. ...adminLogin({ adminLogin: 'login' }),
  112. // 企业
  113. ...organization(['login']),
  114. // 机构
  115. ...mechanism({ interLogin: 'login' }),
  116. // 专家
  117. ...expertLogin({ expertLogin: 'login' }),
  118. // 管理员
  119. async thrSubmit() {
  120. let data = _.get(this, 'form');
  121. data.code_phone = data.phone;
  122. const res = await this.adminLogin(data);
  123. if (this.$checkRes(res)) {
  124. this.$router.push({ path: '/adminCenter/homeIndex' });
  125. }
  126. },
  127. // 企业
  128. async oneSubmit() {
  129. let data = _.get(this, 'form');
  130. data.institution_code = data.phone;
  131. const res = await this.login(data);
  132. if (this.$checkRes(res)) {
  133. this.$router.push({ path: '/adminCenter/homeIndex' });
  134. }
  135. },
  136. // 中介
  137. async twoSubmit() {
  138. let data = _.get(this, 'form');
  139. const res = await this.interLogin(data);
  140. if (this.$checkRes(res)) {
  141. this.$router.push({ path: '/adminCenter/homeIndex' });
  142. }
  143. },
  144. // 专家
  145. async fourSubmit() {
  146. let data = _.get(this, 'form');
  147. const res = await this.expertLogin(data);
  148. if (this.$checkRes(res)) {
  149. this.$router.push({ path: '/adminCenter/homeIndex' });
  150. }
  151. },
  152. resetBtn() {
  153. this.$router.push({ path: '/' });
  154. },
  155. },
  156. computed: {
  157. ...mapState(['user']),
  158. },
  159. metaInfo() {
  160. return { title: this.$route.meta.title };
  161. },
  162. watch: {
  163. test: {
  164. deep: true,
  165. immediate: true,
  166. handler(val) {},
  167. },
  168. },
  169. };
  170. </script>
  171. <style lang="less" scoped>
  172. .main {
  173. background: url('~@/assets/loginBj.jpg');
  174. background-size: 100% 100%;
  175. background-repeat: no-repeat;
  176. height: 100vh;
  177. .one {
  178. padding: 6% 26%;
  179. .title {
  180. text-align: center;
  181. font-size: 35px;
  182. font-weight: bold;
  183. font-family: cursive;
  184. padding: 60px 0;
  185. color: #fff;
  186. }
  187. .info {
  188. height: 400px;
  189. padding: 30px 50px;
  190. border-radius: 5px;
  191. box-shadow: 0 0 5px #f1f1f1;
  192. background-color: #ffffff5f;
  193. .form {
  194. margin: 20px 0 0 0;
  195. .btn {
  196. text-align: center;
  197. margin: 15px 0 0 0;
  198. }
  199. }
  200. /deep/.el-tabs__item {
  201. font-weight: bold;
  202. font-size: 18px;
  203. height: 60px;
  204. line-height: 60px;
  205. }
  206. }
  207. }
  208. }
  209. </style>