gxd-uni-library-editx 1.0.3 → 1.0.5

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.3",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
package/src/install.js CHANGED
@@ -102,9 +102,10 @@ const install = (Vue, options = {}) => {
102
102
  Vue.mixin({
103
103
  data() {
104
104
  return {
105
- $mainColor: '',
106
- $btnColor: '',
107
- $subBtnColor: '',
105
+ /**editx去掉逻辑**/
106
+ // $mainColor: '',
107
+ // $btnColor: '',
108
+ // $subBtnColor: '',
108
109
  $pxNum: null, //px to rpx (1px * $pxNum)rpx
109
110
  $rpxNum: null, //rpx to px (1rpx * $rpxNum)px
110
111
  $portrait: null,
@@ -137,15 +138,16 @@ const install = (Vue, options = {}) => {
137
138
  this.$isIpadCC = 1;
138
139
  // #endif
139
140
 
140
- if (this.webSetting) {
141
- this.$mainColor = this.webSetting['mainColor'] || options['mainColor'];
142
- this.$btnColor = this.webSetting['btnColor'] || options['btnColor'];
143
- this.$subBtnColor = this.webSetting['subBtnColor'] || options['subBtnColor'];
144
- } else {
145
- this.$mainColor = options['mainColor'] ? options['mainColor'] : '';
146
- this.$btnColor = options['btnColor'] ? options['btnColor'] : '';
147
- this.$subBtnColor = options['subBtnColor'] ? options['subBtnColor'] : '';
148
- }
141
+ /**editx去掉逻辑**/
142
+ // if (this.webSetting) {
143
+ // this.$mainColor = this.webSetting['mainColor'] || options['mainColor'];
144
+ // this.$btnColor = this.webSetting['btnColor'] || options['btnColor'];
145
+ // this.$subBtnColor = this.webSetting['subBtnColor'] || options['subBtnColor'];
146
+ // } else {
147
+ // this.$mainColor = options['mainColor'] ? options['mainColor'] : '';
148
+ // this.$btnColor = options['btnColor'] ? options['btnColor'] : '';
149
+ // this.$subBtnColor = options['subBtnColor'] ? options['subBtnColor'] : '';
150
+ // }
149
151
 
150
152
  //横竖屏
151
153
  this.$portrait = 1.4;
@@ -155,9 +157,10 @@ const install = (Vue, options = {}) => {
155
157
  watch: {
156
158
  webSetting(value) {
157
159
  if (value !== null) {
158
- if (value['mainColor']) this.$mainColor = value['mainColor'];
159
- if (value['btnColor']) this.$btnColor = value['btnColor'];
160
- if (value['subBtnColor']) this.$subBtnColor = value['subBtnColor'];
160
+ /**editx去掉逻辑**/
161
+ // if (value['mainColor']) this.$mainColor = value['mainColor'];
162
+ // if (value['btnColor']) this.$btnColor = value['btnColor'];
163
+ // if (value['subBtnColor']) this.$subBtnColor = value['subBtnColor'];
161
164
  this.$webSetting = value;
162
165
  }
163
166
  }
@@ -340,6 +340,7 @@ export function parseContainers (containers) {
340
340
  containers = [containers];
341
341
  }
342
342
  const handle = (str) => {
343
+ if(str === '') return {};
343
344
  if(baseCheckVarType(str) === 'object') return str;
344
345
  try {
345
346
  return JSON.parse(str)
@@ -477,3 +478,5 @@ export function getParentsStyle(parent, key) {
477
478
 
478
479
 
479
480
 
481
+
482
+
@@ -9,6 +9,7 @@ import {
9
9
  getSetting,
10
10
  baseIsEmpty
11
11
  } from "@/utils/xd.base";
12
+ import store from "@/store";
12
13
 
13
14
 
14
15
  import storage from "@/common/storage";
@@ -129,10 +130,10 @@ export function handlePesponse(
129
130
  clog(`Fast Link:${request.url} ${useTime}ms`, 'green');
130
131
  }
131
132
 
133
+
132
134
  //200
133
135
  if (response['statusCode'] === 200) {
134
136
  resolve(response.data);
135
- return;
136
137
  }
137
138
 
138
139
  //400
@@ -162,14 +163,58 @@ export function handlePesponse(
162
163
 
163
164
  //401
164
165
  else if (response['statusCode'] === 401) {
165
- if (!$vm) {
166
- reject(response);
167
- throw new Error(response.data.message);
168
- }
169
- else {
166
+ //是否为刷新接口报错
167
+ if(request.url.indexOf(request.userRefreshToken) !== -1) {
168
+ console.log('request.userRefreshToken.401', request.userRefreshToken);
170
169
  reject(response);
171
170
  $vm.$xdHideLoading();
172
171
  }
172
+
173
+ //其他接口报错
174
+ else{
175
+ if (!$vm) {
176
+ reject(response);
177
+ throw new Error(response.data.message);
178
+ }
179
+ else {
180
+ //需要卡登陆页面
181
+ if(response.data.code === 'NeedCardLogin') {
182
+ //当前页面为卡登陆页面不处理
183
+ if($vm.$route.path === store.state.jfbAuthorize.cardPath) {
184
+ reject(response);
185
+ $vm.$xdHideLoading();
186
+ }
187
+ else store.state.jfbAuthorize.jumpToCardLogin($vm);
188
+ }
189
+
190
+ //用户登陆失效
191
+ else if(response.data.code === 'NeedLogin') {
192
+ if ($vm.$route.path === store.state.jfbAuthorize.LoginPath) {
193
+ reject(response);
194
+ $vm.$xdHideLoading();
195
+ }
196
+ else store.state.jfbAuthorize.jumpToUserLogin($vm);
197
+ }
198
+
199
+ //401去交换token
200
+ else if(response.data.code === 'Unauthorized') {
201
+ store.dispatch('userRefreshToken')
202
+ .then(status=>{
203
+ //交给store进行方法重新调用操作
204
+ reject('reLoadApi');
205
+ })
206
+ .catch(error=>{
207
+ store.state.jfbAuthorize.jumpToUserLogin($vm);
208
+ })
209
+ }
210
+ else {
211
+ reject(response);
212
+ $vm.$xdHideLoading();
213
+ }
214
+ }
215
+ }
216
+
217
+
173
218
  }
174
219
 
175
220
  //500
@@ -51,6 +51,25 @@ export function jfbRootExec(fnName, params) {
51
51
  }
52
52
  };
53
53
 
54
+ /**
55
+ * @description 获得父级页面中的方法引用
56
+ * @param vm {Vue} 插件对象实例
57
+ * @param fnName {String} 方法名字
58
+ * @returns {Function} 返回方法调用
59
+ */
60
+ export function jfbRootFnExec(vm, fnName) {
61
+ if(typeof vm.$root[fnName] === 'function') {
62
+ return vm.$root[fnName];
63
+ }
64
+ else {
65
+ throw new Error(JSON.stringify({
66
+ message: '访问的方法不存在',
67
+ fnName,
68
+ data: params
69
+ }))
70
+ }
71
+ }
72
+
54
73
 
55
74
 
56
75
  /**
@@ -75,7 +75,15 @@ class xdFrame {
75
75
  * @param fnName {String} 方法名字
76
76
  */
77
77
  getParentApi(fnName) {
78
- return this.getParent()['$boardApi'][fnName];
78
+ if (window.parent['$boardApi']) {
79
+ return this.getParent()['$boardApi'][fnName];
80
+ } else {
81
+ return () => {
82
+ return new Promise((resolve) => {
83
+ resolve([]);
84
+ })
85
+ }
86
+ }
79
87
  }
80
88
 
81
89
  /**
@@ -83,7 +91,11 @@ class xdFrame {
83
91
  * @param attr {String} 属性名字
84
92
  */
85
93
  getParentData(attr) {
86
- return this.getParent()['$boardData'][attr];
94
+ console.log('getParentData',)
95
+ if (window.parent['$boardData']) {
96
+ return this.getParent()['$boardData'][attr];
97
+ } else return [];
98
+
87
99
  }
88
100
  }
89
101
 
@@ -269,7 +269,7 @@ class Logs {
269
269
  * @description vue全局报错
270
270
  */
271
271
  vueErrorHandler(){
272
- Vue.config.errorHandler = (error, vm) => {
272
+ let handle = (error, vm)=>{
273
273
  let messageStr = this.checkMessage(error);
274
274
  if (messageStr !== false) {
275
275
  this.push(
@@ -278,7 +278,13 @@ class Logs {
278
278
  'global'
279
279
  )
280
280
  }
281
+ }
282
+
283
+ Vue.config.errorHandler = handle;
284
+
281
285
 
286
+ Vue.config.errorCaptured = (error, vm) => {
287
+ console.error(error)
282
288
  };
283
289
  }
284
290