Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks
Commits
85f2a80f
Commit
85f2a80f
authored
Nov 16, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tenant): 添加租户概念追加相关配置
parent
7b231575
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
239 additions
and
16 deletions
+239
-16
editor.ts
app/controller/editor.ts
+14
-6
tenantAuth.ts
app/controller/tenantAuth.ts
+58
-0
pageInfo.ts
app/model/pageInfo.ts
+6
-0
tenantAuth.ts
app/model/tenantAuth.ts
+63
-0
router.ts
app/router.ts
+2
-0
operation.api.ts
app/web/api/operation.api.ts
+4
-0
index.vue
app/web/component/layout/editor/micro/index.vue
+5
-0
index.ts
app/web/component/layout/editor/single/index.ts
+5
-1
dev.config.ts
app/web/config/dev.config.ts
+2
-1
prod.config.ts
app/web/config/prod.config.ts
+2
-1
test.config.ts
app/web/config/test.config.ts
+1
-0
app.ts
app/web/framework/app.ts
+0
-1
index.ts
app/web/page/editor/component/BasicPageFormModal/index.ts
+1
-0
index.vue
app/web/page/editor/component/BasicPageFormModal/index.vue
+1
-1
index.ts
app/web/page/editor/component/DynamicComponent/index.ts
+7
-0
index.vue
...r/component/DynamicForm/component/BackTopPicker/index.vue
+1
-0
index.ts
app/web/page/editor/component/DynamicFormTabs/index.ts
+1
-1
index.ts
app/web/page/editor/component/DynamicPageForm/index.ts
+9
-0
index.ts
app/web/page/editor/component/MaterialMenu/index.ts
+1
-1
index.vue
app/web/page/editor/view/pageList/index.vue
+1
-1
index.ts
app/web/page/store/index.ts
+3
-1
state.ts
app/web/page/store/modules/editor/state.ts
+1
-0
index.ts
app/web/page/store/modules/tenant/index.ts
+37
-0
state.ts
app/web/page/store/modules/tenant/state.ts
+5
-0
type.ts
app/web/page/store/modules/tenant/type.ts
+2
-0
http.service.ts
app/web/service/http.service.ts
+3
-1
index.d.ts
typings/app/controller/index.d.ts
+2
-0
index.d.ts
typings/app/model/index.d.ts
+2
-0
No files found.
app/controller/editor.ts
View file @
85f2a80f
import
{
Controller
,
Context
}
from
'
egg
'
;
import
{
Controller
,
Context
}
from
'
egg
'
;
import
{
trim
,
omitBy
}
from
'
lodash
'
;
import
{
omitBy
}
from
'
lodash
'
;
import
{
v1
as
uuidv1
}
from
'
uuid
'
;
import
{
v1
as
uuidv1
}
from
'
uuid
'
;
import
*
as
path
from
'
path
'
;
export
default
class
EditorController
extends
Controller
{
export
default
class
EditorController
extends
Controller
{
public
async
login
(
ctx
:
Context
)
{
public
async
login
(
ctx
:
Context
)
{
...
@@ -29,7 +28,7 @@ export default class EditorController extends Controller {
...
@@ -29,7 +28,7 @@ export default class EditorController extends Controller {
if
(
!
pageInfo
.
uuid
)
{
if
(
!
pageInfo
.
uuid
)
{
pageInfo
.
uuid
=
uuidv1
().
replace
(
/-/g
,
''
);
pageInfo
.
uuid
=
uuidv1
().
replace
(
/-/g
,
''
);
}
}
const
result
=
await
ctx
.
model
.
PageInfo
.
update
(
pageInfo
,
{
where
:
{
uuid
:
pageInfo
.
uuid
}});
const
result
=
await
ctx
.
model
.
PageInfo
.
update
(
pageInfo
,
{
where
:
{
uuid
:
pageInfo
.
uuid
,
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
]
}});
await
ctx
.
service
.
redis
.
set
(
`pageInfo:
${
pageInfo
.
uuid
}
`
,
pageInfo
);
await
ctx
.
service
.
redis
.
set
(
`pageInfo:
${
pageInfo
.
uuid
}
`
,
pageInfo
);
await
ctx
.
service
.
redis
.
del
(
`page:
${
pageInfo
.
uuid
}
`
);
await
ctx
.
service
.
redis
.
del
(
`page:
${
pageInfo
.
uuid
}
`
);
ctx
.
body
=
ctx
.
helper
.
ok
(
result
);
ctx
.
body
=
ctx
.
helper
.
ok
(
result
);
...
@@ -38,7 +37,14 @@ export default class EditorController extends Controller {
...
@@ -38,7 +37,14 @@ export default class EditorController extends Controller {
public
async
get
(
ctx
:
Context
)
{
public
async
get
(
ctx
:
Context
)
{
let
pageInfo
=
await
ctx
.
service
.
redis
.
get
(
`pageInfo:
${
ctx
.
params
.
uuid
}
`
);
let
pageInfo
=
await
ctx
.
service
.
redis
.
get
(
`pageInfo:
${
ctx
.
params
.
uuid
}
`
);
if
(
!
pageInfo
)
{
if
(
!
pageInfo
)
{
pageInfo
=
await
ctx
.
model
.
PageInfo
.
findOne
({
where
:
{
uuid
:
ctx
.
params
.
uuid
}});
pageInfo
=
await
ctx
.
model
.
PageInfo
.
findOne
({
where
:
{
uuid
:
ctx
.
params
.
uuid
,
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
]
}});
if
(
ctx
.
query
.
lite
&&
pageInfo
.
elements
.
length
)
{
const
page
=
JSON
.
parse
(
pageInfo
.
page
||
[]);
for
(
let
i
=
0
;
i
<
page
.
elements
.
length
;
i
++
)
{
delete
page
.
elements
[
i
].
schame
}
pageInfo
.
page
=
JSON
.
stringify
(
page
);
}
await
ctx
.
service
.
redis
.
set
(
`pageInfo:
${
ctx
.
params
.
uuid
}
`
,
pageInfo
);
await
ctx
.
service
.
redis
.
set
(
`pageInfo:
${
ctx
.
params
.
uuid
}
`
,
pageInfo
);
}
}
ctx
.
body
=
ctx
.
helper
.
ok
(
pageInfo
);
ctx
.
body
=
ctx
.
helper
.
ok
(
pageInfo
);
...
@@ -52,6 +58,7 @@ export default class EditorController extends Controller {
...
@@ -52,6 +58,7 @@ export default class EditorController extends Controller {
pageName
:
pageName
&&
{
like
:
`%
${
pageName
}
%`
},
pageName
:
pageName
&&
{
like
:
`%
${
pageName
}
%`
},
pageDescribe
:
pageDescribe
&&
{
like
:
`%
${
pageDescribe
}
%`
},
pageDescribe
:
pageDescribe
&&
{
like
:
`%
${
pageDescribe
}
%`
},
isPublish
,
isPublish
,
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
],
enable
:
1
enable
:
1
},
v
=>
!
v
);
},
v
=>
!
v
);
if
(
type
===
'
list
'
)
{
if
(
type
===
'
list
'
)
{
...
@@ -67,7 +74,7 @@ export default class EditorController extends Controller {
...
@@ -67,7 +74,7 @@ export default class EditorController extends Controller {
}
}
public
async
getTemplateList
(
ctx
:
Context
)
{
public
async
getTemplateList
(
ctx
:
Context
)
{
const
list
=
await
ctx
.
model
.
PageInfo
.
findAll
({
where
:
{
isTemplate
:
1
}
});
const
list
=
await
ctx
.
model
.
PageInfo
.
findAll
({
where
:
{
isTemplate
:
1
,
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
]
}
});
ctx
.
body
=
ctx
.
helper
.
ok
(
list
);
ctx
.
body
=
ctx
.
helper
.
ok
(
list
);
}
}
...
@@ -77,6 +84,7 @@ export default class EditorController extends Controller {
...
@@ -77,6 +84,7 @@ export default class EditorController extends Controller {
[
ctx
.
model
.
Sequelize
.
Op
.
lt
]:
Date
.
now
(),
[
ctx
.
model
.
Sequelize
.
Op
.
lt
]:
Date
.
now
(),
[
ctx
.
model
.
Sequelize
.
Op
.
gt
]:
new
Date
(
Date
.
now
()
-
1000
*
60
*
60
*
24
*
7
)
[
ctx
.
model
.
Sequelize
.
Op
.
gt
]:
new
Date
(
Date
.
now
()
-
1000
*
60
*
60
*
24
*
7
)
},
},
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
],
enable
:
1
,
enable
:
1
,
isPublish
:
1
isPublish
:
1
};
};
...
@@ -91,7 +99,7 @@ export default class EditorController extends Controller {
...
@@ -91,7 +99,7 @@ export default class EditorController extends Controller {
}
}
public
async
delete
(
ctx
:
Context
)
{
public
async
delete
(
ctx
:
Context
)
{
const
pageInfo
=
await
ctx
.
model
.
PageInfo
.
update
({
enable
:
0
},
{
where
:
{
id
:
+
ctx
.
params
.
pageId
}});
const
pageInfo
=
await
ctx
.
model
.
PageInfo
.
update
({
enable
:
0
},
{
where
:
{
id
:
+
ctx
.
params
.
pageId
,
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
]
}});
ctx
.
body
=
ctx
.
helper
.
ok
(
pageInfo
);
ctx
.
body
=
ctx
.
helper
.
ok
(
pageInfo
);
}
}
}
}
\ No newline at end of file
app/controller/tenantAuth.ts
0 → 100644
View file @
85f2a80f
import
{
Controller
,
Context
}
from
'
egg
'
;
import
{
omitBy
}
from
'
lodash
'
;
type
GetWhere
=
{
id
?:
number
|
unknown
;
tenantId
?:
number
|
unknown
;
};
export
default
class
TenantAuthController
extends
Controller
{
public
async
add
(
ctx
:
Context
)
{
const
authInfo
=
ctx
.
request
.
body
;
await
ctx
.
model
.
TenantAuth
.
create
({
...
authInfo
});
ctx
.
body
=
ctx
.
helper
.
ok
();
}
public
async
update
(
ctx
:
Context
)
{
const
authInfo
=
ctx
.
request
.
body
;
if
(
!
authInfo
.
tenantId
)
{
ctx
.
body
=
ctx
.
helper
.
fail
({
message
:
'
无租户id
'
,
code
:
'
0001
'
,
businessCode
:
'
0002
'
});
return
;
}
await
ctx
.
model
.
TenantAuth
.
update
(
authInfo
,
{
where
:
{
id
:
authInfo
.
id
}});
ctx
.
body
=
ctx
.
helper
.
ok
();
}
public
async
get
(
ctx
:
Context
)
{
const
where
:
GetWhere
=
{};
if
(
ctx
.
headers
[
'
qg-tenant-id
'
])
where
.
tenantId
=
ctx
.
headers
[
'
qg-tenant-id
'
];
if
(
ctx
.
query
.
id
)
where
.
tenantId
=
ctx
.
query
.
id
;
try
{
const
result
=
await
ctx
.
model
.
TenantAuth
.
findOne
({
where
});
ctx
.
body
=
ctx
.
helper
.
ok
(
result
);
}
catch
(
error
)
{
console
.
log
(
error
);
ctx
.
body
=
ctx
.
helper
.
fail
({
message
:
error
,
code
:
'
0001
'
,
businessCode
:
'
0001
'
});
}
}
public
async
getList
(
ctx
:
Context
)
{
const
{
pageSize
,
pageNo
,
tenantName
,
tenantId
}
=
ctx
.
query
;
const
{
like
}
=
ctx
.
model
.
Sequelize
.
Op
;
let
where
=
omitBy
({
tenantName
:
tenantName
&&
{
like
:
`%
${
tenantName
}
%`
},
tenantId
:
tenantId
&&
{
like
:
`%
${
tenantId
}
%`
},
enable
:
1
},
v
=>
!
v
);
const
{
count
:
total
,
rows
:
data
}
=
await
ctx
.
model
.
PageInfo
.
findAndCountAll
({
where
,
limit
:
+
pageSize
||
10
,
offset
:
(
+
pageNo
-
1
)
*
+
pageSize
||
0
,
order
:
[[
'
updated_at
'
,
'
DESC
'
]]
});
ctx
.
body
=
ctx
.
helper
.
ok
({
total
,
data
});
}
public
async
delete
(
ctx
:
Context
)
{
const
authInfo
=
await
ctx
.
model
.
PageInfo
.
update
({
enable
:
0
},
{
where
:
{
id
:
+
ctx
.
params
.
id
}});
ctx
.
body
=
ctx
.
helper
.
ok
(
authInfo
);
}
}
\ No newline at end of file
app/model/pageInfo.ts
View file @
85f2a80f
...
@@ -86,6 +86,12 @@ export class PageInfo extends Model<PageInfo> {
...
@@ -86,6 +86,12 @@ export class PageInfo extends Model<PageInfo> {
},
},
})
})
updatedAt
:
string
;
updatedAt
:
string
;
@
Column
({
type
:
DataType
.
INTEGER
(
11
),
field
:
'
tenant_id
'
,
})
tenantId
:
number
;
}
}
export
default
()
=>
PageInfo
;
export
default
()
=>
PageInfo
;
\ No newline at end of file
app/model/tenantAuth.ts
0 → 100644
View file @
85f2a80f
/**
* @desc 页面信息表
*/
import
{
AutoIncrement
,
Column
,
DataType
,
Model
,
PrimaryKey
,
Table
,
AllowNull
}
from
'
sequelize-typescript
'
;
@
Table
({
modelName
:
'
tenant_auth_info
'
,
freezeTableName
:
true
})
export
class
TenantAuth
extends
Model
<
TenantAuth
>
{
@
PrimaryKey
@
AutoIncrement
@
Column
({
type
:
DataType
.
INTEGER
(
11
)
})
id
:
number
;
@
AllowNull
(
false
)
@
Column
({
type
:
DataType
.
INTEGER
(
11
),
field
:
'
tenant_id
'
,
})
tenantId
:
number
;
@
Column
({
field
:
'
tenant_name
'
,
type
:
DataType
.
STRING
(
32
)
})
tenantName
:
string
;
@
Column
({
field
:
'
auth_config
'
,
type
:
DataType
.
TEXT
})
authConfig
:
string
;
@
Column
({
field
:
'
config_desc
'
,
type
:
DataType
.
STRING
(
255
)
})
configDesc
:
string
;
@
Column
({
type
:
DataType
.
INTEGER
(
1
)
})
enable
:
number
;
@
Column
({
type
:
DataType
.
DATE
,
field
:
'
updated_at
'
,
get
()
{
const
moment
=
require
(
'
moment
'
);
const
updatedAt
=
this
.
getDataValue
(
'
updatedAt
'
);
return
moment
(
updatedAt
).
format
(
'
YYYY-MM-DD HH:mm:ss
'
);
},
})
updatedAt
:
string
;
}
export
default
()
=>
TenantAuth
;
\ No newline at end of file
app/router.ts
View file @
85f2a80f
...
@@ -19,5 +19,7 @@ export default (application: Application) => {
...
@@ -19,5 +19,7 @@ export default (application: Application) => {
router
.
get
(
'
/editor/login
'
,
controller
.
editor
.
login
);
router
.
get
(
'
/editor/login
'
,
controller
.
editor
.
login
);
router
.
get
(
'
/editor
'
,
controller
.
editor
.
home
);
router
.
get
(
'
/editor
'
,
controller
.
editor
.
home
);
router
.
get
(
'
/editor/*
'
,
controller
.
editor
.
home
);
router
.
get
(
'
/editor/*
'
,
controller
.
editor
.
home
);
router
.
post
(
'
/tenant/add
'
,
controller
.
tenantAuth
.
add
);
router
.
get
(
'
/tenant/get
'
,
controller
.
tenantAuth
.
get
);
router
.
get
(
'
/*
'
,
controller
.
editor
.
home
);
router
.
get
(
'
/*
'
,
controller
.
editor
.
home
);
};
};
\ No newline at end of file
app/web/api/operation.api.ts
View file @
85f2a80f
...
@@ -20,6 +20,10 @@ export default {
...
@@ -20,6 +20,10 @@ export default {
getTemplateList
()
{
getTemplateList
()
{
return
http
.
get
(
'
editor/get/template
'
);
return
http
.
get
(
'
editor/get/template
'
);
},
},
// 获取权限
getTenantAuthInfo
()
{
return
http
.
get
(
'
tenant/get
'
);
},
// 商品列表-查询
// 商品列表-查询
skuInfo
(
params
)
{
skuInfo
(
params
)
{
return
http
.
post
(
`
${
config
.
opapiHost
}
/kdspOp/api/kdsp/activity/activity-goods/sku-info/list`
,
params
,
{
return
http
.
post
(
`
${
config
.
opapiHost
}
/kdspOp/api/kdsp/activity/activity-goods/sku-info/list`
,
params
,
{
...
...
app/web/component/layout/editor/micro/index.vue
View file @
85f2a80f
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
mapActions
}
from
'
vuex
'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
@@ -65,6 +66,9 @@
...
@@ -65,6 +66,9 @@
}
}
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
fetchTenantAuthData
'
]),
select
(
name
)
{
select
(
name
)
{
console
.
log
(
'
select
'
,
name
);
console
.
log
(
'
select
'
,
name
);
const
current
=
this
.
page
[
name
];
const
current
=
this
.
page
[
name
];
...
@@ -79,6 +83,7 @@
...
@@ -79,6 +83,7 @@
},
},
},
},
created
()
{
created
()
{
this
.
fetchTenantAuthData
();
console
.
log
(
'
isDashboard
'
,
this
.
$route
);
console
.
log
(
'
isDashboard
'
,
this
.
$route
);
},
},
computed
:
{
computed
:
{
...
...
app/web/component/layout/editor/single/index.ts
View file @
85f2a80f
import
{
Action
,
State
}
from
'
vuex-class
'
;
import
{
Vue
,
Component
,
Prop
,
Watch
}
from
'
vue-property-decorator
'
;
import
{
Vue
,
Component
,
Prop
,
Watch
}
from
'
vue-property-decorator
'
;
import
iView
from
'
iview
'
;
import
iView
from
'
iview
'
;
import
Raven
from
'
raven-js
'
;
import
Raven
from
'
raven-js
'
;
...
@@ -27,6 +28,8 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
...
@@ -27,6 +28,8 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
export
default
class
Layout
extends
Vue
{
export
default
class
Layout
extends
Vue
{
activeName
:
string
=
'
list
'
;
activeName
:
string
=
'
list
'
;
username
:
string
=
localStorage
.
get
(
'
user
'
)?.
name
||
'
陌生人
'
;
username
:
string
=
localStorage
.
get
(
'
user
'
)?.
name
||
'
陌生人
'
;
@
Action
(
'
fetchTenantAuthData
'
)
fetchTenantAuthData
;
@
State
(
state
=>
state
)
state
;
get
isDashboard
()
{
get
isDashboard
()
{
return
this
.
activeName
===
'
detail
'
;
return
this
.
activeName
===
'
detail
'
;
...
@@ -48,7 +51,8 @@ export default class Layout extends Vue {
...
@@ -48,7 +51,8 @@ export default class Layout extends Vue {
window
.
location
.
href
=
'
/editor/login
'
;
window
.
location
.
href
=
'
/editor/login
'
;
}
}
created
()
{
async
created
()
{
await
this
.
fetchTenantAuthData
();
console
.
log
(
'
>>EASY_ENV_IS_NODE create
'
,
EASY_ENV_IS_NODE
);
console
.
log
(
'
>>EASY_ENV_IS_NODE create
'
,
EASY_ENV_IS_NODE
);
}
}
}
}
\ No newline at end of file
app/web/config/dev.config.ts
View file @
85f2a80f
...
@@ -10,5 +10,6 @@ export default {
...
@@ -10,5 +10,6 @@ export default {
opapiHost
:
`https://opapi-bfe.liangkebang.net`
,
opapiHost
:
`https://opapi-bfe.liangkebang.net`
,
qiniuUpHost
:
`
${
protocol
}
//up-z0.qiniup.com`
,
qiniuUpHost
:
`
${
protocol
}
//up-z0.qiniup.com`
,
// kdspHost: 'https://kdsp-api-bfe.liangkebang.net',
// kdspHost: 'https://kdsp-api-bfe.liangkebang.net',
kdspHost
:
'
https://talos-bfe.liangkebang.net
'
kdspHost
:
'
https://talos-bfe.liangkebang.net
'
,
yxmTenantId
:
560761
};
};
\ No newline at end of file
app/web/config/prod.config.ts
View file @
85f2a80f
...
@@ -7,7 +7,8 @@ const hostMap = {
...
@@ -7,7 +7,8 @@ const hostMap = {
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=production`
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=production`
,
opapiHost
:
`
${
protocol
}
//opapi.q-gp.com`
,
opapiHost
:
`
${
protocol
}
//opapi.q-gp.com`
,
qiniuUpHost
:
`
${
protocol
}
//up-z0.qiniup.com`
,
qiniuUpHost
:
`
${
protocol
}
//up-z0.qiniup.com`
,
kdspHost
:
`
${
protocol
}
//talos.q-gp.com`
kdspHost
:
`
${
protocol
}
//talos.q-gp.com`
,
yxmTenantId
:
560761
};
};
if
(
EASY_ENV_IS_BROWSER
)
{
if
(
EASY_ENV_IS_BROWSER
)
{
...
...
app/web/config/test.config.ts
View file @
85f2a80f
...
@@ -7,6 +7,7 @@ const hostMap = {
...
@@ -7,6 +7,7 @@ const hostMap = {
qiniuHost
:
`
${
protocol
}
//appsync.lkbang.net`
,
qiniuHost
:
`
${
protocol
}
//appsync.lkbang.net`
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=default`
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=default`
,
qiniuUpHost
:
`
${
protocol
}
//up-z0.qiniup.com`
,
qiniuUpHost
:
`
${
protocol
}
//up-z0.qiniup.com`
,
yxmTenantId
:
560761
};
};
if
(
EASY_ENV_IS_BROWSER
)
{
if
(
EASY_ENV_IS_BROWSER
)
{
...
...
app/web/framework/app.ts
View file @
85f2a80f
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
sync
}
from
'
vuex-router-sync
'
;
import
{
sync
}
from
'
vuex-router-sync
'
;
export
default
class
App
{
export
default
class
App
{
config
:
any
;
config
:
any
;
constructor
(
config
)
{
constructor
(
config
)
{
...
...
app/web/page/editor/component/BasicPageFormModal/index.ts
View file @
85f2a80f
...
@@ -12,6 +12,7 @@ import { getStyle } from '@service/utils.service';
...
@@ -12,6 +12,7 @@ import { getStyle } from '@service/utils.service';
export
default
class
DynamicForm
extends
Vue
{
export
default
class
DynamicForm
extends
Vue
{
@
Getter
(
'
pageInfo
'
)
pageInfo
;
@
Getter
(
'
pageInfo
'
)
pageInfo
;
@
Getter
(
'
pageData
'
)
pageData
;
@
Getter
(
'
pageData
'
)
pageData
;
@
State
(
state
=>
state
.
tenant
.
hideShareBtn
)
hideShareBtn
;
@
Prop
(
Boolean
)
value
;
@
Prop
(
Boolean
)
value
;
showPopup
:
boolean
=
false
;
showPopup
:
boolean
=
false
;
...
...
app/web/page/editor/component/BasicPageFormModal/index.vue
View file @
85f2a80f
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<Upload
v-model=
"formCustom.shareCoverImage"
:show-input=
"false"
/>
<Upload
v-model=
"formCustom.shareCoverImage"
:show-input=
"false"
/>
<p
class=
"basic-form__tip"
>
可选,默认使用页面缩略图,建议图片比例1:1,图片格式jpg、png
</p>
<p
class=
"basic-form__tip"
>
可选,默认使用页面缩略图,建议图片比例1:1,图片格式jpg、png
</p>
</FormItem>
</FormItem>
<FormItem
label=
"分享打开方式"
prop=
"shareOpenMethod"
>
<FormItem
label=
"分享打开方式"
prop=
"shareOpenMethod"
v-if=
"!hideShareBtn"
>
<RadioGroup
v-model=
"formCustom.shareOpenMethod"
>
<RadioGroup
v-model=
"formCustom.shareOpenMethod"
>
<Radio
:label=
"1"
:disabled=
"!enableShare"
>
小程序
</Radio>
<Radio
:label=
"1"
:disabled=
"!enableShare"
>
小程序
</Radio>
<Radio
:label=
"2"
:disabled=
"!enableShare"
>
APP
</Radio>
<Radio
:label=
"2"
:disabled=
"!enableShare"
>
APP
</Radio>
...
...
app/web/page/editor/component/DynamicComponent/index.ts
View file @
85f2a80f
...
@@ -7,6 +7,7 @@ import { v4 as uuid } from 'uuid';
...
@@ -7,6 +7,7 @@ import { v4 as uuid } from 'uuid';
@
Component
({
name
:
'
DynamicComponent
'
})
@
Component
({
name
:
'
DynamicComponent
'
})
export
default
class
DynamicComponent
extends
Vue
{
export
default
class
DynamicComponent
extends
Vue
{
@
State
(
state
=>
state
.
editor
.
gridLayout
.
colNum
)
colNum
;
@
State
(
state
=>
state
.
editor
.
gridLayout
.
colNum
)
colNum
;
@
State
(
state
=>
state
.
tenant
.
hideFinanceTab
)
hideFinanceTab
;
@
Prop
({
default
:
()
=>
([]),
type
:
Array
})
data
;
@
Prop
({
default
:
()
=>
([]),
type
:
Array
})
data
;
@
Prop
(
String
)
type
;
@
Prop
(
String
)
type
;
...
@@ -14,6 +15,12 @@ export default class DynamicComponent extends Vue {
...
@@ -14,6 +15,12 @@ export default class DynamicComponent extends Vue {
eleConfigMap
:
object
=
{};
eleConfigMap
:
object
=
{};
activeName
:
string
=
''
;
activeName
:
string
=
''
;
@
Watch
(
'
hideFinanceTab
'
,
{
immediate
:
true
})
onHideFinanceTabChange
(
val
)
{
if
(
val
&&
this
.
eleConfigMap
.
fs
)
{
this
.
$delete
(
this
.
eleConfigMap
,
'
fs
'
);
}
}
@
Watch
(
'
data
'
,
{
immediate
:
true
})
@
Watch
(
'
data
'
,
{
immediate
:
true
})
onDataChange
(
newVal
)
{
onDataChange
(
newVal
)
{
if
(
this
.
type
===
'
business
'
)
{
if
(
this
.
type
===
'
business
'
)
{
...
...
app/web/page/editor/component/DynamicForm/component/BackTopPicker/index.vue
View file @
85f2a80f
...
@@ -27,6 +27,7 @@ const CONFIG_MAP = {
...
@@ -27,6 +27,7 @@ const CONFIG_MAP = {
[
'
自定义
'
]:
DEFAULT_CONFIG
[
'
自定义
'
]:
DEFAULT_CONFIG
};
};
export
default
{
export
default
{
name
:
'
BackTopPicker
'
,
mixins
:
[
FormList
],
mixins
:
[
FormList
],
data
()
{
data
()
{
return
{
return
{
...
...
app/web/page/editor/component/DynamicFormTabs/index.ts
View file @
85f2a80f
...
@@ -5,7 +5,7 @@ import DynamicPageForm from '@editor/component/DynamicPageForm/index.vue';
...
@@ -5,7 +5,7 @@ import DynamicPageForm from '@editor/component/DynamicPageForm/index.vue';
import
DynamicComponentSort
from
'
@editor/component/DynamicComponentSort/index.vue
'
;
import
DynamicComponentSort
from
'
@editor/component/DynamicComponentSort/index.vue
'
;
// import EventBus from '@service/eventBus.service';
// import EventBus from '@service/eventBus.service';
@
Component
({
components
:
{
DynamicPageForm
,
DynamicForm
,
DynamicComponentSort
},
name
:
'
RecordModal
'
})
@
Component
({
components
:
{
DynamicPageForm
,
DynamicForm
,
DynamicComponentSort
},
name
:
'
DynamicFormTabs
'
})
export
default
class
DynamicFormTabs
extends
Vue
{
export
default
class
DynamicFormTabs
extends
Vue
{
@
Getter
(
'
curRightTabName
'
)
curRightTabName
!
:
string
|
null
;
@
Getter
(
'
curRightTabName
'
)
curRightTabName
!
:
string
|
null
;
...
...
app/web/page/editor/component/DynamicPageForm/index.ts
View file @
85f2a80f
...
@@ -15,6 +15,7 @@ import { SHOP_CART_CONFIG } from '@service/staticData.service';
...
@@ -15,6 +15,7 @@ import { SHOP_CART_CONFIG } from '@service/staticData.service';
@
Component
({
components
:
{
Upload
,
ColorSelector
,
BaseSelect
,
Textarea
,
Number
,
FormList
,
BackTopPicker
,
SwitchBtn
},
name
:
'
DynamicPageForm
'
})
@
Component
({
components
:
{
Upload
,
ColorSelector
,
BaseSelect
,
Textarea
,
Number
,
FormList
,
BackTopPicker
,
SwitchBtn
},
name
:
'
DynamicPageForm
'
})
export
default
class
DynamicPageForm
extends
Mixins
(
ContextMenuMixin
)
{
export
default
class
DynamicPageForm
extends
Mixins
(
ContextMenuMixin
)
{
@
Getter
(
'
pageData
'
)
pageData
;
@
Getter
(
'
pageData
'
)
pageData
;
@
State
(
state
=>
state
.
tenant
.
hideShareBtn
)
hideShareBtn
;
title
:
string
=
'
页面
'
;
title
:
string
=
'
页面
'
;
commonStyleForm
:
object
=
{};
commonStyleForm
:
object
=
{};
...
@@ -154,6 +155,14 @@ export default class DynamicPageForm extends Mixins(ContextMenuMixin) {
...
@@ -154,6 +155,14 @@ export default class DynamicPageForm extends Mixins(ContextMenuMixin) {
get
propsSchema
()
{
get
propsSchema
()
{
return
[...
this
.
titleSchema
,
...
this
.
bottomSchema
,
...
this
.
floatSchema
];
return
[...
this
.
titleSchema
,
...
this
.
bottomSchema
,
...
this
.
floatSchema
];
}
}
@
Watch
(
'
hideShareBtn
'
,
{
immediate
:
true
})
onAuthStateChange
(
val
)
{
const
options
=
val
?
[
'
购物车
'
,
'
自定义
'
]
:
[
'
购物车
'
,
'
分享
'
,
'
自定义
'
];
this
.
$set
(
this
.
floatSchema
[
1
].
formControl
[
0
],
'
options
'
,
options
);
console
.
log
(
this
.
floatSchema
[
1
].
formControl
[
0
].
options
);
}
@
Watch
(
'
pageData
'
,
{
immediate
:
true
,
deep
:
true
})
@
Watch
(
'
pageData
'
,
{
immediate
:
true
,
deep
:
true
})
onElementChange
()
{
onElementChange
()
{
this
.
commonStyleSchame
.
forEach
(
schame
=>
{
this
.
commonStyleSchame
.
forEach
(
schame
=>
{
...
...
app/web/page/editor/component/MaterialMenu/index.ts
View file @
85f2a80f
...
@@ -3,7 +3,7 @@ import DynamicComponent from '@editor/component/DynamicComponent/index.vue';
...
@@ -3,7 +3,7 @@ import DynamicComponent from '@editor/component/DynamicComponent/index.vue';
import
{
basicComponents
,
businessComponents
}
from
'
@lib/config
'
;
import
{
basicComponents
,
businessComponents
}
from
'
@lib/config
'
;
import
{
State
}
from
'
vuex-class
'
;
import
{
State
}
from
'
vuex-class
'
;
@
Component
({
components
:
{
DynamicComponent
},
name
:
'
RecordModal
'
})
@
Component
({
components
:
{
DynamicComponent
},
name
:
'
DynamicForm
'
})
export
default
class
DynamicForm
extends
Vue
{
export
default
class
DynamicForm
extends
Vue
{
@
State
(
state
=>
state
.
editor
.
templateList
)
templateList
!
:
any
[];
@
State
(
state
=>
state
.
editor
.
templateList
)
templateList
!
:
any
[];
...
...
app/web/page/editor/view/pageList/index.vue
View file @
85f2a80f
...
@@ -59,7 +59,7 @@ export default {
...
@@ -59,7 +59,7 @@ export default {
[
h
(
[
h
(
'
img
'
,{
'
img
'
,{
attrs
:
{
attrs
:
{
src
:
params
.
row
.
coverImage
,
src
:
params
.
row
.
coverImage
+
'
?imageMogr2/format/jpg/thumbnail/!5p
'
,
},
},
style
:
{
style
:
{
width
:
'
37.5px
'
,
width
:
'
37.5px
'
,
...
...
app/web/page/store/index.ts
View file @
85f2a80f
...
@@ -3,6 +3,7 @@ import Vue from 'vue';
...
@@ -3,6 +3,7 @@ import Vue from 'vue';
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
RootState
from
'
./state
'
;
import
RootState
from
'
./state
'
;
import
Editor
from
'
./modules/editor
'
;
import
Editor
from
'
./modules/editor
'
;
import
Tenant
from
'
./modules/tenant
'
;
Vue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
...
@@ -13,7 +14,8 @@ export default function createStore(initState: any = {}) {
...
@@ -13,7 +14,8 @@ export default function createStore(initState: any = {}) {
return
new
Vuex
.
Store
<
RootState
>
({
return
new
Vuex
.
Store
<
RootState
>
({
state
,
state
,
modules
:
{
modules
:
{
editor
:
new
Editor
(
editor
)
tenant
:
new
Tenant
(),
editor
:
new
Editor
(
editor
),
}
}
});
});
}
}
\ No newline at end of file
app/web/page/store/modules/editor/state.ts
View file @
85f2a80f
...
@@ -57,6 +57,7 @@ export interface PageInfo {
...
@@ -57,6 +57,7 @@ export interface PageInfo {
pageDescribe
?:
string
;
pageDescribe
?:
string
;
pageKeywords
?:
string
;
pageKeywords
?:
string
;
uuid
?:
string
;
uuid
?:
string
;
tenantId
?:
number
;
}
}
export
default
interface
EditorState
{
export
default
interface
EditorState
{
...
...
app/web/page/store/modules/tenant/index.ts
0 → 100644
View file @
85f2a80f
import
operationApi
from
'
@api/operation.api
'
;
import
{
Module
,
GetterTree
,
ActionTree
,
MutationTree
}
from
'
vuex
'
;
import
{
FETCH_AUTH_INFO
}
from
'
./type
'
;
import
RootState
from
'
../../state
'
;
import
EditorAuthInfo
from
'
./state
'
;
import
Vue
from
'
vue
'
;
export
default
class
TenantModule
implements
Module
<
EditorAuthInfo
,
RootState
>
{
state
:
EditorAuthInfo
;
getters
:
GetterTree
<
EditorAuthInfo
,
RootState
>
=
{
authData
(
state
:
EditorAuthInfo
)
{
return
state
;
}
};
actions
:
ActionTree
<
EditorAuthInfo
,
RootState
>
=
{
async
fetchTenantAuthData
({
commit
})
{
const
res
:
Record
<
any
,
any
>
=
await
operationApi
.
getTenantAuthInfo
();
commit
(
FETCH_AUTH_INFO
,
JSON
.
parse
(
res
.
authConfig
as
string
));
}
};
mutations
:
MutationTree
<
EditorAuthInfo
>
=
{
[
FETCH_AUTH_INFO
](
state
,
data
)
{
// ! 此处存取存在问题
Vue
.
set
(
this
.
state
,
'
tenant
'
,
data
);
}
};
constructor
()
{
this
.
state
=
{}
as
EditorAuthInfo
;
}
}
\ No newline at end of file
app/web/page/store/modules/tenant/state.ts
0 → 100644
View file @
85f2a80f
export
default
interface
EditorAuthInfo
{
hideFinanceTab
?:
boolean
;
hideShareBtn
?:
boolean
;
}
\ No newline at end of file
app/web/page/store/modules/tenant/type.ts
0 → 100644
View file @
85f2a80f
'
use strict
'
;
export
const
FETCH_AUTH_INFO
=
'
FETCH_AUTH_INFO
'
;
app/web/service/http.service.ts
View file @
85f2a80f
...
@@ -96,7 +96,9 @@ instance.interceptors.request.use(
...
@@ -96,7 +96,9 @@ instance.interceptors.request.use(
config
.
headers
[
'
X-Auth-Token
'
]
=
token
;
config
.
headers
[
'
X-Auth-Token
'
]
=
token
;
if
(
config
.
accessToken
)
{
config
.
headers
[
'
Access-Token
'
]
=
token
;
}
if
(
config
.
accessToken
)
{
config
.
headers
[
'
Access-Token
'
]
=
token
;
}
}
}
// TODO 需要确定后台字段是什么
const
tenantId
=
localStorage
.
get
(
'
tenantId
'
)
||
''
;
config
.
headers
[
'
qg-tenant-id
'
]
=
tenantId
||
''
;
return
config
;
return
config
;
},
},
error
=>
{
error
=>
{
...
...
typings/app/controller/index.d.ts
View file @
85f2a80f
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
import
'
egg
'
;
import
'
egg
'
;
import
ExportEditor
from
'
../../../app/controller/editor
'
;
import
ExportEditor
from
'
../../../app/controller/editor
'
;
import
ExportTenantAuth
from
'
../../../app/controller/tenantAuth
'
;
declare
module
'
egg
'
{
declare
module
'
egg
'
{
interface
IController
{
interface
IController
{
editor
:
ExportEditor
;
editor
:
ExportEditor
;
tenantAuth
:
ExportTenantAuth
;
}
}
}
}
typings/app/model/index.d.ts
View file @
85f2a80f
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
import
'
egg
'
;
import
'
egg
'
;
import
ExportPageInfo
from
'
../../../app/model/pageInfo
'
;
import
ExportPageInfo
from
'
../../../app/model/pageInfo
'
;
import
ExportTenantAuth
from
'
../../../app/model/tenantAuth
'
;
declare
module
'
egg
'
{
declare
module
'
egg
'
{
interface
IModel
{
interface
IModel
{
PageInfo
:
ReturnType
<
typeof
ExportPageInfo
>
;
PageInfo
:
ReturnType
<
typeof
ExportPageInfo
>
;
TenantAuth
:
ReturnType
<
typeof
ExportTenantAuth
>
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment