|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="login-container flex-row" v-if="showImg" v-loading="loading">
|
|
|
+ <div class="login-container flex-row" v-if="showImg && isAllow" v-loading="loading">
|
|
|
<el-switch class="switch" v-model="getThemeConfig.isIsDark" size="large" inline-prompt @change="onAddDarkChange" :active-icon="Sunny" :inactive-icon="Moon" style="--el-switch-on-color: #fff; --el-switch-off-color: #151515"></el-switch>
|
|
|
<div class="part left">
|
|
|
<div class="flex logo">
|
|
@@ -8,11 +8,17 @@
|
|
|
</div>
|
|
|
<el-image class="img" fit="contain" :src="sysinfo.systemLoginPIC" />
|
|
|
<div>
|
|
|
- <span class="text" v-if="sysinfo.buildTime">服务端版本:{{ sysinfo.buildVersion }} </span>
|
|
|
- <span class="text" v-if="sysinfo.buildTime">{{ dayjs(sysinfo.buildTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
|
|
- <div style="height: 10px;"></div>
|
|
|
- <span class="text" v-if="versionInfo.version">前端版本:{{ versionInfo.version }} </span>
|
|
|
- <span class="text" v-if="versionInfo.updateTime">{{ versionInfo.updateTime }}</span>
|
|
|
+ <span class="text" v-if="sysinfo.buildTime">服务端版本:{{ sysinfo.buildVersion }}
|
|
|
+ </span>
|
|
|
+ <span class="text" v-if="sysinfo.buildTime">{{
|
|
|
+ dayjs(sysinfo.buildTime).format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ }}</span>
|
|
|
+ <div style="height: 10px"></div>
|
|
|
+ <span class="text" v-if="versionInfo.version">前端版本:{{ versionInfo.version }}
|
|
|
+ </span>
|
|
|
+ <span class="text" v-if="versionInfo.updateTime">{{
|
|
|
+ versionInfo.updateTime
|
|
|
+ }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="part">
|
|
@@ -23,72 +29,76 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, computed, ref } from 'vue';
|
|
|
-import Account from '/@/views/login/component/account-tenant.vue';
|
|
|
-import { useStore } from '/@/store/index';
|
|
|
-import { Sunny, Moon } from '@element-plus/icons-vue';
|
|
|
-import dayjs from 'dayjs';
|
|
|
-import api from '/@/api/system';
|
|
|
-import tenantApi from '/@/api/modules/tenant';
|
|
|
-import axios from 'axios';
|
|
|
-import { useRoute } from 'vue-router';
|
|
|
-import { ElMessage } from 'element-plus';
|
|
|
+import { reactive, computed, ref } from "vue";
|
|
|
+import Account from "/@/views/login/component/account-tenant.vue";
|
|
|
+import { useStore } from "/@/store/index";
|
|
|
+import { Sunny, Moon } from "@element-plus/icons-vue";
|
|
|
+import dayjs from "dayjs";
|
|
|
+import api from "/@/api/system";
|
|
|
+import tenantApi from "/@/api/modules/tenant";
|
|
|
+import axios from "axios";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+import { setSystemInfo, setTenantInfo } from "/@/utils/auth";
|
|
|
+import other from "/@/utils/other";
|
|
|
|
|
|
const store = useStore();
|
|
|
const route = useRoute();
|
|
|
-const tenant = route.params?.tenant as string
|
|
|
-const isAllow = ref(true)
|
|
|
-const loading = ref(true)
|
|
|
+const tenant = route.params?.tenant as string;
|
|
|
+const isAllow = ref(true);
|
|
|
+const loading = ref(true);
|
|
|
|
|
|
-const showImg = ref(false)
|
|
|
-const showSSO = ref(false)
|
|
|
+const showImg = ref(false);
|
|
|
+const showSSO = ref(false);
|
|
|
const sysinfo = reactive<any>({
|
|
|
- buildVersion: '',
|
|
|
- buildTime: '',
|
|
|
- systemName: '',
|
|
|
- systemLogo: '',
|
|
|
- systemLoginPIC: '',
|
|
|
-})
|
|
|
-
|
|
|
-api.sysinfo().then((res: any) => {
|
|
|
- // Object.assign(sysinfo, res)
|
|
|
- sysinfo.buildVersion = res.buildVersion
|
|
|
- sysinfo.buildTime = res.buildTime
|
|
|
- const isSSOEnabled = window.atob(res.target).split('|')[4]
|
|
|
- if (isSSOEnabled == '1') {
|
|
|
- showSSO.value = true
|
|
|
- }
|
|
|
-}).finally(() => showImg.value = true)
|
|
|
-
|
|
|
-// tenantApi.get(tenant).then((res: any) => {
|
|
|
-// console.log(res)
|
|
|
-// }).catch(() => {
|
|
|
-// isAllow.value = false
|
|
|
-// }).finally(() => {
|
|
|
-loading.value = false
|
|
|
-// })
|
|
|
-
|
|
|
-const res = {
|
|
|
- "name": "测试租户",
|
|
|
- "code": "ttt",
|
|
|
- "description": "adsfasdfadsf",
|
|
|
- "logoMini": "https://zhgy.sagoo.cn/base-api/upload_file/2024-11-11/d5jfenttbyhtxcsess.png",
|
|
|
- "logoPic": "https://zhgy.sagoo.cn/base-api/upload_file/2024-11-12/d5k9gntb46f5yhfw8r.jpg",
|
|
|
- "logo": "https://zhgy.sagoo.cn/base-api/upload_file/2024-11-11/d5jfepud0ajcbia9fw.png",
|
|
|
- "systemName": "123",
|
|
|
- "systemCopyright": "333",
|
|
|
- "isDeleted": 0,
|
|
|
- "status": 1,
|
|
|
-}
|
|
|
+ buildVersion: "",
|
|
|
+ buildTime: "",
|
|
|
+ systemName: "",
|
|
|
+ systemLogo: "",
|
|
|
+ systemLoginPIC: "",
|
|
|
+});
|
|
|
|
|
|
-if (res?.status) {
|
|
|
- sysinfo.systemName = res.name
|
|
|
- sysinfo.systemLogo = res.logo
|
|
|
- sysinfo.systemLoginPIC = res.logoPic
|
|
|
-} else {
|
|
|
- isAllow.value = false
|
|
|
- ElMessage.error('租户不存在')
|
|
|
-}
|
|
|
+api
|
|
|
+ .sysinfo()
|
|
|
+ .then((res: any) => {
|
|
|
+ setSystemInfo(res);
|
|
|
+ sysinfo.buildVersion = res.buildVersion;
|
|
|
+ sysinfo.buildTime = res.buildTime;
|
|
|
+ const isSSOEnabled = window.atob(res.target).split("|")[4];
|
|
|
+ if (isSSOEnabled == "1") {
|
|
|
+ showSSO.value = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => (showImg.value = true));
|
|
|
+
|
|
|
+tenantApi
|
|
|
+ .get(tenant)
|
|
|
+ .then((res: any) => {
|
|
|
+ if (res?.status) {
|
|
|
+ sysinfo.systemName = res.name;
|
|
|
+ sysinfo.systemLogo = res.logo;
|
|
|
+ sysinfo.systemLoginPIC = res.logoPic;
|
|
|
+
|
|
|
+ // 设置租户的全局名称和图标
|
|
|
+ setTenantInfo({
|
|
|
+ code: res.code,
|
|
|
+ systemName: res.name,
|
|
|
+ systemLogo: res.logo,
|
|
|
+ systemLogoMini: res.logoMini,
|
|
|
+ systemLoginPIC: res.logoPic,
|
|
|
+ })
|
|
|
+ other.useTitle()
|
|
|
+ } else {
|
|
|
+ isAllow.value = false;
|
|
|
+ ElMessage.error("租户不存在");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ isAllow.value = false;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
|
|
|
// 获取布局配置信息
|
|
|
const getThemeConfig = computed(() => {
|
|
@@ -96,31 +106,31 @@ const getThemeConfig = computed(() => {
|
|
|
});
|
|
|
|
|
|
const versionInfo = reactive<any>({
|
|
|
- version: '',
|
|
|
- updateTime: '',
|
|
|
-})
|
|
|
+ version: "",
|
|
|
+ updateTime: "",
|
|
|
+});
|
|
|
// 加载版本信息
|
|
|
-axios.get('/versionInfo.json').then(res => {
|
|
|
- versionInfo.version = res.data.version
|
|
|
- versionInfo.updateTime = res.data.updateTime
|
|
|
-})
|
|
|
+axios.get("/versionInfo.json").then((res) => {
|
|
|
+ versionInfo.version = res.data.version;
|
|
|
+ versionInfo.updateTime = res.data.updateTime;
|
|
|
+});
|
|
|
|
|
|
// 4、界面显示 --> 深色模式
|
|
|
const onAddDarkChange = () => {
|
|
|
const body = document.documentElement as HTMLElement;
|
|
|
if (getThemeConfig.value.isIsDark) {
|
|
|
- body.setAttribute('data-theme', 'dark');
|
|
|
- document.querySelector('html')!.className = 'dark'
|
|
|
+ body.setAttribute("data-theme", "dark");
|
|
|
+ document.querySelector("html")!.className = "dark";
|
|
|
} else {
|
|
|
- body.setAttribute('data-theme', '');
|
|
|
- document.querySelector('html')!.className = ''
|
|
|
+ body.setAttribute("data-theme", "");
|
|
|
+ document.querySelector("html")!.className = "";
|
|
|
}
|
|
|
- store.dispatch('themeConfig/setThemeConfig', getThemeConfig.value);
|
|
|
+ store.dispatch("themeConfig/setThemeConfig", getThemeConfig.value);
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-html[data-theme='dark'] {
|
|
|
+html[data-theme="dark"] {
|
|
|
.login-container {
|
|
|
background: #293146;
|
|
|
}
|