jufubao-forms 1.0.0-beta9 → 1.0.2-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-forms",
3
- "version": "1.0.0-beta9",
3
+ "version": "1.0.2-beta1",
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: [],
@@ -102,12 +102,21 @@
102
102
  <xd-font-icon icon="iconchenggong" color="#06bc85" :size="64"></xd-font-icon>
103
103
  <view class="status_tip">您已成功提交</view>
104
104
  <view class="status_name">{{ formName }}</view>
105
- <view class="status_btn" @click="doClose">关闭</view>
105
+ <!-- <view class="status_btn" @click="doClose">关闭</view> -->
106
+ <view class="status_btn_wrap">
107
+ <view class="status_btn" @click="doClose">关闭</view>
108
+ <view class="status_btn" v-if="marketToolText"
109
+ style="background:#FE7A63;"
110
+ @click="handleMarketToolBtn"
111
+ >{{ marketToolText }}</view>
112
+ </view>
106
113
  </view>
107
114
  <view v-if="form_status === 'error'" class="form_status form_error">
108
- <xd-font-icon icon="iconshibai" color="#ff5235" :size="64"></xd-font-icon>
109
- <view class="status_tip error_tip">{{ err_msg }}</view>
110
- <view class="status_name">{{ formName }}</view>
115
+ <!-- <xd-font-icon icon="iconshibai" color="#ff5235" :size="64"></xd-font-icon> -->
116
+ <image class="empty_image" :src="emptyImage" mode="widthFix"></image>
117
+ <view class="status_tip error_tip" style="color: #333333;">{{ err_msg }}</view>
118
+ <!-- <view class="status_name">{{ formName }}</view> -->
119
+ <view class="status_btn" @click="toQaList" style="border-radius: 8rpx;margin-top: 100rpx;">返回列表</view>
111
120
  </view>
112
121
  </view>
113
122
 
@@ -159,6 +168,7 @@
159
168
  import componentsMixins from "@/mixins/componentsMixins";
160
169
  import extsMixins from "@/mixins/extsMixins";
161
170
  import { mapState } from "vuex";
171
+ import getServiceUrl from "@/common/getServiceUrl";
162
172
  export default {
163
173
  name: "JfbFormsDynamicForm",
164
174
  components: {
@@ -182,9 +192,14 @@
182
192
  return {
183
193
  formName: "",
184
194
  form: {},
195
+ marketing_tool: "",
196
+ activity_page_url: "",
197
+ activity_id: "",
198
+ foreign_id: "",
185
199
  dynamicFormList: [],
186
200
  renderForm: "renderForm",
187
201
  form_id: "",
202
+ foreign_id: "",
188
203
  isShowDialog: false,
189
204
  validImageAPIUrl: "",
190
205
  valid_token: "",
@@ -193,10 +208,12 @@
193
208
  err_msg: "",
194
209
  loaded: false,
195
210
  isPreview: false,
211
+ emptyImage: getServiceUrl('/common/empty/qa.png'),
196
212
 
197
213
  //面板
198
214
  submitPagePath: "",
199
215
  formBe: "1",
216
+ qaListPath: "",
200
217
  // description: "",
201
218
  }
202
219
  },
@@ -204,6 +221,15 @@
204
221
  ...mapState({
205
222
  brandInfo: state => state.brandInfo
206
223
  }),
224
+ marketToolText(){
225
+ let toolText = {
226
+ prize: '去抽奖',
227
+ coupon: '去领券',
228
+ walking: '健步走',
229
+ };
230
+ let btnText = toolText[this.marketing_tool];
231
+ return btnText ? btnText : '';
232
+ },
207
233
  bucket(){
208
234
  return this.formBe == 1 ? 'default' : 'saas';
209
235
  }
@@ -231,18 +257,26 @@
231
257
  });
232
258
  }
233
259
  this.form_id = options.form_id;
260
+ this.foreign_id = options.foreign_id;
234
261
  }else{
235
262
  this.form_id = 1;
236
263
  }
237
264
  let getFormFn = "getDynamicForm"; //加盟商营销动态表单fn
238
265
  // if(this.formBe == 2) getFormFn = "getSaasDynamicForm"
239
266
 
267
+ let activity_range = 2;
268
+ // #ifdef MP
269
+ activity_range = 4;
270
+ // #endif
271
+
240
272
  this.$xdShowLoading({});
241
273
  jfbRootExec(getFormFn, {
242
274
  vm: this,
243
275
  data: {
244
276
  form_id: this.form_id,
245
- bucket: this.bucket
277
+ bucket: this.bucket,
278
+ foreign_id: this.foreign_id,
279
+ activity_range: activity_range
246
280
  }
247
281
  }).then(res => {
248
282
  this.$xdHideLoading();
@@ -337,6 +371,17 @@
337
371
  getTimeFormat2(num) {
338
372
  return Number(num) < 10 ? "0" + num : num;
339
373
  },
374
+ handleMarketToolBtn(){
375
+ let url = this.checkUrlIsValid(this.activity_page_url);
376
+ if(url){
377
+ if(this.marketing_tool === 'prize') url = url + '?id=' + this.activity_id;
378
+ else if(this.marketing_tool === 'coupon') url = url + '?activity_id=' + this.activity_id;
379
+ else url = url + `?id=${this.activity_id}&activity_id=${this.activity_id}&foreign_id=${this.foreign_id}`;
380
+ this.$xdUniHelper.redirectTo({
381
+ url: url
382
+ })
383
+ }
384
+ },
340
385
  doCheckValidCode(){
341
386
  let token = this.valid_token;
342
387
  let valid_code = this.valid_code;
@@ -373,6 +418,7 @@
373
418
  init(container) {
374
419
  this.submitPagePath = getContainerPropsValue(container, 'content.submitPagePath', {value: ""}).value;
375
420
  this.formBe = getContainerPropsValue(container, 'content.formBe', '1');
421
+ this.qaListPath = getContainerPropsValue(container, 'content.qaListPath', {value: ""}).value;
376
422
  // this.description = getContainerPropsValue(container, 'content.description', "");
377
423
  },
378
424
  handleClearError(item){
@@ -423,9 +469,14 @@
423
469
  contents,
424
470
  form_id: this.form_id,
425
471
  bucket: this.bucket,
472
+ foreign_id: this.foreign_id
426
473
  }
427
474
  }).then(res => {
428
475
  this.$xdHideLoading();
476
+ this.marketing_tool = res.marketing_tool;
477
+ this.activity_page_url = res.activity_page_url;
478
+ this.activity_id = res.activity_id;
479
+ this.foreign_id = res.foreign_id;
429
480
  this.form_status = 'success';
430
481
  })
431
482
  },
@@ -611,6 +662,11 @@
611
662
  // window.location.href = 'about:blank';
612
663
  // window.close();
613
664
  },
665
+ toQaList(){
666
+ this.$xdUniHelper.redirectTo({
667
+ url: this.qaListPath
668
+ })
669
+ },
614
670
  onJfbScroll(options) {
615
671
  // console.log('event.onJfbScroll', options)
616
672
  },
@@ -648,6 +704,13 @@
648
704
  flex-direction: column;
649
705
  align-items: center;
650
706
  padding-top: 100rpx;
707
+ .empty_image{
708
+ width: 500rpx;
709
+
710
+ image{
711
+ width: 100%;
712
+ }
713
+ }
651
714
  .status_tip{
652
715
  color: #06bc85;
653
716
  margin-top: 32rpx;
@@ -660,6 +723,11 @@
660
723
  font-size: 32rpx;
661
724
  margin: 78rpx 0;
662
725
  }
726
+ .status_btn_wrap{
727
+ display: flex;
728
+ justify-content: center;
729
+ width: 80%;
730
+ }
663
731
  .status_btn{
664
732
  width: 80%;
665
733
  border-radius: 4px;
@@ -669,6 +737,9 @@
669
737
  height: 80rpx;
670
738
  line-height: 80rpx;
671
739
  text-align: center;
740
+ & + .status_btn{
741
+ margin-left: 32rpx;
742
+ }
672
743
  }
673
744
  }
674
745
 
@@ -18,6 +18,17 @@ export default {
18
18
  { label: 'saas系统', value: 'saas'}
19
19
  ]
20
20
  },
21
+ {
22
+ label: "表单类型",
23
+ ele: "xd-radio",
24
+ valueKey: "base_type",
25
+ value: data['base_type'] || '',
26
+ groupKey:'content',
27
+ list: [
28
+ { label: "员工调研", value: "form"},
29
+ { label: '知识竞赛', value: 'answer'}
30
+ ]
31
+ },
21
32
  {
22
33
  label: "列表外边距设置",
23
34
  groupKey:'style',
@@ -16,10 +16,10 @@
16
16
  </view>
17
17
  <!-- #endif -->
18
18
  <view class="jfb-forms-list__body">
19
- <view class="activity_list_wrap" :style="listWrapBoxStyle">
20
- <view class="activity_list">
19
+ <view v-if="loaded" class="activity_list_wrap" :style="listWrapBoxStyle">
20
+ <view class="activity_list" v-if="list.length">
21
21
  <view class="activity_item"
22
- v-for="(item,i) in list" :key="item.id"
22
+ v-for="(item,i) in list" :key="item.form_id"
23
23
  :style="listItemBoxStyle"
24
24
  @click="toDetail(item)"
25
25
  >
@@ -33,6 +33,10 @@
33
33
  </view>
34
34
  </view>
35
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>
36
40
  </view>
37
41
  </view>
38
42
  </view>
@@ -61,6 +65,8 @@
61
65
  list: [],
62
66
  next_page_token: "",
63
67
  hasNext: true,
68
+ loaded: false,
69
+ emptyImage: getServiceUrl('/common/empty/qa.png'),
64
70
 
65
71
  //todo
66
72
  listMargin: {},
@@ -69,6 +75,7 @@
69
75
  detailPath: "",
70
76
  bucket: "default",
71
77
  qaDetailPath: "",
78
+ base_type: "",
72
79
  }
73
80
  },
74
81
  computed: {
@@ -118,19 +125,28 @@
118
125
  this.listPadding = getContainerPropsValue(container, 'content.listPadding', {});
119
126
  this.itemRadius = getContainerPropsValue(container, 'content.itemRadius', 0);
120
127
  this.bucket = getContainerPropsValue(container, 'content.bucket', 'default');
128
+ this.base_type = getContainerPropsValue(container, 'content.base_type', '');
121
129
  this.detailPath = getContainerPropsValue(container, 'content.detailPath', {value: ""}).value;
122
130
  this.qaDetailPath = getContainerPropsValue(container, 'content.qaDetailPath', {value: ""}).value;
123
131
  },
124
132
  getList(){
133
+ let activity_show_terminal = 2;
134
+
135
+ // #ifdef MP
136
+ activity_show_terminal = 4;
137
+ // #endif
125
138
  let data = {
126
139
  page_token: this.page_token+'',
127
140
  page_size: this.page_size,
128
- bucket: this.bucket
141
+ bucket: this.bucket,
142
+ base_type: this.base_type,
143
+ activity_range: activity_show_terminal
129
144
  }
130
145
  jfbRootExec("getSaasFormList", {
131
146
  vm: this,
132
147
  data: data
133
148
  }).then(res => {
149
+ this.loaded = true;
134
150
  let list = res.list.map(item => {
135
151
  item['cover'] = getServiceUrl(item.cover);
136
152
  item["start_time"] = this.$xdUniHelper.getDate(item["start_time"] * 1000).fullDate;
@@ -193,6 +209,20 @@
193
209
 
194
210
  .jfb-forms-list {
195
211
  &__body{
212
+ .empty_data{
213
+ display: flex;
214
+ flex-direction: column;
215
+ }
216
+ .empty_image{
217
+ width: 500rpx;
218
+ margin: 50rpx auto;
219
+ }
220
+ .empty_text{
221
+ color: #666666;
222
+ font-size: 28rpx;
223
+
224
+ }
225
+
196
226
  .activity_item{
197
227
  background-color: #FFF;
198
228
  padding: 24rpx;
@@ -24,7 +24,10 @@
24
24
  <view class="result_num">{{ right_number }}</view>
25
25
  <view class="result_total">共{{ formList.length }}道题</view>
26
26
  <view class="btn_wrap">
27
- <view class="btn" @click="toHomePage">返回首页</view>
27
+ <view v-if="marketToolText" class="btn primary"
28
+ style="background:#FE7A63;color:#FFFFFF;"
29
+ @click="handleMarketToolBtn">{{ marketToolText }}</view>
30
+ <view v-else class="btn" @click="toHomePage">返回首页</view>
28
31
  <view v-if="is_show_error_answer_analysis==='Y'" class="btn primary" @click="isShowAnalysis=true">答案解析</view>
29
32
  </view>
30
33
  </view>
@@ -117,6 +120,11 @@
117
120
  formList: [],
118
121
  right_number: 0,
119
122
 
123
+ marketing_tool: "",
124
+ activity_page_url: "",
125
+ activity_id: "",
126
+ foreign_id: "",
127
+
120
128
  isShowAnalysis: false, //是否显示解析
121
129
  isOnlyError: false, //是否只看错题
122
130
 
@@ -129,7 +137,16 @@
129
137
  computed: {
130
138
  showFormList(){
131
139
  return this.isOnlyError ? this.formList.filter(item => !item.isRight) : this.formList;
132
- }
140
+ },
141
+ marketToolText(){
142
+ let toolText = {
143
+ prize: '去抽奖',
144
+ coupon: '去领券',
145
+ walking: '健步走',
146
+ };
147
+ let btnText = toolText[this.marketing_tool];
148
+ return btnText ? btnText : '';
149
+ },
133
150
  },
134
151
  watch: {
135
152
  container(value, oldValue) {
@@ -179,6 +196,10 @@
179
196
  return item;
180
197
  });
181
198
  this.right_number = res.right_number;
199
+ this.marketing_tool = res.marketing_tool;
200
+ this.activity_page_url = res.activity_page_url;
201
+ this.activity_id = res.activity_id;
202
+ this.foreign_id = res.foreign_id;
182
203
  })
183
204
 
184
205
  },
@@ -189,6 +210,17 @@
189
210
  init(container) {
190
211
  this.returnHomePath = getContainerPropsValue(container, 'content.returnHomePath', {value: ''}).value;
191
212
  },
213
+ handleMarketToolBtn(){
214
+ let url = this.checkUrlIsValid(this.activity_page_url);
215
+ if(url){
216
+ if(this.marketing_tool === 'prize') url = url + '?id=' + this.activity_id;
217
+ else if(this.marketing_tool === 'coupon') url = url + '?activity_id=' + this.activity_id;
218
+ else url = url + `?id=${this.activity_id}&activity_id=${this.activity_id}&foreign_id=${this.foreign_id}`;
219
+ this.$xdUniHelper.navigateTo({
220
+ url: url
221
+ })
222
+ }
223
+ },
192
224
  toHomePage(){
193
225
  this.$xdUniHelper.navigateTo({
194
226
  url: this.returnHomePath
@@ -61,7 +61,7 @@
61
61
  </view>
62
62
  </template>
63
63
  </view> -->
64
- <view class="bottom_fixed">
64
+ <view class="bottom_fixed" :style="fixedBottom">
65
65
  <xd-button type="primary" :disabled="curIndex === 0"
66
66
  :style="[fixedButtonStyle]" @click="handlePrev">上一题</xd-button>
67
67
  <xd-button type="primary" :disabled="curQA.required && (!qaValue || qaValue.length === 0)"
@@ -119,6 +119,7 @@
119
119
  data() {
120
120
  return {
121
121
  form_id: '',
122
+ foreign_id: "",
122
123
  loaded: false,
123
124
  isPreview: false,
124
125
  form_status: "content",
@@ -143,6 +144,9 @@
143
144
  }
144
145
  },
145
146
  computed: {
147
+ fixedBottom(){
148
+ return this.fixedStyle({paddingBottom: 24, zIndex: 111})
149
+ },
146
150
  progressBarInnerStyle(){
147
151
  let width = ((this.curIndex + 1) / this.formList.length) * 100 + '%';
148
152
  return {
@@ -240,12 +244,19 @@
240
244
  this.form_id = '123';
241
245
  }else{
242
246
  this.form_id = options.form_id;
247
+ this.foreign_id = options.foreign_id;
243
248
  }
249
+ let activity_range = 2;
250
+ // #ifdef MP
251
+ activity_range = 4;
252
+ // #endif
244
253
  this.$xdShowLoading({});
245
254
  jfbRootExec("getDynamicForm", {
246
255
  vm: this,
247
256
  data: {
248
257
  form_id: this.form_id,
258
+ foreign_id: this.foreign_id,
259
+ activity_range: activity_range
249
260
  }
250
261
  }).then(res => {
251
262
  this.$xdHideLoading();
@@ -302,6 +313,7 @@
302
313
  vm: this,
303
314
  data: {
304
315
  form_id: this.form_id,
316
+ foreign_id: this.foreign_id,
305
317
  contents: this.formList.map(item => {
306
318
  let content = Array.isArray(item.value) ? item.value : (item.value ? [item.value] : []);
307
319
  return {
@@ -316,8 +328,8 @@
316
328
  this.activity_page_url = activity_page_url;
317
329
  this.activity_id = activity_id;
318
330
  // uni.showToast({title: '提交成功'});
319
- this.form_status = 'success';
320
- this.$xdUniHelper.navigateTo({
331
+ // this.form_status = 'success';
332
+ this.$xdUniHelper.redirectTo({
321
333
  url: this.qaResultPath + `?form_id=${this.form_id}&main_content_id=${main_content_id}`
322
334
  })
323
335
  })
@@ -329,9 +341,9 @@
329
341
  let url = this.checkUrlIsValid(this.activity_page_url);
330
342
  if(url){
331
343
  if(this.marketing_tool === 'prize') url = url + '?id=' + this.activity_id;
332
- if(this.marketing_tool === 'coupon') url = url + '?activity_id=' + this.activity_id;
333
- else url = url + `?id=${this.activity_id}&activity_id=${this.activity_id}`;
334
- this.$xdUniHelper.navigateTo({
344
+ else if(this.marketing_tool === 'coupon') url = url + '?activity_id=' + this.activity_id;
345
+ else url = url + `?id=${this.activity_id}&activity_id=${this.activity_id}&foreign_id=${this.foreign_id}`;
346
+ this.$xdUniHelper.redirectTo({
335
347
  url: url
336
348
  })
337
349
  }