jufubao-base 1.0.146 → 1.0.148-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 +1 -1
- package/src/common/ICB.SDK.js +78 -0
- package/src/common/authorize.js +187 -33
- package/src/components/JfbBaseAfterOrderList/JfbBaseAfterOrderList.vue +1 -1
- package/src/components/JfbBaseCard/JfbBaseCard.vue +10 -9
- package/src/components/JfbBaseCardBindV2/JfbBaseCardBindV2.vue +4 -2
- package/src/components/JfbBaseCardDetailEntry/JfbBaseCardDetailEntry.vue +1 -3
- package/src/components/JfbBaseCardDisabled/JfbBaseCardDisabled.vue +3 -3
- package/src/components/JfbBaseCardDisabledEntry/JfbBaseCardDisabledEntry.vue +10 -5
- package/src/components/JfbBaseCardDisabledEntry/cardListMixins.js +15 -1
- package/src/components/JfbBaseCardEntry/JfbBaseCardEntry.vue +5 -7
- package/src/components/JfbBaseCardInfo/JfbBaseCardInfo.vue +2 -1
- package/src/components/JfbBaseCardV2/JfbBaseCardV2.vue +1 -3
- package/src/components/JfbBaseCardV3/JfbBaseCardV3.vue +1 -3
- package/src/components/JfbBaseEntry/JfbBaseEntry.vue +12 -4
- package/src/components/JfbBaseLogin/Api.js +12 -0
- package/src/components/JfbBaseLogin/Attr.js +13 -1
- package/src/components/JfbBaseLogin/JfbBaseLogin.vue +95 -40
- package/src/components/JfbBaseNoticeBottom/JfbBaseNoticeBottom.vue +1 -34
- package/src/components/JfbBaseOrderDetail/JfbBaseOrderDetail.vue +6 -6
- package/src/components/JfbBaseOrderList/JfbBaseOrderList.vue +8 -3
- package/src/components/JfbBasePay/JfbBasePay.vue +7 -17
- package/src/components/JfbBasePosterType/JfbBasePosterType.vue +1 -1
- package/src/components/JfbBaseSearch/JfbBaseSearch.vue +11 -1
- package/src/components/JfbBaseWxAuthorize/Api.js +13 -0
- package/src/components/JfbBaseWxAuthorize/Attr.js +20 -0
- package/src/components/JfbBaseWxAuthorize/JfbBaseWxAuthorize.vue +60 -5
package/package.json
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const ICB_SDK = require('@/common/paysdk/ICB.SDK');
|
|
4
|
+
|
|
5
|
+
class ICB {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.ICB_APP = ICB_SDK;
|
|
8
|
+
this.fail(false)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @description 获取版本号
|
|
13
|
+
* @return {*}
|
|
14
|
+
*/
|
|
15
|
+
version(){
|
|
16
|
+
return this.ICB_APP.elifeVer()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fail(notExc=true){
|
|
20
|
+
// if(typeof window.WebViewJavascriptBridge === "undefined"){
|
|
21
|
+
// console.warn('初始化工商银行e生活SDK失败');
|
|
22
|
+
// if(notExc) throw new Error('初始化工商银行e生活SDK失败');
|
|
23
|
+
// }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description 获取用户登录方式
|
|
28
|
+
* @param callback {Function} 成功回调函数
|
|
29
|
+
*/
|
|
30
|
+
login(callback){
|
|
31
|
+
this.fail();
|
|
32
|
+
|
|
33
|
+
this.ICB_APP.merLogin(callback)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @description 第三方显示或隐藏tabBar
|
|
38
|
+
* @param show 默认值:true
|
|
39
|
+
*/
|
|
40
|
+
showBar(show = true){
|
|
41
|
+
this.fail();
|
|
42
|
+
this.ICB_APP.showToolBar(show);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @description 第三方返回APP
|
|
47
|
+
*/
|
|
48
|
+
back(){
|
|
49
|
+
this.fail();
|
|
50
|
+
this.ICB_APP.back();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @description 拨打电话
|
|
55
|
+
* @param tel 电话号码
|
|
56
|
+
*/
|
|
57
|
+
callPhone(tel){
|
|
58
|
+
if(!tel){
|
|
59
|
+
console.warn(`拨打电话号码不能为空,电话号码:${tel}`);
|
|
60
|
+
throw new Error('拨打电话号码不能为空');
|
|
61
|
+
}
|
|
62
|
+
this.fail();
|
|
63
|
+
this.ICB_APP.callPhoneNumber(tel);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @description 是否隐藏第三方的头
|
|
68
|
+
* @param show
|
|
69
|
+
*/
|
|
70
|
+
showThirdNavigation(show = true){
|
|
71
|
+
this.fail();
|
|
72
|
+
if(show) this.ICB_APP.showThirdWebviewNavigation()
|
|
73
|
+
else this.ICB_APP.hideThirdWebviewNavigation()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = new ICB();
|
package/src/common/authorize.js
CHANGED
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
import cookie from "@/common/cookie";
|
|
5
5
|
//#endif
|
|
6
6
|
import storage from "@/common/storage";
|
|
7
|
+
|
|
7
8
|
const settings = require('./../../settings');
|
|
8
9
|
import Vue from 'vue';
|
|
10
|
+
|
|
9
11
|
let __jfbAuthorize = null;
|
|
10
12
|
import store from "@/store";
|
|
11
13
|
|
|
14
|
+
import {Base64} from 'js-base64';
|
|
15
|
+
|
|
12
16
|
class JfbAuthorize {
|
|
13
17
|
/**
|
|
14
18
|
* @description 构造函数
|
|
@@ -18,20 +22,27 @@ class JfbAuthorize {
|
|
|
18
22
|
* @param options.cardPath {String} 购物登录地址 【选填】
|
|
19
23
|
* @param options.LoginPath {String} 用户登录地址 【选填】
|
|
20
24
|
*/
|
|
21
|
-
constructor(options){
|
|
25
|
+
constructor(options) {
|
|
22
26
|
this.siteId = options.siteId;
|
|
23
27
|
this.xSite = options.xSite;
|
|
24
28
|
this.cardPath = options.cardPath;
|
|
25
29
|
this.LoginPath = options.LoginPath;
|
|
30
|
+
this.jumpToTimer = null;
|
|
31
|
+
this.maxTime = 10;
|
|
26
32
|
|
|
27
|
-
this.config = Object.assign({},{
|
|
33
|
+
this.config = Object.assign({}, {
|
|
28
34
|
'user': 'JFB-CSRF-TOKEN-{siteID}',
|
|
29
35
|
'card': 'JFB-CARD-TOKEN-{siteID}',
|
|
30
36
|
'refresh': 'JFB-REFRESH-TOKEN-{siteID}',
|
|
31
37
|
'access': 'JFB-ACCESS-TOKEN',
|
|
32
|
-
|
|
38
|
+
'bizCode': 'JFB-CARD-CODE-{siteID}',
|
|
39
|
+
'userAll':'JFB-USER-ALL-{siteID}',
|
|
40
|
+
}, settings.token ? settings.token : {});
|
|
33
41
|
}
|
|
34
42
|
|
|
43
|
+
doMain() {
|
|
44
|
+
return [''].concat(window.location.host.split('.').slice(-2)).join('.');
|
|
45
|
+
}
|
|
35
46
|
|
|
36
47
|
|
|
37
48
|
/**
|
|
@@ -39,10 +50,10 @@ class JfbAuthorize {
|
|
|
39
50
|
* @param key {String} {String} 设置cookie/storage键值,其值:card|user|refresh|access, 默认:user,【选填】
|
|
40
51
|
* @returns {string|*}
|
|
41
52
|
*/
|
|
42
|
-
getTokenKeyword(key){
|
|
53
|
+
getTokenKeyword(key) {
|
|
43
54
|
if (!this.config[key]) key = 'user';
|
|
44
|
-
if(key === 'access') return this.config.access;
|
|
45
|
-
else{
|
|
55
|
+
if (key === 'access') return this.config.access;
|
|
56
|
+
else {
|
|
46
57
|
return `${this.config[key].replace("{siteID}", this.siteId)}`;
|
|
47
58
|
}
|
|
48
59
|
}
|
|
@@ -82,13 +93,16 @@ class JfbAuthorize {
|
|
|
82
93
|
* @param options {Object} 可选项,{expires: 1, domain: ''}, 过期时间单位:小时
|
|
83
94
|
*/
|
|
84
95
|
removeToken(key, options = {}) {
|
|
96
|
+
let codeKey = this.getTokenKeyword('bizCode');
|
|
85
97
|
key = this.getTokenKeyword(key);
|
|
86
98
|
//#ifdef H5
|
|
87
99
|
cookie.remove(key, options);
|
|
88
|
-
|
|
100
|
+
cookie.remove(codeKey, options);
|
|
101
|
+
cookie.remove(key, {domain: this.doMain()});
|
|
102
|
+
cookie.remove(codeKey, {domain: this.doMain()});
|
|
89
103
|
//#endif
|
|
90
|
-
console.warn(`storage.key=${key}`);
|
|
91
104
|
storage.remove(key);
|
|
105
|
+
storage.remove(codeKey);
|
|
92
106
|
}
|
|
93
107
|
|
|
94
108
|
/**
|
|
@@ -113,10 +127,10 @@ class JfbAuthorize {
|
|
|
113
127
|
* @description h5中获取base
|
|
114
128
|
* @param $vm {Vue}
|
|
115
129
|
*/
|
|
116
|
-
getBasePath($vm){
|
|
130
|
+
getBasePath($vm) {
|
|
117
131
|
let base = '';
|
|
118
132
|
//#ifdef H5
|
|
119
|
-
base =
|
|
133
|
+
base = $vm.$router.history.base;
|
|
120
134
|
//#endif
|
|
121
135
|
return base;
|
|
122
136
|
}
|
|
@@ -124,8 +138,10 @@ class JfbAuthorize {
|
|
|
124
138
|
/**
|
|
125
139
|
* @description 跳转到卡登陆页面
|
|
126
140
|
* @param $vm {Vue}
|
|
141
|
+
* @param callbackUrl {String} 返回参数
|
|
127
142
|
*/
|
|
128
|
-
|
|
143
|
+
|
|
144
|
+
jumpToCardLogin($vm, callbackUrl) {
|
|
129
145
|
let redirect_url = '';
|
|
130
146
|
if (store.state.configProject.platform === 'mp.weixin') {
|
|
131
147
|
redirect_url = $vm['$xdUniHelper'].parseURL().source;
|
|
@@ -133,25 +149,87 @@ class JfbAuthorize {
|
|
|
133
149
|
if (store.state.configProject.platform === 'h5') {
|
|
134
150
|
redirect_url = $vm.$route.fullPath;
|
|
135
151
|
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
//登陆地址与当前项目不再同一个app中处理
|
|
155
|
+
//#ifdef H5
|
|
156
|
+
if (!this.checkUrlIsCameDir(this.cardPath)) {
|
|
157
|
+
redirect_url = `@site_domain@/${store.state.brandInfo.deploy_dir}${redirect_url}`
|
|
158
|
+
}
|
|
159
|
+
//#endif
|
|
160
|
+
|
|
161
|
+
if (callbackUrl) redirect_url = callbackUrl;
|
|
162
|
+
|
|
163
|
+
if (!this.cardPath) {
|
|
164
|
+
console.error(this.cardPath);
|
|
165
|
+
$vm.$xdAlert({
|
|
166
|
+
content: "请设置卡登陆页面地址"
|
|
167
|
+
})
|
|
168
|
+
throw new Error('请设置卡登陆页面地址');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//设置页面过滤卡
|
|
172
|
+
let business_code = '';
|
|
173
|
+
if(store.state.pageBusinessCode) {
|
|
174
|
+
business_code = `&jfb_business_code=${store.state.pageBusinessCode}`;
|
|
175
|
+
}
|
|
176
|
+
|
|
136
177
|
$vm['$xdUniHelper'].redirectTo({
|
|
137
|
-
url: this.cardPath + `?inCallback=${
|
|
178
|
+
url: this.cardPath + `?inCallback=${Base64.encodeURI(redirect_url)}${business_code}`,
|
|
138
179
|
});
|
|
139
180
|
}
|
|
140
181
|
|
|
182
|
+
checkUrlIsCameDir(url) {
|
|
183
|
+
url = url.replace('@site_domain@', '').split('/');
|
|
184
|
+
console.log('checkUrlIsCameDir', url)
|
|
185
|
+
console.log('checkUrlIsCameDir', store.state.brandInfo)
|
|
186
|
+
return url.length === 5 && url[1] === store.state.brandInfo.deploy_dir;
|
|
187
|
+
}
|
|
188
|
+
|
|
141
189
|
/**
|
|
142
190
|
* @description 跳转到用户登陆页面
|
|
143
191
|
* @param $vm {Vue}
|
|
192
|
+
* @param isRedirect {boolean}
|
|
144
193
|
*/
|
|
145
|
-
jumpToUserLogin($vm) {
|
|
194
|
+
jumpToUserLogin($vm,isRedirect = true) {
|
|
146
195
|
let redirect_url = '';
|
|
147
|
-
if(store.state.configProject.platform === 'mp.weixin') {
|
|
196
|
+
if (store.state.configProject.platform === 'mp.weixin') {
|
|
148
197
|
redirect_url = $vm['$xdUniHelper'].parseURL().source;
|
|
149
198
|
}
|
|
150
199
|
if (store.state.configProject.platform === 'h5') {
|
|
151
200
|
redirect_url = $vm.$route.fullPath;
|
|
152
201
|
}
|
|
202
|
+
if(!isRedirect) redirect_url = '';
|
|
203
|
+
|
|
204
|
+
//#ifdef H5
|
|
205
|
+
//登陆地址与当前项目不再同一个app中处理
|
|
206
|
+
if(!this.checkUrlIsCameDir(this.LoginPath)) {
|
|
207
|
+
if(redirect_url) {
|
|
208
|
+
redirect_url = `@site_domain@/${store.state.brandInfo.deploy_dir}${redirect_url}`;
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
redirect_url = `@site_domain@/${store.state.brandInfo.deploy_dir}/`;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//#endif
|
|
215
|
+
|
|
216
|
+
//判断是否有登陆地址
|
|
217
|
+
let LoginPath = redirect_url;
|
|
218
|
+
if (LoginPath.indexOf(this.LoginPath) === -1) {
|
|
219
|
+
LoginPath = this.LoginPath + `?redirect_url=${Base64.encodeURI(redirect_url)}`;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!this.LoginPath) {
|
|
223
|
+
console.error(this.LoginPath);
|
|
224
|
+
$vm.$xdAlert({
|
|
225
|
+
content: "请设置用户登陆页面地址"
|
|
226
|
+
})
|
|
227
|
+
throw new Error('请设置用户登陆页面地址');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
console.warn(`jumpToUserLogin.redirect.url: ${redirect_url} , login: ${LoginPath}`)
|
|
153
231
|
$vm['$xdUniHelper'].redirectTo({
|
|
154
|
-
url:
|
|
232
|
+
url: LoginPath,
|
|
155
233
|
});
|
|
156
234
|
}
|
|
157
235
|
|
|
@@ -162,17 +240,55 @@ class JfbAuthorize {
|
|
|
162
240
|
* @param isAutoJump {Boolean} 是否自己跳转 默认值:true
|
|
163
241
|
* @return {boolean} true 已登陆或者免登 false 未登陆
|
|
164
242
|
*/
|
|
165
|
-
checkCardLogin(canCard = false, $vm, isAutoJump=true){
|
|
166
|
-
|
|
243
|
+
checkCardLogin(canCard = false, $vm, isAutoJump = true) {
|
|
244
|
+
let isSpecialPages = $vm['isSpecialPages'];
|
|
245
|
+
|
|
246
|
+
//免卡登陆
|
|
247
|
+
if (!canCard) {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
167
252
|
if (!this.getToken('card')) {
|
|
168
|
-
|
|
169
|
-
|
|
253
|
+
$vm.isCardLogined = false;
|
|
254
|
+
if (isAutoJump) {
|
|
255
|
+
//需要特殊处理,在设置强制卡的时候需要也可以免卡登陆模式,但是需要进行卡检查
|
|
256
|
+
if(isSpecialPages) return true;
|
|
257
|
+
else this.jumpToCardLogin($vm);
|
|
170
258
|
}
|
|
171
259
|
return false;
|
|
172
260
|
}
|
|
261
|
+
|
|
262
|
+
//已登陆卡
|
|
263
|
+
$vm.isCardLogined = true;
|
|
173
264
|
return true;
|
|
174
265
|
}
|
|
175
266
|
|
|
267
|
+
checkLoginCardSupportBizCode(canCard = false, $vm, isAutoJump = true){
|
|
268
|
+
if (!canCard) return true;
|
|
269
|
+
|
|
270
|
+
//未获取业务线直接跳回卡登陆页面
|
|
271
|
+
let bizCode = this.getToken('bizCode')
|
|
272
|
+
if (!bizCode) {
|
|
273
|
+
if (isAutoJump) {
|
|
274
|
+
this.jumpToCardLogin($vm);
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
//
|
|
279
|
+
else{
|
|
280
|
+
let bizCodeArr = bizCode.split(',');
|
|
281
|
+
let currentBizCode = store.state.xnamespace;
|
|
282
|
+
if(bizCodeArr.includes(currentBizCode)) {
|
|
283
|
+
return true
|
|
284
|
+
}
|
|
285
|
+
if (isAutoJump) {
|
|
286
|
+
this.jumpToCardLogin($vm);
|
|
287
|
+
}
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
176
292
|
/**
|
|
177
293
|
* @description 用户已登录信息
|
|
178
294
|
* @param canSign {Boolean} 检查是否用登录信息 默认:false
|
|
@@ -180,21 +296,34 @@ class JfbAuthorize {
|
|
|
180
296
|
* @param isAutoJump {Boolean} 是否自己跳转 默认值:true
|
|
181
297
|
* @return {Promise} true: 已登陆或者未启用,false:未登陆或刷新token已过期获取(从新交换token)
|
|
182
298
|
*/
|
|
183
|
-
checkUserLogin(canSign, $vm, isAutoJump=true) {
|
|
184
|
-
return new Promise((resolve, reject)=>{
|
|
299
|
+
checkUserLogin(canSign, $vm, isAutoJump = true) {
|
|
300
|
+
return new Promise((resolve, reject) => {
|
|
301
|
+
let isSpecialPages = $vm['isSpecialPages'];
|
|
302
|
+
|
|
185
303
|
//免登陆操作
|
|
186
304
|
if (!canSign) resolve(true);
|
|
187
305
|
|
|
188
|
-
//用户登陆判断
|
|
306
|
+
//用户登陆判断crf
|
|
189
307
|
let userToken = this.getToken('user');
|
|
190
308
|
//用户刷新token
|
|
191
309
|
let refreshToken = this.getToken('refresh');
|
|
192
310
|
|
|
193
311
|
//用户未登陆
|
|
194
|
-
if(!userToken && !refreshToken) {
|
|
312
|
+
if (!userToken && !refreshToken) {
|
|
313
|
+
$vm.isLogined = false;
|
|
314
|
+
|
|
315
|
+
//需要自动跳转到登陆页面
|
|
195
316
|
if (isAutoJump) {
|
|
317
|
+
//需要特殊处理,在设置强制登陆的时候需要也可以免登陆模式,但是需要进行登陆检查
|
|
318
|
+
if(isSpecialPages){
|
|
319
|
+
resolve(true);
|
|
320
|
+
return
|
|
321
|
+
}
|
|
322
|
+
|
|
196
323
|
this.jumpToUserLogin($vm);
|
|
324
|
+
return;
|
|
197
325
|
}
|
|
326
|
+
|
|
198
327
|
resolve(false);
|
|
199
328
|
return
|
|
200
329
|
}
|
|
@@ -202,31 +331,58 @@ class JfbAuthorize {
|
|
|
202
331
|
//去刷新token
|
|
203
332
|
if (!userToken) store.dispatch('userRefreshToken')
|
|
204
333
|
.then(res => {
|
|
334
|
+
$vm.isLogined = true;
|
|
205
335
|
resolve(true);
|
|
206
336
|
})
|
|
207
|
-
.catch(error=>{
|
|
337
|
+
.catch(error => {
|
|
338
|
+
$vm.isLogined = false;
|
|
339
|
+
|
|
208
340
|
if (isAutoJump) {
|
|
341
|
+
//需要特殊处理,在设置强制登陆的时候需要也可以免登陆模式,但是需要进行登陆检查
|
|
342
|
+
if(isSpecialPages){
|
|
343
|
+
resolve(true);
|
|
344
|
+
return
|
|
345
|
+
}
|
|
346
|
+
|
|
209
347
|
this.jumpToUserLogin($vm);
|
|
348
|
+
return;
|
|
210
349
|
}
|
|
350
|
+
|
|
211
351
|
resolve(false);
|
|
212
352
|
});
|
|
213
|
-
|
|
353
|
+
|
|
354
|
+
//已登陆
|
|
355
|
+
else {
|
|
356
|
+
$vm.isLogined = true;
|
|
214
357
|
resolve(true);
|
|
215
358
|
}
|
|
216
359
|
});
|
|
217
360
|
}
|
|
218
361
|
|
|
362
|
+
|
|
363
|
+
|
|
219
364
|
/**
|
|
220
365
|
* @description 客户端设置所有token
|
|
221
366
|
* @param result
|
|
222
367
|
* @param cb {Function|null}
|
|
223
368
|
*/
|
|
224
|
-
setAllToken(result,cb = null){
|
|
369
|
+
setAllToken(result, cb = null) {
|
|
370
|
+
|
|
225
371
|
//#ifdef MP-WEIXIN
|
|
226
|
-
|
|
372
|
+
if(result['csrf_token_expire_in']) result['csrf_token_expire_in'] = Number(result['csrf_token_expire_in']);
|
|
373
|
+
if(result['access_token_expire_in']) result['access_token_expire_in'] = Number(result['access_token_expire_in']);
|
|
374
|
+
if(result['refresh_token_expire_in']) result['refresh_token_expire_in'] = Number(result['refresh_token_expire_in']);
|
|
375
|
+
this.setToken('user', result['csrf_token'], {expires: result['csrf_token_expire_in'] / 60 / 60});
|
|
227
376
|
this.setToken('access', result['access_token'], {expires: result['access_token_expire_in'] / 60 / 60})
|
|
228
377
|
this.setToken('refresh', result['refresh_token'], {expires: result['refresh_token_expire_in'] / 60 / 60})
|
|
229
|
-
|
|
378
|
+
this.setToken('userAll',result,{expires: result['csrf_token_expire_in'] / 60 / 60})
|
|
379
|
+
if (typeof cb === 'function') cb();
|
|
380
|
+
//#endif
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
setCardToken(result,cb){
|
|
384
|
+
//#ifdef MP-WEIXIN
|
|
385
|
+
if (typeof cb === 'function') cb();
|
|
230
386
|
//#endif
|
|
231
387
|
}
|
|
232
388
|
|
|
@@ -234,14 +390,12 @@ class JfbAuthorize {
|
|
|
234
390
|
* @description 客户端删除所有token
|
|
235
391
|
* @param cb {Function|null}
|
|
236
392
|
*/
|
|
237
|
-
removeAllToken(cb=null){
|
|
393
|
+
removeAllToken(cb = null) {
|
|
238
394
|
//#ifdef MP-WEIXIN
|
|
239
395
|
this.removeToken('user');
|
|
240
396
|
this.removeToken('access');
|
|
241
397
|
this.removeToken('refresh');
|
|
242
|
-
|
|
243
|
-
store.state.jfbAuthorize.setAllToken(res)
|
|
244
|
-
}
|
|
398
|
+
this.removeToken('userAll');
|
|
245
399
|
//#endif
|
|
246
400
|
}
|
|
247
401
|
}
|
|
@@ -254,7 +408,7 @@ class JfbAuthorize {
|
|
|
254
408
|
* @param options.LoginPath {String} 用户登录地址 【选填】
|
|
255
409
|
*/
|
|
256
410
|
export default function (options) {
|
|
257
|
-
if(__jfbAuthorize !== null) return __jfbAuthorize;
|
|
411
|
+
if (__jfbAuthorize !== null) return __jfbAuthorize;
|
|
258
412
|
return __jfbAuthorize = new JfbAuthorize(options);
|
|
259
413
|
}
|
|
260
414
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<!-- #endif -->
|
|
19
19
|
<view class="jfb-base-card__body">
|
|
20
20
|
<view class="jfb-base-card__body-cut">
|
|
21
|
-
<template v-if="
|
|
21
|
+
<template v-if="isQrCode">
|
|
22
22
|
<view
|
|
23
23
|
class="jfb-base-card__body-cut-item"
|
|
24
24
|
@click="handleScan"
|
|
@@ -226,10 +226,11 @@ import JfbBaseCardMixin from "./JfbBaseCardMixin";
|
|
|
226
226
|
import componentsMixins from "@/mixins/componentsMixins";
|
|
227
227
|
import extsMixins from "@/mixins/extsMixins";
|
|
228
228
|
import { mapState, mapActions } from "vuex";
|
|
229
|
-
import { getContainerPropsValue, isWechat } from "@/utils/xd.base";
|
|
229
|
+
import { getContainerPropsValue, isWechat,isQrCode } from "@/utils/xd.base";
|
|
230
230
|
import XdNoticeBar from "@/components/XdNoticeBar/XdNoticeBar";
|
|
231
231
|
import { Base64 } from "js-base64";
|
|
232
232
|
const Color = require("color");
|
|
233
|
+
|
|
233
234
|
export default {
|
|
234
235
|
name: "JfbBaseCard",
|
|
235
236
|
components: {
|
|
@@ -293,7 +294,7 @@ export default {
|
|
|
293
294
|
isPreview: false,
|
|
294
295
|
noticeStatus: false,
|
|
295
296
|
|
|
296
|
-
|
|
297
|
+
isQrCode: true,
|
|
297
298
|
cutIndex: 1,
|
|
298
299
|
tabIndex: 1,
|
|
299
300
|
offsetIndex:0,//第几页
|
|
@@ -340,10 +341,9 @@ export default {
|
|
|
340
341
|
this.init(this.container);
|
|
341
342
|
this.noticeBackgroundColor = Color(this.warningColor).alpha(0.2).toString();
|
|
342
343
|
this.isPreview = this.$configProject.isPreview;
|
|
344
|
+
this.isQrCode = isQrCode(this);
|
|
343
345
|
|
|
344
346
|
//#ifdef H5
|
|
345
|
-
this.isWx = this.isPreview || isWechat();
|
|
346
|
-
|
|
347
347
|
if (!this.$configProject.isPreview) {
|
|
348
348
|
jfbRootExec("getH5WxAuthorize", {
|
|
349
349
|
vm: this,
|
|
@@ -442,7 +442,7 @@ export default {
|
|
|
442
442
|
uni.scanCode({
|
|
443
443
|
scanType: ["qrCode"],
|
|
444
444
|
success: (res) => {
|
|
445
|
-
let path = this.getUrlCallback(`${this.confirmUrl}?qrcode=${encodeURIComponent(res.
|
|
445
|
+
let path = this.getUrlCallback(`${this.confirmUrl}?qrcode=${encodeURIComponent(res.result)}`)
|
|
446
446
|
this.$xdUniHelper.navigateTo({
|
|
447
447
|
url: path,
|
|
448
448
|
});
|
|
@@ -490,9 +490,10 @@ export default {
|
|
|
490
490
|
this.$xdHideLoading();
|
|
491
491
|
//#ifdef MP-WEIXIN
|
|
492
492
|
if (this.jfbAuthorize !== null) {
|
|
493
|
-
this.jfbAuthorize.
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
this.jfbAuthorize.setCardToken(res);
|
|
494
|
+
// this.jfbAuthorize.setToken("card", res["card_token"], {
|
|
495
|
+
// expires: res["card_expire_in"] / 60 / 60,
|
|
496
|
+
// });
|
|
496
497
|
}
|
|
497
498
|
//#endif
|
|
498
499
|
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<view
|
|
22
22
|
class="scan_icon"
|
|
23
23
|
@click="doScanCode"
|
|
24
|
+
v-if="isQrCode"
|
|
24
25
|
>
|
|
25
26
|
<xd-font-icon icon="iconsaoma1"></xd-font-icon>
|
|
26
27
|
</view>
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
import XdButton from "@/components/XdButton/XdButton"
|
|
59
60
|
import { jfbRootExec } from "@/utils/xd.event";
|
|
60
61
|
import JfbBaseCardBindV2Mixin from "./JfbBaseCardBindV2Mixin";
|
|
61
|
-
import { getContainerPropsValue } from "@/utils/xd.base";
|
|
62
|
+
import { getContainerPropsValue,isQrCode } from "@/utils/xd.base";
|
|
62
63
|
import componentsMixins from "@/mixins/componentsMixins";
|
|
63
64
|
import extsMixins from "@/mixins/extsMixins";
|
|
64
65
|
import { mapState } from "vuex"
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
validImageAPIUrl: "",
|
|
92
93
|
backUrl: "",
|
|
93
94
|
inCallbackUrlOrg:'',//是否带有回调地址
|
|
95
|
+
isQrCode: false,
|
|
94
96
|
}
|
|
95
97
|
},
|
|
96
98
|
watch: {
|
|
@@ -99,6 +101,7 @@
|
|
|
99
101
|
}
|
|
100
102
|
},
|
|
101
103
|
created() {
|
|
104
|
+
this.isQrCode = isQrCode(this)
|
|
102
105
|
this.init(this.container);
|
|
103
106
|
this.validImageAPIUrl = this.brandInfo['api_host'] + '/common/v1/valid_code/image/show'
|
|
104
107
|
|
|
@@ -176,7 +179,6 @@
|
|
|
176
179
|
success: res => {
|
|
177
180
|
let result = res.resultStr;
|
|
178
181
|
this.cardForm.card_qrcode = result;
|
|
179
|
-
|
|
180
182
|
jfbRootExec("qrCardBind", {
|
|
181
183
|
vm: this,
|
|
182
184
|
data: {
|
|
@@ -367,9 +367,7 @@ export default {
|
|
|
367
367
|
this.$xdHideLoading();
|
|
368
368
|
//#ifdef MP-WEIXIN
|
|
369
369
|
if (this.jfbAuthorize !== null) {
|
|
370
|
-
this.jfbAuthorize.
|
|
371
|
-
expires: res["card_expire_in"] / 60 / 60,
|
|
372
|
-
});
|
|
370
|
+
this.jfbAuthorize.setCardToken(res);
|
|
373
371
|
this.handleToApp(entry);
|
|
374
372
|
}
|
|
375
373
|
//#endif
|
|
@@ -121,7 +121,7 @@ export default {
|
|
|
121
121
|
},
|
|
122
122
|
created() {
|
|
123
123
|
this.init(this.container);
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
},
|
|
126
126
|
methods: {
|
|
127
127
|
onJfbLoad(options) {
|
|
@@ -195,9 +195,9 @@ export default {
|
|
|
195
195
|
* @param container {object} 业务组件对象自己
|
|
196
196
|
*/
|
|
197
197
|
init(container) {},
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
onJfbBack(options) {
|
|
200
|
-
|
|
200
|
+
this.$xdUniHelper.navigateBack();
|
|
201
201
|
},
|
|
202
202
|
},
|
|
203
203
|
};
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<div class="card-list__content">
|
|
42
42
|
<view>
|
|
43
43
|
<text>券号:</text>
|
|
44
|
-
<text>{{item.card_number}}</text>
|
|
44
|
+
<text>{{item.card_number}}{{isShowIndex?`--${item.index}`:''}}</text>
|
|
45
45
|
</view>
|
|
46
46
|
</div>
|
|
47
47
|
<view class="card-list__date">
|
|
@@ -169,8 +169,8 @@ export default {
|
|
|
169
169
|
mixins: [componentsMixins, extsMixins, JfbBaseCardDisabledEntryMixin, colorCardMixins, cardListMixins],
|
|
170
170
|
data() {
|
|
171
171
|
return {
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
isShowUnbind: false,
|
|
173
|
+
isShowIndex:false,
|
|
174
174
|
};
|
|
175
175
|
},
|
|
176
176
|
computed:{
|
|
@@ -191,9 +191,11 @@ export default {
|
|
|
191
191
|
},
|
|
192
192
|
methods: {
|
|
193
193
|
onJfbLoad(options) {
|
|
194
|
+
this.isShowIndex = options['show_index'] === '1';
|
|
194
195
|
this.getCardList();
|
|
195
196
|
},
|
|
196
197
|
|
|
198
|
+
|
|
197
199
|
getCardList() {
|
|
198
200
|
this.$xdShowLoading({});
|
|
199
201
|
jfbRootExec("getDisableCardListEntry", {vm: this, data: {is_all: "Y", is_show_entry_settings: 'Y'},})
|
|
@@ -233,14 +235,16 @@ export default {
|
|
|
233
235
|
vm: this,
|
|
234
236
|
success: (res) => {
|
|
235
237
|
if (res.confirm) {
|
|
236
|
-
let cardIds = this.
|
|
238
|
+
let cardIds = this.cardOrgList.map(item=>{
|
|
237
239
|
return item.card_number + ''
|
|
238
240
|
});
|
|
241
|
+
debugger
|
|
239
242
|
jfbRootExec("batchDisabledCardUnbindEntry", {vm: this, data: {card_numbers: cardIds.join(','),},})
|
|
240
243
|
.then((res) => {
|
|
241
244
|
this.$xdAlert({
|
|
242
245
|
content: "全部失效票券已解绑",
|
|
243
246
|
close: () => {
|
|
247
|
+
this.clearData();
|
|
244
248
|
this.getCardList();
|
|
245
249
|
},
|
|
246
250
|
});
|
|
@@ -275,6 +279,7 @@ export default {
|
|
|
275
279
|
this.$xdAlert({
|
|
276
280
|
content: "票券已解绑",
|
|
277
281
|
close: () => {
|
|
282
|
+
this.clearData();
|
|
278
283
|
this.getCardList();
|
|
279
284
|
},
|
|
280
285
|
});
|
|
@@ -295,7 +300,7 @@ export default {
|
|
|
295
300
|
init(container) {},
|
|
296
301
|
|
|
297
302
|
onJfbBack(options) {
|
|
298
|
-
|
|
303
|
+
this.$xdUniHelper.navigateBack();
|
|
299
304
|
},
|
|
300
305
|
|
|
301
306
|
},
|