gxd-uni-library-editx 1.0.70 → 1.0.72

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": "gxd-uni-library-editx",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -35,7 +35,7 @@
35
35
  ></xd-unit>
36
36
  </view>
37
37
  </view>
38
-
38
+
39
39
  </view>
40
40
  <view
41
41
  class="ticket_list"
@@ -212,7 +212,7 @@ import {
212
212
  } from '@/utils/xd.base';
213
213
 
214
214
  export default {
215
- name: "XdCardPay",
215
+ name: "XdCardPayChose",
216
216
  components: {
217
217
  XdDownDrawer,
218
218
  XdButton,
@@ -278,7 +278,7 @@ export default {
278
278
  }
279
279
  this.$emit('update:show', n);
280
280
  this.$emit("onAlert");
281
-
281
+
282
282
  },
283
283
  orderTotalPrice: {
284
284
  handler(n){
@@ -346,7 +346,7 @@ export default {
346
346
  alert_bottom(){
347
347
  return this.fixedStyle({paddingBottom: 24, zIndex: 110})
348
348
  },
349
-
349
+
350
350
  },
351
351
  async created(){
352
352
  this.switchValidToken();
@@ -442,7 +442,7 @@ export default {
442
442
  });
443
443
  })
444
444
  },
445
-
445
+
446
446
  //选择卡券
447
447
  handlerTicketSelect(flat, ticket, options){
448
448
  if(flat){ //选择卡券,重新调用接口获取 selectedCardList, neePayPrice
@@ -513,7 +513,7 @@ export default {
513
513
  }
514
514
 
515
515
  },
516
-
516
+
517
517
  filterMGinfo(list){
518
518
  //深拷贝
519
519
  if(this.$xdUniHelper.checkVarType(list) === 'object'
@@ -528,7 +528,7 @@ export default {
528
528
  if (list.card_password) list.card_password = list.card_password.substr(0, 2) + '********' + list.card_password.substr(-3);
529
529
  return list;
530
530
  }
531
-
531
+
532
532
  //array
533
533
  return list.map(item => {
534
534
  if(item.card_use_certificate) item.card_use_certificate = item.card_use_certificate.substr(0, 2) + '********' + item.card_use_certificate.substr(-3);
@@ -537,7 +537,7 @@ export default {
537
537
  return item
538
538
  });
539
539
  },
540
-
540
+
541
541
  //添加新卡券
542
542
  addNewCard(options={}){
543
543
  const { cardForm, total_price, submitCardList } = this;
@@ -576,10 +576,10 @@ export default {
576
576
  res: resOptions
577
577
  },'add_card');
578
578
  this.$xdHideLoading();
579
-
579
+
580
580
  //成功回调
581
581
  let {selected_card_list=[], need_pay_price, is_need_pop, card_total_use_price} = res;
582
-
582
+
583
583
  if(is_need_pop){
584
584
  this.useCardPop(res).then((select_content) => {
585
585
  if(select_content) this.addNewCard({select_content});
@@ -594,7 +594,7 @@ export default {
594
594
  let filterCard = selected_card_list.filter(item => !r_cards.includes(item.card_number));
595
595
  //重合的卡券列表
596
596
  let repeatCardList = selected_card_list.filter(item => r_cards.includes(item.card_number));
597
-
597
+
598
598
  if(repeatCardList.length > 0){
599
599
  for(let i = 0; i < repeatCardList.length; i++){
600
600
  let repeatCard = repeatCardList[i];
@@ -833,7 +833,7 @@ export default {
833
833
  box-sizing: border-box;
834
834
  margin: 30rpx auto;
835
835
  font-size: 28rpx;
836
-
836
+
837
837
  .icon{
838
838
  width: 64rpx;
839
839
  height: 64rpx;
@@ -858,4 +858,4 @@ export default {
858
858
  }
859
859
  }
860
860
  }
861
- </style>
861
+ </style>
@@ -14,6 +14,12 @@
14
14
  </view>
15
15
  </template>
16
16
 
17
+ <script>
18
+ export default {
19
+ name:'XdCardV2Skeleton'
20
+ }
21
+ </script>
22
+
17
23
  <style lang="less" scoped>
18
24
  .skeleton-card-item {
19
25
  display: flex;
@@ -82,11 +82,14 @@
82
82
  ]),
83
83
  ...mapState({
84
84
  currentStyle:(state)=>{
85
- let style = {};
86
- Object.keys(state.currentStyle).map(key=>{
87
- style[`$${key}`] = state.currentStyle[key];
88
- });
89
- return style
85
+ if(state.currentStyle !== null) {
86
+ let style = {};
87
+ Object.keys(state.currentStyle).map(key=>{
88
+ style[`$${key}`] = state.currentStyle[key];
89
+ });
90
+ return style
91
+ }
92
+ return {}
90
93
  }
91
94
  })
92
95
 
@@ -166,10 +169,7 @@
166
169
  this.show = false;
167
170
  this.confirm = {}
168
171
  } else {
169
- this.$currentStyle = value.styles
170
- || (this.styleCommon && this.styleCommon.styles)
171
- || this.currentStyle ||
172
- (value.$vm && value.$vm.styles) || {};
172
+ this.$currentStyle = value.styles || this.styleCommon || this.currentStyle || (value.$vm && value.$vm.styles) || {};
173
173
  this.confirm = Object.assign({},
174
174
  this.$xdUniHelper.cloneDeep(this.defaultConfirm),
175
175
  value,
@@ -28,7 +28,12 @@
28
28
  </view>
29
29
  <view class="checklist-content" :class="{'list-content':mode === 'list' && icon ==='left'}">
30
30
  <text class="checklist-text" :style="item.styleIconText">
31
+ <!-- #ifdef h5 -->
31
32
  <slot :name="'a' +item.value" :text="item.text">{{item}}{{item[map.text]}}</slot>
33
+ <!-- #endif -->
34
+ <!-- #ifdef MP-WEIXIN -->
35
+ <slot name="a1" :text="item.text">{{item}}{{item[map.text]}}</slot>
36
+ <!-- #endif -->
32
37
  </text>
33
38
  <view
34
39
  v-if="mode === 'list' && icon === 'right'"
@@ -97,7 +102,7 @@
97
102
  * @value right 右侧显示
98
103
  * @event {Function} change 选中发生变化触发
99
104
  */
100
-
105
+
101
106
  import {
102
107
  getParentsStyle,
103
108
  } from '@/utils/xd.base';
@@ -217,7 +222,7 @@
217
222
  isLocal:true,
218
223
  styles: null,
219
224
  isTop:0,
220
-
225
+
221
226
  styleMainColor: '', //选中颜色
222
227
  };
223
228
  },
@@ -114,7 +114,7 @@
114
114
  <!--tabbar-->
115
115
  <view class="xd-Layout__footer-height" :style="{height: (bottomHeight + (isFooterSolt ? footerHeight: 110)) + 'rpx' }"></view>
116
116
  </view>
117
- <view v-if="websiteStatus === false" class="website-disable">
117
+ <view v-if="websiteStatus === false && this.mpSiteLoading" class="website-disable">
118
118
  <image src="//img.jufubao.cn/component/disabel_phone.png" mode="widthFix"></image>
119
119
  </view>
120
120
  <xd-confirm v-if="getLayoutInfo" :get-layout-info="getLayoutInfo"></xd-confirm>
@@ -267,7 +267,8 @@
267
267
  default(){
268
268
  return {}
269
269
  },
270
- }
270
+ },
271
+
271
272
  },
272
273
  data() {
273
274
  return {
@@ -276,6 +277,7 @@
276
277
  layoutLoading: false,
277
278
  startTime: new Date().getTime(),
278
279
  websiteStatus: null,
280
+ mpSiteLoading: true,
279
281
 
280
282
  startAnimation : false, //开始动画效果
281
283
  doneAnimation: false, //完成动画效果
@@ -510,9 +512,13 @@
510
512
  },
511
513
 
512
514
  created() {
515
+
513
516
  this.wiewType = this.$configProject.isPreview;
514
517
  this.systemInfoSyn = uni.getSystemInfoSync();
515
518
  this.gWindowHeight = uni.getSystemInfoSync().windowHeight;
519
+ // #ifdef MP-WEIXIN
520
+ this.mpSiteLoading = false;
521
+ // #endif
516
522
 
517
523
  //判断是否禁用
518
524
  if(this.wiewType) {
@@ -525,6 +531,7 @@
525
531
  if(!uni.getStorageSync('xd-max-window-height')) {
526
532
  uni.setStorageSync('xd-max-window-height', uni.getSystemInfoSync().windowHeight);
527
533
  }
534
+
528
535
  this.isConsole = !!this.$xdUniHelper.getParmater('is-console')
529
536
  uni.onWindowResize(()=>{
530
537
  this.gWindowHeight = uni.getSystemInfoSync().windowHeight;
@@ -318,7 +318,7 @@ class StyleForm {
318
318
  type: 'number',
319
319
  valueKey: borderWidth,
320
320
  value: data[borderWidth] || '',
321
- placeholder: '请输入边框颜色',
321
+ placeholder: '请输入边框大小',
322
322
  className: 'input80',
323
323
  },
324
324
  ].filter(i=>i).map(item=>{
@@ -812,6 +812,13 @@ class Helpers {
812
812
  }
813
813
 
814
814
  replacePathForDir(url){
815
+ //#ifndef H5
816
+ return url
817
+ //#endif
818
+
819
+
820
+
821
+ //#ifdef H5
815
822
  let siteDomain = `${window.location.protocol}//${window.location.host}`;
816
823
  let dir = '';
817
824
  if(store.state.brandInfo && store.state.brandInfo.deploy_dir) {
@@ -830,6 +837,7 @@ class Helpers {
830
837
  else return `${siteDomain}${url.replace(reg, '')}`;
831
838
  }
832
839
  return url;
840
+ //#endif
833
841
  }
834
842
 
835
843
  /**
@@ -209,12 +209,12 @@ export function handlePesponse(
209
209
  /**
210
210
  * @type {Vue}
211
211
  */
212
- let $vm = (getApp().globalData && getApp().globalData.$vm) || null;
212
+ let $vm = (getApp() && getApp().globalData && getApp().globalData.$vm) || null;
213
213
  let useTime = new Date().getTime() - request.start;
214
214
  let requestInfo = xdGetPesponseParams(request, response);
215
215
 
216
216
  //长连接(耗时连接)
217
- if (getApp().globalData
217
+ if (getApp() && getApp().globalData
218
218
  && getApp().globalData.$store
219
219
  && typeof getApp().saveLogs === 'function'
220
220
  && !checkNotLogs(request.options)
@@ -261,7 +261,7 @@ export function handlePesponse(
261
261
  }
262
262
 
263
263
  //记录错误日志
264
- if (typeof getApp().saveLogs === 'function'
264
+ if (getApp() && typeof getApp().saveLogs === 'function'
265
265
  && !checkNotLogs(request.options)
266
266
  ) {
267
267
  getApp().saveLogs(requestInfo, 'alert', 'ajax');
@@ -342,7 +342,7 @@ export function handlePesponse(
342
342
  }
343
343
 
344
344
  //记录错误日志
345
- if (typeof getApp().saveLogs === 'function'
345
+ if (getApp() && typeof getApp().saveLogs === 'function'
346
346
  && !checkNotLogs(request.options)
347
347
  ) {
348
348
  getApp().saveLogs(requestInfo, 'alert', 'ajax');
@@ -360,7 +360,7 @@ export function handlePesponse(
360
360
  }
361
361
 
362
362
  //记录错误日志
363
- if (typeof getApp().saveLogs === 'function'
363
+ if (getApp() && typeof getApp().saveLogs === 'function'
364
364
  && !checkNotLogs(request.options)
365
365
  ) {
366
366
  getApp().saveLogs(requestInfo, 'alert', 'ajax');
@@ -392,7 +392,7 @@ export function handlePesponse(
392
392
  //记录错误日志
393
393
  //statusCode === undefined 并且 忽略:.json静态文件和请求返沪时间小雨15秒的
394
394
  if(!uriIgnoreErrors(request.options.url, useTime)) {
395
- if (typeof getApp().saveLogs === 'function'
395
+ if (getApp() && typeof getApp().saveLogs === 'function'
396
396
  && !checkNotLogs(request.options)
397
397
  ) {
398
398
  getApp().saveLogs(requestInfo, 'alert', 'ajax');
@@ -402,7 +402,7 @@ export function handlePesponse(
402
402
 
403
403
  if (!$vm) {
404
404
  reject(response);
405
- throw new Error(message);
405
+ console.warn(message)
406
406
  } else {
407
407
  $vm.$xdHideLoading();
408
408
  reject(response);
@@ -5,7 +5,7 @@ import {runtime} from "@/common/runtime";
5
5
  const settings = require('./../../settings');
6
6
  const md5 = require('md5');
7
7
  import Vue from 'vue';
8
- import store from "@/store";
8
+ import store from "@/store/index";
9
9
  import {
10
10
  baseIsEmpty,
11
11
  baseJsDateToTime,
@@ -46,6 +46,22 @@ class Logs {
46
46
  return typeof uni.setStorageSync === 'function';
47
47
  }
48
48
 
49
+ setProject(pos, params){
50
+ console.warn(`${pos}:${JSON.stringify(params)}`)
51
+ }
52
+
53
+ getParams(data){
54
+ return {}
55
+ }
56
+
57
+ setARMSError(error){
58
+ console.error(error)
59
+ }
60
+
61
+ setARMSCustomError(name, errorObj){
62
+ console.error(JSON.stringify({name,errorObj}))
63
+ }
64
+
49
65
 
50
66
  checkApiHost() {
51
67
  if (typeof getApp !== 'function') return false;
@@ -0,0 +1,302 @@
1
+ 'use strict';
2
+ import {Base64} from 'js-base64';
3
+ import {runtime} from "@/common/runtime";
4
+
5
+ const settings = require('./../../settings');
6
+ const md5 = require('md5');
7
+ import Vue from 'vue';
8
+ import store from "@/store";
9
+ import {
10
+ baseIsEmpty,
11
+ baseJsDateToTime,
12
+ baseGetHost
13
+ } from "@/utils/xd.base";
14
+
15
+
16
+ let logInstance = null;
17
+
18
+
19
+ class Logs {
20
+ constructor() {
21
+ this.initDone = false; //是否已加载uni.request和brandInfo['api_host']完成
22
+ this.checkcount = 0; //最大检查1000次
23
+ this.startcount = 0; //最大检查可以上传日志次数
24
+ this.checkMaxWaitTime = 1000;
25
+ //this.check();
26
+ this.saveUploadedLog = [];
27
+ this.onUpdateKeyword = [
28
+ '$vm', //跟uniApp uni.createSelectorQuery() 有关
29
+ "e.x", //跟uniApp滚动组件有关
30
+ 'null is not an object (evaluating', //跟uniApp滚动组件有关
31
+ "Cannot read property 'x' of ",// 跟uniApp滚动组件有关
32
+ ];
33
+
34
+ //#ifdef H5
35
+ this.initH5GlobalEvent()
36
+ //#endif
37
+ }
38
+
39
+ checkUniRequest() {
40
+ if (typeof uni === 'undefined') return false;
41
+ return typeof uni.request === 'function';
42
+ }
43
+
44
+ checkUniSetStorage() {
45
+ if (typeof uni === 'undefined') return false;
46
+ return typeof uni.setStorageSync === 'function';
47
+ }
48
+
49
+
50
+ checkApiHost() {
51
+ if (typeof getApp !== 'function') return false;
52
+ if (typeof getApp().globalData === "undefined") return false;
53
+ if (typeof getApp().globalData.$xd === 'undefined') return false;
54
+ if (typeof getApp().globalData.$xd['brandInfo'] === 'undefined') return false;
55
+ return typeof getApp().globalData.$xd['brandInfo']['api_host'] !== 'undefined';
56
+ }
57
+
58
+ check() {
59
+ let timer = setInterval(() => {
60
+ if ((this.checkUniRequest() && this.checkApiHost())
61
+ || this.checkcount > this.checkMaxWaitTime
62
+ ) {
63
+ this.initDone = true;
64
+ if (this.checkUniRequest() && this.checkApiHost()) {
65
+ setTimeout(() => {
66
+ this.checkBeforeStart();
67
+ }, 2000)
68
+ }
69
+ clearInterval(timer);
70
+ } else {
71
+ this.checkcount++;
72
+ }
73
+ }, 10)
74
+ }
75
+
76
+ checkBeforeStart() {
77
+ let timer = setInterval(() => {
78
+ if (this.startcount > this.checkMaxWaitTime) {
79
+ clearTimeout(timer);
80
+ return;
81
+ }
82
+ if (getApp().globalData.$xd['userInfo'] !== undefined
83
+ && !baseIsEmpty(getApp().globalData.$xd['userInfo'])
84
+ ) {
85
+ this.goBeforeUploadLogs();
86
+ clearTimeout(timer);
87
+ } else {
88
+ this.startcount++;
89
+ }
90
+ }, 10)
91
+ }
92
+
93
+ goBeforeUploadLogs() {
94
+ let logsSave = uni.getStorageInfoSync();
95
+ let logs = [];
96
+ logsSave.keys.map((key) => {
97
+ if (key.indexOf('xd.log.') === 0) {
98
+ logs.push(key);
99
+ }
100
+ });
101
+ logs.map((key) => {
102
+ let logStorage = uni.getStorageSync(key);
103
+ let system = this.getSystemInfo();
104
+
105
+ this.ajaxLogs({
106
+ baseApi: getApp().globalData.$xd.brandInfo['api_host'],
107
+ level: logStorage.level,
108
+ content: JSON.stringify({
109
+ ...system,
110
+ date: baseJsDateToTime(new Date().getTime() / 1000),
111
+ ...logStorage.logs
112
+ })
113
+ })
114
+ uni.removeStorageSync(key);
115
+ })
116
+
117
+ }
118
+
119
+ getSystemInfo() {
120
+ console.log(getApp().globalData.$xd.userInfo);
121
+ let userInfo = {};
122
+ let ext = {};
123
+ if (getApp().globalData
124
+ && getApp().globalData.$xd
125
+ && getApp().globalData.$xd.userInfo
126
+ ) {
127
+ userInfo = Base64.encodeURI(JSON.stringify(getApp().globalData.$xd.userInfo));
128
+ }
129
+
130
+ //#ifdef MP-WEIXIN
131
+ if (!baseIsEmpty(uni.getExtConfigSync())) {
132
+ ext = Base64.encodeURI(JSON.stringify(uni.getExtConfigSync()));
133
+ }
134
+ //#endif
135
+
136
+ const {
137
+ SDKVersion,
138
+ model,
139
+ system,
140
+ version,
141
+ deviceOrientation
142
+ } = uni.getSystemInfoSync();
143
+
144
+ console.log(userInfo, ext, uni.getSystemInfoSync());
145
+ return {
146
+ platform: 'weixin',
147
+ project: settings.system,
148
+ SDKVersion,
149
+ model,
150
+ system,
151
+ version,
152
+ deviceOrientation,
153
+ userInfo,
154
+ ext,
155
+ }
156
+ }
157
+
158
+
159
+ /**
160
+ * @description 上报日志
161
+ * @param log {Object} 上报日志内容
162
+ * @param type {String} 上报日志内容类型
163
+ * type = global(全局错误)
164
+ * type = onerror(系统捕获全局错误信息)
165
+ * type = promise(异步请求全局捕获错误)
166
+ * type = info(普通日志上报错误)
167
+ * type = debug(上报调试日志)
168
+ * type = ajax(返回异步请求字符串错误)
169
+ * type = unkown(返回异步请求字符串错误)
170
+ * tyoe = setting.error (项目配置错误)
171
+ * type = entry.index (记录访问首页入口来源)
172
+ * type = ajax.default {记录异步请求不知道的code的值}
173
+ * @param level {String} 上报级别 alert|info|debug
174
+ */
175
+ push(log, level = 'alert', type = "info") {
176
+ if (level === 'debug') {
177
+ if (settings.isDebug) {
178
+ level = 'info';
179
+ type = 'debug';
180
+ } else return;
181
+ }
182
+ type = `handle.${type}`;
183
+ if (!this.initDone) {
184
+ this.saveLog({log, type, level});
185
+ } else {
186
+ this.updateLog(log, type, level);
187
+ }
188
+ }
189
+
190
+ ajaxLogs(data) {
191
+ store['dispatch']('saveLogs', data)
192
+ .then(res => {
193
+ })
194
+ .catch(res => {
195
+ })
196
+ }
197
+
198
+ /**
199
+ * @description 上报日志
200
+ * @param log
201
+ * @param type
202
+ * @param level
203
+ */
204
+ updateLog(log, type, level) {
205
+ console.log(log, type, level);
206
+ let system = this.getSystemInfo();
207
+ if (level === 'info') system = {}
208
+ let logs = {...system, type, ...log};
209
+ let key = 'xd.log.' + md5(JSON.stringify(logs));
210
+ if (!this.saveUploadedLog.includes(key)) {
211
+ this.ajaxLogs({
212
+ baseApi: getApp().globalData.$xd.brandInfo['api_host'],
213
+ level: level,
214
+ content: JSON.stringify({
215
+ date: baseJsDateToTime(new Date().getTime() / 1000),
216
+ ...logs
217
+ }),
218
+ });
219
+ this.saveUploadedLog.push(key);
220
+ }
221
+ }
222
+
223
+ saveLog({log, type, level}) {
224
+ let logs = {type, before: true, ...log};
225
+ let key = 'xd.log.' + md5(JSON.stringify(logs));
226
+ if (this.checkUniSetStorage()) {
227
+ uni.setStorageSync(key, {logs, level});
228
+ }
229
+ }
230
+
231
+ checkMessage(error) {
232
+ let errorStr = error;
233
+ if (Object.prototype.toString.call(error) === '[object Error]') {
234
+ errorStr = JSON.stringify(runtime().getErrorInfo(error));
235
+ }
236
+ if (Object.prototype.toString.call(error) === '[object String]') {
237
+ errorStr = error;
238
+ }
239
+ if (Object.prototype.toString.call(error) === '[object Object]') {
240
+ errorStr = JSON.stringify(error);
241
+ }
242
+
243
+ let isUpdate = true;
244
+ this.onUpdateKeyword.map((keyword) => {
245
+ if (errorStr.indexOf(keyword) !== -1) {
246
+ isUpdate = false
247
+ }
248
+ });
249
+ return isUpdate === false ? isUpdate : Base64.encodeURI(errorStr);
250
+ }
251
+
252
+ initH5GlobalEvent() {
253
+ /**vue捕获全局错误**/
254
+ this.vueErrorHandler();
255
+ }
256
+
257
+ /**
258
+ * @description vue全局报错
259
+ */
260
+ vueErrorHandler() {
261
+ Vue.config.errorHandler = (error, vm) => {
262
+ let messageStr = this.checkMessage(error);
263
+ if (messageStr !== false) {
264
+ this.push(
265
+ {error: messageStr},
266
+ 'alert',
267
+ 'global'
268
+ )
269
+ }
270
+
271
+ };
272
+ }
273
+
274
+ /**
275
+ * @description 统一Promise catch处理
276
+ * @param error {Error|String} 错误对象(new Error())|字符串当为字符串时候,全局捕获不会处理
277
+ * @param callback 回调事件
278
+ */
279
+ catch(error, callback = null) {
280
+ let messageStr = logInstance.checkMessage(error);
281
+ if (messageStr !== false) {
282
+ logInstance.push(
283
+ {error: messageStr},
284
+ 'alert',
285
+ 'catch'
286
+ );
287
+ }
288
+ if (typeof callback === 'function') callback()
289
+ }
290
+ }
291
+
292
+ function xdWxlog() {
293
+ if (logInstance === null) {
294
+ logInstance = new Logs();
295
+ }
296
+ return logInstance;
297
+ }
298
+
299
+
300
+ export default xdWxlog();
301
+
302
+