|
@@ -22,6 +22,9 @@
|
|
<div v-if="account" class="form-box mt-4">
|
|
<div v-if="account" class="form-box mt-4">
|
|
<el-form ref="formRef" :model="formValue" :rules="formRules" label-position="left" label-width="0px"
|
|
<el-form ref="formRef" :model="formValue" :rules="formRules" label-position="left" label-width="0px"
|
|
size="large">
|
|
size="large">
|
|
|
|
+ <el-form-item prop="tenantId" v-if="tenantMode">
|
|
|
|
+ <el-input v-model="formValue.tenantId" clearable placeholder="租户ID"/>
|
|
|
|
+ </el-form-item>
|
|
<el-form-item prop="username">
|
|
<el-form-item prop="username">
|
|
<el-input v-model="formValue.username" clearable placeholder="账号"/>
|
|
<el-input v-model="formValue.username" clearable placeholder="账号"/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -65,28 +68,41 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import {ref} from "vue";
|
|
|
|
|
|
+import {ref, onMounted} from "vue";
|
|
import router from '~src/router/index';
|
|
import router from '~src/router/index';
|
|
import {useAppStore} from "~src/store";
|
|
import {useAppStore} from "~src/store";
|
|
import {useAppLogin} from "~sto/user";
|
|
import {useAppLogin} from "~sto/user";
|
|
-import {formValidate} from "js-fast-way"
|
|
|
|
|
|
+import {formValidate, getToObjVal} from "js-fast-way"
|
|
import HcPicVue from './components/pic.vue'
|
|
import HcPicVue from './components/pic.vue'
|
|
import HcHomeBg from './components/home-bg.vue'
|
|
import HcHomeBg from './components/home-bg.vue'
|
|
|
|
+import {getTenantID} from "~api/user";
|
|
|
|
+import {getTopUrl} from "~uti/tools";
|
|
|
|
|
|
const userStore = useAppStore()
|
|
const userStore = useAppStore()
|
|
userStore.clearStoreData() //先清理下缓存
|
|
userStore.clearStoreData() //先清理下缓存
|
|
|
|
|
|
//切换登录类型
|
|
//切换登录类型
|
|
const account = ref(true)
|
|
const account = ref(true)
|
|
|
|
+const tenantMode = ref(true)
|
|
|
|
+
|
|
const accountClick = () => {
|
|
const accountClick = () => {
|
|
account.value = !account.value;
|
|
account.value = !account.value;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
+ getTenantIdApi()
|
|
|
|
+})
|
|
|
|
+
|
|
//表单
|
|
//表单
|
|
const formRef = ref(null);
|
|
const formRef = ref(null);
|
|
const checkbox = ref(false)
|
|
const checkbox = ref(false)
|
|
const formValue = ref({tenantId: "000000", username: '', password: '', type: "account"})
|
|
const formValue = ref({tenantId: "000000", username: '', password: '', type: "account"})
|
|
const formRules = {
|
|
const formRules = {
|
|
|
|
+ tenantId: {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入租户ID",
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ },
|
|
username: {
|
|
username: {
|
|
required: true,
|
|
required: true,
|
|
message: "请输入账号",
|
|
message: "请输入账号",
|
|
@@ -104,6 +120,19 @@ const passwordKeyUp = (e) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//获取租户id
|
|
|
|
+const getTenantIdApi = async () => {
|
|
|
|
+ const {error, code, data} = await getTenantID(getTopUrl())
|
|
|
|
+ const res = getToObjVal(data)
|
|
|
|
+ if (!error && code === 200 && res) {
|
|
|
|
+ tenantMode.value = false
|
|
|
|
+ formValue.value.tenantId = res.tenantId
|
|
|
|
+ } else {
|
|
|
|
+ tenantMode.value = true
|
|
|
|
+ formValue.value.tenantId = "000000"
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
//登录
|
|
//登录
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
const formValidateClick = async () => {
|
|
const formValidateClick = async () => {
|