From ae3e84f8f4e5f66ba820510545888c03be99b27a Mon Sep 17 00:00:00 2001 From: jayjduan Date: Thu, 30 Sep 2021 00:04:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BE=AE=E6=90=AD=E7=99=BB=E9=99=86cms?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0tam=E5=B9=B3=E5=8F=B0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +-- packages/admin/src/pages/login/index.tsx | 37 +++++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 966c1cff..ae50dd65 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "lint:fix": "eslint --fix --cache --ext .ts,.tsx --format=pretty ./packages", "lint:prettier": "prettier --check \"**/*.{ts,tsx,js,jsx,json}\" --end-of-line auto", "deploy": "tcb framework deploy", - "preext:zip": "rm -rf build && mkdir build && npm run build", - "preext:zip-wx": "rm -rf build && mkdir build && npm run build:wx", + "preext:zip": "rm -rf build && mkdir build && yarn run build", + "preext:zip-wx": "rm -rf build && mkdir build && yarn run build:wx", "ext:zip": "bash ./scripts/zip.sh", "ext:zip-wx": "bash ./scripts/zip.sh" }, diff --git a/packages/admin/src/pages/login/index.tsx b/packages/admin/src/pages/login/index.tsx index aad08779..c05fe8c9 100644 --- a/packages/admin/src/pages/login/index.tsx +++ b/packages/admin/src/pages/login/index.tsx @@ -72,10 +72,12 @@ const Login: React.FC<{}> = () => { const { username, password } = values + let loginSuccess = false try { // 用户名密码登录 await loginWithPassword(username.trim(), password.trim()) message.success('登录成功') + loginSuccess = true replaceGoto() setTimeout(() => { refresh() @@ -101,6 +103,7 @@ const Login: React.FC<{}> = () => { } setSubmitting(false) + return Promise.resolve(loginSuccess) } // 从低码平台登录 @@ -111,9 +114,16 @@ const Login: React.FC<{}> = () => { console.log('CMS 收到信息', event.data, event.origin) + const loginData: { + username?: string + password?: string + fromLowcode?: boolean + isSuccess?: boolean + } = {} try { const data = event?.data ? JSON.parse(event.data) : {} if (data?.from !== 'lowcode') return + loginData.fromLowcode = true window?.opener?.postMessage( JSON.stringify({ from: 'cms', @@ -123,30 +133,49 @@ const Login: React.FC<{}> = () => { ) const { password, username } = data - await handleSubmit({ + loginData.password = password || undefined + loginData.username = username || undefined + const loginSuccess = await handleSubmit({ password, username, }) + loginData.isSuccess = !!loginSuccess + // 响应低码平台 window?.opener?.postMessage( JSON.stringify({ from: 'cms', - status: 'success', + status: loginSuccess ? 'success' : 'fail', }), '*' ) } catch (error) { - if (window.parent === window.self) return + // if (window.parent === window.self) return // 响应低码平台 window?.opener?.postMessage( JSON.stringify({ from: 'cms', status: 'fail', - message: error.message, + message: error?.message, }), '*' ) } + + // 上报cms日志 + if (loginData?.fromLowcode && window['Aegis']) { + try { + new window['Aegis']({ + id: 'lXHFsBpTyYTEVwaNUr', + }).infoAll({ + msg: `lowcode-login::${loginData?.isSuccess || false}`, + ext1: window?.TcbCmsConfig?.envId || '', + ext2: loginData?.username || '', + // password: loginData.password || "", + ext3: loginData?.isSuccess || false, + }) + } catch (e) {} + } } window.addEventListener('message', messageListener, false) From 92be547050dcf3f83b996c20a4bc2e905dd02c53 Mon Sep 17 00:00:00 2001 From: jayjduan Date: Thu, 30 Sep 2021 00:05:15 +0800 Subject: [PATCH 2/3] v2.13.3 --- lerna.json | 2 +- packages/admin/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 91b0665f..73de5d66 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "packages": ["packages/*"], "npmClient": "yarn", - "version": "2.13.2" + "version": "2.13.3" } diff --git a/packages/admin/package.json b/packages/admin/package.json index 113b1800..950d6c97 100644 --- a/packages/admin/package.json +++ b/packages/admin/package.json @@ -1,6 +1,6 @@ { "name": "cloudbase-cms-admin", - "version": "2.13.2", + "version": "2.13.3", "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { From a3e03096baa19ccbc432973715cdd1de43e10ec7 Mon Sep 17 00:00:00 2001 From: jayjduan Date: Thu, 30 Sep 2021 00:37:04 +0800 Subject: [PATCH 3/3] =?UTF-8?q?sam.yml=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sam.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sam.yml b/sam.yml index 8c38a81a..82c77b9d 100644 --- a/sam.yml +++ b/sam.yml @@ -1,7 +1,7 @@ TCBSAMFormatVersion: '2020-10-20' Name: tcb-ext-cms SpecVersion: v1beta -Version: 2.13.2 +Version: 2.13.3 License: Apache-2.0 Category: CloudApp DisplayName: CMS内容管理系统 @@ -19,11 +19,9 @@ IconUrl: https://main.qcloudimg.com/raw/f87b49914efe502722f9aa128f5d8865/hello_w IntroUrl: https://docs.cloudbase.net/cms/intro.html # 更新日志 ChangeLog: - - Title: 2.13.2 + - Title: 2.13.3 Content: - - 优化数据列表样式 - - 优化时间类型数据的检索方式 - - 优化其他平台拉起cms流程 + - 体验优化 Author: AuthorName: TCB Email: cloudbase@tencent.com @@ -60,7 +58,7 @@ Resources: Type: CloudBase::Function Properties: FunctionName: tcb-ext-cms-init - CodeUri: extension://f95fb4211ebe4c6bb241f5af181019ab.zip + CodeUri: extension://0ba805cc0a3f4c80b211221115723de7.zip InstallDependency: true Description: 提供初始化应用功能,安装扩展后,会通过该函数来进行静态资源的部署和密码的生成和设置,修改账号密码或者部署路径等扩展参数都会再次执行该函数来进行更新 MemorySize: 256