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
c7712014
Commit
c7712014
authored
May 28, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: apollo问题修复
parent
f13ba138
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
11 deletions
+13
-11
activity.ts
app/controller/activity.ts
+6
-7
app.ts
app/web/framework/app.ts
+1
-2
index.ts
app/web/page/store/modules/activity/index.ts
+1
-1
config.sit.ts
config/config.sit.ts
+1
-1
typings.d.ts
config/typings.d.ts
+4
-0
No files found.
app/controller/activity.ts
View file @
c7712014
...
@@ -9,15 +9,14 @@ export default class ActivityController extends Controller {
...
@@ -9,15 +9,14 @@ export default class ActivityController extends Controller {
ctx
.
logger
.
info
(
'
请求redis成功 key: %j
'
,
redisKey
);
ctx
.
logger
.
info
(
'
请求redis成功 key: %j
'
,
redisKey
);
}
}
if
(
!
body
)
{
if
(
!
body
)
{
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
});
let
apollo
=
{};
// if (process.env.NODE_ENV === 'production') {
const
{
api
,
qiniu
}
=
ctx
.
app
.
config
.
apollo
||
{};
apollo
=
{
...
api
,
...
qiniu
};
// }
body
=
await
ctx
.
renderView
(
'
activity.js
'
,
{
url
:
ctx
.
url
,
apollo
});
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
}
}
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
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
;
ctx
.
body
=
body
;
}
}
}
}
\ No newline at end of file
app/web/framework/app.ts
View file @
c7712014
...
@@ -70,14 +70,13 @@ export default class App {
...
@@ -70,14 +70,13 @@ export default class App {
server
()
{
server
()
{
return
context
=>
{
return
context
=>
{
// console.log('server', context.state);
const
vm
=
this
.
create
(
context
.
state
);
const
vm
=
this
.
create
(
context
.
state
);
const
{
store
,
router
}
=
vm
;
const
{
store
,
router
}
=
vm
;
router
.
push
(
context
.
state
.
url
);
router
.
push
(
context
.
state
.
url
);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
router
.
onReady
(()
=>
{
router
.
onReady
(()
=>
{
this
.
fetch
(
vm
).
then
(()
=>
{
this
.
fetch
(
vm
).
then
(()
=>
{
context
.
state
=
store
.
state
;
context
.
state
=
{...
store
.
state
,
apollo
:
context
.
state
.
apollo
}
;
return
resolve
(
new
Vue
(
vm
));
return
resolve
(
new
Vue
(
vm
));
});
});
});
});
...
...
app/web/page/store/modules/activity/index.ts
View file @
c7712014
...
@@ -23,7 +23,7 @@ export default class EditorModule implements Module<EditorState, RootState> {
...
@@ -23,7 +23,7 @@ export default class EditorModule implements Module<EditorState, RootState> {
const
[
res
]
=
await
api
.
getPageById
(
condition
);
const
[
res
]
=
await
api
.
getPageById
(
condition
);
let
{
page
,
...
rest
}
=
res
as
PageInfo
;
let
{
page
,
...
rest
}
=
res
as
PageInfo
;
if
(
!
page
)
{
if
(
!
page
)
{
page
=
"
[]
"
;
page
=
'
[]
'
;
}
}
commit
(
SET_PAGE_INFO
,
{
...
rest
,
page
:
JSON
.
parse
(
page
as
string
)
});
commit
(
SET_PAGE_INFO
,
{
...
rest
,
page
:
JSON
.
parse
(
page
as
string
)
});
}
}
...
...
config/config.sit.ts
View file @
c7712014
import
{
Application
,
EggAppConfig
}
from
'
egg
'
;
import
{
Application
,
EggAppConfig
}
from
'
egg
'
;
const
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
export
default
(
appInfo
:
EggAppConfig
)
=>
{
export
default
(
appInfo
:
EggAppConfig
)
=>
{
const
exports
:
any
=
{};
const
exports
:
any
=
{};
const
{
redis
}
=
require
(
path
.
resolve
(
'
./config/apollo.json
'
));
const
{
redis
}
=
require
(
path
.
resolve
(
'
./config/apollo.json
'
));
...
...
config/typings.d.ts
0 → 100644
View file @
c7712014
declare
module
"
*.json
"
{
const
value
:
any
;
export
default
value
;
}
\ No newline at end of file
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