mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-22 12:58:55 +08:00
ref: 优化不同架构下前缀自适应
This commit is contained in:
parent
9f23e64034
commit
9cc34aa71b
@ -145,7 +145,7 @@ export const getUserInfo = () => {
|
||||
|
||||
export const logout = () => {
|
||||
return request({
|
||||
url: '/admin/token/logout',
|
||||
url: '/auth/token/logout',
|
||||
method: 'delete',
|
||||
});
|
||||
};
|
||||
|
@ -13,14 +13,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="wngEditor">
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import '@wangeditor/editor/dist/css/style.css';
|
||||
import { reactive, shallowRef, watch, onBeforeUnmount } from 'vue';
|
||||
// @ts-ignore
|
||||
import { IDomEditor } from '@wangeditor/editor';
|
||||
import { Toolbar, Editor } from '@wangeditor/editor-for-vue';
|
||||
import { Session } from '/@/utils/storage';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
// 定义父组件传过来的值
|
||||
const props = defineProps({
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
<script setup lang="ts" name="upload-file">
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { Local, Session } from '/@/utils/storage';
|
||||
import { Session } from '/@/utils/storage';
|
||||
import other from '/@/utils/other';
|
||||
const props = defineProps({
|
||||
modelValue: [String, Array],
|
||||
@ -110,10 +110,9 @@ const uploadList = ref([]) as any;
|
||||
const fileUpload = ref();
|
||||
|
||||
const headers = computed(() => {
|
||||
const tenantId = Local.get('tenantId') ? Local.get('tenantId') : 1;
|
||||
return {
|
||||
Authorization: 'Bearer ' + Session.get('token'),
|
||||
'TENANT-ID': tenantId,
|
||||
'TENANT-ID': Session.getTenant(),
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { Session, Local } from '/@/utils/storage';
|
||||
import { Session } from '/@/utils/storage';
|
||||
import { useMessageBox } from '/@/hooks/message';
|
||||
import qs from 'qs';
|
||||
import other from './other';
|
||||
@ -36,7 +36,7 @@ service.interceptors.request.use(
|
||||
}
|
||||
|
||||
// 统一增加TENANT-ID请求头
|
||||
const tenantId = Local.get('tenantId');
|
||||
const tenantId = Session.getTenant()
|
||||
if (tenantId && !config.headers?.skipTenant) {
|
||||
config.headers!['TENANT-ID'] = tenantId;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ export const Session = {
|
||||
clear() {
|
||||
Cookies.remove('token');
|
||||
Cookies.remove('refresh_token');
|
||||
Cookies.remove('tenantId');
|
||||
window.sessionStorage.clear();
|
||||
},
|
||||
// 获取当前存储的 token
|
||||
|
42
src/views/ext/jimu.vue
Normal file
42
src/views/ext/jimu.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<el-scrollbar class="main">
|
||||
<iframe :src="src" class="iframe" v-if="isMicro === 'true'" />
|
||||
<span v-else>单体架构暂不支持报表设计器</span>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="modelView" setup>
|
||||
import other from '/@/utils/other';
|
||||
import { Session } from '/@/utils/storage';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute();
|
||||
const src = ref('');
|
||||
const isMicro = import.meta.env.VITE_IS_MICRO;
|
||||
|
||||
watch([route], () => {
|
||||
init();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
const init = () => {
|
||||
const token = Session.getToken();
|
||||
const tenantId = Session.getTenant();
|
||||
let url = proxy.baseURL + `/jimu/jmreport/list?token=${tenantId}_${token}`;
|
||||
src.value = other.adaptationUrl(url);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iframe {
|
||||
width: 100%;
|
||||
height: 80vh;
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
40
src/views/ext/report.vue
Normal file
40
src/views/ext/report.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<iframe :src="src" class="iframe" v-if="isMicro === 'true'" />
|
||||
<span v-else>单体架构暂不支持大屏设计器</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="modelView" setup>
|
||||
import other from '/@/utils/other';
|
||||
import { Session } from '/@/utils/storage';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute();
|
||||
const src = ref('');
|
||||
const isMicro = import.meta.env.VITE_IS_MICRO;
|
||||
|
||||
watch([route], () => {
|
||||
init();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
const init = () => {
|
||||
const token = Session.getToken();
|
||||
const tenantId = Session.getTenant();
|
||||
let url = `/gv?token=${token}&TENANT-ID=${tenantId}`;
|
||||
src.value = proxy.baseURL + other.adaptationUrl(url);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iframe {
|
||||
width: 100%;
|
||||
height: 80vh;
|
||||
border: 0;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
@ -21,6 +21,7 @@ import Driver from 'driver.js';
|
||||
import { fetchList } from '/@/api/admin/tenant';
|
||||
import { Local, Session } from '/@/utils/storage';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@ -69,6 +70,7 @@ const handleAutoTenant = () => {
|
||||
const handleCommand = (tenant: any) => {
|
||||
Session.set('tenantId', tenant.id); // 写入到 session 存储
|
||||
Local.set('tenantId', tenant.id); // 写入到 local 存储
|
||||
Cookies.set('tenantId', tenant.id); //写入到 cookie 方便第三方使用
|
||||
};
|
||||
|
||||
/**
|
||||
@ -105,7 +107,7 @@ const guide = () => {
|
||||
*/
|
||||
onMounted(async () => {
|
||||
await getTenantList(); // 获取租户列表
|
||||
tenant.value = Local.get('tenantId'); // 从本地存储读取当前租户信息
|
||||
tenant.value = Session.getTenant(); // 从本地存储读取当前租户信息
|
||||
|
||||
if (autoTenantEnable) {
|
||||
handleAutoTenant(); // 自动根据域名匹配租户信息
|
||||
|
@ -121,7 +121,7 @@ import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import commonFunction from '/@/utils/commonFunction';
|
||||
import other from '/@/utils/other';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { copyText } = commonFunction();
|
||||
// 引入组件
|
||||
const ImageUpload = defineAsyncComponent(() => import('/@/components/Upload/Image.vue'));
|
||||
@ -188,8 +188,8 @@ const dialogFormVisible = ref(false);
|
||||
const wxurl = ref('');
|
||||
const access = (row: any) => {
|
||||
dialogFormVisible.value = true;
|
||||
let url = baseUrl + row.url + '/mp/' + row.appid + '/portal';
|
||||
wxurl.value = other.adaptationUrl(url);
|
||||
let url = '/mp/' + row.appid + '/portal';
|
||||
wxurl.value = row.url + proxy.baseURL + other.adaptationUrl(url);
|
||||
};
|
||||
|
||||
const generate = (row: any) => {
|
||||
|
@ -7,10 +7,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="modelView" setup>
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import other from '/@/utils/other';
|
||||
import { Session } from '/@/utils/storage';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute();
|
||||
|
||||
const src = ref('');
|
||||
|
@ -75,7 +75,6 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="model" setup>
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { delObj, fetchList, status } from '/@/api/oa/process';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
@ -85,7 +84,7 @@ import other from '/@/utils/other';
|
||||
|
||||
// 引入组件
|
||||
const { t } = useI18n();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
// 定义变量内容
|
||||
const showPicDialog = ref(false);
|
||||
@ -139,12 +138,10 @@ const handleDelete = async (ids: string[]) => {
|
||||
|
||||
//查看流程图
|
||||
const handleView = (row: any) => {
|
||||
let url =
|
||||
proxy.baseURL +
|
||||
`/act/process/resource/${row.deploymentId}/${
|
||||
row.processonDefinitionId
|
||||
}/image?access_token=${Session.getToken()}&TENANT-ID=${Session.getTenant()}`;
|
||||
actPicUrl.value = other.adaptationUrl(url);
|
||||
let url = `/act/process/resource/${row.deploymentId}/${
|
||||
row.processonDefinitionId
|
||||
}/image?access_token=${Session.getToken()}&TENANT-ID=${Session.getTenant()}`;
|
||||
actPicUrl.value = proxy.baseURL + other.adaptationUrl(url);
|
||||
showPicDialog.value = true;
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemTask">
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { fetchList, delObj } from '/@/api/oa/task';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@ -88,8 +87,8 @@ import other from '/@/utils/other';
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const CommentDialog = defineAsyncComponent(() => import('./comment.vue'));
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { t } = useI18n();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
// 定义查询字典
|
||||
const formDialogRef = ref();
|
||||
@ -152,8 +151,8 @@ const handleDelete = async (ids: string[]) => {
|
||||
|
||||
//查看流程图
|
||||
const handleView = (row: any) => {
|
||||
let url = proxy.baseURL + `/act/task/view/${row.taskId}?access_token=${Session.getToken()}&TENANT-ID=${Session.getTenant()}`;
|
||||
actPicUrl.value = other.adaptationUrl(url);
|
||||
let url = `/act/task/view/${row.taskId}?access_token=${Session.getToken()}&TENANT-ID=${Session.getTenant()}`;
|
||||
actPicUrl.value = proxy.baseURL + other.adaptationUrl(url);
|
||||
showPicDialog.value = true;
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user