@cloudbase/lowcode-builder 1.8.105 → 1.8.107
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.d.ts +9 -0
- package/lib/builder/config/dependencies.js +45 -0
- package/lib/builder/config/index.d.ts +1 -0
- package/lib/builder/config/index.js +3 -1
- package/lib/builder/core/index.d.ts +1 -1
- package/lib/builder/core/index.js +14 -14
- package/lib/builder/mp/BuildContext.d.ts +1 -0
- package/lib/builder/mp/index.d.ts +1 -2
- package/lib/builder/mp/index.js +13 -38
- package/lib/builder/mp/lowcode.js +5 -1
- package/lib/builder/mp/materials.d.ts +2 -3
- package/lib/builder/mp/materials.js +28 -26
- package/lib/builder/mp/mp_config.js +2 -1
- package/lib/builder/mp/util.d.ts +5 -2
- package/lib/builder/mp/util.js +14 -6
- package/lib/builder/mp/wxml.d.ts +3 -1
- package/lib/builder/mp/wxml.js +20 -7
- package/lib/builder.web.js +8 -8
- package/package.json +3 -3
- package/template/html/index.html.ejs +2 -2
- package/template/mp/app/common.js +0 -2
- package/template/mp/app/weapps-api.js +1 -20
- package/template/mp/common/info/index.js +4 -2
- package/template/mp/common/util.js +33 -774
- package/template/mp/common/weapp-page.js +12 -514
- package/template/mp/component/index.js +52 -19
- package/template/mp/component/index.json +1 -1
- package/template/mp/datasources/index.js.tpl +3 -99
- package/template/mp/package.json +4 -15
- package/template/mp/packages/$wd_system/pages/login/components/captchaDialog/index.js +115 -0
- package/template/mp/packages/$wd_system/pages/login/components/captchaDialog/index.json +6 -0
- package/template/mp/packages/$wd_system/pages/login/components/captchaDialog/index.wxml +24 -0
- package/template/mp/packages/$wd_system/pages/login/components/captchaDialog/index.wxss +165 -0
- package/template/mp/packages/$wd_system/pages/login/components/input/index.js +26 -10
- package/template/mp/packages/$wd_system/pages/login/components/input/index.wxml +5 -3
- package/template/mp/packages/$wd_system/pages/login/index.js +223 -64
- package/template/mp/packages/$wd_system/pages/login/index.json +3 -2
- package/template/mp/packages/$wd_system/pages/login/index.wxml +50 -25
- package/template/mp/packages/$wd_system/pages/login/index.wxss +16 -1
- package/template/mp/packages/$wd_system/pages/login/methods/contants.js +5 -0
- package/template/mp/packages/$wd_system/pages/login/methods/errorHandler.js +152 -0
- package/template/mp/packages/$wd_system/pages/login/methods/loginBySms.js +66 -0
- package/template/mp/packages/$wd_system/pages/login/methods/loginByWXPhone.js +6 -3
- package/template/mp/page/index.js +1 -2
- package/template/mp/common/constant.js +0 -1
- package/template/mp/common/data-patch-test.js +0 -60
- package/template/mp/common/data-patch.js +0 -66
- package/template/mp/common/event-emitter.js +0 -124
- package/template/mp/common/flow.js +0 -65
- package/template/mp/common/merge-renderer.js +0 -75
- package/template/mp/common/placeholder/index.js +0 -1
- package/template/mp/common/placeholder/index.json +0 -4
- package/template/mp/common/placeholder/index.wxml +0 -1
- package/template/mp/common/placeholder/index.wxss +0 -1
- package/template/mp/common/query.js +0 -300
- package/template/mp/common/style.js +0 -34
- package/template/mp/common/watch.js +0 -70
- package/template/mp/common/weapp-component.js +0 -289
- package/template/mp/common/widget.js +0 -872
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { auth, getWedaAPI } from '@cloudbase/weda-client'
|
|
2
|
-
import { redirectToLogin, findLoginPage, getAuthConfig, checkAnonymous } from '../common/util';
|
|
3
|
-
import { setConfig, initTcb } from '../common/cloud-sdk';
|
|
4
|
-
|
|
5
|
-
const getAccessToken = auth.getAccessToken
|
|
6
|
-
const loginScope = auth.loginScope
|
|
7
|
-
|
|
1
|
+
import { auth, getWedaAPI, app as clientApp } from '@cloudbase/weda-client'
|
|
8
2
|
import { default as config, AEGIS_CONFIG } from './config'
|
|
9
3
|
|
|
10
|
-
|
|
4
|
+
clientApp.init({
|
|
11
5
|
...config,
|
|
12
6
|
// 设置数据源请求的 loading 及 toast 处理
|
|
13
7
|
beforeDSRequest: (cfg) => {
|
|
@@ -15,42 +9,6 @@ setConfig({
|
|
|
15
9
|
if (!cfg.options || !cfg.options.showLoading) return;
|
|
16
10
|
app.showLoading();
|
|
17
11
|
},
|
|
18
|
-
beforeCallFunction: async (params) => {
|
|
19
|
-
const { app } = getWedaAPI();
|
|
20
|
-
try {
|
|
21
|
-
const loginPage = findLoginPage();
|
|
22
|
-
|
|
23
|
-
let skip = false;
|
|
24
|
-
switch (params?.data?.methodName) {
|
|
25
|
-
case 'callWedaApi': {
|
|
26
|
-
if (['GetMiniProgramUserTicket', 'DescribeRuntimeResourceStrategy'].includes(params?.data?.params.action)) {
|
|
27
|
-
skip = true;
|
|
28
|
-
}
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// 后续做过滤处理
|
|
34
|
-
const endpointType = app?.__internal__?.getCloudSdkConfig('endpointType');
|
|
35
|
-
if ((params?.data?.mode === 'c' && skip) || (endpointType !== 'tcb-api' && !loginPage)) {
|
|
36
|
-
return params;
|
|
37
|
-
}
|
|
38
|
-
// await initTcb();
|
|
39
|
-
const { accessToken } = await getAccessToken();
|
|
40
|
-
if (accessToken) {
|
|
41
|
-
params.data.accessToken = accessToken;
|
|
42
|
-
}
|
|
43
|
-
} catch (e) {
|
|
44
|
-
if (app?.cloud?.currentUser?.userType === 'externalUser' && e?.error === 'unauthenticated') {
|
|
45
|
-
app.showToast({
|
|
46
|
-
title: '登录态失效',
|
|
47
|
-
icon: 'error',
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
// console.error('beforeCallFunction error', e);
|
|
51
|
-
}
|
|
52
|
-
return params;
|
|
53
|
-
},
|
|
54
12
|
afterDSRequest: (cfg, error, result) => {
|
|
55
13
|
const { app } = getWedaAPI();
|
|
56
14
|
if (!cfg.options) return;
|
|
@@ -59,61 +17,7 @@ setConfig({
|
|
|
59
17
|
const isSuccess = !error && result && !result.code;
|
|
60
18
|
app.showToast({ icon: isSuccess ? 'success' : 'error' });
|
|
61
19
|
},
|
|
62
|
-
|
|
63
|
-
const { app } = getWedaAPI();
|
|
64
|
-
let oauthError =
|
|
65
|
-
error?.message?.includes?.('PERMISSION_DENIED') ||
|
|
66
|
-
error?.code === 'unauthenticated' ||
|
|
67
|
-
error?.error === 'unauthenticated' ||
|
|
68
|
-
error?.code === 'invalid_grant' ||
|
|
69
|
-
error?.error === 'invalid_grant' ||
|
|
70
|
-
error?.code === 'INVALID_ACCESS_TOKEN';
|
|
71
|
-
|
|
72
|
-
if (!oauthError) {
|
|
73
|
-
try {
|
|
74
|
-
/**
|
|
75
|
-
* js-sdk v2 实现上吞了所有错误
|
|
76
|
-
* 返回 new Error(JSON.stringify({code: "OPERATION_FAIL", msg:"[INVALID_ACCESS_TOKEN]XXX"}))
|
|
77
|
-
*/
|
|
78
|
-
let tcbErrorObj = JSON.parse(error.message);
|
|
79
|
-
if (tcbErrorObj?.code === 'OPERATION_FAIL' && /\[INVALID_ACCESS_TOKEN\]/.test(tcbErrorObj.msg)) {
|
|
80
|
-
oauthError = true;
|
|
81
|
-
}
|
|
82
|
-
} catch (e) {}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
params?.data?.params?.action != 'DescribeRuntimeResourceStrategy' &&
|
|
87
|
-
(['InnerError.AuthFailure', 'InvalidAccessToken'].includes(res?.result?.code) || oauthError)
|
|
88
|
-
) {
|
|
89
|
-
const loginPage = findLoginPage();
|
|
90
|
-
if (loginPage) {
|
|
91
|
-
const authConfig = await getAuthConfig();
|
|
92
|
-
if (authConfig.RejectStrategy === 'to_login') {
|
|
93
|
-
if (['InnerError.AuthFailure'].includes(res?.result?.code)) {
|
|
94
|
-
const isAnonymous = await checkAnonymous();
|
|
95
|
-
if (!isAnonymous) return;
|
|
96
|
-
// 匿名用户越权去登录
|
|
97
|
-
}
|
|
98
|
-
redirectToLogin();
|
|
99
|
-
} else if (authConfig.RejectStrategy === 'show_warning') {
|
|
100
|
-
if (oauthError) {
|
|
101
|
-
const isAnonymous = await checkAnonymous();
|
|
102
|
-
if (!isAnonymous) {
|
|
103
|
-
redirectToLogin();
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
app.showToast({
|
|
108
|
-
title: '接口无访问权限',
|
|
109
|
-
icon: 'error',
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
initTcb()
|
|
20
|
+
})
|
|
117
21
|
|
|
118
22
|
<% if(cdnEndpoints.aegis){ %>
|
|
119
23
|
require.async('../packages/$wd_system/index.js').then(({ Aegis }) => {
|
package/template/mp/package.json
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lcap-<%= appId%>",
|
|
3
3
|
"version": "1.0.8",
|
|
4
|
-
"scripts": {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"@cloudbase/oauth": "0.1.1-alpha.6",
|
|
9
|
-
"@cloudbase/weda-client": "1.0.34",
|
|
10
|
-
"@cloudbase/weda-cloud-sdk": "1.0.61",
|
|
11
|
-
"mobx": "^5.15.4",
|
|
12
|
-
"lodash.get": "^4.4.2",
|
|
13
|
-
"lodash.set": "^4.3.2",
|
|
14
|
-
"miniprogram-gesture": "^1.0.6",
|
|
15
|
-
"miniprogram-api-promise": "^1.0.4"<% Object.keys(extraDeps).map(depName => {%>,
|
|
16
|
-
"<%= depName%>": "<%= extraDeps[depName]%>"<%
|
|
17
|
-
})%>
|
|
18
|
-
}
|
|
4
|
+
"scripts": {
|
|
5
|
+
"fix:cloud": "node -e 'try{const fix = require(\"@cloudbase/weda-cloud-sdk/scripts/fix-wx-none-private.js\");fix()}catch(e){}'"
|
|
6
|
+
},
|
|
7
|
+
"dependencies": <%= JSON.stringify(extraDeps, undefined, 2) %>
|
|
19
8
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { app } from '../../../../../../app/weapps-api';
|
|
2
|
+
import { EXTRA_API } from '../../../../../../common/cloud-sdk';
|
|
3
|
+
|
|
4
|
+
async function getAuth() {
|
|
5
|
+
const cloudbase = await app.cloud.getCloudInstance();
|
|
6
|
+
const auth = cloudbase.authInstance || cloudbase.auth;
|
|
7
|
+
return auth;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Component({
|
|
11
|
+
options: {
|
|
12
|
+
virtualHost: true,
|
|
13
|
+
styleIsolation: 'shared',
|
|
14
|
+
multipleSlots: true,
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* 组件的属性列表
|
|
18
|
+
*/
|
|
19
|
+
properties: {
|
|
20
|
+
token: String,
|
|
21
|
+
captchaData: String,
|
|
22
|
+
state: String,
|
|
23
|
+
visible: { type: Boolean, value: false },
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 组件的初始数据
|
|
28
|
+
*/
|
|
29
|
+
data: {
|
|
30
|
+
message: '',
|
|
31
|
+
key: '',
|
|
32
|
+
loading: false,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
lifetimes: {
|
|
36
|
+
attached: function () {
|
|
37
|
+
EXTRA_API.EVENT_BUS.on('CAPTCHA_DATA_CHANGE', ({ token, url, state }) => {
|
|
38
|
+
this.setData({
|
|
39
|
+
visible: true,
|
|
40
|
+
state,
|
|
41
|
+
token,
|
|
42
|
+
captchaData: url,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
detached() {
|
|
47
|
+
EXTRA_API.EVENT_BUS.off('CAPTCHA_DATA_CHANGE');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 组件的方法列表
|
|
53
|
+
*/
|
|
54
|
+
methods: {
|
|
55
|
+
async _createCaptchaData() {
|
|
56
|
+
const auth = await getAuth();
|
|
57
|
+
try {
|
|
58
|
+
const { token, data } = await auth.createCaptchaData({
|
|
59
|
+
state: this.properties.state,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
this.setData({
|
|
63
|
+
key: '',
|
|
64
|
+
token,
|
|
65
|
+
captchaData: data,
|
|
66
|
+
});
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.error(e);
|
|
69
|
+
this.setData({ message: `错误:${e.error || ''} - ${e.error_description || e.message}` });
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
async onRefresh() {
|
|
73
|
+
this.setData({ message: '' });
|
|
74
|
+
await this._createCaptchaData();
|
|
75
|
+
},
|
|
76
|
+
async onVerifyCaptchaData() {
|
|
77
|
+
const auth = await getAuth();
|
|
78
|
+
try {
|
|
79
|
+
const res = await auth.verifyCaptchaData({
|
|
80
|
+
token: this.data.token,
|
|
81
|
+
key: this.data.key,
|
|
82
|
+
});
|
|
83
|
+
this.setData({
|
|
84
|
+
message: '验证成功',
|
|
85
|
+
});
|
|
86
|
+
this.triggerEvent('sunmit', res);
|
|
87
|
+
EXTRA_API.EVENT_BUS.emit('RESOLVE_CAPTCHA_DATA', res);
|
|
88
|
+
wx.nextTick(() => {
|
|
89
|
+
this.setData({
|
|
90
|
+
visible: false,
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.error(e);
|
|
95
|
+
this.setData({ message: `输入字符和图片不匹配` });
|
|
96
|
+
await this._createCaptchaData();
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
onChange(e) {
|
|
100
|
+
this.setData({
|
|
101
|
+
key: e.detail.value,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
observers: {
|
|
106
|
+
visible: function (visible) {
|
|
107
|
+
if (visible && (!this.data.token || !this.data.captchaData)) {
|
|
108
|
+
this.setData({ loading: true });
|
|
109
|
+
this._createCaptchaData().catch((e) => {
|
|
110
|
+
this.setData({ loading: false });
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<mp-dialog title="{{loading?'验证码获取中...':'请输入你看到的字符:'}}" show="{{visible}}" bindbuttontap="tapDialogButton">
|
|
2
|
+
<view id="loading" style="height:40px;margin: 20px 0;position:relative;" wx:if="{{loading}}">
|
|
3
|
+
<view class="spinner"></view>
|
|
4
|
+
</view>
|
|
5
|
+
<view class="container" wx:if="{{!loading}}">
|
|
6
|
+
<view class="input_field captch_box" style="text-align: left;">
|
|
7
|
+
<image alt="captcha" src="{{captchaData}}"></image>
|
|
8
|
+
<button class="weda-ui weda-button weui-btn weui-btn_primary wd-event-tap refreshButton" bindtap="onRefresh">
|
|
9
|
+
<view class="icon-redo"></view>
|
|
10
|
+
</button>
|
|
11
|
+
</view>
|
|
12
|
+
<view class="input_field captch_input">
|
|
13
|
+
<input type="text" placeholder="输入字符" maxlength="6" bindinput="onChange" value="{{key}}"></input>
|
|
14
|
+
</view>
|
|
15
|
+
<view class="message" style="color: var(--wd-color-error); font-size:14px;display:block;">
|
|
16
|
+
{{message}}
|
|
17
|
+
</view>
|
|
18
|
+
<view class="input_field button">
|
|
19
|
+
<button class="weda-ui weda-button weui-btn weui-btn_primary wd-event-tap" bindtap="onVerifyCaptchaData">
|
|
20
|
+
确定
|
|
21
|
+
</button>
|
|
22
|
+
</view>
|
|
23
|
+
</view>
|
|
24
|
+
</mp-dialog>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
#loader {
|
|
2
|
+
background: #fff;
|
|
3
|
+
height: 100%;
|
|
4
|
+
left: 0;
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
z-index: 9;
|
|
9
|
+
}
|
|
10
|
+
.spinner {
|
|
11
|
+
animation: 1s linear infinite spin;
|
|
12
|
+
border: 3px solid rgba(2, 158, 249, 0.2);
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
border-top-color: #029ef9;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
height: 40px;
|
|
17
|
+
left: 0;
|
|
18
|
+
margin: auto;
|
|
19
|
+
position: absolute;
|
|
20
|
+
right: 0;
|
|
21
|
+
top: 0;
|
|
22
|
+
width: 40px;
|
|
23
|
+
}
|
|
24
|
+
@keyframes spin {
|
|
25
|
+
0% {
|
|
26
|
+
transform: rotate(0);
|
|
27
|
+
}
|
|
28
|
+
to {
|
|
29
|
+
transform: rotate(1turn);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.input_field {
|
|
34
|
+
position: relative;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 45px;
|
|
37
|
+
margin-top: 15px;
|
|
38
|
+
}
|
|
39
|
+
.input_field.captch_box {
|
|
40
|
+
height: 80px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.captch_box image {
|
|
44
|
+
height: 70px;
|
|
45
|
+
width: 210px;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.icon-redo,
|
|
50
|
+
.icon-redo::before {
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
}
|
|
53
|
+
body {
|
|
54
|
+
height: 100vh;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
background: 0 0;
|
|
59
|
+
}
|
|
60
|
+
.button button,
|
|
61
|
+
.input_field input {
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
height: 100%;
|
|
64
|
+
width: 100%;
|
|
65
|
+
outline: 0;
|
|
66
|
+
border: none;
|
|
67
|
+
border-radius: 8px;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
}
|
|
70
|
+
.input_field input {
|
|
71
|
+
padding: 0 15px;
|
|
72
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
73
|
+
}
|
|
74
|
+
.refresh_button {
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 50%;
|
|
77
|
+
right: 5px;
|
|
78
|
+
transform: translateY(-50%);
|
|
79
|
+
padding-left: 12px;
|
|
80
|
+
height: 40px;
|
|
81
|
+
width: 40px;
|
|
82
|
+
border: none;
|
|
83
|
+
border-radius: 4px;
|
|
84
|
+
}
|
|
85
|
+
.refresh_button:active {
|
|
86
|
+
transform: translateY(-50%) scale(0.98);
|
|
87
|
+
}
|
|
88
|
+
.captch_input input:focus {
|
|
89
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
|
|
90
|
+
}
|
|
91
|
+
.message {
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
margin: 14px 0;
|
|
94
|
+
color: #347eff;
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
.icon-redo,
|
|
98
|
+
.message.active {
|
|
99
|
+
display: block;
|
|
100
|
+
}
|
|
101
|
+
.button button {
|
|
102
|
+
user-select: none;
|
|
103
|
+
}
|
|
104
|
+
.button button:active {
|
|
105
|
+
transform: scale(0.99);
|
|
106
|
+
}
|
|
107
|
+
.button.disabled {
|
|
108
|
+
opacity: 0.6;
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
}
|
|
111
|
+
.icon-redo {
|
|
112
|
+
position: relative;
|
|
113
|
+
width: 16px;
|
|
114
|
+
height: 16px;
|
|
115
|
+
border: 2px solid;
|
|
116
|
+
border-right-color: transparent;
|
|
117
|
+
border-radius: 100px;
|
|
118
|
+
}
|
|
119
|
+
.icon-redo::before {
|
|
120
|
+
content: '';
|
|
121
|
+
display: block;
|
|
122
|
+
position: absolute;
|
|
123
|
+
width: 6px;
|
|
124
|
+
height: 6px;
|
|
125
|
+
border-top: 2px solid;
|
|
126
|
+
border-right: 2px solid;
|
|
127
|
+
top: -3px;
|
|
128
|
+
right: -1px;
|
|
129
|
+
transform: rotate(68deg);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.wd-devtools-highlight {
|
|
133
|
+
position: absolute;
|
|
134
|
+
background-color: #52d959;
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
z-index: 9999;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.refreshButton {
|
|
140
|
+
position: relative;
|
|
141
|
+
box-sizing: border-box;
|
|
142
|
+
max-width: 40px;
|
|
143
|
+
height: 40px;
|
|
144
|
+
padding: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.captch_box {
|
|
148
|
+
display: flex;
|
|
149
|
+
justify-content: space-between;
|
|
150
|
+
align-items: center;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.container {
|
|
154
|
+
text-align: left;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.message {
|
|
158
|
+
padding-left: 5px;
|
|
159
|
+
}
|
|
160
|
+
.icon-redo {
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 50%;
|
|
163
|
+
left: 50%;
|
|
164
|
+
translate: -50% -50%;
|
|
165
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Component({
|
|
3
3
|
options: {
|
|
4
4
|
virtualHost: true,
|
|
5
|
-
styleIsolation: 'shared'
|
|
5
|
+
styleIsolation: 'shared',
|
|
6
|
+
multipleSlots: true,
|
|
6
7
|
},
|
|
7
8
|
behaviors: ['wx://form-field'],
|
|
8
9
|
|
|
@@ -10,15 +11,29 @@ Component({
|
|
|
10
11
|
* 组件的属性列表
|
|
11
12
|
*/
|
|
12
13
|
properties: {
|
|
14
|
+
style: {
|
|
15
|
+
type: String,
|
|
16
|
+
value: '',
|
|
17
|
+
},
|
|
13
18
|
type: String,
|
|
14
|
-
placeholder: String
|
|
19
|
+
placeholder: String,
|
|
20
|
+
maxlength: { type: Number, value: 140 },
|
|
21
|
+
defaultValue: String,
|
|
15
22
|
},
|
|
16
23
|
|
|
17
24
|
/**
|
|
18
25
|
* 组件的初始数据
|
|
19
26
|
*/
|
|
20
27
|
data: {
|
|
21
|
-
name: ''
|
|
28
|
+
name: '',
|
|
29
|
+
},
|
|
30
|
+
lifetimes: {
|
|
31
|
+
attached: function () {
|
|
32
|
+
if (this.properties.defaultValue) {
|
|
33
|
+
this.setData({ value: this.properties.defaultValue });
|
|
34
|
+
}
|
|
35
|
+
// 在组件实例进入页面节点树时执行
|
|
36
|
+
},
|
|
22
37
|
},
|
|
23
38
|
|
|
24
39
|
/**
|
|
@@ -26,15 +41,16 @@ Component({
|
|
|
26
41
|
*/
|
|
27
42
|
methods: {
|
|
28
43
|
focus(e) {
|
|
29
|
-
this.triggerEvent('focus', e.detail)
|
|
44
|
+
this.triggerEvent('focus', e.detail);
|
|
30
45
|
},
|
|
31
46
|
blur(e) {
|
|
32
|
-
this.triggerEvent('blur', e.detail)
|
|
47
|
+
this.triggerEvent('blur', e.detail);
|
|
33
48
|
},
|
|
34
49
|
setValue(e) {
|
|
35
50
|
this.setData({
|
|
36
|
-
value: e.detail
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
51
|
+
value: e.detail.value,
|
|
52
|
+
});
|
|
53
|
+
this.triggerEvent('change', e.detail);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<view class="weda-ui weda-ui-to-wd">
|
|
2
|
-
<view style="border-width:0 0 1px 0;border-style:solid;border-color:rgba(0, 0, 0, 0.25);
|
|
2
|
+
<view style="border-width:0 0 1px 0;border-style:solid;border-color:rgba(0, 0, 0, 0.25);" class="weda-ui weda-input wd-comp-id-input1 wd-event-focus wd-event-blur">
|
|
3
3
|
<view class="weda-ui weui-cells weui-cells_forms weui-flex">
|
|
4
4
|
<view class="weui-flex__item">
|
|
5
|
-
<view class="weui-cell__bd weui-flex">
|
|
6
|
-
<
|
|
5
|
+
<view class="weui-cell__bd weui-flex" style="justify-content: space-between;align-items:center;">
|
|
6
|
+
<slot name="prefix"></slot>
|
|
7
|
+
<input maxlength="{{maxlength}}" value="{{value}}" style="padding-left: 16px; padding-right: 16px;" placeholder="{{placeholder}}" name="{{name}}" placeholder-class="weui-input__placeholder" type="{{type}}" class="weui-input" bind:focus="focus" bind:blur="blur" bindinput="setValue" />
|
|
8
|
+
<slot name="suffix"></slot>
|
|
7
9
|
</view>
|
|
8
10
|
</view>
|
|
9
11
|
</view>
|