merchant.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <div class="wrap">
  3. <div class="inner">
  4. <div class="img">
  5. <img src="../../assets/cover.svg">
  6. </div>
  7. <a-card :bordered="false" class="login-box">
  8. <template #title>
  9. <div class="title">
  10. <b>OTA商户管理平台</b> <a-tag color="orange">用户登录</a-tag>
  11. </div>
  12. </template>
  13. <a-form
  14. ref="formRef"
  15. :model="formState"
  16. :wrapper-col="{ span: 24 }"
  17. >
  18. <a-form-item
  19. :rules="{
  20. required: true,
  21. message: '请输入商户名'
  22. }"
  23. name="projectName">
  24. <a-input v-model:value="formState.projectName" placeholder="商户名">
  25. <template #prefix><ShopOutlined style="color: rgba(0, 0, 0, 0.25)" /></template>
  26. </a-input>
  27. </a-form-item>
  28. <a-form-item
  29. :rules="{
  30. required: true,
  31. message: '请输入用户名'
  32. }"
  33. name="userName">
  34. <a-input v-model:value="formState.userName" placeholder="用户名">
  35. <template #prefix><UserOutlined style="color: rgba(0, 0, 0, 0.25)" /></template>
  36. </a-input>
  37. </a-form-item>
  38. <a-form-item
  39. :rules="{
  40. required: true,
  41. message: '请输入密码'
  42. }"
  43. name="password">
  44. <a-input v-model:value="formState.password" type="password" placeholder="密码">
  45. <template #prefix><LockOutlined style="color: rgba(0, 0, 0, 0.25)" /></template>
  46. </a-input>
  47. </a-form-item>
  48. <a-form-item >
  49. <a-button block type="primary" html-type="submit" @click="submitForm">
  50. 登录
  51. </a-button>
  52. </a-form-item>
  53. <div class="register">
  54. <span>没有商户?</span><a-button type="link" @click="$refs.modal.showModal()">免费注册</a-button>
  55. </div>
  56. <!-- <div style="text-align:right">
  57. <router-link to="/"> 客户端登录 >></router-link>
  58. </div> -->
  59. </a-form>
  60. </a-card>
  61. </div>
  62. <!-- <a :href="admin_url" class="link">管理端</a> -->
  63. <Modal ref="modal"></Modal>
  64. <Footer></Footer>
  65. </div>
  66. </template>
  67. <script setup>
  68. import router from '@/router'
  69. import { message } from 'ant-design-vue'
  70. import Modal from './Modal.vue'
  71. import md5 from 'md5'
  72. import { encrypt } from '@/utils'
  73. import { login, logout } from '@/api/login'
  74. import { reactive, ref } from 'vue'
  75. import { UserOutlined, LockOutlined, MailOutlined, ShopOutlined } from '@ant-design/icons-vue'
  76. import Footer from './Footer.vue'
  77. const admin_url = window.location.href.replace('merchant', 'merchant_mgt')
  78. const appType = import.meta.env.MODE
  79. const formRef = ref()
  80. const formState = reactive(
  81. !import.meta.env.PROD
  82. ? {
  83. projectName: 'demo',
  84. userName: 'admin',
  85. password: 'Aa123456'
  86. }
  87. : {
  88. projectName: '',
  89. password: '', // 123456 md5加密
  90. userName: ''
  91. }
  92. )
  93. const state = reactive({
  94. time: 60,
  95. smsSendBtn: false
  96. })
  97. const submitForm = () => {
  98. formRef.value.validate()
  99. .then(async() => {
  100. const params = { ...formState, password: encrypt(formState.password) }
  101. // await logout()
  102. login(params).then(res => {
  103. message.success('登录成功')
  104. setTimeout(() => {
  105. router.push('/order/index')
  106. }, 500)
  107. })
  108. })
  109. .catch(error => {
  110. console.log('error', error)
  111. })
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. @import './index.scss';
  116. .register{
  117. text-align: right;
  118. margin-top: -15px;
  119. span{
  120. color: grey;
  121. }
  122. }
  123. </style>