feat: 优化结构
This commit is contained in:
parent
4ac07ef938
commit
d36e33e4df
@ -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,
|
||||
};
|
@ -174,6 +174,7 @@ export class WorkspaceController {
|
||||
pre[id] = cur;
|
||||
return pre;
|
||||
}, {});
|
||||
|
||||
const surveyTotalList = await Promise.all(
|
||||
workspaceIdList.map((item) => {
|
||||
return this.surveyMetaService.countSurveyMetaByWorkspaceId({
|
||||
|
2
web/.gitignore
vendored
2
web/.gitignore
vendored
@ -26,4 +26,4 @@ yarn.lock
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
.history
|
||||
.history
|
122
web/components.d.ts
vendored
122
web/components.d.ts
vendored
@ -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']
|
||||
}
|
||||
}
|
||||
|
7
web/env.d.ts
vendored
7
web/env.d.ts
vendored
@ -1,8 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
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";
|
||||
}
|
||||
|
@ -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"
|
||||
},
|
||||
|
@ -24,7 +24,5 @@ export const replacePxWithRem = (html) => {
|
||||
})
|
||||
})
|
||||
|
||||
console.log('生成的结果', res)
|
||||
|
||||
return res
|
||||
}
|
||||
|
@ -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})$/
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import { type IMember, type ListItem } from '@/management/utils/types/workSpace'
|
||||
import OperationSelect from './OperationSelect.vue'
|
||||
import { useWorkSpaceStore } from '@/management/stores/workSpace'
|
||||
|
||||
const store = useStore()
|
||||
const workSpaceStore = useWorkSpaceStore()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
members: IMember[]
|
||||
@ -43,7 +43,7 @@ const list = computed({
|
||||
}
|
||||
})
|
||||
const currentUserId = computed(() => {
|
||||
return store.state.list.spaceDetail?.currentUserId
|
||||
return workSpaceStore.spaceDetail?.currentUserId
|
||||
})
|
||||
const handleRemove = (index: number) => {
|
||||
list.value.splice(index, 1)
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import MemberList from './MemberList.vue'
|
||||
import { getUserList } from '@/management/api/space'
|
||||
import {
|
||||
@ -33,8 +32,9 @@ import {
|
||||
roleLabels
|
||||
} from '@/management/utils/types/workSpace'
|
||||
import { CODE_MAP } from '@/management/api/base'
|
||||
import { useUserStore } from '@/management/stores/user'
|
||||
|
||||
const store = useStore()
|
||||
const userStore = useUserStore()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
members?: IMember[]
|
||||
@ -65,7 +65,7 @@ const remoteMethod = async (query: string) => {
|
||||
if (res.code === CODE_MAP.SUCCESS) {
|
||||
selectOptions.value = res.data.map((item: any) => {
|
||||
// 不可以选中自己
|
||||
const currentUser = item.username === store.state.user.userInfo.username
|
||||
const currentUser = item.username === userStore.userInfo?.username
|
||||
return {
|
||||
value: item.userId,
|
||||
label: item.username,
|
||||
|
@ -133,9 +133,6 @@ const onPreviewImage = (e) => {
|
||||
}
|
||||
|
||||
.table-row-cell {
|
||||
white-space: nowrap; /* 禁止自动换行 */
|
||||
overflow: hidden; /* 超出部分隐藏 */
|
||||
text-overflow: ellipsis; /* 显示省略号 */
|
||||
:deep(img) {
|
||||
height: 23px !important;
|
||||
width: auto !important;
|
||||
|
@ -42,6 +42,7 @@ import PublishPanel from '../modules/contentModule/PublishPanel.vue'
|
||||
import CooperationPanel from '../modules/contentModule/CooperationPanel.vue'
|
||||
|
||||
const editStore = useEditStore()
|
||||
const { schema, changeSchema } = editStore
|
||||
const title = computed(() => (editStore.schema?.metaData as any)?.title || '')
|
||||
// 校验 - 逻辑
|
||||
const updateLogicConf = () => {
|
||||
@ -67,10 +68,12 @@ const updateLogicConf = () => {
|
||||
|
||||
const showLogicConf = showLogicEngine.value.toJson()
|
||||
// 更新逻辑配置
|
||||
store.dispatch('edit/changeSchema', { key: 'logicConf', value: { showLogicConf } })
|
||||
changeSchema({ key: 'logicConf', value: { showLogicConf } })
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
// 校验 - 白名单
|
||||
@ -79,7 +82,7 @@ const updateWhiteConf = () => {
|
||||
validated: true,
|
||||
message: ''
|
||||
}
|
||||
const baseConf = store.state.edit.schema.baseConf || {}
|
||||
const baseConf = (schema?.baseConf as any) || {}
|
||||
if (baseConf.passwordSwitch && !baseConf.password) {
|
||||
res = {
|
||||
validated: false,
|
||||
@ -99,6 +102,11 @@ const updateWhiteConf = () => {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import url('@/management/styles/edit-btn.scss');
|
||||
.view-icon {
|
||||
font-size: 20px;
|
||||
height: 29px;
|
||||
line-height: 29px;
|
||||
}
|
||||
.nav {
|
||||
width: 100%;
|
||||
height: 56px;
|
||||
|
@ -113,7 +113,7 @@ const normalizationValues = (configList: Array<any> = []) => {
|
||||
if (item.hidden) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// 动态显隐设置器
|
||||
if (_isFunction(item.relyFunc)) {
|
||||
return item.relyFunc(props.moduleConfig)
|
||||
|
@ -25,8 +25,7 @@
|
||||
</el-popover>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { get as _get } from 'lodash-es'
|
||||
import { ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
import moment from 'moment'
|
||||
|
@ -67,12 +67,6 @@ const handlePublish = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
if (updateWhiteConf()) {
|
||||
isPublishing.value = false
|
||||
ElMessage.error('请检查问卷设置是否有误')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const saveRes: any = await saveSurvey(saveData)
|
||||
if (saveRes.code !== 200) {
|
||||
|
@ -15,11 +15,9 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, nextTick, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import { get as _get } from 'lodash-es'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import 'element-plus/theme-chalk/src/message.scss'
|
||||
|
||||
@ -33,7 +31,6 @@ interface Props {
|
||||
|
||||
const route = useRoute()
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const isSaving = ref<boolean>(false)
|
||||
const isShowAutoSave = ref<boolean>(false)
|
||||
const autoSaveStatus = ref<'succeed' | 'saving' | 'failed'>('succeed')
|
||||
@ -48,7 +45,7 @@ const saveText = computed(
|
||||
|
||||
const editStore = useEditStore()
|
||||
const { schemaUpdateTime } = storeToRefs(editStore)
|
||||
const { schema, changeSchema } = editStore
|
||||
const { schema } = editStore
|
||||
|
||||
const validate = () => {
|
||||
let checked = true
|
||||
@ -130,7 +127,6 @@ const handleSave = async () => {
|
||||
const { checked, msg } = validate()
|
||||
if (!checked) {
|
||||
isSaving.value = false
|
||||
ElMessage.error('请检查问卷设置是否有误')
|
||||
ElMessage.error(msg)
|
||||
return
|
||||
}
|
||||
|
@ -17,10 +17,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
import { EDIT_STATUS_MAP } from '../enum'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
import { EDIT_STATUS_MAP } from './components/enum'
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
|
||||
const editStore = useEditStore()
|
||||
const { currentEditStatus } = storeToRefs(editStore)
|
||||
const statusList = [
|
@ -16,9 +16,9 @@ import { toRef } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
|
||||
import SuccessContent from '../components/SuccessContent.vue'
|
||||
import OverTime from '../components/OverTime.vue'
|
||||
import { EDIT_STATUS_MAP } from '../enum'
|
||||
import SuccessContent from './components/SuccessContent.vue'
|
||||
import OverTime from './components/OverTime.vue'
|
||||
import { EDIT_STATUS_MAP } from './components/enum'
|
||||
|
||||
const components = {
|
||||
[EDIT_STATUS_MAP.SUCCESS]: SuccessContent,
|
@ -30,7 +30,7 @@ import { get as _get } from 'lodash-es'
|
||||
|
||||
import FormItem from '@/materials/setters/widgets/FormItem.vue'
|
||||
import setterLoader from '@/materials/setters/setterLoader'
|
||||
import statusConfig from '../config/statusConfig'
|
||||
import statusConfig from '@/management/pages/edit/setterConfig/statusConfig'
|
||||
|
||||
const textMap = {
|
||||
Success: '提交成功页面配置',
|
34
web/src/management/pages/edit/modules/resultModule/components/OverTime.vue
Executable file
34
web/src/management/pages/edit/modules/resultModule/components/OverTime.vue
Executable file
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="over-time">
|
||||
<img class="over-img" src="/imgs/icons/overtime.webp" />
|
||||
<p class="title-msg" v-safe-html="resultText"></p>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
interface Props {
|
||||
moduleConfig: any
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const resultText = computed(() => props.moduleConfig?.msgContent?.msg_9001 || '问卷已过期')
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.over-time {
|
||||
text-align: center;
|
||||
margin-bottom: 5.5rem;
|
||||
height: 100%;
|
||||
|
||||
.title-msg {
|
||||
width: 100%;
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.over-time .over-img {
|
||||
margin-top: 1.6rem;
|
||||
margin-bottom: 15px;
|
||||
width: 100px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="suc-page">
|
||||
<div class="suc-content">
|
||||
<div class="title-box">
|
||||
<img src="/imgs/icons/success.webp" class="success-img" />
|
||||
<div class="title-msg" v-safe-html="successText"></div>
|
||||
</div>
|
||||
<div class="bottom-btn"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
interface Props {
|
||||
moduleConfig: any
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const successText = computed(() => props.moduleConfig?.msgContent?.msg_200 || '')
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/*成功页面跳转全屏展示浮层*/
|
||||
.suc-page {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
.success-img {
|
||||
margin-top: -0.2rem;
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.suc-content {
|
||||
max-width: 920px;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding-top: 1.8rem;
|
||||
}
|
||||
|
||||
.title-msg {
|
||||
margin-top: 0.4rem;
|
||||
margin-bottom: 0.4rem;
|
||||
font-size: 0.36rem;
|
||||
color: #666;
|
||||
:deep(*) {
|
||||
font-size: 0.36rem;
|
||||
}
|
||||
}
|
||||
.bottom-btn {
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
@ -38,14 +38,13 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, onMounted, shallowRef } from 'vue'
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
import { useStore } from 'vuex'
|
||||
import {
|
||||
cloneDeep as _cloneDeep,
|
||||
isArray as _isArray,
|
||||
get as _get,
|
||||
isFunction as _isFunction
|
||||
} from 'lodash-es'
|
||||
import { useEditStore } from '@/management/stores/edit'
|
||||
|
||||
import baseConfig from '@/management/pages/edit/setterConfig/baseConfig'
|
||||
import baseFormConfig from '@/management/pages/edit/setterConfig/baseFormConfig'
|
||||
@ -55,6 +54,9 @@ import setterLoader from '@/materials/setters/setterLoader'
|
||||
import WhiteList from './components/WhiteList.vue'
|
||||
import TeamMemberList from './components/TeamMemberList.vue'
|
||||
|
||||
const editStore = useEditStore()
|
||||
const { schema, changeSchema } = editStore
|
||||
|
||||
const formConfigList = ref<Array<any>>([])
|
||||
const components = shallowRef<any>({
|
||||
['WhiteList']: WhiteList,
|
||||
@ -65,8 +67,8 @@ const registerTypes = ref<any>({
|
||||
WhiteList: 'WhiteList',
|
||||
TeamMemberList: 'TeamMemberList'
|
||||
})
|
||||
const store = useStore()
|
||||
const schemaBaseConf = computed(() => store.state.edit?.schema?.baseConf || {})
|
||||
|
||||
const schemaBaseConf = computed(() => schema?.baseConf || {})
|
||||
|
||||
const setterList = computed(() => {
|
||||
const list = _cloneDeep(formConfigList.value)
|
||||
@ -173,7 +175,6 @@ onMounted(async () => {
|
||||
padding-bottom: 19px;
|
||||
margin-bottom: 10px;
|
||||
border-bottom: 1px solid $border-color;
|
||||
padding-left: 30px;
|
||||
|
||||
span {
|
||||
position: relative;
|
||||
|
@ -1,23 +1,33 @@
|
||||
<template>
|
||||
<div class="team-member-wrap">
|
||||
<div class="team-tree-wrap">
|
||||
<el-tree ref="treeRef" :default-expanded-keys="defaultCheckedKeys" :default-checked-keys="defaultCheckedKeys"
|
||||
:data="treeData" empty-text="暂无数据" @check="handleChange" style="height:201px" highlight-current show-checkbox
|
||||
node-key="id" :props="defaultProps" />
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
:default-expanded-keys="defaultCheckedKeys"
|
||||
:default-checked-keys="defaultCheckedKeys"
|
||||
:data="treeData"
|
||||
empty-text="暂无数据"
|
||||
@check="handleChange"
|
||||
style="height: 201px"
|
||||
highlight-current
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
:props="defaultProps"
|
||||
/>
|
||||
</div>
|
||||
<div class="member-count">
|
||||
已选择 <span>{{ selectCount }}</span> 人
|
||||
</div>
|
||||
<div class="member-count">已选择 <span>{{ selectCount }}</span> 人</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, computed, defineProps, defineEmits, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'
|
||||
import {
|
||||
getMemberList
|
||||
} from '@/management/api/space'
|
||||
import { getMemberList } from '@/management/api/space'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
formConfig: Object,
|
||||
formConfig: Object
|
||||
})
|
||||
const emit = defineEmits([FORM_CHANGE_EVENT_KEY])
|
||||
|
||||
@ -26,58 +36,53 @@ const treeData = ref([])
|
||||
const defaultCheckedKeys = ref([])
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
label: 'label'
|
||||
}
|
||||
|
||||
const handleChange = () => {
|
||||
const key = props.formConfig.key;
|
||||
const userKeys = treeRef.value?.getCheckedKeys(true);
|
||||
const key = props.formConfig.key
|
||||
const userKeys = treeRef.value?.getCheckedKeys(true)
|
||||
if (userKeys.length > 100) {
|
||||
ElMessage.error('最多添加100个')
|
||||
return;
|
||||
return
|
||||
}
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key: key, value: userKeys });
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key: key, value: userKeys })
|
||||
}
|
||||
|
||||
|
||||
const selectCount = computed(() => {
|
||||
return treeRef.value?.getCheckedKeys(true).length || 0
|
||||
})
|
||||
|
||||
|
||||
const getSpaceMenus = async () => {
|
||||
const res = await getMemberList();
|
||||
const res = await getMemberList()
|
||||
if (res.code != 200) {
|
||||
ElMessage.error('获取空间成员列表失败');
|
||||
return
|
||||
ElMessage.error('获取空间成员列表失败')
|
||||
}
|
||||
const data = res.data;
|
||||
const data = res.data
|
||||
data.map((v) => {
|
||||
const members = v.members || [];
|
||||
const members = v.members || []
|
||||
treeData.value.push({
|
||||
id: v.ownerId,
|
||||
label: v.name,
|
||||
children: members?.map(v => ({
|
||||
children: members?.map((v) => ({
|
||||
id: v.userId,
|
||||
label: v.role,
|
||||
label: v.role
|
||||
}))
|
||||
})
|
||||
})
|
||||
defaultCheckedKeys.value = props.formConfig.value;
|
||||
defaultCheckedKeys.value = props.formConfig.value
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getSpaceMenus();
|
||||
getSpaceMenus()
|
||||
})
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.team-member-wrap {
|
||||
width: 508px;
|
||||
|
||||
.team-tree-wrap {
|
||||
background: #FFFFFF;
|
||||
background: #ffffff;
|
||||
border: 1px solid rgba(227, 228, 232, 1);
|
||||
border-radius: 2px;
|
||||
min-height: 204px;
|
||||
@ -93,4 +98,4 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -1,55 +1,64 @@
|
||||
<template>
|
||||
<div class="white-list-wrap">
|
||||
<el-button class="create-btn" type="primary" @click="whiteVisible=true">
|
||||
添加
|
||||
</el-button>
|
||||
<el-button v-if="whitelist.length>0" class="create-btn" color="#4A4C5B" @click="delAllList">
|
||||
<el-button class="create-btn" type="primary" @click="whiteVisible = true"> 添加 </el-button>
|
||||
<el-button v-if="whitelist.length > 0" class="create-btn" color="#4A4C5B" @click="delAllList">
|
||||
全部删除
|
||||
</el-button>
|
||||
<el-table class="table-wrap" empty-text="暂无数据" :data="whitelist" height="240" style="width: 426px">
|
||||
<el-table-column label="名单" width="350" >
|
||||
<el-table
|
||||
class="table-wrap"
|
||||
empty-text="暂无数据"
|
||||
:data="whitelist"
|
||||
height="240"
|
||||
style="width: 426px"
|
||||
>
|
||||
<el-table-column label="名单" width="350">
|
||||
<template #default="scope">
|
||||
<div>{{ whitelist[scope.$index] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="74" >
|
||||
<div>{{ whitelist[scope.$index] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="74">
|
||||
<template #default="scope">
|
||||
<div @click="delRowItem(scope.$index)" class="flex cursor"><i-ep-delete :size="16" /></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<div @click="delRowItem(scope.$index)" class="flex cursor">
|
||||
<i-ep-delete :size="16" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-dialog v-model="whiteVisible" title="添加白名单" width="600" @closed="handleClose">
|
||||
<div>
|
||||
<el-form-item label-position="top" label="类型选择" label-width="auto">
|
||||
<el-radio-group v-model="memberType" >
|
||||
<el-form-item label-position="top" label="类型选择" label-width="auto">
|
||||
<el-radio-group v-model="memberType" @change="handleTypeChange">
|
||||
<el-radio value="MOBILE">手机号</el-radio>
|
||||
<el-radio value="EMAIL">邮箱</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label-position="top" class="flex-column" label="名单录入" label-width="auto">
|
||||
<el-input v-model="whiteTextarea" placeholder="多个用逗号(半角)“,”隔开" rows="7" resize="none" type="textarea" />
|
||||
<el-input
|
||||
v-model="whiteTextarea"
|
||||
placeholder="多个用逗号(半角)“,”隔开"
|
||||
rows="7"
|
||||
resize="none"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="whiteVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleChange">
|
||||
确定
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleChange"> 确定 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
import { ref,nextTick } from 'vue'
|
||||
import { ref, nextTick } from 'vue'
|
||||
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { regexpMap } from '@/common/regexpMap.ts'
|
||||
|
||||
const props = defineProps({
|
||||
formConfig: Object,
|
||||
formConfig: Object
|
||||
})
|
||||
const emit = defineEmits([FORM_CHANGE_EVENT_KEY])
|
||||
|
||||
@ -59,36 +68,40 @@ const whiteVisible = ref(false)
|
||||
const whiteTextarea = ref(whitelist.value.join(','))
|
||||
|
||||
const regularMap = {
|
||||
MOBILE:regexpMap.m,
|
||||
EMAIL:regexpMap.e
|
||||
MOBILE: regexpMap.m,
|
||||
EMAIL: regexpMap.e
|
||||
}
|
||||
|
||||
|
||||
const checkValRule = (list) => {
|
||||
let status = false;
|
||||
if (list.length > 100) {
|
||||
let status = false
|
||||
if (list.length > 100) {
|
||||
ElMessage.error('最多添加100个')
|
||||
return true;
|
||||
};
|
||||
const pattern = regularMap[memberType.value];
|
||||
if(!pattern) return false;
|
||||
return true
|
||||
}
|
||||
const pattern = regularMap[memberType.value]
|
||||
if (!pattern) return false
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (!pattern.test(list[i])) {
|
||||
status = true;
|
||||
ElMessage.error('数据格式错误,请检查后重新输入~')
|
||||
break;
|
||||
status = true
|
||||
ElMessage.error('格式错误,请检查后重新输入~')
|
||||
break
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
||||
return status
|
||||
}
|
||||
|
||||
|
||||
const handleTypeChange = () => {
|
||||
whiteTextarea.value = ''
|
||||
}
|
||||
|
||||
const handleChange = () => {
|
||||
const keys = props.formConfig.keys;
|
||||
const keys = props.formConfig.keys
|
||||
const list = whiteTextarea.value ? whiteTextarea.value.split(',') : []
|
||||
if(checkValRule(list)) return
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key:keys[0], value: list });
|
||||
if (checkValRule(list)) return
|
||||
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key: keys[0], value: list })
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key: keys[1], value: memberType.value })
|
||||
whiteVisible.value = false
|
||||
}
|
||||
@ -102,44 +115,41 @@ const handleClose = () => {
|
||||
}
|
||||
|
||||
const delRowItem = (index) => {
|
||||
whitelist.value.splice(index, 1);
|
||||
whitelist.value.splice(index, 1)
|
||||
whiteTextarea.value = whitelist.value.join(',')
|
||||
const keys = props.formConfig.keys;
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key:keys[0], value: whitelist.value });
|
||||
const keys = props.formConfig.keys
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key: keys[0], value: whitelist.value })
|
||||
}
|
||||
|
||||
const delAllList = () => {
|
||||
whitelist.value = []
|
||||
whiteTextarea.value = ''
|
||||
handleChange();
|
||||
handleChange()
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.white-list-wrap {
|
||||
.flex-column{
|
||||
.flex-column {
|
||||
flex-direction: column;
|
||||
}
|
||||
:deep(th){
|
||||
padding:4px 0;
|
||||
background: #F6F7F9;
|
||||
:deep(th) {
|
||||
padding: 4px 0;
|
||||
background: #f6f7f9;
|
||||
}
|
||||
:deep(td){
|
||||
padding:6px 0;
|
||||
:deep(td) {
|
||||
padding: 6px 0;
|
||||
}
|
||||
.table-wrap{
|
||||
.table-wrap {
|
||||
margin-top: 16px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 2px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.cursor{
|
||||
.cursor {
|
||||
cursor: pointer;
|
||||
}
|
||||
.flex{
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
</style>
|
@ -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;
|
@ -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()
|
35
web/src/management/pages/edit/setterConfig/bannerConfig.js
Normal file
35
web/src/management/pages/edit/setterConfig/bannerConfig.js
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
]
|
@ -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'
|
||||
]
|
||||
}
|
||||
]
|
@ -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'
|
||||
}
|
16
web/src/management/pages/edit/setterConfig/logoConfig.js
Normal file
16
web/src/management/pages/edit/setterConfig/logoConfig.js
Normal file
@ -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' }
|
||||
}
|
||||
]
|
48
web/src/management/pages/edit/setterConfig/skinConfig.js
Normal file
48
web/src/management/pages/edit/setterConfig/skinConfig.js
Normal file
@ -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
|
||||
}
|
||||
]
|
26
web/src/management/pages/edit/setterConfig/statusConfig.js
Normal file
26
web/src/management/pages/edit/setterConfig/statusConfig.js
Normal file
@ -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'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
62
web/src/management/pages/edit/setterConfig/submitConfig.js
Normal file
62
web/src/management/pages/edit/setterConfig/submitConfig.js
Normal file
@ -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: '提交失败!'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -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;
|
||||
}
|
||||
|
@ -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 })
|
||||
|
@ -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({
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
export default {
|
||||
currentEditOne: null,
|
||||
currentEditStatus: 'Success',
|
||||
schemaUpdateTime: Date.now(),
|
||||
surveyId: '', // url上取的surveyId
|
||||
schema: {
|
||||
metaData: null,
|
||||
bannerConf: {
|
||||
titleConfig: {
|
||||
mainTitle: '<h3 style="text-align: center">欢迎填写问卷</h3>',
|
||||
subTitle: `<p>为了给您提供更好的服务,希望您能抽出几分钟时间,将您的感受和建议告诉我们,<span style="color: rgb(204, 0, 0)">期待您的参与!</span></p>`,
|
||||
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: []
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
})
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
export default {
|
||||
setBannerList(state, data) {
|
||||
state.bannerList = data
|
||||
},
|
||||
setCooperPermissions(state, data) {
|
||||
state.cooperPermissions = data
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
import { SurveyPermissions } from '@/management/utils/types/workSpace'
|
||||
export default {
|
||||
bannerList: [],
|
||||
cooperPermissions: Object.values(SurveyPermissions)
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
@ -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'
|
||||
|
@ -52,4 +52,3 @@ export const useUserStore = defineStore('user', () => {
|
||||
|
||||
return { userInfo, hasLogined, loginTime, initialized, init, login, logout }
|
||||
})
|
||||
|
||||
|
@ -41,12 +41,13 @@ export const useWorkSpaceStore = defineStore('workSpace', () => {
|
||||
const workSpaceId = ref('')
|
||||
const spaceDetail = ref<SpaceDetail | null>(null)
|
||||
const workSpaceList = ref<SpaceItem[]>([])
|
||||
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,
|
||||
|
@ -16,6 +16,7 @@ export type IWorkspace = {
|
||||
description: string
|
||||
members: IMember[]
|
||||
}
|
||||
|
||||
export type IMember = {
|
||||
userId: string
|
||||
username: string
|
||||
|
@ -2,6 +2,7 @@
|
||||
<el-input
|
||||
:placeholder="formConfig.placeholder"
|
||||
v-model="modelValue"
|
||||
:maxlength="formConfig.maxLength"
|
||||
@blur="handleInputBlur"
|
||||
></el-input>
|
||||
</template>
|
||||
|
@ -1,33 +0,0 @@
|
||||
<template>
|
||||
<el-input
|
||||
:maxlength="maxLength"
|
||||
v-model="modelValue"
|
||||
:placeholder="placeholder"
|
||||
show-word-limit
|
||||
type="text"
|
||||
@change="handleInputChange"
|
||||
/>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed,ref } from 'vue'
|
||||
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'
|
||||
|
||||
const props = defineProps({
|
||||
formConfig: Object,
|
||||
})
|
||||
const emit = defineEmits([FORM_CHANGE_EVENT_KEY])
|
||||
|
||||
const modelValue = ref(props.formConfig.value || '')
|
||||
|
||||
const maxLength = computed(() => props.formConfig.maxLength || 10)
|
||||
|
||||
const placeholder = computed(() => props.formConfig.placeholder || '')
|
||||
|
||||
const handleInputChange = (value) => {
|
||||
const key = props.formConfig.key
|
||||
|
||||
modelValue.value = value
|
||||
emit(FORM_CHANGE_EVENT_KEY, { key, value })
|
||||
}
|
||||
|
||||
</script>
|
@ -1,52 +0,0 @@
|
||||
<template>
|
||||
<div class="switch-input-wrap">
|
||||
<el-switch v-model="passwordSwitch" @change="changeData(props.formConfig.keys[0],passwordSwitch)" />
|
||||
<InputWordLimit
|
||||
v-if="passwordSwitch"
|
||||
class="mt16"
|
||||
@form-change="handleFormChange"
|
||||
:formConfig="{
|
||||
...props.formConfig,
|
||||
key: props.formConfig.keys[1],
|
||||
value:props.formConfig?.value[1]
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'
|
||||
import InputWordLimit from './InputWordLimit.vue'
|
||||
|
||||
const store = useStore();
|
||||
const props = defineProps({
|
||||
formConfig: Object,
|
||||
})
|
||||
const emit = defineEmits([FORM_CHANGE_EVENT_KEY])
|
||||
const passwordSwitch = ref(props.formConfig?.value[0] || false);
|
||||
|
||||
|
||||
const changeData = (key, value) => {
|
||||
emit(FORM_CHANGE_EVENT_KEY, {
|
||||
key,
|
||||
value
|
||||
})
|
||||
|
||||
}
|
||||
const handleFormChange = (data) => {
|
||||
store.dispatch('edit/changeSchema', {
|
||||
key: data.key,
|
||||
value: data.value
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.switch-input-wrap{
|
||||
width: 100%;
|
||||
.mt16{
|
||||
margin-top: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -2,12 +2,12 @@
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import { get as _get } from 'lodash-es'
|
||||
import { watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
const store = useStore()
|
||||
const skinConf = computed(() => _get(store, 'state.skinConf', {}))
|
||||
import { useSurveyStore } from './stores/survey'
|
||||
|
||||
const { skinConf } = storeToRefs(useSurveyStore())
|
||||
|
||||
const updateSkinConfig = (value: any) => {
|
||||
const root = document.documentElement
|
||||
|
@ -33,9 +33,9 @@ export const getEncryptInfo = () => {
|
||||
return axios.get('/clientEncrypt/getEncryptInfo')
|
||||
}
|
||||
|
||||
export const validate = ({ surveyPath,password, whitelist }) => {
|
||||
export const validate = ({ surveyPath, password, whitelist }) => {
|
||||
return axios.post(`/responseSchema/${surveyPath}/validate`, {
|
||||
password,
|
||||
whitelist
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,6 @@ watch(
|
||||
key: field,
|
||||
value: value
|
||||
}
|
||||
// store.commit('changeFormData', data)
|
||||
surveyStore.changeData(data)
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +1,52 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="whiteVisible"
|
||||
title="验证"
|
||||
:show-close="false"
|
||||
class="verify-white-wrap"
|
||||
width="315"
|
||||
:close-on-press-escape="false"
|
||||
:close-on-click-modal="false"
|
||||
align-center
|
||||
|
||||
>
|
||||
<template #header>
|
||||
<div class="verify-white-head">
|
||||
<div class="verify-white-title">验证</div>
|
||||
<div v-if="whitelistTip" class="verify-white-tips">{{ whitelistTip }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="verify-white-body">
|
||||
<el-input v-if="isPwd" v-model="state.password" class="wd255 mb16" placeholder="请输入6位字符串类型访问密码" />
|
||||
<el-input v-if="isValue" v-model="state.value" class="wd255 mb16" :placeholder="placeholder" />
|
||||
<div class="submit-btn" @click="handleSubmit">验证并开始答题</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
v-model="whiteVisible"
|
||||
title="验证"
|
||||
:show-close="false"
|
||||
class="verify-white-wrap"
|
||||
width="315"
|
||||
:close-on-press-escape="false"
|
||||
:close-on-click-modal="false"
|
||||
align-center
|
||||
>
|
||||
<template #header>
|
||||
<div class="verify-white-head">
|
||||
<div class="verify-white-title">验证</div>
|
||||
<div v-if="whitelistTip" class="verify-white-tips">{{ whitelistTip }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="verify-white-body">
|
||||
<el-input
|
||||
v-if="isPwd"
|
||||
v-model="state.password"
|
||||
class="wd255 mb16"
|
||||
placeholder="请输入6位字符串类型访问密码"
|
||||
/>
|
||||
<el-input
|
||||
v-if="isValue"
|
||||
v-model="state.value"
|
||||
class="wd255 mb16"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
<div class="submit-btn" @click="handleSubmit">验证并开始答题</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref,reactive,computed,watch} from 'vue'
|
||||
import { validate } from '../api/survey'
|
||||
import { useStore } from 'vuex'
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import 'element-plus/theme-chalk/src/message.scss'
|
||||
|
||||
import { validate } from '../api/survey'
|
||||
import { useSurveyStore } from '../stores/survey'
|
||||
|
||||
const whiteVisible = ref(false)
|
||||
|
||||
|
||||
const store = useStore()
|
||||
const surveyStore = useSurveyStore()
|
||||
const state = reactive({
|
||||
password: '',
|
||||
value: '',
|
||||
is_submit:false
|
||||
password: '',
|
||||
value: '',
|
||||
is_submit: false
|
||||
})
|
||||
|
||||
const baseConf = computed(() => store.state.baseConf || {})
|
||||
@ -48,91 +57,91 @@ const whitelistTip = computed(() => baseConf.value.whitelistTip)
|
||||
const surveyPath = computed(() => store.state?.surveyPath || '')
|
||||
|
||||
const isValue = computed(() => {
|
||||
if(!whitelistType.value) return false
|
||||
return whitelistType.value!='ALL'
|
||||
if (!whitelistType.value) return false
|
||||
return whitelistType.value != 'ALL'
|
||||
})
|
||||
|
||||
const placeholder = computed(() => {
|
||||
if (whitelistType.value == 'MEMBER') {
|
||||
return '请输入用户名'
|
||||
}
|
||||
if(memberType.value == 'MOBILE'){
|
||||
return '请输入手机号'
|
||||
}
|
||||
if(memberType.value == 'EMAIL'){
|
||||
return '请输入邮箱'
|
||||
}
|
||||
return ''
|
||||
if (whitelistType.value == 'MEMBER') {
|
||||
return '请输入用户名'
|
||||
}
|
||||
if (memberType.value == 'MOBILE') {
|
||||
return '请输入手机号'
|
||||
}
|
||||
if (memberType.value == 'EMAIL') {
|
||||
return '请输入邮箱'
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
const handleSubmit = async() => {
|
||||
if (state.is_submit) return;
|
||||
const params = {
|
||||
surveyPath:surveyPath.value
|
||||
}
|
||||
if (isValue.value) {
|
||||
params.whitelist = state.value
|
||||
}
|
||||
if(isPwd.value){
|
||||
params.password = state.password
|
||||
}
|
||||
const res = await validate(params)
|
||||
if (res.code != 200) {
|
||||
ElMessage.error(res.errmsg || '验证失败')
|
||||
return
|
||||
}
|
||||
whiteVisible.value = false
|
||||
store.commit('setWhiteData',params)
|
||||
const handleSubmit = async () => {
|
||||
if (state.is_submit) return
|
||||
const params = {
|
||||
surveyPath: surveyPath.value
|
||||
}
|
||||
if (isValue.value) {
|
||||
params.whitelist = state.value
|
||||
}
|
||||
if (isPwd.value) {
|
||||
params.password = state.password
|
||||
}
|
||||
const res = await validate(params)
|
||||
if (res.code != 200) {
|
||||
ElMessage.error(res.errmsg || '验证失败')
|
||||
return
|
||||
}
|
||||
whiteVisible.value = false
|
||||
surveyStore.setWhiteData(params)
|
||||
}
|
||||
|
||||
watch(()=>baseConf.value, () => {
|
||||
if (whiteVisible.value) return
|
||||
if(isValue.value || isPwd.value){
|
||||
whiteVisible.value = true;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(
|
||||
() => baseConf.value,
|
||||
() => {
|
||||
if (whiteVisible.value) return
|
||||
if (isValue.value || isPwd.value) {
|
||||
whiteVisible.value = true
|
||||
}
|
||||
}
|
||||
)
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.verify-white-wrap{
|
||||
.verify-white-body{
|
||||
padding:0 14px
|
||||
}
|
||||
.verify-white-head{
|
||||
padding:0 14px;
|
||||
margin-bottom: 8px;
|
||||
margin-top:2px;
|
||||
}
|
||||
.mb16{
|
||||
margin-bottom:16px;
|
||||
}
|
||||
.verify-white-tips{
|
||||
text-align: center;
|
||||
margin-top:8px;
|
||||
font-size: 14px;
|
||||
color: #92949D;
|
||||
}
|
||||
.verify-white-title{
|
||||
font-size: 16px;
|
||||
color: #292A36;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
.submit-btn{
|
||||
background: #FAA600;
|
||||
border-radius: 2px;
|
||||
width:255px;
|
||||
height:32px;
|
||||
color:#fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top:4px;
|
||||
margin-bottom:14px;
|
||||
}
|
||||
.verify-white-wrap {
|
||||
.verify-white-body {
|
||||
padding: 0 14px;
|
||||
}
|
||||
.verify-white-head {
|
||||
padding: 0 14px;
|
||||
margin-bottom: 8px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.mb16 {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.verify-white-tips {
|
||||
text-align: center;
|
||||
margin-top: 8px;
|
||||
font-size: 14px;
|
||||
color: #92949d;
|
||||
}
|
||||
.verify-white-title {
|
||||
font-size: 16px;
|
||||
color: #292a36;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.submit-btn {
|
||||
background: #faa600;
|
||||
border-radius: 2px;
|
||||
width: 255px;
|
||||
height: 32px;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -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) => {
|
||||
|
@ -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: `<p>问卷未到开始填写时间,暂时无法进行填写<p/>
|
||||
<p>开始时间为: ${begTime}</p>`
|
||||
})
|
||||
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: `<p>不在答题时间范围内,暂时无法进行填写<p/>
|
||||
<p>答题时间为: ${answerBegTime} ~ ${answerEndTime}</p>`
|
||||
})
|
||||
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)
|
||||
}
|
||||
}
|
@ -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
|
||||
}, [])
|
||||
)
|
||||
}
|
||||
}
|
@ -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
|
||||
})
|
@ -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
|
||||
}
|
||||
}
|
@ -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: {
|
||||
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user