Commit 6a84adf3 authored by 郭志伟's avatar 郭志伟

fix: apollo测试

parent 5e1b90e5
import { Controller, Context } from 'egg'; import { Controller, Context } from 'egg';
import { trim, omitBy } from 'lodash'; import { trim, 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) {
...@@ -9,7 +9,10 @@ export default class EditorController extends Controller { ...@@ -9,7 +9,10 @@ export default class EditorController extends Controller {
} }
public async home(ctx: Context) { public async home(ctx: Context) {
await ctx.renderClient('editor.js', {}); const { api, qiniu } = await import(path.resolve('./config/apollo.json'));
await ctx.renderClient('editor.js', {
apollo: {...api, ...qiniu}
});
} }
public async save(ctx: Context) { public async save(ctx: Context) {
......
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https'; const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
export default { export default {
apiHost: `https://quantum-blocks-test1.liangkebang.net/`, apiHost: `https://quantum-blocks-test1.liangkebang.net/`,
h5Host: 'https://quantum-h5-test1.liangkebang.net/', h5Host: 'https://quantum-h5-test1.liangkebang.net/',
......
...@@ -3,7 +3,8 @@ declare var EASY_ENV_IS_BROWSER: boolean; ...@@ -3,7 +3,8 @@ declare var EASY_ENV_IS_BROWSER: boolean;
declare var __webpack_public_path__: string; declare var __webpack_public_path__: string;
type PlainObject<T = any> = { [key: string]: T }; type PlainObject<T = any> = { [key: string]: T };
interface Window { interface Window {
__INITIAL_STATE__: string; __INITIAL_STATE__: string | any;
__POWERED_BY_QIANKUN__: string; __POWERED_BY_QIANKUN__: string;
__INJECTED_PUBLIC_PATH_BY_QIANKUN__: string; __INJECTED_PUBLIC_PATH_BY_QIANKUN__: string;
} }
\ No newline at end of file declare var apollo: any;
\ No newline at end of file
...@@ -23,6 +23,9 @@ const create = function(initState) { ...@@ -23,6 +23,9 @@ const create = function(initState) {
const client = function() { const client = function() {
const vm = create(window.__INITIAL_STATE__); const vm = create(window.__INITIAL_STATE__);
if (window.__INITIAL_STATE__.apollo) {
window.apollo = window.__INITIAL_STATE__.apollo;
}
const app = new Vue(vm); const app = new Vue(vm);
const root = document.getElementById('app'); const root = document.getElementById('app');
const hydrate = (<HTMLElement>root).childNodes.length > 0; const hydrate = (<HTMLElement>root).childNodes.length > 0;
......
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
<link rel="stylesheet" type="text/css" href="https://activitystatic.lkbang.net/swiper/4.5.1/css/swiper.min.css"> <link rel="stylesheet" type="text/css" href="https://activitystatic.lkbang.net/swiper/4.5.1/css/swiper.min.css">
<style> <style>
html { html {
font-size: 37.5Px !important; font-size: 37.5px !important;
} }
html, body { html,
body {
line-height: 1.15 !important; line-height: 1.15 !important;
} }
</style> </style>
......
{ {
"api": { "api": {
"apiHost": "https://quantum-blocks-vcc2.liangkebang.net/", "apiHost": "https://quantum-blocks-undefined.liangkebang.net/",
"h5Host": "https://quantum-h5-vcc2.liangkebang.net/", "h5Host": "https://quantum-h5-undefined.liangkebang.net/",
"opapiHost": "https://opapi-vcc2.liangkebang.net/" "opapiHost": "https://opapi-undefined.liangkebang.net/"
}, },
"mysql": { "mysql": {
"low_code": { "low_code": {
......
...@@ -1501,9 +1501,9 @@ ...@@ -1501,9 +1501,9 @@
} }
}, },
"@qg/citrus-ui": { "@qg/citrus-ui": {
"version": "0.1.2", "version": "0.1.3-beta1",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.1.2.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.1.3-beta1.tgz",
"integrity": "sha512-wh2EY618bDcrnXmQIzEoL10Pnx/JYVzbj7HZNBeLi3LU4TCmDVGTAR54YQac97pJNleIXRfaSb8x39jSmm7bJw==", "integrity": "sha512-lf87UC4XOKaloHfa9rj8xnFwTfEYDhEwOQ8K5KAslxsM7aPYPMrIZi4f5JCFvrJTi7YbQRrJq+D9QkCWl6T/Hg==",
"requires": { "requires": {
"@better-scroll/core": "^2.1.1", "@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.20.19", "@qg/cherry-ui": "^2.20.19",
...@@ -20135,9 +20135,9 @@ ...@@ -20135,9 +20135,9 @@
"integrity": "sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w=" "integrity": "sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w="
}, },
"rollup": { "rollup": {
"version": "2.48.0", "version": "2.49.0",
"resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.48.0.tgz", "resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.49.0.tgz",
"integrity": "sha512-wl9ZSSSsi5579oscSDYSzGn092tCS076YB+TQrzsGuSfYyJeep8eEWj0eaRjuC5McuMNmcnR8icBqiE/FWNB1A==", "integrity": "sha512-UnrCjMXICx9q0jF8L7OYs7LPk95dW0U5UYp/VANnWqfuhyr66FWi/YVlI34Oy8Tp4ZGLcaUDt4APJm80b9oPWQ==",
"requires": { "requires": {
"fsevents": "~2.3.1" "fsevents": "~2.3.1"
} }
......
...@@ -3,7 +3,6 @@ const path = require('path'); ...@@ -3,7 +3,6 @@ const path = require('path');
const SentryPlugin = require("webpack-sentry-plugin"); const SentryPlugin = require("webpack-sentry-plugin");
const resolve = filepath => path.resolve(__dirname, filepath); const resolve = filepath => path.resolve(__dirname, filepath);
const SentryConfig = require("./app/web/.sentryclirc.ts"); const SentryConfig = require("./app/web/.sentryclirc.ts");
const apollo = require('@qg/apollo-nodejs');
let { name } = require('./package'); let { name } = require('./package');
name = name.replace(/-/g, ''); name = name.replace(/-/g, '');
...@@ -75,15 +74,6 @@ module.exports = { ...@@ -75,15 +74,6 @@ module.exports = {
define:{ define:{
'process.env': { 'process.env': {
SENTRY_ENV: JSON.stringify(process.env.SENTRY_ENV) SENTRY_ENV: JSON.stringify(process.env.SENTRY_ENV)
},
'window.apollo': async function() {
if (process.env.NODE_ENV === 'development') return;
await apollo.load({
appId: 'quantum-blocks',
configPath: path.resolve(__dirname, '../config'),
});
const cfg = require("./config/apollo.json");
return JSON.stringify({ ...cfg.api, ...cfg.qiniu });
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment