@cloudbase/lowcode-builder 1.10.33 → 1.10.35

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.10.33",
3
+ "version": "1.10.35",
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",
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "@babel/core": "7.21.4",
51
51
  "@babel/preset-env": "7.21.4",
52
- "@cloudbase/cals": "^1.2.20",
52
+ "@cloudbase/cals": "^1.2.23",
53
53
  "@cloudbase/lowcode-generator": "^1.8.42",
54
54
  "axios": "^0.21.0",
55
55
  "chalk": "^2.4.2",
@@ -94,4 +94,4 @@
94
94
  "webpack-dev-server": "^4.7.3",
95
95
  "worker-loader": "^3.0.8"
96
96
  }
97
- }
97
+ }
@@ -464,7 +464,7 @@
464
464
  <script type="module" src="/src/index.jsx"></script>
465
465
  <% } %> <% if(!isAdminPortal){ %>
466
466
  <script src="<%= wedaPrivateConfigEndpoint ? wedaPrivateConfigEndpoint : '' %>/weda-config/weda-private.js"></script>
467
- <script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.20.12/cloudbase.full.js?v=1"></script>
467
+ <script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.22.10/cloudbase.full.js?v=1"></script>
468
468
  <script
469
469
  crossorigin
470
470
  src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/cloudbase-adapter-privatelink@0.0.2/dist/index.js"
@@ -1,4 +1,5 @@
1
1
  import { registerAi, createAi } from "@cloudbase/ai";
2
+ import { registerApis, generateApis } from "@cloudbase/apis";
2
3
  import { generateAuthInstance, registerAuth } from "@cloudbase/auth";
3
4
  <% if(cdnEndpoints.aegis){ %>import Aegis from 'aegis-mp-sdk';<%} else {%> class Aegis {
4
5
  constructor() {
@@ -32,6 +33,10 @@ const loadMap = {
32
33
  generateAuthInstance,
33
34
  registerAuth,
34
35
  },
36
+ "@cloudbase/apis": {
37
+ registerApis,
38
+ generateApis,
39
+ },
35
40
  "@cloudbase/adapter-wx_mp": require('@cloudbase/adapter-wx_mp')
36
41
  };
37
42
 
@@ -44,6 +44,13 @@ function decodePageQuery(query) {
44
44
 
45
45
  const BUTTON_CLASSNAME = 'weda-ui weda-button weui-btn weui-btn_primary wd-event-tap';
46
46
 
47
+ const ICONS = {
48
+ __sms: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20fill%3D%22none%22%3E%3Cpath%20fillRule%3D%22evenodd%22%20clipRule%3D%22evenodd%22%20d%3D%22M3%200.666626H13V15.3333H3V0.666626ZM4.33333%201.99996V14H11.6667V1.99996H4.33333Z%22%20fill%3D%22%234490ee%22%20fillOpacity%3D%220.9%22/%3E%3Cpath%20fillRule%3D%22evenodd%22%20clippRule%3D%22evenodd%22%20d%3D%22M7.3335%2011.3334H8.66943V12.6693H7.3335V11.3334Z%22%20fill%3D%22%234490ee%22%20fillOpacity%3D%220.9%22/%3E%3C/g%3E%3C/svg%3E',
49
+ __miniprogram_phone: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20fill%3D%22%234490ee%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.3335%202.00006L15.3335%2014.0001L0.66683%2014.0001L0.66683%202.00006L15.3335%202.00006ZM14.0002%203.33339L2.00016%203.33339L2.00016%206.00006L14.0002%206.00006L14.0002%203.33339ZM14.0002%207.33339L2.00016%207.3334L2.00016%2012.6667L14.0002%2012.6667L14.0002%207.33339ZM6.66683%2010.6667L3.3335%2010.6667L3.3335%209.33339L6.66683%209.3334L6.66683%2010.6667Z%22%20fill%3D%22%234490ee%22%20fill-opacity%3D%220.9%22/%3E%3C/g%3E%3C/svg%3E',
50
+ email: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20fill%3D%22none%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M0.666504%202.66669H15.3332V13.3334H0.666504V2.66669ZM3.31624%204.00002L7.99984%207.19316L12.6834%204.00002H3.31624ZM13.9998%204.71626V12H1.99984V4.71626L7.99984%208.80688L13.9998%204.71626Z%22%20fill%3D%22%234490ee%22%20fill-opacity%3D%220.9%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E',
51
+ __openid_login: 'data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2016%2016%22%3E%0A%20%20%20%20%20%20%3Cg%20fill%3D%22none%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%0A%20%20%20%20%20%20%20%20%20%20fillRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20clipRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20d%3D%22M10.9122%207.16659C8.74181%207.16659%207.15755%208.66323%207.15755%2010.3089C7.15755%2011.9545%208.74181%2013.4511%2010.9122%2013.4511C11.3394%2013.4511%2011.7484%2013.3913%2012.1286%2013.282L12.3599%2013.2155L13.2267%2013.5953L13.0731%2012.9055L13.4167%2012.6473C14.2041%2012.0555%2014.6667%2011.2145%2014.6667%2010.3089C14.6667%208.66323%2013.0825%207.16659%2010.9122%207.16659ZM5.82422%2010.3089C5.82422%207.74725%208.1989%205.83325%2010.9122%205.83325C13.6254%205.83325%2016.0001%207.74725%2016.0001%2010.3089C16.0001%2011.5424%2015.4361%2012.64%2014.5567%2013.4339L14.993%2015.3932H14.0073L12.2578%2014.6265C11.8282%2014.7297%2011.3769%2014.7845%2010.9122%2014.7845C8.1989%2014.7845%205.82422%2012.8705%205.82422%2010.3089Z%22%0A%20%20%20%20%20%20%20%20%20%20fill%3D%22%234490ee%22%0A%20%20%20%20%20%20%20%20%20%20fillOpacity%3D%220.9%22%0A%20%20%20%20%20%20%20%20%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3Cpath%0A%20%20%20%20%20%20%20%20%20%20fillRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20clipRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20d%3D%22M5.96278%202.44661C3.30372%202.44661%201.33333%204.26852%201.33333%206.30474C1.33333%207.41602%201.90228%208.4435%202.86201%209.16679L3.19915%209.42087L3.01575%2010.3073L4.02507%209.81612L4.28122%209.89966C4.76113%2010.0562%205.28126%2010.1481%205.82681%2010.1612C5.91206%207.78491%208.04762%205.99865%2010.5585%205.84419C10.2883%204.00172%208.41944%202.44661%205.96278%202.44661ZM0%206.30474C0%203.34301%202.77191%201.11328%205.96278%201.11328C9.15365%201.11328%2011.9256%203.34301%2011.9256%206.30474C11.9256%206.38561%2011.9234%206.4661%2011.9192%206.54618L11.8838%207.22076L11.2097%207.17642C11.1116%207.16996%2011.0124%207.16667%2010.9121%207.16667C8.74176%207.16667%207.1575%208.66331%207.1575%2010.3089C7.1575%2010.4433%207.16758%2010.5754%207.18708%2010.7047L7.29247%2011.4042L6.58802%2011.468C6.38236%2011.4867%206.17376%2011.4962%205.96278%2011.4962C5.32541%2011.4962%204.70977%2011.4092%204.13147%2011.2472L2.2599%2012.1579H1.2713L1.72601%209.96009C0.674276%209.03578%200%207.74977%200%206.30474Z%22%0A%20%20%20%20%20%20%20%20%20%20fill%3D%22%234490ee%22%0A%20%20%20%20%20%20%20%20%20%20fillOpacity%3D%220.9%22%0A%20%20%20%20%20%20%20%20%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3Cpath%0A%20%20%20%20%20%20%20%20%20%20fillRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20clipRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20d%3D%22M8.7207%209.29555C8.7207%208.8966%209.04409%208.57312%209.44282%208.57312C9.842%208.57312%2010.1653%208.89657%2010.1653%209.29555C10.1653%209.69453%209.842%2010.018%209.44282%2010.018C9.04409%2010.018%208.7207%209.69451%208.7207%209.29555ZM11.6657%209.29555C11.6657%208.89657%2011.9891%208.57312%2012.388%208.57312C12.7871%208.57312%2013.1103%208.8966%2013.1103%209.29555C13.1103%209.69451%2012.7871%2010.018%2012.388%2010.018C11.9891%2010.018%2011.6657%209.69453%2011.6657%209.29555Z%22%0A%20%20%20%20%20%20%20%20%20%20fill%3D%22%234490ee%22%0A%20%20%20%20%20%20%20%20%20%20fillOpacity%3D%220.9%22%0A%20%20%20%20%20%20%20%20%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%20%20%3Cpath%0A%20%20%20%20%20%20%20%20%20%20fillRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20clipRule%3D%22evenodd%22%0A%20%20%20%20%20%20%20%20%20%20d%3D%22M3.36084%204.84006C3.36084%204.37603%203.73707%204%204.2009%204C4.66506%204%205.04113%204.37603%205.04113%204.84006C5.04113%205.30424%204.66508%205.68029%204.2009%205.68029C3.73705%205.68029%203.36084%205.30424%203.36084%204.84006ZM6.89497%204.84006C6.89497%204.37603%207.27104%204%207.73519%204C8.19916%204%208.57541%204.37601%208.57541%204.84006C8.57541%205.30426%208.19918%205.68029%207.73519%205.68029C7.27102%205.68029%206.89497%205.30424%206.89497%204.84006Z%22%0A%20%20%20%20%20%20%20%20%20%20fill%3D%22%234490ee%22%0A%20%20%20%20%20%20%20%20%20%20fillOpacity%3D%220.9%22%0A%20%20%20%20%20%20%20%20%3E%3C%2Fpath%3E%0A%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fsvg%3E',
52
+ }
53
+
47
54
  function setStorage(data, key = phoneVerifyInfoKey) {
48
55
  const current = wx.getStorageSync(key || phoneVerifyInfoKey);
49
56
  wx.setStorageSync(key, {
@@ -104,6 +111,7 @@ Component({
104
111
 
105
112
  isRegister: false, // 是否注册场景
106
113
  registerMethods: [], // 注册方式
114
+ icons: ICONS,
107
115
  },
108
116
  methods: {
109
117
  async getPhoneCodeNumber(e) {
@@ -197,7 +205,7 @@ Component({
197
205
  },
198
206
  miniprogram: (config.miniprogram || []).map(v => ({
199
207
  ...v,
200
- label: v.label?.replace(/^微信小程序/, '')
208
+ label: v.label?.split('(')[0]
201
209
  })),
202
210
  access: {
203
211
  ...config.access
@@ -316,6 +324,7 @@ Component({
316
324
  verificationInfo,
317
325
  loginOnly: !this.data.settingData.userRegistry?.enable,
318
326
  isRegister: this.data.isRegister,
327
+ isAutoRegister: !this.data.settingData.userRegistry.registerType || this.data.settingData.userRegistry.registerType === 'auto',
319
328
  hasRegisterConfig: this.data.settingData.userRegistry?.enable && !!this.data.settingData.userRegistry?.miniprogram?.find(v => v.id === this.data.currentLoginType), // 有注册配置,才会走注册配置的判断
320
329
  callback: (err, data) => {
321
330
  if (err) {
@@ -435,7 +444,15 @@ Component({
435
444
 
436
445
  // 5. 确定登录模式和目标类型
437
446
  const loginOnly = !this.data.settingData.userRegistry?.enable;
438
- const target = loginOnly ? 'USER' : 'ANY';
447
+ const isAutoRegister= !this.data.settingData.userRegistry.registerType || this.data.settingData.userRegistry.registerType === 'auto'
448
+
449
+ /**
450
+ * 1) 如果当前是注册页面,则目标类型为ANY;
451
+ * 2) 如果当前是登录页面,且未开启注册,则目标类型为USER;
452
+ * 3) 如果当前是登录页面,且开启注册,且为自动注册,则目标类型为ANY;
453
+ * 4) 如果当前是登录页面,且开启注册,且为非自动注册,则目标类型为USER;
454
+ */
455
+ const target = !this.data.isRegister && (!isAutoRegister || loginOnly) ? 'USER' : 'ANY';
439
456
 
440
457
  // 6. 获取用户输入的标识(手机号/邮箱)
441
458
  const identifier = this.data[getInfoField];
@@ -63,7 +63,7 @@
63
63
  <view wx:if="{{!isRegister && publicPage && publicPage.length > 0}}" 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="loginCancel">
64
64
  暂不登录
65
65
  </view>
66
- <view wx:if="{{registerMethods.length}}" class="register">
66
+ <view wx:if="{{registerMethods.length && settingData.userRegistry.registerType === 'split'}}" class="register">
67
67
  <text>{{isRegister ? '已有账号?' : '没有账号?'}}</text>
68
68
  <text class="link" bind:tap="toRegister">{{isRegister ? '立即登录' : '立即注册'}}</text>
69
69
  </view>
@@ -76,7 +76,10 @@
76
76
  <view class="login-method__list">
77
77
  <block wx:for="{{isRegister ? registerMethods : currentLoginList}}" wx:for-item="item" wx:key="index">
78
78
  <view wx:if="{{item.id !== currentLoginType}}" class="login-method__list-item" bind:tap="methodClick" data-item="{{item}}">
79
- <view class="short-name">{{item.label[0]}}</view>
79
+ <view class="short-name">
80
+ <image wx:if="{{icons[item.id]}}" class="short-name__image" src="{{icons[item.id]}}" />
81
+ <text wx:else>{{item.label[0]}}</text>
82
+ </view>
80
83
  <view class="name">{{isRegister ? item.registerLabel : item.label}}</view>
81
84
  </view>
82
85
  </block>
@@ -137,4 +140,4 @@
137
140
  </view>
138
141
  <wd-info type="{{initing? 'loading': 'auth'}}" wx:if="{{initing || error}}" message="{{loading?'加载配置中...':' '}}" error="{{error}}" />
139
142
  <captcha-dialog />
140
- </page-meta>
143
+ </page-meta>
@@ -120,11 +120,16 @@ button:active {
120
120
  .login-method .login-method__list .login-method__list-item .short-name {
121
121
  width: 84rpx;
122
122
  height: 84rpx;
123
- line-height: 84rpx;
124
- border-radius: 100%;
125
- text-align: center;
126
- background-color: #7fb5f1;
127
- color: #fff;
123
+ border: 1px solid #d6dbe3;
124
+ border-radius: 10px;
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ }
129
+
130
+ .login-method .login-method__list .login-method__list-item .short-name .short-name__image {
131
+ height: 48rpx;
132
+ width: 48rpx;
128
133
  }
129
134
 
130
135
  .login-method .login-method__list .login-method__list-item .name {
@@ -145,4 +150,4 @@ button:active {
145
150
 
146
151
  .register .link {
147
152
  color: #006eff;
148
- }
153
+ }
@@ -164,7 +164,7 @@ export const parseCommonError = (e) => {
164
164
  msg = `网络错误,请检查您的网络连接,稍后重试${prefixMsg(e.error_description)}`;
165
165
  break;
166
166
  case 'resource_exhausted':
167
- return '验证码已被使用,或者尝试过于频繁,请稍后重试';
167
+ return '验证码已过期,或尝试过于频繁,请稍后重试,或选择其他登录方式';
168
168
  case 'license_required':
169
169
  return '该用户没有产品许可证,请授权后重试';
170
170
  default:
@@ -19,7 +19,8 @@ export default async function loginByEmail(
19
19
  loginOnly,
20
20
  isRegister,
21
21
  bindInfo,
22
- hasRegisterConfig
22
+ hasRegisterConfig,
23
+ isAutoRegister = true
23
24
  },
24
25
  ) {
25
26
  wx.showLoading({
@@ -39,12 +40,14 @@ export default async function loginByEmail(
39
40
  };
40
41
  }
41
42
 
42
- if (isRegister && verificationInfo.isUser) {
43
- throw new Error('user has already registered, please log in directly');
44
- }
43
+ if (!isAutoRegister) {
44
+ if (isRegister && verificationInfo.isUser) {
45
+ throw new Error('user has already registered, please log in directly');
46
+ }
45
47
 
46
- if (!isRegister && !verificationInfo.isUser) {
47
- throw { error: 'user not registered, please register first' };
48
+ if (!isRegister && !verificationInfo.isUser) {
49
+ throw { error: 'user not registered, please register first' };
50
+ }
48
51
  }
49
52
 
50
53
  // 校验
@@ -67,7 +70,7 @@ export default async function loginByEmail(
67
70
  provider_token: bindInfo.providerToken,
68
71
  });
69
72
  }
70
- } else if (hasRegisterConfig && isRegister) {
73
+ } else if ((hasRegisterConfig && isRegister) || isAutoRegister) {
71
74
  // 3. 注册
72
75
  await auth.signUp({
73
76
  email,
@@ -5,7 +5,7 @@ import { phoneVerifyInfoKey, verifyCodeFailedLimit } from './contants';
5
5
 
6
6
  export default async function loginBySms(
7
7
  instance,
8
- { callback, verificationInfo, verificationCode, phoneNum, bindInfo, loginOnly, isRegister, hasRegisterConfig },
8
+ { callback, verificationInfo, verificationCode, phoneNum, bindInfo, loginOnly, isRegister, hasRegisterConfig, isAutoRegister = true },
9
9
  ) {
10
10
  wx.showLoading({ mask: true });
11
11
  const { usedCount = 0 } = wx.getStorageSync(phoneVerifyInfoKey) || {};
@@ -18,14 +18,17 @@ export default async function loginBySms(
18
18
  throw { error: 'get_verify_code' };
19
19
  }
20
20
 
21
- if (isRegister && verificationInfo.isUser) {
22
- throw new Error('user has already registered, please log in directly');
23
- }
21
+ if (!isAutoRegister) {
22
+ if (isRegister && verificationInfo.isUser) {
23
+ throw new Error('user has already registered, please log in directly');
24
+ }
24
25
 
25
- if (!isRegister && !verificationInfo.isUser) {
26
- throw { error: 'user not registered, please register first' };
26
+ if (!isRegister && !verificationInfo.isUser) {
27
+ throw { error: 'user not registered, please register first' };
28
+ }
27
29
  }
28
30
 
31
+
29
32
  // 校验
30
33
  if (!phoneNum || !verificationCode) {
31
34
  throw new Error('输入内容不合法');
@@ -48,7 +51,7 @@ export default async function loginBySms(
48
51
  provider_token: bindInfo.providerToken,
49
52
  });
50
53
  }
51
- } else if (hasRegisterConfig && isRegister) {
54
+ } else if ((hasRegisterConfig && isRegister) || isAutoRegister) {
52
55
  // 自定义应用走signUp逻辑
53
56
  await auth.signUp({
54
57
  phone_number: `+86 ${phoneNum}`,
@@ -13,6 +13,16 @@ export default function (instance) {
13
13
  pageId: query.sourcePageId,
14
14
  packageName: query.sourcePagePackageName || undefined,
15
15
  params,
16
+ fail: (res) => {
17
+ if (res.errMsg?.includes?.('tabbar page')) {
18
+ const path = `${
19
+ query.sourcePagePackageName ? '/packages/' + query.sourcePagePackageName : ''
20
+ }/pages/${query.sourcePageId}/index`
21
+ app.switchTab({ url: path })
22
+ } else {
23
+ app.relaunchHome()
24
+ }
25
+ }
16
26
  }) : app.relaunchHome();
17
27
  } catch (e) {
18
28
  app.relaunchHome();
@@ -100,7 +100,7 @@ module.exports = function (options) {
100
100
  }),
101
101
  new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
102
102
  new webpack.NormalModuleReplacementPlugin(
103
- /@\/components\/(?!ui)(.*)|^@\/(lib|hooks|configs|utils)|^@\/components$/, // 使用否定前瞻匹配除ui外的所有路径
103
+ /@\/components\/(?!ui)(.*)|^@\/(lib|hooks|configs|utils|pages)|^@\/components$/, // 使用否定前瞻匹配除ui外的所有路径
104
104
  function (resource) {
105
105
  if (/lowcode\//.test(resource.context)) {
106
106
  if (resource.request === '@/components') {