Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks-h5
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-h5
Commits
1f97e9ba
Commit
1f97e9ba
authored
Jun 16, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(bottomTip): 底部提示语
parent
f9c3b95b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
22 deletions
+93
-22
activity.ts
app/controller/activity.ts
+11
-11
index.vue
app/web/page/activity/component/PageBottomTip/index.vue
+38
-0
index.ts
app/web/page/activity/view/activity/index.ts
+19
-2
index.vue
app/web/page/activity/view/activity/index.vue
+25
-9
No files found.
app/controller/activity.ts
View file @
1f97e9ba
...
...
@@ -3,18 +3,18 @@ export default class ActivityController extends Controller {
public
async
home
(
ctx
:
Context
)
{
const
redisKey
=
`quantum-blocks:page:
${
ctx
.
params
.
id
}
`
;
let
body
=
await
ctx
.
service
.
redis
.
get
(
redisKey
);
if
(
body
)
{
ctx
.
logger
.
info
(
'
请求redis成功 key: %j
'
,
redisKey
);
}
if
(
!
body
)
{
//
let body = await ctx.service.redis.get(redisKey);
//
if (body) {
//
ctx.logger.info('请求redis成功 key: %j', redisKey);
//
}
//
if (!body) {
let
apollo
=
{};
if
(
process
.
env
.
NODE_ENV
===
'
production
'
&&
process
.
env
.
EGG_SERVER_ENV
===
'
sit
'
)
{
apollo
=
ctx
.
app
.
config
.
apollo
||
{};
}
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
,
apollo
});
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
}
//
if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
//
apollo = ctx.app.config.apollo || {};
//
}
let
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
,
apollo
});
//
await ctx.service.redis.set(redisKey, body);
//
}
ctx
.
body
=
body
;
}
}
\ No newline at end of file
app/web/page/activity/component/PageBottomTip/index.vue
0 → 100644
View file @
1f97e9ba
<
template
>
<div
class=
"Pb-container"
>
<span
class=
"Pb-text"
:style=
"style"
>
{{
txt
}}
</span>
</div>
</
template
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
;
export
default
{
name
:
'
PageBottomTip
'
,
computed
:
{
...
mapGetters
([
'
pageData
'
]),
txt
()
{
return
this
.
pageData
.
props
.
pageBottomTxt
;
},
style
()
{
return
{
color
:
this
.
pageData
.
props
.
pageBottomColor
};
}
}
}
</
script
>
<
style
lang=
"less"
>
.Pb {
&-container {
height: 60px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
&-text {
font-size: 14px;
color: #333;
}
}
</
style
>
\ No newline at end of file
app/web/page/activity/view/activity/index.ts
View file @
1f97e9ba
import
{
Vue
,
Component
,
Watch
,
Provide
,
Mixins
}
from
'
vue-property-decorator
'
;
import
{
Getter
,
State
,
Mutation
}
from
'
vuex-class
'
;
import
FreedomContainer
from
'
../../component/FreedomContainer/index.vue
'
;
import
PageBottomTip
from
'
../../component/PageBottomTip/index.vue
'
;
import
GridLayout
from
'
../../component/VueGridLayout/GridLayout.vue
'
;
import
GridItem
from
'
../../component/VueGridLayout/GridItem.vue
'
;
import
TransformStyleMixin
from
'
@/page/mixins/transformStyle.mixin
'
;
import
SaMixin
from
'
@/page/mixins/sa.mixin
'
;
import
{
getStyle
,
debounce
}
from
'
@/service/utils.service
'
;
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
},
name
:
'
Activity
'
})
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
,
PageBottomTip
},
name
:
'
Activity
'
})
export
default
class
Activity
extends
Mixins
(
TransformStyleMixin
,
SaMixin
)
{
@
Getter
(
'
pageData
'
)
pageData
;
@
State
(
state
=>
state
.
activity
.
pageInfo
.
pageName
)
pageName
;
...
...
@@ -15,7 +16,8 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
@
Mutation
(
'
SET_PAGE_ELEMENTS
'
)
setPageElement
;
@
Provide
()
editor
=
this
;
bottomInfo
:
object
=
{};
isLayoutComReady
=
false
;
showBackTop
=
false
;
targetEle
:
HTMLElement
|
null
=
null
;
...
...
@@ -25,6 +27,21 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
get
layout
()
{
return
this
.
pageData
&&
this
.
pageData
.
elements
.
map
(
v
=>
v
.
point
)
||
[];
}
@
Watch
(
'
layout
'
)
onLayoutChange
(
val
)
{
const
lastGridItemPoint
=
val
[
val
.
length
-
1
];
if
(
lastGridItemPoint
.
w
)
{
this
.
bottomInfo
=
{
x
:
0
,
y
:
0
,
w
:
0
,
h
:
60
,
i
:
'
page-bottom-top
'
};
if
(
lastGridItemPoint
.
w
>
this
.
bottomInfo
.
w
)
{
this
.
bottomInfo
.
w
=
lastGridItemPoint
.
w
;
}
this
.
bottomInfo
.
y
=
this
.
bottomInfo
.
y
+
lastGridItemPoint
.
y
+
lastGridItemPoint
.
h
;
}
}
@
Watch
(
'
pageName
'
,
{
immediate
:
true
})
onPageNameChange
(
newVal
)
{
...
...
app/web/page/activity/view/activity/index.vue
View file @
1f97e9ba
...
...
@@ -16,18 +16,34 @@
@
layout-updated=
"layoutUpdatedEvent"
>
<grid-item
:style=
"transformStyle(item.commonStyle)"
v-for=
"(item, index) in pageData.elements"
:x=
"item.point.x"
:y=
"item.point.y"
:w=
"item.point.w"
:h=
"item.point.h"
:i=
"item.point.i"
:key=
"item.point.i"
@
click.native=
"dot(item.title)"
>
<component
:data-index=
"index"
:id=
"item.id"
:containerIndex=
"index"
:childItem=
"item"
:is=
"item.name"
:key=
"item.id"
:sa-info=
"getSaInfo(item)"
v-bind=
"item.props"
></component>
:x=
"item.point.x"
:y=
"item.point.y"
:w=
"item.point.w"
:h=
"item.point.h"
:i=
"item.point.i"
:key=
"item.point.i"
@
click.native=
"dot(item.title)"
>
<component
:data-index=
"index"
:id=
"item.id"
:containerIndex=
"index"
:childItem=
"item"
:is=
"item.name"
:key=
"item.id"
:sa-info=
"getSaInfo(item)"
v-bind=
"item.props"
></component>
</grid-item>
<grid-item
v-if=
"pageData.props.showPageBottomTip"
:x=
"bottomInfo.x"
:y=
"bottomInfo.y"
:w=
"bottomInfo.w"
:h=
"bottomInfo.h"
:i=
"bottomInfo.i"
:static=
"true"
:key=
"bottomInfo.i + pageData.elements.length"
>
<page-bottom-tip
/>
</grid-item>
</grid-layout>
<cr-back-top
v-if=
"showBackTop && pageData.props.showBackTop"
/>
<div
class=
"page-bottom"
>
<p><img
src=
""
/></p>
<p>
没有更多啦~
</p>
</div>
</div>
</
template
>
<
script
lang=
"ts"
src=
"./index.ts"
></
script
>
...
...
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