mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-10 14:57:09 +08:00
feat(tenant):增加通过域名查询租户编码和查询租户开关状态的功能
This commit is contained in:
@@ -6,6 +6,7 @@ export * from './modules/route'
|
||||
export * from './modules/tabs'
|
||||
export * from './modules/dict'
|
||||
export * from './modules/user'
|
||||
export * from './modules/tenant'
|
||||
|
||||
const pinia = createPinia()
|
||||
pinia.use(piniaPluginPersistedstate)
|
||||
|
||||
@@ -68,7 +68,6 @@ const storeSetup = () => {
|
||||
siteConfig.SITE_TITLE = resMap.get('SITE_TITLE')
|
||||
siteConfig.SITE_COPYRIGHT = resMap.get('SITE_COPYRIGHT')
|
||||
siteConfig.SITE_BEIAN = resMap.get('SITE_BEIAN')
|
||||
siteConfig.TENANT_ENABLED = resMap.get('TENANT_ENABLED') === 'true'
|
||||
document.title = resMap.get('SITE_TITLE')
|
||||
document
|
||||
.querySelector('link[rel="shortcut icon"]')
|
||||
@@ -123,10 +122,6 @@ const storeSetup = () => {
|
||||
const getForRecord = () => {
|
||||
return siteConfig.SITE_BEIAN
|
||||
}
|
||||
|
||||
const getTenantEnabled = () => {
|
||||
return siteConfig.TENANT_ENABLED
|
||||
}
|
||||
return {
|
||||
...toRefs(settingConfig),
|
||||
...toRefs(siteConfig),
|
||||
@@ -143,7 +138,6 @@ const storeSetup = () => {
|
||||
getTitle,
|
||||
getCopyright,
|
||||
getForRecord,
|
||||
getTenantEnabled,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
31
src/stores/modules/tenant.ts
Normal file
31
src/stores/modules/tenant.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, reactive } from 'vue'
|
||||
|
||||
const storeSetup = () => {
|
||||
interface TenantInfo {
|
||||
tenantEnabled: boolean
|
||||
tenantCode: string
|
||||
}
|
||||
const tenantInfo = reactive<TenantInfo>({
|
||||
tenantEnabled: false,
|
||||
tenantCode: '',
|
||||
})
|
||||
const tenantEnabled = computed(() => tenantInfo.tenantEnabled)
|
||||
const tenantCode = computed(() => tenantInfo.tenantCode)
|
||||
const setTenantEnable = (tenantStatus: boolean) => {
|
||||
tenantInfo.tenantEnabled = tenantStatus
|
||||
}
|
||||
const setTenantCode = (tenantCode: string) => {
|
||||
tenantInfo.tenantCode = tenantCode
|
||||
}
|
||||
return {
|
||||
tenantCode,
|
||||
tenantEnabled,
|
||||
setTenantCode,
|
||||
setTenantEnable,
|
||||
}
|
||||
}
|
||||
|
||||
export const useTenantStore = defineStore('tenant', storeSetup, {
|
||||
persist: { paths: ['tenantInfo'], storage: localStorage },
|
||||
})
|
||||
Reference in New Issue
Block a user