@cloudbase/lowcode-builder 1.8.105 → 1.8.106

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": "@cloudbase/lowcode-builder",
3
- "version": "1.8.105",
3
+ "version": "1.8.106",
4
4
  "description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
5
5
  "author": "yhsunshining@gmail.com",
6
6
  "homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
@@ -47,7 +47,7 @@
47
47
  "dependencies": {
48
48
  "@babel/core": "7.21.4",
49
49
  "@babel/preset-env": "7.21.4",
50
- "@cloudbase/cals": "^1.1.4",
50
+ "@cloudbase/cals": "^1.1.5",
51
51
  "@cloudbase/lowcode-generator": "^1.8.33",
52
52
  "axios": "^0.21.0",
53
53
  "browserfs": "^1.4.3",
@@ -3,11 +3,11 @@
3
3
  "version": "1.0.8",
4
4
  "scripts": {},
5
5
  "dependencies": {<% if(importJSSDK) {%>
6
- "@cloudbase/js-sdk": "2.5.42-beta.0",<%
6
+ "@cloudbase/js-sdk": "2.5.45-beta.0",<%
7
7
  } %>
8
- "@cloudbase/oauth": "0.1.1-alpha.6",
8
+ "@cloudbase/oauth": "0.1.1-alpha.11",
9
9
  "@cloudbase/weda-client": "1.0.34",
10
- "@cloudbase/weda-cloud-sdk": "1.0.61",
10
+ "@cloudbase/weda-cloud-sdk": "1.0.63",
11
11
  "mobx": "^5.15.4",
12
12
  "lodash.get": "^4.4.2",
13
13
  "lodash.set": "^4.3.2",
@@ -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,6 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "mp-dialog": "weui-miniprogram/dialog/dialog"
5
+ }
6
+ }
@@ -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); padding: 0 16px;" class="weda-ui weda-input wd-comp-id-input1 wd-event-focus wd-event-blur">
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
- <input maxlength="140" placeholder="{{placeholder}}" name="{{name}}"placeholder-class="weui-input__placeholder" type="{{type}}" class="weui-input" bind:focus="focus" bind:blur="blur" bindinput="setValue" />
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>