fix: ui bugs (#3454)
This commit is contained in:
parent
aff1ab7d1b
commit
6473f27cae
@ -6,12 +6,14 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<base target="_blank" />
|
<base target="_blank" />
|
||||||
<title>%VITE_APP_TITLE%</title>
|
<title>%VITE_APP_TITLE%</title>
|
||||||
|
<script>
|
||||||
|
;((prefix) => {
|
||||||
|
window.MaxKB = {
|
||||||
|
prefix: '/admin',
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<script>
|
|
||||||
window.MaxKB = {
|
|
||||||
prefix: '/admin',
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
|||||||
12
ui/chat.html
12
ui/chat.html
@ -6,12 +6,14 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<base target="_blank" />
|
<base target="_blank" />
|
||||||
<title>%VITE_APP_TITLE%</title>
|
<title>%VITE_APP_TITLE%</title>
|
||||||
|
<script>
|
||||||
|
;((prefix) => {
|
||||||
|
window.MaxKB = {
|
||||||
|
prefix: '/chat',
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<script>
|
|
||||||
window.MaxKB = {
|
|
||||||
prefix: '/chat',
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/chat.ts"></script>
|
<script type="module" src="/src/chat.ts"></script>
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
class="problem-button mt-4 mb-4 flex"
|
class="problem-button mt-4 mb-4 flex"
|
||||||
:class="sendMessage ? 'cursor' : 'disabled'"
|
:class="sendMessage ? 'cursor' : 'disabled'"
|
||||||
>
|
>
|
||||||
<el-icon class="mr-8" style="margin-top: 2px;">
|
<el-icon class="mr-8" style="margin-top: 2px">
|
||||||
<EditPen />
|
<EditPen />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
{{ item.content }}
|
{{ item.content }}
|
||||||
@ -55,7 +55,7 @@ config({
|
|||||||
}
|
}
|
||||||
tokens[idx].attrSet(
|
tokens[idx].attrSet(
|
||||||
'onerror',
|
'onerror',
|
||||||
'this.src="/ui/assets/load_error.png";this.onerror=null;this.height="33px"'
|
'this.src="/${window.MaxKB.prefix}/assets/load_error.png";this.onerror=null;this.height="33px"',
|
||||||
)
|
)
|
||||||
return md.renderer.renderToken(tokens, idx, options)
|
return md.renderer.renderToken(tokens, idx, options)
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ config({
|
|||||||
return md.renderer.renderToken(tokens, idx, options)
|
return md.renderer.renderToken(tokens, idx, options)
|
||||||
}
|
}
|
||||||
document.appendChild
|
document.appendChild
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@ -79,14 +79,14 @@ const props = withDefaults(
|
|||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
source: '',
|
source: '',
|
||||||
disabled: false
|
disabled: false,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
const editorRef = ref()
|
const editorRef = ref()
|
||||||
const md_view_list = computed(() => {
|
const md_view_list = computed(() => {
|
||||||
const temp_source = props.source
|
const temp_source = props.source
|
||||||
return split_form_rander(
|
return split_form_rander(
|
||||||
split_echarts_rander(split_html_rander(split_quick_question([temp_source])))
|
split_echarts_rander(split_html_rander(split_quick_question([temp_source]))),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ const split_quick_question_ = (source: string) => {
|
|||||||
.filter((item) => !md_quick_question_list?.includes(item))
|
.filter((item) => !md_quick_question_list?.includes(item))
|
||||||
const result = Array.from(
|
const result = Array.from(
|
||||||
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
||||||
(v, i) => i
|
(v, i) => i,
|
||||||
).map((index) => {
|
).map((index) => {
|
||||||
if (index % 2 == 0) {
|
if (index % 2 == 0) {
|
||||||
return { type: 'md', content: split_quick_question_value[Math.floor(index / 2)] }
|
return { type: 'md', content: split_quick_question_value[Math.floor(index / 2)] }
|
||||||
@ -117,7 +117,7 @@ const split_quick_question_ = (source: string) => {
|
|||||||
type: 'question',
|
type: 'question',
|
||||||
content: md_quick_question_list[Math.floor(index / 2)]
|
content: md_quick_question_list[Math.floor(index / 2)]
|
||||||
.replace('<quick_question>', '')
|
.replace('<quick_question>', '')
|
||||||
.replace('</quick_question>', '')
|
.replace('</quick_question>', ''),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -142,7 +142,7 @@ const split_html_rander_ = (source: string, type: string) => {
|
|||||||
.filter((item) => !md_quick_question_list?.includes(item))
|
.filter((item) => !md_quick_question_list?.includes(item))
|
||||||
const result = Array.from(
|
const result = Array.from(
|
||||||
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
||||||
(v, i) => i
|
(v, i) => i,
|
||||||
).map((index) => {
|
).map((index) => {
|
||||||
if (index % 2 == 0) {
|
if (index % 2 == 0) {
|
||||||
return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
|
return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
|
||||||
@ -151,7 +151,7 @@ const split_html_rander_ = (source: string, type: string) => {
|
|||||||
type: 'html_rander',
|
type: 'html_rander',
|
||||||
content: md_quick_question_list[Math.floor(index / 2)]
|
content: md_quick_question_list[Math.floor(index / 2)]
|
||||||
.replace('<html_rander>', '')
|
.replace('<html_rander>', '')
|
||||||
.replace('</html_rander>', '')
|
.replace('</html_rander>', ''),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -177,7 +177,7 @@ const split_echarts_rander_ = (source: string, type: string) => {
|
|||||||
.filter((item) => !md_quick_question_list?.includes(item))
|
.filter((item) => !md_quick_question_list?.includes(item))
|
||||||
const result = Array.from(
|
const result = Array.from(
|
||||||
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
||||||
(v, i) => i
|
(v, i) => i,
|
||||||
).map((index) => {
|
).map((index) => {
|
||||||
if (index % 2 == 0) {
|
if (index % 2 == 0) {
|
||||||
return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
|
return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
|
||||||
@ -186,7 +186,7 @@ const split_echarts_rander_ = (source: string, type: string) => {
|
|||||||
type: 'echarts_rander',
|
type: 'echarts_rander',
|
||||||
content: md_quick_question_list[Math.floor(index / 2)]
|
content: md_quick_question_list[Math.floor(index / 2)]
|
||||||
.replace('<echarts_rander>', '')
|
.replace('<echarts_rander>', '')
|
||||||
.replace('</echarts_rander>', '')
|
.replace('</echarts_rander>', ''),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -212,7 +212,7 @@ const split_form_rander_ = (source: string, type: string) => {
|
|||||||
.filter((item) => !md_quick_question_list?.includes(item))
|
.filter((item) => !md_quick_question_list?.includes(item))
|
||||||
const result = Array.from(
|
const result = Array.from(
|
||||||
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
{ length: md_quick_question_list.length + split_quick_question_value.length },
|
||||||
(v, i) => i
|
(v, i) => i,
|
||||||
).map((index) => {
|
).map((index) => {
|
||||||
if (index % 2 == 0) {
|
if (index % 2 == 0) {
|
||||||
return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
|
return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
|
||||||
@ -221,7 +221,7 @@ const split_form_rander_ = (source: string, type: string) => {
|
|||||||
type: 'form_rander',
|
type: 'form_rander',
|
||||||
content: md_quick_question_list[Math.floor(index / 2)]
|
content: md_quick_question_list[Math.floor(index / 2)]
|
||||||
.replace('<form_rander>', '')
|
.replace('<form_rander>', '')
|
||||||
.replace('</form_rander>', '')
|
.replace('</form_rander>', ''),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -79,7 +79,7 @@ const loginImage = computed(() => {
|
|||||||
return `${fileURL.value}`
|
return `${fileURL.value}`
|
||||||
} else {
|
} else {
|
||||||
const imgName = getThemeImg(theme.themeInfo?.theme)
|
const imgName = getThemeImg(theme.themeInfo?.theme)
|
||||||
const imgPath = `/theme/${imgName}.jpg`
|
const imgPath = `${window.MaxKB.prefix}/theme/${imgName}.jpg`
|
||||||
const imageUrl = new URL(imgPath, import.meta.url).href
|
const imageUrl = new URL(imgPath, import.meta.url).href
|
||||||
return imageUrl
|
return imageUrl
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ const loginImage = computed(() => {
|
|||||||
return `${fileURL.value}`
|
return `${fileURL.value}`
|
||||||
} else {
|
} else {
|
||||||
const imgName = getThemeImg(theme.themeInfo?.theme)
|
const imgName = getThemeImg(theme.themeInfo?.theme)
|
||||||
const imgPath = `/theme/${imgName}.jpg`
|
const imgPath = `${window.MaxKB.prefix}/theme/${imgName}.jpg`
|
||||||
const imageUrl = new URL(imgPath, import.meta.url).href
|
const imageUrl = new URL(imgPath, import.meta.url).href
|
||||||
return imageUrl
|
return imageUrl
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { getBrowserLang } from '@/locales/index'
|
|||||||
import useUserStore from './user'
|
import useUserStore from './user'
|
||||||
const useApplicationStore = defineStore('application', {
|
const useApplicationStore = defineStore('application', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
location: `${window.location.origin}/ui/chat/`,
|
location: `${window.location.origin}/${window.MaxKB.prefix}/chat/`,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async asyncGetAllApplication() {
|
async asyncGetAllApplication() {
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export function filesize(size: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 头像
|
// 头像
|
||||||
export const defaultIcon = '/ui/favicon.ico'
|
export const defaultIcon = '/${window.MaxKB.prefix}/favicon.ico'
|
||||||
export function isAppIcon(url: string | undefined) {
|
export function isAppIcon(url: string | undefined) {
|
||||||
return url === defaultIcon ? '' : url
|
return url === defaultIcon ? '' : url
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ const loginImage = computed(() => {
|
|||||||
return `${fileURL.value}`
|
return `${fileURL.value}`
|
||||||
} else {
|
} else {
|
||||||
const imgName = getThemeImg(theme.themeInfo?.theme)
|
const imgName = getThemeImg(theme.themeInfo?.theme)
|
||||||
const imgPath = `/theme/${imgName}.jpg`
|
const imgPath = `${window.MaxKB.prefix}/theme/${imgName}.jpg`
|
||||||
const imageUrl = new URL(imgPath, import.meta.url).href
|
const imageUrl = new URL(imgPath, import.meta.url).href
|
||||||
return imageUrl
|
return imageUrl
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,9 +81,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="submit-button">
|
<div class="submit-button">
|
||||||
<el-button type="primary" @click="submitPermissions"
|
<el-button
|
||||||
v-if="hasPermission(permissionObj[(route.meta?.resource as string||'APPLICATION')],'OR')"
|
type="primary"
|
||||||
>{{ $t('common.save') }}</el-button>
|
@click="submitPermissions"
|
||||||
|
v-if="
|
||||||
|
hasPermission(
|
||||||
|
permissionObj[(route.meta?.resource as string) || 'APPLICATION'],
|
||||||
|
'OR',
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>{{ $t('common.save') }}</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -105,7 +113,7 @@ import { EditionConst, RoleConst, PermissionConst } from '@/utils/permission/dat
|
|||||||
import { hasPermission } from '@/utils/permission/index'
|
import { hasPermission } from '@/utils/permission/index'
|
||||||
import type { WorkspaceItem } from '@/api/type/workspace'
|
import type { WorkspaceItem } from '@/api/type/workspace'
|
||||||
import { ComplexPermission } from '@/utils/permission/type'
|
import { ComplexPermission } from '@/utils/permission/type'
|
||||||
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
import { loadPermissionApi } from '@/utils/dynamics-api/permission-api.ts'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
@ -118,21 +126,49 @@ const currentType = ref<string>('')
|
|||||||
const filterText = ref('')
|
const filterText = ref('')
|
||||||
const tableHeight = ref(0)
|
const tableHeight = ref(0)
|
||||||
|
|
||||||
const permissionObj=ref<any>({
|
const permissionObj = ref<any>({
|
||||||
"APPLICATION":new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
APPLICATION: new ComplexPermission(
|
||||||
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
[
|
||||||
"KNOWLEDGE":new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
||||||
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT
|
||||||
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
.getWorkspacePermissionWorkspaceManageRole,
|
||||||
"TOOL":new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
],
|
||||||
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
[],
|
||||||
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT.getWorkspacePermissionWorkspaceManageRole],[],'OR'),
|
'OR',
|
||||||
"MODEL":new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
),
|
||||||
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
KNOWLEDGE: new ComplexPermission(
|
||||||
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT.getWorkspacePermissionWorkspaceManageRole],[],'OR')
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
|
[
|
||||||
|
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
||||||
|
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT
|
||||||
|
.getWorkspacePermissionWorkspaceManageRole,
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
'OR',
|
||||||
|
),
|
||||||
|
TOOL: new ComplexPermission(
|
||||||
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
|
[
|
||||||
|
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
||||||
|
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT
|
||||||
|
.getWorkspacePermissionWorkspaceManageRole,
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
'OR',
|
||||||
|
),
|
||||||
|
MODEL: new ComplexPermission(
|
||||||
|
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
|
||||||
|
[
|
||||||
|
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT,
|
||||||
|
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_EDIT
|
||||||
|
.getWorkspacePermissionWorkspaceManageRole,
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
'OR',
|
||||||
|
),
|
||||||
})
|
})
|
||||||
console.log(route.meta.resource||'APPLICATION')
|
console.log(route.meta.resource || 'APPLICATION')
|
||||||
const settingTags = reactive([
|
const settingTags = reactive([
|
||||||
{
|
{
|
||||||
label: t('views.knowledge.title'),
|
label: t('views.knowledge.title'),
|
||||||
@ -338,7 +374,8 @@ const getWholeTree = async (user_id: string) => {
|
|||||||
const folderTree = cloneDeep((parentRes as unknown as any).data)
|
const folderTree = cloneDeep((parentRes as unknown as any).data)
|
||||||
if (Object.keys(childrenRes.data).indexOf(item.type) !== -1) {
|
if (Object.keys(childrenRes.data).indexOf(item.type) !== -1) {
|
||||||
item.isRole =
|
item.isRole =
|
||||||
childrenRes.data[item.type].length > 0 && hasPermission([EditionConst.IS_EE], 'OR')
|
childrenRes.data[item.type].length > 0 &&
|
||||||
|
hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')
|
||||||
? childrenRes.data[item.type][0].auth_type == 'ROLE'
|
? childrenRes.data[item.type][0].auth_type == 'ROLE'
|
||||||
: false
|
: false
|
||||||
folderIdMap = getFolderIdMap(childrenRes.data[item.type])
|
folderIdMap = getFolderIdMap(childrenRes.data[item.type])
|
||||||
|
|||||||
@ -101,7 +101,7 @@ const onChange = (file: any) => {
|
|||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
if (radioType.value === 'default') {
|
if (radioType.value === 'default') {
|
||||||
emit('refresh', '/ui/favicon.ico')
|
emit('refresh', '/${window.MaxKB.prefix}/favicon.ico')
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
} else if (radioType.value === 'custom' && iconFile.value) {
|
} else if (radioType.value === 'custom' && iconFile.value) {
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user