jufubao-base 1.0.209-beta3 → 1.0.209-beta5

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-base",
3
- "version": "1.0.209-beta3",
3
+ "version": "1.0.209-beta5",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -17,12 +17,6 @@
17
17
  :style="{ height: layoutInfo.bodyMinHeightRpx + 'rpx' }"
18
18
  class="jfb-base-sweep__body"
19
19
  >
20
- <view
21
- :style="{ background: backgroundColor, color: warningColor }"
22
- class="jfb-base-sweep__body-pop"
23
- v-if="isPreview"
24
- >设置背景模式方便编辑(占位),在线上此模块不显</view
25
- >
26
20
  <view class="jfb-base-sweep__body-other" v-if="other">
27
21
  <view>
28
22
  <xd-font-icon
@@ -33,19 +27,15 @@
33
27
  <view class="jfb-base-sweep__body-other-text">无法识别该界面</view>
34
28
  </view>
35
29
  <view class="jfb-base-sweep__body-footer" :style="prod_bottom">
36
- <XdButton @click="scan" type="primary" radius="50rpx" width="50%"
37
- >重试</XdButton
38
- >
30
+ <xd-button @click="scan" type="primary" radius="50rpx" width="50%">重试</xd-button>
39
31
  </view>
40
32
  </view>
41
- <view class="jfb-base-sweep__body-other" v-if="show">
33
+ <view class="jfb-base-sweep__body-other" v-if="show || isPreview">
42
34
  <view>
43
35
  <image style="width: 500rpx;height:500rpx" src="https://img0.jufubao.cn/common/qrcode-dome.png?ver=1"></image>
44
36
  </view>
45
37
  <view class="jfb-base-sweep__body-footer" :style="prod_bottom">
46
- <XdButton @click="scan" type="primary" radius="50rpx" width="50%"
47
- >扫一扫</XdButton
48
- >
38
+ <xd-button @click="scan" type="primary" radius="50rpx" width="50%">扫一扫</xd-button>
49
39
  </view>
50
40
  </view>
51
41
  </view>
@@ -77,7 +67,8 @@ export default {
77
67
  backgroundColor: "",
78
68
  other: false,
79
69
  show: false,
80
- flag: true
70
+ flag: true,
71
+ isBack: false, //是否启动返回逻辑
81
72
  };
82
73
  },
83
74
  computed: {
@@ -118,6 +109,7 @@ export default {
118
109
  },
119
110
  methods: {
120
111
  onJfbLoad(options) {
112
+ this.isBack = options.isBack?options.isBack:false;
121
113
  if (!this.isPreview) {
122
114
  this.$xdShowLoading({
123
115
  isMask: true
@@ -133,6 +125,7 @@ export default {
133
125
  const matches = hostname.match(/[^.]+\.[^.]+$/);
134
126
  return matches ? matches[0] : hostname;
135
127
  },
128
+ //#ifdef H5
136
129
  handleH5() {
137
130
  // 判断jwxSDK是否为空
138
131
  if (this.jwxSDK !== null) {
@@ -200,7 +193,7 @@ export default {
200
193
  },
201
194
  // 扫描失败后的回调函数
202
195
  fail: (error) => {
203
- console.log(44444,'fail');
196
+ console.log(44444,'fail',error);
204
197
  this.other = false;
205
198
  this.show = true;
206
199
  // 如果error是字符串类型,则将其转换为对象类型
@@ -211,14 +204,22 @@ export default {
211
204
  // 调用$xdLog的setARMSError方法,记录错误信息
212
205
  this.$xdLog.setARMSError(error);
213
206
  },
214
- cancel: ()=>{
215
- console.log(44444,'fail');
207
+ cancel: (e)=>{
208
+ console.log(44444,'fail',e.errMsg);
216
209
  this.other = false;
217
210
  this.show = true;
211
+
212
+ //取消扫描并且需要返回页面时候调用
213
+ if(this.isBack && e.errMsg.indexOf(':cancel') !== -1) {
214
+ this.onJfbBack();
215
+ }
216
+
218
217
  }
219
218
  });
220
219
  }
221
220
  },
221
+ //#endif
222
+ //#ifdef MP-WEIXIN
222
223
  handleMP() {
223
224
  // 调用uni.scanCode方法,扫描二维码
224
225
  uni.scanCode({
@@ -244,6 +245,7 @@ export default {
244
245
  });
245
246
  return;
246
247
  }
248
+ //带pa参数出来
247
249
  if (queryobjArr["pa"]) {
248
250
  // 如果queryobjArr中有pa属性,则获取pa属性的值,并将其拼接到bind_url后面,然后使用navigateTo方法跳转到该路径
249
251
  let qrcode = encodeURIComponent(res.result)
@@ -277,14 +279,24 @@ export default {
277
279
  this.flag = false;
278
280
  },
279
281
  fail: (error) => {
280
- // 如果扫描失败,则调用$xdLog.setARMSError方法记录错误信息
281
- this.other = false;
282
- this.show = true;
283
- this.$xdLog.setARMSError(error);
282
+ //取消扫描并且需要返回页面时候调用
283
+ if(error.errMsg === 'scanCode:fail cancel') {
284
+ if(this.isBack) {
285
+ this.onJfbBack();
286
+ }
287
+ }
288
+ else {
289
+ this.$xdLog.setARMSError(error);
290
+ this.other = false;
291
+ this.show = true;
292
+ }
293
+
284
294
  }
285
295
  });
286
296
  },
297
+ //#endif
287
298
  scan() {
299
+ if(this.$configProject.isPreview) return;
288
300
  try {
289
301
  //#ifdef H5
290
302
  this.handleH5();
@@ -317,6 +329,10 @@ export default {
317
329
  }
318
330
  console.log("event.onJfbShow", options);
319
331
  },
332
+ onJfbBack(){
333
+ if(this.$configProject["isPreview"]) return;
334
+ this.$xdUniHelper.navigateBack();
335
+ }
320
336
  },
321
337
  };
322
338
  </script>