Skip to content

Commit cae9974

Browse files
committed
merge branch 'tiny/develop'
2 parents fc69d6c + 69efc94 commit cae9974

17 files changed

Lines changed: 94 additions & 63 deletions

File tree

.github/workflows/deploy-gh-pages.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches: [develop]
6+
workflow_dispatch:
7+
inputs:
8+
environment:
9+
description: 'Backend environment'
10+
required: true
11+
default: 'alpha'
12+
type: choice
13+
options:
14+
- alpha
15+
- production
616

717
jobs:
818
deploy-gh-pages:
@@ -31,14 +41,17 @@ jobs:
3141

3242
- name: add environment variable
3343
run: |
34-
cat <<'EOF' >> designer-demo/env/.env.alpha
35-
// ---- appended by CI (gh-pages) ----
36-
VITE_ORIGIN=https://agent.opentiny.design/
44+
ENV=${{ github.event.inputs.environment || 'alpha' }}
45+
VITE_ORIGIN_URL="https://agent-alpha.opentiny.design/"
46+
if [ "$ENV" = "production" ]; then
47+
VITE_ORIGIN_URL="https://agent.opentiny.design/"
48+
fi
49+
cat <<EOF >> designer-demo/env/.env.alpha
50+
# ---- appended by CI (gh-pages) ----
51+
VITE_ORIGIN=$VITE_ORIGIN_URL
3752
EOF
38-
- name: change material url
39-
run: |
40-
sed -i "s#material: \['/mock/bundle.json'\]#material: \['https://opentiny.github.io/tiny-engine/mock/bundle.json'\]#g" designer-demo/engine.config.js
41-
echo "Updated material url in designer-demo/engine.config.js"
53+
echo "DEPLOY_ENV=$ENV"
54+
echo "VITE_ORIGIN_URL=$VITE_ORIGIN_URL"
4255
- name: Run Build
4356
run: |
4457
set -eo pipefail

designer-demo/engine.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
id: 'engine.config',
33
theme: 'light',
4-
material: ['/mock/bundle.json'],
4+
material: ['./mock/bundle.json'],
55
scripts: [],
66
styles: [],
77
// 是否开启 TailWindCSS 特性

packages/common/composable/defaultGlobalService.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,30 @@ const userState = reactive({
4949
username: '',
5050
token: null,
5151
expireTime: null,
52-
tenantId: ''
52+
tenantId: '',
53+
tenant: []
5354
},
5455
needToLogin: false
5556
})
5657

5758
const getLoginStatus = () => userState.needToLogin
5859

59-
const setNeedToLogin = (value: boolean, tenantId: any) => {
60+
const setNeedToLogin = (value: boolean) => {
6061
userState.needToLogin = value
6162
if (!value) {
62-
const baseUrl = `${window.location.origin}${window.location.pathname}?type=app&`
63-
const id = getBaseInfo().id
64-
const baseTenantId = getBaseInfo().tenantId
65-
66-
// 浏览器Url没有组织id,都默认公共组织,应用id默认为公共组织的应用1
67-
if (!baseTenantId) {
68-
window.location.href = `${baseUrl}id=1&tenant=${tenantId}`
69-
}
70-
71-
if (baseTenantId && !id) {
72-
window.location.href = `${baseUrl}tenant=${baseTenantId}`
73-
}
74-
75-
if (baseTenantId && id) {
76-
window.location = window.location
63+
const defaultTenantId = userState.userInfo.tenant?.[0]?.id
64+
if (defaultTenantId) {
65+
const currentUrl = new URL(window.location.href)
66+
const currentTenant = getBaseInfo().tenantId
67+
68+
const filterList = userState.userInfo.tenant.filter((item) => item.id === currentTenant) || []
69+
// 只有当tenant值不存在时才更新
70+
if (!filterList?.length) {
71+
currentUrl.searchParams.set('tenant', String(defaultTenantId))
72+
window.history.replaceState(window.history.state, '', currentUrl.href)
73+
}
7774
}
75+
window.location.reload()
7876
}
7977
}
8078

@@ -86,7 +84,12 @@ const setUserInfo = (data: any) => {
8684

8785
const fetchUserInfo = () => {
8886
// 获取登录用户信息
89-
return getMetaApi(META_SERVICE.Http).get('/platform-center/api/user/me')
87+
return getMetaApi(META_SERVICE.Http).get('/platform-center/api/user/me', {
88+
transformRequest: (data: any, headers: any) => {
89+
delete headers['x-lowcode-org']
90+
return data
91+
}
92+
})
9093
}
9194

9295
const setTenantInfo = (id: any) => {

packages/common/composable/http/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ const createAbortController = (config) => {
117117

118118
// 取消所有进行中的请求
119119
const abortAllRequests = (message = '用户未登录,请求已取消') => {
120-
abortControllers.forEach((controller, key) => {
120+
abortControllers.forEach((controller) => {
121121
controller.abort(message)
122122
})
123123
abortControllers.clear()
Lines changed: 12 additions & 1 deletion
Loading
Lines changed: 3 additions & 12 deletions
Loading
Lines changed: 3 additions & 9 deletions
Loading
File renamed without changes.

packages/design-core/src/login/Index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default {
6666
flex: 2;
6767
.login-img {
6868
max-height: 500px;
69+
min-height: 298px;
6970
width: 100%;
7071
height: 100%;
7172
background-image: url(../../assets/login-bg.svg);
@@ -83,6 +84,7 @@ export default {
8384
max-width: 440px;
8485
min-width: 340px;
8586
max-height: 500px;
87+
min-height: 298px;
8688
width: 100%;
8789
height: 100%;
8890
background: #fff;

0 commit comments

Comments
 (0)