diff --git a/.env b/.env new file mode 100644 index 0000000..91b536c --- /dev/null +++ b/.env @@ -0,0 +1,10 @@ +# .env +VITE_APP_BASE_URL=http://192.168.8.165:15011/ +VITE_APP_ENV=development +VITE_APP_CURRENTMODE=dev +VITE_APP_BASEOSS=https://diaoyan-files.automark.cc +VITE_APP_DELIVERY_BASEURL=https://javaxq.test.automark.cc/ +VITE_APP_MESSAGE_CENTER=http://gtech-gateway.dcin-test.digitalyili.com/apigtech/message-send-center/ +VITE_APP_SOCKETURL=wss://yls-api-uat.dctest.digitalyili.com/survey_sync +VITE_APP_JSONPURL=https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken +VITE_APP_YQRURL=https://ocp-uat-ain.digitalyili.com diff --git a/.env.development b/.env.development index e8d30fa..b5cc42d 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,10 @@ -VITE_APP_BASE_URL = '/' -VITE_APP_ENV = 'development' +# .env.development +VITE_APP_BASEURL=http://192.168.8.165:15011/ +VITE_APP_ENV=development +VITE_APP_CURRENTMODE=dev +VITE_APP_BASEOSS=https://diaoyan-files.automark.cc +VITE_APP_DELIVERY_BASEURL=https://javaxq.test.automark.cc/ +VITE_APP_MESSAGE_CENTER=http://gtech-gateway.dcin-test.digitalyili.com/apigtech/message-send-center/ +VITE_APP_SOCKETURL=wss://yls-api-uat.dctest.digitalyili.com/survey_sync +VITE_APP_JSONPURL=https://iam-uat.dctest.digitalyili.com/idp/restful/getIDPToken +VITE_APP_YQRURL=https://ocp-uat-ain.digitalyili.com diff --git a/.env.production b/.env.production deleted file mode 100644 index 9e37b5c..0000000 --- a/.env.production +++ /dev/null @@ -1,2 +0,0 @@ -VITE_APP_BASE_URL = 'https://xx.digitalyili.com' -VITE_APP_ENV = 'prod' diff --git a/.env.sit b/.env.sit deleted file mode 100644 index b62dff6..0000000 --- a/.env.sit +++ /dev/null @@ -1,2 +0,0 @@ -VITE_APP_BASE_URL = 'https://sit.xx.digitalyili.com' -VITE_APP_ENV = 'sit' diff --git a/.env.uat b/.env.uat deleted file mode 100644 index c4b9b8b..0000000 --- a/.env.uat +++ /dev/null @@ -1,2 +0,0 @@ -VITE_APP_BASE_URL = 'https://uat.xx.digitalyili.com' -VITE_APP_ENV = 'uat' diff --git a/auto-imports.d.ts b/auto-imports.d.ts index b0b0357..9d24007 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -5,4 +5,6 @@ // Generated by unplugin-auto-import // biome-ignore lint: disable export {} -declare global {} +declare global { + +} diff --git a/components.d.ts b/components.d.ts index f15d4ea..edf019e 100644 --- a/components.d.ts +++ b/components.d.ts @@ -19,11 +19,18 @@ declare module 'vue' { VanCheckbox: typeof import('vant/es')['Checkbox'] VanCheckboxGroup: typeof import('vant/es')['CheckboxGroup'] VanCol: typeof import('vant/es')['Col'] + VanDatePicker: typeof import('vant/es')['DatePicker'] + VanDatetimePicker: typeof import('vant/es')['DatetimePicker'] VanDialog: typeof import('vant/es')['Dialog'] VanDivider: typeof import('vant/es')['Divider'] + VanFiel: typeof import('vant/es')['Fiel'] VanField: typeof import('vant/es')['Field'] + VanGrid: typeof import('vant/es')['Grid'] + VanGridItem: typeof import('vant/es')['GridItem'] VanIcon: typeof import('vant/es')['Icon'] VanNavBar: typeof import('vant/es')['NavBar'] + VanPicker: typeof import('vant/es')['Picker'] + VanPikcer: typeof import('vant/es')['Pikcer'] VanPopup: typeof import('vant/es')['Popup'] VanRadio: typeof import('vant/es')['Radio'] VanRadioGroup: typeof import('vant/es')['RadioGroup'] @@ -33,6 +40,8 @@ declare module 'vue' { VanSwitch: typeof import('vant/es')['Switch'] VanTabbar: typeof import('vant/es')['Tabbar'] VanTabbarItem: typeof import('vant/es')['TabbarItem'] + VanTimePicker: typeof import('vant/es')['TimePicker'] + YLPicker: typeof import('./src/components/YLPicker.vue')['default'] YLSelect: typeof import('./src/components/YLSelect.vue')['default'] } } diff --git a/package-lock.json b/package-lock.json index 393a4ca..24957ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,15 @@ "version": "0.0.0", "dependencies": { "@element-plus/icons-vue": "^2.3.1", + "axios": "^1.8.2", + "dotenv": "^16.4.7", "element-plus": "^2.7.8", "lodash": "^4.17.21", "pinia": "^2.1.7", "sortablejs": "^1.15.6", "uuid": "^11.1.0", "vant": "^4.9.17", + "vite-plugin-vue": "^0.0.1", "vue": "^3.4.29", "vue-router": "^4.3.3", "vuex": "^4.1.0" @@ -4782,6 +4785,11 @@ "resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-4.2.5.tgz", "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -4797,6 +4805,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/axios": { + "version": "1.8.2", + "resolved": "https://registry.npmmirror.com/axios/-/axios-1.8.2.tgz", + "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", @@ -4974,7 +4992,6 @@ }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -5100,6 +5117,17 @@ "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz", @@ -5311,6 +5339,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-1.0.3.tgz", @@ -5404,9 +5440,19 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", - "dev": true, "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", @@ -5548,7 +5594,6 @@ }, "node_modules/es-define-property": { "version": "1.0.1", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -5556,7 +5601,6 @@ }, "node_modules/es-errors": { "version": "1.3.0", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -5591,7 +5635,6 @@ }, "node_modules/es-object-atoms": { "version": "1.1.1", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0" @@ -5602,7 +5645,6 @@ }, "node_modules/es-set-tostringtag": { "version": "2.1.0", - "dev": true, "license": "MIT", "dependencies": { "es-errors": "^1.3.0", @@ -6614,6 +6656,25 @@ "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.5", "resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.5.tgz", @@ -6629,6 +6690,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/form-data": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.2.tgz", + "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -6652,7 +6727,6 @@ }, "node_modules/function-bind": { "version": "1.1.2", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -6697,7 +6771,6 @@ }, "node_modules/get-intrinsic": { "version": "1.3.0", - "dev": true, "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", @@ -6720,7 +6793,6 @@ }, "node_modules/get-proto": { "version": "1.0.1", - "dev": true, "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", @@ -6914,7 +6986,6 @@ }, "node_modules/gopd": { "version": "1.2.0", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -6978,7 +7049,6 @@ }, "node_modules/has-symbols": { "version": "1.1.0", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -6989,7 +7059,6 @@ }, "node_modules/has-tostringtag": { "version": "1.0.2", - "dev": true, "license": "MIT", "dependencies": { "has-symbols": "^1.0.3" @@ -7003,7 +7072,6 @@ }, "node_modules/hasown": { "version": "2.0.2", - "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -7826,7 +7894,6 @@ }, "node_modules/math-intrinsics": { "version": "1.1.0", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -7908,6 +7975,25 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.3.tgz", @@ -8662,6 +8748,11 @@ "react-is": "^16.13.1" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", @@ -10450,6 +10541,12 @@ } } }, + "node_modules/vite-plugin-vue": { + "version": "0.0.1", + "resolved": "https://registry.npmmirror.com/vite-plugin-vue/-/vite-plugin-vue-0.0.1.tgz", + "integrity": "sha512-PhAy+v+t6W3JAeqFxf6w/hGyURZ2qvrJMS/HTeCPLnfllz+O5wNP49TcAb4MROeif93kKIOigtDFJowaLuU+0w==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, "node_modules/vscode-uri": { "version": "3.1.0", "resolved": "https://registry.npmmirror.com/vscode-uri/-/vscode-uri-3.1.0.tgz", diff --git a/package.json b/package.json index e66227f..a2c9510 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --mode development", "build": "run-p type-check \"build-only {@}\" --", "preview": "vite preview", "build-only": "vite build", @@ -15,13 +15,14 @@ "dependencies": { "@element-plus/icons-vue": "^2.3.1", "axios": "^1.8.2", + "dotenv": "^16.4.7", "element-plus": "^2.7.8", "lodash": "^4.17.21", - "lodash-es": "^4.17.21", "pinia": "^2.1.7", "sortablejs": "^1.15.6", "uuid": "^11.1.0", "vant": "^4.9.17", + "vite-plugin-vue": "^0.0.1", "vue": "^3.4.29", "vue-router": "^4.3.3", "vuex": "^4.1.0" diff --git a/src/api/design/index.js b/src/api/design/index.js new file mode 100644 index 0000000..a01a619 --- /dev/null +++ b/src/api/design/index.js @@ -0,0 +1,31 @@ +import request from '@/utils/request.js'; +export function snQuestions(params) { + return request({ + url: `/console/surveys/${params.sn}/questions`, + method: 'get' + }); +} +// 操作编辑 +export function saveQuestion(params) { + return request({ + url: `console/surveys/${params.sn}/questions`, + method: 'post', + data: params + }); +} +export function sync(params) { + return request({ + url: `console/surveys/${params.sn}/sync`, + method: 'post', + data: params + }); +} +export function questionDetails(params) { + // let sn = params.sn; + // delete params.sn; + return request({ + url: `console/surveys/${params.sn}/details`, + method: 'post', + data: params + }); +} diff --git a/src/api/home/index.js b/src/api/home/index.js new file mode 100644 index 0000000..ba0fa30 --- /dev/null +++ b/src/api/home/index.js @@ -0,0 +1,19 @@ +import request from '@/utils/request.js'; + +export function getQuestionList(params) { + return request({ + url: '/console/template/list_shortcut', + method: 'get', + params + }); +} +export function consoleSurveys(params) { + return request({ + url: '/console/surveys', + method: 'post', + data: { + ...params, + source: '1' + } + }); +} diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 9c41435..603da52 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -1,6 +1,7 @@ @import 'base'; @import '../../fonts/iconfont.css'; @import 'vant'; +@import '../../fonts/moblie/iconfont.css'; a, .green { diff --git a/src/components/YLPicker.vue b/src/components/YLPicker.vue new file mode 100644 index 0000000..1e98e52 --- /dev/null +++ b/src/components/YLPicker.vue @@ -0,0 +1,689 @@ + + + + diff --git a/src/components/contenteditable.vue b/src/components/contenteditable.vue index 78e2ecd..cf0b12a 100644 --- a/src/components/contenteditable.vue +++ b/src/components/contenteditable.vue @@ -23,7 +23,7 @@ const props = defineProps({ const editor = ref(null); const editorAction = ref(null); -const emit = defineEmits(['update:modelValue']); +const emit = defineEmits(['update:modelValue', 'blur']); const save = (e) => { emit('update:modelValue', e.innerHTML); }; @@ -42,6 +42,9 @@ const functions = { }; const funEvent = (item) => { + // 保持焦点在编辑器 + const selection = window.getSelection(); + selection.getRangeAt(0); functions[item.fun](); }; @@ -81,12 +84,40 @@ const actions = [ fun: 'italic' } ]; +const checkContains = (element, target) => { + try { + return element?.contains(target) ?? false; + } catch (e) { + console.error('Contains check failed:', e); + return false; + } +}; onMounted(() => { editor.value.addEventListener('focus', () => { showAction.value = true; }); + // 如果点击了 editor 与 editorAction 其他地方就触发保存 + + document.addEventListener('click', (e) => { + if (!editor.value || !editorAction.value) return; + + const target = e.composedPath?.()?.[0] || e.target; + const isEditor = checkContains(editor.value, target); + const isActionBar = checkContains(editorAction.value, target); + + if (!isEditor && !isActionBar) { + showAction.value = false; + save(editor.value); + emit('blur', editor.value); + } + }); + // editor.value.addEventListener('blur', () => { + // setTimeout(() => { + // showAction.value = false; + // }); + // }); document.addEventListener('resize', () => { showAction.value = false; }); diff --git a/src/config.js b/src/config.js new file mode 100644 index 0000000..f3fc324 --- /dev/null +++ b/src/config.js @@ -0,0 +1,12 @@ +// src/config.js +export default { + proxyUrl: import.meta.env.VITE_APP_BASEURL, + proxyUrlDelivery: import.meta.env.VITE_APP_DELIVERY_BASEURL, + proxyUrlMessageCenter: import.meta.env.VITE_APP_MESSAGE_CENTER, + baseOss: import.meta.env.VITE_APP_BASEOSS, + loginUrl: import.meta.env.VITE_APP_LOGIN, + socketUrl: import.meta.env.VITE_APP_SOCKETURL, + jsonpUrl: import.meta.env.VITE_APP_JSONPURL, + jqrUrl: import.meta.env.VITE_APP_YQRURL, + currentMode: import.meta.env.VITE_APP_CURRENTMODE +}; diff --git a/src/fonts/demo.css b/src/fonts/demo.css index 12ec742..7df7d71 100644 --- a/src/fonts/demo.css +++ b/src/fonts/demo.css @@ -9,6 +9,14 @@ url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg'); + src: + url('//at.alicdn.com/t/c/font_4841764_vat2jbvw3q.woff2?t=1741575060989') format('woff2'), + url('//at.alicdn.com/t/c/font_4841764_vat2jbvw3q.woff?t=1741575060989') format('woff'), + url('//at.alicdn.com/t/c/font_4841764_vat2jbvw3q.ttf?t=1741575060989') format('truetype'); +} + +@font-face { + font-family: ''; } .logo { diff --git a/src/fonts/moblie/demo.css b/src/fonts/moblie/demo.css new file mode 100644 index 0000000..12ec742 --- /dev/null +++ b/src/fonts/moblie/demo.css @@ -0,0 +1,548 @@ +/* Logo 字体 */ +@font-face { + font-family: 'iconfont logo'; + src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); + src: + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') + format('embedded-opentype'), + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), + url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') + format('svg'); +} + +.logo { + font-style: normal; + font-size: 160px; + font-family: 'iconfont logo'; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* tabs */ +.nav-tabs { + position: relative; +} + +.nav-tabs .nav-more { + position: absolute; + right: 0; + bottom: 0; + height: 42px; + color: #666; + line-height: 42px; +} + +#tabs { + border-bottom: 1px solid #eee; +} + +#tabs li { + position: relative; + z-index: 1; + width: 100px; + height: 40px; + margin-bottom: -1px; + border-bottom: 2px solid transparent; + color: #666; + font-size: 16px; + line-height: 40px; + text-align: center; + cursor: pointer; +} + +#tabs .active { + border-bottom-color: #f00; + color: #222; +} + +.tab-container .content { + display: none; +} + +/* 页面布局 */ +.main { + width: 960px; + margin: 0 auto; + padding: 30px 100px; +} + +.main .logo { + overflow: hidden; + height: 110px; + margin-top: -50px; + margin-bottom: 30px; + color: #333; + line-height: 1; + text-align: left; + *zoom: 1; +} + +.main .logo a { + color: #333; + font-size: 160px; +} + +.helps { + margin-top: 40px; +} + +.helps pre { + overflow: auto; + margin: 10px 0; + padding: 20px; + border: solid 1px #e7e1cd; + background-color: #fffdef; +} + +.icon_lists { + overflow: hidden; + width: 100% !important; + *zoom: 1; +} + +.icon_lists li { + width: 100px; + margin-right: 20px; + margin-bottom: 10px; + list-style: none !important; + text-align: center; + cursor: default; +} + +.icon_lists li .code-name { + line-height: 1.2; +} + +.icon_lists .icon { + display: block; + height: 100px; + margin: 10px auto; + color: #333; + font-size: 42px; + line-height: 100px; + -webkit-transition: + font-size 0.25s linear, + width 0.25s linear; + -moz-transition: + font-size 0.25s linear, + width 0.25s linear; + transition: + font-size 0.25s linear, + width 0.25s linear; +} + +.icon_lists .icon:hover { + font-size: 100px; +} + +.icon_lists .svg-icon { + /* 图标和文字相邻时,垂直对齐 */ + vertical-align: -0.15em; + + /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示 + normalize.css 中也包含这行 */ + overflow: hidden; + + /* 通过设置 font-size 来改变图标大小 */ + width: 1em; + + /* 通过设置 color 来改变 SVG 的颜色/fill */ + fill: currentcolor; +} + +.icon_lists li .name, +.icon_lists li .code-name { + color: #666; +} + +/* markdown 样式 */ +.markdown { + color: #666; + font-size: 14px; + line-height: 1.8; +} + +.highlight { + line-height: 1.5; +} + +.markdown img { + vertical-align: middle; + max-width: 100%; +} + +.markdown h1 { + margin-bottom: 24px; + color: #404040; + font-weight: 500; + line-height: 40px; +} + +.markdown h2, +.markdown h3, +.markdown h4, +.markdown h5, +.markdown h6 { + clear: both; + margin: 1.6em 0 0.6em; + color: #404040; + font-weight: 500; +} + +.markdown h1 { + font-size: 28px; +} + +.markdown h2 { + font-size: 22px; +} + +.markdown h3 { + font-size: 16px; +} + +.markdown h4 { + font-size: 14px; +} + +.markdown h5 { + font-size: 12px; +} + +.markdown h6 { + font-size: 12px; +} + +.markdown hr { + clear: both; + height: 1px; + margin: 16px 0; + border: 0; + background: #e9e9e9; +} + +.markdown p { + margin: 1em 0; +} + +.markdown > p, +.markdown > blockquote, +.markdown > .highlight, +.markdown > ol, +.markdown > ul { + width: 80%; +} + +.markdown ul > li { + list-style: circle; +} + +.markdown > ul li, +.markdown blockquote ul > li { + margin-left: 20px; + padding-left: 4px; +} + +.markdown > ul li p, +.markdown > ol li p { + margin: 0.6em 0; +} + +.markdown ol > li { + list-style: decimal; +} + +.markdown > ol li, +.markdown blockquote ol > li { + margin-left: 20px; + padding-left: 4px; +} + +.markdown code { + margin: 0 3px; + padding: 0 5px; + border-radius: 3px; + background: #eee; +} + +.markdown strong, +.markdown b { + font-weight: 600; +} + +.markdown > table { + width: 95%; + margin-bottom: 24px; + border: 1px solid #e9e9e9; + border-spacing: 0; + border-collapse: collapse; + empty-cells: show; +} + +.markdown > table th { + color: #333; + font-weight: 600; + white-space: nowrap; +} + +.markdown > table th, +.markdown > table td { + padding: 8px 16px; + border: 1px solid #e9e9e9; + text-align: left; +} + +.markdown > table th { + background: #f7f7f7; +} + +.markdown blockquote { + margin: 1em 0; + padding-left: 0.8em; + border-left: 4px solid #e9e9e9; + color: #999; + font-size: 90%; +} + +.markdown blockquote p { + margin: 0; +} + +.markdown .anchor { + margin-left: 8px; + opacity: 0; + transition: opacity 0.3s ease; +} + +.markdown .waiting { + color: #ccc; +} + +.markdown h1:hover .anchor, +.markdown h2:hover .anchor, +.markdown h3:hover .anchor, +.markdown h4:hover .anchor, +.markdown h5:hover .anchor, +.markdown h6:hover .anchor { + display: inline-block; + opacity: 1; +} + +.markdown > br, +.markdown > p > br { + clear: both; +} + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: #333; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #a71d5d; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333; +} + +.hljs-title, +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + background-color: #eaffea; + color: #55a532; +} + +.hljs-deletion { + background-color: #ffecec; + color: #bd2c00; +} + +.hljs-link { + text-decoration: underline; +} + +/* 代码高亮 */ + +/* PrismJS 1.15.0 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */ + +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ +code[class*='language-'], +pre[class*='language-'] { + background: none; + color: black; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + line-height: 1.5; + text-align: left; + text-shadow: 0 1px white; + white-space: pre; + word-spacing: normal; + word-wrap: normal; + word-break: normal; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*='language-']::-moz-selection, +pre[class*='language-'] ::-moz-selection, +code[class*='language-']::-moz-selection, +code[class*='language-'] ::-moz-selection { + background: #b3d4fc; + text-shadow: none; +} + +pre[class*='language-']::selection, +pre[class*='language-'] ::selection, +code[class*='language-']::selection, +code[class*='language-'] ::selection { + background: #b3d4fc; + text-shadow: none; +} + +@media print { + code[class*='language-'], + pre[class*='language-'] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*='language-'] { + overflow: auto; + margin: 0.5em 0; + padding: 1em; +} + +:not(pre) > code[class*='language-'], +pre[class*='language-'] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*='language-'] { + padding: 0.1em; + border-radius: 0.3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: 0.7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + background: hsla(0deg, 0%, 100%, 0.5); + color: #9a6e3a; +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #dd4a68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} + +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} diff --git a/src/fonts/moblie/iconfont.css b/src/fonts/moblie/iconfont.css new file mode 100644 index 0000000..e9186ca --- /dev/null +++ b/src/fonts/moblie/iconfont.css @@ -0,0 +1,75 @@ +@font-face { + font-family: mobilefont; /* Project id 4841764 */ + src: + url('iconfont.woff2?t=1741575354833') format('woff2'), + url('iconfont.woff?t=1741575354833') format('woff'), + url('iconfont.ttf?t=1741575354833') format('truetype'); +} + +.mobilefont { + font-style: normal; + font-size: 18px; + font-family: mobilefont !important; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-radiobox::before { + content: '\e75b'; +} + +.icon-juzhendafen::before { + content: '\e641'; +} + +.icon-checkbox-checked::before { + content: '\e6c3'; +} + +.icon-nps::before { + content: '\e6b0'; +} + +.icon-input::before { + content: '\e6fd'; +} + +.icon-juzhentiankong::before { + content: '\e62e'; +} + +.icon-wenjianshangchuan::before { + content: '\e631'; +} + +.icon-qianming::before { + content: '\e661'; +} + +.icon-tuwen::before { + content: '\e62c'; +} + +.icon-juzhenduoxuan::before { + content: '\e818'; +} + +.icon-juzhendanxuan::before { + content: '\13c7f'; +} + +.icon-edit2::before { + content: '\e630'; +} + +.icon-copy::before { + content: '\e632'; +} + +.icon-delete::before { + content: '\e63f'; +} + +.icon-sort::before { + content: '\e6a0'; +} diff --git a/src/fonts/moblie/iconfont.js b/src/fonts/moblie/iconfont.js new file mode 100644 index 0000000..00018eb --- /dev/null +++ b/src/fonts/moblie/iconfont.js @@ -0,0 +1,67 @@ +(window._iconfont_svg_string_4841764 = + ''), + ((l) => { + var a = (t = (t = document.getElementsByTagName('script'))[t.length - 1]).getAttribute( + 'data-injectcss' + ), + t = t.getAttribute('data-disable-injectsvg'); + if (!t) { + var c, + i, + e, + h, + o, + n = function (a, t) { + t.parentNode.insertBefore(a, t); + }; + if (a && !l.__iconfont__svg__cssinject__) { + l.__iconfont__svg__cssinject__ = !0; + try { + document.write( + '' + ); + } catch (a) { + console && console.log(a); + } + } + (c = function () { + var a, + t = document.createElement('div'); + (t.innerHTML = l._iconfont_svg_string_4841764), + (t = t.getElementsByTagName('svg')[0]) && + (t.setAttribute('aria-hidden', 'true'), + (t.style.position = 'absolute'), + (t.style.width = 0), + (t.style.height = 0), + (t.style.overflow = 'hidden'), + (t = t), + (a = document.body).firstChild ? n(t, a.firstChild) : a.appendChild(t)); + }), + document.addEventListener + ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) + ? setTimeout(c, 0) + : ((i = function () { + document.removeEventListener('DOMContentLoaded', i, !1), c(); + }), + document.addEventListener('DOMContentLoaded', i, !1)) + : document.attachEvent && + ((e = c), + (h = l.document), + (o = !1), + s(), + (h.onreadystatechange = function () { + 'complete' == h.readyState && ((h.onreadystatechange = null), d()); + })); + } + function d() { + o || ((o = !0), e()); + } + function s() { + try { + h.documentElement.doScroll('left'); + } catch (a) { + return void setTimeout(s, 50); + } + d(); + } + })(window); diff --git a/src/fonts/moblie/iconfont.json b/src/fonts/moblie/iconfont.json new file mode 100644 index 0000000..f9f4e22 --- /dev/null +++ b/src/fonts/moblie/iconfont.json @@ -0,0 +1,114 @@ +{ + "id": "4841764", + "name": "yl", + "font_family": "iconfont", + "css_prefix_text": "icon-", + "description": "", + "glyphs": [ + { + "icon_id": "240132", + "name": "radio_box", + "font_class": "radiobox", + "unicode": "e75b", + "unicode_decimal": 59227 + }, + { + "icon_id": "844024", + "name": "矩阵打分", + "font_class": "juzhendafen", + "unicode": "e641", + "unicode_decimal": 58945 + }, + { + "icon_id": "1176868", + "name": "checkbox-checked", + "font_class": "checkbox-checked", + "unicode": "e6c3", + "unicode_decimal": 59075 + }, + { + "icon_id": "8766356", + "name": "nps", + "font_class": "nps", + "unicode": "e6b0", + "unicode_decimal": 59056 + }, + { + "icon_id": "11215250", + "name": "input", + "font_class": "input", + "unicode": "e6fd", + "unicode_decimal": 59133 + }, + { + "icon_id": "15969322", + "name": "矩阵填空", + "font_class": "juzhentiankong", + "unicode": "e62e", + "unicode_decimal": 58926 + }, + { + "icon_id": "15969340", + "name": "文件上传", + "font_class": "wenjianshangchuan", + "unicode": "e631", + "unicode_decimal": 58929 + }, + { + "icon_id": "17269853", + "name": "签名", + "font_class": "qianming", + "unicode": "e661", + "unicode_decimal": 58977 + }, + { + "icon_id": "17373529", + "name": "图文", + "font_class": "tuwen", + "unicode": "e62c", + "unicode_decimal": 58924 + }, + { + "icon_id": "36443758", + "name": "矩阵多选", + "font_class": "juzhenduoxuan", + "unicode": "e818", + "unicode_decimal": 59416 + }, + { + "icon_id": "38465935", + "name": "矩阵单选", + "font_class": "juzhendanxuan", + "unicode": "13c7f", + "unicode_decimal": 81023 + }, + { + "icon_id": "1160114", + "name": "edit-2", + "font_class": "edit2", + "unicode": "e630", + "unicode_decimal": 58928 + }, + { + "icon_id": "1160116", + "name": "copy", + "font_class": "copy", + "unicode": "e632", + "unicode_decimal": 58930 + }, + { + "icon_id": "1160129", + "name": "delete", + "font_class": "delete", + "unicode": "e63f", + "unicode_decimal": 58943 + }, + { + "icon_id": "1160227", + "name": "sort", + "font_class": "sort", + "unicode": "e6a0", + "unicode_decimal": 59040 + } + ] +} diff --git a/src/fonts/moblie/iconfont.ttf b/src/fonts/moblie/iconfont.ttf new file mode 100644 index 0000000..ec87c07 Binary files /dev/null and b/src/fonts/moblie/iconfont.ttf differ diff --git a/src/fonts/moblie/iconfont.woff b/src/fonts/moblie/iconfont.woff new file mode 100644 index 0000000..33c8376 Binary files /dev/null and b/src/fonts/moblie/iconfont.woff differ diff --git a/src/fonts/moblie/iconfont.woff2 b/src/fonts/moblie/iconfont.woff2 new file mode 100644 index 0000000..6b0fc4c Binary files /dev/null and b/src/fonts/moblie/iconfont.woff2 differ diff --git a/src/stores/counter.ts b/src/stores/counter.ts index 646a644..3015b5c 100644 --- a/src/stores/counter.ts +++ b/src/stores/counter.ts @@ -15,7 +15,10 @@ const modules = Object.entries(modulesFiles).reduce( export const useCounterStore = defineStore('counter', () => { // 引入 common 模块 const commonStore = useCommonStore(); - const { questionsInfo } = storeToRefs(commonStore); + const ques = storeToRefs(commonStore); + + // 暴露 fetchQuestionInfo 方法 + const { fetchQuestionInfo, setQuestionInfo } = commonStore; // 返回需要暴露的内容 - return { commonStore, questionsInfo, modules }; + return { commonStore, modules, fetchQuestionInfo, ...ques, setQuestionInfo }; }); diff --git a/src/stores/modules/common.ts b/src/stores/modules/common.ts index 1a9dca6..bc77f9d 100644 --- a/src/stores/modules/common.ts +++ b/src/stores/modules/common.ts @@ -4,40 +4,25 @@ import { defineStore } from 'pinia'; // 如果没有现成的 uid 函数,可以引入一个 UUID 库 // 或者使用其他 UUID 库 import { v4 as uuidv4 } from 'uuid'; -import { http } from '@/request/axios'; -import { surveyQuestion } from '@/request/api/modules/survey'; export const useCommonStore = defineStore('common', { state: () => ({ questionsInfo: { survey: { - id: 8721, - introduction: '

【样本量要求≥60】

', - pages: [ - [24, 27, 26, 1], - [2, 3, 4, 5, 6, 7], - [8, 9, 10, 11, 12, 13, 14], - [15, 16, 17, 18, 19, 20, 21], - [28, 22] - ], - sn: '8YXK4kW5', + id: 9577, + introduction: '

123

', + pages: [[]], + sn: 'oxywX8W6', status: 0, - title: - '

液态奶产品研究标准化问卷-概念测试(内测标准版)

', - detail_pages: [ - [24, 27, 26, 1], - [2, 3, 4, 5, 6, 7], - [8, 9, 10, 11, 12, 13, 14], - [15, 16, 17, 18, 19, 20, 21], - [28, 22] - ], + title: '报名签到问卷 ', + detail_pages: [], group_pages: [], is_one_page_one_question: 0, last_question_index: 0, is_three_d_permissions: 0, is_dept: 1, - last_title: 'Q5', - project_name: '概念诊断问卷示例-0227', + last_title: 'Q0', + project_name: '报名签到问卷 ', quota_end_content: '

\n

很抱歉,本次调研不太适合您的情况,感谢您的参与!

', quota_end_url: '', @@ -52,225 +37,27 @@ export const useCommonStore = defineStore('common', { end_jump_status: 0, end_jump_standing_time: 0, success_end_content: - '

\n

您已完成本次调研,感谢您的参与!

\n

【成功完成】

', + '

\n

您已完成本次调研,感谢您的参与!

\n

【成功完成】

', success_end_url: '', success_end_url_select: 0, success_standing_time: 0, - template_type: 300, - local_pages: [ - { - pages: [], - is_short_time: 0, - short_time: '', - is_show: 0, - use_type: 0 - }, - { - pages: [], - is_short_time: 0, - short_time: '', - is_show: 0, - use_type: 0 - }, - { - pages: [], - is_short_time: 0, - short_time: '', - is_show: 0, - use_type: 0 - }, - { - pages: [], - is_short_time: 0, - short_time: '', - is_show: 0, - use_type: 0 - }, - { - pages: [], - is_short_time: 0, - short_time: '', - is_show: 0, - use_type: 0 - } - ] + template_type: 0, + local_pages: [] }, - logics: [ - { - logic: [ - { - value: '', - location: 0, - date: '', - time: '', - type: 0, - row_type: 0, - cell_type: 0, - logic: 'if', - operator: '=', - is_answer: 1, - is_select: 0, - row_index: 0, - cell_index: 0, - question_type: 1, - question_index: 24, - relation_question_index: 0, - relation_question_row_index: 0, - relation_question_cell_index: 0, - is_option_group: 0, - option_index: 1, - skip_type: null, - question_id: null - } - ], - skip_question_index: 27, - skip_type: 0, - id: 472148, - question_index: 24, - question_id: '17852294' - }, - { - logic: [ - { - value: '', - location: 0, - date: '', - time: '', - type: 0, - row_type: 0, - cell_type: 0, - logic: 'if', - operator: '=', - is_answer: 1, - is_select: 0, - row_index: 0, - cell_index: 0, - question_type: 1, - question_index: 24, - relation_question_index: 0, - relation_question_row_index: 0, - relation_question_cell_index: 0, - is_option_group: 0, - option_index: 0, - skip_type: null, - question_id: null - } - ], - skip_type: 0, - id: 472149, - question_index: 24, - question_id: '17852294' - }, - { - logic: [ - { - value: '', - location: 0, - date: '', - time: '', - type: 0, - row_type: 0, - cell_type: 0, - logic: 'if', - operator: '=', - is_answer: 1, - is_select: 0, - row_index: 0, - cell_index: 0, - question_type: 1, - question_index: 24, - relation_question_index: 0, - relation_question_row_index: 0, - relation_question_cell_index: 0, - is_option_group: 0, - option_index: 0, - skip_type: null, - question_id: null - } - ], - skip_type: 0, - id: 472151, - question_index: 24, - question_id: '17852294' - }, - { - logic: [ - { - logic: 'if', - question_index: 30, - question_type: 1, - is_answer: 1, - operator: '=', - option_index: 2, - relation_question_index: 0, - type: 0, - is_option_group: 0, - group_index: null - }, - { - logic: 'and', - question_index: 30, - question_type: 1, - is_answer: 1, - operator: '=', - option_index: 1, - relation_question_index: 0, - type: 0, - is_option_group: 1, - group_index: 1 - } - ], - skip_question_index: 0, - skip_type: 1, - id: 472152, - question_index: 24, - question_id: '17852294' - }, - { - logic: [ - { - logic: 'if', - question_index: 30, - question_type: 1, - is_answer: 0, - operator: '=', - option_index: 0, - relation_question_index: 0, - type: 0 - } - ], - skip_type: 1, - id: '28fe4d64-81eb-4937-a082-c519ac74374f', - question_index: 24, - question_id: '17852294' - }, - { - logic: [ - { - operator: '=', - is_answer: 1, - question_type: 1, - logic: 'always' - } - ], - skip_type: 1, - id: '459f781f-8db0-4663-b2d1-9ddad627078e', - question_index: 24, - question_id: '17852294' - } - ], + logics: [], questions: [], cycle_pages: null - } as QuestionsInfo + } }), actions: { - async fetchQuestionInfo(questionInfo: string) { + async fetchQuestionInfo(questionInfo) { + console.log(questionInfo, 456); try { if (!questionInfo) return; const info = JSON.parse(questionInfo); if (info?.questions?.length) { - info.questions.forEach((page:any) => { + info.questions.forEach((page) => { // 使用 UUID 生成唯一 ID if (page?.page) { page.pageId = page.pageId || uuidv4(); @@ -282,21 +69,10 @@ export const useCommonStore = defineStore('common', { // 未来扩展 } }, - setQuestionInfo(questionInfo: QuestionsInfo) { + setQuestionInfo(questionInfo) { + console.log(questionInfo, 9998); + console.log(this); this.questionsInfo = questionInfo; - }, - /** - * web 端测试问卷地址 `/api/api/console/surveys/RWNK9BYp/questions` - * 做了个测试,后面再改 - */ - fetchSurveyQuestion() { - http.get(surveyQuestion).then(res => { - // console.log('http get request:',res.data.data); - this.setQuestionInfo(res.data.data); - });/* .catch(res=>{ - // console.log('catch',res); - this.setQuestionInfo(res); - }) */ } }, getters: { diff --git a/src/utils/QuestionJsons/FileUpload.js b/src/utils/QuestionJsons/FileUpload.js new file mode 100644 index 0000000..868a7a8 --- /dev/null +++ b/src/utils/QuestionJsons/FileUpload.js @@ -0,0 +1,29 @@ +export default { + id: '', + question_type: 18, + question_index: 41, + stem: '请上传文件', + title: 'Q14', + options: [], + last_option_index: 0, + config: { + is_required: 1, + quick_type: 0, + is_show: [], + select_random: 0, + min_number: 1, + max_number: 1, + min_size: 0, + max_size: 1, + is_file: 0, + file_type: '0' + }, + associate: [], + question_code: '', + logic_config: { + order: 0, + type: 0, + expect: '', + stay_time: '' + } +}; diff --git a/src/utils/QuestionJsons/MartrixQuestion.js b/src/utils/QuestionJsons/MartrixQuestion.js index 5da73ce..583eccf 100644 --- a/src/utils/QuestionJsons/MartrixQuestion.js +++ b/src/utils/QuestionJsons/MartrixQuestion.js @@ -1,14 +1,14 @@ export default { // JSON 需要修改 id: '', - question_type: 5, + question_type: '', question_index: '', - stem: '请完成打分', + stem: '请每行选择一个选项', title: '', options: [ [ { - id: 'e46f51b1-bfd8-4d9c-becc-4fb7d175a6f4', + id: '', is_fixed: 0, is_other: 0, is_remove_other: 0, @@ -25,6 +25,83 @@ export default { type: 0, cascade: [], config: [] + }, + { + id: '', + is_fixed: 0, + is_other: 0, + is_remove_other: 0, + option: '

选项2

', + option_config: { + image_url: [], + title: '', + instructions: [], + option_type: 0, + limit_right_content: '' + }, + option_index: 1, + parent_id: 0, + type: 0, + cascade: [], + config: [] + } + ], + [ + { + option: '

列标签1

', + id: '1049201', + type: 2, + is_other: 0, + is_fixed: 0, + is_remove_other: 0, + created_at: null, + created_user_id: null, + parent_id: null, + option_index: 3, + list_id: 74491, + option_code: '', + option_config: { + title: '', + instructions: [], + price: 0, + gradient: '', + image_url: [], + option_type: 0, + type: 0, + limit_right_content: '', + child_area: null, + binding_goods_id: '' + }, + disable_option_update: null, + cascade: [] + }, + { + option: '

列标签2

', + id: '1049202', + type: 2, + is_other: 0, + is_fixed: 0, + is_remove_other: 0, + created_at: null, + created_user_id: null, + parent_id: null, + option_index: 4, + list_id: 74491, + option_code: '', + option_config: { + title: '', + instructions: [], + price: 0, + gradient: '', + image_url: [], + option_type: 0, + type: 0, + limit_right_content: '', + child_area: null, + binding_goods_id: '' + }, + disable_option_update: null, + cascade: [] } ] ], diff --git a/src/utils/QuestionJsons/NPS.js b/src/utils/QuestionJsons/NPS.js new file mode 100644 index 0000000..0f305ef --- /dev/null +++ b/src/utils/QuestionJsons/NPS.js @@ -0,0 +1,54 @@ +export default { + id: '', + question_type: 106, + question_index: 0, + stem: '您向朋友或同事推荐我们的可能性多大?', + title: '', + options: [ + [ + { + id: 'b68d45eb-d833-4b25-b0aa-2fde1310e88d', + is_fixed: 0, + is_other: 0, + is_remove_other: 0, + option: '

选项1

', + option_config: { + image_url: [], + title: '', + instructions: [], + option_type: 0, + limit_right_content: '' + }, + option_index: 1, + parent_id: 0, + type: 0, + cascade: [], + config: [] + } + ] + ], + last_option_index: 0, + config: { + is_required: 1, + quick_type: 0, + is_show: [], + version: 2, + prompt_left: '不可能', + prompt_right: '极有可能', + prompt_center: '', + max: 10, + min: 0, + score_interval: 1, + score_type: 0, + score_way: 1, + prompt_score: 2 + }, + associate: [], + question_code: '', + logic_config: { + order: 0, + type: 0, + expect: '', + stay_time: '' + } +}; diff --git a/src/utils/QuestionJsons/SignQuestion.js b/src/utils/QuestionJsons/SignQuestion.js new file mode 100644 index 0000000..c8e11da --- /dev/null +++ b/src/utils/QuestionJsons/SignQuestion.js @@ -0,0 +1,37 @@ +export default { + id: '17852690', + title: 'Q7', + stem: '请留下您的姓名', + other: '', + question_index: 10, + question_type: 22, + config: { + is_required: 1, + select_random: 0, + float_window: 0, + float_window_content: '', + popup_window: 0, + popup_window_content: '', + is_show: [], + quick_type: 0 + }, + created_at: '2025-03-06T15:51:13', + created_user_id: 1281, + updated_user_id: null, + survey_id: 9482, + logic_config: { + expect: '', + order: 0, + type: 0, + stay_time: '' + }, + options: [], + associate: [], + logics_has: null, + last_option_index: 0, + question_code: '', + question_value: '', + question_tag: '', + planet_id: '', + permissions: null +}; diff --git a/src/utils/QuestionJsons/TextWithImages.js b/src/utils/QuestionJsons/TextWithImages.js new file mode 100644 index 0000000..1c8d613 --- /dev/null +++ b/src/utils/QuestionJsons/TextWithImages.js @@ -0,0 +1,22 @@ +export default { + id: '', + question_type: '', + question_index: 0, + stem: '请认真阅读以下内容', + title: '', + options: [], + last_option_index: 0, + config: { + is_required: 1, + quick_type: 0, + is_show: [] + }, + associate: [], + question_code: '', + logic_config: { + order: 0, + type: 0, + expect: '', + stay_time: '' + } +}; diff --git a/src/utils/importJsons.js b/src/utils/importJsons.js index b952229..66ff0ab 100644 --- a/src/utils/importJsons.js +++ b/src/utils/importJsons.js @@ -4,3 +4,7 @@ export { default as checkbox } from './QuestionJsons/Checkbox.js'; export { default as completion } from './QuestionJsons/Completion.js'; export { default as rate } from './QuestionJsons/Rate.js'; export { default as martrixQuestion } from './QuestionJsons/MartrixQuestion.js'; +export { default as fileUpload } from './QuestionJsons/FileUpload.js'; +export { default as textWithImages } from './QuestionJsons/TextWithImages.js'; +export { default as signQuestion } from './QuestionJsons/SignQuestion.js'; +export { default as nps } from './QuestionJsons/NPS.js'; diff --git a/src/utils/request.js b/src/utils/request.js new file mode 100644 index 0000000..16fd215 --- /dev/null +++ b/src/utils/request.js @@ -0,0 +1,91 @@ +import axios from 'axios'; + +// import router from '@/router/index'; +// import { A_COMMON_CLEAR_TOKEN } from '@/stores/constance/constance.common.js'; + +import * as config from '@/config.js'; +// import {proxyUrl} from config.default +const NODE_ENV = import.meta.env.VITE_APP_ENV; +const baseURL = NODE_ENV === 'production' ? config.default.proxyUrl : 'http://192.168.8.165:15011/'; + +// axios.defaults.withCredentials = true; + +// create an axios instance +const service = axios.create({ + baseURL: `${baseURL}`, // url = base url + request url + // withCredentials: true, // send cookies when cross-domain requests + timeout: 30000 // request timeout +}); + +// request interceptor +service.interceptors.request.use( + (config) => { + if (!config.headers) { + config.headers.Accept = 'application/json'; + } + config.headers.Authorization = `${localStorage.getItem('plantToken')}`; + if (!config.headers.remoteIp) { + config.baseURL += '/api'; + } + delete config.headers.host; + config.headers.remoteIp = localStorage.getItem('plantIp') || '127.0.0.1'; + // if (store.state.common.token) { + // config.headers['Login-Type'] = 'pc'; + // config.headers.Authorization = `Bearer ${store.state.common.token}`; + // } + return config; + }, + (error) => Promise.reject(error) +); + +// response interceptor +service.interceptors.response.use( + (response) => { + if ( + response.status === 200 + || response.status === 201 + || response.status === 202 + || response.status === 204 + ) { + if (response.config.method === 'put') { + // message.success('保存中...'); + } + return Promise.resolve(response); + } + // return Promise.reject(/* new Error(response.message || 'Error') */); + } + // (error) => { + // // for debug + // if (error.response.status === 401) { + // const query = router.currentRoute.value.query; + // //关闭已弹出的所有弹框,防止弹框重叠 + // // Modal.destroyAll(); + // store.dispatch(A_COMMON_CLEAR_TOKEN); + // window.parent.postMessage( + // { + // code: '301', + // params: {} + // }, + // '*' + // ); + // store.commit('common/M_COMMON_SET_TOKEN_UNAUTHORIZED', false); + // } else if (error.response.status === 403) { + // router.push({ + // path: '/error/403' + // }); + // } else if (error.response.status === 404) { + // router.push({ + // path: '/error/404' + // }); + // } else if (error.response.status === 500) { + // router.push({ + // path: '/error/500' + // }); + // } else { + // // message.error(error.response.data?.message || '服务器错误'); + // } + // return Promise.reject(error.response); + // } +); + +export default service; diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue index 52a7248..434861e 100644 --- a/src/views/Design/Index.vue +++ b/src/views/Design/Index.vue @@ -14,8 +14,6 @@ :questions="questionInfo.questions" :index="index" :chooseQuestionId="chooseQuestionId" - :show-actions="!preview" - style="margin: 10px 0" @get-choose-question-id="getChooseQuestionId" > @@ -89,7 +87,11 @@