jufubao-forms 1.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/commands.js +84 -0
- package/commands.update.change.js +176 -0
- package/file.config.js +16 -0
- package/get.package.path.js +22 -0
- package/get.package.path.js.tpl +22 -0
- package/package.json +119 -0
- package/src/CreateClientID.js +16 -0
- package/src/ICONS.js +1148 -0
- package/src/common/authorize.js +261 -0
- package/src/common/getBusinessImageUrl.js +39 -0
- package/src/common/getServiceUrl.js +38 -0
- package/src/common/paysdk/jweixin.js +98 -0
- package/src/components/CusCouponChose/CusCouponChose.vue +1024 -0
- package/src/components/CusCouponItem/CusCouponItem.vue +298 -0
- package/src/components/CusEnter/CusEnter.vue +333 -0
- package/src/components/CusPoster/CusPoster.vue +213 -0
- package/src/components/CusPoster/CusSwiperDot.vue +234 -0
- package/src/components/CusProduct/CusProduct.vue +362 -0
- package/src/components/CusSwiperDot/CusSwiperDot.vue +234 -0
- package/src/components/CusTab/CusTab.vue +411 -0
- package/src/components/CusVideo/CusVideo.vue +170 -0
- package/src/components/JfbFormsDynamicForm/Api.js +66 -0
- package/src/components/JfbFormsDynamicForm/Attr.js +35 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicForm.vue +767 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicFormLess.less +79 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicFormMixin.js +30 -0
- package/src/components/JfbFormsDynamicForm/Mock.js +194 -0
- package/src/components/JfbFormsDynamicForm/XdFormDate.vue +71 -0
- package/src/components/JfbFormsDynamicForm/ld-select/ld-select.vue +329 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/calendar-item.vue +177 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/calendar.vue +930 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/en.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/index.js +8 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/time-picker.vue +934 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/uni-datetime-picker.vue +1042 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/util.js +403 -0
- package/src/components/JfbFormsList/Api.js +20 -0
- package/src/components/JfbFormsList/Attr.js +70 -0
- package/src/components/JfbFormsList/JfbFormsList.vue +228 -0
- package/src/components/JfbFormsList/JfbFormsListLess.less +79 -0
- package/src/components/JfbFormsList/JfbFormsListMixin.js +30 -0
- package/src/components/JfbFormsList/Mock.js +38 -0
- package/src/components/JfbFormsQuestionAndAnswer/Api.js +43 -0
- package/src/components/JfbFormsQuestionAndAnswer/Attr.js +14 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswer.vue +506 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswerLess.less +79 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswerMixin.js +30 -0
- package/src/components/JfbFormsQuestionAndAnswer/Mock.js +144 -0
- package/src/components/SkeProduct/SkeProduct.vue +241 -0
- package/src/config.app.plus.js +6 -0
- package/src/config.h5.js +13 -0
- package/src/config.mp.weixin.js +13 -0
- package/src/config.project.js +15 -0
- package/src/mixins/cardListMixins.js +187 -0
- package/src/mixins/colorCardMixins.js +122 -0
- package/src/mixins/componentsMixins.js +900 -0
- package/src/mixins/extsMixins.js +3 -0
- package/src/mixins/locationMixins.js +119 -0
- package/src/mixins/newLocaltionMixins.js +754 -0
- package/src/mixins/openDebuggerMixins.js +74 -0
- package/src/mixins/pageEditx.js +347 -0
- package/src/mixins/pageEvent.js +311 -0
- package/src/mixins/pageMain.js +120 -0
- package/src/mixins/pageUitls.js +738 -0
- package/src/mixins/posterMixins.js +122 -0
- package/src/mixins/scrollListFixedHeigthMixins.js +174 -0
- package/src/mocks.js +4 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc 获取绝对路径完整地址
|
|
3
|
+
* @param @path
|
|
4
|
+
**/
|
|
5
|
+
//例如:https://image.jufubao.cn/20220501010108/image/bg/default_gonghui_bg.png
|
|
6
|
+
@basePath: 'business/';
|
|
7
|
+
@doMain: '//sandbox-img.jufubao.cn/';
|
|
8
|
+
|
|
9
|
+
.getBusinessImageUrl(@path, @size: 'size8') {
|
|
10
|
+
@url: "@{doMain}@{basePath}@{path}?x-oss-process=style/@{size}";
|
|
11
|
+
background-image: url(@url);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//start
|
|
15
|
+
.jfb-forms-list {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
|
|
18
|
+
&__body{
|
|
19
|
+
position: relative;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
z-index: 2
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.editx,&.editx:hover {
|
|
25
|
+
position: relative;
|
|
26
|
+
min-height: unit(100, rpx);
|
|
27
|
+
z-index: 3;
|
|
28
|
+
&::after {
|
|
29
|
+
border: 2rpx dashed blue;
|
|
30
|
+
content: " ";
|
|
31
|
+
position: absolute;
|
|
32
|
+
top:0;
|
|
33
|
+
left:0;
|
|
34
|
+
bottom:0;
|
|
35
|
+
right:0;
|
|
36
|
+
z-index: var(--preview-z-index);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
&__edit {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
position: absolute;
|
|
46
|
+
right: unit(0, rpx);
|
|
47
|
+
top: unit(-52, rpx);
|
|
48
|
+
height: unit(50, rpx);
|
|
49
|
+
line-height: unit(50, rpx);
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
background: rgba(0, 0, 0, .6);
|
|
54
|
+
border-radius: unit(10, rpx);
|
|
55
|
+
box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
|
|
56
|
+
color: #fff;
|
|
57
|
+
font-size: unit(22, rpx);
|
|
58
|
+
|
|
59
|
+
&-icon{
|
|
60
|
+
padding: 0 unit(20, rpx);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.editx {
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**notPreview**/
|
|
73
|
+
.jfb-forms-list {
|
|
74
|
+
//&:before {
|
|
75
|
+
//content: " ";
|
|
76
|
+
//display: table;
|
|
77
|
+
//}
|
|
78
|
+
}
|
|
79
|
+
/**endNotPreview**/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
//@AttrImport
|
|
5
|
+
import Attr from "./Attr";
|
|
6
|
+
//@EndAttrImport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
//#ifdef H5
|
|
13
|
+
|
|
14
|
+
//@AttrData
|
|
15
|
+
Attr:{}, //对外开发编辑属性
|
|
16
|
+
//@EndAttrData
|
|
17
|
+
|
|
18
|
+
// #endif
|
|
19
|
+
cssRoot: 'jfb-forms-list'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
created() {
|
|
23
|
+
|
|
24
|
+
//@AttrDataCreated
|
|
25
|
+
this.Attr = this.$xdUniHelper.customClone(Attr);
|
|
26
|
+
//@EndAttrDataCreated
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
getSaasFormList: {
|
|
5
|
+
total_size: 1,
|
|
6
|
+
next_page_token: "",
|
|
7
|
+
list: [
|
|
8
|
+
{
|
|
9
|
+
form_id: 33,
|
|
10
|
+
form_name: "员工调研",
|
|
11
|
+
cover: "/uploads/20240905/3b599a80e11de676fca13db5cf1bd369.png",
|
|
12
|
+
status: "Ok",
|
|
13
|
+
tip: "",
|
|
14
|
+
start_time: 1725292800,
|
|
15
|
+
end_time: 1729526400
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
form_id: 34,
|
|
19
|
+
form_name: "员工调研2",
|
|
20
|
+
cover: "/uploads/20240905/3b599a80e11de676fca13db5cf1bd369.png",
|
|
21
|
+
status: "Ok",
|
|
22
|
+
tip: "",
|
|
23
|
+
start_time: 1725292800,
|
|
24
|
+
end_time: 1729526400
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
form_id: 34,
|
|
28
|
+
form_name: "员工调研3",
|
|
29
|
+
cover: "/uploads/20240905/3b599a80e11de676fca13db5cf1bd369.png",
|
|
30
|
+
status: "Ok",
|
|
31
|
+
tip: "",
|
|
32
|
+
start_time: 1725292800,
|
|
33
|
+
end_time: 1729526400
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
request_id: "db8a06d15c6bf2a2"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @description 接口配置,
|
|
4
|
+
* 在设置方法名字当时候,别忘记加上【模块名字】:Question
|
|
5
|
+
* @type {*[]}
|
|
6
|
+
*/
|
|
7
|
+
module.exports = [
|
|
8
|
+
{
|
|
9
|
+
mapFnName: "getDynamicForm",
|
|
10
|
+
title: '动态表单内容 - 获取',
|
|
11
|
+
path: '/forms/v1/sms-form-field/field-by-form-id',
|
|
12
|
+
isRule: false,
|
|
13
|
+
params: {
|
|
14
|
+
form_id: ['表单ID', 'Number', '必选'],
|
|
15
|
+
},
|
|
16
|
+
isConsole: true,
|
|
17
|
+
disabled: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
mapFnName: 'submitDynamicForm',
|
|
21
|
+
title: '动态表单内容 - 提交',
|
|
22
|
+
path: '/forms/v1/sms-form-content',
|
|
23
|
+
isRule: false,
|
|
24
|
+
data: {
|
|
25
|
+
form_id: ['表单ID', 'Number', '必选'],
|
|
26
|
+
contents: ['内容', 'array[object(FrontSmsFormContent)]', '必选'],
|
|
27
|
+
},
|
|
28
|
+
isConsole: true,
|
|
29
|
+
disabled: true,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
mapFnName: "checkValidCode",
|
|
33
|
+
title: "图片验证码 - 校验",
|
|
34
|
+
path: "/common/v1/valid_code/image/check",
|
|
35
|
+
isRule: false,
|
|
36
|
+
data: {
|
|
37
|
+
token: ['随机请求码,前端生成', 'String', '必选'],
|
|
38
|
+
valid_code: ['验证码', 'String', '必选'],
|
|
39
|
+
},
|
|
40
|
+
isConsole: true,
|
|
41
|
+
disabled: true,
|
|
42
|
+
}
|
|
43
|
+
];
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="jfb-forms-question-and-answer"
|
|
4
|
+
@click="handleEditxSelect"
|
|
5
|
+
:class="{ editx : isEditx && active }"
|
|
6
|
+
>
|
|
7
|
+
<!--#ifdef H5-->
|
|
8
|
+
<view
|
|
9
|
+
class="jfb-forms-question-and-answer__edit"
|
|
10
|
+
:class="{ editx : isEditx && active }"
|
|
11
|
+
v-if="isEditx && active"
|
|
12
|
+
>
|
|
13
|
+
<view class="jfb-forms-question-and-answer__edit-icon" @click="delEdit">删除</view>
|
|
14
|
+
</view>
|
|
15
|
+
<!-- #endif -->
|
|
16
|
+
<view class="jfb-forms-question-and-answer__body" :style="{
|
|
17
|
+
'--main-color': mainColor,
|
|
18
|
+
'--main-color-alpha': mainColorAlpha,
|
|
19
|
+
}">
|
|
20
|
+
<view v-if="loaded">
|
|
21
|
+
<view v-if="form_status === 'content'">
|
|
22
|
+
<view style="background: #FFFFFF;">
|
|
23
|
+
<view class="qa_title">{{ formName }}</view>
|
|
24
|
+
<view class="qa_progress">
|
|
25
|
+
<view class="progress_text">{{curIndex+1}}/{{ formList.length }}</view>
|
|
26
|
+
<view class="qa_progress_bar">
|
|
27
|
+
<view class="qa_progress_bar_inner" :style="[progressBarInnerStyle]"></view>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
<view v-if="curQA" class="qa_content">
|
|
31
|
+
<view class="qa_type">【{{qaType}}】</view>
|
|
32
|
+
<view class="qa_question">{{ curIndex+1 }}.{{ curQA.field_name }}</view>
|
|
33
|
+
<view class="qa_answer">
|
|
34
|
+
<view class="answer_column" v-for="o in curQA.options" :key="o.value"
|
|
35
|
+
@click="handleCheck(o.value)"
|
|
36
|
+
>
|
|
37
|
+
<xd-radio v-if="curQA.field_type==='radio'"
|
|
38
|
+
:value="qaValue==o.value" :isClickEvent="false" :iconSize="20"></xd-radio>
|
|
39
|
+
<xd-radio v-if="curQA.field_type==='checkbox'" class="qa_checkbox"
|
|
40
|
+
:value="qaValue.includes(o.value)" :isClickEvent="false" :iconSize="20"></xd-radio>
|
|
41
|
+
<view>{{ o.label }}</view>
|
|
42
|
+
</view>
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
<view v-if="qaResult" class="qa_result">
|
|
47
|
+
<view class="result_status" v-if="qaResult.right">
|
|
48
|
+
<xd-font-icon class="icon_font" icon="iconzan_mian"></xd-font-icon> 恭喜您,回答正确!</view>
|
|
49
|
+
<template v-else>
|
|
50
|
+
<view class="result_status error">
|
|
51
|
+
<xd-font-icon class="icon_font" icon="iconmingchengtubiao"></xd-font-icon> 回答有误,再接再厉哦!</view>
|
|
52
|
+
<view class="ans_right">正确选项: {{ qaResult.answer }}</view>
|
|
53
|
+
|
|
54
|
+
<view>
|
|
55
|
+
<view>答案解析:</view>
|
|
56
|
+
<view class="ans_explain">{{ qaResult.explain }}</view>
|
|
57
|
+
</view>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
</view>
|
|
61
|
+
<view class="bottom_fixed">
|
|
62
|
+
<xd-button type="primary" :disabled="curIndex === 0"
|
|
63
|
+
:style="[fixedButtonStyle]" @click="handlePrev">上一题</xd-button>
|
|
64
|
+
<xd-button type="primary" :disabled="curQA.required && (!qaValue || qaValue.length === 0)"
|
|
65
|
+
:style="[fixedButtonStyle]" @click="handleNext">{{isLastQA ? '确认提交':'下一题'}}</xd-button>
|
|
66
|
+
</view>
|
|
67
|
+
</view>
|
|
68
|
+
<view v-if="form_status === 'success'" class="form_status form_success">
|
|
69
|
+
<xd-font-icon icon="iconchenggong" color="#06bc85" :size="64"></xd-font-icon>
|
|
70
|
+
<view class="status_tip">您已成功提交</view>
|
|
71
|
+
<view class="status_name">{{ formName }}</view>
|
|
72
|
+
<view class="status_btn_wrap">
|
|
73
|
+
<view class="status_btn">关闭</view>
|
|
74
|
+
<view class="status_btn" v-if="marketToolText"
|
|
75
|
+
style="background:#FE7A63;"
|
|
76
|
+
@click="handleMarketToolBtn"
|
|
77
|
+
>{{ marketToolText }}</view>
|
|
78
|
+
</view>
|
|
79
|
+
</view>
|
|
80
|
+
</view>
|
|
81
|
+
|
|
82
|
+
</view>
|
|
83
|
+
</view>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script>
|
|
87
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
88
|
+
import XdFormCheckbox from "@/components/XdFormCheckbox/XdFormCheckbox"
|
|
89
|
+
import XdButton from "@/components/XdButton/XdButton";
|
|
90
|
+
import XdRadio from "@/components/XdRadio/XdRadio"
|
|
91
|
+
import { jfbRootExec } from "@/utils/xd.event";
|
|
92
|
+
import JfbFormsQuestionAndAnswerMixin from "./JfbFormsQuestionAndAnswerMixin";
|
|
93
|
+
import { getContainerPropsValue } from "@/utils/xd.base";
|
|
94
|
+
import componentsMixins from "@/mixins/componentsMixins";
|
|
95
|
+
import extsMixins from "@/mixins/extsMixins";
|
|
96
|
+
import Color from "color"
|
|
97
|
+
export default {
|
|
98
|
+
name: "JfbFormsQuestionAndAnswer",
|
|
99
|
+
components: {
|
|
100
|
+
XdFontIcon,
|
|
101
|
+
XdFormCheckbox,
|
|
102
|
+
XdRadio,
|
|
103
|
+
XdButton,
|
|
104
|
+
},
|
|
105
|
+
mixins: [
|
|
106
|
+
componentsMixins, extsMixins, JfbFormsQuestionAndAnswerMixin
|
|
107
|
+
],
|
|
108
|
+
data() {
|
|
109
|
+
return {
|
|
110
|
+
form_id: '',
|
|
111
|
+
loaded: false,
|
|
112
|
+
isPreview: false,
|
|
113
|
+
form_status: "content",
|
|
114
|
+
formName: "",
|
|
115
|
+
marketing_tool: "",
|
|
116
|
+
activity_page_url: "",
|
|
117
|
+
activity_id: "",
|
|
118
|
+
|
|
119
|
+
value: [],
|
|
120
|
+
qaValue: "",
|
|
121
|
+
|
|
122
|
+
mainColorAlpha: "",
|
|
123
|
+
formList: [],
|
|
124
|
+
|
|
125
|
+
curIndex: 0,
|
|
126
|
+
//todo
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
computed: {
|
|
130
|
+
progressBarInnerStyle(){
|
|
131
|
+
let width = ((this.curIndex + 1) / this.formList.length) * 100 + '%';
|
|
132
|
+
return {
|
|
133
|
+
width: width
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
curQA(){
|
|
137
|
+
return this.formList[this.curIndex];
|
|
138
|
+
},
|
|
139
|
+
isLastQA(){
|
|
140
|
+
return this.curIndex === (this.formList.length - 1);
|
|
141
|
+
},
|
|
142
|
+
qaType(){
|
|
143
|
+
let types = {radio: '单选', checkbox: '多选'};
|
|
144
|
+
return types[this.curQA.field_type];
|
|
145
|
+
},
|
|
146
|
+
qaResult(){
|
|
147
|
+
if(!this.curQA) return null;
|
|
148
|
+
//是否需要校验
|
|
149
|
+
let is_verify_answer = this.curQA.is_verify_answer;
|
|
150
|
+
if(is_verify_answer === "N") return null;
|
|
151
|
+
|
|
152
|
+
let result = this.curQA.value;
|
|
153
|
+
if(result && result.length > 0){
|
|
154
|
+
let answer = this.curQA.answer;
|
|
155
|
+
let isRight = false;
|
|
156
|
+
|
|
157
|
+
if(this.curQA.field_type === 'radio'){
|
|
158
|
+
isRight = result === answer[0]; //答案正确
|
|
159
|
+
}else if(this.curQA.field_type === 'checkbox'){
|
|
160
|
+
isRight = this.isSameArray(result, answer);
|
|
161
|
+
}
|
|
162
|
+
if(isRight) return {right: true};
|
|
163
|
+
else {
|
|
164
|
+
return {
|
|
165
|
+
right: false,
|
|
166
|
+
answer: answer,
|
|
167
|
+
explain: this.curQA.answer_analysis,
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
},
|
|
173
|
+
marketToolText(){
|
|
174
|
+
let toolText = {
|
|
175
|
+
prize: '去抽奖',
|
|
176
|
+
coupon: '去领券',
|
|
177
|
+
walking: '健步走',
|
|
178
|
+
};
|
|
179
|
+
let btnText = toolText[this.marketing_tool];
|
|
180
|
+
return btnText ? btnText : '';
|
|
181
|
+
},
|
|
182
|
+
fixedButtonStyle(){
|
|
183
|
+
return {
|
|
184
|
+
width: '300rpx',
|
|
185
|
+
height: '70rpx',
|
|
186
|
+
lineHeight: '70rpx',
|
|
187
|
+
fontSize: '28rpx',
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
watch: {
|
|
192
|
+
container(value, oldValue) {
|
|
193
|
+
if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
|
|
194
|
+
if (this.$configProject['isPreview']) this.init(value)
|
|
195
|
+
},
|
|
196
|
+
curIndex(value, oldValue){
|
|
197
|
+
console.log('curIndex', value, oldValue);
|
|
198
|
+
if(value !== oldValue && this.curQA){
|
|
199
|
+
if(this.curQA.value){
|
|
200
|
+
this.qaValue = this.curQA.value;
|
|
201
|
+
}else{
|
|
202
|
+
let field_type = this.curQA.field_type;
|
|
203
|
+
if(field_type === 'radio') this.qaValue = '';
|
|
204
|
+
else if(field_type === 'checkbox') this.qaValue = [];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
created() {
|
|
210
|
+
this.init(this.container);
|
|
211
|
+
this.mainColorAlpha = Color(this.mainColor).alpha(0.15).string();
|
|
212
|
+
this.isPreview = this.$configProject['isPreview'];
|
|
213
|
+
|
|
214
|
+
//todo
|
|
215
|
+
},
|
|
216
|
+
methods: {
|
|
217
|
+
onJfbLoad(options) {
|
|
218
|
+
|
|
219
|
+
if(!this.isPreview && !options.form_id) {
|
|
220
|
+
return uni.showToast({
|
|
221
|
+
title: '请配置表单id',
|
|
222
|
+
duration: 2000
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if(this.isPreview) {
|
|
226
|
+
this.form_id = '123';
|
|
227
|
+
}else{
|
|
228
|
+
this.form_id = options.form_id;
|
|
229
|
+
}
|
|
230
|
+
this.$xdShowLoading({});
|
|
231
|
+
jfbRootExec("getDynamicForm", {
|
|
232
|
+
vm: this,
|
|
233
|
+
data: {
|
|
234
|
+
form_id: this.form_id,
|
|
235
|
+
}
|
|
236
|
+
}).then(res => {
|
|
237
|
+
this.$xdHideLoading();
|
|
238
|
+
this.loaded = true;
|
|
239
|
+
this.formList = res.list;
|
|
240
|
+
this.formName = res.form_name;
|
|
241
|
+
})
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* @description 监听事件变化
|
|
245
|
+
* @param container {object} 业务组件对象自己
|
|
246
|
+
*/
|
|
247
|
+
init(container) {
|
|
248
|
+
|
|
249
|
+
//this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
|
|
250
|
+
|
|
251
|
+
//this.height = getContainerPropsValue(container, 'content.height', 10);
|
|
252
|
+
},
|
|
253
|
+
handlePrev(){
|
|
254
|
+
if(this.curIndex > 0){
|
|
255
|
+
this.curIndex--;
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
handleNext(){
|
|
259
|
+
|
|
260
|
+
if(this.isLastQA){
|
|
261
|
+
return this.p_submitQaForm();
|
|
262
|
+
}
|
|
263
|
+
if(this.curIndex < this.formList.length - 1){
|
|
264
|
+
this.curIndex++;
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
p_submitQaForm(){
|
|
268
|
+
uni.showModal({
|
|
269
|
+
title: '提示',
|
|
270
|
+
content: '您已完成所有题目,是否提交?',
|
|
271
|
+
success: (res) => {
|
|
272
|
+
if(res.confirm){
|
|
273
|
+
jfbRootExec("submitDynamicForm", {
|
|
274
|
+
vm: this,
|
|
275
|
+
data: {
|
|
276
|
+
form_id: this.form_id,
|
|
277
|
+
contents: this.formList.map(item => {
|
|
278
|
+
let content = Array.isArray(item.value) ? item.value : [item.value];
|
|
279
|
+
return {
|
|
280
|
+
field_id: item.field_id,
|
|
281
|
+
content: JSON.stringify(content)
|
|
282
|
+
}
|
|
283
|
+
}),
|
|
284
|
+
}
|
|
285
|
+
}).then(res => {
|
|
286
|
+
const { activity_id, marketing_tool, activity_page_url } = res;
|
|
287
|
+
this.marketing_tool = marketing_tool;
|
|
288
|
+
this.activity_page_url = activity_page_url;
|
|
289
|
+
this.activity_id = activity_id;
|
|
290
|
+
|
|
291
|
+
// uni.showToast({title: '提交成功'});
|
|
292
|
+
this.form_status = 'success';
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
})
|
|
297
|
+
},
|
|
298
|
+
handleMarketToolBtn(){
|
|
299
|
+
let url = this.checkUrlIsValid(this.activity_page_url);
|
|
300
|
+
if(url){
|
|
301
|
+
if(this.marketing_tool === 'prize') url = url + '?id=' + this.activity_id;
|
|
302
|
+
if(this.marketing_tool === 'coupon') url = url + '?activity_id=' + this.activity_id;
|
|
303
|
+
else url = url + `?id=${this.activity_id}&activity_id=${this.activity_id}`;
|
|
304
|
+
this.$xdUniHelper.navigateTo({
|
|
305
|
+
url: url
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
handleCheck(radio){
|
|
310
|
+
let field_type = this.curQA.field_type;
|
|
311
|
+
|
|
312
|
+
if(field_type == 'radio'){
|
|
313
|
+
if(this.qaValue == radio) this.qaValue = '';
|
|
314
|
+
else this.qaValue = radio;
|
|
315
|
+
}
|
|
316
|
+
if(field_type === 'checkbox'){
|
|
317
|
+
if(this.qaValue.includes(radio)) {
|
|
318
|
+
let index = this.qaValue.indexOf(radio);
|
|
319
|
+
this.qaValue.splice(index, 1)
|
|
320
|
+
}else{
|
|
321
|
+
this.qaValue.push(radio);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
this.$set(this.formList[this.curIndex], 'value', this.qaValue);
|
|
326
|
+
},
|
|
327
|
+
//判断两个包含数组是否相同
|
|
328
|
+
isSameArray(arr1, arr2){
|
|
329
|
+
if(arr1.length != arr2.length) return false;
|
|
330
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
331
|
+
if(!arr2.includes(arr1[i])){
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return true;
|
|
336
|
+
},
|
|
337
|
+
onJfbScroll(options) {
|
|
338
|
+
// console.log('event.onJfbScroll', options)
|
|
339
|
+
},
|
|
340
|
+
onJfbReachBottom(options) {
|
|
341
|
+
console.log('event.onJfbReachBottom', options)
|
|
342
|
+
},
|
|
343
|
+
onJfbShow(options) {
|
|
344
|
+
// console.log('event.onJfbShow', options)
|
|
345
|
+
this.onJfbLoad(options);
|
|
346
|
+
},
|
|
347
|
+
onJfbHide(options) {
|
|
348
|
+
console.log('event.onJfbHide', options)
|
|
349
|
+
},
|
|
350
|
+
onJfbBack(options) {
|
|
351
|
+
console.log('event.onJfbBack', options)
|
|
352
|
+
},
|
|
353
|
+
onJfbUpdate(...data) {
|
|
354
|
+
console.log('event.onJfbUpdate', data)
|
|
355
|
+
},
|
|
356
|
+
onJfbCustomEvent(options) {
|
|
357
|
+
console.log('event.onJfbReachBottom', options)
|
|
358
|
+
},
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
</script>
|
|
363
|
+
|
|
364
|
+
<style scoped lang="less">
|
|
365
|
+
@import "./JfbFormsQuestionAndAnswerLess.less";
|
|
366
|
+
|
|
367
|
+
.jfb-forms-question-and-answer {
|
|
368
|
+
&__body{
|
|
369
|
+
.qa_title{
|
|
370
|
+
text-align: center;
|
|
371
|
+
padding: 40rpx 0;
|
|
372
|
+
font-size: 32rpx;
|
|
373
|
+
color: #333333;
|
|
374
|
+
font-weight: 400;
|
|
375
|
+
}
|
|
376
|
+
.qa_progress{
|
|
377
|
+
.progress_text{
|
|
378
|
+
text-align: center;
|
|
379
|
+
font-size: 28rpx;
|
|
380
|
+
margin-bottom: 8rpx;
|
|
381
|
+
}
|
|
382
|
+
.qa_progress_bar{
|
|
383
|
+
background-color: #D8D8D8;
|
|
384
|
+
width: 100%;
|
|
385
|
+
height: 6px;
|
|
386
|
+
.qa_progress_bar_inner{
|
|
387
|
+
background-color: #007AFF;
|
|
388
|
+
height: 100%;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
.qa_content{
|
|
393
|
+
padding: 24rpx;
|
|
394
|
+
.qa_type{
|
|
395
|
+
color: var(--main-color);
|
|
396
|
+
background: var(--main-color-alpha);
|
|
397
|
+
display: inline-block;
|
|
398
|
+
padding: 4rpx 8rpx;
|
|
399
|
+
border-radius: 8rpx;
|
|
400
|
+
font-size: 28rpx;
|
|
401
|
+
}
|
|
402
|
+
.qa_question{
|
|
403
|
+
color: var(--main-color);
|
|
404
|
+
margin-top: 16rpx;
|
|
405
|
+
font-size: 28rpx;
|
|
406
|
+
}
|
|
407
|
+
.qa_answer{
|
|
408
|
+
margin-top: 40rpx;
|
|
409
|
+
font-size: 28rpx;
|
|
410
|
+
.answer_column{
|
|
411
|
+
display: flex;
|
|
412
|
+
align-items: center;
|
|
413
|
+
|
|
414
|
+
::v-deep .xd-radio{
|
|
415
|
+
width: 50rpx !important;
|
|
416
|
+
height: 50rpx !important;
|
|
417
|
+
}
|
|
418
|
+
::v-deep .qa_checkbox{
|
|
419
|
+
.xd-radio__body{
|
|
420
|
+
border-radius: 8rpx !important;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
::v-deep .mySelfCheckbox{
|
|
425
|
+
.checklist-group{
|
|
426
|
+
flex-direction: column;
|
|
427
|
+
.checklist-text{
|
|
428
|
+
line-height: 32rpx;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
.qa_result{
|
|
435
|
+
padding: 24rpx;
|
|
436
|
+
font-size: 28rpx;
|
|
437
|
+
.ans_right{
|
|
438
|
+
margin: 24rpx 0;
|
|
439
|
+
}
|
|
440
|
+
.ans_explain{
|
|
441
|
+
text-indent: 1em;
|
|
442
|
+
}
|
|
443
|
+
.result_status{
|
|
444
|
+
display: flex;
|
|
445
|
+
align-items: center;
|
|
446
|
+
.icon_font{
|
|
447
|
+
margin-right: 8rpx;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
&.error{
|
|
451
|
+
color: rgba(212, 48, 48, 1);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
.bottom_fixed{
|
|
456
|
+
position: fixed;
|
|
457
|
+
bottom: 0;
|
|
458
|
+
left: 0;
|
|
459
|
+
width: 100%;
|
|
460
|
+
background-color: #fff;
|
|
461
|
+
padding: 24rpx;
|
|
462
|
+
display: flex;
|
|
463
|
+
justify-content: space-between;
|
|
464
|
+
box-sizing: border-box;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.form_status{
|
|
468
|
+
display: flex;
|
|
469
|
+
flex-direction: column;
|
|
470
|
+
align-items: center;
|
|
471
|
+
padding-top: 100rpx;
|
|
472
|
+
.status_tip{
|
|
473
|
+
color: #06bc85;
|
|
474
|
+
margin-top: 32rpx;
|
|
475
|
+
font-size: 40rpx;
|
|
476
|
+
&.error_tip{
|
|
477
|
+
color: #f0413d;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
.status_name{
|
|
481
|
+
font-size: 32rpx;
|
|
482
|
+
margin: 78rpx 0;
|
|
483
|
+
}
|
|
484
|
+
.status_btn_wrap{
|
|
485
|
+
display: flex;
|
|
486
|
+
justify-content: center;
|
|
487
|
+
width: 80%;
|
|
488
|
+
}
|
|
489
|
+
.status_btn{
|
|
490
|
+
width: 80%;
|
|
491
|
+
border-radius: 40px;
|
|
492
|
+
background: #06bc85;
|
|
493
|
+
color: #fff;
|
|
494
|
+
font-size: 26rpx;
|
|
495
|
+
height: 80rpx;
|
|
496
|
+
line-height: 80rpx;
|
|
497
|
+
text-align: center;
|
|
498
|
+
|
|
499
|
+
& + .status_btn{
|
|
500
|
+
margin-left: 32rpx;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
</style>
|