style:优化字体图标和样式

- 更新移动设备字体图标- 调整公共样式,包括开关、表格、blockquote等- 优化代码高亮样式- 添加新的字体图标样式
This commit is contained in:
陈昱达
2025-03-15 16:17:58 +08:00
parent e81a3a4bfe
commit 4bf37ae4da
56 changed files with 857 additions and 754 deletions

2
components.d.ts vendored
View File

@@ -23,6 +23,8 @@ declare module 'vue' {
VanCol: typeof import('vant/es')['Col']
VanDivider: typeof import('vant/es')['Divider']
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']

View File

@@ -4,7 +4,7 @@ import { onMounted } from 'vue';
import appBridge from '@/assets/js/appBridge';
import utils from '@/assets/js/common';
onMounted(async () => {
onMounted(async() => {
if (utils.getParameter('digitalYiliToken')) {
// 隐藏/显示 header
appBridge.setHeaderShown(false);

View File

@@ -32,6 +32,10 @@
}
}
.van-switch--on{
background: $theme-color;
}
.van-toast {
padding: 10px 16px !important;
border-radius: 5px !important;

BIN
src/assets/img/empty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -170,8 +170,8 @@ const getMaxDateLimit = computed(() => {
props.format
);
const tempStr = '0000-12-31 23:59:59';
const result =
props.maxDate.length !== 0 && thisMax.length > props.maxDate.length
const result
= props.maxDate.length !== 0 && thisMax.length > props.maxDate.length
? thisMax.slice(0, props.maxDate.length) + tempStr.slice(props.maxDate.length)
: thisMax;
return result.slice(0, props.format.length);
@@ -194,8 +194,8 @@ function onChange({ selectedValues, columnIndex }) {
renderMinuteColumns,
renderSecondColumns
];
updateColumns[columnIndex] &&
updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false);
updateColumns[columnIndex]
&& updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false);
}
// 渲染全部列

View File

@@ -1,5 +1,11 @@
<template>
<div ref="editor" :contenteditable="active" class="van-field" v-html="modelValue"></div>
<p
ref="editor"
:contenteditable="active"
class="van-field"
:class="className"
v-html="modelValue"
></p>
<div v-if="showAction && active" ref="editorAction" class="editor-action">
<button v-for="item in actions" :key="item.name" @click="funEvent(item, $event)">
{{ item.label }}
@@ -15,6 +21,10 @@ const props = defineProps({
type: String,
default: ''
},
className: {
type: String,
default: ''
},
active: {
type: Boolean,
default: false

View File

@@ -4,11 +4,11 @@
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'),
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');
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'),

View File

@@ -1,15 +1,17 @@
@font-face {
font-family: iconfont; /* Project id 3121635 */
font-family: mobilefont; /* Project id 3121635 */
src:
url('iconfont.woff2?t=1732174085435') format('woff2'),
url('iconfont.woff?t=1732174085435') format('woff'),
url('iconfont.ttf?t=1732174085435') format('truetype');
}
.iconfont {
.mobilefont {
font-style: normal;
font-size: 16px;
font-family: iconfont !important;
font-family: mobilefont !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@@ -2,13 +2,10 @@
@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'),
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');
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
@@ -51,6 +48,7 @@
cursor: pointer;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
@@ -121,15 +119,9 @@
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;
-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 {
@@ -226,35 +218,35 @@
margin: 1em 0;
}
.markdown > p,
.markdown > blockquote,
.markdown > .highlight,
.markdown > ol,
.markdown > ul {
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul > li {
.markdown ul>li {
list-style: circle;
}
.markdown > ul li,
.markdown blockquote ul > li {
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown > ul li p,
.markdown > ol li p {
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol > li {
.markdown ol>li {
list-style: decimal;
}
.markdown > ol li,
.markdown blockquote ol > li {
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
@@ -271,7 +263,7 @@
font-weight: 600;
}
.markdown > table {
.markdown>table {
width: 95%;
margin-bottom: 24px;
border: 1px solid #e9e9e9;
@@ -280,21 +272,21 @@
empty-cells: show;
}
.markdown > table th {
.markdown>table th {
color: #333;
font-weight: 600;
white-space: nowrap;
}
.markdown > table th,
.markdown > table td {
.markdown>table th,
.markdown>table td {
padding: 8px 16px;
border: 1px solid #e9e9e9;
text-align: left;
}
.markdown > table th {
background: #f7f7f7;
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
@@ -329,11 +321,12 @@
opacity: 1;
}
.markdown > br,
.markdown > p > br {
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
overflow-x: auto;
@@ -458,19 +451,19 @@ code[class*='language-'] ::selection {
/* Code blocks */
pre[class*='language-'] {
overflow: auto;
margin: 0.5em 0;
margin: .5em 0;
padding: 1em;
}
:not(pre) > code[class*='language-'],
:not(pre)>code[class*='language-'],
pre[class*='language-'] {
background: #f5f2f0;
}
/* Inline code */
:not(pre) > code[class*='language-'] {
padding: 0.1em;
border-radius: 0.3em;
:not(pre)>code[class*='language-'] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
@@ -486,7 +479,7 @@ pre[class*='language-'] {
}
.namespace {
opacity: 0.7;
opacity: .7;
}
.token.property,
@@ -513,7 +506,7 @@ pre[class*='language-'] {
.token.url,
.language-css .token.string,
.style .token.string {
background: hsla(0deg, 0%, 100%, 0.5);
background: hsla(0deg, 0%, 100%, .5);
color: #9a6e3a;
}
@@ -525,7 +518,7 @@ pre[class*='language-'] {
.token.function,
.token.class-name {
color: #dd4a68;
color: #DD4A68;
}
.token.regex,

View File

@@ -1,75 +1,103 @@
@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');
src: url('iconfont.woff2?t=1742025232194') format('woff2'),
url('iconfont.woff?t=1742025232194') format('woff'),
url('iconfont.ttf?t=1742025232194') format('truetype');
}
.mobilefont {
font-style: normal;
font-size: 18px;
font-size: 16px;
font-family: mobilefont !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-radiobox::before {
.mobilefont-del1::before {
content: '\e637';
}
.mobilefont-gengduo::before {
content: '\e600';
}
.mobilefont-delete1::before {
content: '\e66d';
}
.mobilefont-del::before {
content: '\e6f5';
}
.mobilefont-option::before {
content: '\e6ff';
}
.mobilefont-setting::before {
content: '\e633';
}
.mobilefont-add::before {
content: '\e686';
}
.mobilefont-radiobox::before {
content: '\e75b';
}
.icon-juzhendafen::before {
.mobilefont-juzhendafen::before {
content: '\e641';
}
.icon-checkbox-checked::before {
.mobilefont-checkbox-checked::before {
content: '\e6c3';
}
.icon-nps::before {
.mobilefont-nps::before {
content: '\e6b0';
}
.icon-input::before {
.mobilefont-input::before {
content: '\e6fd';
}
.icon-juzhentiankong::before {
.mobilefont-juzhentiankong::before {
content: '\e62e';
}
.icon-wenjianshangchuan::before {
.mobilefont-wenjianshangchuan::before {
content: '\e631';
}
.icon-qianming::before {
.mobilefont-qianming::before {
content: '\e661';
}
.icon-tuwen::before {
.mobilefont-tuwen::before {
content: '\e62c';
}
.icon-juzhenduoxuan::before {
.mobilefont-juzhenduoxuan::before {
content: '\e818';
}
.icon-juzhendanxuan::before {
.mobilefont-juzhendanxuan::before {
content: '\13c7f';
}
.icon-edit2::before {
.mobilefont-edit2::before {
content: '\e630';
}
.icon-copy::before {
.mobilefont-copy::before {
content: '\e632';
}
.icon-delete::before {
.mobilefont-delete::before {
content: '\e63f';
}
.icon-sort::before {
.mobilefont-sort::before {
content: '\e6a0';
}

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,59 @@
{
"id": "4841764",
"name": "yl",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"font_family": "mobilefont",
"css_prefix_text": "mobilefont-",
"description": "",
"glyphs": [
{
"icon_id": "6135228",
"name": "del",
"font_class": "del1",
"unicode": "e637",
"unicode_decimal": 58935
},
{
"icon_id": "159969",
"name": "more",
"font_class": "gengduo",
"unicode": "e600",
"unicode_decimal": 58880
},
{
"icon_id": "627633",
"name": "delete",
"font_class": "delete1",
"unicode": "e66d",
"unicode_decimal": 58989
},
{
"icon_id": "669644",
"name": "del",
"font_class": "del",
"unicode": "e6f5",
"unicode_decimal": 59125
},
{
"icon_id": "17956030",
"name": "option",
"font_class": "option",
"unicode": "e6ff",
"unicode_decimal": 59135
},
{
"icon_id": "18261691",
"name": "setting",
"font_class": "setting",
"unicode": "e633",
"unicode_decimal": 58931
},
{
"icon_id": "22873715",
"name": "add",
"font_class": "add",
"unicode": "e686",
"unicode_decimal": 59014
},
{
"icon_id": "240132",
"name": "radio_box",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -15,64 +15,7 @@
</template>
<script setup>
import { RouterView, useRouter } from 'vue-router';
import { ref } from 'vue';
// import utils from '@/assets/js/common';
// import { getUserInfo } from '@/api/common/index.js';
// import { showFailToast } from 'vant';
const router = useRouter();
const active = ref();
const table = [
{
title: '首页',
path: '/',
icon: 'https://files.axshare.com/gsc/DR6075/de/a0/49/dea049d6ad3e4c2c80af44258c6c76d6/images/%E9%A6%96%E9%A1%B5_1/u18.png?pageId=74b3e5b2-848e-4258-8a34-9e220127c8a6'
},
{
title: '问卷',
path: '/survey',
icon: 'https://files.axshare.com/gsc/DR6075/de/a0/49/dea049d6ad3e4c2c80af44258c6c76d6/images/%E9%A6%96%E9%A1%B5_1/u21.png?pageId=74b3e5b2-848e-4258-8a34-9e220127c8a6'
},
{
title: '新建问卷',
path: '/create',
icon: 'https://files.axshare.com/gsc/DR6075/de/a0/49/dea049d6ad3e4c2c80af44258c6c76d6/images/首页_1/u15.png?pageId=74b3e5b2-848e-4258-8a34-9e220127c8a6'
},
{
title: '模板',
path: '/market',
icon: 'https://files.axshare.com/gsc/DR6075/de/a0/49/dea049d6ad3e4c2c80af44258c6c76d6/images/%E9%A6%96%E9%A1%B5_1/u24.png?pageId=74b3e5b2-848e-4258-8a34-9e220127c8a6'
}
];
function tabPath(path) {
router.push({
path
});
// if (utils.getParameter('digitalYiliToken')) {
// const appToken = utils.getParameter('digitalYiliToken');
// getUserInfo(appToken)
// .then((res) => {
// if (res.data) {
// utils.setSessionStorage('userInfo', res.data.data);
// router.push({
// path
// });
// } else {
// showFailToast(
// error.response.data?.message || error.data?.message || error.message || '服务器错误'
// );
// }
// })
// .catch((error) => {
// showFailToast(error?.response?.data?.message || error?.message || '服务器错误');
// });
// } else {
// router.push({
// path
// });
// }
}
import { RouterView } from 'vue-router';
</script>
<style scoped lang="scss">

View File

@@ -46,13 +46,13 @@ function showModal(options) {
* @param {*} data
* @returns
*/
const canPlanetPublishPSM = function (data) {
const canPlanetPublishPSM = function(data) {
let isFb = true;
let content = '';
let title = '题目设置未完成';
const incompleteQuestionList = [];
data.questions &&
data.questions.forEach((s) => {
data.questions
&& data.questions.forEach((s) => {
if (s.question_type === 101 && s.config.price_gradient.length <= 0) {
isFb = false;
content = 'psm题目未完成设置请设置价格区间后投放';
@@ -77,15 +77,15 @@ const canPlanetPublishPSM = function (data) {
* @param {*} data
* @returns
*/
const canPlanetPublishMxdAndHotArea = function (data) {
const canPlanetPublishMxdAndHotArea = function(data) {
let isFb = true;
let content = '';
const qSteams = [];
const incompleteQuestionList = [];
let type = 0;
let title = '题目设置未完成';
data.questions &&
data.questions.forEach((s) => {
data.questions
&& data.questions.forEach((s) => {
if (s.question_type === 105 && s.config.design_version <= 0) {
isFb = false;
content = 'maxdiff题目未完成设置请生成设计后投放';
@@ -124,14 +124,14 @@ const canPlanetPublishMxdAndHotArea = function (data) {
* @param {*} data
* @returns
*/
const canPlanetPublish3D = function (data) {
const canPlanetPublish3D = function(data) {
{
let canFB = true;
let content = '';
const qSteams = [];
let title = '';
data.questions &&
data.questions.forEach((s) => {
data.questions
&& data.questions.forEach((s) => {
if (QUESTION_TYPE.contains(s.question_type)) {
try {
if (s.config.is_three_dimensions && !s.config.scene) {
@@ -161,15 +161,15 @@ const canPlanetPublish3D = function (data) {
let content = '';
const qSteams = [];
let title = '';
data.questions &&
data.questions.forEach((s) => {
data.questions
&& data.questions.forEach((s) => {
if (QUESTION_TYPE.contains(s.question_type)) {
try {
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
const wares = [];
const _sceneInformation = s.config.scene_information;
const sceneInformation =
typeof _sceneInformation === 'string'
const sceneInformation
= typeof _sceneInformation === 'string'
? JSON.parse(_sceneInformation)
: _sceneInformation;
sceneInformation.shelves.forEach((shelf) => {
@@ -221,14 +221,14 @@ const canPlanetPublish3D = function (data) {
* @param {*} data
* @returns
*/
const canPlanetPublishImage = function (data) {
const canPlanetPublishImage = function(data) {
{
let canFB = true;
let content = '';
const qSteams = [];
let title = '';
data.questions &&
data.questions.forEach((s) => {
data.questions
&& data.questions.forEach((s) => {
if (s.question_type === 13) {
try {
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
@@ -323,8 +323,8 @@ function canPublishRandom(data, publishType) {
if (!isValidated) {
errors.push({
message:
field.message ||
`请填写“${random.title}”中第${index + 1}组“随机题组”的“${field.name}`
field.message
|| `请填写“${random.title}”中第${index + 1}组“随机题组”的“${field.name}`
});
}
});
@@ -378,7 +378,7 @@ function canPublishRandom(data, publishType) {
// return false;
// }
export const canPlanetPublish = async function (sn, publishType) {
export const canPlanetPublish = async function(sn, publishType) {
const parsedPublishType = !publishType ? 2 : publishType;
const num = window.location.href.indexOf('code=');

View File

@@ -1,4 +1,3 @@
import './assets/css/main.scss';
import 'amfe-flexible';
import { createApp } from 'vue';
import { createPinia } from 'pinia';
@@ -10,6 +9,8 @@ import 'vant/lib/index.css';
import '@/style/utils.scss';
import appBridge from '@/assets/js/appBridge';
import VConsole from 'vconsole';
import './assets/css/main.scss';
const app = createApp(App);
if (import.meta.env.VITE_APP_ENV !== 'production') {

View File

@@ -1,2 +1,2 @@
export const surveyQuestion =
'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions';
export const surveyQuestion
= 'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions';

View File

@@ -38,10 +38,10 @@ service.interceptors.request.use(
service.interceptors.response.use(
(response) => {
if (
response.status === 200 ||
response.status === 201 ||
response.status === 202 ||
response.status === 204
response.status === 200
|| response.status === 201
|| response.status === 202
|| response.status === 204
) {
if (response.config.method === 'put') {
// message.success('保存中...');

View File

@@ -44,10 +44,10 @@ service.interceptors.request.use(
service.interceptors.response.use(
(response) => {
if (
response.status === 200 ||
response.status === 201 ||
response.status === 202 ||
response.status === 204
response.status === 200
|| response.status === 201
|| response.status === 202
|| response.status === 204
) {
if (response.config.method === 'put') {
// message.success('保存中...');

View File

@@ -1,6 +1,7 @@
<template>
<div class="design-create">
<draggable
v-if="questionInfo.questions.length > 0"
v-model:data="questionInfo.questions"
item-key="id"
handle=".moverQues"
@@ -51,8 +52,8 @@
<martrix-question
v-if="
element.question_type === 8 ||
element.question_type === 9 ||
element.question_type === 10
element.question_type === 9 ||
element.question_type === 10
"
:element="computedElement(element)"
:index="index"
@@ -130,6 +131,9 @@
</div>
</template>
</draggable>
<div v-else>
<slot name="empty"></slot>
</div>
</div>
</template>
<script setup>
@@ -163,7 +167,7 @@ const { filterGap, activeId } = defineProps({
default: false
},
activeId: {
type: String,
type: [String, Number],
default: ''
}
});
@@ -243,7 +247,8 @@ watch(
() => questionInfo.value.questions,
(newVal) => {
if (newVal) {
saveQueItem(questionInfo.value.logics, newVal); // 确保保存最新的数据
// 确保保存最新的数据
saveQueItem(questionInfo.value.logics, newVal);
}
},
{ deep: true }

View File

@@ -4,9 +4,9 @@
<div class="flex align-center option-action-container">
<slot name="item" :element="item" :index="index"></slot>
<span v-if="active" class="flex">
<van-icon name="close" @click="deleteOption(index)"></van-icon>
<van-icon name="setting-o" @click="openMoveModel(item, index)"></van-icon>
<van-icon name="more-o" @click="openOptionActionModel(item, index)"></van-icon>
<van-icon class-prefix="mobilefont" name="setting " @click="openMoveModel(item, index)" />
<van-icon class-prefix="mobilefont" name="gengduo " @click="openOptionActionModel(item, index)" />
<van-icon class-prefix="mobilefont" name="del1 " @click="deleteOption(index)" />
</span>
</div>
</template>
@@ -117,23 +117,23 @@ const openMoveModel = (item, index) => {
// 上下移动
const optionMove = (action) => {
switch (action.action) {
case 'up':
if (activeIndex.value === 0) {
moveShow.value = false;
return false;
}
// 向上移动
element.value.splice(activeIndex.value - 1, 0, element.value.splice(activeIndex.value, 1)[0]);
activeIndex.value -= 1;
break;
case 'down':
if (activeIndex.value === element.value.length - 1) {
moveShow.value = false;
return false;
}
element.value.splice(activeIndex.value + 1, 0, element.value.splice(activeIndex.value, 1)[0]);
activeIndex.value += 1;
break;
case 'up':
if (activeIndex.value === 0) {
moveShow.value = false;
return false;
}
// 向上移动
element.value.splice(activeIndex.value - 1, 0, element.value.splice(activeIndex.value, 1)[0]);
activeIndex.value -= 1;
break;
case 'down':
if (activeIndex.value === element.value.length - 1) {
moveShow.value = false;
return false;
}
element.value.splice(activeIndex.value + 1, 0, element.value.splice(activeIndex.value, 1)[0]);
activeIndex.value += 1;
break;
}
};
@@ -162,11 +162,23 @@ const deleteOption = (index) => {
font-size: 20px;
& .option-action-container {
font-size: 20px;
font-size: 16px;
& .mobilefont{
font-size: 16px;
}
& .mobilefont + .mobilefont {
margin-left: 5px;
}
& .van-icon + .van-icon {
margin-left: 5px;
}
& .van-icon + .mobilefont {
margin-left: 5px;
}
}
}
</style>

View File

@@ -1,8 +1,8 @@
<template>
<div class="question-action-container flex">
<van-icon name="clear" @click="deleteQuestion"></van-icon>
<van-icon name="setting" @click="openQuestionSettingModel"></van-icon>
<van-icon name="more" @click="openQuestionActionModel"></van-icon>
<van-icon class-prefix="mobilefont" name="setting" @click="openQuestionSettingModel"></van-icon>
<van-icon class-prefix="mobilefont" name="gengduo " @click="openQuestionActionModel"></van-icon>
<van-icon class-prefix="mobilefont" name="delete" @click="deleteQuestion"></van-icon>
</div>
<!-- 操作项弹窗-->
@@ -179,7 +179,8 @@ const saveSettings = () => {
emit('setting', activeQuestion.value);
};
const saveLogics = () => {
emit('logics', activeQuestion.value); // 将更新后的 questionsInfo 传递给父组件
// 将更新后的 questionsInfo 传递给父组件
emit('logics', activeQuestion.value);
};
// 当前题目
@@ -259,8 +260,8 @@ const getSkipTypeText = (skipType) => {
const ls = [];
logics.map((item) => {
if (
item.skip_type === skipType &&
item.question_index === activeQuestion.value.question_index
item.skip_type === skipType
&& item.question_index === activeQuestion.value.question_index
) {
ls.push(item);
}
@@ -276,13 +277,13 @@ const getSkipTypeText = (skipType) => {
const questionSetting = (type) => {
switch (type) {
case 'before':
questionBeforeShow.value = true;
case 'before':
questionBeforeShow.value = true;
break;
case 'after':
questionBeforeShow.value = true;
break;
break;
case 'after':
questionBeforeShow.value = true;
break;
}
skipType.value = type === 'before' ? 1 : 0;
};
@@ -315,8 +316,16 @@ const updateConfig = (value) => {
.question-action-container {
font-size: 20px;
& .mobilefont{
font-size:18px;
}
& .van-icon + .van-icon {
margin-left: 5px;
}
& .mobilefont + .mobilefont {
margin-left: 5px;
}
}
</style>

View File

@@ -13,6 +13,6 @@
import { completionOptions } from '@/utils/questionSteeingList.js';
import YlSelect from '@/components/YLSelect.vue';
import YlInput from '@/components/YLInput.vue';
const logic = defineModel('logic', {});
const logic = defineModel('logic');
</script>
<style scoped lang="scss"></style>

View File

@@ -16,8 +16,18 @@
import { completionOptions } from '@/utils/questionSteeingList.js';
import YlSelect from '@/components/YLSelect.vue';
import YlInput from '@/components/YLInput.vue';
const logic = defineModel('logic', {});
const beforeQuesOptions = defineModel('beforeQuesOptions', {});
const logic = defineModel('logic', {
type: Object,
default: () => {
return {};
}
});
const beforeQuesOptions = defineModel('beforeQuesOptions', {
type: Array,
default: () => {
return [];
}
});
const getOptions = (type) => {
let options = [];

View File

@@ -20,8 +20,18 @@
<script setup>
import { groupOptions, symbolOptions } from '@/utils/questionSteeingList.js';
import YlSelect from '@/components/YLSelect.vue';
const logic = defineModel('logic');
const beforeQuesOptions = defineModel('beforeQuesOptions');
const logic = defineModel('logic', {
type: Object,
default: () => {
return {};
}
});
const beforeQuesOptions = defineModel('beforeQuesOptions', {
type: Array,
default: () => {
return [];
}
});
const getOptions = (type) => {
console.log(beforeQuesOptions);

View File

@@ -55,8 +55,18 @@ const changeQuestionIndex = () => {
return options;
};
const beforeQuesOptions = defineModel('beforeQuesOptions');
const logic = defineModel('logic', {});
const logic = defineModel('logic', {
type: Object,
default: () => {
return {};
}
});
const beforeQuesOptions = defineModel('beforeQuesOptions', {
type: Array,
default: () => {
return [];
}
});
watch(
() => logic.value,
(newVal, oldVal) => {

View File

@@ -12,6 +12,11 @@
import { symbolOptions } from '@/utils/questionSteeingList.js';
import YlSelect from '@/components/YLSelect.vue';
import YlInput from '@/components/YLInput.vue';
const logic = defineModel('logic');
const logic = defineModel('logic', {
type: Object,
default: () => {
return {};
}
});
</script>
<style scoped lang="scss"></style>

View File

@@ -144,8 +144,8 @@
<BeforeRate
v-if="
log.logic !== 'always' &&
log.is_answer !== 0 &&
[5, 106].includes(log.question_type)
log.is_answer !== 0 &&
[5, 106].includes(log.question_type)
"
:activeQuestion="activeQuestion"
:logic="log"
@@ -356,7 +356,12 @@ const props = defineProps({
}
});
const questionsInfo = defineModel('questionsInfo');
const questionsInfo = defineModel('questionsInfo', {
type: Object,
default: () => {
return {};
}
});
const logics = ref(questionsInfo.value.logics);
const questions = questionsInfo.value.questions;

View File

@@ -108,9 +108,9 @@ function isSurplus() {
return false;
} else {
return (
parseFloat(((localConfig.value.max - localConfig.value.min) * 1000).toFixed(4, 10)) %
parseFloat((localConfig.value.score_interval * 1000).toFixed(4, 10)) ===
0
parseFloat(((localConfig.value.max - localConfig.value.min) * 1000).toFixed(4, 10))
% parseFloat((localConfig.value.score_interval * 1000).toFixed(4, 10))
=== 0
);
}
}

View File

@@ -10,14 +10,6 @@
<template #title>
<span class="title"> {{ getQuestionType(element.question_type) }}</span>
</template>
</van-cell>
<slot></slot>
<!-- 题目操作-->
<van-cell v-if="chooseQuestionId === element.id" class="choose-question-active-container">
<template #icon>
<slot name="action" :element="element" :index="index"></slot>
</template>
<template #title>{{}}</template>
<template #right-icon>
<question-action
v-model:data="element"
@@ -32,6 +24,14 @@
></question-action>
</template>
</van-cell>
<slot></slot>
<!-- 题目操作-->
<van-cell v-if="chooseQuestionId === element.id" class="choose-question-active-container">
<template #icon>
<slot name="action" :element="element" :index="index"></slot>
</template>
<template #title>{{}}</template>
</van-cell>
</div>
<div v-else>
<slot></slot>

View File

@@ -21,14 +21,14 @@ const { element } = toRefs(props);
*/
const tableInputTypeMapping = (/** regx?: any */) => {
switch (element.value.question_type) {
case 8:
return 'text';
case 9:
return 'radio';
case 10:
return 'checkbox';
default:
return 'radio';
case 8:
return 'text';
case 9:
return 'radio';
case 10:
return 'checkbox';
default:
return 'radio';
}
};

View File

@@ -42,7 +42,7 @@ const props = defineProps<{
columns: { option: string; editor?: boolean }[];
questionType: number;
matrixAnswer: { [key: string]: any };
rowRecord: (number | string)[];
rowRecord:(number | string)[];
}>();
/* const emits = */ defineEmits(['update:matrixAnswer', 'update:rowRecord']);

View File

@@ -23,14 +23,14 @@ const matrixAnswer = ref({
*/
const tableInputTypeMapping = (/** regx?: any */) => {
switch (element.question_type) {
case 8:
return 'text';
case 9:
return 'radio';
case 10:
return 'checkbox';
default:
return 'radio';
case 8:
return 'text';
case 9:
return 'radio';
case 10:
return 'checkbox';
default:
return 'radio';
}
};
@@ -67,55 +67,55 @@ function handleColNameChange(rowOption: string, colOption: string, e: any) {
// 不同的 question_type 的 matrix 问卷处理不同的结果
switch (element.question_type) {
case 8: {
// 获取输入框元素
const inputElement = e.target as HTMLInputElement;
// 如果没有获取到输入框元素,则直接返回
if (!inputElement) return;
// 将输入框的值保存到 rowRecord 对应位置
rowRecord[col] = e!.target!.value;
// 清空 matrixAnswer 的 answer 属性
matrixAnswer.value.answer = {};
// 遍历所有行选项
element.options[0].forEach((_, rowIndex) => {
// 获取当前行记录
const colOptions = rowRecord[rowIndex];
// 如果当前行有记录,则更新 matrixAnswer 的 answer 属性
if (colOptions) {
matrixAnswer.value.answer[`R${rowIndex + 1}_C${col + 1}`] = colOptions;
}
});
break;
}
case 9:
// 将选择的行索引加1后保存到 rowRecord 对应位置
rowRecord[col] = row + 1;
// 清空 matrixAnswer 的 answer 属性
matrixAnswer.value.answer = {};
// 遍历 rowRecord更新 matrixAnswer 的 answer 属性
rowRecord.forEach((row, index) => {
matrixAnswer.value.answer[`${index + 1}_${row}`] = 1;
});
break;
case 10:
// 将选择的行索引加1后添加到 rowRecord 对应位置的数组中
rowRecord[col] = (rowRecord[col] || []).concat(row + 1);
// 清空 matrixAnswer 的 answer 属性
matrixAnswer.value.answer = {};
// 遍历所有行选项
element.options[0].forEach((rowOption, rowIndex) => {
// 获取当前行记录
const colOptions = rowRecord[rowIndex];
// 如果当前行有记录,则更新 matrixAnswer 的 answer 属性
if (colOptions) {
colOptions.forEach((col: any) => {
matrixAnswer.value.answer[`R${rowIndex + 1}_C${col}`] = true;
});
}
});
break;
default:
break;
case 8: {
// 获取输入框元素
const inputElement = e.target as HTMLInputElement;
// 如果没有获取到输入框元素,则直接返回
if (!inputElement) return;
// 将输入框的值保存到 rowRecord 对应位置
rowRecord[col] = e!.target!.value;
// 清空 matrixAnswer 的 answer 属性
matrixAnswer.value.answer = {};
// 遍历所有行选项
element.options[0].forEach((_, rowIndex) => {
// 获取当前行记录
const colOptions = rowRecord[rowIndex];
// 如果当前行有记录,则更新 matrixAnswer 的 answer 属性
if (colOptions) {
matrixAnswer.value.answer[`R${rowIndex + 1}_C${col + 1}`] = colOptions;
}
});
break;
}
case 9:
// 将选择的行索引加1后保存到 rowRecord 对应位置
rowRecord[col] = row + 1;
// 清空 matrixAnswer 的 answer 属性
matrixAnswer.value.answer = {};
// 遍历 rowRecord更新 matrixAnswer 的 answer 属性
rowRecord.forEach((row, index) => {
matrixAnswer.value.answer[`${index + 1}_${row}`] = 1;
});
break;
case 10:
// 将选择的行索引加1后添加到 rowRecord 对应位置的数组中
rowRecord[col] = (rowRecord[col] || []).concat(row + 1);
// 清空 matrixAnswer 的 answer 属性
matrixAnswer.value.answer = {};
// 遍历所有行选项
element.options[0].forEach((rowOption, rowIndex) => {
// 获取当前行记录
const colOptions = rowRecord[rowIndex];
// 如果当前行有记录,则更新 matrixAnswer 的 answer 属性
if (colOptions) {
colOptions.forEach((col: any) => {
matrixAnswer.value.answer[`R${rowIndex + 1}_C${col}`] = true;
});
}
});
break;
default:
break;
}
}
</script>

View File

@@ -43,7 +43,7 @@ const props = defineProps<{
columns: { option: string; editor?: boolean }[];
questionType: number;
matrixAnswer: { [key: string]: any };
rowRecord: (number | string)[];
rowRecord:(number | string)[];
}>();
/* const emits = */ defineEmits(['update:matrixAnswer', 'update:rowRecord']);

View File

@@ -11,8 +11,7 @@
class="iconfont active-icon"
:style="{ marginRight: isLastPage ? '0' : '16px' }"
@click="activePage"
>&#xe86c;</i
>
>&#xe86c;</i>
<template v-if="!isLastPage">
<i class="iconfont moverQues" style="margin-right: 16px">&#xe71b;</i>
<i class="iconfont" @click="deleteHandle">&#xe6c5;</i>

View File

@@ -9,7 +9,7 @@ import { onMounted, ref } from 'vue';
const contentShow = ref(false);
const show = ref(false);
onMounted(async () => {
onMounted(async() => {
contentShow.value = true;
// if (utils.getSessionStorage('xToken')) {
// const appToken = utils.getParameter('digitalYiliToken');
@@ -43,8 +43,8 @@ function create() {
<Market />
<div class="new_survey">
<van-button type="primary" block color="#70B937" @click="create">
<span class="fw-bold">+</span> 新建问卷</van-button
>
<span class="fw-bold">+</span> 新建问卷
</van-button>
</div>
</div>
<van-popup v-model:show="show" round closeable position="bottom">
@@ -54,7 +54,7 @@ function create() {
<style scoped lang="scss">
.container {
padding: 30px 10px 80px 10px;
padding: 30px 10px 80px;
background: linear-gradient(0deg, #f5f5f5 0%, #f5f5f5 84%, #a5d380 100%);
& > :first-child {
@@ -75,15 +75,16 @@ function create() {
padding: 20px 10px;
}
}
.new_survey {
position: fixed;
left: 0;
bottom: 0;
width: 100vw;
background: #fff;
padding: 12px 11px 28px;
left: 0;
box-sizing: border-box;
width: 100vw;
padding: 12px 11px 28px;
border-radius: 12px;
background: #fff;
}
}
</style>

View File

@@ -90,14 +90,15 @@ onMounted(() => {
.create_survey {
padding: 15px;
color: #000;
.create_survey_title {
font-family:
PingFangSC,
PingFang SC;
margin-bottom: 15px;
color: #000;
font-weight: bold;
font-size: 15px;
color: #000000;
margin-bottom: 15px;
font-family:
PingFangSC,
'PingFang SC';
}
}
@@ -108,12 +109,13 @@ onMounted(() => {
justify-content: space-around;
span {
font-family: PingFangHK, PingFangHK;
font-weight: 400;
font-size: 0.34667rem;
color: #000000;
margin-top: 8px;
margin-bottom: 18px;
color: #000;
font-weight: 400;
font-size: 0.34rem;
//font-family: PingFangHK, PingFangHK;
}
}
</style>

View File

@@ -46,7 +46,7 @@ import { consoleSurveys } from '@/api/home/index.js';
const survey = ref({
project_name: ''
});
const fetchSurveys = async () => {
const fetchSurveys = async() => {
const params = {
page: 1,
per_page: 10,

View File

@@ -20,7 +20,7 @@ const marketList = ref([]);
const active = ref(null);
const marketInfo = ref([]);
const getTableList = async () => {
const getTableList = async() => {
const res = await getListScene();
if (res.data.code === 0) {
res.data.data.forEach((item) => {
@@ -32,7 +32,7 @@ const getTableList = async () => {
getMarketInfo(marketList.value[0]);
}
};
const getMarketInfo = async (item) => {
const getMarketInfo = async(item) => {
const code = marketList.value.filter((market, index) => item === index)[0].code;
const params = {
page: 1,

View File

@@ -28,8 +28,8 @@
</div>
</template>
<script setup lang="ts">
import contentSvg from './svgs/contentSvg.svg';
import MarketItemSvg from './svgs/MarketItemSvg.svg';
// import contentSvg from './svgs/contentSvg.svg';
// import MarketItemSvg from './svgs/MarketItemSvg.svg';
const { info } = defineProps({
info: {
type: Object,

View File

@@ -3,9 +3,7 @@
<div v-for="item in 10" :key="item" class="template">
<img src="https://picsum.photos/131/128" width="110" height="100" alt="" />
<span>报名/签到模板</span>
<span style="color: rgb(127, 127, 127)"
>报名签到 | 引用 {{ item }} | 创建人: {{ '张三' }}</span
>
<span style="color: rgb(127, 127, 127)">报名签到 | 引用 {{ item }} | 创建人: {{ '张三' }}</span>
</div>
</div>
</template>

View File

@@ -6,38 +6,64 @@
</template>
</van-nav-bar>
<van-cell-group inset class="result-cell">
<div>
<div>
<!--问卷标题-->
<contenteditable
v-model="questionInfo.survey.title"
:active="true"
@blur="saveTitle"
></contenteditable>
</div>
<div>
<!-- 问卷标注-->
<contenteditable
v-model="questionInfo.survey.introduction"
:active="true"
@blur="saveTitle"
></contenteditable>
</div>
<van-button v-if="questionInfo.questions.length === 0" size="small" @click="show = true">
添加题目
</van-button>
<div class="question-title flex space-between">
<div class="title-left">
<!--问卷标题-->
<contenteditable
v-model="questionInfo.survey.title"
className="content-title"
:active="true"
@blur="saveTitle"
></contenteditable>
<!-- 问卷标注-->
<contenteditable
v-model="questionInfo.survey.introduction"
className="introduction"
:active="true"
@blur="saveTitle"
></contenteditable>
</div>
</van-cell-group>
<!-- <van-cell-group inset class="result-cell">-->
<!-- <div>-->
<!-- <div>-->
<!-- -->
<!-- </div>-->
<!-- <div>-->
<!-- -->
<!-- </div>-->
<!-- </div>-->
<!-- </van-cell-group>-->
<div class="title-right">图标</div>
</div>
<div class="ques">
<!-- 题目-->
<Design :active-id="activeId" class="design" @get-active-question="getActiveQuestion">
<Design :activeId="activeId" class="design" @get-active-question="getActiveQuestion">
<template #button="{ item }">
<div class="design-button">
<van-button v-if="activeId === item.id" size="small" @click="show = true">
添加题目
<van-button
v-if="activeId === item.id"
size="small"
@click="show = true"
>
+ 添加题目
</van-button>
</div>
</template>
<template #empty>
<div class="empty">
<div>
<img :src="emptyImage" alt="" class="empty-image" />
</div>
<van-button
v-if="questionInfo.questions.length === 0"
class="theme-background"
size="small"
@click="show = true"
>
+ 添加题目
</van-button>
</div>
</template>
@@ -284,6 +310,7 @@
</template>
<script setup lang="ts">
import emptyImage from '@/assets/img/empty.png';
import { ref, computed, onMounted, watch } from 'vue';
import * as Base64 from 'js-base64';
import {
@@ -374,14 +401,14 @@ const questionEvent = (item) => {
options:
item.json.options.length > 0
? item.json.options.map((item) => {
return item.map((it) => {
return {
...it,
// 主键生成
id: uuidv4()
};
});
})
return item.map((it) => {
return {
...it,
// 主键生成
id: uuidv4()
};
});
})
: []
})
);
@@ -514,12 +541,14 @@ const previewQuestion = () => {
router.push({ name: 'preview', query: { ...route.query } });
};
onMounted(async () => {
onMounted(async() => {
await getQuestionDetail();
});
</script>
<style scoped lang="scss">
@import '@/assets/css/theme';
::v-deep .van-nav-bar {
background-color: #70b937;
color: #fff;
@@ -533,6 +562,28 @@ onMounted(async () => {
}
}
.container {
& .question-title {
padding: 0 20px;
background-color: transparent !important;
& .title-left {
color: #fff;
::v-deep .content-title {
margin-top: 5px;
margin-bottom: 5px;
font-size: 18px;
}
}
& .title-right {
margin-right: 50px;
margin-left: 20px;
}
}
}
::v-deep .van-hairline--bottom::after {
display: none;
}
@@ -561,14 +612,6 @@ onMounted(async () => {
flex-direction: column;
align-items: center;
text-align: center;
& > button {
margin: 20px;
//border-radius: 10px;
background-color: #70b936;
color: #fff;
}
}
}
@@ -588,6 +631,45 @@ onMounted(async () => {
.ques {
min-height: 70vh;
.design-button{
text-align: center;
& > button {
padding:0.5rem ;
border-radius: 8px;
background: rgba(240, 248, 235, 1);
color:$theme-color
//opacity: 0.1;
}
}
.empty {
overflow: hidden;
height: 250px;
margin: 10px;
padding: 10px;
border-radius: 8px;
background: #fff;
text-align: center;
& .empty-image{
width: 186px;
height:114px;
margin-top:40px;
}
& > button {
margin-top:40px;
padding:0.5rem ;
border-radius: 5px;
background: rgba(240, 248, 235, 1);
color:$theme-color
//opacity: 0.1;
}
}
.ques_title {
margin: 20px 0 10px 20px;
font-weight: bold;
@@ -596,19 +678,6 @@ onMounted(async () => {
& .design {
padding-bottom: 60px;
& .design-button {
width: 100%;
text-align: center;
::v-deep .van-button {
background-color: #70b936;
//width: 140px;
color: #fff;
font-size: 12px;
}
}
}
.ques_list {

View File

@@ -692,9 +692,9 @@ async function answer(callback, callbackBeforePage) {
question.error = translatedText.value.ThisIsARequiredQuestion;
}
} else if (
answer &&
questionType === 1 &&
Object.keys(answer).findIndex((value) => !answer[value]) !== -1
answer
&& questionType === 1
&& Object.keys(answer).findIndex((value) => !answer[value]) !== -1
) {
// 单选题
isError = true;
@@ -869,47 +869,47 @@ async function answer(callback, callbackBeforePage) {
const { value } = answer;
const newValue = value.replace(/\n|\r|\r\n/g, '');
switch (config.text_type) {
case 3: // 字母
isError =
config.include_mark === 1
? !/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
newValue
) || !newValue.length
: !/^[a-zA-Z]+$/.test(newValue) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterEnglishLetters : '';
break;
case 4: // 中文
isError =
config.include_mark === 1
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
newValue
) || !newValue.length
: !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
newValue
) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterChineseWords : '';
break;
case 3: // 字母
isError
= config.include_mark === 1
? !/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
newValue
) || !newValue.length
: !/^[a-zA-Z]+$/.test(newValue) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterEnglishLetters : '';
break;
case 4: // 中文
isError
= config.include_mark === 1
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
newValue
) || !newValue.length
: !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
newValue
) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterChineseWords : '';
break;
// 邮箱
case 5:
isError =
!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
break;
case 6: // 手机号
isError = !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
question.error = isError ? translatedText.value.PleaseEnterACorrectPhone : '';
break;
case 7: // 身份证号
isError =
!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
break;
default:
break;
case 5:
isError
= !/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
break;
case 6: // 手机号
isError = !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
question.error = isError ? translatedText.value.PleaseEnterACorrectPhone : '';
break;
case 7: // 身份证号
isError
= !/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
break;
default:
break;
}
if (!isError && value.length < config.min && ![1, 2].includes(config.text_type)) {
isError = true;
@@ -921,46 +921,46 @@ async function answer(callback, callbackBeforePage) {
Object.keys(answer).forEach((key) => {
const value = answer[key];
switch (config.text_type) {
case 3: // 字母
isError =
config.include_mark === 1
? !/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
newValue
) || !newValue.length
: !/^[a-zA-Z]+$/.test(newValue) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterEnglishLetters : '';
break;
case 4: // 中文
isError =
config.include_mark === 1
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
newValue
) || !newValue.length
: !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
newValue
) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterChineseWords : '';
break;
case 5: // 邮箱
isError =
!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
break;
case 6: // 手机号
isError = !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
question.error = isError ? translatedText.value.PleaseEnterACorrectPhone : '';
break;
case 7: // 身份证号
isError =
!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
break;
default:
break;
case 3: // 字母
isError
= config.include_mark === 1
? !/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
newValue
) || !newValue.length
: !/^[a-zA-Z]+$/.test(newValue) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterEnglishLetters : '';
break;
case 4: // 中文
isError
= config.include_mark === 1
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
newValue
) || !newValue.length
: !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
newValue
) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterChineseWords : '';
break;
case 5: // 邮箱
isError
= !/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
break;
case 6: // 手机号
isError = !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
question.error = isError ? translatedText.value.PleaseEnterACorrectPhone : '';
break;
case 7: // 身份证号
isError
= !/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
break;
default:
break;
}
if (!isError && value.length < config.min && ![1, 2].includes(config.text_type)) {
isError = true;
@@ -1037,14 +1037,14 @@ async function answer(callback, callbackBeforePage) {
currentQuestions.forEach((question, index) => {
if (index >= warnStart && index < warnEnd) {
if (repeat.repeat_type) {
question.warning =
translatedText.value.TheAnswerIsRepeatedMoreThanOneTimesPleaseRevise(
question.warning
= translatedText.value.TheAnswerIsRepeatedMoreThanOneTimesPleaseRevise(
repeat.allow_repeat_num,
repeat.repeat_type
);
} else {
question.error =
translatedText.value.TheAnswerIsRepeatedMoreThanOneTimesPleaseRevise(
question.error
= translatedText.value.TheAnswerIsRepeatedMoreThanOneTimesPleaseRevise(
repeat.allow_repeat_num,
repeat.repeat_type
);
@@ -1234,8 +1234,8 @@ function updateAnswer(auto) {
const evt1 = {};
if ([1].includes(question.question_type)) {
evt1.value =
Object.keys(question.answer)
evt1.value
= Object.keys(question.answer)
.map((key) => (question.answer[key] ? key : undefined))
.filter((i) => !!i)?.[0] || undefined;
evt1.options = question.list.flatMap((i) => i.options);

View File

@@ -227,8 +227,8 @@ export default defineComponent({
.map((option) => {
return this.wares.find(
(ware) =>
ware.question_index === option.question_index &&
ware.option_index === option.option_index
ware.question_index === option.question_index
&& ware.option_index === option.option_index
);
});
wares = wares.filter((x) => x);

View File

@@ -144,7 +144,7 @@ export default {
methods: {
debounce(func, wait) {
let timeout;
return function (...args) {
return function(...args) {
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(this, args), wait);
};

View File

@@ -102,37 +102,37 @@ export default defineComponent({
const isEndUrl = computed(() => {
const code = props.action ? props.action.code : props.code;
return (
(code === 20004 &&
props.survey.screening_end_url_select &&
props.survey.screening_end_url) ||
(code === 20011 && props.survey.success_end_url_select && props.survey.success_end_url) ||
(code === 20016 && props.survey.quota_end_url_select && props.survey.quota_end_url)
(code === 20004
&& props.survey.screening_end_url_select
&& props.survey.screening_end_url)
|| (code === 20011 && props.survey.success_end_url_select && props.survey.success_end_url)
|| (code === 20016 && props.survey.quota_end_url_select && props.survey.quota_end_url)
);
});
// 跳转
function toEndUrl() {
switch (props.action.code) {
case 20004: // 被甄别
if (props.survey.screening_end_url_select && props.survey.screening_end_url) {
const url = props.survey.screening_end_url;
toUrl(url);
}
break;
case 20011: // 成功
if (props.survey.success_end_url_select && props.survey.success_end_url) {
const url = props.survey.success_end_url;
toUrl(url);
}
break;
case 20016: // 配额超限
if (props.survey.quota_end_url_select && props.survey.quota_end_url) {
const url = props.survey.quota_end_url;
toUrl(url);
}
break;
default:
break;
case 20004: // 被甄别
if (props.survey.screening_end_url_select && props.survey.screening_end_url) {
const url = props.survey.screening_end_url;
toUrl(url);
}
break;
case 20011: // 成功
if (props.survey.success_end_url_select && props.survey.success_end_url) {
const url = props.survey.success_end_url;
toUrl(url);
}
break;
case 20016: // 配额超限
if (props.survey.quota_end_url_select && props.survey.quota_end_url) {
const url = props.survey.quota_end_url;
toUrl(url);
}
break;
default:
break;
}
}

View File

@@ -264,16 +264,16 @@ export default defineComponent({
});
if (
!compareArrayByField(options.value, newOptions, 'option_key') ||
!compareArrayByField(options.value, newOptions, 'option')
!compareArrayByField(options.value, newOptions, 'option_key')
|| !compareArrayByField(options.value, newOptions, 'option')
) {
options.value = newOptions;
}
// 清空值和答案
if (
value.value &&
options.value.findIndex((option) => option.option_key === value.value) === -1
value.value
&& options.value.findIndex((option) => option.option_key === value.value) === -1
) {
// 清空值
value.value = '';
@@ -291,8 +291,8 @@ export default defineComponent({
() => options.value,
(val, oldVal) => {
if (
compareArrayByField(val, oldVal || [], 'option_key') &&
compareArrayByField(val, oldVal || [], 'option')
compareArrayByField(val, oldVal || [], 'option_key')
&& compareArrayByField(val, oldVal || [], 'option')
) {
return;
}

View File

@@ -132,8 +132,8 @@ export default defineComponent({
const value = matchValue.replace('[%cite(', '').replace(')%]', '');
let replacement = ''; // 替换文本
// 查找引用问题
const question =
props.questions.find((question) => {
const question
= props.questions.find((question) => {
// 矩阵题
if (question.question_type >= 8 && question.question_type <= 11) {
return question.title === value.split('_R')[0].split('_C')[0];
@@ -143,8 +143,8 @@ export default defineComponent({
return question.title === value.split('_A')[0];
}
return question.title === value;
}) ||
props.questions.find((question) => {
})
|| props.questions.find((question) => {
// 矩阵题
if (question.question_type >= 8 && question.question_type <= 11) {
return question.title === (value + cycleIndexStr).split('_R')[0].split('_C')[0];
@@ -171,8 +171,8 @@ export default defineComponent({
replacement = answer[option.option_key];
}
} else if (
question.question_type === 2 &&
Object.keys(answer).length >= question.config.min_select
question.question_type === 2
&& Object.keys(answer).length >= question.config.min_select
) {
// 查找引用选项(多选)
options.forEach((option) => {

View File

@@ -350,7 +350,7 @@ export const language = {
zh: '请点击查看图片'
},
NoteCantViewAfterTimeLimit: {
en: "Note: Can't view after time limit",
en: 'Note: Can\'t view after time limit',
zh: '注意:超过显示时间限制后将无法再次查看'
},
DisplayTimeLimitExceeded: {

View File

@@ -250,10 +250,10 @@ function quesHandle(answer, logChild) {
const matrixRateHandle = () => {
// 如果配置的逻辑中参数为空,则代表没有配置逻辑匹配值,此时不做校验
if (
logChild.cell_index === 0 ||
logChild.row_index === 0 ||
!logChild.operator ||
!logChild.value
logChild.cell_index === 0
|| logChild.row_index === 0
|| !logChild.operator
|| !logChild.value
) {
return true;
}
@@ -265,10 +265,10 @@ function quesHandle(answer, logChild) {
const matrixInputHandle = () => {
// 如果配置的逻辑中参数为空,则代表没有配置逻辑匹配值,此时不做校验
if (
logChild.cell_index === 0 ||
logChild.row_index === 0 ||
!logChild.operator ||
!logChild.value
logChild.cell_index === 0
|| logChild.row_index === 0
|| !logChild.operator
|| !logChild.value
) {
return true;
}
@@ -428,59 +428,59 @@ function getConditionStatus(logChild) {
if (answer) {
try {
switch (logChild.question_type) {
case 1:
quesStatus = quesHandles.choiceHandle(config);
break;
case 2:
quesStatus = quesHandles.choiceCheckBoxHandle(config);
break;
case 3:
quesStatus = quesHandles.cascaderHandle();
break;
case 4:
quesStatus = quesHandles.inputHandle();
break;
case 5:
quesStatus = quesHandles.rateHandle();
break;
case 7:
quesStatus = quesHandles.dateTimeHandle();
break;
case 8:
quesStatus = quesHandles.matrixInputHandle();
break;
case 9:
quesStatus = quesHandles.matrixRadioHandle(config);
break;
case 10:
quesStatus = quesHandles.matrixCheckboxHandle(config);
break;
case 11:
quesStatus = quesHandles.matrixRateHandle();
break;
case 13:
quesStatus = quesHandles.imgRadioHandle();
break;
case 14:
quesStatus = quesHandles.imgCheckBoxHandle();
break;
case 15:
quesStatus = quesHandles.classifyHandle();
break;
case 16:
quesStatus = quesHandles.sortHandle();
break;
case 17:
quesStatus = quesHandles.constantSumHandle();
break;
case 23:
quesStatus = quesHandles.agreementHandle();
break;
case 101:
quesStatus = quesHandles.psmHandle(config);
break;
default:
break;
case 1:
quesStatus = quesHandles.choiceHandle(config);
break;
case 2:
quesStatus = quesHandles.choiceCheckBoxHandle(config);
break;
case 3:
quesStatus = quesHandles.cascaderHandle();
break;
case 4:
quesStatus = quesHandles.inputHandle();
break;
case 5:
quesStatus = quesHandles.rateHandle();
break;
case 7:
quesStatus = quesHandles.dateTimeHandle();
break;
case 8:
quesStatus = quesHandles.matrixInputHandle();
break;
case 9:
quesStatus = quesHandles.matrixRadioHandle(config);
break;
case 10:
quesStatus = quesHandles.matrixCheckboxHandle(config);
break;
case 11:
quesStatus = quesHandles.matrixRateHandle();
break;
case 13:
quesStatus = quesHandles.imgRadioHandle();
break;
case 14:
quesStatus = quesHandles.imgCheckBoxHandle();
break;
case 15:
quesStatus = quesHandles.classifyHandle();
break;
case 16:
quesStatus = quesHandles.sortHandle();
break;
case 17:
quesStatus = quesHandles.constantSumHandle();
break;
case 23:
quesStatus = quesHandles.agreementHandle();
break;
case 101:
quesStatus = quesHandles.psmHandle(config);
break;
default:
break;
}
} catch (error) {
// console.log(error);
@@ -519,10 +519,10 @@ function getlogicStatus(questionData) {
// } else {
// statusStr = statusStr + conditionStatus;
// }
statusStr =
statusStr +
(logChild.logic === 'and' ? '&&' : logChild.logic === 'or' ? '||' : '') +
conditionStatus;
statusStr
= statusStr
+ (logChild.logic === 'and' ? '&&' : logChild.logic === 'or' ? '||' : '')
+ conditionStatus;
});
// eslint-disable-next-line no-eval
logs.logicStatus = eval(statusStr);

View File

@@ -105,8 +105,8 @@ export default function answerMock(questionsData, page) {
} else if (logic.skip_type === 4) {
// 只计算跳转后所在页面的隐藏逻辑,否则会出现只返回最后一道隐藏选项题目的情况,导致失效
const toPage = page + 1;
const hasHiddenLogicQuizPage =
data.pages.findIndex((page) => page.includes(logic.question_index)) + 1;
const hasHiddenLogicQuizPage
= data.pages.findIndex((page) => page.includes(logic.question_index)) + 1;
if (hasHiddenLogicQuizPage === toPage) {
// 选项隐藏逻辑
updateOptionHidden(data.hide_options, logic);

View File

@@ -154,9 +154,9 @@ export default defineComponent({
question.error = translatedText.value.ThisIsARequiredQuestion;
}
} else if (
answer &&
questionType === 1 &&
Object.keys(answer).findIndex((value) => !answer[value]) !== -1
answer
&& questionType === 1
&& Object.keys(answer).findIndex((value) => !answer[value]) !== -1
) {
// 单选题
isError = true;
@@ -302,9 +302,9 @@ export default defineComponent({
} else if (answer && questionType === 12) {
question.error = '';
} else if (
answer &&
questionType === 14 &&
Object.keys(answer).length < config.min_select
answer
&& questionType === 14
&& Object.keys(answer).length < config.min_select
) {
// 图片多选题
isError = true;
@@ -340,46 +340,46 @@ export default defineComponent({
const { value } = answer;
const newValue = value.replace(/\n|\r|\r\n/g, '');
switch (config.text_type) {
case 3: // 字母
isError =
config.include_mark === 1
? !/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
newValue
) || !newValue.length
: !/^[a-zA-Z]+$/.test(newValue) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterEnglishLetters : '';
break;
case 4: // 中文
isError =
config.include_mark === 1
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
newValue
) || !newValue.length
: !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
newValue
) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterChineseWords : '';
break;
case 5: // 邮箱
isError =
!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
break;
case 6: // 手机号
isError = !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
question.error = isError ? translatedText.value.PleaseEnterACorrectPhone : '';
break;
case 7: // 身份证号
isError =
!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
break;
default:
break;
case 3: // 字母
isError
= config.include_mark === 1
? !/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
newValue
) || !newValue.length
: !/^[a-zA-Z]+$/.test(newValue) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterEnglishLetters : '';
break;
case 4: // 中文
isError
= config.include_mark === 1
? !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
newValue
) || !newValue.length
: !/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/.test(
newValue
) || !newValue.length;
question.error = isError ? translatedText.value.PleaseEnterChineseWords : '';
break;
case 5: // 邮箱
isError
= !/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectEmail : '';
break;
case 6: // 手机号
isError = !/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value);
question.error = isError ? translatedText.value.PleaseEnterACorrectPhone : '';
break;
case 7: // 身份证号
isError
= !/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
);
question.error = isError ? translatedText.value.PleaseEnterACorrectID : '';
break;
default:
break;
}
if (!isError && value.length < config.min && ![1, 2].includes(config.text_type)) {
isError = true;
@@ -391,54 +391,54 @@ export default defineComponent({
Object.keys(answer).forEach((key) => {
const value = answer[key];
switch (config.text_type) {
case 3: // 字母
if (
!/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterEnglishLetters;
}
break;
case 4: // 中文
if (
!/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterChineseWords;
}
break;
case 5: // 邮箱
if (
!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterACorrectEmail;
}
break;
case 6: // 手机号
if (!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value)) {
question.error = translatedText.value.PleaseEnterACorrectPhone;
}
break;
case 7: // 身份证号
if (
!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterACorrectID;
}
break;
default:
break;
case 3: // 字母
if (
!/^[a-zA-Z·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]]+$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterEnglishLetters;
}
break;
case 4: // 中文
if (
!/^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|[·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]])+$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterChineseWords;
}
break;
case 5: // 邮箱
if (
!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterACorrectEmail;
}
break;
case 6: // 手机号
if (!/^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(value)) {
question.error = translatedText.value.PleaseEnterACorrectPhone;
}
break;
case 7: // 身份证号
if (
!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/.test(
value
)
) {
question.error = translatedText.value.PleaseEnterACorrectID;
}
break;
default:
break;
}
if (
!question.error &&
value.length < config.min &&
![1, 2].includes(config.text_type)
!question.error
&& value.length < config.min
&& ![1, 2].includes(config.text_type)
) {
question.error = translatedText.value.PleaseEnterMoreThanOneCharacters(config.min);
}
@@ -814,8 +814,8 @@ export default defineComponent({
const evt1 = {};
if ([1].includes(question.question_type)) {
evt1.value =
Object.keys(question.answer)
evt1.value
= Object.keys(question.answer)
.map((key) => (question.answer[key] ? key : undefined))
.filter((i) => !!i)?.[0] || undefined;
evt1.options = question.list.flatMap((i) => i.options);

View File

@@ -5,9 +5,11 @@
<!-- <van-cell-group v-if="status === 1" inset style="padding-top: 15px"> -->
<van-cell-group inset style="padding-top: 15px">
<div>
<img width="100%"
<img
width="100%"
src="https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u14.jpg?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333"
alt="" />
alt=""
/>
</div>
<div class="qrcode">
<img :src="publishInfo.img_url" alt="" width="100px" height="100px" />
@@ -108,9 +110,9 @@ type OperateItem = (typeof operateList)[0];
// }
// }
function getCode () {
publishInfo.value.img_url =
'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
function getCode() {
publishInfo.value.img_url
= 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
publishInfo.value.url = `${configUrl.proxyDomain}/publish?sn=${sn && sn !== undefined ? sn : ''}`;
publishInfo.value.download_url = {
title: '问卷下载',
@@ -140,27 +142,27 @@ watch(status, (val) => {
getCode();
}
});
onMounted(async () => {
onMounted(async() => {
// fetchInfo();
getCode();
});
const operateBtn = (item: OperateItem) => {
switch (item.type) {
case 'shareLink':
shareLink();
break;
case 'copyLink':
copyLink();
break;
case 'qrCode':
downLoadImg();
break;
default:
break;
case 'shareLink':
shareLink();
break;
case 'copyLink':
copyLink();
break;
case 'qrCode':
downLoadImg();
break;
default:
break;
}
};
// 复制链接
function copyLink () {
function copyLink() {
const input = document.createElement('input');
input.value = publishInfo.value.url;
document.body.appendChild(input);
@@ -170,7 +172,7 @@ function copyLink () {
showToast('复制成功');
}
// 分享链接
function shareLink () {
function shareLink() {
const params = {
type: 'shareToWx',
title: publishInfo.value.download_url.title,
@@ -180,11 +182,11 @@ function shareLink () {
scene: 0 // 朋友圈1 微信好友0
};
console.log('shareUrl', publishInfo.value.url);
appBridge.shareToWeChat(params, () => { });
appBridge.shareToWeChat(params);
}
// 下载二维码
function downLoadImg () {
function downLoadImg() {
const { title, url } = publishInfo.value.download_url;
if (utils.getSessionStorage('xToken')) {
appBridge.save2Album(url, () => {

View File

@@ -6,8 +6,8 @@
</template>
<script setup>
const successImg =
'https://files.axshare.com/gsc/DR6075/c7/5a/53/c75a534148d349f1bb8e185629f784ac/images/%E9%A2%84%E8%A7%88/u123.png?pageId=18fb9d8a-b9b7-465f-9bd7-625b1b78f72e';
const successImg
= 'https://files.axshare.com/gsc/DR6075/c7/5a/53/c75a534148d349f1bb8e185629f784ac/images/%E9%A2%84%E8%A7%88/u123.png?pageId=18fb9d8a-b9b7-465f-9bd7-625b1b78f72e';
</script>
<style lang="scss" scoped>