This commit is contained in:
xyc 2025-06-19 15:28:27 +08:00
parent 827ff4994b
commit 3f715f361b
5 changed files with 244 additions and 21 deletions

View File

@ -0,0 +1,206 @@
<template>
<div class="tenant-selector">
<!-- 添加返回按钮 -->
<div class="back-button" @click="handleBack">
<i class="el-icon-arrow-left"></i> 返回
</div>
<div class="login-header">
<h2>选择租户登录</h2>
<p>请选择您要登录的租户</p>
</div>
<div class="tenant-list">
<div
v-for="tenant in tenants"
:key="tenant.id"
class="tenant-item"
:class="{ 'active': selectedTenant === tenant.id }"
@click="selectTenant(tenant)"
>
<div class="tenant-avatar">
{{ tenant.name.charAt(0).toUpperCase() }}
</div>
<div class="tenant-info">
<h3>{{ tenant.name }}</h3>
<p>{{ tenant.description || '暂无描述' }}</p>
</div>
</div>
</div>
<div class="login-actions">
<button
class="login-btn"
:disabled="!selectedTenant"
@click="confirmLogin"
>
确认登录
</button>
</div>
</div>
</template>
<script>
export default {
props: {
tenants: {
type: Array,
required: true,
default: () => []
}
},
data() {
return {
selectedTenant: null
}
},
methods: {
selectTenant(tenant) {
this.selectedTenant = tenant.id;
},
confirmLogin() {
if (this.selectedTenant) {
this.$emit('tenant-selected', this.selectedTenant);
}
},
handleBack() {
this.$emit('back');
}
}
}
</script>
<style scoped>
.tenant-selector {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.login-header {
text-align: center;
margin-bottom: 24px;
}
.login-header h2 {
font-size: 20px;
color: #333;
margin-bottom: 8px;
}
.login-header p {
font-size: 14px;
color: #999;
}
.tenant-list {
margin-bottom: 24px;
}
.tenant-item {
display: flex;
align-items: center;
padding: 12px 16px;
border: 1px solid #eaeaea;
border-radius: 6px;
margin-bottom: 12px;
cursor: pointer;
transition: all 0.3s;
}
.tenant-item:hover {
border-color: #1890ff;
}
.tenant-item.active {
border-color: #1890ff;
background-color: #f0f7ff;
}
.tenant-avatar {
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
background-color: #1890ff;
color: white;
border-radius: 50%;
margin-right: 12px;
font-weight: bold;
}
.tenant-info h3 {
font-size: 16px;
color: #333;
margin-bottom: 4px;
}
.tenant-info p {
font-size: 12px;
color: #999;
}
.login-actions {
text-align: center;
}
.login-btn {
width: 100%;
height: 40px;
background-color: #1890ff;
color: white;
border: none;
border-radius: 4px;
font-size: 14px;
cursor: pointer;
transition: background-color 0.3s;
}
.login-btn:hover {
background-color: #40a9ff;
}
.login-btn:disabled {
background-color: #d9d9d9;
cursor: not-allowed;
}
.tenant-selector {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
position: relative;
}
.back-button {
position: absolute;
top: 20px;
left: 20px;
color: #1890ff;
cursor: pointer;
font-size: 14px;
display: flex;
align-items: center;
}
.back-button:hover {
color: #40a9ff;
}
.back-button i {
margin-right: 4px;
}
.login-header {
text-align: center;
margin-bottom: 24px;
padding-top: 10px; /* 为返回按钮留出空间 */
}
</style>

View File

@ -70,7 +70,7 @@ export function updateUser(data) {
// 删除用户
export function delUser(userId) {
return request({
url: '/system/user/delete?id=' + userId,
url: '/inspectionStaff/delete?id=' + userId,
method: 'delete'
})
}

View File

@ -2,7 +2,7 @@
<div class="container">
<!-- <div class="logo"></div>-->
<!-- 登录区域 -->
<div class="content">
<div class="content" v-show="!showTenantList">
<!-- 配图 -->
<div class="pic"></div>
<!-- 表单 -->
@ -13,7 +13,7 @@
</h2>
<!-- 表单 -->
<div class="form-cont">
<div class="form-cont" >
<el-tabs class="form" v-model="loginForm.loginType" style=" float:none;">
<el-tab-pane label="账号密码登录" name="uname">
</el-tab-pane>
@ -94,25 +94,35 @@
</el-form>
</div>
</div>
</div>
</div>
<el-dialog
title="提示"
:visible.sync="showTenantList"
width="30%">
<el-radio-group v-model="tenant">
<el-radio-button :label="item" v-for="item in tenantList">{{item.name}}</el-radio-button>
</el-radio-group>
<span slot="footer" class="dialog-footer">
<el-button @click="showTenantList = false"> </el-button>
<el-button type="primary" @click="selectTenant"> </el-button>
</span>
</el-dialog>
<div v-if="showTenantList" style="width: 500px; position: relative;">
<tenant-select
:tenants="tenantList"
@tenant-selected="selectTenant"
@back="showTenantList = false"
></tenant-select>
</div>
<!-- <el-dialog-->
<!-- title="提示"-->
<!-- :visible.sync="showTenantList"-->
<!-- width="30%">-->
<!-- <el-radio-group v-model="tenant">-->
<!-- <el-radio-button :label="item" v-for="item in tenantList">{{item.name}}</el-radio-button>-->
<!-- </el-radio-group>-->
<!-- <span slot="footer" class="dialog-footer">-->
<!-- <el-button @click="showTenantList = false"> </el-button>-->
<!-- <el-button type="primary" @click="selectTenant"> </el-button>-->
<!-- </span>-->
<!-- </el-dialog>-->
<!-- 图形验证码 -->
<Verify ref="verify" :captcha-type="'blockPuzzle'" :img-size="{width:'400px',height:'200px'}"
@success="handleLogin" />
<!-- footer -->
<div class="footer">
<!-- Copyright © 2020-2022 iocoder.cn All Rights Reserved.-->
@ -136,12 +146,14 @@ import {
} from "@/utils/auth";
import Verify from '@/components/Verifition/Verify';
import TenantSelect from "@/components/tenantSelect/tenantSelect.vue";
import {resetUserPwd} from "@/api/system/user";
export default {
name: "Login",
components: {
Verify
Verify,
TenantSelect
},
data() {
return {
@ -258,15 +270,17 @@ export default {
tenantName: tenantName ? tenantName : this.loginForm.tenantName,
};
},
selectTenant(){
selectTenant(tenant){
this.tenant = tenant
if (!this.tenant) {
this.$message.error("请选择租户")
}
console.log('当前租户',this.tenant)
setTenantId(this.tenant.id)
setTenantId(this.tenant)
this.handleLogin()
},
handleLogin(captchaParams) {
//
this.$refs.loginForm.validate(async valid => {
console.log("登录", this.loginForm)
if (valid) {
@ -295,6 +309,7 @@ export default {
});
}).catch(() => {
this.loading = false;
this.showTenantList = false
});
}
});

View File

@ -409,7 +409,7 @@
this.$set(this.dict.type,this.$options.dicts[i],res.data)
})
}
this.getpid()
this.getList();
this.customerSource();
},
methods: {

View File

@ -26,7 +26,7 @@
</el-form-item>
<el-form-item label="角色" prop="status">
<el-select v-model="queryParams.roleId" placeholder="角色" clearable style="width: 240px">
<el-option v-for="dict in dict.type.inspection_use_role.slice(0, 3)" :key="dict.value" :label="dict.label"
<el-option v-for="dict in dict.type.inspection_use_role" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
@ -463,7 +463,8 @@ export default {
this.$set(this.dict.type, this.$options.dicts[i], res.data)
})
}
this.getpid()
// this.getpid()
this.getList();
this.customerSource();
},
methods: {
@ -640,6 +641,7 @@ export default {
this.BankAccountList.push(temp)
})
})
this.loading = false;
},
//
cancel() {