feat: 代码format、升级ts和lint
This commit is contained in:
parent
5bc5eb8719
commit
da1749fb53
@ -61,8 +61,8 @@
|
||||
"@types/node": "^20.3.1",
|
||||
"@types/node-forge": "^1.3.11",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
||||
"@typescript-eslint/parser": "^7.16.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.42.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
@ -76,7 +76,7 @@
|
||||
"ts-loader": "^9.4.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"typescript": "^5.1.3"
|
||||
"typescript": "^5.5.3"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
|
@ -40,7 +40,7 @@
|
||||
"skinColor": "#4a4c5b",
|
||||
"inputBgColor": "#ffffff",
|
||||
"backgroundConf": {
|
||||
"color": "#fff"
|
||||
"color": "#ffffff"
|
||||
},
|
||||
"themeConf": {
|
||||
"color": "#ffa600"
|
||||
@ -52,4 +52,4 @@
|
||||
"logicConf": {
|
||||
"showLogicConf": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,9 @@ export function getListHeadByDataList(dataList) {
|
||||
let othersCode;
|
||||
const radioType = ['radio-star', 'radio-nps'];
|
||||
if (radioType.includes(question.type)) {
|
||||
const rangeConfigKeys = question.rangeConfig ? Object.keys(question.rangeConfig) : [];
|
||||
const rangeConfigKeys = question.rangeConfig
|
||||
? Object.keys(question.rangeConfig)
|
||||
: [];
|
||||
if (rangeConfigKeys.length > 0) {
|
||||
othersCode = [{ code: `${question.field}_custom`, option: '填写理由' }];
|
||||
}
|
||||
|
@ -154,10 +154,12 @@ describe('WorkspaceController', () => {
|
||||
count: workspaces.length,
|
||||
});
|
||||
|
||||
|
||||
jest.spyOn(userService, 'getUserListByIds').mockResolvedValue([]);
|
||||
|
||||
const result = await controller.findAll(req, {curPage:1,pageSize:10});
|
||||
const result = await controller.findAll(req, {
|
||||
curPage: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
|
||||
expect(result.code).toEqual(200);
|
||||
expect(workspaceMemberService.findAllByUserId).toHaveBeenCalledWith({
|
||||
@ -167,7 +169,7 @@ describe('WorkspaceController', () => {
|
||||
workspaceIdList: memberList.map((item) => item.workspaceId),
|
||||
page: 1,
|
||||
limit: 10,
|
||||
name: undefined
|
||||
name: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -102,6 +102,9 @@ export class WorkspaceService {
|
||||
where: query,
|
||||
skip,
|
||||
take: limit,
|
||||
order: {
|
||||
createDate: -1,
|
||||
},
|
||||
});
|
||||
return { list: data, count };
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ export enum QUESTION_TYPE {
|
||||
BINARY_CHOICE = 'binary-choice',
|
||||
RADIO_STAR = 'radio-star',
|
||||
RADIO_NPS = 'radio-nps',
|
||||
VOTE = 'vote',
|
||||
VOTE = 'vote'
|
||||
}
|
||||
|
||||
// 题目类型标签映射对象
|
||||
@ -23,16 +23,10 @@ export const typeTagLabels: Record<QUESTION_TYPE, string> = {
|
||||
}
|
||||
|
||||
// 输入类题型
|
||||
export const INPUT = [
|
||||
QUESTION_TYPE.TEXT,
|
||||
QUESTION_TYPE.TEXTAREA
|
||||
]
|
||||
export const INPUT = [QUESTION_TYPE.TEXT, QUESTION_TYPE.TEXTAREA]
|
||||
|
||||
// 选择类题型分类
|
||||
export const NORMAL_CHOICES = [
|
||||
QUESTION_TYPE.RADIO,
|
||||
QUESTION_TYPE.CHECKBOX
|
||||
]
|
||||
export const NORMAL_CHOICES = [QUESTION_TYPE.RADIO, QUESTION_TYPE.CHECKBOX]
|
||||
|
||||
// 选择类题型分类
|
||||
export const CHOICES = [
|
||||
@ -43,8 +37,4 @@ export const CHOICES = [
|
||||
]
|
||||
|
||||
// 评分题题型分类
|
||||
export const RATES = [
|
||||
QUESTION_TYPE.RADIO_STAR,
|
||||
QUESTION_TYPE.RADIO_NPS
|
||||
]
|
||||
|
||||
export const RATES = [QUESTION_TYPE.RADIO_STAR, QUESTION_TYPE.RADIO_NPS]
|
||||
|
@ -58,7 +58,9 @@ const tabArr = [
|
||||
}
|
||||
]
|
||||
const tabs = ref([])
|
||||
watch(() => store.state.cooperPermissions, (newVal) => {
|
||||
watch(
|
||||
() => store.state.cooperPermissions,
|
||||
(newVal) => {
|
||||
tabs.value = []
|
||||
// 如果有问卷管理权限,则加入问卷编辑和投放菜单
|
||||
if (newVal.includes(SurveyPermissions.SurveyManage)) {
|
||||
@ -69,7 +71,9 @@ watch(() => store.state.cooperPermissions, (newVal) => {
|
||||
if (newVal.includes(SurveyPermissions.DataManage)) {
|
||||
tabs.value.push(tabArr[2])
|
||||
}
|
||||
}, { immediate: true })
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.nav {
|
||||
|
@ -163,7 +163,7 @@ const onMove = () => {}
|
||||
padding: 0.36rem 0 0.36rem;
|
||||
border: 1px solid transparent;
|
||||
&.spliter {
|
||||
border-bottom: 0.12rem solid var(--primary-background-color);
|
||||
border-bottom: 0.1rem solid $spliter-color;
|
||||
}
|
||||
|
||||
&.mouse-hover {
|
||||
|
@ -125,7 +125,7 @@ const closedDialog = () => {
|
||||
&.pc {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background: #ffffff;
|
||||
background: #f7f7f7;
|
||||
box-shadow: 0px 2px 10px -2px rgba(82, 82, 102, 0.2);
|
||||
height: 726px;
|
||||
.wrapper {
|
||||
|
@ -157,7 +157,7 @@ const props = defineProps({
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['reflush'])
|
||||
const emit = defineEmits(['refresh'])
|
||||
const fields = ['type', 'title', 'remark', 'owner', 'state', 'createDate', 'updateDate']
|
||||
const showModify = ref(false)
|
||||
const modifyType = ref('')
|
||||
@ -251,7 +251,7 @@ const workSpaceId = computed(() => {
|
||||
return store.state.list.workSpaceId
|
||||
})
|
||||
|
||||
const onReflush = async () => {
|
||||
const onRefresh = async () => {
|
||||
const filterString = JSON.stringify(
|
||||
filter.value.filter((item) => {
|
||||
return item.condition[0].value
|
||||
@ -265,7 +265,7 @@ const onReflush = async () => {
|
||||
if (workSpaceId.value) {
|
||||
params.workspaceId = workSpaceId.value
|
||||
}
|
||||
emit('reflush', params)
|
||||
emit('refresh', params)
|
||||
}
|
||||
|
||||
const getToolConfig = (row) => {
|
||||
@ -400,14 +400,14 @@ const onDelete = async (row) => {
|
||||
const res = await deleteSurvey(row._id)
|
||||
if (res.code === CODE_MAP.SUCCESS) {
|
||||
ElMessage.success('删除成功')
|
||||
onReflush()
|
||||
onRefresh()
|
||||
} else {
|
||||
ElMessage.error(res.errmsg || '删除失败')
|
||||
}
|
||||
}
|
||||
const handleCurrentChange = (current) => {
|
||||
currentPage.value = current
|
||||
onReflush()
|
||||
onRefresh()
|
||||
}
|
||||
const onModify = (data, type = QOP_MAP.EDIT) => {
|
||||
showModify.value = true
|
||||
@ -418,7 +418,7 @@ const onCloseModify = (type) => {
|
||||
showModify.value = false
|
||||
questionInfo.value = {}
|
||||
if (type === 'update') {
|
||||
onReflush()
|
||||
onRefresh()
|
||||
}
|
||||
}
|
||||
const onRowClick = (row) => {
|
||||
@ -432,18 +432,18 @@ const onRowClick = (row) => {
|
||||
const onSearchText = (e) => {
|
||||
store.commit('list/setSearchVal', e)
|
||||
currentPage.value = 1
|
||||
onReflush()
|
||||
onRefresh()
|
||||
}
|
||||
const onSelectChange = (selectKey, selectValue) => {
|
||||
store.commit('list/changeSelectValueMap', { key: selectKey, value: selectValue })
|
||||
// selectValueMap.value[selectKey] = selectValue
|
||||
currentPage.value = 1
|
||||
onReflush()
|
||||
onRefresh()
|
||||
}
|
||||
const onButtonChange = (effectKey, effectValue) => {
|
||||
store.commit('list/reserButtonValueMap')
|
||||
store.commit('list/resetButtonValueMap')
|
||||
store.commit('list/changeButtonValueMap', { key: effectKey, value: effectValue })
|
||||
onReflush()
|
||||
onRefresh()
|
||||
}
|
||||
|
||||
const cooperModify = ref(false)
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="search">
|
||||
<TextSearch placeholder="请输入问卷标题" :value="searchVal" @search="onSearchText" />
|
||||
<TextSearch placeholder="请输入空间名称" :value="searchVal" @search="onSearchText" />
|
||||
</div>
|
||||
<div class="list-wrap" v-if="props.total > 0">
|
||||
<el-table
|
||||
@ -75,7 +75,7 @@
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import 'element-plus/theme-chalk/src/message-box.scss'
|
||||
@ -91,7 +91,6 @@ import EmptyIndex from '@/management/components/EmptyIndex.vue'
|
||||
import ToolBar from './ToolBar.vue'
|
||||
import { UserRole } from '@/management/utils/types/workSpace'
|
||||
|
||||
|
||||
const showSpaceModify = ref(false)
|
||||
const modifyType = ref('edit')
|
||||
const store = useStore()
|
||||
@ -109,7 +108,7 @@ const props = defineProps({
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['reflush'])
|
||||
const emit = defineEmits(['refresh'])
|
||||
const fields = ['name', 'surveyTotal', 'memberTotal', 'owner', 'createDate']
|
||||
const fieldList = computed(() => {
|
||||
return map(fields, (f) => {
|
||||
@ -128,19 +127,19 @@ const data = computed(() => {
|
||||
})
|
||||
let searchVal = ref('')
|
||||
let curPage = ref(1)
|
||||
const emitReflush = (page: number, name: string) => {
|
||||
const emitRefresh = (page: number, name: string) => {
|
||||
curPage.value = page
|
||||
emit('reflush', {
|
||||
emit('refresh', {
|
||||
curPage: page,
|
||||
name
|
||||
})
|
||||
}
|
||||
const handleCurrentChange = async (val: number) => {
|
||||
emitReflush(val, searchVal.value)
|
||||
emitRefresh(val, searchVal.value)
|
||||
}
|
||||
const onSearchText = async (e: string) => {
|
||||
searchVal.value = e
|
||||
emitReflush(1, e)
|
||||
const onSearchText = async (value: string) => {
|
||||
searchVal.value = value
|
||||
emitRefresh(1, value)
|
||||
}
|
||||
|
||||
const getTools = (data: any) => {
|
||||
|
@ -30,7 +30,7 @@
|
||||
<i class="iconfont icon-chuangjian"></i>
|
||||
<span>创建团队空间</span>
|
||||
</el-button>
|
||||
<el-button type="default" @click="onSetGroup" v-if="workSpaceId">
|
||||
<el-button type="default" class="btn" @click="onSetGroup" v-if="workSpaceId">
|
||||
<i class="iconfont icon-shujuliebiao"></i>
|
||||
<span>团队管理</span>
|
||||
</el-button>
|
||||
@ -49,13 +49,13 @@
|
||||
:loading="loading"
|
||||
:data="surveyList"
|
||||
:total="surveyTotal"
|
||||
@reflush="fetchSurveyList"
|
||||
@refresh="fetchSurveyList"
|
||||
v-if="spaceType !== SpaceType.Group"
|
||||
></BaseList>
|
||||
<SpaceList
|
||||
ref="spaceListRef"
|
||||
@reflush="fetchSpaceList"
|
||||
:loading="loading2"
|
||||
@refresh="fetchSpaceList"
|
||||
:loading="spaceLoading"
|
||||
:data="spaceList"
|
||||
:total="spaceTotal"
|
||||
v-if="spaceType === SpaceType.Group"
|
||||
@ -93,8 +93,8 @@ const surveyList = computed(() => {
|
||||
const surveyTotal = computed(() => {
|
||||
return store.state.list.surveyTotal
|
||||
})
|
||||
let spaceListRef = ref<InstanceType<typeof SpaceList> | null>(null)
|
||||
const loading2 = ref(false)
|
||||
const spaceListRef = ref<InstanceType | null>(null)
|
||||
const spaceLoading = ref(false)
|
||||
const spaceList = computed(() => {
|
||||
return store.state.list.teamSpaceList
|
||||
})
|
||||
@ -102,10 +102,10 @@ const spaceTotal = computed(() => {
|
||||
return store.state.list.teamSpaceListTotal
|
||||
})
|
||||
const fetchSpaceList = async (params?: any) => {
|
||||
loading2.value = true
|
||||
spaceLoading.value = true
|
||||
store.commit('list/changeWorkSpace', '')
|
||||
await store.dispatch('list/getSpaceList', params)
|
||||
loading2.value = false
|
||||
spaceLoading.value = false
|
||||
}
|
||||
|
||||
const activeIndex = ref('1')
|
||||
@ -277,6 +277,7 @@ const handleLogout = () => {
|
||||
|
||||
.create-btn {
|
||||
background: #4a4c5b;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn {
|
||||
@ -286,10 +287,9 @@ const handleLogout = () => {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
color: #fff;
|
||||
|
||||
.icon-shujuliebiao,
|
||||
.icon-chuangjian {
|
||||
padding-right: 8px;
|
||||
padding-right: 5px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
import { createRouter, createWebHistory, type RouteLocationNormalized, type NavigationGuardNext } from 'vue-router'
|
||||
import {
|
||||
createRouter,
|
||||
createWebHistory,
|
||||
type RouteLocationNormalized,
|
||||
type NavigationGuardNext
|
||||
} from 'vue-router'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import { useStore, type Store } from 'vuex'
|
||||
import { SurveyPermissions } from '@/management/utils/types/workSpace'
|
||||
@ -156,35 +161,45 @@ const router = createRouter({
|
||||
})
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const store = useStore();
|
||||
const store = useStore()
|
||||
// 初始化用户信息
|
||||
if (!store.state.user?.initialized) {
|
||||
await store.dispatch('user/init');
|
||||
await store.dispatch('user/init')
|
||||
}
|
||||
// 更新页面标题
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title as string;
|
||||
document.title = to.meta.title as string
|
||||
}
|
||||
|
||||
if (to.meta.needLogin) {
|
||||
await handleLoginGuard(to, from, next, store);
|
||||
await handleLoginGuard(to, from, next, store)
|
||||
} else {
|
||||
next();
|
||||
next()
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
async function handleLoginGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext, store: Store<any>) {
|
||||
async function handleLoginGuard(
|
||||
to: RouteLocationNormalized,
|
||||
from: RouteLocationNormalized,
|
||||
next: NavigationGuardNext,
|
||||
store: Store<any>
|
||||
) {
|
||||
if (store.state.user?.hasLogined) {
|
||||
await handlePermissionsGuard(to, from, next, store);
|
||||
await handlePermissionsGuard(to, from, next, store)
|
||||
} else {
|
||||
next({
|
||||
name: 'login',
|
||||
query: { redirect: encodeURIComponent(to.path) },
|
||||
});
|
||||
query: { redirect: encodeURIComponent(to.path) }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function handlePermissionsGuard(to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext, store: Store<any>) {
|
||||
async function handlePermissionsGuard(
|
||||
to: RouteLocationNormalized,
|
||||
from: RouteLocationNormalized,
|
||||
next: NavigationGuardNext,
|
||||
store: Store<any>
|
||||
) {
|
||||
const currSurveyId = to?.params?.id || ''
|
||||
const prevSurveyId = from?.params?.id || ''
|
||||
// 如果跳转页面不存在surveyId 或者不需要页面权限,则直接跳转
|
||||
@ -195,21 +210,19 @@ async function handlePermissionsGuard(to: RouteLocationNormalized, from: RouteLo
|
||||
if (currSurveyId !== prevSurveyId) {
|
||||
await store.dispatch('fetchCooperPermissions', currSurveyId)
|
||||
if (hasRequiredPermissions(to.meta.permissions as string[], store.state.cooperPermissions)) {
|
||||
next();
|
||||
next()
|
||||
} else {
|
||||
ElMessage.warning('您没有该问卷的相关协作权限');
|
||||
next({ name: 'survey' });
|
||||
ElMessage.warning('您没有该问卷的相关协作权限')
|
||||
next({ name: 'survey' })
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
next()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hasRequiredPermissions(requiredPermissions: string[], userPermissions: string[]) {
|
||||
return requiredPermissions.some(permission => userPermissions.includes(permission));
|
||||
return requiredPermissions.some((permission) => userPermissions.includes(permission))
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default router
|
||||
|
@ -107,8 +107,8 @@ export default {
|
||||
},
|
||||
changeWorkSpace(state, workSpaceId) {
|
||||
// 切换空间清除筛选条件
|
||||
this.commit('list/reserSelectValueMap')
|
||||
this.commit('list/reserButtonValueMap')
|
||||
this.commit('list/resetSelectValueMap')
|
||||
this.commit('list/resetButtonValueMap')
|
||||
this.commit('list/setSearchVal', '')
|
||||
state.workSpaceId = workSpaceId
|
||||
},
|
||||
@ -130,7 +130,7 @@ export default {
|
||||
setSearchVal(state, data) {
|
||||
state.searchVal = data
|
||||
},
|
||||
reserSelectValueMap(state) {
|
||||
resetSelectValueMap(state) {
|
||||
state.selectValueMap = {
|
||||
surveyType: '',
|
||||
'curStatus.status': ''
|
||||
@ -139,7 +139,7 @@ export default {
|
||||
changeSelectValueMap(state, { key, value }) {
|
||||
state.selectValueMap[key] = value
|
||||
},
|
||||
reserButtonValueMap(state) {
|
||||
resetButtonValueMap(state) {
|
||||
state.buttonValueMap = {
|
||||
'curStatus.date': '',
|
||||
createDate: -1
|
||||
|
@ -33,7 +33,7 @@ $remark-color: #4a4c5b;
|
||||
$placeholder-color: #c8c9cd;
|
||||
$light-focus-color: #666666;
|
||||
|
||||
$spliter-color: #f7f7f7;
|
||||
$spliter-color: hsl(0, 0%, 97%, 0.5);
|
||||
|
||||
$error-color: #ec4e29;
|
||||
|
||||
|
@ -39,11 +39,11 @@ export const getQuestionByType = (type, fields) => {
|
||||
const questionMeta = questionLoader.getMeta(type)
|
||||
const { attrs } = questionMeta
|
||||
let newQuestion = defaultQuestionConfig
|
||||
if( attrs ) {
|
||||
if (attrs) {
|
||||
let questionSchema = {}
|
||||
attrs.forEach(element => {
|
||||
attrs.forEach((element) => {
|
||||
questionSchema[element.name] = element.defaultValue
|
||||
});
|
||||
})
|
||||
newQuestion = questionSchema
|
||||
} else {
|
||||
newQuestion = defaultQuestionConfig
|
||||
@ -51,7 +51,8 @@ export const getQuestionByType = (type, fields) => {
|
||||
}
|
||||
|
||||
newQuestion.field = getNewField(fields) // 动态生成题目id
|
||||
if('options ' in newQuestion) { // 动态更新选项的hash-id
|
||||
if ('options ' in newQuestion) {
|
||||
// 动态更新选项的hash-id
|
||||
const hashList = []
|
||||
for (const option of newQuestion.options) {
|
||||
const hash = generateHash(hashList)
|
||||
|
@ -111,20 +111,10 @@ export default defineComponent({
|
||||
editConfigure={questionMeta?.editConfigure}
|
||||
onChange={this.onChange}
|
||||
>
|
||||
<dynamicComponent
|
||||
readonly
|
||||
{...props}
|
||||
onBlur={this.onBlur}
|
||||
onFocus={this.onFocus}
|
||||
/>
|
||||
<dynamicComponent readonly {...props} onBlur={this.onBlur} onFocus={this.onFocus} />
|
||||
</EditOptions>
|
||||
) : (
|
||||
<dynamicComponent
|
||||
readonly
|
||||
{...props}
|
||||
onBlur={this.onBlur}
|
||||
onFocus={this.onFocus}
|
||||
/>
|
||||
<dynamicComponent readonly {...props} onBlur={this.onBlur} onFocus={this.onFocus} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -94,7 +94,7 @@
|
||||
}
|
||||
|
||||
&.spliter {
|
||||
border-bottom: 0.12rem solid var(--primary-background-color);
|
||||
border-bottom: 0.1rem solid $spliter-color;
|
||||
}
|
||||
|
||||
.sort-tip {
|
||||
|
@ -11,7 +11,7 @@ $light-focus-color: #666666;
|
||||
$disable-color: #f2f4f7;
|
||||
$border-color: #dee2e6;
|
||||
|
||||
$spliter-color: #f7f7f7;
|
||||
$spliter-color: hsl(0, 0%, 97%, 0.5);
|
||||
|
||||
$error-color: #ec4e29;
|
||||
|
||||
|
@ -53,25 +53,25 @@ const meta = {
|
||||
description: '这是用于描述选项',
|
||||
defaultValue: [
|
||||
{
|
||||
"text": "对",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115019"
|
||||
text: '对',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115019'
|
||||
},
|
||||
{
|
||||
"text": "错",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115020"
|
||||
text: '错',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115020'
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
formConfig: [basicConfig],
|
||||
editConfigure: {
|
||||
|
@ -53,22 +53,22 @@ const meta = {
|
||||
description: '这是用于描述选项',
|
||||
defaultValue: [
|
||||
{
|
||||
"text": "选项1",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115019"
|
||||
text: '选项1',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115019'
|
||||
},
|
||||
{
|
||||
"text": "选项2",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115020"
|
||||
text: '选项2',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115020'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -19,7 +19,7 @@
|
||||
}
|
||||
}
|
||||
.question-block {
|
||||
padding: 0!important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
.radio-nps-hover {
|
||||
.rate-item {
|
||||
|
@ -53,29 +53,27 @@ const meta = {
|
||||
description: '这是用于描述选项',
|
||||
defaultValue: [
|
||||
{
|
||||
"text": "选项1",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115019"
|
||||
text: '选项1',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115019'
|
||||
},
|
||||
{
|
||||
"text": "选项2",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115020"
|
||||
text: '选项2',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115020'
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
formConfig: [
|
||||
basicConfig,
|
||||
}
|
||||
],
|
||||
formConfig: [basicConfig],
|
||||
editConfigure: {
|
||||
optionEdit: {
|
||||
show: true
|
||||
|
@ -63,14 +63,14 @@ const meta = {
|
||||
name: 'starStyle',
|
||||
propType: String,
|
||||
description: '',
|
||||
defaultValue: 'star',
|
||||
defaultValue: 'star'
|
||||
},
|
||||
{
|
||||
name: 'rangeConfig',
|
||||
propType: Object,
|
||||
description: '这是用于描述评分高级设置',
|
||||
defaultValue: {}
|
||||
},
|
||||
}
|
||||
],
|
||||
formConfig: [
|
||||
basicConfig,
|
||||
|
@ -70,11 +70,9 @@ export default defineComponent({
|
||||
class="rich-editor"
|
||||
modelValue={filterXSS(this.title)}
|
||||
onChange={this.handleChange}
|
||||
onCreated={
|
||||
(editor) => {
|
||||
onCreated={(editor) => {
|
||||
editor?.focus()
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -53,22 +53,22 @@ const meta = {
|
||||
description: '这是用于描述选项',
|
||||
defaultValue: [
|
||||
{
|
||||
"text": "选项1",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115019"
|
||||
text: '选项1',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115019'
|
||||
},
|
||||
{
|
||||
"text": "选项2",
|
||||
"imageUrl": "",
|
||||
"others": false,
|
||||
"mustOthers": false,
|
||||
"othersKey": "",
|
||||
"placeholderDesc": "",
|
||||
"hash": "115020"
|
||||
text: '选项2',
|
||||
imageUrl: '',
|
||||
others: false,
|
||||
mustOthers: false,
|
||||
othersKey: '',
|
||||
placeholderDesc: '',
|
||||
hash: '115020'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -15,12 +15,7 @@ interface Props {
|
||||
formConfig: any
|
||||
}
|
||||
|
||||
interface Emit {
|
||||
(ev: typeof FORM_CHANGE_EVENT_KEY, arg: { key: string; value: string }): void
|
||||
(ev: 'change' | 'input', value: string): void
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emit>()
|
||||
const emit = defineEmits([FORM_CHANGE_EVENT_KEY, 'change', 'input'])
|
||||
const props = withDefaults(defineProps<Props>(), { formConfig: {} })
|
||||
|
||||
const handleEditorValueChange = (eventType: 'change' | 'input', value: string) => {
|
||||
|
@ -57,8 +57,10 @@ const questionConfig = computed(() => {
|
||||
moduleConfig.othersValue = unref(othersValue)
|
||||
}
|
||||
if (
|
||||
RATES.includes(type) && rest?.rangeConfig &&
|
||||
Object.keys(rest?.rangeConfig).filter((index) => rest?.rangeConfig[index].isShowInput).length > 0
|
||||
RATES.includes(type) &&
|
||||
rest?.rangeConfig &&
|
||||
Object.keys(rest?.rangeConfig).filter((index) => rest?.rangeConfig[index].isShowInput).length >
|
||||
0
|
||||
) {
|
||||
let { rangeConfig, othersValue } = useShowInput(field)
|
||||
moduleConfig.rangeConfig = unref(rangeConfig)
|
||||
|
@ -7,9 +7,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
<script setup></script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
|
@ -17,15 +17,8 @@ const route = useRoute()
|
||||
const loadData = (res: any, surveyPath: string) => {
|
||||
if (res.code === 200) {
|
||||
const data = res.data
|
||||
const {
|
||||
bannerConf,
|
||||
baseConf,
|
||||
bottomConf,
|
||||
dataConf,
|
||||
skinConf,
|
||||
submitConf,
|
||||
logicConf
|
||||
} = data.code
|
||||
const { bannerConf, baseConf, bottomConf, dataConf, skinConf, submitConf, logicConf } =
|
||||
data.code
|
||||
const questionData = {
|
||||
bannerConf,
|
||||
baseConf,
|
||||
|
@ -18,10 +18,7 @@ const VOTE_INFO_KEY = 'voteinfo'
|
||||
import router from '../router'
|
||||
export default {
|
||||
// 初始化
|
||||
init(
|
||||
{ commit, dispatch },
|
||||
{ bannerConf, baseConf, bottomConf, dataConf, skinConf, submitConf }
|
||||
) {
|
||||
init({ commit, dispatch }, { bannerConf, baseConf, bottomConf, dataConf, skinConf, submitConf }) {
|
||||
commit('setEnterTime')
|
||||
const { begTime, endTime, answerBegTime, answerEndTime } = baseConf
|
||||
const { msgContent } = submitConf
|
||||
@ -58,7 +55,6 @@ export default {
|
||||
}
|
||||
router.push({ name: 'renderPage' })
|
||||
|
||||
|
||||
// 根据初始的schema生成questionData, questionSeq, rules, formValues, 这四个字段
|
||||
const { questionData, questionSeq, rules, formValues } = adapter.generateData({
|
||||
bannerConf,
|
||||
|
@ -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;
|
@ -10,6 +10,6 @@ $placeholder-color: #c8c9cd;
|
||||
$disable-color: #f2f4f7;
|
||||
$border-color: #dee2e6;
|
||||
|
||||
$spliter-color: #f7f7f7;
|
||||
$spliter-color: hsl(0, 0%, 97%, 0.5);
|
||||
|
||||
$error-color: #ec4e29;
|
||||
|
Loading…
Reference in New Issue
Block a user