jufubao-base 1.0.77 → 1.0.78-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-base",
3
- "version": "1.0.77",
3
+ "version": "1.0.78-beta1",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -29,6 +29,7 @@ class JfbAuthorize {
29
29
  'card': 'JFB-CARD-TOKEN-{siteID}',
30
30
  'refresh': 'JFB-REFRESH-TOKEN-{siteID}',
31
31
  'access': 'JFB-ACCESS-TOKEN',
32
+ 'cardCode':'JFB-CARD-CODE-{siteID}'
32
33
  }, settings.token? settings.token: {});
33
34
  }
34
35
 
@@ -40,6 +41,7 @@ class JfbAuthorize {
40
41
  * @returns {string|*}
41
42
  */
42
43
  getTokenKeyword(key){
44
+
43
45
  if (!this.config[key]) key = 'user';
44
46
  if(key === 'access') return this.config.access;
45
47
  else{
@@ -83,6 +85,8 @@ class JfbAuthorize {
83
85
  */
84
86
  removeToken(key, options = {}) {
85
87
  key = this.getTokenKeyword(key);
88
+ let codeKey = this.getTokenKeyword('cardCode');
89
+ debugger
86
90
  //#ifdef H5
87
91
  cookie.remove(key, options);
88
92
  console.warn(`cookie.key=${key}`);
@@ -142,7 +146,7 @@ class JfbAuthorize {
142
146
  * @description 跳转到用户登陆页面
143
147
  * @param $vm {Vue}
144
148
  */
145
- jumpToUserLogin($vm) {
149
+ jumpToUserLogin($vm,isRedirect) {
146
150
  let redirect_url = '';
147
151
  if(store.state.configProject.platform === 'mp.weixin') {
148
152
  redirect_url = $vm['$xdUniHelper'].parseURL().source;
@@ -131,4 +131,13 @@ module.exports = [
131
131
  provider_id: ['登陆提供者id', 'String', '必选']
132
132
  }
133
133
  },
134
+ {
135
+ mapFnName: 'loginExperience',
136
+ title: '体验码登录',
137
+ path: '/passport-pb/v1/user/login-experience',
138
+ isRule: false,
139
+ params: {
140
+ experience_code: ['体验码code', 'String', '必选'],
141
+ }
142
+ },
134
143
  ];
@@ -4,6 +4,32 @@ export default {
4
4
  style: [],
5
5
  advanced: [],
6
6
  content: [
7
+ {
8
+ label: 'LOGO文字颜色:',
9
+ ele: 'xd-color',
10
+ valueKey: 'logoTextColor',
11
+ value: '',
12
+ placeholder: '请输入LOGO文字颜色',
13
+ classNmae: 'input80',
14
+ },
15
+ {
16
+ label: '是否使用体验码功能:',
17
+ ele: 'xd-radio',
18
+ valueKey: 'isPreview',
19
+ value: 'N',
20
+ placeholder: '请选择是否使用体验码功能',
21
+ multiple: false,
22
+ className: 'input80',
23
+ list: [
24
+ {label: '是', value: 'Y'},
25
+ {label: '否', value: 'N'},
26
+ ]
27
+ },
28
+ {
29
+ ele: 'title',
30
+ label: '页面连接设置',
31
+ size: 'small',
32
+ },
7
33
  {
8
34
  label: '快速授权失败访问地址:', //label
9
35
  ele: 'xd-select-pages-path', //package 名称
@@ -60,12 +86,9 @@ export default {
60
86
  inline: false,
61
87
  },
62
88
  {
63
- label: 'logo文字颜色:',
64
- ele: 'xd-color',
65
- valueKey: 'logoTextColor',
66
- value: '',
67
- placeholder: '请输入logo文字颜色',
68
- classNmae: 'input80',
89
+ ele: 'title',
90
+ label: '服务设置',
91
+ size: 'small',
69
92
  },
70
93
  {
71
94
  label: '隐私政策:',
@@ -170,6 +170,25 @@
170
170
  >忘记密码</view
171
171
  >
172
172
  </view>
173
+ <view class="bottom_btn" :style="prod_bottom" v-if="isPreview === 'Y'">
174
+ <view @click="dialogPreview = true" :style="{
175
+ color: mainColor,
176
+ border: `1px solid ${mainColor}`
177
+ }">进入体验 ></view>
178
+ </view>
179
+ <xd-dailog
180
+ v-if="dialogPreview"
181
+ title="体验码"
182
+ :show.sync="dialogPreview"
183
+ :cancel="false"
184
+ confirm-text="进入体验模式"
185
+ @onBtn="handlePreview"
186
+ @close="previewAccout=''"
187
+ >
188
+ <view class="preview-login">
189
+ <input v-model="previewAccout" type="text" class="preview-login-input" placeholder="请输入体验码">
190
+ </view>
191
+ </xd-dailog>
173
192
  </view>
174
193
  </view>
175
194
  </template>
@@ -187,6 +206,7 @@ import XdFormCheckbox from "@/components/XdFormCheckbox/XdFormCheckbox";
187
206
  import XdFormInput from "@/components/XdFormInput/XdFormInput";
188
207
  import XdForm from "@/components/XdForm/XdForm";
189
208
  import XdFormItem from "@/components/XdFormItem/XdFormItem";
209
+ import XdDailog from "@/components/XdDailog/XdDailog.vue";
190
210
  import { Base64 } from "js-base64";
191
211
  import { mapState } from "vuex";
192
212
  import getServiceUrl from "@/common/getServiceUrl";
@@ -208,15 +228,19 @@ export default {
208
228
  XdFormInput,
209
229
  XdForm,
210
230
  XdFormItem,
231
+ XdDailog
211
232
  },
212
233
  mixins: [componentsMixins, extsMixins, JfbBaseLoginMixin, privacyMixins],
213
234
  data() {
214
235
  return {
236
+ //体验模式
237
+ dialogPreview: false,
238
+ previewAccout: '',
239
+
215
240
  showStep: 1,
216
241
  panel_1_checked: "",
217
242
  panel_2_checked: "",
218
243
  password: "",
219
- //todo
220
244
  accountLoginType: "phone", //phone: 验证码登录 pwd: 密码登录
221
245
  accountForm: {
222
246
  phone_number: "", //15801505541
@@ -255,6 +279,7 @@ export default {
255
279
  logo: "",
256
280
  partnerName: "",
257
281
  logoTextColor: "",
282
+ isPreview:'N', //是否启用体验码模式
258
283
  };
259
284
  },
260
285
  computed: {
@@ -265,6 +290,9 @@ export default {
265
290
  panelTwoIsChecked() {
266
291
  return this.panel_2_checked.includes(1);
267
292
  },
293
+ prod_bottom() {
294
+ return this.fixedStyle({ height: 0, zIndex: 111 });
295
+ },
268
296
  },
269
297
  watch: {
270
298
  container(value) {
@@ -296,16 +324,46 @@ export default {
296
324
  url: `/pages/content/content?${params}`
297
325
  })
298
326
  },
299
-
300
-
327
+
328
+ loginPreview(experience_code){
329
+ return new Promise((resolve,reject)=>{
330
+ jfbRootExec("loginExperience", {
331
+ vm: this,
332
+ data: {experience_code},
333
+ }).then(res=>{
334
+ resolve(res)
335
+ }).catch(err=>{
336
+ reject(err)
337
+ })
338
+ })
339
+ },
340
+
341
+ async handlePreview(){
342
+ if(!this.previewAccout) {
343
+ this.$xdAlert({
344
+ content: '请输入体验码',
345
+ type:'error'
346
+ });
347
+ return;
348
+ }
349
+ this.$xdShowLoading({});
350
+ try{
351
+ const res = await this.loginPreview(this.previewAccout);
352
+ if(res) this.jfbAuthorize.setAllToken(res);
353
+ this.toHomeAfterLogin();
354
+ this.$xdHideLoading();
355
+ }catch (e){
356
+ this.$xdHideLoading();
357
+ }
358
+ },
359
+
360
+
301
361
  onJfbLoad(options) {
302
362
  this.redirect_url = options.redirect_url ? Base64.decode(options.redirect_url): '';
303
363
  // #ifdef MP-WEIXIN
304
364
  this.authWxMpListProviders();
305
365
  // #endif
306
-
307
366
  this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.start')
308
-
309
367
  // #ifdef H5
310
368
  try{
311
369
  this.authH5ListProviders();
@@ -313,7 +371,6 @@ export default {
313
371
  this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.error');
314
372
  this.$xdLog.setARMSError(error);
315
373
  }
316
-
317
374
  //#endif
318
375
 
319
376
  // if (options.isDebug === "1") {
@@ -354,7 +411,7 @@ export default {
354
411
  this.phone_number_collect_url = getContainerPropsValue(value, "content.phone_number_collect_url", {value: ''}).value;
355
412
  this.forget_pwd_url = getContainerPropsValue(value, "content.forget_pwd_url", {value: ''}).value;
356
413
  this.error_callback_url = getContainerPropsValue(value, "content.error_url", {value: ''}).value;
357
-
414
+ this.isPreview = getContainerPropsValue(value, "content.isPreview", 'N');
358
415
  },
359
416
 
360
417
  /**
@@ -464,22 +521,22 @@ export default {
464
521
  "62fde99f2583a19c58fd937b",
465
522
  "62fde9432583a19c58fd937a",
466
523
  ];
467
-
524
+
468
525
  let { redirect_url, callback_url } = this;
469
-
526
+
470
527
  //不同项目直接域名替换
471
528
  if (/^(@site_domain@).+$/.test(redirect_url)) {
472
529
  redirect_url = redirect_url.replace(/@site_domain@/, location.origin)
473
530
  }
474
-
531
+
475
532
  try {
476
533
  let redirectURL = new URL(redirect_url);
477
534
  redirect_url = redirectURL.href;
478
535
  } catch (e) {
479
536
  redirect_url = location.origin + this.base + redirect_url;
480
537
  }
481
-
482
-
538
+
539
+
483
540
  let params = {
484
541
  providers: providers.join(","),
485
542
  callback_url: redirect_url,
@@ -487,9 +544,9 @@ export default {
487
544
  phone_number_collect_url: location.origin + this.base + this.phone_number_collect_url,
488
545
  error_callback_url: location.origin + this.base + this.error_callback_url,
489
546
  };
490
-
547
+
491
548
  this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.loading..');
492
-
549
+
493
550
  jfbRootExec("listSiteProvider", {
494
551
  vm: this,
495
552
  data: params,
@@ -116,7 +116,7 @@
116
116
  mixins: [componentsMixins,extsMixins,JfbBasePosterMixin],
117
117
  data() {
118
118
  return {
119
- selfMask: true,
119
+ selfMask: false,
120
120
  params: {},
121
121
 
122
122
  //Swiper 配置
@@ -37,25 +37,28 @@
37
37
  <xd-font-icon :color="color" icon="iconwode_mian" size="100"></xd-font-icon>
38
38
  </view>
39
39
  </template>
40
- <view class="no-image" :style="{borderColor: color}" v-else>
40
+ <view v-else class="no-image" :style="{borderColor: color}">
41
41
  <xd-font-icon :color="color" icon="iconwode_mian" size="90"></xd-font-icon>
42
42
  </view>
43
+
43
44
  <view v-if="logined && textType ==='N'" :style="{color:color}">{{userInfo|getName}}</view>
44
45
  <view class="vertical-user" v-if="logined && textType ==='Y'" :style="{color:color}">
45
46
  <view>{{userInfo|getName}}</view>
46
- <view @click="handleToLink()" v-if="0">
47
+ <view @click="handleToLink()">
47
48
  <xd-font-icon :color="color" size="40" icon="iconshezhi_mian"></xd-font-icon>
48
49
  </view>
49
50
  </view>
50
51
  </view>
51
- <view @click="handleToLink()" v-if="logined && textType ==='N' && 0 ">
52
- <xd-font-icon :color="color" size="40" icon="iconshezhi_mian"></xd-font-icon>
52
+
53
+ <view @click="handleLogout()" v-if="logined" class="logout">
54
+ <view v-if="textType ==='N'">[退出登录]</view>
53
55
  </view>
54
56
  </view>
55
57
  </view>
56
58
  </view>
57
59
  </template>
58
60
 
61
+
59
62
  <script>
60
63
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
61
64
  import { jfbRootExec } from "@/utils/xd.event";
@@ -64,6 +67,7 @@
64
67
  import extsMixins from "@/mixins/extsMixins"
65
68
  import { getContainerPropsValue } from "@/utils/xd.base";
66
69
  import {mapState} from 'vuex';
70
+ import store from "@/store";
67
71
  export default {
68
72
  name: "JfbBaseUserInfo",
69
73
  components: {
@@ -72,7 +76,7 @@
72
76
  mixins: [componentsMixins,extsMixins,JfbBaseUserInfoMixin],
73
77
  computed: {
74
78
  ...mapState(['jfbAuthorize']),
75
-
79
+
76
80
  outMargin() {
77
81
  let margin = `${this.margin.top !== null ? this.margin.top : 20}rpx`;
78
82
  margin = `${margin} ${this.margin.right !== null ? this.margin.right : 20}rpx`;
@@ -106,24 +110,24 @@
106
110
  logined: false,
107
111
  userInfo: null,
108
112
  address_url: '',
109
-
113
+
110
114
  //基础
111
115
  color: '#333',
112
116
  backgroundColor: 'rgba(0,0,0,0)',
113
117
  textType: 'N', //默认水平
114
118
  radius: 0,
115
-
119
+
116
120
  //投影
117
121
  is_shadow: 'Y',
118
122
  is_shadow_bg: 0,
119
123
  is_shadow_w: 0,
120
-
121
-
124
+
125
+
122
126
  //边框
123
127
  is_border: 'Y',
124
128
  is_border_w: 0,
125
129
  is_border_c: '',
126
-
130
+
127
131
  //其他
128
132
  margin: {
129
133
  top: 0,
@@ -137,7 +141,7 @@
137
141
  right: 0,
138
142
  bottom: 0
139
143
  },
140
-
144
+
141
145
  }
142
146
  },
143
147
  watch: {
@@ -154,8 +158,27 @@
154
158
  url: '/pages/settings/settings'
155
159
  })
156
160
  },
161
+
162
+ async handleLogout(){
163
+ debugger
164
+ // #ifdef H5
165
+ if (this.$configProject.isPreview) return;
166
+ // #endif
167
+
168
+ if (this.jfbAuthorize !== null) {
169
+ this.$xdShowLoading({});
170
+ store.dispatch('logout').then(res=>{
171
+ this.$xdHideLoading();
172
+ this.jfbAuthorize.removeToken('card');
173
+ this.jfbAuthorize.jumpToUserLogin(this, false);
174
+ }).catch(err=>{
175
+ console.error(err);
176
+ })
177
+ }
178
+ },
179
+
157
180
  async onJfbLoad(options) {
158
-
181
+
159
182
  //预览模式
160
183
  if(this.$configProject.isPreview) {
161
184
  jfbRootExec('getBaseUserInfo', {
@@ -170,10 +193,10 @@
170
193
  });
171
194
  return;
172
195
  }
173
-
196
+
174
197
  this.logined = await this.jfbAuthorize.checkUserLogin(true, this, false);
175
198
  if(!this.logined) return;
176
-
199
+
177
200
  jfbRootExec('getBaseUserInfo', {
178
201
  vm: this,
179
202
  data: {}
@@ -194,16 +217,16 @@
194
217
  this.address_url = getContainerPropsValue(container, 'content.address_url', {value: ''});
195
218
  this.color = getContainerPropsValue(container, 'content.textColor', '#333');
196
219
  this.backgroundColor = getContainerPropsValue(container, 'content.backgroundColor', 'rgba(0,0,0,0)');
197
- this.textType = getContainerPropsValue(container, 'content.text_type', 'N');
198
-
220
+ this.textType = "N";//getContainerPropsValue(container, 'content.text_type', 'N');
221
+
199
222
  this.is_shadow = getContainerPropsValue(container, 'content.is_shadow', 'N');
200
223
  this.is_shadow_bg = getContainerPropsValue(container, 'content.is_shadow_bg', '#fff');
201
224
  this.is_shadow_w = getContainerPropsValue(container, 'content.is_shadow_w', '10');
202
-
225
+
203
226
  this.is_border = getContainerPropsValue(container, 'content.is_border', 'N');
204
227
  this.is_border_c = getContainerPropsValue(container, 'content.is_border_c', '#fff');
205
228
  this.is_border_w = getContainerPropsValue(container, 'content.is_border_w', '10');
206
-
229
+
207
230
  this.radius = getContainerPropsValue(container, 'content.radius', '0');
208
231
  },
209
232
  }
@@ -213,7 +236,7 @@
213
236
 
214
237
  <style scoped lang="less">
215
238
  @import "./JfbBaseUserInfoLess.less";
216
-
239
+
217
240
  .vertical-user {
218
241
  display: flex;
219
242
  justify-content: center;
@@ -229,29 +252,29 @@
229
252
  display: flex;
230
253
  align-items: center;
231
254
  justify-content: flex-start;
232
-
233
-
255
+
256
+
234
257
  &-left {
235
258
  display: flex;
236
259
  align-items: center;
237
260
  flex: 1;
238
-
261
+
239
262
  &.vertical {
240
263
  width: 100%;
241
264
  flex-direction: column;
242
-
265
+
243
266
  & > view:last-child {
244
267
  width: 100%;
245
268
  text-align: center;
246
269
  flex-shrink: 0;
247
270
  padding-top: unit(20, rpx);
248
271
  }
249
-
272
+
250
273
  & > image, .no-image {
251
274
  margin-right: unit(0, rpx);
252
275
  }
253
276
  }
254
-
277
+
255
278
  & > image, .no-image {
256
279
  width: unit(140, rpx);
257
280
  height: unit(140, rpx);
@@ -263,21 +286,28 @@
263
286
  flex-shrink: 0;
264
287
  overflow: hidden;
265
288
  }
266
-
289
+
267
290
  .no-image {
268
291
  border: unit(4, rpx) solid #e5e5e5;
269
292
  }
270
-
293
+
271
294
  & > view {
272
295
  color: #383838;
273
296
  font-size: unit(32, rpx);
274
297
  }
275
298
  }
276
-
299
+
277
300
  & > view:nth-child(2) {
278
301
  flex-shrink: 0;
279
302
  }
280
303
  }
281
304
  }
305
+
306
+ .logout {
307
+ font-size: unit(26, rpx);
308
+ & > view {
309
+ color: #333;
310
+ }
311
+ }
282
312
  }
283
313
  </style>