账号密码登录
continuous-integration/drone/push Build is passing Details

This commit is contained in:
余同学 2024-11-13 19:02:08 +08:00
parent 4ec91760a1
commit 3d5fd892a5
4 changed files with 102 additions and 15 deletions

View File

@ -15,9 +15,8 @@ export const mer_admin = {
* @returns
*/
loginByAccount: (params) => {
return $http.post(`/auth/login`, {
return $http.post(`/admin-api/auth/login`, {
...params,
type: 1,
});
},
loginByMobile: (params) => {
@ -155,5 +154,4 @@ export const mer_admin = {
params: { id },
});
},
};

View File

@ -3,9 +3,7 @@
<div class="site-content__wrapper">
<div class="site-content">
<div class="brand-info">
<h1 class="brand-info__text" style="margin-left: 0px">
大妈集市商户端
</h1>
<h1>大妈集市商户端</h1>
<!-- <h1 class="brand-info__text1" style="margin-left: 145px">
登录
</h1> -->
@ -13,6 +11,12 @@
</div>
<div class="login-main">
<h3 class="login-title">大妈集市商户端登录</h3>
<div class="brand-info__text" style="margin-left: 0px">
<el-radio-group v-model="value">
<el-radio-button :label="true">验证码登入</el-radio-button>
<el-radio-button :label="false">账号登录</el-radio-button>
</el-radio-group>
</div>
<el-tabs
v-if="false"
:stretch="true"
@ -102,6 +106,7 @@
</el-tab-pane>
</el-tabs>
<el-form
v-if="value"
:model="loginByYZMForm"
:rules="loginByYZMFormRule"
ref="loginByYZMRef"
@ -133,6 +138,47 @@
>
</el-form-item>
</el-form>
<el-form
v-else
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
status-icon
>
<el-form-item prop="userName">
<el-input
v-model="dataForm.userName"
placeholder="帐号"
></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="dataForm.password"
type="password"
placeholder="密码"
></el-input>
</el-form-item>
<!-- <el-form-item prop="captcha">
<el-row :gutter="20">
<el-col :span="14">
<el-input v-model="dataForm.captcha" placeholder="验证码">
</el-input>
</el-col>
<el-col :span="10" class="login-captcha">
<img :src="captchaPath" @click="getCaptcha()" alt="" />
</el-col>
</el-row>
</el-form-item> -->
<el-form-item>
<el-button
class="login-btn-submit"
type="primary"
@click="handleLogin()"
>登录</el-button
>
</el-form-item>
</el-form>
</div>
</div>
</div>
@ -144,6 +190,7 @@ import { getUUID } from "@/utils";
export default {
data() {
return {
value: true,
loginWay: "code_login",
loginType: "教育局",
mobileCodeCountDown: 0,
@ -256,6 +303,31 @@ export default {
});
});
},
handleLogin() {
const _loginTypeMapper = {
管理员: "ROLE_ADMIN",
教育局: "ROLE_EDU",
学校: "ROLE_SCHOOL",
教师: "ROLE_TEACHER",
};
this.$refs["dataForm"].validate((valid) => {
console.log("账号密码登录");
this.$api.mer_admin
.loginByAccount({
// role: _loginTypeMapper[this.loginType],
userName: this.dataForm.userName,
password: this.dataForm.password,
})
.then(({ data }) => {
console.log("data", data);
this.$cookie.set("token", data.data.token);
this.$router.replace({ name: "home" });
})
.catch((err) => {
console.log(err);
});
});
},
//
getCode() {
//

View File

@ -21,10 +21,7 @@
></el-input>
</el-form-item>
<el-form-item v-if="marketList.length > 0" label="摊铺">
<el-select
v-model="searchForm.linkId"
placeholder="请选择活动区域"
>
<el-select v-model="searchForm.linkId" placeholder="请选择摊铺">
<el-option
v-for="item in marketList"
:key="item.marketId"
@ -36,6 +33,7 @@
<el-button type="primary" @click="$refs.oTable.reload()"
>搜索</el-button
>
<el-button type="primary" @click="Reset">重置</el-button>
</el-form>
<el-button type="primary" @click="addFareTemplate"
>添加运费模板</el-button
@ -104,6 +102,14 @@ export default {
this.$refs.oTable.complete(false);
});
},
Reset() {
this.searchForm = {
name: "",
linkId: JSON.parse(sessionStorage.getItem("userInfo")).markets[0]
.marketId,
};
this.$refs.oTable.reload();
},
addFareTemplate() {
this.$refs.addTemplate.toggle().add(this.searchForm.linkId);
},

View File

@ -12,24 +12,34 @@
>
<template slot="tableTop">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="平台分类">
<!-- <el-form-item label="平台分类">
<el-select v-model="formInline.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
<el-form-item label="商户分类">
</el-form-item> -->
<!-- <el-form-item label="商户分类">
<el-select v-model="formInline.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="商品搜索">
<el-input
v-model="formInline.name"
placeholder="商品搜索"
></el-input>
</el-form-item>
<el-form-item v-if="marketList.length > 0" label="摊铺">
<el-select v-model="formInline.marketId" placeholder="请选择摊铺">
<el-option
v-for="item in marketList"
:key="item.marketId"
:label="item.marketName"
:value="item.marketId"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="$refs.oTable.reload()"
>查询</el-button
@ -173,7 +183,8 @@ export default {
Reset() {
this.formInline = {
name: "",
// region: "",
marketId: JSON.parse(sessionStorage.getItem("userInfo")).markets[0]
.marketId,
};
this.$refs.oTable.reload();
},