jufubao-base 1.0.23 → 1.0.25

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.23",
3
+ "version": "1.0.25",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -14,6 +14,7 @@
14
14
  "create": "node ./commands/create.pack.js",
15
15
  "change": "node ./commands/change.pack",
16
16
  "release": "node ./commands/npmignore && npm publish",
17
+ "view": "node ./commands/update.preview.js base",
17
18
  "init": "cross-env isLocal=false node ./commands.js",
18
19
  "init.local": "cross-env isLocal=true node ./commands.js",
19
20
  "coder": "node ./build/commands/coder.js",
@@ -47,8 +48,8 @@
47
48
  "color": "^3.1.3",
48
49
  "core-js": "^2.6.5",
49
50
  "flyio": "^0.6.2",
50
- "gxd-commands-bussiness": "^1.0.8",
51
- "gxd-uni-library-editx": "1.0.2",
51
+ "gxd-commands-bussiness": "^1.0.12",
52
+ "gxd-uni-library-editx": "1.0.4",
52
53
  "jweixin-module": "^1.6.0",
53
54
  "md5": "^2.3.0",
54
55
  "path-to-regexp": "^6.2.1",
@@ -71,6 +71,7 @@ module.exports = [
71
71
  isRule: false,
72
72
  data: {
73
73
  phone_number: ['手机号', 'String', '必选'],
74
+ biz_name: ['业务名称', 'String', '必选']
74
75
  },
75
76
  isConsole: true,
76
77
  disabled: true,
@@ -121,15 +122,4 @@ module.exports = [
121
122
  isConsole: true,
122
123
  disabled: true,
123
124
  },
124
- {
125
- mapFnName: "sendMsg",
126
- title: "发送手机验证码",
127
- path: "/common/v1/valid_code/sms/send",
128
- isRule: false,
129
- data: {
130
- phone_number: ['手机号', 'Number', '必填']
131
- },
132
- isConsole: true,
133
- disabled: true
134
- }
135
125
  ];
@@ -4,6 +4,50 @@ export default {
4
4
  style: [],
5
5
  advanced: [],
6
6
  content: [
7
+ {
8
+ label: '登录成功跳转地址:', //label
9
+ ele: 'xd-select-pages-path', //package 名称
10
+ valueKey: 'callback_url', //form[valueKey]
11
+ placeholder: '请选择登录成功跳转地址',
12
+ value: null,
13
+ setting: {
14
+ router: XdBus.getParentData('getPagesTree'),
15
+ },
16
+ inline: false,
17
+ },
18
+ {
19
+ label: '手机号登录地址:', //label
20
+ ele: 'xd-select-pages-path', //package 名称
21
+ valueKey: 'phone_number_login_url', //form[valueKey]
22
+ placeholder: '请选择手机号登录地址',
23
+ value: null,
24
+ setting: {
25
+ router: XdBus.getParentData('getPagesTree'),
26
+ },
27
+ inline: false,
28
+ },
29
+ {
30
+ label: '收集手机号地址:', //label
31
+ ele: 'xd-select-pages-path', //package 名称
32
+ valueKey: 'phone_number_collect_url', //form[valueKey]
33
+ placeholder: '请选择收集手机号地址',
34
+ value: null,
35
+ setting: {
36
+ router: XdBus.getParentData('getPagesTree'),
37
+ },
38
+ inline: false,
39
+ },
40
+ {
41
+ label: '忘记密码跳转地址:', //label
42
+ ele: 'xd-select-pages-path', //package 名称
43
+ valueKey: 'forget_pwd_url', //form[valueKey]
44
+ placeholder: '请选择跳转地址',
45
+ value: null,
46
+ setting: {
47
+ router: XdBus.getParentData('getPagesTree'),
48
+ },
49
+ inline: false,
50
+ },
7
51
  {
8
52
  label: '是否展示忘记密码:', //label
9
53
  ele: 'xd-radio', //package 名称
@@ -22,6 +22,9 @@
22
22
  />
23
23
  </view>
24
24
  <view class="login_types">
25
+ <!--#ifdef H5-->
26
+ <xd-button v-if="hasAuthLogin" type="primary" radius="10rpx" @click="doLoginAuth">快捷登录</xd-button>
27
+ <!-- #endif -->
25
28
  <!--#ifdef MP-->
26
29
  <xd-button
27
30
  v-if="hasAuthLogin"
@@ -68,7 +71,7 @@
68
71
  @click="setAccountLoginType('pwd')"
69
72
  >密码登录<text :style="{background: mainColor}"></text></view>
70
73
  </view>
71
-
74
+
72
75
  <xd-form label-width="128"
73
76
  style="margin-top: 40rpx;"
74
77
  label-align="right"
@@ -141,109 +144,6 @@
141
144
  @click="toNotLoginHome"
142
145
  >暂不登录,去逛逛</view>
143
146
  </view>
144
- <view
145
- v-if="showStep == 3"
146
- class="panel-forget-password"
147
- >
148
- <view class="form-group">
149
- <view style="font-size: 36rpx;">请输入手机号</view>
150
- <view style="font-size:26rpx;color: #A6A6A6;">为了您的账号安全,请先验证手机号</view>
151
- </view>
152
- <xd-form
153
- label-width="120"
154
- style="margin-top: 40rpx;"
155
- label-align="right"
156
- content-align="left"
157
- :border="true"
158
- >
159
- <xd-form-item
160
- label="手机号"
161
- content-align="left"
162
- >
163
- <xd-form-input
164
- v-model="resetForm.phone_number"
165
- placeholder="请输入11位手机号"
166
- />
167
- </xd-form-item>
168
- <xd-form-item
169
- label="验证码"
170
- content-align="left"
171
- >
172
- <view class="flex align-center">
173
- <xd-form-input
174
- v-model="resetForm.verification_code"
175
- placeholder="请输入验证码"
176
- />
177
- <view
178
- class="get_code"
179
- @click="reGetCode"
180
- style="{color:mainColor}"
181
- >{{time ? time + '秒后获取':'获取验证码'}}</view>
182
- </view>
183
- </xd-form-item>
184
- </xd-form>
185
- <view class="form-group">
186
- <xd-button
187
- type="primary"
188
- radius="10rpx"
189
- @click="toResetPassword"
190
- >确定</xd-button>
191
- </view>
192
- <view class="forget_tip">
193
- <view>亲爱的用户,为了您的账户安全请联系管理员,或拨打客服热线</view>
194
- <view class="contact_phone">400-800-9503</view>
195
- <xd-button
196
- type="primary"
197
- style="width: 360rpx;"
198
- >知道了</xd-button>
199
- </view>
200
- </view>
201
- <view
202
- v-if="showStep == 4"
203
- class="panel-reset-password"
204
- >
205
- <view class="form-group">
206
- <view style="font-size: 36rpx;">手机号{{resetForm.phone_number}}</view>
207
- <view style="font-size:26rpx;color: #A6A6A6;">请输入新密码并牢记</view>
208
- </view>
209
- <xd-form
210
- label-width="220rpx"
211
- style="margin-top: 40rpx;"
212
- label-align="right"
213
- content-align="left"
214
- :border="true"
215
- >
216
- <xd-form-item
217
- label="输入新密码"
218
- content-align="left"
219
- >
220
- <xd-form-input
221
- v-model="resetForm.password"
222
- type="password"
223
- placeholder="请输入新密码"
224
- />
225
- </xd-form-item>
226
- <xd-form-item
227
- label="确认新密码"
228
- content-align="left"
229
- >
230
- <view class="flex align-center">
231
- <xd-form-input
232
- v-model="resetForm.confirm_password"
233
- type="password"
234
- placeholder="请再次输入新密码"
235
- />
236
- </view>
237
- </xd-form-item>
238
- </xd-form>
239
- <view class="form-group">
240
- <xd-button
241
- type="primary"
242
- radius="10rpx"
243
- @click="doResetPassword"
244
- >确定</xd-button>
245
- </view>
246
- </view>
247
147
  </view>
248
148
  </view>
249
149
  </template>
@@ -305,7 +205,12 @@
305
205
  "account": "用户登录",
306
206
  "dingding": "钉钉登录"
307
207
  },
308
- quickLogin: null
208
+ quickLogin: null,
209
+ redirect_url: "", //401回跳地址
210
+ callback_url: "", //面板配置登录完跳转地址
211
+ phone_number_login_url: "", //授权登录后的手机登录地址
212
+ phone_number_collect_url: "", //授权登录后的手机号手机地址
213
+ forget_pwd_url: "", //忘记密码跳转地址
309
214
  }
310
215
  },
311
216
  computed: {
@@ -322,23 +227,35 @@
322
227
  created() {
323
228
  this.init(this.container);
324
229
  //todo
325
- // this.p_getListProviders();
326
230
  },
327
231
 
328
232
  methods: {
233
+ onJfbLoad(options) {
234
+ this.redirect_url = options.redirect_url;
235
+ this.p_getListProviders();
236
+ },
329
237
  init(value) {
330
- console.log("init: ", value);
331
- console.log("content", value.component.props.content);
238
+ this.callback_url = getContainerPropsValue(value, 'content.callback_url').value;
239
+ this.phone_number_login_url = getContainerPropsValue(value, 'content.phone_number_login_url').value;
240
+ this.phone_number_collect_url = getContainerPropsValue(value, 'content.phone_number_collect_url').value;
241
+ this.forget_pwd_url = getContainerPropsValue(value, 'content.forget_pwd_url').value;
332
242
  },
333
243
  p_getListProviders(){
334
244
  let providers = this.projectAttr.login_providers || '62fde99f2583a19c58fd937b,62fde9432583a19c58fd937a';
245
+ let {redirect_url, callback_url} = this;
246
+ try{
247
+ let redirectURL = new URL(decodeURIComponent(redirect_url));
248
+ redirect_url = redirectURL.href;
249
+ }catch(e){
250
+ redirect_url = location.origin + redirect_url;
251
+ }
335
252
  jfbRootExec("listSiteProvider", {
336
253
  vm: this,
337
254
  data: {
338
255
  providers: providers,
339
- callback_url: 'http://sandbox-editx.jufubao.cn/editx',
340
- phone_number_login_url: 'http://sandbox-editx.jufubao.cn/editx',
341
- phone_number_collect_url: 'http://sandbox-editx.jufubao.cn/editx'
256
+ callback_url: redirect_url || (location.origin + this.settings.index),
257
+ phone_number_login_url: location.origin + this.phone_number_login_url,
258
+ phone_number_collect_url: location.origin + this.phone_number_collect_url
342
259
  }
343
260
  }).then(res => {
344
261
  if(res.quick_enabled){
@@ -435,7 +352,6 @@
435
352
  verification_code
436
353
  },
437
354
  }).then(res => {
438
- // location.href = this.phoneLogin.redirect_url;
439
355
  this.toHomeAfterLogin();
440
356
  })
441
357
  }else if(accountLoginType == "pwd"){
@@ -447,70 +363,42 @@
447
363
  password: password
448
364
  }
449
365
  }).then(res => {
450
- // location.href = this.pwdLogin.redirect_url;
451
366
  this.toHomeAfterLogin();
452
367
  })
453
368
  }
454
369
 
455
370
  },
456
371
  toHomeAfterLogin(){
457
- let {redirect_url} = this.$route.query;
372
+ let {redirect_url, callback_url} = this;
458
373
  if(redirect_url) redirect_url = decodeURIComponent(redirect_url);
459
- redirect_url = redirect_url || this.settings.index;
460
374
  this.$xdUniHelper.redirectTo({
461
- url: redirect_url
375
+ url: redirect_url || callback_url || this.settings.index
462
376
  })
463
377
  },
464
-
378
+
465
379
  //暂不登录, 去逛逛
466
380
  toNotLoginHome(){
467
381
  //location.href = not_login_home_url;
468
382
  },
469
- //验证手机号通过 -> 去重新设置密码
470
- toResetPassword(){
471
- this.showStep = 4;
472
- // const {verification_code, phone_number} = this.resetForm;
473
- // jfbRootExec('verifyPhoneCode', {
474
- // vm: this,
475
- // data: {
476
- // verification_code,
477
- // phone_number
478
- // }
479
- // }).then(res => {
480
- // this.showStep = 4;
481
- // })
482
383
 
483
- },
484
- //接口重设密码
485
- doResetPassword(){
486
- jfbRootExec("forgetPwd", {
487
- vm: this,
488
- data: this.resetForm
489
- }).then(res => {
490
- //重新设置成功
491
- })
492
-
493
- },
494
384
  //跳转验证手机号页面
495
385
  toValidPhone(){
496
- this.showStep = 3;
497
- },
498
- onJfbLoad(options) {
499
- console.log('event.onJfbLoad');
500
- this.p_getListProviders();
501
- },
502
- onJfbScroll(options) {
503
- console.log('event.onJfbScroll', options)
504
- },
505
- onJfbReachBottom(options) {
506
- console.log('event.onJfbReachBottom', options)
507
- },
508
- onJfbShow(options) {
509
- console.log('event.onJfbShow', options)
510
- },
511
- onJfbHide(options) {
512
- console.log('event.onJfbHide', options)
386
+ this.$xdUniHelper.navigateTo({
387
+ url: this.forget_pwd_url
388
+ })
513
389
  },
390
+ // onJfbScroll(options) {
391
+ // console.log('event.onJfbScroll', options)
392
+ // },
393
+ // onJfbReachBottom(options) {
394
+ // console.log('event.onJfbReachBottom', options)
395
+ // },
396
+ // onJfbShow(options) {
397
+ // console.log('event.onJfbShow', options)
398
+ // },
399
+ // onJfbHide(options) {
400
+ // console.log('event.onJfbHide', options)
401
+ // },
514
402
  onJfbBack(options) {
515
403
  console.log('event.onJfbBack', options);
516
404
  if(this.showStep > 1) this.showStep--;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description API模型
5
+ * 建议:Ffff=>模块 Xxxx=>自定义名字
6
+ * 获取单记录(getByIdFfffXxxx)
7
+ * 获取列表记录(getByListFfffXxxx)
8
+ * 添加列表记录(addFfffXxxxx)
9
+ * 删除列表记录(removeFfffXxxxx|deleteFfffXxxx)
10
+ * 更新列表记录(updateFfffXxxxx)
11
+ * @type {*[]}
12
+ */
13
+ module.exports = [
14
+ {
15
+ mapFnName: 'sendMsg',
16
+ title: '发送验证码',
17
+ path: '/common/v1/valid_code/sms/send',
18
+ isRule: false,
19
+ data: {
20
+ phone_number: ['手机号', 'String', '必选'],
21
+ biz_name: ['业务名称', 'String', '必选']
22
+ },
23
+ isConsole: true,
24
+ disabled: true,
25
+ },
26
+ {
27
+ mapFnName: "verifyPhoneCode",
28
+ title: "验证手机验证码",
29
+ path: "/passport/v1/user/check-forget-password-verification-code",
30
+ isRule: false,
31
+ params: {
32
+ phone_number: ['手机号', 'String', '必填'],
33
+ verification_code: ['验证码', 'String', 'false']
34
+ }
35
+ },
36
+ ];
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ export default {
4
+ style: [],
5
+ advanced: [],
6
+ content: [
7
+ {
8
+ label: '客服热线:', //label
9
+ ele: 'el-input', //package 名称
10
+ type: 'text',
11
+ valueKey: 'tell_hot', //form[valueKey]
12
+ value: '', //v-model
13
+ placeholder: '请输入客服电话号码',
14
+ classNmae: 'input40', //样式名称 //input100,input80,input70,input60,input50,input40,input30,input20,
15
+ rules: [
16
+ {
17
+ required: true,
18
+ message: '请输入客服电话号码',
19
+ trigger: 'blur'
20
+ },
21
+ ]
22
+ },
23
+ {
24
+ label: '重新设置密码地址:', //label
25
+ ele: 'xd-select-pages-path', //package 名称
26
+ valueKey: 'reset_pwd_url', //form[valueKey]
27
+ placeholder: '请选择跳转地址',
28
+ value: null,
29
+ setting: {
30
+ router: XdBus.getParentData('getPagesTree'),
31
+ },
32
+ inline: false,
33
+ },
34
+ ],
35
+ }
@@ -0,0 +1,245 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-login-forget-pwd"
4
+ @click="handleSelect"
5
+ :class="{ editx : isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-base-login-forget-pwd__edit"
10
+ :class="{ editx : isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-base-login-forget-pwd__edit-icon" @click="delEdit">删除</view>
14
+ </view>
15
+ <!-- #endif -->
16
+ <view class="jfb-base-login-forget-pwd__body">
17
+ <view
18
+ class="panel-forget-password"
19
+ >
20
+ <view class="form-group">
21
+ <view style="font-size: 36rpx;">请输入手机号</view>
22
+ <view style="font-size:26rpx;color: #A6A6A6;">为了您的账号安全,请先验证手机号</view>
23
+ </view>
24
+ <xd-form
25
+ label-width="126"
26
+ style="margin-top: 40rpx;"
27
+ label-align="right"
28
+ content-align="left"
29
+ :border="true"
30
+ >
31
+ <xd-form-item
32
+ label="手机号"
33
+ content-align="left"
34
+ >
35
+ <xd-form-input
36
+ v-model="resetForm.phone_number"
37
+ placeholder="请输入11位手机号"
38
+ />
39
+ </xd-form-item>
40
+ <xd-form-item
41
+ label="验证码"
42
+ content-align="left"
43
+ >
44
+ <view class="flex align-center">
45
+ <xd-form-input
46
+ v-model="resetForm.verification_code"
47
+ placeholder="请输入验证码"
48
+ />
49
+ <view
50
+ class="get_code"
51
+ @click="reGetCode"
52
+ style="{color:mainColor}"
53
+ >{{time ? time + '秒后获取':'获取验证码'}}</view>
54
+ </view>
55
+ </xd-form-item>
56
+ </xd-form>
57
+ <view class="form-group">
58
+ <xd-button
59
+ type="primary"
60
+ radius="10rpx"
61
+ @click="toResetPassword"
62
+ >确定</xd-button>
63
+ </view>
64
+ <view class="forget_tip">
65
+ <view>亲爱的用户,为了您的账户安全请联系管理员,或拨打客服热线</view>
66
+ <view class="contact_phone">{{tell_hot}}</view>
67
+ <xd-button
68
+ type="primary"
69
+ style="width: 360rpx;"
70
+ >知道了</xd-button>
71
+ </view>
72
+ </view>
73
+ </view>
74
+ </view>
75
+ </template>
76
+
77
+ <script>
78
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
79
+ import { jfbRootExec } from "@/utils/xd.event";
80
+ import JfbBaseLoginForgetPwdMixin from "./JfbBaseLoginForgetPwdMixin";
81
+ import { getContainerPropsValue } from "@/utils/xd.base";
82
+ import XdFormItem from "@/components/XdFormItem/XdFormItem";
83
+ import XdForm from "@/components/XdForm/XdForm";
84
+ import XdFormInput from "@/components/XdFormInput/XdFormInput";
85
+ import XdButton from "@/components/XdButton/XdButton";
86
+
87
+ export default {
88
+ name: "JfbBaseLoginForgetPwd",
89
+ components: {
90
+ XdFontIcon,
91
+ XdFormItem,
92
+ XdForm,
93
+ XdFormInput,
94
+ XdButton
95
+ },
96
+ mixins: [
97
+ JfbBaseLoginForgetPwdMixin
98
+ ],
99
+ data() {
100
+ return {
101
+ resetForm: {
102
+ phone_number: "",
103
+ verification_code: "",
104
+ },
105
+ time: 0,
106
+ interval: null,
107
+ tell_hot: "",
108
+ reset_pwd_url: "",
109
+ //todo
110
+ }
111
+ },
112
+ watch: {
113
+ container(value) {
114
+ this.init(value)
115
+ }
116
+ },
117
+ created() {
118
+ this.init(this.container);
119
+
120
+ //todo
121
+ },
122
+ methods: {
123
+ onJfbLoad(options) {
124
+
125
+ },
126
+ /**
127
+ * @description 监听事件变化
128
+ * @param container {object} 业务组件对象自己
129
+ */
130
+ init(value) {
131
+ this.tell_hot = getContainerPropsValue(value, 'content.tell_hot');
132
+ this.reset_pwd_url = getContainerPropsValue(value, 'content.reset_pwd_url').value;
133
+ //this.bgcolor = getContainerPropsValue(value, 'content.bgcolor', '#fff');
134
+ //this.height = getContainerPropsValue(value, 'content.height', 10);
135
+ },
136
+ reGetCode(){
137
+ if(this.time > 0) return;
138
+ const { phone_number } = this.resetForm;
139
+
140
+ jfbRootExec('sendMsg', {
141
+ vm: this,
142
+ data: {
143
+ phone_number,
144
+ biz_name: "passport-password"
145
+ }
146
+ }).then(res => {
147
+ this.time = 120;
148
+ this.interval = setInterval(() => {
149
+ this.time--;
150
+ if(this.time == 0){
151
+ clearTimeout(this.interval);
152
+ }
153
+ }, 1000)
154
+ })
155
+ },
156
+ toResetPassword(){
157
+ jfbRootExec("verifyPhoneCode", {
158
+ vm: this,
159
+ data: this.resetForm
160
+ }).then(res => {
161
+ this.$xdUniHelper.navigateTo({
162
+ url: this.reset_pwd_url + "?" + this.$xdUniHelper.jsonToParams(this.resetForm)
163
+ })
164
+ })
165
+ },
166
+ // onJfbScroll(options) {
167
+ // console.log('event.onJfbScroll', options)
168
+ // },
169
+ // onJfbReachBottom(options) {
170
+ // console.log('event.onJfbReachBottom', options)
171
+ // },
172
+ // onJfbShow(options) {
173
+ // console.log('event.onJfbShow', options)
174
+ // },
175
+ // onJfbHide(options) {
176
+ // console.log('event.onJfbHide', options)
177
+ // },
178
+ // onJfbBack(options) {
179
+ // console.log('event.onJfbBack', options)
180
+ // },
181
+ }
182
+ }
183
+
184
+ </script>
185
+
186
+ <style scoped lang="less">
187
+ @import "./JfbBaseLoginForgetPwdLess.less";
188
+
189
+ .jfb-base-login-forget-pwd {
190
+ &__body {
191
+ .xd-form-checkbox {
192
+ /deep/ .checklist-content .checklist-text {
193
+ font-size: 26rpx !important;
194
+ }
195
+ }
196
+
197
+ .form-group {
198
+ padding: 20rpx 70rpx;
199
+ }
200
+
201
+ .get_code {
202
+ color: @xd-base-color;
203
+ font-size: 24rpx;
204
+ }
205
+ .panel-forget-password {
206
+ /deep/ .uni-forms-item__label {
207
+ .label-text {
208
+ font-size: 26rpx;
209
+ color: #A6A6A6;
210
+ }
211
+ }
212
+ /deep/ .uni-easyinput__placeholder-class {
213
+ font-size: 26rpx;
214
+ color: #D4D4D4;
215
+ }
216
+
217
+ .forget_tip {
218
+ box-sizing: border-box;
219
+ width: 600rpx;
220
+ border-radius: 10rpx;
221
+ box-shadow: 0px 0px 20px 0px #00000019;
222
+ padding: 64rpx 46rpx;
223
+ margin: 200rpx auto;
224
+ text-align: center;
225
+ font-size: 32rpx;
226
+
227
+ .contact_phone {
228
+ color: @xd-base-color;
229
+ font-size: 56rpx;
230
+ margin: 20rpx 0 30rpx;
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ .flex{
237
+ display: flex;
238
+ }
239
+ .flex-sub{
240
+ flex: 1;
241
+ }
242
+ .align-center{
243
+ align-items: center;
244
+ }
245
+ </style>