@cloudbase/lowcode-builder 1.9.13 → 1.10.0
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/lib/builder/config/dependencies.js +2 -2
- package/lib/builder/core/index.js +8 -3
- package/lib/builder/h5/generate.js +1 -6
- package/lib/builder/mp/wxml.js +10 -1
- package/lib/builder.web.js +7 -7
- package/package.json +1 -1
- package/template/html/index.html.ejs +4 -4
- package/template/mp/common/util.js +34 -16
- package/template/mp/packages/$wd_system/pages/login/index.js +544 -279
- package/template/mp/packages/$wd_system/pages/login/index.wxml +89 -61
- package/template/mp/packages/$wd_system/pages/login/index.wxss +82 -22
- package/template/mp/packages/$wd_system/pages/login/methods/loginByOpenId.js +24 -0
- package/template/mp/packages/$wd_system/pages/login/methods/loginByUnionId.js +24 -0
|
@@ -1,77 +1,105 @@
|
|
|
1
1
|
<page-meta page-style="{{pageStyle}}">
|
|
2
2
|
<view wx:if="{{!initing && !error}}" class="wd-mp-root" data-weui-theme="light">
|
|
3
3
|
<view style="width:90%;margin:0px auto;display:flex;flex-direction:column;max-width:50rem;" class="login-class">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<button class="{{loginButtonClass}}" style="width:100%;border-radius:5px;" size="md" form-type="submit">
|
|
16
|
-
账号密码登录
|
|
17
|
-
</button>
|
|
18
|
-
</form>
|
|
19
|
-
</view>
|
|
20
|
-
<view wx:if="{{enableSms}}">
|
|
21
|
-
<form bindsubmit="loginBySms">
|
|
22
|
-
<login-input name="phoneNum" defaultValue="{{defaultPhoneNumber}}" placeholder="输入手机号" type="number" auto maxlength="11" bindchange="onPhoneChange">
|
|
23
|
-
<view class="input-prefix" style="color:#acacac;padding: 0 10px" slot="prefix">
|
|
24
|
-
+86
|
|
4
|
+
<block wx:if="{{!baseInfoShow}}">
|
|
5
|
+
<view style="margin:80px 0px 60px;">
|
|
6
|
+
<image style="margin:0px auto;display:flex;justify-content:center;width: 80px;height: 80px;" class="weda-ui weda-image" mode="aspectFit" src="{{settingData.logo}}" />
|
|
7
|
+
</view>
|
|
8
|
+
<view wx:if="{{currentLoginType === 'password'}}">
|
|
9
|
+
<form bindsubmit="loginByPassword">
|
|
10
|
+
<login-input name="username" placeholder="请输入用户名" type="text" />
|
|
11
|
+
<view style="margin-bottom:30px;position:relative;">
|
|
12
|
+
<login-input name="password" placeholder="输入验证码" style="padding-right:100px" type="{{passwordVisible?'text':'password'}}">
|
|
13
|
+
<image style="width:20px;height:20px;padding:0 10px;box-sizing: content-box;" class="weda-ui weda-image wd-event-tap input-suffix" mode="widthFix" src="{{passwordVisible?'https://qcloudimg.tencent-cloud.cn/raw/487eba32ccfc23ebc68f8fac005d6919.svg':'https://qcloudimg.tencent-cloud.cn/raw/0b6cef53d62a3356e3bcc5bd83341482.svg'}}" bind:tap="togglePasswordVisible" slot="suffix" />
|
|
14
|
+
</login-input>
|
|
25
15
|
</view>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
<button class="{{loginButtonClass}}" style="width:100%;border-radius:5px;" size="md" form-type="submit">
|
|
17
|
+
账号密码登录
|
|
18
|
+
</button>
|
|
19
|
+
</form>
|
|
20
|
+
</view>
|
|
21
|
+
<view wx:elif="{{currentLoginType === 'sms'}}">
|
|
22
|
+
<form bindsubmit="loginBySms">
|
|
23
|
+
<login-input name="phoneNum" defaultValue="{{defaultPhoneNumber}}" placeholder="输入手机号" type="number" auto maxlength="11" bindchange="onPhoneChange">
|
|
24
|
+
<view class="input-prefix" style="color:#acacac;padding: 0 10px" slot="prefix">
|
|
25
|
+
+86
|
|
31
26
|
</view>
|
|
32
27
|
</login-input>
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
<view style="margin-bottom:30px;position:relative;">
|
|
29
|
+
<login-input name="verificationCode" placeholder="输入验证码" style="padding-right:100px" type="text" maxlength="6">
|
|
30
|
+
<view class="input-suffix wd-event-tap" style="font-size:14px;width: 150px;text-align:center;padding:0 10px;color:{{phoneValidateMessage || smsDelay>0?'var(--wd-color-brand-disabled)':'var(--wd-color-text-brand)'}};" slot="suffix" bindtap="getCaptcha">
|
|
31
|
+
{{smsDelay > 0 ? '重新获取'+smsDelay : '获取验证码'}}
|
|
32
|
+
</view>
|
|
33
|
+
</login-input>
|
|
34
|
+
</view>
|
|
35
|
+
<button class="{{loginButtonClass}}" style="width:100%;border-radius:5px;" size="md" form-type="submit">
|
|
36
|
+
登录
|
|
37
|
+
</button>
|
|
38
|
+
</form>
|
|
39
|
+
</view>
|
|
40
|
+
<view wx:elif="{{currentLoginType === 'miniprogram_phone'}}">
|
|
41
|
+
<button style="width:100%;border-radius: 5px;" bindgetphonenumber="getPhoneCodeNumber" open-type="getPhoneNumber" role="button" class="{{loginButtonClass}}">
|
|
35
42
|
登录
|
|
36
43
|
</button>
|
|
37
|
-
</
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
</view>
|
|
45
|
+
<view wx:if="{{currentLoginList.length >= 1}}" class="login-method">
|
|
46
|
+
<view class="divider">
|
|
47
|
+
<view class="divider-line"></view>
|
|
48
|
+
<view class="divider-title">可选登录方式</view>
|
|
49
|
+
<view class="divider-line"></view>
|
|
50
|
+
</view>
|
|
51
|
+
<view class="login-method__list">
|
|
52
|
+
<view class="login-method__list-item" wx:for="{{currentLoginList}}" wx:for-item="item" wx:key="index" bind:tap="methodClick" data-item="{{item}}">
|
|
53
|
+
<view class="short-name">{{item.label[0]}}</view>
|
|
54
|
+
<view class="name">{{item.label}}</view>
|
|
55
|
+
</view>
|
|
56
|
+
</view>
|
|
57
|
+
</view>
|
|
58
|
+
<view style="display:flex;justify-content:center;flex-direction:row;font-size:0.8rem;position:fixed;left:0px;right:0px;bottom:50px;" class="have-read" wx:if="{{settingData.agreement.enable}}">
|
|
59
|
+
<view class="weda-ui weda-ui-to-wd">
|
|
60
|
+
<view class="weda-ui weda-checkbox wd-event-change">
|
|
61
|
+
<view class="weda-ui weda-formcells weui-cells weui-cells_checkbox weui-flex">
|
|
62
|
+
<view class="weui-flex__item">
|
|
63
|
+
<view class="weui-cell__bd weui-flex">
|
|
64
|
+
<checkbox-group bind:change="onAgreementChange">
|
|
65
|
+
<label role="checkbox" aria-disables="false" aria-checked="false" class="weui-cell weui-cell_active weui-check__label">
|
|
66
|
+
<view class="weui-cell__hd">
|
|
67
|
+
<checkbox aria-disables="false" value="haveRead" role="checkbox" aria-checked="false" class="weui-check"></checkbox>
|
|
68
|
+
<i class="weui-icon-checked"></i>
|
|
69
|
+
</view>
|
|
70
|
+
<view class="weui-cell__bd">
|
|
71
|
+
<view>我已阅读并同意</view>
|
|
72
|
+
</view>
|
|
73
|
+
</label>
|
|
74
|
+
</checkbox-group>
|
|
75
|
+
</view>
|
|
61
76
|
</view>
|
|
62
77
|
</view>
|
|
63
78
|
</view>
|
|
64
79
|
</view>
|
|
80
|
+
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);text-align:center;" wx:if="{{settingData.agreement.items[0].enable}}" data-index="0" bind:tap="showAgreement">
|
|
81
|
+
<text>《{{settingData.agreement.items[0].label}}》</text>
|
|
82
|
+
</text>
|
|
83
|
+
<text style="white-space: pre-warp; display:flex;align-items:center;white-space:pre-line;" class="weda-text weda-ui" wx:if="{{settingData.agreement.items[0].enable && settingData.agreement.items[1].enable}}">
|
|
84
|
+
<text>和</text>
|
|
85
|
+
</text>
|
|
86
|
+
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);" data-index="1" wx:if="{{settingData.agreement.items[1].enable}}" bind:tap="showAgreement">
|
|
87
|
+
<text>《{{settingData.agreement.items[1].label}}》</text>
|
|
88
|
+
</text>
|
|
89
|
+
</view>
|
|
90
|
+
</block>
|
|
91
|
+
<view wx:else class="weui-cell__bd weui-flex" style="flex-direction: column;margin-top: 60rpx;">
|
|
92
|
+
<view style="font-size: 32rpx; margin-bottom: 40rpx;">登录成功,请完善个人信息</view>
|
|
93
|
+
<button style="padding: 12rpx; display: flex; align-items: center;justify-content: center;" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
|
94
|
+
<image style="width: 80px;height: 80px;" src="{{avatarRealUrl || avatarUrl}}"></image>
|
|
95
|
+
</button>
|
|
96
|
+
<input type="nickname" placeholder="请输入昵称" value="{{nickName}}" placeholder-class="weui-input__placeholder" style="padding: 16px; border-bottom: 1px solid rgba(0, 0, 0, 0.25);" bindinput="nickNameChange" />
|
|
97
|
+
<button class="weda-ui weda-button weui-btn weui-btn_primary wd-event-tap" style="margin-top: 80rpx; width:100%;border-radius:5px;" size="md" bind:tap="baseInfoConfirm">
|
|
98
|
+
确定
|
|
99
|
+
</button>
|
|
100
|
+
<view class="weda-ui weda-button weui-btn weui-btn_default wd-event-tap" style="margin-top: 30rpx; width:100%; background: transparent;font-size: 14px;" size="md" bind:tap="jumpBaseInfoConfig">
|
|
101
|
+
跳过
|
|
65
102
|
</view>
|
|
66
|
-
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);text-align:center;" wx:if="{{settingData.agreement.items[0].enable}}" data-index="0" bind:tap="showAgreement">
|
|
67
|
-
<text>《{{settingData.agreement.items[0].label}}》</text>
|
|
68
|
-
</text>
|
|
69
|
-
<text style="white-space: pre-warp; display:flex;align-items:center;white-space:pre-line;" class="weda-text weda-ui" wx:if="{{settingData.agreement.items[0].enable && settingData.agreement.items[1].enable}}">
|
|
70
|
-
<text>和</text>
|
|
71
|
-
</text>
|
|
72
|
-
<text class="weda-text weda-ui wd-event-tap" style="white-space: pre-line; margin:0px 5px;display:flex;align-items:center;color:rgb(68, 144, 238);" data-index="1" wx:if="{{settingData.agreement.items[1].enable}}" bind:tap="showAgreement">
|
|
73
|
-
<text>《{{settingData.agreement.items[1].label}}》</text>
|
|
74
|
-
</text>
|
|
75
103
|
</view>
|
|
76
104
|
</view>
|
|
77
105
|
<gsd-h5-react-Modal style="position: absolute;" isDefaultButton="{{false}}" visible="{{isShowAgreement}}" bind:close="showAgreement">
|
|
@@ -2,74 +2,134 @@ button,
|
|
|
2
2
|
button:hover,
|
|
3
3
|
button,
|
|
4
4
|
button:active {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
font-size: 14px !important;
|
|
6
|
+
color: white;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.login-class .weda-ui .wedatea2td-input,
|
|
10
10
|
.login-class .weda-ui .wedatea2td-button {
|
|
11
|
-
|
|
11
|
+
border: none;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.login-class .weda-ui .wedatea2td-input,
|
|
15
15
|
.login-class .weda-ui .weda-input {
|
|
16
|
-
|
|
16
|
+
width: 100%;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.login-class .weda-ui .wedatea2td-btn {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
border: none;
|
|
21
|
+
line-height: 1;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.login-class .weda-ui .wedatea2td-btn::after {
|
|
25
|
-
|
|
25
|
+
border: none;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.login-class .weda-ui .weui-cells:before,
|
|
29
29
|
.login-class .weda-ui .weui-cells::after {
|
|
30
|
-
|
|
30
|
+
display: none;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.login-class .token-container .weda-button {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
width: 11rem;
|
|
35
|
+
padding: 0.5rem;
|
|
36
|
+
color: #1e6fd8;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.login-class .token-container .weda-button::after {
|
|
40
|
-
|
|
40
|
+
border: none;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.login-class .token-container .weda-button[disabled] {
|
|
44
|
-
|
|
44
|
+
color: #d0d0d0;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.login-class .have-read .weui-cells {
|
|
48
|
-
|
|
48
|
+
font-size: 0.8rem;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.login-class .have-read .weui-cell {
|
|
52
|
-
|
|
52
|
+
padding: 0;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.login-class .have-read .weui-cells_checkbox .weui-cell__hd {
|
|
56
|
-
|
|
56
|
+
padding-right: 0.5rem;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.login-class .have-read .weui-cells_checkbox .weui-icon-checked {
|
|
60
|
-
|
|
60
|
+
width: 1.2rem;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.login-class .weui-btn_primary.is-disabled {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
background-color: var(--wd-color-brand-disabled) !important;
|
|
65
|
+
border-color: var(--wd-color-brand-disabled) !important;
|
|
66
|
+
color: #fff !important;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.login-class .input-prefix {
|
|
70
|
-
|
|
70
|
+
border-right: 1px solid #dbdbdb;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.login-class .input-suffix {
|
|
74
|
-
|
|
74
|
+
border-left: 1px solid #dbdbdb;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.login-method .divider {
|
|
78
|
+
margin: 32px auto 8px;
|
|
79
|
+
color: #9e9e9e;
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.login-method .divider-line {
|
|
88
|
+
flex: 1;
|
|
89
|
+
display: inline-block;
|
|
90
|
+
background-color: #ddd;
|
|
91
|
+
height: 1rpx;
|
|
92
|
+
width: 100%;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.login-method .divider-title {
|
|
96
|
+
margin: 0 32rpx;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.login-method .login-method__list {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-wrap: wrap;
|
|
102
|
+
padding: 10rpx 0;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.login-method .login-method__list .login-method__list-item {
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
margin: 16rpx;
|
|
109
|
+
border-radius: 50%;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
width: 28.7%;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.login-method .login-method__list .login-method__list-item .short-name {
|
|
118
|
+
width: 84rpx;
|
|
119
|
+
height: 84rpx;
|
|
120
|
+
line-height: 84rpx;
|
|
121
|
+
border-radius: 100%;
|
|
122
|
+
text-align: center;
|
|
123
|
+
background-color: #7fb5f1;
|
|
124
|
+
color: #fff;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.login-method .login-method__list .login-method__list-item .name {
|
|
128
|
+
font-size: 24rpx;
|
|
129
|
+
margin-top: 12rpx;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
white-space: nowrap;
|
|
133
|
+
width: 100%;
|
|
134
|
+
text-align: center;
|
|
75
135
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
app
|
|
3
|
+
} from '../../../../../app/weapps-api';
|
|
4
|
+
|
|
5
|
+
export default async function (instance) {
|
|
6
|
+
try {
|
|
7
|
+
wx.showLoading({
|
|
8
|
+
title: '请稍后'
|
|
9
|
+
})
|
|
10
|
+
const res = await app.cloud.openIdLoginInWxApp();
|
|
11
|
+
if (!res) throw new Error('登录失败')
|
|
12
|
+
wx.hideLoading()
|
|
13
|
+
return res;
|
|
14
|
+
} catch (e) {
|
|
15
|
+
wx.hideLoading()
|
|
16
|
+
console.error('登录失败:', e);
|
|
17
|
+
app.showModal({
|
|
18
|
+
title: '登录失败',
|
|
19
|
+
content: e.errMsg || e.message || JSON.stringify(e),
|
|
20
|
+
showCancel: false,
|
|
21
|
+
})
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
app
|
|
3
|
+
} from '../../../../../app/weapps-api';
|
|
4
|
+
|
|
5
|
+
export default async function (instance) {
|
|
6
|
+
try {
|
|
7
|
+
wx.showLoading({
|
|
8
|
+
title: '请稍后'
|
|
9
|
+
})
|
|
10
|
+
const res = await app.cloud.unionIdLoginInWxApp()
|
|
11
|
+
if (!res) throw new Error('登录失败')
|
|
12
|
+
wx.hideLoading()
|
|
13
|
+
return res
|
|
14
|
+
} catch (e) {
|
|
15
|
+
wx.hideLoading()
|
|
16
|
+
console.error('登录失败:', e);
|
|
17
|
+
app.showModal({
|
|
18
|
+
title: '登录失败',
|
|
19
|
+
content: e.errMsg || e.message || JSON.stringify(e),
|
|
20
|
+
showCancel: false,
|
|
21
|
+
})
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
}
|