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
cc729e48
Commit
cc729e48
authored
May 27, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改问题
parent
c2a0f20b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
activity.ts
app/controller/activity.ts
+3
-2
index.ts
app/web/page/store/modules/activity/index.ts
+15
-9
No files found.
app/controller/activity.ts
View file @
cc729e48
...
...
@@ -3,7 +3,6 @@ import * as path from 'path';
export
default
class
ActivityController
extends
Controller
{
public
async
home
(
ctx
:
Context
)
{
const
{
api
,
qiniu
}
=
await
import
(
path
.
resolve
(
'
./config/apollo.json
'
));
const
redisKey
=
`quantum-blocks:page:
${
ctx
.
params
.
id
}
`
;
let
body
=
await
ctx
.
service
.
redis
.
get
(
redisKey
);
if
(
body
)
{
...
...
@@ -14,9 +13,11 @@ export default class ActivityController extends Controller {
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
}
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
const
firstScriptTagIndex
=
body
.
indexOf
(
'
<script
'
);
const
{
api
,
qiniu
}
=
await
import
(
path
.
resolve
(
'
./config/apollo.json
'
));
const
firstScriptTagIndex
=
body
.
indexOf
(
'
<script
'
);
body
=
`
${
body
.
slice
(
0
,
firstScriptTagIndex
)}
<script>var apollo =
${
JSON
.
stringify
({...
api
,
...
qiniu
}
)}
;</script>
${
body
.
slice
(
firstScriptTagIndex
,
body
.
length
-
1
)}
`
;
}
ctx
.
logger
.
info
(
'
body: %j
'
,
body
);
ctx
.
body
=
body
;
}
}
\ No newline at end of file
app/web/page/store/modules/activity/index.ts
View file @
cc729e48
...
...
@@ -31,23 +31,29 @@ export default class EditorModule implements Module<EditorState, RootState> {
state
.
pageInfo
=
data
;
},
[
UPDATE_PAGE_INFO
](
state
,
{
containerIndex
,
childIndex
,
data
})
{
const
page
=
(
state
.
pageInfo
.
page
as
Page
).
elements
;
if
(
childIndex
||
childIndex
===
0
)
{
page
[
containerIndex
].
child
.
splice
(
childIndex
,
1
,
data
);
}
else
{
page
.
splice
(
containerIndex
,
1
,
data
);
if
(
state
.
pageInfo
&&
state
.
pageInfo
.
page
)
{
const
page
=
(
state
.
pageInfo
.
page
as
Page
).
elements
;
if
(
childIndex
||
childIndex
===
0
)
{
page
[
containerIndex
].
child
.
splice
(
childIndex
,
1
,
data
);
}
else
{
page
.
splice
(
containerIndex
,
1
,
data
);
}
}
},
[
SET_PAGE_DATA
](
state
,
data
)
{
state
.
pageInfo
.
page
=
data
;
},
[
SET_PAGE_ELEMENTS
](
state
,
data
)
{
if
(
data
)
{
(
state
.
pageInfo
.
page
as
Page
).
elements
=
data
;
}
if
(
state
.
pageInfo
&&
state
.
pageInfo
.
page
)
{
if
(
data
)
{
(
state
.
pageInfo
.
page
as
Page
).
elements
=
data
;
}
}
},
[
SET_ELEMENT_POINT
](
state
,
{
id
,
data
})
{
const
elements
=
(
state
.
pageInfo
.
page
as
Page
).
elements
;
const
element
=
elements
.
find
(
ele
=>
ele
.
id
===
id
);
if
(
element
&&
data
)
{
element
.
point
=
data
;
}
if
(
state
.
pageInfo
&&
state
.
pageInfo
.
page
)
{
const
elements
=
(
state
.
pageInfo
.
page
as
Page
).
elements
;
const
element
=
elements
.
find
(
ele
=>
ele
.
id
===
id
);
if
(
element
&&
data
)
{
element
.
point
=
data
;
}
}
},
};
...
...
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