diff --git a/server/src/config/index.ts b/server/src/config/index.ts deleted file mode 100644 index 4ca78c6c..00000000 --- a/server/src/config/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -const mongo = { - url: process.env.XIAOJU_SURVEY_MONGO_URL || 'mongodb://localhost:27017', - dbName: process.env.XIAOJU_SURVER_MONGO_DBNAME || 'xiaojuSurvey', -}; - -const session = { - expireTime: parseInt(process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN) || 8 * 3600 * 1000 -}; - -const encrypt = { - type: process.env.XIAOJU_SURVEY_ENCRYPT_TYPE || 'aes', - aesCodelength: parseInt(process.env.XIAOJU_SURVEY_ENCRYPT_TYPE_LEN) || 10 //aes密钥长度 -}; - -const jwt = { - secret: process.env.XIAOJU_SURVEY_JWT_SECRET || 'xiaojuSurveyJwtSecret', - expiresIn: process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN || '8h' -}; - - -export{ - mongo, - session, - encrypt, - jwt, -}; diff --git a/server/src/modules/workspace/controllers/workspace.controller.ts b/server/src/modules/workspace/controllers/workspace.controller.ts index 93928cd8..b1985490 100644 --- a/server/src/modules/workspace/controllers/workspace.controller.ts +++ b/server/src/modules/workspace/controllers/workspace.controller.ts @@ -174,6 +174,7 @@ export class WorkspaceController { pre[id] = cur; return pre; }, {}); + const surveyTotalList = await Promise.all( workspaceIdList.map((item) => { return this.surveyMetaService.countSurveyMetaByWorkspaceId({ diff --git a/web/.gitignore b/web/.gitignore index e0a576ec..94556503 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -26,4 +26,4 @@ yarn.lock *.sln *.sw? -.history +.history \ No newline at end of file diff --git a/web/components.d.ts b/web/components.d.ts index fa277a42..02b54173 100644 --- a/web/components.d.ts +++ b/web/components.d.ts @@ -7,68 +7,68 @@ export {} declare module 'vue' { export interface GlobalComponents { - ElButton: (typeof import('element-plus/es'))['ElButton'] - ElCheckbox: (typeof import('element-plus/es'))['ElCheckbox'] - ElCollapse: (typeof import('element-plus/es'))['ElCollapse'] - ElCollapseItem: (typeof import('element-plus/es'))['ElCollapseItem'] - ElColorPicker: (typeof import('element-plus/es'))['ElColorPicker'] - ElConfigProvider: (typeof import('element-plus/es'))['ElConfigProvider'] - ElDatePicker: (typeof import('element-plus/es'))['ElDatePicker'] - ElDialog: (typeof import('element-plus/es'))['ElDialog'] - ElForm: (typeof import('element-plus/es'))['ElForm'] - ElFormItem: (typeof import('element-plus/es'))['ElFormItem'] - ElInput: (typeof import('element-plus/es'))['ElInput'] - ElInputNumber: (typeof import('element-plus/es'))['ElInputNumber'] - ElMenu: (typeof import('element-plus/es'))['ElMenu'] - ElMenuItem: (typeof import('element-plus/es'))['ElMenuItem'] - ElMenuItemGroup: (typeof import('element-plus/es'))['ElMenuItemGroup'] - ElOption: (typeof import('element-plus/es'))['ElOption'] - ElPagination: (typeof import('element-plus/es'))['ElPagination'] - ElPopover: (typeof import('element-plus/es'))['ElPopover'] - ElRadio: (typeof import('element-plus/es'))['ElRadio'] - ElRadioButton: (typeof import('element-plus/es'))['ElRadioButton'] - ElRadioGroup: (typeof import('element-plus/es'))['ElRadioGroup'] - ElRow: (typeof import('element-plus/es'))['ElRow'] - ElSegmented: (typeof import('element-plus/es'))['ElSegmented'] - ElSelect: (typeof import('element-plus/es'))['ElSelect'] - ElSelectV2: (typeof import('element-plus/es'))['ElSelectV2'] - ElSlider: (typeof import('element-plus/es'))['ElSlider'] - ElSwitch: (typeof import('element-plus/es'))['ElSwitch'] - ElTable: (typeof import('element-plus/es'))['ElTable'] - ElTableColumn: (typeof import('element-plus/es'))['ElTableColumn'] - ElTabPane: (typeof import('element-plus/es'))['ElTabPane'] - ElTabs: (typeof import('element-plus/es'))['ElTabs'] - ElTag: (typeof import('element-plus/es'))['ElTag'] - ElTimePicker: (typeof import('element-plus/es'))['ElTimePicker'] - ElTooltip: (typeof import('element-plus/es'))['ElTooltip'] - ElTree: (typeof import('element-plus/es'))['ElTree'] - IEpBottom: (typeof import('~icons/ep/bottom'))['default'] - IEpCheck: (typeof import('~icons/ep/check'))['default'] - IEpCirclePlus: (typeof import('~icons/ep/circle-plus'))['default'] - IEpClose: (typeof import('~icons/ep/close'))['default'] - IEpConnection: (typeof import('~icons/ep/connection'))['default'] - IEpCopyDocument: (typeof import('~icons/ep/copy-document'))['default'] - IEpDelete: (typeof import('~icons/ep/delete'))['default'] - IEpIphone: (typeof import('~icons/ep/iphone'))['default'] - IEpLoading: (typeof import('~icons/ep/loading'))['default'] - IEpMinus: (typeof import('~icons/ep/minus'))['default'] - IEpMonitor: (typeof import('~icons/ep/monitor'))['default'] - IEpMore: (typeof import('~icons/ep/more'))['default'] - IEpPlus: (typeof import('~icons/ep/plus'))['default'] - IEpQuestionFilled: (typeof import('~icons/ep/question-filled'))['default'] - IEpRank: (typeof import('~icons/ep/rank'))['default'] - IEpRemove: (typeof import('~icons/ep/remove'))['default'] - IEpSearch: (typeof import('~icons/ep/search'))['default'] - IEpSort: (typeof import('~icons/ep/sort'))['default'] - IEpSortDown: (typeof import('~icons/ep/sort-down'))['default'] - IEpSortUp: (typeof import('~icons/ep/sort-up'))['default'] - IEpTop: (typeof import('~icons/ep/top'))['default'] - IEpView: (typeof import('~icons/ep/view'))['default'] - IEpWarningFilled: (typeof import('~icons/ep/warning-filled'))['default'] - RouterLink: (typeof import('vue-router'))['RouterLink'] - RouterView: (typeof import('vue-router'))['RouterView'] + ElButton: typeof import('element-plus/es')['ElButton'] + ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] + ElCollapse: typeof import('element-plus/es')['ElCollapse'] + ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] + ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] + ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] + ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] + ElDialog: typeof import('element-plus/es')['ElDialog'] + ElForm: typeof import('element-plus/es')['ElForm'] + ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElInput: typeof import('element-plus/es')['ElInput'] + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] + ElMenu: typeof import('element-plus/es')['ElMenu'] + ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] + ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup'] + ElOption: typeof import('element-plus/es')['ElOption'] + ElPagination: typeof import('element-plus/es')['ElPagination'] + ElPopover: typeof import('element-plus/es')['ElPopover'] + ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] + ElRow: typeof import('element-plus/es')['ElRow'] + ElSegmented: typeof import('element-plus/es')['ElSegmented'] + ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSelectV2: typeof import('element-plus/es')['ElSelectV2'] + ElSlider: typeof import('element-plus/es')['ElSlider'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] + ElTable: typeof import('element-plus/es')['ElTable'] + ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] + ElTag: typeof import('element-plus/es')['ElTag'] + ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] + ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTree: typeof import('element-plus/es')['ElTree'] + IEpBottom: typeof import('~icons/ep/bottom')['default'] + IEpCheck: typeof import('~icons/ep/check')['default'] + IEpCirclePlus: typeof import('~icons/ep/circle-plus')['default'] + IEpClose: typeof import('~icons/ep/close')['default'] + IEpConnection: typeof import('~icons/ep/connection')['default'] + IEpCopyDocument: typeof import('~icons/ep/copy-document')['default'] + IEpDelete: typeof import('~icons/ep/delete')['default'] + IEpIphone: typeof import('~icons/ep/iphone')['default'] + IEpLoading: typeof import('~icons/ep/loading')['default'] + IEpMinus: typeof import('~icons/ep/minus')['default'] + IEpMonitor: typeof import('~icons/ep/monitor')['default'] + IEpMore: typeof import('~icons/ep/more')['default'] + IEpPlus: typeof import('~icons/ep/plus')['default'] + IEpQuestionFilled: typeof import('~icons/ep/question-filled')['default'] + IEpRank: typeof import('~icons/ep/rank')['default'] + IEpRemove: typeof import('~icons/ep/remove')['default'] + IEpSearch: typeof import('~icons/ep/search')['default'] + IEpSort: typeof import('~icons/ep/sort')['default'] + IEpSortDown: typeof import('~icons/ep/sort-down')['default'] + IEpSortUp: typeof import('~icons/ep/sort-up')['default'] + IEpTop: typeof import('~icons/ep/top')['default'] + IEpView: typeof import('~icons/ep/view')['default'] + IEpWarningFilled: typeof import('~icons/ep/warning-filled')['default'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] } export interface ComponentCustomProperties { - vLoading: (typeof import('element-plus/es'))['ElLoadingDirective'] + vLoading: typeof import('element-plus/es')['ElLoadingDirective'] } } diff --git a/web/env.d.ts b/web/env.d.ts index 9706856f..11f02fe2 100644 --- a/web/env.d.ts +++ b/web/env.d.ts @@ -1,8 +1 @@ /// -declare module "vuex" { - export * from "vuex/types/index.d.ts"; - export * from "vuex/types/helpers.d.ts"; - export * from "vuex/types/logger.d.ts"; - export * from "vuex/types/vue.d.ts"; - } - \ No newline at end of file diff --git a/web/package.json b/web/package.json index 445fbb26..afc1e033 100644 --- a/web/package.json +++ b/web/package.json @@ -31,7 +31,6 @@ "vue": "^3.4.15", "vue-router": "^4.2.5", "vuedraggable": "^4.1.0", - "vuex": "^4.0.2", "xss": "^1.0.14", "yup": "^1.4.0" }, diff --git a/web/src/common/Editor/utils.js b/web/src/common/Editor/utils.js index 5adfe0b6..3300c0c6 100644 --- a/web/src/common/Editor/utils.js +++ b/web/src/common/Editor/utils.js @@ -24,7 +24,5 @@ export const replacePxWithRem = (html) => { }) }) - console.log('生成的结果', res) - return res } diff --git a/web/src/common/regexpMap.ts b/web/src/common/regexpMap.ts index 1de548a6..d115526c 100644 --- a/web/src/common/regexpMap.ts +++ b/web/src/common/regexpMap.ts @@ -8,4 +8,4 @@ export const regexpMap = { e: /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/, licensePlate: /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([DFAG]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[DF]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4,5}[A-Z0-9挂学警港澳]{1})$/ -} \ No newline at end of file +} diff --git a/web/src/management/components/CooperModify/MemberList.vue b/web/src/management/components/CooperModify/MemberList.vue index dedb06be..2a5afa3c 100644 --- a/web/src/management/components/CooperModify/MemberList.vue +++ b/web/src/management/components/CooperModify/MemberList.vue @@ -16,11 +16,11 @@ diff --git a/web/src/management/pages/edit/modules/resultModule/components/SuccessContent.vue b/web/src/management/pages/edit/modules/resultModule/components/SuccessContent.vue new file mode 100644 index 00000000..284b5e74 --- /dev/null +++ b/web/src/management/pages/edit/modules/resultModule/components/SuccessContent.vue @@ -0,0 +1,56 @@ + + + diff --git a/web/src/management/pages/edit/modules/settingModule/enum.js b/web/src/management/pages/edit/modules/resultModule/components/enum.js similarity index 100% rename from web/src/management/pages/edit/modules/settingModule/enum.js rename to web/src/management/pages/edit/modules/resultModule/components/enum.js diff --git a/web/src/management/pages/edit/modules/settingModule/SettingPanel.vue b/web/src/management/pages/edit/modules/settingModule/SettingPanel.vue index aecfda5b..02b20af5 100644 --- a/web/src/management/pages/edit/modules/settingModule/SettingPanel.vue +++ b/web/src/management/pages/edit/modules/settingModule/SettingPanel.vue @@ -38,14 +38,13 @@ \ No newline at end of file + diff --git a/web/src/materials/setters/widgets/whiteList.vue b/web/src/management/pages/edit/modules/settingModule/components/WhiteList.vue similarity index 54% rename from web/src/materials/setters/widgets/whiteList.vue rename to web/src/management/pages/edit/modules/settingModule/components/WhiteList.vue index 46cfcbca..6db2d252 100644 --- a/web/src/materials/setters/widgets/whiteList.vue +++ b/web/src/management/pages/edit/modules/settingModule/components/WhiteList.vue @@ -1,55 +1,64 @@ + + - +
+ +
+ +
- - + + 手机号 邮箱 - +
\ No newline at end of file + diff --git a/web/src/management/pages/edit/modules/settingModule/skin/CatalogPanel.vue b/web/src/management/pages/edit/modules/skinModule/CatalogPanel.vue similarity index 97% rename from web/src/management/pages/edit/modules/settingModule/skin/CatalogPanel.vue rename to web/src/management/pages/edit/modules/skinModule/CatalogPanel.vue index 3ed0a072..09b4db67 100644 --- a/web/src/management/pages/edit/modules/settingModule/skin/CatalogPanel.vue +++ b/web/src/management/pages/edit/modules/skinModule/CatalogPanel.vue @@ -93,10 +93,6 @@ const changePreset = (banner: any) => { border: none; overflow-y: auto; background-color: #fff; - scrollbar-width: none; - &::-webkit-scrollbar { - display: none; - } .title { height: 40px; line-height: 40px; @@ -113,9 +109,11 @@ const changePreset = (banner: any) => { display: flex; flex-wrap: wrap; .tag { - cursor: pointer; - width: 51px; + width: 55px; margin: 5px 2px; + cursor: pointer; + flex: auto; + cursor: pointer; &.current { color: $primary-color; background-color: $primary-bg-color; diff --git a/web/src/management/pages/edit/modules/settingModule/skin/PreviewPanel.vue b/web/src/management/pages/edit/modules/skinModule/PreviewPanel.vue similarity index 100% rename from web/src/management/pages/edit/modules/settingModule/skin/PreviewPanel.vue rename to web/src/management/pages/edit/modules/skinModule/PreviewPanel.vue diff --git a/web/src/management/pages/edit/modules/settingModule/skin/SetterPanel.vue b/web/src/management/pages/edit/modules/skinModule/SetterPanel.vue similarity index 96% rename from web/src/management/pages/edit/modules/settingModule/skin/SetterPanel.vue rename to web/src/management/pages/edit/modules/skinModule/SetterPanel.vue index 16af87cc..93a69ae7 100644 --- a/web/src/management/pages/edit/modules/settingModule/skin/SetterPanel.vue +++ b/web/src/management/pages/edit/modules/skinModule/SetterPanel.vue @@ -28,7 +28,7 @@ import { ref } from 'vue' import { useEditStore } from '@/management/stores/edit' import { get as _get } from 'lodash-es' -import skinConfig from '@/management/config/setterConfig/skinConfig' +import skinConfig from '@/management/pages/edit/setterConfig/skinConfig' import SetterField from '@/management/pages/edit/components/SetterField.vue' const editStore = useEditStore() diff --git a/web/src/management/pages/edit/setterConfig/bannerConfig.js b/web/src/management/pages/edit/setterConfig/bannerConfig.js new file mode 100644 index 00000000..9263920e --- /dev/null +++ b/web/src/management/pages/edit/setterConfig/bannerConfig.js @@ -0,0 +1,35 @@ +export default [ + { + label: '顶部图片地址', + type: 'InputSetter', + key: 'bgImage', + labelStyle: { width: '120px' } + }, + { + label: '顶部视频地址', + type: 'InputSetter', + key: 'videoLink', + labelStyle: { width: '120px' } + }, + { + label: '视频海报地址', + type: 'InputSetter', + key: 'postImg', + labelStyle: { width: '120px' } + }, + { + label: '图片支持点击', + type: 'CustomedSwitch', + labelStyle: { width: '120px' }, + key: 'bgImageAllowJump' + }, + { + label: '跳转链接', + type: 'InputSetter', + labelStyle: { width: '120px' }, + key: 'bgImageJumpLink', + relyFunc: (data) => { + return !!data?.bgImageAllowJump + } + } +] diff --git a/web/src/management/pages/edit/modules/settingModule/config/baseConfig.js b/web/src/management/pages/edit/setterConfig/baseConfig.js similarity index 63% rename from web/src/management/pages/edit/modules/settingModule/config/baseConfig.js rename to web/src/management/pages/edit/setterConfig/baseConfig.js index 146a5a1b..f220ac34 100644 --- a/web/src/management/pages/edit/modules/settingModule/config/baseConfig.js +++ b/web/src/management/pages/edit/setterConfig/baseConfig.js @@ -12,6 +12,13 @@ export default [ { title: '作答限制', key: 'respondConfig', - formList: ['interview_pwd','answer_type','white_placeholder','white_list','team_list'] + formList: [ + 'interview_pwd_switch', + 'interview_pwd', + 'answer_type', + 'white_placeholder', + 'white_list', + 'team_list' + ] } ] diff --git a/web/src/management/pages/edit/modules/settingModule/config/baseFormConfig.js b/web/src/management/pages/edit/setterConfig/baseFormConfig.js similarity index 62% rename from web/src/management/pages/edit/modules/settingModule/config/baseFormConfig.js rename to web/src/management/pages/edit/setterConfig/baseFormConfig.js index 58f28292..b3e83294 100644 --- a/web/src/management/pages/edit/modules/settingModule/config/baseFormConfig.js +++ b/web/src/management/pages/edit/setterConfig/baseFormConfig.js @@ -22,41 +22,62 @@ export default { type: 'QuestionTimeHour', placement: 'top' }, - interview_pwd: { - keys: ['baseConf.passwordSwitch', 'baseConf.password'], + interview_pwd_switch: { + key: 'baseConf.passwordSwitch', label: '访问密码', - type: 'SwitchInput', + type: 'CustomedSwitch' + }, + interview_pwd: { + type: 'InputSetter', placeholder: '请输入6位字符串类型访问密码 ', maxLength: 6, + relyFunc: (data) => { + return !!data?.passwordSwitch + } }, answer_type: { key: 'baseConf.whitelistType', label: '答题名单', - type: 'AnswerRadio', + type: 'RadioGroup', + options: [ + { + label: '所有人', + value: 'ALL' + }, + { + label: '空间成员', + value: 'MEMBER' + }, + { + label: '白名单', + value: 'CUSTOM' + } + ] }, - white_placeholder:{ + white_placeholder: { key: 'baseConf.whitelistTip', label: '名单登录提示语', - placeholder:'请输入名单提示语', - type: 'InputWordLimit', + placeholder: '请输入名单提示语', + type: 'InputSetter', maxLength: 40, relyFunc: (data) => { - return ['CUSTOM','MEMBER'].includes(data.whitelistType) + return ['CUSTOM', 'MEMBER'].includes(data.whitelistType) } }, - white_list:{ - keys: ['baseConf.whitelist','baseConf.memberType'], + white_list: { + keys: ['baseConf.whitelist', 'baseConf.memberType'], label: '白名单列表', - type: 'whiteList', + type: 'WhiteList', + custom: true, // 自定义导入高级组件 relyFunc: (data) => { - return data.whitelistType == 'CUSTOM' } }, - team_list:{ + team_list: { key: 'baseConf.whitelist', label: '团队空间成员选择', - type: 'teamMemberList', + type: 'TeamMemberList', + custom: true, // 自定义导入高级组件 relyFunc: (data) => { return data.whitelistType == 'MEMBER' } diff --git a/web/src/management/pages/edit/setterConfig/logoConfig.js b/web/src/management/pages/edit/setterConfig/logoConfig.js new file mode 100644 index 00000000..9d2bff7f --- /dev/null +++ b/web/src/management/pages/edit/setterConfig/logoConfig.js @@ -0,0 +1,16 @@ +export default [ + { + label: '自定义Logo', + type: 'InputSetter', + key: 'logoImage', + tip: '默认尺寸200px*50px', + labelStyle: { width: '120px' } + }, + { + label: 'Logo大小', + type: 'InputPercent', + key: 'logoImageWidth', + tip: '填写宽度百分比,例如30%', + labelStyle: { width: '120px' } + } +] diff --git a/web/src/management/pages/edit/setterConfig/skinConfig.js b/web/src/management/pages/edit/setterConfig/skinConfig.js new file mode 100644 index 00000000..9177466d --- /dev/null +++ b/web/src/management/pages/edit/setterConfig/skinConfig.js @@ -0,0 +1,48 @@ +import bannerConfig from './bannerConfig' +import logoConfig from './logoConfig' + +export default [ + { + name: '头图', + key: 'bannerConf.bannerConfig', + formConfigList: bannerConfig + }, + { + name: '背景', + key: 'skinConf.backgroundConf', + formConfigList: [ + { + label: '背景颜色', + type: 'ColorPicker', + key: 'color' + } + ] + }, + { + name: '主题色', + key: 'skinConf.themeConf', + formConfigList: [ + { + label: '全局应用', + type: 'ColorPicker', + key: 'color' + } + ] + }, + { + key: 'skinConf.contentConf', + name: '内容区域', + formConfigList: [ + { + label: '内容透明度', + type: 'SliderSetter', + key: 'opacity' + } + ] + }, + { + name: '品牌logo', + key: 'bottomConf', + formConfigList: logoConfig + } +] diff --git a/web/src/management/pages/edit/setterConfig/statusConfig.js b/web/src/management/pages/edit/setterConfig/statusConfig.js new file mode 100644 index 00000000..520732a0 --- /dev/null +++ b/web/src/management/pages/edit/setterConfig/statusConfig.js @@ -0,0 +1,26 @@ +export default { + Success: [ + { + label: '提示文案', + type: 'RichText', + key: 'msgContent.msg_200', + placeholder: '提交成功', + value: '提交成功', + labelStyle: { + 'font-weight': 'bold' + } + } + ], + OverTime: [ + { + label: '提示文案', + type: 'RichText', + key: 'msgContent.msg_9001', + placeholder: '问卷已过期', + value: '问卷已过期', + labelStyle: { + 'font-weight': 'bold' + } + } + ] +} diff --git a/web/src/management/pages/edit/setterConfig/submitConfig.js b/web/src/management/pages/edit/setterConfig/submitConfig.js new file mode 100644 index 00000000..ae4efa97 --- /dev/null +++ b/web/src/management/pages/edit/setterConfig/submitConfig.js @@ -0,0 +1,62 @@ +export default [ + { + title: '提交按钮文案', + type: 'InputSetter', + key: 'submitTitle', + placeholder: '提交', + value: '' + }, + { + title: '提交确认弹窗', + type: 'Customed', + key: 'confirmAgain', + content: [ + { + label: '是否配置该项', + labelStyle: { width: '120px' }, + type: 'CustomedSwitch', + key: 'confirmAgain.is_again', + value: true + }, + { + label: '二次确认文案', + labelStyle: { width: '120px' }, + type: 'InputSetter', + key: 'confirmAgain.again_text', + placeholder: '确认要提交吗?', + value: '确认要提交吗?' + } + ] + }, + { + title: '提交文案配置', + type: 'Customed', + key: 'msgContent', + content: [ + { + label: '已提交', + labelStyle: { width: '120px' }, + type: 'InputSetter', + key: 'msgContent.msg_9002', + placeholder: '请勿多次提交!', + value: '请勿多次提交!' + }, + { + label: '提交结束', + labelStyle: { width: '120px' }, + type: 'InputSetter', + key: 'msgContent.msg_9003', + placeholder: '您来晚了,已经满额!', + value: '您来晚了,已经满额!' + }, + { + label: '其他提交失败', + labelStyle: { width: '120px' }, + type: 'InputSetter', + key: 'msgContent.msg_9004', + placeholder: '提交失败!', + value: '提交失败!' + } + ] + } +] diff --git a/web/src/management/pages/list/components/BaseList.vue b/web/src/management/pages/list/components/BaseList.vue index 4cca56d9..49e5ba87 100644 --- a/web/src/management/pages/list/components/BaseList.vue +++ b/web/src/management/pages/list/components/BaseList.vue @@ -244,7 +244,7 @@ const order = computed(() => { return JSON.stringify(formatOrder) }) -const onReflush = async () => { +const onRefresh = async () => { const filterString = JSON.stringify( filter.value.filter((item) => { return item.condition[0].value @@ -456,16 +456,20 @@ const onCooperClose = () => { justify-content: space-between; align-items: center; margin-bottom: 20px; + .select { display: flex; } + .search { display: flex; } } + .list-wrapper { padding: 10px 20px; background: #fff; + .list-table { min-height: 620px; } @@ -473,11 +477,13 @@ const onCooperClose = () => { .list-pagination { margin-top: 20px; + :deep(.el-pagination) { display: flex; justify-content: flex-end; } } + :deep(.el-table__header) { .tableview-header .el-table__cell { .cell { @@ -487,21 +493,26 @@ const onCooperClose = () => { } } } + :deep(.tableview-row) { .tableview-cell { padding: 5px 0; + &.link { cursor: pointer; } + .cell .cell-span { font-size: 14px; } } } } + .el-select-dropdown__wrap { background: #eee; } + .el-select-dropdown__item.hover { background: #fff; } diff --git a/web/src/management/pages/list/components/SpaceList.vue b/web/src/management/pages/list/components/SpaceList.vue index 6d7c26e9..b2128f01 100644 --- a/web/src/management/pages/list/components/SpaceList.vue +++ b/web/src/management/pages/list/components/SpaceList.vue @@ -170,7 +170,6 @@ const handleDelete = (id: string) => { .then(async () => { await workSpaceStore.deleteSpace(id) await workSpaceStore.getSpaceList() - curPage.value = 1 }) .catch(() => {}) } @@ -186,7 +185,6 @@ const handleClick = (key: string, data: any) => { const onCloseModify = () => { showSpaceModify.value = false workSpaceStore.getSpaceList() - curPage.value = 1 } defineExpose({ onCloseModify }) diff --git a/web/src/management/pages/list/components/SpaceModify.vue b/web/src/management/pages/list/components/SpaceModify.vue index b48ad786..5e6dac82 100644 --- a/web/src/management/pages/list/components/SpaceModify.vue +++ b/web/src/management/pages/list/components/SpaceModify.vue @@ -47,11 +47,13 @@ import { computed, ref, shallowRef, onMounted } from 'vue' import { pick as _pick } from 'lodash-es' import { ElMessage } from 'element-plus' import 'element-plus/theme-chalk/src/message.scss' + import { QOP_MAP } from '@/management/utils/constant' -import MemberSelect from '@/management/components/CooperModify/MemberSelect.vue' import { type IMember, type IWorkspace, UserRole } from '@/management/utils/types/workSpace' import { useWorkSpaceStore } from '@/management/stores/workSpace' +import MemberSelect from '@/management/components/CooperModify/MemberSelect.vue' + const workSpaceStore = useWorkSpaceStore() const emit = defineEmits(['on-close-codify', 'onFocus', 'change', 'blur']) const props = defineProps({ diff --git a/web/src/management/store/actions.js b/web/src/management/store/actions.js deleted file mode 100644 index c8e185ea..00000000 --- a/web/src/management/store/actions.js +++ /dev/null @@ -1,21 +0,0 @@ -import { getBannerData } from '@/management/api/skin.js' -import { getCollaboratorPermissions } from '@/management/api/space.ts' -import { CODE_MAP } from '../api/base' - -export default { - async getBannerData({ state, commit }) { - if (state.bannerList && state.bannerList.length > 0) { - return - } - const res = await getBannerData() - if (res.code === 200) { - commit('setBannerList', res.data) - } - }, - async fetchCooperPermissions({ commit }, id) { - const res = await getCollaboratorPermissions(id) - if (res.code === CODE_MAP.SUCCESS) { - commit('setCooperPermissions', res.data.permissions) - } - } -} diff --git a/web/src/management/store/edit/actions.js b/web/src/management/store/edit/actions.js deleted file mode 100644 index 5a8a1c11..00000000 --- a/web/src/management/store/edit/actions.js +++ /dev/null @@ -1,72 +0,0 @@ -import { getNewField } from '@/management/utils' -import { cloneDeep as _cloneDeep, get as _get } from 'lodash-es' -import { getSurveyById } from '@/management/api/survey' - -export default { - async init({ state, dispatch }) { - const metaData = _get(state, 'schema.metaData') - if (!metaData || metaData._id !== state.surveyId) { - await dispatch('getSchemaFromRemote') - } - dispatch('resetState') - }, - async getSchemaFromRemote({ commit, state }) { - const res = await getSurveyById(state.surveyId) - if (res.code === 200) { - const metaData = res.data.surveyMetaRes - document.title = metaData.title - const { - bannerConf, - bottomConf, - skinConf, - baseConf, - submitConf, - dataConf, - logicConf = {} - } = res.data.surveyConfRes.code - commit('initSchema', { - metaData, - codeData: { - bannerConf, - bottomConf, - skinConf, - baseConf, - submitConf, - questionDataList: dataConf.dataList, - logicConf - } - }) - } else { - throw new Error(res.errmsg || '问卷不存在') - } - }, - resetState({ commit }) { - commit('setCurrentEditOne', null) - commit('changeStatusPreview', { type: 'Success' }) - }, - // 复制题目到当前题目后 - copyQuestion({ commit, state }, { index }) { - const newQuestion = _cloneDeep(state.schema.questionDataList[index]) - newQuestion.field = getNewField(state.schema.questionDataList.map((item) => item.field)) - commit('addQuestion', { question: newQuestion, index }) - }, - addQuestion({ commit }, { question, index }) { - commit('addQuestion', { question, index }) - commit('updateSchemaUpdateTime', Date.now()) - }, - deleteQuestion({ commit }, { index }) { - commit('deleteQuestion', { index }) - commit('updateSchemaUpdateTime', Date.now()) - }, - moveQuestion({ commit }, { index, range }) { - commit('moveQuestion', { index, range }) - commit('updateSchemaUpdateTime', Date.now()) - }, - changeSchema({ commit }, { key, value }) { - commit('changeSchema', { key, value }) - commit('updateSchemaUpdateTime', Date.now()) - }, - changeThemePreset({ commit }, presets) { - commit('changeThemePreset', presets) - } -} diff --git a/web/src/management/store/edit/getters.js b/web/src/management/store/edit/getters.js deleted file mode 100644 index 3350922d..00000000 --- a/web/src/management/store/edit/getters.js +++ /dev/null @@ -1,71 +0,0 @@ -import submitFormConfig from '@/management/config/setterConfig/submitConfig' -import questionLoader from '@/materials/questions/questionLoader' - -const innerMetaConfig = { - submit: { - title: '提交配置', - formConfig: submitFormConfig - } -} - -export default { - moduleConfig(state) { - const currentEditOne = state.currentEditOne - if (currentEditOne === null) { - return null - } - - if (currentEditOne === 'banner' || currentEditOne === 'mainTitle') { - return state?.schema?.bannerConf - } else if (currentEditOne === 'submit') { - return state?.schema?.submitConf - } else if (currentEditOne === 'logo') { - return state?.schema?.bottomConf - } else if (!Number.isNaN(currentEditOne)) { - return state?.schema?.questionDataList?.[currentEditOne] - } else { - return null - } - }, - formConfigList(state, getters) { - const currentEditOne = state.currentEditOne - if (currentEditOne === null) { - return null - } - - return getters?.currentEditMeta?.formConfig || [] - }, - currentEditMeta(state) { - const currentEditOne = state.currentEditOne - if (currentEditOne === null) { - return null - } else if (innerMetaConfig[currentEditOne]) { - return innerMetaConfig[currentEditOne] - } else { - const questionType = state.schema?.questionDataList?.[currentEditOne]?.type - return questionLoader.getMeta(questionType) - } - }, - currentEditKey(state) { - const currentEditOne = state.currentEditOne - if (currentEditOne === null) { - return null - } - let key = '' - switch (currentEditOne) { - case 'banner': - case 'mainTitle': - key = 'bannerConf' - break - case 'submit': - key = 'submitConf' - break - case 'logo': - key = 'bottomConf' - break - default: - key = `questionDataList.${currentEditOne}` - } - return key - } -} diff --git a/web/src/management/store/edit/index.js b/web/src/management/store/edit/index.js deleted file mode 100644 index 41d27622..00000000 --- a/web/src/management/store/edit/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import state from './state' -import mutations from './mutations' -import actions from './actions' -import getters from './getters' - -export default { - namespaced: true, - state, - actions, - getters, - mutations -} diff --git a/web/src/management/store/edit/mutations.js b/web/src/management/store/edit/mutations.js deleted file mode 100644 index 412b87a9..00000000 --- a/web/src/management/store/edit/mutations.js +++ /dev/null @@ -1,68 +0,0 @@ -import { set as _set, merge as _merge } from 'lodash-es' - -export default { - setCurrentEditOne(state, data) { - state.currentEditOne = data - }, - changeStatusPreview(state, { type }) { - state.currentEditStatus = type - }, - updateSchemaUpdateTime(state) { - state.schemaUpdateTime = Date.now() - }, - initSchema(state, { metaData, codeData }) { - state.schema.metaData = metaData - state.schema.bannerConf = _merge({}, state.schema.bannerConf, codeData.bannerConf) - state.schema.bottomConf = _merge({}, state.schema.bottomConf, codeData.bottomConf) - state.schema.skinConf = _merge({}, state.schema.skinConf, codeData.skinConf) - state.schema.baseConf = _merge({}, state.schema.baseConf, codeData.baseConf) - state.schema.submitConf = _merge({}, state.schema.submitConf, codeData.submitConf) - state.schema.questionDataList = codeData.questionDataList || [] - state.schema.logicConf = codeData.logicConf - }, - setSurveyId(state, data) { - state.surveyId = data - }, - addQuestion(state, { question, index }) { - state.schema.questionDataList.splice(index, 0, question) - }, - deleteQuestion(state, { index }) { - state.schema.questionDataList.splice(index, 1) - }, - moveQuestion(state, { index, range }) { - let start, end - if (range < 0) { - // 向上移动 - start = index + range - end = index - } else if (range > 0) { - // 向下移动 - start = index + 1 - end = index + range + 1 - } else { - // 无变化 - return - } - const currentData = state.schema.questionDataList[index] - // 新位置和老位置之间所有的题目 - const comparedList = state.schema.questionDataList.slice(start, end) - if (range < 0) { - // 向上移动 - state.schema.questionDataList.splice(index + range, 1 - range, currentData, ...comparedList) - } else if (range > 0) { - // 向下移动 - state.schema.questionDataList.splice(index, range + 1, ...comparedList, currentData) - } - }, - changeSchema(state, { key, value }) { - _set(state.schema, key, value) - }, - changeThemePreset(state, presets) { - Object.keys(presets).forEach((key) => { - _set(state.schema, key, presets[key]) - }) - }, - setQuestionDataList(state, data) { - state.schema.questionDataList = data - } -} diff --git a/web/src/management/store/edit/state.js b/web/src/management/store/edit/state.js deleted file mode 100644 index 1927e24a..00000000 --- a/web/src/management/store/edit/state.js +++ /dev/null @@ -1,60 +0,0 @@ -export default { - currentEditOne: null, - currentEditStatus: 'Success', - schemaUpdateTime: Date.now(), - surveyId: '', // url上取的surveyId - schema: { - metaData: null, - bannerConf: { - titleConfig: { - mainTitle: '

欢迎填写问卷

', - subTitle: `

为了给您提供更好的服务,希望您能抽出几分钟时间,将您的感受和建议告诉我们,期待您的参与!

`, - applyTitle: '' - }, - bannerConfig: { - bgImage: '', - bgImageAllowJump: false, - bgImageJumpLink: '', - videoLink: '', - postImg: '' - } - }, - bottomConf: { - logoImage: '', - logoImageWidth: '28%' - }, - skinConf: { - backgroundConf: { - color: '#fff' - }, - themeConf: { - color: '#ffa600' - }, - contentConf: { - opacity: 100 - } - }, - baseConf: { - begTime: '', - endTime: '', - language: 'chinese', - showVoteProcess: 'allow', - tLimit: 0, - answerBegTime: '', - answerEndTime: '', - answerLimitTime: 0 - }, - submitConf: { - submitTitle: '', - msgContent: {}, - confirmAgain: { - is_again: true - }, - link: '' - }, - questionDataList: [], - logicConf: { - showLogicConf: [] - } - } -} diff --git a/web/src/management/store/index.js b/web/src/management/store/index.js deleted file mode 100644 index c0ca999b..00000000 --- a/web/src/management/store/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import { createStore } from 'vuex' -import edit from './edit' -import user from './user' -import list from './list' -import actions from './actions' -import mutations from './mutations' -import state from './state' - -export default createStore({ - state, - getters: {}, - mutations, - actions, - modules: { - edit, - user, - list - } -}) diff --git a/web/src/management/store/list/index.js b/web/src/management/store/list/index.js deleted file mode 100644 index d40fc5b3..00000000 --- a/web/src/management/store/list/index.js +++ /dev/null @@ -1,263 +0,0 @@ -import { - createSpace, - getSpaceList, - getSpaceDetail, - updateSpace, - deleteSpace -} from '@/management/api/space' -import { CODE_MAP } from '@/management/api/base' -import { ElMessage } from 'element-plus' -import 'element-plus/theme-chalk/src/message.scss' -import { getSurveyList as surveyList } from '@/management/api/survey' -import { set } from 'lodash-es' -import { SpaceType } from '@/management/utils/types/workSpace' - -export default { - namespaced: true, - state: { - // 空间管理 - spaceMenus: [ - { - icon: 'icon-wodekongjian', - name: '我的空间', - id: SpaceType.Personal - }, - { - icon: 'icon-tuanduikongjian', - name: '团队空间', - id: SpaceType.Group, - children: [ - // { - // name: '小桔问卷调研团队', - // id: 'xxxx', - // } - ] - } - ], - spaceType: SpaceType.Personal, - workSpaceId: '', - spaceDetail: null, - // 团队空间 - teamSpaceList: [], - teamSpaceListTotal: 0, - // 列表管理 - surveyList: [], - surveyTotal: 0, - searchVal: '', - selectValueMap: { - surveyType: '', - 'curStatus.status': '' - }, - buttonValueMap: { - 'curStatus.date': '', - createDate: -1 - } - }, - getters: { - listFliter(state) { - return [ - { - comparator: '', - condition: [ - { - field: 'title', - value: state.searchVal, - comparator: '$regex' - } - ] - }, - { - comparator: '', - condition: [ - { - field: 'curStatus.status', - value: state.selectValueMap['curStatus.status'] - } - ] - }, - { - comparator: '', - condition: [ - { - field: 'surveyType', - value: state.selectValueMap.surveyType - } - ] - } - ] - }, - listOrder(state) { - const { buttonValueMap } = state - return Object.entries(buttonValueMap) - .filter(([, effectValue]) => effectValue) - .reduce((prev, item) => { - const [effectKey, effectValue] = item - prev.push({ field: effectKey, value: effectValue }) - return prev - }, []) - } - }, - mutations: { - updateSpaceMenus(state, teamSpace) { - // 更新空间列表下的团队空间 - set(state, 'spaceMenus[1].children', teamSpace) - }, - changeSpaceType(state, spaceType) { - state.spaceType = spaceType - }, - changeWorkSpace(state, workSpaceId) { - // 切换空间清除筛选条件 - this.commit('list/resetSelectValueMap') - this.commit('list/resetButtonValueMap') - this.commit('list/setSearchVal', '') - state.workSpaceId = workSpaceId - }, - setSpaceDetail(state, data) { - state.spaceDetail = data - }, - setTeamSpaceList(state, data) { - state.teamSpaceList = data - }, - setTeamSpaceListTotal(state, teamSpaceListTotal) { - state.teamSpaceListTotal = teamSpaceListTotal - }, - setSurveyList(state, list) { - state.surveyList = list - }, - setSurveyTotal(state, total) { - state.surveyTotal = total - }, - setSearchVal(state, data) { - state.searchVal = data - }, - resetSelectValueMap(state) { - state.selectValueMap = { - surveyType: '', - 'curStatus.status': '' - } - }, - changeSelectValueMap(state, { key, value }) { - state.selectValueMap[key] = value - }, - resetButtonValueMap(state) { - state.buttonValueMap = { - 'curStatus.date': '', - createDate: -1 - } - }, - changeButtonValueMap(state, { key, value }) { - state.buttonValueMap[key] = value - } - }, - actions: { - async getSpaceList({ commit }, p = { curPage: 1 }) { - try { - const res = await getSpaceList(p) - if (res.code === CODE_MAP.SUCCESS) { - const { list, count } = res.data - const teamSpace = list.map((item) => { - return { - id: item._id, - name: item.name - } - }) - commit('setTeamSpaceListTotal', count) - commit('setTeamSpaceList', list) - commit('updateSpaceMenus', teamSpace) - } else { - ElMessage.error('getSpaceList' + res.errmsg) - } - } catch (err) { - ElMessage.error('getSpaceList' + err) - } - }, - async addSpace({}, params) { - const res = await createSpace({ - name: params.name, - description: params.description, - members: params.members - }) - - if (res.code === CODE_MAP.SUCCESS) { - ElMessage.success('添加成功') - } else { - ElMessage.error('createSpace code err' + res.errmsg) - } - }, - async getSpaceDetail({ state, commit }, id) { - try { - const workspaceId = id || state.workSpaceId - const res = await getSpaceDetail(workspaceId) - if (res.code === CODE_MAP.SUCCESS) { - commit('setSpaceDetail', res.data) - } else { - ElMessage.error('getSpaceList' + res.errmsg) - } - } catch (err) { - ElMessage.error('getSpaceList' + err) - } - }, - async updateSpace({}, params) { - const res = await updateSpace({ - workspaceId: params._id, - name: params.name, - description: params.description, - members: params.members - }) - - if (res.code === CODE_MAP.SUCCESS) { - ElMessage.success('更新成功') - } else { - ElMessage.error(res.errmsg) - } - }, - async deleteSpace({}, workspaceId) { - try { - const res = await deleteSpace(workspaceId) - - if (res.code === CODE_MAP.SUCCESS) { - ElMessage.success('删除成功') - } else { - ElMessage.error(res.errmsg) - } - } catch (err) { - ElMessage.error(err) - } - }, - async getSurveyList({ state, getters, commit }, payload) { - const filterString = JSON.stringify( - getters.listFliter.filter((item) => { - return item.condition[0].value - }) - ) - const orderString = JSON.stringify(getters.listOrder) - try { - let params = { - curPage: payload?.curPage || 1, - pageSize: payload?.pageSize || 10, // 默认一页10条 - filter: filterString, - order: orderString, - workspaceId: state.workSpaceId - } - // if(payload?.order) { - // params.order = payload.order - // } - // if(payload.filter) { - // params.filter = payload.filter - // } - // if(payload?.workspaceId) { - // params.workspaceId = payload.workspaceId - // } - const res = await surveyList(params) - if (res.code === CODE_MAP.SUCCESS) { - commit('setSurveyList', res.data.data) - commit('setSurveyTotal', res.data.count) - } else { - ElMessage.error(res.errmsg) - } - } catch (error) { - ElMessage.error('getSurveyList status' + error) - } - } - } -} diff --git a/web/src/management/store/mutations.js b/web/src/management/store/mutations.js deleted file mode 100644 index 0bf45451..00000000 --- a/web/src/management/store/mutations.js +++ /dev/null @@ -1,8 +0,0 @@ -export default { - setBannerList(state, data) { - state.bannerList = data - }, - setCooperPermissions(state, data) { - state.cooperPermissions = data - } -} diff --git a/web/src/management/store/state.js b/web/src/management/store/state.js deleted file mode 100644 index 8ef14c4d..00000000 --- a/web/src/management/store/state.js +++ /dev/null @@ -1,5 +0,0 @@ -import { SurveyPermissions } from '@/management/utils/types/workSpace' -export default { - bannerList: [], - cooperPermissions: Object.values(SurveyPermissions) -} diff --git a/web/src/management/store/user/index.js b/web/src/management/store/user/index.js deleted file mode 100644 index 14a991eb..00000000 --- a/web/src/management/store/user/index.js +++ /dev/null @@ -1,64 +0,0 @@ -const USER_INFO_KEY = 'surveyUserInfo' - -export default { - namespaced: true, - state: { - userInfo: { - token: '', - username: '' - }, - hasLogined: false, - loginTime: null, - initialized: false - }, - mutations: { - setUserInfo(state, data) { - state.userInfo = data - }, - setHsLogined(state, data) { - state.hasLogined = data - }, - setLoginTime(state, data) { - state.loginTime = data - }, - setInitialized(state, data) { - state.initialized = data - } - }, - actions: { - init({ dispatch, commit }) { - const localData = localStorage.getItem(USER_INFO_KEY) - if (localData) { - try { - const { userInfo, loginTime } = JSON.parse(localData) - if (Date.now() - loginTime > 7 * 3600000) { - localStorage.removeItem(USER_INFO_KEY) - } else { - dispatch('login', userInfo) - } - } catch (error) { - console.log(error) - } - } - commit('setInitialized', true) - }, - login({ commit }, data) { - const loginTime = Date.now() - commit('setUserInfo', data) - commit('setHsLogined', true) - commit('setLoginTime', loginTime) - localStorage.setItem( - USER_INFO_KEY, - JSON.stringify({ - userInfo: data, - loginTime: loginTime - }) - ) - }, - logout({ commit }) { - commit('setUserInfo', null) - commit('setHsLogined', false) - localStorage.removeItem(USER_INFO_KEY) - } - } -} diff --git a/web/src/management/stores/edit.ts b/web/src/management/stores/edit.ts index 4061c9f0..cad89467 100644 --- a/web/src/management/stores/edit.ts +++ b/web/src/management/stores/edit.ts @@ -4,7 +4,8 @@ import { merge as _merge, cloneDeep as _cloneDeep, set as _set } from 'lodash-es import { getSurveyById } from '@/management/api/survey' import { getNewField } from '@/management/utils' -import submitFormConfig from '@/management/config/setterConfig/submitConfig' + +import submitFormConfig from '@/management/pages/edit/setterConfig/statusConfig' import questionLoader from '@/materials/questions/questionLoader' import { SurveyPermissions } from '@/management/utils/types/workSpace' diff --git a/web/src/management/stores/user.ts b/web/src/management/stores/user.ts index 5b152519..7b2670af 100644 --- a/web/src/management/stores/user.ts +++ b/web/src/management/stores/user.ts @@ -52,4 +52,3 @@ export const useUserStore = defineStore('user', () => { return { userInfo, hasLogined, loginTime, initialized, init, login, logout } }) - diff --git a/web/src/management/stores/workSpace.ts b/web/src/management/stores/workSpace.ts index 4a39e4e4..f9c05c55 100644 --- a/web/src/management/stores/workSpace.ts +++ b/web/src/management/stores/workSpace.ts @@ -41,12 +41,13 @@ export const useWorkSpaceStore = defineStore('workSpace', () => { const workSpaceId = ref('') const spaceDetail = ref(null) const workSpaceList = ref([]) + const workSpaceListTotal = ref(0) const surveyListStore = useSurveyListStore() - async function getSpaceList() { + async function getSpaceList(params = { curPage: 1 }) { try { - const res: any = await getSpaceListReq() + const res: any = await getSpaceListReq(params) if (res.code === CODE_MAP.SUCCESS) { const { list } = res.data @@ -135,6 +136,7 @@ export const useWorkSpaceStore = defineStore('workSpace', () => { workSpaceId, spaceDetail, workSpaceList, + workSpaceListTotal, getSpaceList, getSpaceDetail, changeSpaceType, diff --git a/web/src/management/utils/types/workSpace.ts b/web/src/management/utils/types/workSpace.ts index 4d4f606f..bcecdd97 100644 --- a/web/src/management/utils/types/workSpace.ts +++ b/web/src/management/utils/types/workSpace.ts @@ -16,6 +16,7 @@ export type IWorkspace = { description: string members: IMember[] } + export type IMember = { userId: string username: string diff --git a/web/src/materials/setters/widgets/InputSetter.vue b/web/src/materials/setters/widgets/InputSetter.vue index c9bc7123..b3d37552 100644 --- a/web/src/materials/setters/widgets/InputSetter.vue +++ b/web/src/materials/setters/widgets/InputSetter.vue @@ -2,6 +2,7 @@ diff --git a/web/src/materials/setters/widgets/InputWordLimit.vue b/web/src/materials/setters/widgets/InputWordLimit.vue deleted file mode 100644 index fd08461e..00000000 --- a/web/src/materials/setters/widgets/InputWordLimit.vue +++ /dev/null @@ -1,33 +0,0 @@ - - \ No newline at end of file diff --git a/web/src/materials/setters/widgets/SwitchInput.vue b/web/src/materials/setters/widgets/SwitchInput.vue deleted file mode 100644 index fe954eeb..00000000 --- a/web/src/materials/setters/widgets/SwitchInput.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - \ No newline at end of file diff --git a/web/src/render/App.vue b/web/src/render/App.vue index acafc152..28416b75 100644 --- a/web/src/render/App.vue +++ b/web/src/render/App.vue @@ -2,12 +2,12 @@ diff --git a/web/src/render/pages/RenderPage.vue b/web/src/render/pages/RenderPage.vue index 9757a402..6cf290e1 100644 --- a/web/src/render/pages/RenderPage.vue +++ b/web/src/render/pages/RenderPage.vue @@ -62,7 +62,7 @@ const surveyStore = useSurveyStore() const questionStore = useQuestionStore() const renderData = computed(() => questionStore.renderData) -const { bannerConf, submitConf, bottomConf: logoConf } = storeToRefs(surveyStore) +const { bannerConf, submitConf, bottomConf: logoConf, whiteData } = storeToRefs(surveyStore) const surveyPath = computed(() => surveyStore.surveyPath || '') const validate = (cbk: (v: boolean) => void) => { diff --git a/web/src/render/store/actions.js b/web/src/render/store/actions.js deleted file mode 100644 index 27e45326..00000000 --- a/web/src/render/store/actions.js +++ /dev/null @@ -1,177 +0,0 @@ -import moment from 'moment' -// 引入中文 -import 'moment/locale/zh-cn' -// 设置中文 -moment.locale('zh-cn') -import adapter from '../adapter' -import { queryVote, getEncryptInfo } from '@/render/api/survey' -import { RuleMatch } from '@/common/logicEngine/RulesMatch' -/** - * CODE_MAP不从management引入,在dev阶段,会导致B端 router被加载,进而导致C端路由被添加 baseUrl: /management - */ -const CODE_MAP = { - SUCCESS: 200, - ERROR: 500, - NO_AUTH: 403 -} -const VOTE_INFO_KEY = 'voteinfo' -import router from '../router' -export default { - // 初始化 - init({ commit, dispatch }, { bannerConf, baseConf, bottomConf, dataConf, skinConf, submitConf }) { - commit('setEnterTime') - const { begTime, endTime, answerBegTime, answerEndTime } = baseConf - const { msgContent } = submitConf - const now = Date.now() - if (now < new Date(begTime).getTime()) { - router.push({ name: 'errorPage' }) - commit('setErrorInfo', { - errorType: 'overTime', - errorMsg: `

问卷未到开始填写时间,暂时无法进行填写

-

开始时间为: ${begTime}

` - }) - return - } else if (now > new Date(endTime).getTime()) { - router.push({ name: 'errorPage' }) - commit('setErrorInfo', { - errorType: 'overTime', - errorMsg: msgContent.msg_9001 || '您来晚了,感谢支持问卷~' - }) - return - } else if (answerBegTime && answerEndTime) { - const momentNow = moment() - const todayStr = momentNow.format('yyyy-MM-DD') - const momentStartTime = moment(`${todayStr} ${answerBegTime}`) - const momentEndTime = moment(`${todayStr} ${answerEndTime}`) - if (momentNow.isBefore(momentStartTime) || momentNow.isAfter(momentEndTime)) { - router.push({ name: 'errorPage' }) - commit('setErrorInfo', { - errorType: 'overTime', - errorMsg: `

不在答题时间范围内,暂时无法进行填写

-

答题时间为: ${answerBegTime} ~ ${answerEndTime}

` - }) - return - } - } - router.push({ name: 'renderPage' }) - - // 根据初始的schema生成questionData, questionSeq, rules, formValues, 这四个字段 - const { questionData, questionSeq, rules, formValues } = adapter.generateData({ - bannerConf, - baseConf, - bottomConf, - dataConf, - skinConf, - submitConf - }) - - // 将数据设置到state上 - commit('assignState', { - questionData, - questionSeq, - rules, - bannerConf, - baseConf, - bottomConf, - dataConf, - skinConf, - submitConf, - formValues - }) - // 获取已投票数据 - dispatch('initVoteData') - }, - // 用户输入或者选择后,更新表单数据 - changeData({ commit }, data) { - commit('changeFormData', data) - }, - // 初始化投票题的数据 - async initVoteData({ state, commit }) { - const questionData = state.questionData - const surveyPath = state.surveyPath - - const fieldList = [] - - for (const field in questionData) { - const { type } = questionData[field] - if (/vote/.test(type)) { - fieldList.push(field) - } - } - - if (fieldList.length <= 0) { - return - } - try { - localStorage.removeItem(VOTE_INFO_KEY) - const voteRes = await queryVote({ - surveyPath, - fieldList: fieldList.join(',') - }) - - if (voteRes.code === 200) { - localStorage.setItem( - VOTE_INFO_KEY, - JSON.stringify({ - ...voteRes.data - }) - ) - commit('setVoteMap', voteRes.data) - } - } catch (error) { - console.log(error) - } - }, - updateVoteData({ state, commit }, data) { - const { key: questionKey, value: questionVal } = data - // 更新前获取接口缓存在localStorage中的数据 - const localData = localStorage.getItem(VOTE_INFO_KEY) - const voteinfo = JSON.parse(localData) - const currentQuestion = state.questionData[questionKey] - const options = currentQuestion.options - const voteTotal = voteinfo?.[questionKey]?.total || 0 - let totalPayload = { - questionKey, - voteKey: 'total', - voteValue: voteTotal - } - options.forEach((option) => { - const optionhash = option.hash - const voteCount = voteinfo?.[questionKey]?.[optionhash] || 0 - // 如果选中值包含该选项,对应voteCount 和 voteTotal + 1 - if ( - Array.isArray(questionVal) ? questionVal.includes(optionhash) : questionVal === optionhash - ) { - const countPayload = { - questionKey, - voteKey: optionhash, - voteValue: voteCount + 1 - } - totalPayload.voteValue += 1 - commit('updateVoteMapByKey', countPayload) - } else { - const countPayload = { - questionKey, - voteKey: optionhash, - voteValue: voteCount - } - commit('updateVoteMapByKey', countPayload) - } - commit('updateVoteMapByKey', totalPayload) - }) - }, - async getEncryptInfo({ commit }) { - try { - const res = await getEncryptInfo() - if (res.code === CODE_MAP.SUCCESS) { - commit('setEncryptInfo', res.data) - } - } catch (error) { - console.log(error) - } - }, - async initRuleEngine({ commit }, ruleConf) { - const ruleEngine = new RuleMatch(ruleConf) - commit('setRuleEgine', ruleEngine) - } -} diff --git a/web/src/render/store/getters.js b/web/src/render/store/getters.js deleted file mode 100644 index 79d8a23f..00000000 --- a/web/src/render/store/getters.js +++ /dev/null @@ -1,30 +0,0 @@ -export default { - // 题目列表 - renderData: (state) => { - const { questionSeq, questionData } = state - - let index = 1 - return ( - questionSeq && - questionSeq.reduce((pre, item) => { - const questionArr = [] - - item.forEach((questionKey) => { - const question = { ...questionData[questionKey] } - // 开启显示序号 - if (question.showIndex) { - question.indexNumber = index++ - } - - questionArr.push(question) - }) - - if (questionArr && questionArr.length) { - pre.push(questionArr) - } - - return pre - }, []) - ) - } -} diff --git a/web/src/render/store/index.js b/web/src/render/store/index.js deleted file mode 100644 index 4013b40c..00000000 --- a/web/src/render/store/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { createStore } from 'vuex' - -import state from './state' -import getters from './getters' -import mutations from './mutations' -import actions from './actions' - -export default createStore({ - state, - getters, - mutations, - actions -}) diff --git a/web/src/render/store/mutations.js b/web/src/render/store/mutations.js deleted file mode 100644 index 39585610..00000000 --- a/web/src/render/store/mutations.js +++ /dev/null @@ -1,56 +0,0 @@ -import { forEach, set } from 'lodash-es' -export default { - // 将数据设置到state上 - assignState(state, data) { - forEach(data, (value, key) => { - state[key] = value - }) - }, - setQuestionData(state, data) { - state.questionData = data - }, - setErrorInfo(state, { errorType, errorMsg }) { - state.errorInfo = { - errorType, - errorMsg - } - }, - changeFormData(state, data) { - let { key, value } = data - // console.log('formValues', key, value) - set(state, `formValues.${key}`, value) - }, - changeSelectMoreData(state, data) { - const { key, value, field } = data - set(state, `questionData.${field}.othersValue.${key}`, value) - }, - setEnterTime(state) { - state.enterTime = Date.now() - }, - setSurveyPath(state, data) { - state.surveyPath = data - }, - setVoteMap(state, data) { - state.voteMap = data - }, - updateVoteMapByKey(state, data) { - const { questionKey, voteKey, voteValue } = data - // 兼容为空的情况 - if (!state.voteMap[questionKey]) { - state.voteMap[questionKey] = {} - } - state.voteMap[questionKey][voteKey] = voteValue - }, - setQuestionSeq(state, data) { - state.questionSeq = data - }, - setEncryptInfo(state, data) { - state.encryptInfo = data - }, - setRuleEgine(state, ruleEngine) { - state.ruleEngine = ruleEngine - }, - setWhiteData(state, data) { - state.whiteData = data - } -} diff --git a/web/src/render/store/state.js b/web/src/render/store/state.js deleted file mode 100644 index 11ba0ef0..00000000 --- a/web/src/render/store/state.js +++ /dev/null @@ -1,19 +0,0 @@ -import { isMobile } from '../utils/index' - -export default { - surveyPath: '', - questionData: null, - isMobile: isMobile(), - errorInfo: { - errorType: '', - errorMsg: '' - }, - enterTime: null, - questionSeq: [], // 题目的顺序,因为可能会有分页的情况,所以是一个二维数组[[qid1, qid2], [qid3,qid4]] - voteMap: {}, - encryptInfo: null, - ruleEngine: null, - whiteData: { - - } -} diff --git a/web/src/render/stores/survey.js b/web/src/render/stores/survey.js index 182b1275..23c49c31 100644 --- a/web/src/render/stores/survey.js +++ b/web/src/render/stores/survey.js @@ -37,11 +37,16 @@ export const useSurveyStore = defineStore('survey', () => { const skinConf = ref({}) const submitConf = ref({}) const formValues = ref({}) + const whiteData = ref({}) const router = useRouter() const questionStore = useQuestionStore() const { setErrorInfo } = useErrorInfo() + const setWhiteData = (data) => { + whiteData.value = data + } + const setSurveyPath = (data) => { surveyPath.value = data } @@ -115,7 +120,15 @@ export const useSurveyStore = defineStore('survey', () => { rules: _rules, formValues: _formValues } = adapter.generateData( - pick(option, ['bannerConf', 'baseConf', 'bottomConf', 'dataConf', 'skinConf', 'submitConf']) + pick(option, [ + 'bannerConf', + 'baseConf', + 'bottomConf', + 'dataConf', + 'skinConf', + 'submitConf', + 'whiteData' + ]) ) questionStore.questionData = questionData @@ -130,6 +143,7 @@ export const useSurveyStore = defineStore('survey', () => { skinConf.value = option.skinConf submitConf.value = option.submitConf formValues.value = _formValues + whiteData.value = option.whiteData // 获取已投票数据 questionStore.initVoteData() @@ -156,9 +170,11 @@ export const useSurveyStore = defineStore('survey', () => { skinConf, submitConf, formValues, + whiteData, initSurvey, changeData, + setWhiteData, setSurveyPath, setEnterTime, getEncryptInfo diff --git a/web/src/render/styles/default.scss b/web/src/render/styles/default.scss deleted file mode 100644 index eaebf2a6..00000000 --- a/web/src/render/styles/default.scss +++ /dev/null @@ -1,22 +0,0 @@ -$primary-color: #faa600; -$primary-color-light: hsl(48, 100%, 97%); - -$title-color-deep: #292a36; -$title-color: #4a4c5b; -$font-color: #6e707c; -$remark-color: #4a4c5b; -$placeholder-color: #c8c9cd; -$light-focus-color: #666666; - -$disable-color: #f2f4f7; -$border-color: #dee2e6; - -$spliter-color: #f7f7f7; - -$error-color: #ec4e29; - -@import './variable'; - -$title-size: 0.32rem; -$font-size: 0.28rem; -$tip-size: 0.22rem;