@cloudbase/lowcode-builder 1.10.1 → 1.10.3

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.1",
3
+ "version": "1.10.3",
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",
@@ -557,7 +557,7 @@
557
557
  crossorigin
558
558
  src="<%=
559
559
  cdnEndpoints.cdngo
560
- %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.18f98172f3be7e1d2860.bundle.js"
560
+ %>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.c91146779b08145f3c29.bundle.js"
561
561
  ></script>
562
562
  </body>
563
563
  </html>
@@ -8,7 +8,7 @@ import { default as cloudConfig } from '<%= subLevelPath %>../datasources/config
8
8
  import { createDataset } from '<%= subLevelPath %>../common/cloud-sdk'
9
9
 
10
10
  import config from '<%= subLevelPath %>../common/config';
11
- import { LOGIN_CONFIG } from '../common/util'
11
+ import { LOGIN_CONFIG, getLoginConfig } from '../common/util'
12
12
 
13
13
  <%= importor.state? `import state from '../lowcode/state'` : "const state = {}" %>
14
14
  <%= importor.computed? `import computed from '../lowcode/computed'` : "const computed = {}" %>
@@ -106,6 +106,8 @@ function createGlboalApi() {
106
106
  return globalAPI.__internal__.getConfig()
107
107
  }
108
108
 
109
+ globalAPI.__internal__.getLoginConfig = getLoginConfig
110
+
109
111
  let dataset = createDataset('$global', undefined, {
110
112
  appId: globalAPI.id
111
113
  })
@@ -1,3 +1,4 @@
1
+ import { APP_LAUNCH_OPTIONS_PROMISE } from '@cloudbase/weda-client'
1
2
  import { app, $app } from '<%= wedaRootRelativePath %>app/weapps-api';
2
3
  <%= importor.lifecycle? `import lifeCycle from '${wedaRootRelativePath}lowcode/lifecycle'` : "const lifeCycle = {}" %>
3
4
  // 引入数据源管理器并进行初始化
@@ -46,6 +47,7 @@ App({
46
47
  return this.globaldata._beforeCustomLaunchPromise;
47
48
  },
48
49
  async onLaunch(options) {
50
+ APP_LAUNCH_OPTIONS_PROMISE?.resolve(options)
49
51
  if (wx.onLazyLoadError) {
50
52
  wx.onLazyLoadError(({ type, subpackage, errMsg}) => {
51
53
  console.log('subpackage')
@@ -29,7 +29,7 @@ export async function redirectToLogin($page) {
29
29
 
30
30
  // 开启了多种登录模式,跳入登录页面让用户选择登录方式
31
31
  if (loginConfig?.miniprogram?.length > 1) {
32
- _redirectToLogin($page);
32
+ await _redirectToLogin($page);
33
33
  return null;
34
34
  }
35
35
 
@@ -46,15 +46,14 @@ export async function redirectToLogin($page) {
46
46
  const { avatarUrl, nickName } = app.auth.currentUser;
47
47
  // 信息不全,去登录页面补全信息
48
48
  if (!avatarUrl || !nickName) {
49
- _redirectToLogin($page, { baseInfoShow: 'true', currentLoginType: loginType });
49
+ await _redirectToLogin($page, { baseInfoShow: 'true', currentLoginType: loginType });
50
50
  return null
51
51
  }
52
52
 
53
- const accessData = await getAccessPermission(app.id, $page.__internal__.packageName, $page.id, <%= !!isAdminPortal %>)
54
- return { returnResult: accessData?.isAccess };
53
+ return { refreshAccess: true };
55
54
  }
56
55
 
57
- _redirectToLogin($page);
56
+ await _redirectToLogin($page);
58
57
  return null
59
58
  }
60
59
 
@@ -98,8 +97,9 @@ export async function checkAuth(app, appId, $page) {
98
97
  if (loginPage && !isInPublicPage) {
99
98
  // 开启了手机号授权登录,则判断是否跳转到登录页面
100
99
  const res = await redirectToLogin($page, loginConfig);
101
- if(res !== null) {
102
- return res.returnResult
100
+ if(res?.refreshAccess) {
101
+ const accessData = await getAccessPermission(appId, $page.__internal__.packageName, $page.id, <%= !!isAdminPortal %>)
102
+ return accessData?.isAccess
103
103
  }
104
104
  }
105
105
  } else {
@@ -114,14 +114,16 @@ export async function checkAuth(app, appId, $page) {
114
114
  if (loginPage && !isInPublicPage) {
115
115
  try {
116
116
  const res = await redirectToLogin($page, loginConfig);
117
- if(res !== null) {
118
- return res.returnResult
117
+ if(res?.refreshAccess) {
118
+ const accessData = await getAccessPermission(appId, $page.__internal__.packageName, $page.id, <%= !!isAdminPortal %>)
119
+ return accessData?.isAccess
119
120
  }
120
121
  return false;
121
122
  } catch (e) {
122
123
  const res = await redirectToLogin($page, loginConfig);
123
- if(res !== null) {
124
- return res.returnResult
124
+ if(res?.refreshAccess) {
125
+ const accessData = await getAccessPermission(appId, $page.__internal__.packageName, $page.id, <%= !!isAdminPortal %>)
126
+ return accessData?.isAccess
125
127
  }
126
128
  return false;
127
129
  }
@@ -59,16 +59,17 @@ const CLOUD_CONFIG = {
59
59
  } else if (!config.endpointType) {
60
60
  return loginState.notLogin && await auth.signInAnonymouslyInWx();
61
61
  }
62
- } else if (publicPage){
63
- const pages = getCurrentPages();
64
- const currentPage = pages[pages.length - 1]?.route?.match(/^pages\/(.*)\//)?.[1] || getApp().app?.__internal__?.getConfig()?.pages?.[0]?.id;
65
- if (publicPage.includes(currentPage)) {
66
- // 未登录时,进入公开访问页面,则匿名登录
67
- return loginState.notLogin && await auth.signInAnonymously();
68
- } else {
69
- return redirectToLogin?.();
70
- }
71
- }
62
+ } else {
63
+ if (publicPage){
64
+ const pages = getCurrentPages();
65
+ const currentPage = pages[pages.length - 1]?.route?.match(/^pages\/(.*)\//)?.[1] || getApp().app?.__internal__?.getConfig()?.pages?.[0]?.id;
66
+ if (publicPage.includes(currentPage)) {
67
+ // 未登录时,进入公开访问页面,则匿名登录
68
+ return loginState.notLogin && await auth.signInAnonymously();
69
+ }
70
+ }
71
+ return redirectToLogin?.();
72
+ }
72
73
 
73
74
  return await defaultLogin();
74
75
  },