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", "skinColor": "#4a4c5b",
"inputBgColor": "#ffffff", "inputBgColor": "#ffffff",
"backgroundConf": { "backgroundConf": {
"color": "#ffffff", "color": "#b8dbff",
"type": "color", "type": "color",
"image": "" "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> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue' 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 OperationSelect from './OperationSelect.vue'
import { useWorkSpaceStore } from '@/management/stores/workSpace' import { useWorkSpaceStore } from '@/management/stores/workSpace'

View File

@ -30,7 +30,7 @@ import {
type ListItem, type ListItem,
type UserRole, type UserRole,
roleLabels roleLabels
} from '@/management/utils/types/workSpace' } from '@/management/utils/workSpace'
import { CODE_MAP } from '@/management/api/base' import { CODE_MAP } from '@/management/api/base'
import { useUserStore } from '@/management/stores/user' 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 'element-plus/theme-chalk/src/message.scss'
import { getPermissionList, getCollaborator, saveCollaborator } from '@/management/api/space' 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 { CODE_MAP } from '@/management/api/base'
import MemberSelect from './MemberSelect.vue' import MemberSelect from './MemberSelect.vue'
@ -67,7 +67,6 @@ const formTitle = ref('协作管理')
const cooperOptions = ref([]) const cooperOptions = ref([])
const fetchPermissionList = async () => { const fetchPermissionList = async () => {
const res: any = await getPermissionList() const res: any = await getPermissionList()
if (res.code === CODE_MAP.SUCCESS) { 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 { ElMessageBox, type CheckboxValueType } from 'element-plus'
import 'element-plus/theme-chalk/src/message-box.scss' 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( const props = withDefaults(
defineProps<{ defineProps<{

View File

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

View File

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

View File

@ -19,7 +19,6 @@ import { useEditStore } from '@/management/stores/edit'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss' import 'element-plus/theme-chalk/src/message.scss'
import applySkinConfig from '@/common/utils/applySkinConfig'
import LeftMenu from '@/management/components/LeftMenu.vue' import LeftMenu from '@/management/components/LeftMenu.vue'
import CommonTemplate from './components/CommonTemplate.vue' import CommonTemplate from './components/CommonTemplate.vue'
@ -33,8 +32,26 @@ const route = useRoute()
watch( watch(
() => schema.skinConf, () => schema.skinConf,
(v) => { (skinConfig) => {
applySkinConfig(v) 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, deep: true,

View File

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

View File

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

View File

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

View File

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

View File

@ -88,7 +88,7 @@ import SpaceModify from './SpaceModify.vue'
import TextSearch from '@/management/pages/list/components/TextSearch.vue' import TextSearch from '@/management/pages/list/components/TextSearch.vue'
import EmptyIndex from '@/management/components/EmptyIndex.vue' import EmptyIndex from '@/management/components/EmptyIndex.vue'
import ToolBar from './ToolBar.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' import { useWorkSpaceStore } from '@/management/stores/workSpace'
const showSpaceModify = ref(false) const showSpaceModify = ref(false)

View File

@ -49,7 +49,7 @@ import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss' import 'element-plus/theme-chalk/src/message.scss'
import { QOP_MAP } from '@/management/utils/constant' 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 { useWorkSpaceStore } from '@/management/stores/workSpace'
import MemberSelect from '@/management/components/CooperModify/MemberSelect.vue' 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 SliderBar from './components/SliderBar.vue'
import SpaceModify from './components/SpaceModify.vue' import SpaceModify from './components/SpaceModify.vue'
import TopNav from '@/management/components/TopNav.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 { useWorkSpaceStore } from '@/management/stores/workSpace'
import { useSurveyListStore } from '@/management/stores/surveyList' import { useSurveyListStore } from '@/management/stores/surveyList'

View File

@ -5,7 +5,7 @@ import {
type NavigationGuardNext type NavigationGuardNext
} from 'vue-router' } from 'vue-router'
import type { RouteRecordRaw } 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 { analysisTypeMap } from '@/management/config/analysisConfig'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss' 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 { QUESTION_TYPE } from '@/common/typeEnum'
import { getQuestionByType } from '@/management/utils/index' 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 { getCollaboratorPermissions } from '@/management/api/space'
import useInitializeSchema from './composables/useInitializeSchema' import useInitializeSchema from './composables/useInitializeSchema'

View File

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

View File

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

View File

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

View File

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

View File

@ -6,12 +6,29 @@ import { watch } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useSurveyStore } from './stores/survey' import { useSurveyStore } from './stores/survey'
import applySkinConfig from '@/common/utils/applySkinConfig';
const { skinConf } = storeToRefs(useSurveyStore()) const { skinConf } = storeToRefs(useSurveyStore())
watch(skinConf, (value) => { watch(skinConf, (skinConfig) => {
applySkinConfig(value) 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> </script>
<style lang="scss"> <style lang="scss">