jufubao-base 1.0.119-beta2 → 1.0.119-beta3

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>
@@ -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,18 @@
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
+ },
14
26
  {
15
27
  mapFnName: 'phoneCollect',
16
28
  title: "收集手机号",