Skip to content

Commit

Permalink
fix: 优化配置内容
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoooooo committed Sep 24, 2024
1 parent 4b8719a commit e4f2cde
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"skinColor": "#4a4c5b",
"inputBgColor": "#ffffff",
"backgroundConf": {
"color": "#ffffff",
"color": "#b8dbff",
"type": "color",
"image": ""
},
Expand Down
Binary file removed web/public/imgs/icons/upload.png
Binary file not shown.
21 changes: 0 additions & 21 deletions web/src/common/utils/applySkinConfig.ts

This file was deleted.

2 changes: 1 addition & 1 deletion web/src/management/components/CooperModify/MemberList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 1 addition & 2 deletions web/src/management/components/CooperModify/ModifyDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -67,7 +67,6 @@ const formTitle = ref('协作管理')
const cooperOptions = ref([])
const fetchPermissionList = async () => {
const res: any = await getPermissionList()
if (res.code === CODE_MAP.SUCCESS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/components/LeftMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions web/src/management/config/skinPresets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
'default-1': {
'skinConf.backgroundConf.color': '#90b4fa',
'skinConf.themeConf.color': '#FAA600'
'skinConf.backgroundConf.color': '#b8dbff',
'skinConf.themeConf.color': '#faa600'
}
}
23 changes: 20 additions & 3 deletions web/src/management/pages/edit/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
10 changes: 5 additions & 5 deletions web/src/management/pages/edit/setterConfig/skinConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/pages/list/components/BaseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions web/src/management/pages/list/components/SliderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/pages/list/components/SpaceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/pages/list/components/SpaceModify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/pages/list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/stores/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 2 additions & 6 deletions web/src/management/stores/workSpace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion web/src/materials/setters/widgets/TabsSetter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions web/src/materials/setters/widgets/UploadSingleFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -92,7 +92,7 @@ const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
box-sizing: border-box;
.upload-img {
.el-upload {
width: 80px;
width: 32px;
height: 32px;
}
}
Expand Down
23 changes: 20 additions & 3 deletions web/src/render/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit e4f2cde

Please sign in to comment.