fix: 优化配置内容

This commit is contained in:
sudoooooo 2024-09-24 15:48:39 +08:00
parent 4b8719ab9c
commit e4f2cdede6
24 changed files with 75 additions and 67 deletions

View File

@ -50,7 +50,7 @@
"skinColor": "#4a4c5b",
"inputBgColor": "#ffffff",
"backgroundConf": {
"color": "#ffffff",
"color": "#b8dbff",
"type": "color",
"image": ""
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

View File

@ -1,21 +0,0 @@
export default function (skinConfig: any) {
const root = document.documentElement
const { themeConf, backgroundConf, contentConf } = skinConfig
if (themeConf?.color) {
// 设置主题颜色
root.style.setProperty('--primary-color', themeConf?.color)
}
// 设置背景
const { color, type, image } = backgroundConf || {}
root.style.setProperty(
'--primary-background',
type === 'image' ? `url(${image}) no-repeat center / cover` : color
)
if (contentConf?.opacity.toString()) {
// 设置全局透明度
root.style.setProperty('--opacity', `${contentConf.opacity / 100}`)
}
}

View File

@ -16,7 +16,7 @@
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { type IMember, type ListItem } from '@/management/utils/types/workSpace'
import { type IMember, type ListItem } from '@/management/utils/workSpace'
import OperationSelect from './OperationSelect.vue'
import { useWorkSpaceStore } from '@/management/stores/workSpace'

View File

@ -30,7 +30,7 @@ import {
type ListItem,
type UserRole,
roleLabels
} from '@/management/utils/types/workSpace'
} from '@/management/utils/workSpace'
import { CODE_MAP } from '@/management/api/base'
import { useUserStore } from '@/management/stores/user'

View File

@ -45,7 +45,7 @@ import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss'
import { getPermissionList, getCollaborator, saveCollaborator } from '@/management/api/space'
import { type IMember, SurveyPermissions } from '@/management/utils/types/workSpace'
import { type IMember, SurveyPermissions } from '@/management/utils/workSpace'
import { CODE_MAP } from '@/management/api/base'
import MemberSelect from './MemberSelect.vue'
@ -67,7 +67,6 @@ const formTitle = ref('协作管理')
const cooperOptions = ref([])
const fetchPermissionList = async () => {
const res: any = await getPermissionList()
if (res.code === CODE_MAP.SUCCESS) {

View File

@ -39,7 +39,7 @@ import { ref, computed, watch } from 'vue'
import { ElMessageBox, type CheckboxValueType } from 'element-plus'
import 'element-plus/theme-chalk/src/message-box.scss'
import { type ListItem } from '@/management/utils/types/workSpace'
import { type ListItem } from '@/management/utils/workSpace'
const props = withDefaults(
defineProps<{

View File

@ -34,7 +34,7 @@ import { useEditStore } from '@/management/stores/edit'
import { useRoute } from 'vue-router'
const route = useRoute()
import LogoIcon from './LogoIcon.vue'
import { SurveyPermissions } from '@/management/utils/types/workSpace.ts'
import { SurveyPermissions } from '@/management/utils/workSpace'
const editStore = useEditStore()
const tabArr = [

View File

@ -1,6 +1,6 @@
export default {
'default-1': {
'skinConf.backgroundConf.color': '#90b4fa',
'skinConf.themeConf.color': '#FAA600'
'skinConf.backgroundConf.color': '#b8dbff',
'skinConf.themeConf.color': '#faa600'
}
}

View File

@ -19,7 +19,6 @@ import { useEditStore } from '@/management/stores/edit'
import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss'
import applySkinConfig from '@/common/utils/applySkinConfig'
import LeftMenu from '@/management/components/LeftMenu.vue'
import CommonTemplate from './components/CommonTemplate.vue'
@ -33,8 +32,26 @@ const route = useRoute()
watch(
() => schema.skinConf,
(v) => {
applySkinConfig(v)
(skinConfig) => {
const root = document.documentElement
const { themeConf, backgroundConf, contentConf } = skinConfig
if (themeConf?.color) {
//
root.style.setProperty('--primary-color', themeConf?.color)
}
//
const { color, type, image } = backgroundConf || {}
root.style.setProperty(
'--primary-background',
type === 'image' ? `url(${image}) no-repeat center / cover` : color
)
if (contentConf?.opacity.toString()) {
//
root.style.setProperty('--opacity', `${contentConf.opacity / 100}`)
}
},
{
deep: true,

View File

@ -80,8 +80,8 @@ const changePreset = (banner: any) => {
const name = banner.group + '-' + banner.title
let presets = {
'bannerConf.bannerConfig.bgImage': banner.src,
'skinConf.themeConf.color': '#FAA600',
'skinConf.backgroundConf.color': '#fff'
'skinConf.themeConf.color': '#faa600',
'skinConf.backgroundConf.color': '#f6f7f9'
}
if ((skinPresets as any)[name]) {

View File

@ -14,22 +14,22 @@ export default [
{
type: 'TabsSetter',
key: 'type',
tabList: [
options: [
{
label: '图片(<5M)',
value: 'image',
value: 'image'
},
{
label: '颜色',
value: 'color',
value: 'color'
}
]
},
{
label: '背景图片',
type: 'UploadSingleFile',
accept: "image/*",
limitSize: 5,// 单位MB
accept: 'image/*',
limitSize: 5, // 单位MB
key: 'image',
relyFunc: (data) => {
return data.type === 'image'

View File

@ -127,7 +127,7 @@ import ToolBar from './ToolBar.vue'
import TextSearch from './TextSearch.vue'
import TextSelect from './TextSelect.vue'
import TextButton from './TextButton.vue'
import { SurveyPermissions } from '@/management/utils/types/workSpace'
import { SurveyPermissions } from '@/management/utils/workSpace'
import {
fieldConfig,

View File

@ -38,8 +38,8 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { type MenuItem } from '@/management/utils/types/workSpace'
import { SpaceType } from '@/management/utils/types/workSpace'
import { type MenuItem } from '@/management/utils/workSpace'
import { SpaceType } from '@/management/utils/workSpace'
const menuRef = ref()

View File

@ -88,7 +88,7 @@ import SpaceModify from './SpaceModify.vue'
import TextSearch from '@/management/pages/list/components/TextSearch.vue'
import EmptyIndex from '@/management/components/EmptyIndex.vue'
import ToolBar from './ToolBar.vue'
import { UserRole } from '@/management/utils/types/workSpace'
import { UserRole } from '@/management/utils/workSpace'
import { useWorkSpaceStore } from '@/management/stores/workSpace'
const showSpaceModify = ref(false)

View File

@ -49,7 +49,7 @@ import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss'
import { QOP_MAP } from '@/management/utils/constant'
import { type IMember, type IWorkspace, UserRole } from '@/management/utils/types/workSpace'
import { type IMember, type IWorkspace, UserRole } from '@/management/utils/workSpace'
import { useWorkSpaceStore } from '@/management/stores/workSpace'
import MemberSelect from '@/management/components/CooperModify/MemberSelect.vue'

View File

@ -68,7 +68,7 @@ import SpaceList from './components/SpaceList.vue'
import SliderBar from './components/SliderBar.vue'
import SpaceModify from './components/SpaceModify.vue'
import TopNav from '@/management/components/TopNav.vue'
import { SpaceType } from '@/management/utils/types/workSpace'
import { SpaceType } from '@/management/utils/workSpace'
import { useWorkSpaceStore } from '@/management/stores/workSpace'
import { useSurveyListStore } from '@/management/stores/surveyList'

View File

@ -5,7 +5,7 @@ import {
type NavigationGuardNext
} from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import { SurveyPermissions } from '@/management/utils/types/workSpace'
import { SurveyPermissions } from '@/management/utils/workSpace'
import { analysisTypeMap } from '@/management/config/analysisConfig'
import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss'

View File

@ -4,7 +4,7 @@ import { set as _set, isNumber as _isNumber } from 'lodash-es'
import { QUESTION_TYPE } from '@/common/typeEnum'
import { getQuestionByType } from '@/management/utils/index'
import { SurveyPermissions } from '@/management/utils/types/workSpace'
import { SurveyPermissions } from '@/management/utils/workSpace'
import { getCollaboratorPermissions } from '@/management/api/space'
import useInitializeSchema from './composables/useInitializeSchema'

View File

@ -13,12 +13,8 @@ import {
getSpaceDetail as getSpaceDetailReq
} from '@/management/api/space'
import { SpaceType } from '@/management/utils/types/workSpace'
import {
type SpaceDetail,
type SpaceItem,
type IWorkspace
} from '@/management/utils/types/workSpace'
import { SpaceType } from '@/management/utils/workSpace'
import { type SpaceDetail, type SpaceItem, type IWorkspace } from '@/management/utils/workSpace'
import { useSurveyListStore } from './surveyList'

View File

@ -42,6 +42,13 @@ export type SpaceItem = Required<Omit<SpaceDetail, 'members'>> & {
surveyTotal: number
}
export interface ICollaborator {
_id?: string
userId: string
username: string
permissions: Array<number>
}
export enum SpaceType {
Personal = 'personal',
Group = 'group',
@ -58,13 +65,6 @@ export const roleLabels: Record<UserRole, string> = {
[UserRole.Member]: '成员'
}
export interface ICollaborator {
_id?: string
userId: string
username: string
permissions: Array<number>
}
export enum SurveyPermissions {
SurveyManage = 'SURVEY_CONF_MANAGE',
DataManage = 'SURVEY_RESPONSE_MANAGE',

View File

@ -30,7 +30,7 @@ const props = defineProps<IProps>()
const emit = defineEmits<IEmit>()
const tabList = computed(() => {
return props.formConfig?.tabList || []
return props.formConfig?.options || []
})
function handleTabClick(item: any) {

View File

@ -16,7 +16,7 @@
:before-upload="beforeAvatarUpload"
:on-success="onSuccess"
>
<img src="/imgs/icons/upload.png" alt="上传图标" />
<i-ep-upload />
</el-upload>
</template>
</el-input>
@ -92,7 +92,7 @@ const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
box-sizing: border-box;
.upload-img {
.el-upload {
width: 80px;
width: 32px;
height: 32px;
}
}

View File

@ -6,12 +6,29 @@ import { watch } from 'vue'
import { storeToRefs } from 'pinia'
import { useSurveyStore } from './stores/survey'
import applySkinConfig from '@/common/utils/applySkinConfig';
const { skinConf } = storeToRefs(useSurveyStore())
watch(skinConf, (value) => {
applySkinConfig(value)
watch(skinConf, (skinConfig) => {
const root = document.documentElement
const { themeConf, backgroundConf, contentConf }: any = skinConfig
if (themeConf?.color) {
//
root.style.setProperty('--primary-color', themeConf?.color)
}
//
const { color, type, image } = backgroundConf || {}
root.style.setProperty(
'--primary-background',
type === 'image' ? `url(${image}) no-repeat center / cover` : color
)
if (contentConf?.opacity.toString()) {
//
root.style.setProperty('--opacity', `${contentConf.opacity / 100}`)
}
})
</script>
<style lang="scss">