jufubao-forms 1.0.8 → 1.0.9-beta2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-forms",
3
- "version": "1.0.8",
3
+ "version": "1.0.9-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝表单业务插件库",
6
6
  "main": "index.js",
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ /**
3
+ * @description 接口配置,
4
+ * 在设置方法名字当时候,别忘记加上【模块名字】:Qa
5
+ * @type {*[]}
6
+ */
7
+ module.exports = [
8
+ {
9
+ mapFnName: 'getQaRecordList',
10
+ title: '获取答题记录',
11
+ path: '/forms/v1/sms-form-content/:form_id/all',
12
+ isRule: false,
13
+ params: {
14
+ form_id: ['表单ID', 'string', '必填'],
15
+ },
16
+ isConsole: true,
17
+ disabled: true,
18
+ },
19
+ ];
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ import style from "./cusAttr/style";
4
+ import advanced from "./cusAttr/advanced";
5
+ import content from "./cusAttr/content";
6
+
7
+ export default {
8
+ style: [],
9
+ advanced: [],
10
+ content: (data, gValue, gColor, oldData={})=>{
11
+
12
+ return [
13
+ ...content(data, gValue,gColor,oldData),
14
+ ...style(data, gValue,gColor,oldData),
15
+ ...advanced(data),
16
+ ].filter(i=>i)
17
+ },
18
+ }
@@ -0,0 +1,216 @@
1
+ <template>
2
+ <view
3
+ class="jfb-forms-qa-record"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx : isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-forms-qa-record__edit"
10
+ :class="{ editx : isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-forms-qa-record__edit-icon" @click.stop="delEdit">
14
+ <xd-font-icon icon="iconshanchu-01" color="#fff" size="30"></xd-font-icon>
15
+ </view>
16
+ </view>
17
+ <!-- #endif -->
18
+ <view class="jfb-forms-qa-record__body">
19
+ <view class="form_name">{{ formName }}</view>
20
+ <view class="qa_list">
21
+ <view class="qa_item" v-for="(item, i) in formList" :key="i">
22
+ <view class="qa_body">
23
+ <view class="q_t">
24
+ <view class="q_t_i">
25
+ <view class="icon_wrap"><xd-font-icon icon="iconquanbudingdan1" :size="24" color="#71ACF5"></xd-font-icon></view>
26
+ 总题数 {{item.content_number}}个
27
+ </view>
28
+ <view class="q_t_r">正确率:{{ item.right_rate }}%</view>
29
+ </view>
30
+ <view class="q_b">
31
+ <view class="q_t_i">
32
+ <view class="icon_wrap" style="background: #E8FFED;">
33
+ <xd-font-icon icon="iconquanbudingdan1" :size="24" color="#32C93A"></xd-font-icon>
34
+ </view>
35
+ 答对 {{item.right_number}}题
36
+ </view>
37
+ </view>
38
+ </view>
39
+ <view class="qa_foot">
40
+ <view>答题时间:{{ item.created_time }}</view>
41
+ <view>
42
+ <xd-button radius="8rpx" type="primary" size="small" @click="toQaResult(item)">查看答案</xd-button>
43
+ </view>
44
+ </view>
45
+ </view>
46
+ </view>
47
+ <view class="no_more">没有更多数据了</view>
48
+ </view>
49
+ </view>
50
+ </template>
51
+
52
+ <script>
53
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
54
+ import XdButton from "@/components/XdButton/XdButton"
55
+ import { jfbRootExec } from "@/utils/xd.event";
56
+ import JfbFormsQaRecordMixin from "./JfbFormsQaRecordMixin";
57
+ import { getContainerPropsValue, gCPVal } from "@/utils/xd.base";
58
+ import componentsMixins from "@/mixins/componentsMixins";
59
+ import extsMixins from "@/mixins/extsMixins";
60
+ export default {
61
+ name: "JfbFormsQaRecord",
62
+ components: {
63
+ XdFontIcon,
64
+ XdButton
65
+ },
66
+ mixins: [
67
+ componentsMixins, extsMixins, JfbFormsQaRecordMixin
68
+ ],
69
+ data() {
70
+ return {
71
+ closeMask: true,
72
+ //todo
73
+ form_id: "",
74
+ formName: "",
75
+ formList: [],
76
+ qaResultPath: "",
77
+ }
78
+ },
79
+ watch: {
80
+ container(value, oldValue) {
81
+ if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
82
+ if (this.$configProject['isPreview']) this.init(value)
83
+ },
84
+ },
85
+ created() {
86
+ this.init(this.container);
87
+
88
+ //todo
89
+ },
90
+ methods: {
91
+ onJfbLoad(options) {
92
+ this.form_id = options.form_id;
93
+ this.getList();
94
+ },
95
+ /**
96
+ * @description 监听事件变化
97
+ * @param container {object} 业务组件对象自己
98
+ */
99
+ init(container) {
100
+ this.qaResultPath = gCPVal(container, 'qaResultPath', {value: ""}).value;
101
+ },
102
+ getList(){
103
+ jfbRootExec("getQaRecordList", {
104
+ vm: this,
105
+ data: {
106
+ form_id: this.form_id
107
+ }
108
+ }).then(res => {
109
+ this.formName = res.form_name;
110
+ this.formList = res.list.map(item => {
111
+ //正确率
112
+ item.right_rate = (item.right_number / item.content_number * 100).toFixed(2);
113
+ item.created_time = this.$xdUniHelper.getDate(item.created_time * 1000).fullTime;
114
+ return item;
115
+ });
116
+ })
117
+ },
118
+ toQaResult(item){
119
+ this.$xdUniHelper.navigateTo({
120
+ url: this.qaResultPath + `?form_id=${this.form_id}&main_content_id=${item.main_content_id}`
121
+ })
122
+ },
123
+ onJfbScroll(options) {
124
+ console.log('event.onJfbScroll', options)
125
+ },
126
+ onJfbReachBottom(options) {
127
+ console.log('event.onJfbReachBottom', options)
128
+ },
129
+ onJfbShow(options) {
130
+ console.log('event.onJfbShow', options)
131
+ },
132
+ onJfbHide(options) {
133
+ console.log('event.onJfbHide', options)
134
+ },
135
+ onJfbBack(options) {
136
+ console.log('event.onJfbBack', options)
137
+ },
138
+ onJfbUpdate(...data) {
139
+ console.log('event.onJfbUpdate', data)
140
+ },
141
+ onJfbCustomEvent(options) {
142
+ console.log('event.onJfbReachBottom', options)
143
+ },
144
+ }
145
+ }
146
+
147
+ </script>
148
+
149
+ <style scoped lang="less">
150
+ @import "./JfbFormsQaRecordLess.less";
151
+
152
+ .jfb-forms-qa-record {
153
+ &__body{
154
+ background-color: rgba(248, 248, 248, 1);
155
+ .form_name{
156
+ padding: 32rpx;
157
+ font-size: 32rpx;
158
+ color: rgba(51, 51, 51, 1);
159
+ text-align: center;
160
+ }
161
+ .qa_item{
162
+ border-radius: 24rpx;
163
+ background: #FFFFFF;
164
+ margin: 16rpx;
165
+
166
+ .qa_body{
167
+ border-bottom: 1px solid rgba(238, 238, 238, 1);
168
+ padding: 24rpx;
169
+ font-size: 32rpx;
170
+ color: rgba(51, 51, 51, 1);
171
+ }
172
+ .q_t_i{
173
+ display: flex;
174
+ align-items: center;
175
+ .icon_wrap{
176
+ width: 40rpx;
177
+ height: 40rpx;
178
+ background-color: rgba(232, 243, 255, 1);
179
+ border-radius: 40%;
180
+ display: flex;
181
+ align-items: center;
182
+ justify-content: center;
183
+ margin-right: 8rpx;
184
+ }
185
+ }
186
+ .qa_foot{
187
+ padding: 32rpx 24rpx;
188
+ display: flex;
189
+ align-items: center;
190
+ font-size: 24rpx;
191
+ justify-content: space-between;
192
+ color: rgba(102, 102, 102, 1);
193
+ }
194
+ .q_t{
195
+ display: flex;
196
+ align-items: center;
197
+ justify-content: space-between;
198
+
199
+ .q_t_r{
200
+ font-size: 24rpx;
201
+ color: rgba(102, 102, 102, 1);
202
+ }
203
+ }
204
+ .q_b{
205
+ margin-top: 8rpx;
206
+ }
207
+ }
208
+ .no_more{
209
+ text-align: center;
210
+ font-size: 24rpx;
211
+ color: #666666;
212
+ padding: 32rpx 0;
213
+ }
214
+ }
215
+ }
216
+ </style>
@@ -0,0 +1,80 @@
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-qa-record {
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(0, rpx);
48
+ height: unit(50, rpx);
49
+ z-index: 100;
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ background: rgba(0, 0, 0, .4);
54
+ border-radius: 0 0 0 20rpx;
55
+ box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
56
+ color: #fff;
57
+ font-size: unit(22, rpx);
58
+ padding: 0 6rpx 0 6px;
59
+
60
+ &-icon{
61
+ padding: 0 unit(20, rpx);
62
+ }
63
+
64
+ &.editx {
65
+ box-sizing: border-box;
66
+
67
+ }
68
+ }
69
+ }
70
+ //end
71
+
72
+
73
+ /**notPreview**/
74
+ .jfb-forms-qa-record {
75
+ //&:before {
76
+ //content: " ";
77
+ //display: table;
78
+ //}
79
+ }
80
+ /**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-qa-record'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+
5
+ getQaByIdFilmSquate:{},
6
+
7
+ updateQaFilmPaiqiDate:{},
8
+
9
+ removeQaFilmAddress:{},
10
+
11
+ addQaFilmcart:{},
12
+
13
+ }
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+ import {
3
+ dataVal ,
4
+ statusShow,
5
+ statusDataVal,
6
+ customVal,
7
+ cusDisabled ,
8
+ getCustomAttr,
9
+ TestCssInfo,
10
+ cRaBorShadow
11
+ } from "@/utils/AttrTools";
12
+ export default (data, gValue, gColor, oldData) => {
13
+ return [
14
+ {
15
+ label: "查看答案",
16
+ ele: 'xd-select-pages-path',
17
+ valueKey: 'qaResultPath',
18
+ groupKey:'advanced',
19
+ placeholder: '请选择查看答案跳转路径',
20
+ value: data['qaResultPath'] || null,
21
+ setting: {
22
+ router: XdBus.getParentApi('getPagesTree'),
23
+ },
24
+ inline: false,
25
+ labelInline: true,
26
+ className: "input100"
27
+ },
28
+ {
29
+ label: '版本号:',
30
+ ele: 'el-input',
31
+ type: 'text',
32
+ groupKey: 'advanced',
33
+ valueKey: 'version',
34
+ value: 'v2.0',
35
+ hidden: true,
36
+ },
37
+ ].filter(i=>i)
38
+ }
39
+
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+ import {
3
+ dataVal ,
4
+ statusShow,
5
+ statusDataVal,
6
+ customVal,
7
+ cusDisabled ,
8
+ getCustomAttr,
9
+ TestCssInfo,
10
+ cRaBorShadow
11
+ } from "@/utils/AttrTools";
12
+
13
+ export default (data, gValue, gColor, oldData) => {
14
+ return [
15
+
16
+ ].filter(i=>i)
17
+ }
@@ -0,0 +1,14 @@
1
+ import {
2
+ dataVal ,
3
+ statusShow,
4
+ statusDataVal,
5
+ customVal,
6
+ cusDisabled ,
7
+ getCustomAttr,
8
+ TestCssInfo,
9
+ cRaBorShadow
10
+ } from "@/utils/AttrTools";
11
+ export default function (data, gValue, gColor, oldData) {
12
+ return [
13
+ ].filter(i=>i)
14
+ }
@@ -8,7 +8,7 @@ export default {
8
8
  content: (data) => {
9
9
  return [
10
10
  {
11
- label: "返回首页跳转路径",
11
+ label: "返回首页",
12
12
  ele: 'xd-select-pages-path',
13
13
  valueKey: 'returnHomePath',
14
14
  groupKey:'advanced',
@@ -18,6 +18,8 @@ export default {
18
18
  router: XdBus.getParentApi('getPagesTree'),
19
19
  },
20
20
  inline: false,
21
+ labelInline: true,
22
+ className: "input100"
21
23
  },
22
24
  ].filter(i=>i)
23
25
  },
@@ -8,28 +8,32 @@ export default {
8
8
  content: (data) => {
9
9
  return [
10
10
  {
11
- label: "问卷结果跳转路径",
11
+ label: "问卷结果",
12
12
  ele: 'xd-select-pages-path',
13
13
  valueKey: 'qaResultPath',
14
14
  groupKey:'advanced',
15
- placeholder: '请选择问卷详情跳转路径',
15
+ placeholder: '请选择问卷结果跳转路径',
16
16
  value: data['qaResultPath'] || null,
17
17
  setting: {
18
18
  router: XdBus.getParentApi('getPagesTree'),
19
19
  },
20
20
  inline: false,
21
+ labelInline: true,
22
+ className: "input100",
21
23
  },
22
24
  {
23
- label: "问卷列表跳转路径",
25
+ label: "问卷列表",
24
26
  ele: 'xd-select-pages-path',
25
27
  valueKey: 'qaListPath',
26
28
  groupKey:'advanced',
27
- placeholder: '请选择问卷详情跳转路径',
29
+ placeholder: '请选择问卷列表跳转路径',
28
30
  value: data['qaListPath'] || null,
29
31
  setting: {
30
32
  router: XdBus.getParentApi('getPagesTree'),
31
33
  },
32
34
  inline: false,
35
+ labelInline: true,
36
+ className: "input100",
33
37
  },
34
38
  ].filter(i=>i)
35
39
  },
@@ -44,20 +44,21 @@
44
44
  <view>{{ o.label }}</view>
45
45
  </view>
46
46
  </view>
47
+ <view v-if="curQA.field_type === 'checkbox'" class="checkbox_btn" @click="getQaResult">答完了</view>
47
48
  </view>
48
49
  </view>
49
- <view v-if="qaResult" class="qa_result">
50
- <view class="result_status" v-if="qaResult.right">
50
+ <view v-if="curQaResult" class="qa_result">
51
+ <view class="result_status" v-if="curQaResult.right">
51
52
  <!-- <xd-font-icon class="icon_font" icon="iconzan_mian"></xd-font-icon> 恭喜您,回答正确! -->
52
53
  </view>
53
54
  <template v-else>
54
55
  <view class="result_status error">
55
56
  <xd-font-icon class="icon_font" icon="iconmingchengtubiao"></xd-font-icon> 回答有误,再接再厉哦!</view>
56
- <view class="ans_right">正确选项: {{ qaResult.answer }}</view>
57
+ <view class="ans_right">正确选项: {{ curQaResult.answer }}</view>
57
58
 
58
59
  <view>
59
60
  <view>答案解析:</view>
60
- <view class="ans_explain">{{ qaResult.explain }}</view>
61
+ <view class="ans_explain">{{ curQaResult.explain }}</view>
61
62
  </view>
62
63
  </template>
63
64
  </view>
@@ -132,6 +133,7 @@
132
133
  activity_page_url: "",
133
134
  activity_id: "",
134
135
  emptyImage: getServiceUrl('/common/empty/qa.png'),
136
+ curQaResult: null,
135
137
 
136
138
  value: [],
137
139
  qaValue: "",
@@ -306,6 +308,44 @@
306
308
  this.qaResultPath = getContainerPropsValue(container, 'content.qaResultPath', {value: ''}).value;
307
309
  this.qaListPath = getContainerPropsValue(container, 'content.qaListPath', {value: ""}).value;
308
310
  },
311
+ //获取当前题目的答案
312
+ getQaResult(){
313
+ if(!this.curQA){
314
+ this.curQaResult = null;
315
+ return;
316
+ };
317
+ //是否需要校验
318
+ let is_verify_answer = this.curQA.is_verify_answer;
319
+ if(is_verify_answer === "N") {
320
+ this.curQaResult = null;
321
+ return;
322
+ }
323
+
324
+ let result = this.curQA.value;
325
+ if(result && result.length > 0){
326
+ let answer = this.curQA.answer;
327
+ let isRight = false;
328
+
329
+ if(this.curQA.field_type === 'radio'){
330
+ isRight = result === answer[0]; //答案正确
331
+ }else if(this.curQA.field_type === 'checkbox'){
332
+ isRight = this.isSameArray(result, answer);
333
+ }
334
+ if(isRight) {
335
+ this.curQaResult = {right: true};
336
+ return;
337
+ }
338
+ else {
339
+ this.curQaResult = {
340
+ right: false,
341
+ answer: answer,
342
+ explain: this.curQA.answer_analysis,
343
+ }
344
+ return;
345
+ }
346
+ }
347
+ this.curQaResult = null;
348
+ },
309
349
  handlePrev(){
310
350
  if(this.curIndex > 0){
311
351
  this.curIndex--;
@@ -318,6 +358,7 @@
318
358
  }
319
359
  if(this.curIndex < this.formList.length - 1){
320
360
  this.curIndex++;
361
+ this.curQaResult = null;
321
362
  }
322
363
  },
323
364
  doClose(){
@@ -393,6 +434,9 @@
393
434
  }
394
435
 
395
436
  this.$set(this.formList[this.curIndex], 'value', this.qaValue);
437
+ if(field_type === 'radio'){
438
+ this.getQaResult();
439
+ }
396
440
  },
397
441
  //判断两个包含数组是否相同
398
442
  isSameArray(arr1, arr2){
@@ -469,6 +513,17 @@
469
513
  }
470
514
  .qa_content{
471
515
  padding: 24rpx;
516
+ position: relative;
517
+ .checkbox_btn{
518
+ position: absolute;
519
+ bottom: -40rpx;
520
+ border: 1px solid var(--g-theme-main-color);
521
+ color: var(--g-theme-main-color);
522
+ border-radius: 80rpx;
523
+ padding: 8rpx 32rpx;
524
+ font-size: 28rpx;
525
+ right: 40rpx;
526
+ }
472
527
  .qa_type{
473
528
  color: var(--main-color);
474
529
  background: var(--main-color-alpha);
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * @description 第三方库
5
- * @param threePackagePath {String} 第三方库所在项目路径存放路径路
6
- * @param packname {String} 包名字
7
- * @returns {string|*}
8
- */
9
- const getPackagePath = (threePackagePath, packname = 'gxd-commands-bussiness')=>{
10
- if(packname === 'gxd-commands-bussiness') {
11
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-commands-bussiness/${threePackagePath}`;
12
- }
13
-
14
- if (packname === 'gxd-uni-library-editx') {
15
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-uni-library-editx/${threePackagePath}`;
16
- }
17
-
18
- };
19
-
20
- module.exports = {
21
- getPackagePath
22
- }