jufubao-forms 1.0.0-beta1 → 1.0.0-beta10

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.0-beta1",
3
+ "version": "1.0.0-beta10",
4
4
  "private": false,
5
5
  "description": "聚福宝表单业务插件库",
6
6
  "main": "index.js",
@@ -29,6 +29,18 @@ export default {
29
29
  router: XdBus.getParentApi('getPagesTree')
30
30
  },
31
31
  },
32
+ {
33
+ label: "表单列表跳转路径",
34
+ ele: 'xd-select-pages-path',
35
+ valueKey: 'qaListPath',
36
+ groupKey:'advanced',
37
+ placeholder: '请选择表单列表跳转路径',
38
+ value: data['qaListPath'] || null,
39
+ setting: {
40
+ router: XdBus.getParentApi('getPagesTree'),
41
+ },
42
+ inline: false,
43
+ },
32
44
  ].filter(i=>i)
33
45
  },
34
46
  advanced: [],
@@ -10,7 +10,9 @@
10
10
  :class="{ editx : isEditx && active }"
11
11
  v-if="isEditx && active"
12
12
  >
13
- <view class="jfb-forms-dynamic-form__edit-icon" @click="delEdit">删除</view>
13
+ <view class="jfb-forms-dynamic-form__edit-icon" @click.stop="delEdit">
14
+ <xd-font-icon icon="iconshanchu-01" color="#fff" size="30"></xd-font-icon>
15
+ </view>
14
16
  </view>
15
17
  <!-- #endif -->
16
18
  <view class="jfb-forms-dynamic-form__body">
@@ -76,7 +78,7 @@
76
78
  :end="item.end_time"
77
79
  :border="false"
78
80
  placeholder="请选择日期"
79
- @change="handleClearError(item)">
81
+ @change="e => handleDateTimePicker(e, item)">
80
82
  </uni-datetime-picker>
81
83
  </template>
82
84
  <!-- <xd-form-date v-if="item.field_type === 'calendar'"
@@ -103,13 +105,15 @@
103
105
  <view class="status_btn" @click="doClose">关闭</view>
104
106
  </view>
105
107
  <view v-if="form_status === 'error'" class="form_status form_error">
106
- <xd-font-icon icon="iconshibai" color="#ff5235" :size="64"></xd-font-icon>
107
- <view class="status_tip error_tip">{{ err_msg }}</view>
108
- <view class="status_name">{{ formName }}</view>
108
+ <!-- <xd-font-icon icon="iconshibai" color="#ff5235" :size="64"></xd-font-icon> -->
109
+ <image class="empty_image" :src="emptyImage" mode="widthFix"></image>
110
+ <view class="status_tip error_tip" style="color: #333333;">{{ err_msg }}</view>
111
+ <!-- <view class="status_name">{{ formName }}</view> -->
112
+ <view class="status_btn" @click="toQaList" style="border-radius: 8rpx;margin-top: 100rpx;">返回列表</view>
109
113
  </view>
110
114
  </view>
111
-
112
-
115
+
116
+
113
117
  <xd-dialog :show.sync="isShowDialog" title="请输入验证码" :showCloseIcon="false">
114
118
  <xd-form
115
119
  label-align="left"
@@ -129,7 +133,7 @@
129
133
  </view>
130
134
  </xd-form-item>
131
135
  </xd-form>
132
-
136
+
133
137
  <view slot="btn">
134
138
  <xd-button type="primary" width="400rpx" @click="doCheckValidCode">提交</xd-button>
135
139
  </view>
@@ -157,6 +161,7 @@
157
161
  import componentsMixins from "@/mixins/componentsMixins";
158
162
  import extsMixins from "@/mixins/extsMixins";
159
163
  import { mapState } from "vuex";
164
+ import getServiceUrl from "@/common/getServiceUrl";
160
165
  export default {
161
166
  name: "JfbFormsDynamicForm",
162
167
  components: {
@@ -191,10 +196,12 @@
191
196
  err_msg: "",
192
197
  loaded: false,
193
198
  isPreview: false,
199
+ emptyImage: getServiceUrl('/common/empty/qa.png'),
194
200
 
195
201
  //面板
196
202
  submitPagePath: "",
197
203
  formBe: "1",
204
+ qaListPath: "",
198
205
  // description: "",
199
206
  }
200
207
  },
@@ -202,6 +209,9 @@
202
209
  ...mapState({
203
210
  brandInfo: state => state.brandInfo
204
211
  }),
212
+ bucket(){
213
+ return this.formBe == 1 ? 'default' : 'saas';
214
+ }
205
215
  },
206
216
  watch: {
207
217
  container(value, oldValue) {
@@ -230,14 +240,14 @@
230
240
  this.form_id = 1;
231
241
  }
232
242
  let getFormFn = "getDynamicForm"; //加盟商营销动态表单fn
233
- if(this.formBe == 2) getFormFn = "getSaasDynamicForm"
234
-
243
+ // if(this.formBe == 2) getFormFn = "getSaasDynamicForm"
235
244
 
236
245
  this.$xdShowLoading({});
237
246
  jfbRootExec(getFormFn, {
238
247
  vm: this,
239
248
  data: {
240
249
  form_id: this.form_id,
250
+ bucket: this.bucket
241
251
  }
242
252
  }).then(res => {
243
253
  this.$xdHideLoading();
@@ -250,7 +260,7 @@
250
260
  }
251
261
  this.dynamicFormList = res.list.map((item, i) => {
252
262
  item.error = "";
253
-
263
+
254
264
  if(item.is_show_explain !== 'Y'){
255
265
  item.explain = "";
256
266
  }
@@ -310,6 +320,8 @@
310
320
  setTimeout(() => {
311
321
  this.setFieldItemTop();
312
322
  }, 100)
323
+ }).catch(err => {
324
+ this.$xdHideLoading();
313
325
  })
314
326
  },
315
327
  setFieldItemTop(){
@@ -366,6 +378,7 @@
366
378
  init(container) {
367
379
  this.submitPagePath = getContainerPropsValue(container, 'content.submitPagePath', {value: ""}).value;
368
380
  this.formBe = getContainerPropsValue(container, 'content.formBe', '1');
381
+ this.qaListPath = getContainerPropsValue(container, 'content.qaListPath', {value: ""}).value;
369
382
  // this.description = getContainerPropsValue(container, 'content.description', "");
370
383
  },
371
384
  handleClearError(item){
@@ -407,14 +420,15 @@
407
420
  console.log(contents, "contents")
408
421
 
409
422
  let submitFormFn = "submitDynamicForm"; //加盟商营销动态表单fn
410
- if(this.formBe == 2) submitFormFn = "submitSaasDynamicForm"
423
+ // if(this.formBe == 2) submitFormFn = "submitSaasDynamicForm"
411
424
 
412
425
  this.$xdShowLoading({});
413
426
  jfbRootExec(submitFormFn, {
414
427
  vm: this,
415
428
  data: {
416
429
  contents,
417
- form_id: this.form_id
430
+ form_id: this.form_id,
431
+ bucket: this.bucket,
418
432
  }
419
433
  }).then(res => {
420
434
  this.$xdHideLoading();
@@ -563,7 +577,7 @@
563
577
  return this.getDecimalTip(item);
564
578
  }
565
579
  }
566
-
580
+
567
581
  //开始验证限制范围
568
582
  if(fieldValue && !showRange) return errTip;
569
583
  max = Number(max);
@@ -592,6 +606,10 @@
592
606
  this.$set(this.form, item.field_value, value);
593
607
  this.$set(item, "error", "")
594
608
  },
609
+ handleDateTimePicker(time, item){
610
+ this.$set(this.form, item.field_value, time);
611
+ this.$set(item, "error", "")
612
+ },
595
613
  doClose(){
596
614
  this.$xdUniHelper.navigateTo({
597
615
  url: this.submitPagePath
@@ -599,6 +617,11 @@
599
617
  // window.location.href = 'about:blank';
600
618
  // window.close();
601
619
  },
620
+ toQaList(){
621
+ this.$xdUniHelper.redirectTo({
622
+ url: this.qaListPath
623
+ })
624
+ },
602
625
  onJfbScroll(options) {
603
626
  // console.log('event.onJfbScroll', options)
604
627
  },
@@ -636,6 +659,13 @@
636
659
  flex-direction: column;
637
660
  align-items: center;
638
661
  padding-top: 100rpx;
662
+ .empty_image{
663
+ width: 500rpx;
664
+
665
+ image{
666
+ width: 100%;
667
+ }
668
+ }
639
669
  .status_tip{
640
670
  color: #06bc85;
641
671
  margin-top: 32rpx;
@@ -659,7 +689,7 @@
659
689
  text-align: center;
660
690
  }
661
691
  }
662
-
692
+
663
693
  .align-center{
664
694
  display: flex;
665
695
  align-items: center;
@@ -734,7 +764,7 @@
734
764
  }
735
765
  .uni-easyinput__content-input{
736
766
  font-size: 24rpx;
737
-
767
+
738
768
  .uni-easyinput__placeholder-class{
739
769
  font-size: 24rpx;
740
770
  }
@@ -746,7 +776,7 @@
746
776
  font-size: 24rpx !important;
747
777
  border: none !important;
748
778
  }
749
-
779
+
750
780
  }
751
781
  .description{
752
782
  color: #666666;
@@ -44,17 +44,18 @@
44
44
  cursor: pointer;
45
45
  position: absolute;
46
46
  right: unit(0, rpx);
47
- top: unit(-52, rpx);
47
+ top: unit(0, rpx);
48
48
  height: unit(50, rpx);
49
- line-height: unit(50, rpx);
49
+ z-index: 100;
50
50
  display: flex;
51
51
  justify-content: center;
52
52
  align-items: center;
53
- background: rgba(0, 0, 0, .6);
54
- border-radius: unit(10, rpx);
53
+ background: rgba(0, 0, 0, .4);
54
+ border-radius: 0 0 0 20rpx;
55
55
  box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
56
56
  color: #fff;
57
57
  font-size: unit(22, rpx);
58
+ padding: 0 6rpx 0 6px;
58
59
 
59
60
  &-icon{
60
61
  padding: 0 unit(20, rpx);
@@ -595,6 +595,9 @@
595
595
  this.tempRange.before = this.cale.multipleStatus.before
596
596
  this.tempRange.after = this.cale.multipleStatus.after
597
597
  }
598
+ if(this.hasTime && !this.time) {
599
+ this.time = getTime(new Date(), this.hideSecond)
600
+ }
598
601
  this.change()
599
602
  },
600
603
  changeMonth(type) {
@@ -8,7 +8,7 @@ module.exports = [
8
8
  {
9
9
  mapFnName: 'getSaasFormList',
10
10
  title: '获取问卷列表',
11
- path: '/saas-app/v1/sms-form',
11
+ path: '/forms/v1/sms-form',
12
12
  isRule: false,
13
13
  params: {
14
14
  page_token: ['当前页', 'Number', '必选'],
@@ -7,6 +7,17 @@ export default {
7
7
  style: [],
8
8
  content: (data) => {
9
9
  return [
10
+ {
11
+ label: "表单所属业务",
12
+ ele: "xd-radio",
13
+ valueKey: "bucket",
14
+ value: data['bucket'] || 'default',
15
+ groupKey:'content',
16
+ list: [
17
+ { label: "加盟商营销", value: "default"},
18
+ { label: 'saas系统', value: 'saas'}
19
+ ]
20
+ },
10
21
  {
11
22
  label: "列表外边距设置",
12
23
  groupKey:'style',
@@ -64,6 +75,18 @@ export default {
64
75
  },
65
76
  inline: false,
66
77
  },
78
+ {
79
+ label: "问答详情跳转路径",
80
+ ele: 'xd-select-pages-path',
81
+ valueKey: 'qaDetailPath',
82
+ groupKey:'advanced',
83
+ placeholder: '请选择问卷详情跳转路径',
84
+ value: data['qaDetailPath'] || null,
85
+ setting: {
86
+ router: XdBus.getParentApi('getPagesTree'),
87
+ },
88
+ inline: false,
89
+ },
67
90
  ].filter(i=>i)
68
91
  },
69
92
  advanced: [],
@@ -10,16 +10,18 @@
10
10
  :class="{ editx : isEditx && active }"
11
11
  v-if="isEditx && active"
12
12
  >
13
- <view class="jfb-forms-list__edit-icon" @click="delEdit">删除</view>
13
+ <view class="jfb-forms-list__edit-icon" @click.stop="delEdit">
14
+ <xd-font-icon icon="iconshanchu-01" color="#fff" size="30"></xd-font-icon>
15
+ </view>
14
16
  </view>
15
17
  <!-- #endif -->
16
18
  <view class="jfb-forms-list__body">
17
- <view class="activity_list_wrap" :style="listWrapBoxStyle">
18
- <view class="activity_list">
19
+ <view v-if="loaded" class="activity_list_wrap" :style="listWrapBoxStyle">
20
+ <view class="activity_list" v-if="list.length">
19
21
  <view class="activity_item"
20
22
  v-for="(item,i) in list" :key="item.id"
21
23
  :style="listItemBoxStyle"
22
- @click="toDetail(item.form_id)"
24
+ @click="toDetail(item)"
23
25
  >
24
26
  <view class="item_img">
25
27
  <image :src="item.cover" mode="aspectFill"></image>
@@ -31,6 +33,10 @@
31
33
  </view>
32
34
  </view>
33
35
  </view>
36
+ <view v-else class="empty_data" style="display: flex;align-items: center;justify-content: center;">
37
+ <image class="empty_image" :src="emptyImage" mode="widthFix"></image>
38
+ <view class="empty_text">暂无活动</view>
39
+ </view>
34
40
  </view>
35
41
  </view>
36
42
  </view>
@@ -59,12 +65,16 @@
59
65
  list: [],
60
66
  next_page_token: "",
61
67
  hasNext: true,
68
+ loaded: false,
69
+ emptyImage: getServiceUrl('/common/empty/qa.png'),
62
70
 
63
71
  //todo
64
72
  listMargin: {},
65
73
  listPadding: {},
66
74
  itemRadius: 0,
67
75
  detailPath: "",
76
+ bucket: "default",
77
+ qaDetailPath: "",
68
78
  }
69
79
  },
70
80
  computed: {
@@ -113,17 +123,21 @@
113
123
  this.listMargin = getContainerPropsValue(container, 'content.listMargin', {});
114
124
  this.listPadding = getContainerPropsValue(container, 'content.listPadding', {});
115
125
  this.itemRadius = getContainerPropsValue(container, 'content.itemRadius', 0);
126
+ this.bucket = getContainerPropsValue(container, 'content.bucket', 'default');
116
127
  this.detailPath = getContainerPropsValue(container, 'content.detailPath', {value: ""}).value;
128
+ this.qaDetailPath = getContainerPropsValue(container, 'content.qaDetailPath', {value: ""}).value;
117
129
  },
118
130
  getList(){
119
131
  let data = {
120
132
  page_token: this.page_token+'',
121
- page_size: this.page_size
133
+ page_size: this.page_size,
134
+ bucket: this.bucket
122
135
  }
123
136
  jfbRootExec("getSaasFormList", {
124
137
  vm: this,
125
138
  data: data
126
139
  }).then(res => {
140
+ this.loaded = true;
127
141
  let list = res.list.map(item => {
128
142
  item['cover'] = getServiceUrl(item.cover);
129
143
  item["start_time"] = this.$xdUniHelper.getDate(item["start_time"] * 1000).fullDate;
@@ -139,10 +153,17 @@
139
153
  this.hasNext = !!res.next_page_token;
140
154
  })
141
155
  },
142
- toDetail(form_id){
143
- this.$xdUniHelper.navigateTo({
156
+ toDetail(item){
157
+ let form_id = item.form_id;
158
+ if(item.base_type=='form'){
159
+ this.$xdUniHelper.navigateTo({
144
160
  url: this.detailPath + `?form_id=${form_id}`
145
161
  })
162
+ }else{
163
+ this.$xdUniHelper.navigateTo({
164
+ url: this.qaDetailPath + `?form_id=${form_id}`
165
+ })
166
+ }
146
167
  },
147
168
  onJfbScroll(options) {
148
169
  console.log('event.onJfbScroll', options)
@@ -179,6 +200,20 @@
179
200
 
180
201
  .jfb-forms-list {
181
202
  &__body{
203
+ .empty_data{
204
+ display: flex;
205
+ flex-direction: column;
206
+ }
207
+ .empty_image{
208
+ width: 500rpx;
209
+ margin: 50rpx auto;
210
+ }
211
+ .empty_text{
212
+ color: #666666;
213
+ font-size: 28rpx;
214
+
215
+ }
216
+
182
217
  .activity_item{
183
218
  background-color: #FFF;
184
219
  padding: 24rpx;
@@ -44,17 +44,18 @@
44
44
  cursor: pointer;
45
45
  position: absolute;
46
46
  right: unit(0, rpx);
47
- top: unit(-52, rpx);
47
+ top: unit(0, rpx);
48
48
  height: unit(50, rpx);
49
- line-height: unit(50, rpx);
49
+ z-index: 100;
50
50
  display: flex;
51
51
  justify-content: center;
52
52
  align-items: center;
53
- background: rgba(0, 0, 0, .6);
54
- border-radius: unit(10, rpx);
53
+ background: rgba(0, 0, 0, .4);
54
+ border-radius: 0 0 0 20rpx;
55
55
  box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
56
56
  color: #fff;
57
57
  font-size: unit(22, rpx);
58
+ padding: 0 6rpx 0 6px;
58
59
 
59
60
  &-icon{
60
61
  padding: 0 unit(20, rpx);
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ /**
3
+ * @description 接口配置,
4
+ * 在设置方法名字当时候,别忘记加上【模块名字】:Qa
5
+ * @type {*[]}
6
+ */
7
+ module.exports = [
8
+ {
9
+ mapFnName: 'getFormContentResult',
10
+ title: '获取问卷结果',
11
+ path: '/forms/v1/sms-form-content/:form_id',
12
+ isRule: false,
13
+ params: {
14
+ form_id: ['form_id', '表单ID', 'string'],
15
+ },
16
+ isConsole: true,
17
+ disabled: true,
18
+ },
19
+ ];
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
5
+ */
6
+ export default {
7
+ style: [],
8
+ content: (data) => {
9
+ return [
10
+ {
11
+ label: "返回首页跳转路径",
12
+ ele: 'xd-select-pages-path',
13
+ valueKey: 'returnHomePath',
14
+ groupKey:'advanced',
15
+ placeholder: '请选择返回首页跳转路径',
16
+ value: data['returnHomePath'] || null,
17
+ setting: {
18
+ router: XdBus.getParentApi('getPagesTree'),
19
+ },
20
+ inline: false,
21
+ },
22
+ ].filter(i=>i)
23
+ },
24
+ advanced: [],
25
+ };
@@ -0,0 +1,453 @@
1
+ <template>
2
+ <view
3
+ class="jfb-forms-qa-result"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx : isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-forms-qa-result__edit"
10
+ :class="{ editx : isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-forms-qa-result__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-result__body" :style="{
19
+ '--main-color': mainColor,
20
+ '--main-color-alpha': mainColorAlpha,
21
+ }">
22
+ <view class="qa_result_box">
23
+ <view class="result_tt">答对提数</view>
24
+ <view class="result_num">{{ right_number }}</view>
25
+ <view class="result_total">共{{ formList.length }}道题</view>
26
+ <view class="btn_wrap">
27
+ <view class="btn" @click="toHomePage">返回首页</view>
28
+ <view v-if="is_show_error_answer_analysis==='Y'" class="btn primary" @click="isShowAnalysis=true">答案解析</view>
29
+ </view>
30
+ </view>
31
+
32
+ <template v-if="isShowAnalysis">
33
+ <view class="analysis_head">
34
+ <view class="_left">答案解析</view>
35
+ <view class="_right" :class="{active: isOnlyError}" @click="isOnlyError=!isOnlyError">
36
+ <xd-radio :value="isOnlyError" :width="40" :height="40" :iconSize="18" :isClickEvent="false"></xd-radio>
37
+ 仅看错题
38
+ </view>
39
+ </view>
40
+
41
+ <view class="analysis_body">
42
+ <view class="analysis_title">
43
+ <view class="_left">选择题</view>
44
+ <view class="_right">共{{ formList.length }}题</view>
45
+ </view>
46
+ <view class="qa_list">
47
+ <view class="qa_item" v-for="(item,i) in showFormList" :key="item.field_id">
48
+ <view class="qa_type">【{{item.field_type_name}}】</view>
49
+ <view class="qa_title">{{ item.key }}.{{ item.field_name }}</view>
50
+ <view class="answer_list">
51
+ <view class="answer_item"
52
+ v-for="ans in item.options"
53
+ :key="ans.value"
54
+ :class="{
55
+ a_right : ans.is_checked,
56
+ }"
57
+ >
58
+ {{ans.abc}} {{ ans.label }}
59
+ <!-- <view v-if="ans.is_error" class="err_tip">
60
+ <xd-font-icon icon="iconguanbi" size="32" color="#FF7063"></xd-font-icon>
61
+ </view> -->
62
+ </view>
63
+ <!-- <view class="answer_item a_error a_right">ASF3244</view> -->
64
+ </view>
65
+ <view class="qa_explain">
66
+ <view class="answer_right">
67
+ <view class="flex-center">
68
+ <xd-font-icon v-if="item.isRight" icon="icondui_fill" size="32" :color="mainColor" style="margin-right: 6rpx;"></xd-font-icon>
69
+ <xd-font-icon v-else icon="iconshibai" size="32" color="#FF7063" style="margin-right: 6rpx;"></xd-font-icon>
70
+ {{ item.isRight ? '回答正确' : '回答错误' }}
71
+ </view>
72
+ <view class="is_right">正确答案: {{ item.answer_right_abc }}</view>
73
+ </view>
74
+ <view v-if="!item.isRight && item.answer_analysis" class="answer_analysis">
75
+ <view class="_title">
76
+ <xd-font-icon icon="icondanghang" size="32" style="margin-right: 6rpx;"></xd-font-icon>
77
+ 答案解析</view>
78
+ <view class="_content">{{ item.answer_analysis }}</view>
79
+ </view>
80
+ </view>
81
+ </view>
82
+ </view>
83
+ </view>
84
+ <view class="to_top_wrap">
85
+ <view class="to_top" @click="scrollToTop">返回顶部</view>
86
+ </view>
87
+ </template>
88
+ </view>
89
+ </view>
90
+ </template>
91
+
92
+ <script>
93
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
94
+ import XdButton from "@/components/XdButton/XdButton";
95
+ import XdRadio from "@/components/XdRadio/XdRadio"
96
+ import { jfbRootExec } from "@/utils/xd.event";
97
+ import JfbFormsQaResultMixin from "./JfbFormsQaResultMixin";
98
+ import { getContainerPropsValue } from "@/utils/xd.base";
99
+ import componentsMixins from "@/mixins/componentsMixins";
100
+ import extsMixins from "@/mixins/extsMixins";
101
+ import Color from "color"
102
+ export default {
103
+ name: "JfbFormsQaResult",
104
+ components: {
105
+ XdFontIcon,
106
+ XdButton,
107
+ XdRadio
108
+ },
109
+ mixins: [
110
+ componentsMixins, extsMixins, JfbFormsQaResultMixin
111
+ ],
112
+ data() {
113
+ return {
114
+ mainColorAlpha: "",
115
+ form_id: "",
116
+ main_content_id: "",
117
+ formList: [],
118
+ right_number: 0,
119
+
120
+ isShowAnalysis: false, //是否显示解析
121
+ isOnlyError: false, //是否只看错题
122
+
123
+ is_show_error_answer_analysis: "", //创建表单是创建的是否展示错误答案解析Y/N
124
+ //todo
125
+
126
+ returnHomePath: "",
127
+ }
128
+ },
129
+ computed: {
130
+ showFormList(){
131
+ return this.isOnlyError ? this.formList.filter(item => !item.isRight) : this.formList;
132
+ }
133
+ },
134
+ watch: {
135
+ container(value, oldValue) {
136
+ if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
137
+ if (this.$configProject['isPreview']) this.init(value)
138
+ },
139
+ },
140
+ created() {
141
+ this.init(this.container);
142
+ this.mainColorAlpha = Color(this.mainColor).alpha(0.15).toString();
143
+ //todo
144
+ },
145
+ methods: {
146
+ onJfbLoad(options) {
147
+ this.form_id = options.form_id;
148
+ this.main_content_id = options.main_content_id;
149
+
150
+ jfbRootExec("getFormContentResult",{
151
+ vm: this,
152
+ data:{
153
+ form_id: this.form_id,
154
+ main_content_id: this.main_content_id
155
+ }
156
+ }).then(res => {
157
+ let abc = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'];
158
+ let fileTypes = {
159
+ 'radio': '单选',
160
+ 'checkbox': '多选'
161
+ }
162
+ this.is_show_error_answer_analysis = res.is_show_error_answer_analysis;
163
+ this.formList = res.list.map((item, index) => {
164
+ let defaultValue = JSON.parse(item.default);
165
+ item.rightValue = item.answer;
166
+ item.isRight = this.isSameArray(defaultValue, item.answer);
167
+ item.field_type_name = fileTypes[item.field_type];
168
+ item.key = index + 1;
169
+
170
+ item.options = item.options.map((ans, i) => {
171
+ ans['is_checked'] = defaultValue.includes(ans.value);
172
+ // ans['is_error'] = item.answer.includes(ans.value) && !item.rightValue.includes(ans.value);
173
+ // ans['is_right'] = item.answer.includes(ans.value);
174
+ ans['abc'] = abc[i];
175
+ return ans;
176
+ })
177
+ item['answer_right_abc'] = this.getRightAbc(item);
178
+
179
+ return item;
180
+ });
181
+ this.right_number = res.right_number;
182
+ })
183
+
184
+ },
185
+ /**
186
+ * @description 监听事件变化
187
+ * @param container {object} 业务组件对象自己
188
+ */
189
+ init(container) {
190
+ this.returnHomePath = getContainerPropsValue(container, 'content.returnHomePath', {value: ''}).value;
191
+ },
192
+ toHomePage(){
193
+ this.$xdUniHelper.navigateTo({
194
+ url: this.returnHomePath
195
+ })
196
+ },
197
+ //判断两个包含数组是否相同
198
+ isSameArray(arr1, arr2){
199
+ if(arr1.length != arr2.length) return false;
200
+ for (let i = 0; i < arr1.length; i++) {
201
+ if(!arr2.includes(arr1[i])){
202
+ return false;
203
+ }
204
+ }
205
+ return true;
206
+ },
207
+ getRightAbc(item){
208
+ return item.options.filter((ans) => {
209
+ return item.answer.includes(ans.value)
210
+ }).map(item => item.abc).join(",")
211
+ },
212
+ scrollToTop(){
213
+ uni.pageScrollTo({
214
+ scrollTop: 0,
215
+ })
216
+ },
217
+ onJfbScroll(options) {
218
+ // console.log('event.onJfbScroll', options)
219
+ },
220
+ onJfbReachBottom(options) {
221
+ console.log('event.onJfbReachBottom', options)
222
+ },
223
+ onJfbShow(options) {
224
+ console.log('event.onJfbShow', options)
225
+ },
226
+ onJfbHide(options) {
227
+ console.log('event.onJfbHide', options)
228
+ },
229
+ onJfbBack(options) {
230
+ console.log('event.onJfbBack', options)
231
+ },
232
+ onJfbUpdate(...data) {
233
+ console.log('event.onJfbUpdate', data)
234
+ },
235
+ onJfbCustomEvent(options) {
236
+ console.log('event.onJfbReachBottom', options)
237
+ },
238
+ }
239
+ }
240
+
241
+ </script>
242
+
243
+ <style scoped lang="less">
244
+ @import "./JfbFormsQaResultLess.less";
245
+
246
+ .jfb-forms-qa-result {
247
+ &__body{
248
+ padding: 0 0 40rpx;
249
+ font-size: 28rpx;
250
+ .qa_result_box{
251
+ display: flex;
252
+ flex-direction: column;
253
+ align-items: center;
254
+ background-color: #FFFFFF;
255
+ margin-bottom: 20rpx;
256
+ padding: 48rpx;
257
+ .result_tt{
258
+ color: var(--main-color);
259
+ font-size: 32rpx;
260
+ font-weight: 400;
261
+ }
262
+ .result_num{
263
+ color: var(--main-color);
264
+ font-size: 160rpx;
265
+ font-weight: 700;
266
+ }
267
+ .result_total{
268
+ color: #AAAAAA;
269
+ font-weight: 400;
270
+ font-size: 28rpx;
271
+ }
272
+ .btn_wrap{
273
+ display: flex;
274
+ margin-top: 28rpx;
275
+ justify-content: center;
276
+ .btn{
277
+ width: 230rpx;
278
+ height: 88rpx;
279
+ display: flex;
280
+ align-items: center;
281
+ justify-content: center;
282
+ border-radius: 16rpx;
283
+ background: #F0F0F0;
284
+ color: #AAAAAA;
285
+ font-size: 28rpx;
286
+ &.primary{
287
+ background: var(--main-color-alpha);
288
+ color: var(--main-color);
289
+ }
290
+
291
+ & + .btn{
292
+ margin-left: 60rpx;
293
+ }
294
+ }
295
+ }
296
+ }
297
+ .analysis_head{
298
+ display: flex;
299
+ align-items: center;
300
+ justify-content: space-between;
301
+ background-color: #FFFFFF;
302
+ margin-bottom: 20rpx;
303
+ padding: 24rpx 40rpx;
304
+ ._left{
305
+ color: #666666;
306
+ font-size: 28rpx;
307
+ }
308
+ ._right{
309
+ // border: 1px solid #666666;
310
+ // padding: 14rpx 24rpx;
311
+ border-radius: 12rpx;
312
+ color: #666666;
313
+ font-size: 24rpx;
314
+ display: flex;
315
+ align-items: center;
316
+
317
+ &.active{
318
+ // border: 1px solid var(--main-color);
319
+ color: var(--main-color);
320
+ }
321
+ }
322
+ }
323
+ .analysis_body{
324
+ .analysis_title{
325
+ display: flex;
326
+ align-items: center;
327
+ justify-content: space-between;
328
+ border-bottom: 1px solid #EEEEEE;
329
+ padding: 24rpx 40rpx;
330
+ background-color: #FFFFFF;
331
+ ._left{
332
+ color: #666666;
333
+ font-size: 28rpx;
334
+ font-weight: 400;
335
+ position: relative;
336
+ padding-left: 20rpx;
337
+ &::before{
338
+ position: absolute;
339
+ content: ' ';
340
+ width: 6rpx;
341
+ height: 32rpx;
342
+ background: var(--main-color);
343
+ left: 0;
344
+ top: 50%;
345
+ transform: translate(0, -50%);
346
+ border-radius: 2rpx;
347
+ }
348
+ }
349
+ ._right{
350
+ font-size: 24rpx;
351
+ color: #CCCCCC;
352
+ font-weight: 400
353
+ }
354
+ }
355
+ .qa_list{
356
+ .qa_item{
357
+ background-color: #FFFFFF;
358
+ padding: 40rpx;
359
+ margin-bottom: 20rpx;
360
+
361
+ .qa_type{
362
+ background: var(--main-color-alpha);
363
+ color: var(--main-color);
364
+ font-size: 20rpx;
365
+ font-weight: 400;
366
+ display: inline-block;
367
+ padding: 4rpx;
368
+ border-radius: 8rpx;
369
+ margin-bottom: 16rpx;
370
+ }
371
+ .qa_title{
372
+ color: #666666;
373
+ font-weight: 400;
374
+ }
375
+
376
+ .answer_list{
377
+ .answer_item{
378
+ background: #F7F7F7;
379
+ padding: 16rpx 32rpx;
380
+ border-radius: 12rpx;
381
+ margin: 24rpx 0;
382
+ color: #666666;
383
+ font-size: 28rpx;
384
+ font-weight: 400;
385
+ position: relative;
386
+ .err_tip{
387
+ position: absolute;
388
+ right: 32rpx;
389
+ top: 16rpx;
390
+ }
391
+
392
+ &.a_right{
393
+ color: #FFFFFF;
394
+ background: var(--main-color);
395
+ }
396
+ // &.a_error{
397
+ // color: #FF7063;
398
+ // background: #FFE3E0;
399
+ // }
400
+ }
401
+ }
402
+ .qa_explain{
403
+ .answer_right{
404
+ display: flex;
405
+ align-items: center;
406
+ justify-content: space-between;
407
+ padding: 0 24rpx;
408
+ margin-top: 36rpx;
409
+
410
+ .flex-center{
411
+ display: flex;
412
+ align-items: center;
413
+ }
414
+
415
+ .is_right{
416
+ color: var(--main-color);
417
+ }
418
+ }
419
+ .answer_analysis{
420
+ color: var(--main-color);
421
+ background-color: var(--main-color-alpha);
422
+ margin-top: 36rpx;
423
+ padding: 24rpx;
424
+ border-radius: 12rpx;
425
+ ._title{
426
+ font-size: 28rpx;
427
+ display: flex;
428
+ align-items: center;
429
+ }
430
+ ._content{
431
+ font-size: 26rpx;
432
+ padding-left: 42rpx;
433
+ margin-top: 16rpx;
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }
439
+ }
440
+
441
+ .to_top_wrap{
442
+ display: flex;
443
+ justify-content: center;
444
+ .to_top{
445
+ padding: 16rpx 40rpx;
446
+ border-radius: 50rpx;
447
+ background: #F0F0F0;
448
+ color: #A6A6A6;
449
+ }
450
+ }
451
+ }
452
+ }
453
+ </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-result {
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-result {
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-result'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+
5
+ }
@@ -7,7 +7,30 @@ export default {
7
7
  style: [],
8
8
  content: (data) => {
9
9
  return [
10
-
10
+ {
11
+ label: "问卷结果跳转路径",
12
+ ele: 'xd-select-pages-path',
13
+ valueKey: 'qaResultPath',
14
+ groupKey:'advanced',
15
+ placeholder: '请选择问卷详情跳转路径',
16
+ value: data['qaResultPath'] || null,
17
+ setting: {
18
+ router: XdBus.getParentApi('getPagesTree'),
19
+ },
20
+ inline: false,
21
+ },
22
+ {
23
+ label: "问卷列表跳转路径",
24
+ ele: 'xd-select-pages-path',
25
+ valueKey: 'qaListPath',
26
+ groupKey:'advanced',
27
+ placeholder: '请选择问卷详情跳转路径',
28
+ value: data['qaListPath'] || null,
29
+ setting: {
30
+ router: XdBus.getParentApi('getPagesTree'),
31
+ },
32
+ inline: false,
33
+ },
11
34
  ].filter(i=>i)
12
35
  },
13
36
  advanced: [],
@@ -10,12 +10,15 @@
10
10
  :class="{ editx : isEditx && active }"
11
11
  v-if="isEditx && active"
12
12
  >
13
- <view class="jfb-forms-question-and-answer__edit-icon" @click="delEdit">删除</view>
13
+ <view class="jfb-forms-question-and-answer__edit-icon" @click.stop="delEdit">
14
+ <xd-font-icon icon="iconshanchu-01" color="#fff" size="30"></xd-font-icon>
15
+ </view>
14
16
  </view>
15
17
  <!-- #endif -->
16
18
  <view class="jfb-forms-question-and-answer__body" :style="{
17
19
  '--main-color': mainColor,
18
20
  '--main-color-alpha': mainColorAlpha,
21
+ 'min-height': layoutInfo.bodyMinHeight
19
22
  }">
20
23
  <view v-if="loaded">
21
24
  <view v-if="form_status === 'content'">
@@ -30,6 +33,7 @@
30
33
  <view v-if="curQA" class="qa_content">
31
34
  <view class="qa_type">【{{qaType}}】</view>
32
35
  <view class="qa_question">{{ curIndex+1 }}.{{ curQA.field_name }}</view>
36
+ <view v-if="curQA.is_show_explain === 'Y' && curQA.explain" class="qa_explain">{{ curQA.explain }}</view>
33
37
  <view class="qa_answer">
34
38
  <view class="answer_column" v-for="o in curQA.options" :key="o.value"
35
39
  @click="handleCheck(o.value)"
@@ -43,7 +47,7 @@
43
47
  </view>
44
48
  </view>
45
49
  </view>
46
- <view v-if="qaResult" class="qa_result">
50
+ <!-- <view v-if="qaResult" class="qa_result">
47
51
  <view class="result_status" v-if="qaResult.right">
48
52
  <xd-font-icon class="icon_font" icon="iconzan_mian"></xd-font-icon> 恭喜您,回答正确!</view>
49
53
  <template v-else>
@@ -56,8 +60,7 @@
56
60
  <view class="ans_explain">{{ qaResult.explain }}</view>
57
61
  </view>
58
62
  </template>
59
-
60
- </view>
63
+ </view> -->
61
64
  <view class="bottom_fixed">
62
65
  <xd-button type="primary" :disabled="curIndex === 0"
63
66
  :style="[fixedButtonStyle]" @click="handlePrev">上一题</xd-button>
@@ -70,13 +73,20 @@
70
73
  <view class="status_tip">您已成功提交</view>
71
74
  <view class="status_name">{{ formName }}</view>
72
75
  <view class="status_btn_wrap">
73
- <view class="status_btn">关闭</view>
74
- <view class="status_btn" v-if="marketToolText"
76
+ <view class="status_btn" @click="doClose">关闭</view>
77
+ <view class="status_btn" v-if="marketToolText"
75
78
  style="background:#FE7A63;"
76
79
  @click="handleMarketToolBtn"
77
80
  >{{ marketToolText }}</view>
78
81
  </view>
79
82
  </view>
83
+ <view v-if="form_status === 'error'" class="form_status form_error">
84
+ <!-- <xd-font-icon icon="iconshibai" color="#ff5235" :size="64"></xd-font-icon> -->
85
+ <image class="empty_image" :src="emptyImage" mode="widthFix"></image>
86
+ <view class="status_tip error_tip" style="color: #333333;">{{ err_msg }}</view>
87
+ <!-- <view class="status_name">{{ formName }}</view> -->
88
+ <view class="status_btn" @click="toQaList" style="border-radius: 8rpx;margin-top: 100rpx;">返回列表</view>
89
+ </view>
80
90
  </view>
81
91
 
82
92
  </view>
@@ -94,6 +104,7 @@
94
104
  import componentsMixins from "@/mixins/componentsMixins";
95
105
  import extsMixins from "@/mixins/extsMixins";
96
106
  import Color from "color"
107
+ import getServiceUrl from '@/common/getServiceUrl'
97
108
  export default {
98
109
  name: "JfbFormsQuestionAndAnswer",
99
110
  components: {
@@ -111,10 +122,12 @@
111
122
  loaded: false,
112
123
  isPreview: false,
113
124
  form_status: "content",
125
+ err_msg: "",
114
126
  formName: "",
115
127
  marketing_tool: "",
116
128
  activity_page_url: "",
117
129
  activity_id: "",
130
+ emptyImage: getServiceUrl('/common/empty/qa.png'),
118
131
 
119
132
  value: [],
120
133
  qaValue: "",
@@ -124,6 +137,9 @@
124
137
 
125
138
  curIndex: 0,
126
139
  //todo
140
+
141
+ qaResultPath: "",
142
+ qaListPath: "",
127
143
  }
128
144
  },
129
145
  computed: {
@@ -210,8 +226,6 @@
210
226
  this.init(this.container);
211
227
  this.mainColorAlpha = Color(this.mainColor).alpha(0.15).string();
212
228
  this.isPreview = this.$configProject['isPreview'];
213
-
214
- //todo
215
229
  },
216
230
  methods: {
217
231
  onJfbLoad(options) {
@@ -238,6 +252,13 @@
238
252
  this.loaded = true;
239
253
  this.formList = res.list;
240
254
  this.formName = res.form_name;
255
+ this.err_msg = res.message;
256
+ if(res.message){
257
+ this.form_status = "error";
258
+ return;
259
+ }
260
+ }).catch(err => {
261
+ this.$xdHideLoading();
241
262
  })
242
263
  },
243
264
  /**
@@ -245,10 +266,8 @@
245
266
  * @param container {object} 业务组件对象自己
246
267
  */
247
268
  init(container) {
248
-
249
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
250
-
251
- //this.height = getContainerPropsValue(container, 'content.height', 10);
269
+ this.qaResultPath = getContainerPropsValue(container, 'content.qaResultPath', {value: ''}).value;
270
+ this.qaListPath = getContainerPropsValue(container, 'content.qaListPath', {value: ""}).value;
252
271
  },
253
272
  handlePrev(){
254
273
  if(this.curIndex > 0){
@@ -264,6 +283,15 @@
264
283
  this.curIndex++;
265
284
  }
266
285
  },
286
+ doClose(){
287
+ window.location.href = 'about:blank';
288
+ window.close();
289
+ },
290
+ toQaList(){
291
+ this.$xdUniHelper.redirectTo({
292
+ url: this.qaListPath
293
+ })
294
+ },
267
295
  p_submitQaForm(){
268
296
  uni.showModal({
269
297
  title: '提示',
@@ -275,7 +303,7 @@
275
303
  data: {
276
304
  form_id: this.form_id,
277
305
  contents: this.formList.map(item => {
278
- let content = Array.isArray(item.value) ? item.value : [item.value];
306
+ let content = Array.isArray(item.value) ? item.value : (item.value ? [item.value] : []);
279
307
  return {
280
308
  field_id: item.field_id,
281
309
  content: JSON.stringify(content)
@@ -283,13 +311,15 @@
283
311
  }),
284
312
  }
285
313
  }).then(res => {
286
- const { activity_id, marketing_tool, activity_page_url } = res;
314
+ const { activity_id, marketing_tool, activity_page_url, main_content_id } = res;
287
315
  this.marketing_tool = marketing_tool;
288
316
  this.activity_page_url = activity_page_url;
289
317
  this.activity_id = activity_id;
290
-
291
318
  // uni.showToast({title: '提交成功'});
292
319
  this.form_status = 'success';
320
+ this.$xdUniHelper.navigateTo({
321
+ url: this.qaResultPath + `?form_id=${this.form_id}&main_content_id=${main_content_id}`
322
+ })
293
323
  })
294
324
  }
295
325
  }
@@ -404,6 +434,11 @@
404
434
  margin-top: 16rpx;
405
435
  font-size: 28rpx;
406
436
  }
437
+ .qa_explain{
438
+ color: #808080;
439
+ font-size: 20rpx;
440
+ margin-top: 10rpx;
441
+ }
407
442
  .qa_answer{
408
443
  margin-top: 40rpx;
409
444
  font-size: 28rpx;
@@ -469,6 +504,13 @@
469
504
  flex-direction: column;
470
505
  align-items: center;
471
506
  padding-top: 100rpx;
507
+ .empty_image{
508
+ width: 500rpx;
509
+
510
+ image{
511
+ width: 100%;
512
+ }
513
+ }
472
514
  .status_tip{
473
515
  color: #06bc85;
474
516
  margin-top: 32rpx;
@@ -44,17 +44,18 @@
44
44
  cursor: pointer;
45
45
  position: absolute;
46
46
  right: unit(0, rpx);
47
- top: unit(-52, rpx);
47
+ top: unit(0, rpx);
48
48
  height: unit(50, rpx);
49
- line-height: unit(50, rpx);
49
+ z-index: 100;
50
50
  display: flex;
51
51
  justify-content: center;
52
52
  align-items: center;
53
- background: rgba(0, 0, 0, .6);
54
- border-radius: unit(10, rpx);
53
+ background: rgba(0, 0, 0, .4);
54
+ border-radius: 0 0 0 20rpx;
55
55
  box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
56
56
  color: #fff;
57
57
  font-size: unit(22, rpx);
58
+ padding: 0 6rpx 0 6px;
58
59
 
59
60
  &-icon{
60
61
  padding: 0 unit(20, rpx);