jufubao-base 1.0.119-beta2 → 1.0.119-beta4

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.
@@ -0,0 +1,410 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-saas-login"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx : isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-base-saas-login__edit"
10
+ :class="{ editx : isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-base-saas-login__edit-icon" @click="delEdit">删除</view>
14
+ </view>
15
+ <!-- #endif -->
16
+ <view class="jfb-base-saas-login__body" :style="{
17
+ minHeight: layoutInfo.bodyMinHeightPx + 'px'
18
+ }">
19
+ <view class="login_form_wrap">
20
+ <xd-form
21
+ label-width="130"
22
+ label-align="right"
23
+ content-align="left"
24
+ :border="true"
25
+ paddingBetween="40"
26
+ >
27
+ <xd-form-item class="form-item"
28
+ label="手机号"
29
+ content-align="left"
30
+ >
31
+ <xd-form-input
32
+ v-model="accountForm.phone_number"
33
+ placeholder="请输入11位手机号"
34
+ />
35
+ </xd-form-item>
36
+ <xd-form-item
37
+ label="验证码"
38
+ content-align="left"
39
+ >
40
+ <view class="flex align-center">
41
+ <xd-form-input
42
+ v-model="accountForm.verification_code"
43
+ placeholder="请输入验证码"
44
+ />
45
+ <view
46
+ class="get_code"
47
+ @click="reGetCode"
48
+ :style="{ color: mainColor }"
49
+ >{{ time ? time + "秒后获取" : "获取验证码" }}
50
+ </view>
51
+ </view>
52
+ </xd-form-item>
53
+ <!-- <xd-form-item
54
+ label="密码"
55
+ content-align="left"
56
+ >
57
+ <xd-form-input
58
+ type="password"
59
+ v-model="accountForm.password"
60
+ placeholder="请输入密码"
61
+ />
62
+ </xd-form-item> -->
63
+ </xd-form>
64
+
65
+ <view class="form-group" style="padding-bottom:0">
66
+ <xd-form-checkbox
67
+ class="xd-form-checkbox"
68
+ v-model="panel_2_checked"
69
+ mode="default"
70
+ multiple
71
+ :localdata="[{ value: 1, text: '登录即同意《隐私政策》《用户服务协议》' },]"
72
+ >
73
+ <template slot="a1">
74
+ <view>
75
+ <text>请阅读并同意</text>
76
+ <text @click.stop="handlePrivacy('privacy_privacy')" :style="{color: mainColor}">《隐私政策》</text>
77
+ <text @click.stop="handlePrivacy('privacy_service')" :style="{color: mainColor}">《用户服务协议》</text>
78
+ </view>
79
+ </template>
80
+ </xd-form-checkbox>
81
+ </view>
82
+ <view class="form-group">
83
+ <xd-button
84
+ style="flex: 1"
85
+ type="primary"
86
+ radius="10rpx"
87
+ :disabled="!panelTwoIsChecked"
88
+ @click="doLoginForm"
89
+ >登录</xd-button>
90
+ </view>
91
+ <!-- <view
92
+ class="forget_password"
93
+ @click="toValidPhone"
94
+ >忘记密码</view> -->
95
+ </view>
96
+ <view class="not_login">暂不登录,去逛逛</view>
97
+ <xd-dailog :show.sync="dialogShow" title="">
98
+ <view class="dia_title">您在多个企业任职<br/>请选择本次要访问的企业</view>
99
+ <view class="company_list">
100
+ <view class="company_item" v-for="(item, i) in companyList" :key="i" @click="toHome(item)">
101
+ <view class="_name">{{ item.company_name }}</view>
102
+ <xd-font-icon icon="iconxiangyou_xian" :size="30"></xd-font-icon>
103
+ </view>
104
+ </view>
105
+ <view slot="btn"></view>
106
+ </xd-dailog>
107
+ </view>
108
+ </view>
109
+ </template>
110
+
111
+ <script>
112
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
113
+ import XdButton from "@/components/XdButton/XdButton";
114
+ import XdFormCheckbox from "@/components/XdFormCheckbox/XdFormCheckbox";
115
+ import XdFormInput from "@/components/XdFormInput/XdFormInput";
116
+ import XdForm from "@/components/XdForm/XdForm";
117
+ import XdFormItem from "@/components/XdFormItem/XdFormItem";
118
+ import XdDailog from "@/components/XdDailog/XdDailog"
119
+ import { jfbRootExec } from "@/utils/xd.event";
120
+ import JfbBaseSaasLoginMixin from "./JfbBaseSaasLoginMixin";
121
+ import { getContainerPropsValue } from "@/utils/xd.base";
122
+ import componentsMixins from "@/mixins/componentsMixins";
123
+ import extsMixins from "@/mixins/extsMixins";
124
+ export default {
125
+ name: "JfbBaseSaasLogin",
126
+ components: {
127
+ XdFontIcon,
128
+ XdButton,
129
+ XdFormCheckbox,
130
+ XdFormInput,
131
+ XdForm,
132
+ XdFormItem,
133
+ XdDailog
134
+ },
135
+ mixins: [
136
+ componentsMixins, extsMixins, JfbBaseSaasLoginMixin
137
+ ],
138
+ computed: {
139
+ panelTwoIsChecked() {
140
+ return this.panel_2_checked.includes(1);
141
+ },
142
+ },
143
+ data() {
144
+ return {
145
+ accountForm: {
146
+ phone_number: "",
147
+ password: "",
148
+ verification_code: ""
149
+ },
150
+ time: 0,
151
+ panel_2_checked: "",
152
+ redirect_url: "", //401回跳地址
153
+ dialogShow: false,
154
+ companyList: [],
155
+
156
+ //面板
157
+ callback_url: "", //面板配置登录完跳转地址
158
+ forget_pwd_url: "", //忘记密码跳转地址
159
+ }
160
+ },
161
+ watch: {
162
+ container(value) {
163
+ this.init(value)
164
+ }
165
+ },
166
+ created() {
167
+ this.init(this.container);
168
+ },
169
+ methods: {
170
+ onJfbLoad(options) {
171
+ this.redirect_url = options.redirect_url ? Base64.decode(options.redirect_url): '';
172
+ },
173
+ /**
174
+ * @description 监听事件变化
175
+ * @param container {object} 业务组件对象自己
176
+ */
177
+ init(container) {
178
+ this.callback_url = getContainerPropsValue(container, "content.callback_url", {value: ''}).value;
179
+ this.forget_pwd_url = getContainerPropsValue(container, "content.forget_pwd_url", {value: ''}).value;
180
+ },
181
+ doLoginForm() {
182
+ const { phone_number, password, verification_code } = this.accountForm;
183
+ let err_tip = "";
184
+ if (!phone_number) err_tip = "手机号不能为空";
185
+ else if (!verification_code) err_tip = "验证码不能为空";
186
+ if (err_tip) {
187
+ return uni.showToast({
188
+ title: err_tip,
189
+ icon: "none",
190
+ });
191
+ }
192
+
193
+ this.$xdShowLoading({})
194
+ jfbRootExec("sassLogin", {
195
+ vm: this,
196
+ data: {
197
+ biz_name: "login",
198
+ phone_number: phone_number,
199
+ valid_code: verification_code,
200
+ },
201
+ })
202
+ .then((res) => {
203
+ this.$xdHideLoading()
204
+ // this.jfbAuthorize.setAllToken(res);
205
+ // this.toHomeAfterLogin();
206
+ if(res.list.length === 0){
207
+ uni.showToast({
208
+ title: '该用户没有所属企业',
209
+ duration: 2000
210
+ });
211
+ }
212
+ else if(res.list.length > 1){
213
+ this.companyList = res.list;
214
+ this.dialogShow = true;
215
+ }else{
216
+ this.toHome(res.list[0])
217
+ }
218
+ })
219
+ .catch(error => {
220
+ this.$xdHideLoading()
221
+ this.$xdLog.catch(error)
222
+ });
223
+ },
224
+ toHome(item){
225
+ this.$xdUniHelper.redirectTo({
226
+ url: `/apply/main/saas/home?company_id=${item.company_id}`
227
+ });
228
+ // this.toHomeAfterLogin();
229
+ },
230
+ toHomeAfterLogin() {
231
+ let { redirect_url, callback_url } = this;
232
+ if (redirect_url) redirect_url = redirect_url;
233
+ this.$xdUniHelper.redirectTo({
234
+ url: redirect_url || callback_url || this.settings.index,
235
+ });
236
+ },
237
+ //跳转忘记密码
238
+ toValidPhone() {
239
+ this.$xdUniHelper.navigateTo({
240
+ url: this.forget_pwd_url,
241
+ });
242
+ },
243
+ handlePrivacy(code){
244
+ let params = `page_id=${this.pageAttr["page_id"]}`;
245
+ params = `${params}&container_id=${this.containerId}${code}`;
246
+ this.$xdUniHelper.navigateTo({
247
+ url: `/pages/content/content?${params}`
248
+ })
249
+ },
250
+ reGetCode() {
251
+ if (this.time > 0) return;
252
+ const { phone_number } = this.accountForm;
253
+ if (!/^1[3-9]\d{9}$/.test(phone_number)) {
254
+ uni.showToast({
255
+ title: "请填写正确的手机号",
256
+ icon: "none",
257
+ });
258
+ return false;
259
+ }
260
+ this.$xdShowLoading({});
261
+ jfbRootExec("sendMsg", {
262
+ vm: this,
263
+ data: {
264
+ phone_number,
265
+ biz_name: "login",
266
+ },
267
+ }).then((res) => {
268
+ this.$xdHideLoading();
269
+ this.time = 120;
270
+ this.interval = setInterval(() => {
271
+ this.time--;
272
+ if (this.time === 0) {
273
+ clearTimeout(this.interval);
274
+ }
275
+ }, 1000);
276
+ }).catch((error) => {
277
+ this.$xdHideLoading();
278
+ console.error(error);
279
+ this.$xdLog.catch(error)
280
+ });
281
+ },
282
+ onJfbScroll(options) {
283
+
284
+ },
285
+ onJfbReachBottom(options) {
286
+ console.log('event.onJfbReachBottom', options)
287
+ },
288
+ onJfbShow(options) {
289
+ console.log('event.onJfbShow', options)
290
+ },
291
+ onJfbHide(options) {
292
+ console.log('event.onJfbHide', options)
293
+ },
294
+ onJfbBack(options) {
295
+ console.log('event.onJfbBack', options)
296
+ this.$xdUniHelper.navigateBack();
297
+ },
298
+ onJfbUpdate(...data) {
299
+ console.log('event.onJfbUpdate', data)
300
+ },
301
+ onJfbCustomEvent(options) {
302
+ console.log('event.onJfbReachBottom', options)
303
+ },
304
+ }
305
+ }
306
+
307
+ </script>
308
+
309
+ <style scoped lang="less">
310
+ @import "./JfbBaseSaasLoginLess.less";
311
+
312
+ .jfb-base-saas-login {
313
+ border: 1px dashed rgba(0, 0, 0, 0);
314
+ box-sizing: border-box;
315
+ &__body{
316
+ position: relative;
317
+ .dia_title{
318
+ color: #333333;
319
+ font-size: 32rpx;
320
+ font-weight: 500;
321
+ margin: 60rpx 0;
322
+ }
323
+ .company_list{
324
+ .company_item{
325
+ display: flex;
326
+ justify-content: space-between;
327
+ background: #FE7A63;
328
+ border-radius: 60rpx;
329
+ padding: 20rpx 48rpx;
330
+ color: #FFFFFF;
331
+ margin: 20rpx 0;
332
+ ._name{
333
+ flex: 1;
334
+ width: 100rpx;
335
+ overflow: hidden;
336
+ white-space: nowrap;
337
+ text-overflow: ellipsis;
338
+ }
339
+ }
340
+ }
341
+ .not_login{
342
+ position: absolute;
343
+ bottom: 200rpx;
344
+ text-align: center;
345
+ width: 100%;
346
+ color: #FE7A63;
347
+ font-size: 24rpx;
348
+ }
349
+ .xd-form-checkbox {
350
+ /deep/ .checklist-content .checklist-text {
351
+ font-size: 26rpx !important;
352
+ }
353
+ }
354
+ .xd-form-checkbox {
355
+ /deep/ .checklist-box {
356
+ margin: 0;
357
+ }
358
+ }
359
+ .xd-form-checkbox {
360
+ /deep/ .checklist-group {
361
+ justify-content: center;
362
+ }
363
+ }
364
+ .xd-form-checkbox {
365
+ /deep/ .checklist-text {
366
+ margin-left: unit(20,rpx) !important;
367
+ }
368
+ }
369
+
370
+ .form-group {
371
+ padding: 40rpx 70rpx;
372
+ }
373
+ .get_code {
374
+ color: @xd-base-color;
375
+ font-size: 24rpx;
376
+ margin-right: unit(20,rpx);
377
+ }
378
+ .form-item {
379
+ /deep/ .uni-forms-item {
380
+ padding-left: unit(30rpx) !important;
381
+ }
382
+ }
383
+ /deep/ .uni-forms-item__label {
384
+ .label-text {
385
+ font-size: 26rpx;
386
+ color: #a6a6a6;
387
+ }
388
+ }
389
+ /deep/ .uni-easyinput__placeholder-class {
390
+ font-size: 26rpx;
391
+ color: #d4d4d4;
392
+ }
393
+ .forget_password {
394
+ font-size: 24rpx;
395
+ color: #a6a6a6;
396
+ text-align: right;
397
+ margin: 20rpx 70rpx 0 0;
398
+ }
399
+ }
400
+ }
401
+ .flex {
402
+ display: flex;
403
+ }
404
+ .flex-sub {
405
+ flex: 1;
406
+ }
407
+ .align-center {
408
+ align-items: center;
409
+ }
410
+ </style>
@@ -12,7 +12,7 @@ export default {
12
12
  ele: 'xd-select-pages-path', //package 名称
13
13
  valueKey: 'newsDetailUrl', //form[valueKey]
14
14
  placeholder: '请选择新闻详情地址',
15
- value: null,
15
+ value: data.newsDetailUrl || null,
16
16
  setting: {
17
17
  router: XdBus.getParentApi('getPagesTree'),
18
18
  },
@@ -66,7 +66,8 @@
66
66
  },
67
67
  methods: {
68
68
  onJfbLoad(options) {
69
- this.p_getNewsList("news")
69
+ let position_id = options.position_id;
70
+ this.p_getNewsList(position_id)
70
71
  },
71
72
  /**
72
73
  * @description 监听事件变化
@@ -11,6 +11,33 @@
11
11
  * @type {*[]}
12
12
  */
13
13
  module.exports = [
14
+ {
15
+ mapFnName: "phoneAuth",
16
+ title: "三方登入 - 手机号认证",
17
+ path: "/saas/v1/login/phone-auth",
18
+ isRule: false,
19
+ data: {
20
+ access_code: ['临时访问标识', 'String', true],
21
+ valid_code: ['验证码', 'String', true],
22
+ },
23
+ isConsole: true,
24
+ disabled: true,
25
+ },
26
+ {
27
+ mapFnName: "passportSaasLogin",
28
+ title: "saas用户登录",
29
+ path: "/passport-pb/v1/user/login-saas",
30
+ isRule: false,
31
+ params: {
32
+ access_token: ['access_token', 'String', true],
33
+ redirect_url: ['跳转地址', 'String', true],
34
+ phone_number: ['手机号', 'String', true],
35
+ valid_code: ['手机验证码', 'String', true],
36
+ biz_name: ['验证码校验参数', 'String', true]
37
+ },
38
+ isConsole: true,
39
+ disabled: true,
40
+ },
14
41
  {
15
42
  mapFnName: 'phoneCollect',
16
43
  title: "收集手机号",
@@ -25,6 +25,7 @@
25
25
  <xd-form-item label="手机号" content-align="left">
26
26
  <xd-form-input
27
27
  v-model="accountForm.phone_number"
28
+ disabled
28
29
  placeholder="请输入11位手机号"
29
30
  />
30
31
  </xd-form-item>
@@ -43,7 +44,7 @@
43
44
  </view>
44
45
  </xd-form-item>
45
46
  </xd-form>
46
- <view class="form-group" style="padding-bottom: 0">
47
+ <!-- <view class="form-group" style="padding-bottom: 0">
47
48
  <xd-form-checkbox
48
49
  class="xd-form-checkbox"
49
50
  v-model="panel_1_checked"
@@ -59,8 +60,8 @@
59
60
  </view>
60
61
  </template>
61
62
  </xd-form-checkbox>
62
- </view>
63
- <view class="form-group">
63
+ </view> -->
64
+ <!-- <view class="form-group">
64
65
  <xd-button
65
66
  style="flex: 1"
66
67
  type="primary"
@@ -69,11 +70,20 @@
69
70
  @click="doLoginForm"
70
71
  >登录</xd-button
71
72
  >
73
+ </view> -->
74
+ <view class="form-group">
75
+ <xd-button
76
+ style="flex: 1"
77
+ type="primary"
78
+ radius="10rpx"
79
+ @click="doLoginForm"
80
+ >确定</xd-button
81
+ >
72
82
  </view>
73
- <view
83
+ <!-- <view
74
84
  class="jump_collect"
75
85
  @click="jumpCollect"
76
- >跳过</view>
86
+ >跳过</view> -->
77
87
  </view>
78
88
  </view>
79
89
  </view>
@@ -111,6 +121,8 @@
111
121
  phone_number: "",
112
122
  verification_code: "",
113
123
  },
124
+ access_code: "",
125
+ phone_number: "",
114
126
  jfbTimeer: 0,
115
127
  interval: null,
116
128
  provider_id: "",
@@ -146,6 +158,9 @@
146
158
  onJfbLoad(options) {
147
159
  this.provider_id = options.provider_id;
148
160
  this.callback_url = options.callback_url;
161
+ this.access_code = options.access_code;
162
+ this.phone_number = options.phone_number;
163
+ this.$set(this.accountForm, 'phone_number', options.phone_number);
149
164
  },
150
165
  /**
151
166
  * @description 监听事件变化
@@ -205,17 +220,16 @@
205
220
  });
206
221
  },
207
222
  doLoginForm() {
208
- const { provider_id } = this;
209
223
  const { phone_number, verification_code } = this.accountForm;
210
224
  if (!phone_number || !verification_code) return uni.showToast({ title: "手机号跟验证码不能为空", icon: "none" });
211
225
 
212
226
  this.$xdShowLoading({})
213
- jfbRootExec("phoneCollect", {
227
+ jfbRootExec("phoneAuth", {
214
228
  vm: this,
215
229
  data: {
216
- provider_id,
217
230
  phone_number,
218
- verification_code,
231
+ valid_code: verification_code,
232
+ access_code: this.access_code
219
233
  },
220
234
  }).then((res) => {
221
235
  this.$xdHideLoading()
@@ -260,7 +274,76 @@
260
274
 
261
275
  .jfb-base-sass-phone-collect {
262
276
  &__body{
277
+ .xd-form-checkbox {
278
+ /deep/ .checklist-content .checklist-text {
279
+ font-size: 26rpx !important;
280
+ }
281
+ }
263
282
 
283
+ .xd-form-checkbox {
284
+ /deep/ .checklist-box {
285
+ margin: 0 !important;
286
+ }
287
+ }
288
+ .xd-form-checkbox {
289
+ /deep/ .checklist-group {
290
+ justify-content: center;
291
+ }
292
+ }
293
+
294
+ .xd-form-checkbox {
295
+ /deep/ .checklist-text {
296
+ margin-left: unit(20,rpx) !important;
297
+ }
298
+ }
299
+
300
+ .form-group {
301
+ padding: 40rpx 70rpx;
302
+ }
303
+
304
+ .get_code {
305
+ color: @xd-base-color;
306
+ font-size: 24rpx;
307
+ }
308
+ .panel-login-password {
309
+ /deep/ .uni-forms-item__label {
310
+ .label-text {
311
+ font-size: 26rpx;
312
+ color: #a6a6a6;
313
+ }
314
+ }
315
+
316
+ /deep/ .uni-easyinput__placeholder-class {
317
+ font-size: 26rpx;
318
+ color: #d4d4d4;
319
+ }
320
+
321
+ .not_login {
322
+ position: fixed;
323
+ width: 100%;
324
+ text-align: center;
325
+ bottom: 100rpx;
326
+ font-size: 24rpx;
327
+ color: #fe7a63;
328
+ }
329
+ .jump_collect{
330
+ font-size: 24rpx;
331
+ color: #a6a6a6;
332
+ text-align: right;
333
+ margin: 20rpx 70rpx 0 0;
334
+ }
335
+ }
264
336
  }
265
337
  }
338
+ .flex {
339
+ display: flex;
340
+ }
341
+
342
+ .flex-sub {
343
+ flex: 1;
344
+ }
345
+
346
+ .align-center {
347
+ align-items: center;
348
+ }
266
349
  </style>