| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <div class="wrap">
- <div class="inner">
- <div class="img">
- <img src="../../assets/cover.svg">
- </div>
- <a-card :bordered="false" class="login-box">
- <template #title>
- <div class="title">
- <b>OTA商户管理平台</b> <a-tag color="orange">用户登录</a-tag>
- </div>
- </template>
- <a-form
- ref="formRef"
- :model="formState"
- :wrapper-col="{ span: 24 }"
- >
- <a-form-item
- :rules="{
- required: true,
- message: '请输入商户名'
- }"
- name="projectName">
- <a-input v-model:value="formState.projectName" placeholder="商户名">
- <template #prefix><ShopOutlined style="color: rgba(0, 0, 0, 0.25)" /></template>
- </a-input>
- </a-form-item>
- <a-form-item
- :rules="{
- required: true,
- message: '请输入用户名'
- }"
- name="userName">
- <a-input v-model:value="formState.userName" placeholder="用户名">
- <template #prefix><UserOutlined style="color: rgba(0, 0, 0, 0.25)" /></template>
- </a-input>
- </a-form-item>
- <a-form-item
- :rules="{
- required: true,
- message: '请输入密码'
- }"
- name="password">
- <a-input v-model:value="formState.password" type="password" placeholder="密码">
- <template #prefix><LockOutlined style="color: rgba(0, 0, 0, 0.25)" /></template>
- </a-input>
- </a-form-item>
- <a-form-item >
- <a-button block type="primary" html-type="submit" @click="submitForm">
- 登录
- </a-button>
- </a-form-item>
- <div class="register">
- <span>没有商户?</span><a-button type="link" @click="$refs.modal.showModal()">免费注册</a-button>
- </div>
- <!-- <div style="text-align:right">
- <router-link to="/"> 客户端登录 >></router-link>
- </div> -->
- </a-form>
- </a-card>
- </div>
- <!-- <a :href="admin_url" class="link">管理端</a> -->
- <Modal ref="modal"></Modal>
- <Footer></Footer>
- </div>
- </template>
- <script setup>
- import router from '@/router'
- import { message } from 'ant-design-vue'
- import Modal from './Modal.vue'
- import md5 from 'md5'
- import { encrypt } from '@/utils'
- import { login, logout } from '@/api/login'
- import { reactive, ref } from 'vue'
- import { UserOutlined, LockOutlined, MailOutlined, ShopOutlined } from '@ant-design/icons-vue'
- import Footer from './Footer.vue'
- const admin_url = window.location.href.replace('merchant', 'merchant_mgt')
- const appType = import.meta.env.MODE
- const formRef = ref()
- const formState = reactive(
- !import.meta.env.PROD
- ? {
- projectName: 'demo',
- userName: 'admin',
- password: 'Aa123456'
- }
- : {
- projectName: '',
- password: '', // 123456 md5加密
- userName: ''
- }
- )
- const state = reactive({
- time: 60,
- smsSendBtn: false
- })
- const submitForm = () => {
- formRef.value.validate()
- .then(async() => {
- const params = { ...formState, password: encrypt(formState.password) }
- // await logout()
- login(params).then(res => {
- message.success('登录成功')
- setTimeout(() => {
- router.push('/order/index')
- }, 500)
- })
- })
- .catch(error => {
- console.log('error', error)
- })
- }
- </script>
- <style lang="scss" scoped>
- @import './index.scss';
- .register{
- text-align: right;
- margin-top: -15px;
- span{
- color: grey;
- }
- }
- </style>
|