Commit 11f5a69e authored by 郭志伟's avatar 郭志伟

Merge branch 'feature/tenant' into 'master'

Feature/tenant

See merge request !59
parents a06261ca 49aa723b
...@@ -3,23 +3,22 @@ export default class ActivityController extends Controller { ...@@ -3,23 +3,22 @@ export default class ActivityController extends Controller {
public async home(ctx: Context) { public async home(ctx: Context) {
// 开发环境不走redis缓存 // 开发环境不走redis缓存
const apollo = ctx.app.config.apollo || {};
let body = '';
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
ctx.body = await ctx.renderToHtml('activity.js', { url: ctx.url });
return;
}
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 apollo = {};
if (process.env.NODE_ENV === 'production' && process.env.EGG_SERVER_ENV === 'sit') {
apollo = ctx.app.config.apollo || {};
}
body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo }); body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body); } else {
const redisKey = `quantum-blocks:page:${ctx.params.id}`;
body = await ctx.service.redis.get(redisKey);
if (body) {
ctx.logger.info('请求redis成功 key: %j', redisKey);
}
if (!body) {
body = await ctx.renderToHtml('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body);
}
} }
ctx.body = body; ctx.body = body;
} }
} }
...@@ -3,18 +3,26 @@ import config from '../config'; ...@@ -3,18 +3,26 @@ import config from '../config';
export default { export default {
getPageById(params) { getPageById(params) {
return http.get(`${config.apiHost}/editor/get/${params.pageId}`); return http.get(`${config.apiHost}/editor/get/${params.pageId}?lite=1`);
}, },
getShopCartCount() { getShopCartCount() {
return http.get(`${config.kdspHost}/api/kdsp/shop-cart/count`); return http.get(`${config.kdspHost}/api/kdsp/shop-cart/count`);
}, },
getMpSchema(params) { getMpSchema(params, appId, tenantId) {
return http.post(`${config.kdspHost}/api/kdsp/ka/info/getShareMiniUrl`, params, { emulateJSON: true }); return http.post(`${config.kdspHost}/api/kdsp/ka/info/getShareMiniUrl`, params, {
emulateJSON: true,
hideToast: true,
headers: {
'mini-app-id': appId,
'qg-tenant-id': tenantId
}
});
}, },
getWxConfig(url = window.location.href.split('#')[0]) { getWxConfig(url = window.location.href.split('#')[0]) {
return http.post(`${config.kdspHost}/api/kdsp/wx/mp/getJsapiSign`, { return http.post(`${config.kdspHost}/api/kdsp/wx/mp/getJsapiSign`, {
url, url,
appId: 'wx2f44c7fe7b08458d' appId: 'wx2f44c7fe7b08458d',
hideLoading: true
}); });
} }
}; };
\ No newline at end of file
...@@ -9,6 +9,7 @@ import SaDirective from '@qg/citrus-ui/src/helper/directives/saTrack.directive.j ...@@ -9,6 +9,7 @@ import SaDirective from '@qg/citrus-ui/src/helper/directives/saTrack.directive.j
import config from '@qg/citrus-ui/src/config/index.js'; import config from '@qg/citrus-ui/src/config/index.js';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus'; import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import { getParameterByName } from '../../../service/utils.service'; import { getParameterByName } from '../../../service/utils.service';
import localStorage from '../../../service/localStorage.service';
import lazyload from '@qg/cherry-ui/src/lazyload/index'; import lazyload from '@qg/cherry-ui/src/lazyload/index';
// 初始化sentry // 初始化sentry
...@@ -71,16 +72,19 @@ export default class Layout extends Vue { ...@@ -71,16 +72,19 @@ export default class Layout extends Vue {
`<script src="https://activitystatic.lkbang.net/axios/0.19.2/axios.min.js"></script>` `<script src="https://activitystatic.lkbang.net/axios/0.19.2/axios.min.js"></script>`
]; ];
talosHost: string = config.kdspHost; talosHost: string = config.kdspHost;
get title() { get title() {
return this.pageInfo.title || '羊小咩'; return this.pageInfo.title || this.defaultTitle();
} }
get description() { get description() {
return this.pageInfo.description || '羊小咩'; return this.pageInfo.description || this.defaultTitle();
} }
get keywords() { get keywords() {
return this.pageInfo.keywords || '羊小咩'; return this.pageInfo.keywords || this.defaultTitle();
}
defaultTitle() {
return +localStorage.get('tenantId') === 560671 ? '羊小咩' : '活动页';
} }
} }
\ No newline at end of file
...@@ -6,8 +6,20 @@ ...@@ -6,8 +6,20 @@
<meta name="description" :content="description"> <meta name="description" :content="description">
<meta http-equiv="content-type" content="text/html;charset=utf-8"> <meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="data:image/png;base64" type="image/x-icon" />
<link rel="dns-prefetch" :href="talosHost" /> <link rel="dns-prefetch" :href="talosHost" />
<link rel="preconnect" href="https://appsync.lkbang.net">
<link rel="dns-prefetch" href="//misc.lkbang.net">
<link rel="dns-prefetch" href="//appsync.lkbang.net">
<link rel="dns-prefetch" href="//img.lkbang.net">
<link rel="dns-prefetch" href="//img10.360buyimg.com">
<link rel="dns-prefetch" href="//img11.360buyimg.com">
<link rel="dns-prefetch" href="//img12.360buyimg.com">
<link rel="dns-prefetch" href="//img13.360buyimg.com">
<link rel="dns-prefetch" href="//img14.360buyimg.com">
<link rel="dns-prefetch" href="//img20.360buyimg.com">
<link rel="dns-prefetch" href="//img30.360buyimg.com">
<link rel="dns-prefetch" href="//kdspstatic.q-gp.com">
<!-- <link rel="stylesheet" href="/public/asset/css/reset.css"> --> <!-- <link rel="stylesheet" href="/public/asset/css/reset.css"> -->
<!-- <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"> -->
</head> </head>
......
import apolloSsr from '../../../config/apollo.ssr.json'; import apolloSsr from '../../../config/apollo.ssr.json';
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https'; const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https:';
const hostMap = { const hostMap = {
apiHost: `${protocol}//quantum-blocks-bfe.liangkebang.net`, apiHost: `${protocol}//quantum-blocks-tob.liangkebang.net`,
kdspHost: `${protocol}//talos-bfe.liangkebang.net`, kdspHost: `${protocol}//talos-tob.liangkebang.net`,
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`,
mallHost: `${protocol}://mall-bfe.liangkebang.net`, mallHost: `${protocol}//mall-tob.liangkebang.net`,
test: true test: true,
yxmTenantId: 560761,
appIdMap: {
560761: 'wxe16bf9293671506c',
560867: 'wxccb8435d68e8c7d6',
},
}; };
if (EASY_ENV_IS_BROWSER) { if (EASY_ENV_IS_BROWSER) {
......
...@@ -58,6 +58,7 @@ export default { ...@@ -58,6 +58,7 @@ export default {
}, },
request(cfg) { request(cfg) {
const { method, hideVccChannel } = cfg; const { method, hideVccChannel } = cfg;
cfg.headers['qg-tenant-id'] = localStorage.get('tenantId') || '';
cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || ''; cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || '';
cfg.headers['version'] = '8.2.00'; cfg.headers['version'] = '8.2.00';
if (cfg.customHeader) { if (cfg.customHeader) {
......
// const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https'; // const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
import apolloSsr from '../../../config/apollo.ssr.json';
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https:';
export default { const hostMap = {
apiHost: `https://quantum-blocks.q-gp.com`, apiHost: `${protocol}//quantum-blocks.q-gp.com`,
kdspHost: `https://talos.q-gp.com`, kdspHost: `${protocol}//talos.q-gp.com`,
shenceUrl: `https://bn.xyqb.com/sa?project=production`, shenceUrl: `${protocol}//bn.xyqb.com/sa?project=production`,
mallHost: `https://mall.q-gp.com`, mallHost: `${protocol}//mall.q-gp.com`,
test: false test: false,
yxmTenantId: 560761,
appIdMap: {
560761: 'wxb3e6270e1b1e0bc7',
560867: 'wxbd0bc68b270a1dab',
},
}; };
if (EASY_ENV_IS_BROWSER) {
const apolloWin = window.apollo || window.__INITIAL_STATE__.apollo;
if (apolloWin) {
for (const key in apolloWin) {
if (apolloWin[key]) {
hostMap[key] = apolloWin[key];
}
}
}
}
if (EASY_ENV_IS_NODE) {
if (apolloSsr) {
for (const key in apolloSsr) {
if (apolloSsr[key]) {
hostMap[key] = apolloSsr[key];
}
}
}
}
export default hostMap;
import apolloSsr from '../../../config/apollo.ssr.json'; import apolloSsr from '../../../config/apollo.ssr.json';
const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https'; const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https:';
const hostMap = { const hostMap = {
apiHost: `${protocol}//quantum-blocks-test1.liangkebang.net`, apiHost: `${protocol}//quantum-blocks-test1.liangkebang.net`,
kdspHost: `${protocol}//talos-test1.liangkebang.net`, kdspHost: `${protocol}//talos-test1.liangkebang.net`,
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`,
mallHost: `${protocol}://mall-test1.liangkebang.net`, mallHost: `${protocol}//mall-test1.liangkebang.net`,
test: true test: true,
yxmTenantId: 560761,
appIdMap: {
560761: 'wxe16bf9293671506c',
560867: 'wxccb8435d68e8c7d6',
},
}; };
if (EASY_ENV_IS_BROWSER) { if (EASY_ENV_IS_BROWSER) {
......
...@@ -5,7 +5,8 @@ import { isWechat } from '@/service/utils.service'; ...@@ -5,7 +5,8 @@ import { isWechat } from '@/service/utils.service';
import initService from '@/service/init.service'; import initService from '@/service/init.service';
export default class App { export default class App {
config: any; config: any;
constructor(config) {
aysnc; constructor(config) {
this.config = config; this.config = config;
} }
...@@ -16,7 +17,6 @@ export default class App { ...@@ -16,7 +17,6 @@ export default class App {
} }
return this.client(); return this.client();
} }
create(initState) { create(initState) {
const { entry, createStore, createRouter } = this.config; const { entry, createStore, createRouter } = this.config;
// console.log('initState', initState); // console.log('initState', initState);
......
...@@ -6,3 +6,4 @@ interface Window { ...@@ -6,3 +6,4 @@ interface Window {
xyqbNativeEvent: any; xyqbNativeEvent: any;
} }
declare var apollo: any; declare var apollo: any;
declare var tenantId: any;
...@@ -24,7 +24,7 @@ import api from '@/api/editor.api'; ...@@ -24,7 +24,7 @@ import api from '@/api/editor.api';
import cfg from '@/config/index'; import cfg from '@/config/index';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import DisableTouchMixin from '../../../mixins/disableTouch.mixin'; import DisableTouchMixin from '../../../mixins/disableTouch.mixin';
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils'; import { navToDlApp, getParameterByName } from '@qg/citrus-ui/src/helper/service/utils';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus'; import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
const WEAPP_PATH = 'pages/webview/webview'; const WEAPP_PATH = 'pages/webview/webview';
...@@ -48,12 +48,15 @@ export default { ...@@ -48,12 +48,15 @@ export default {
mpSchema: '', mpSchema: '',
link: '', link: '',
shareInfo: {}, shareInfo: {},
showShareOverlay: ((isWechat && !isWxMp) || isH5Normal) && !localStorage.get('vccChannel'), showShareOverlay: ((isWechat && !isWxMp) || isH5Normal) && !(localStorage.get('vccChannel') || (localStorage.get('tenantId') && getParameterByName('fromHost', window.location.href))),
isWechat isWechat
}; };
}, },
computed: { computed: {
...mapGetters(['pageData', 'pageInfo']), ...mapGetters(['pageData', 'pageInfo']),
wxAppId() {
return cfg.appIdMap[this.pageInfo.tenantId] || '';
},
backTopList() { backTopList() {
const btAttachVal = this.pageData.props?.btAttachVal || []; const btAttachVal = this.pageData.props?.btAttachVal || [];
if (isDef(this.cartIndex) && this.cartIndex !== -1 && btAttachVal.length) { if (isDef(this.cartIndex) && this.cartIndex !== -1 && btAttachVal.length) {
...@@ -105,12 +108,13 @@ export default { ...@@ -105,12 +108,13 @@ export default {
methods: { methods: {
async getMpSchema() { async getMpSchema() {
if (isH5Normal && EASY_ENV_IS_BROWSER) { if (isH5Normal && EASY_ENV_IS_BROWSER && this.wxAppId) {
try { try {
console.log(this.pageInfo.tenantId);
const [schema] = await api.getMpSchema({ const [schema] = await api.getMpSchema({
miniUrl: WEAPP_PATH, miniUrl: WEAPP_PATH,
params: `url=${encodeURIComponent(JSON.stringify(this.link))}` params: `url=${encodeURIComponent(JSON.stringify(this.link))}`
}); }, this.wxAppId, this.pageInfo.tenantId);
this.mpSchema = schema; this.mpSchema = schema;
} catch (error) { } catch (error) {
...@@ -124,7 +128,9 @@ export default { ...@@ -124,7 +128,9 @@ export default {
return; return;
} }
if (isH5Normal) { if (isH5Normal) {
window.location.href = this.shareOpenMethod === 1 ? this.mpSchema : this.appSchema; const fromHost = getParameterByName('fromHost', window.location.href);
const loginUrl = `${fromHost}/login?redirectUrl=${window.location.href}`;
window.location.href = fromHost ? loginUrl : this.shareOpenMethod === 1 ? this.mpSchema : this.appSchema;
setTimeout(() => { setTimeout(() => {
this.shareOpenMethod === 2 && navToDlApp(); this.shareOpenMethod === 2 && navToDlApp();
}, 2000); }, 2000);
...@@ -153,14 +159,15 @@ export default { ...@@ -153,14 +159,15 @@ export default {
initShareInfo() { initShareInfo() {
if (EASY_ENV_IS_NODE) return; if (EASY_ENV_IS_NODE) return;
const { coverImage, pageName, pageDescribe, shareCoverImage } = this.pageInfo; const { coverImage, pageName, pageDescribe, shareCoverImage } = this.pageInfo;
const link = `${window.location.origin}${window.location.pathname}?vccToken={token}`; const link = `${window.location.origin}${window.location.pathname}?vccToken={token}&tenantId=${localStorage.get('tenantId') || ''}`;
this.link = link; this.link = link;
const defaultTitle = +localStorage.get('tenantId') === 560671 ? '羊小咩' : '活动页';
this.shareInfo = { this.shareInfo = {
event: "showShareView", event: "showShareView",
data: { data: {
platform: ["weChat", "timeLine"], platform: ["weChat", "timeLine"],
shareDic: { shareDic: {
title: pageName || '羊小咩', title: pageName || defaultTitle,
desc: pageDescribe || '美好生活更从容', desc: pageDescribe || '美好生活更从容',
link, link,
imgUrl: shareCoverImage || coverImage // 图片地址 imgUrl: shareCoverImage || coverImage // 图片地址
...@@ -183,7 +190,7 @@ export default { ...@@ -183,7 +190,7 @@ export default {
this.jsBridge.showShareView(this.shareInfo); this.jsBridge.showShareView(this.shareInfo);
}, },
postMpShareInfo() { postMpShareInfo() {
if (EASY_ENV_IS_NODE) return; if (EASY_ENV_IS_NODE || !this.wxAppId) return;
const wx = require('weixin-js-sdk'); const wx = require('weixin-js-sdk');
const { shareInfo } = this; const { shareInfo } = this;
wx.miniProgram.postMessage({ data: shareInfo }); wx.miniProgram.postMessage({ data: shareInfo });
......
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
export default { export default {
name: 'EmptyState', name: 'EmptyState',
mounted() { mounted() {
const loadingEle = document.querySelector('.mainload'); if (!this.$isServer) {
if (!loadingEle) { return; } const loadingEle = document.querySelector('.mainload');
loadingEle.style.display = 'none'; if (!loadingEle) { return; }
loadingEle.style.display = 'none';
}
} }
} }
</script> </script>
......
...@@ -13,6 +13,8 @@ import DisableTouchMixin from '@/page/mixins/disableTouch.mixin'; ...@@ -13,6 +13,8 @@ import DisableTouchMixin from '@/page/mixins/disableTouch.mixin';
import { setAppTitleColor } from '@/service/color.service'; import { setAppTitleColor } from '@/service/color.service';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus'; import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
import basicConfig from '@/config';
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop, EmptyState }, name: 'Activity'}) @Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop, EmptyState }, name: 'Activity'})
export default class Activity extends Mixins(TransformStyleMixin, SaMixin, DisableTouchMixin) { export default class Activity extends Mixins(TransformStyleMixin, SaMixin, DisableTouchMixin) {
...@@ -20,6 +22,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab ...@@ -20,6 +22,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
@State(state => state.activity.pageInfo.pageName) pageName; @State(state => state.activity.pageInfo.pageName) pageName;
@State(state => state.activity.noPageData) noPageData; @State(state => state.activity.noPageData) noPageData;
@State(state => state.activity.pageInfo.appLoginState) appLoginState; @State(state => state.activity.pageInfo.appLoginState) appLoginState;
@State(state => state.activity.pageInfo.tenantId) tenantId;
@State(state => state.activity.gridLayout.rowHeight) rowHeight; @State(state => state.activity.gridLayout.rowHeight) rowHeight;
@Mutation('SET_PAGE_ELEMENTS') setPageElement; @Mutation('SET_PAGE_ELEMENTS') setPageElement;
@Mutation('UPDATE_APP_LOGIN_STATE') updateAppLoginState; @Mutation('UPDATE_APP_LOGIN_STATE') updateAppLoginState;
...@@ -44,6 +47,13 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab ...@@ -44,6 +47,13 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
} }
return this.pageData && this.pageData.elements.map(v => v.point) || []; return this.pageData && this.pageData.elements.map(v => v.point) || [];
} }
get tenantIdCorrect() {
if (EASY_ENV_IS_NODE) {
return true;
}
// TODO
return +this.tenantId ? (+this.tenantId === +(localStorage.get('tenantId') || 560761)) : true;
}
@Watch('pageData', { deep: true }) @Watch('pageData', { deep: true })
onPageDataChange(val) { onPageDataChange(val) {
......
<template> <template>
<div class="activity" :style="transformStyle(pageData.commonStyle)"> <div class="activity" :style="transformStyle(pageData.commonStyle)">
<template v-if="!noPageData"> <template v-if="!noPageData && tenantIdCorrect">
<div class="layout"> <div class="layout">
<div :style="transformStyle(item.commonStyle, item.point, item.name)" v-for="(item, index) in pageData.elements" <div :style="transformStyle(item.commonStyle, item.point, item.name)" v-for="(item, index) in pageData.elements"
:key="fixGridKey(item)" :key="fixGridKey(item)"
......
...@@ -99,7 +99,7 @@ instance.interceptors.response.use( ...@@ -99,7 +99,7 @@ instance.interceptors.response.use(
!config.hideLoading && afterRequest(); !config.hideLoading && afterRequest();
let message = ''; let message = '';
let showToast = true; let showToast = !config.hideToast;
if (err.message === 'Network Error' && !err.response) { if (err.message === 'Network Error' && !err.response) {
// 网络异常: 错误域名, // 网络异常: 错误域名,
......
...@@ -3,7 +3,7 @@ import { isWechat, isApp, errorQueryValues } from './utils.service'; ...@@ -3,7 +3,7 @@ import { isWechat, isApp, errorQueryValues } from './utils.service';
import Cookies from './cookieStorage.service'; import Cookies from './cookieStorage.service';
import localStorage from './localStorage.service'; import localStorage from './localStorage.service';
// formXcxPage:标识是从小程序跳转过来的; // formXcxPage:标识是从小程序跳转过来的;
const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'sonVccChannel', 'formXcxPage']; const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'sonVccChannel', 'formXcxPage', 'tenantId'];
const cookiesParams = ['h']; const cookiesParams = ['h'];
export default { export default {
......
...@@ -4,11 +4,11 @@ import Storage from '@/service/localStorage.service'; ...@@ -4,11 +4,11 @@ import Storage from '@/service/localStorage.service';
import { getParameterByName, isWxMp, isApp } from '@/service/utils.service'; import { getParameterByName, isWxMp, isApp } from '@/service/utils.service';
export function initSa(router) { export function initSa(router) {
if (process.env.NODE_ENV === 'development') { return; }
const sa = require('sa-sdk-javascript'); const sa = require('sa-sdk-javascript');
const activityId = window.location.pathname.split('/')?.[2] || ''; const activityId = window.location.pathname.split('/')?.[2] || '';
const vccChannel = getParameterByName('vccChannel') || getParameterByName('registerFrom'); const vccChannel = getParameterByName('vccChannel') || getParameterByName('registerFrom');
const sonVccChannel = getParameterByName('sonVccChannel'); const sonVccChannel = getParameterByName('sonVccChannel');
const tenantId = +(getParameterByName('tenantId') || config.yxmTenantId);
sa.init({ sa.init({
server_url: config.shenceUrl, server_url: config.shenceUrl,
heatmap: { heatmap: {
...@@ -28,7 +28,8 @@ export function initSa(router) { ...@@ -28,7 +28,8 @@ export function initSa(router) {
platformType: isWxMp ? 'MP' : isApp ? 'APP' : 'H5', platformType: isWxMp ? 'MP' : isApp ? 'APP' : 'H5',
activity_id: activityId, activity_id: activityId,
parent_channel_id: vccChannel || '', parent_channel_id: vccChannel || '',
channel_id: sonVccChannel || '' channel_id: sonVccChannel || '',
tenantId,
}); });
router.afterEach(() => { router.afterEach(() => {
Vue.nextTick(() => { Vue.nextTick(() => {
......
...@@ -11,7 +11,7 @@ export const chunk = function(array, size) { ...@@ -11,7 +11,7 @@ export const chunk = function(array, size) {
}; };
export const getParameterByName = function(name, url) { export const getParameterByName = function(name, url) {
if (!url) { if (!url && !EASY_ENV_IS_NODE) {
url = window.location.href; url = window.location.href;
} }
name = name.replace(/[\[\]]/g, '\\$&'); name = name.replace(/[\[\]]/g, '\\$&');
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" style="font-size: 37.5px;"> <html lang="en" style="font-size: 37.5px;">
<head> <head>
<title>羊小咩</title> <title>活动页</title>
<meta name="keywords"> <meta name="keywords">
<meta name="description"> <meta name="description">
<meta http-equiv="content-type" content="text/html;charset=utf-8"> <meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover"> <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="data:image/png;base64" type="image/x-icon" />
<link rel="preconnect" href="https://appsync.lkbang.net">
<link rel="dns-prefetch" href="//misc.lkbang.net">
<link rel="dns-prefetch" href="//appsync.lkbang.net">
<link rel="dns-prefetch" href="//img.lkbang.net">
<link rel="dns-prefetch" href="//img10.360buyimg.com">
<link rel="dns-prefetch" href="//img11.360buyimg.com">
<link rel="dns-prefetch" href="//img12.360buyimg.com">
<link rel="dns-prefetch" href="//img13.360buyimg.com">
<link rel="dns-prefetch" href="//img14.360buyimg.com">
<link rel="dns-prefetch" href="//img20.360buyimg.com">
<link rel="dns-prefetch" href="//img30.360buyimg.com">
<link rel="dns-prefetch" href="//kdspstatic.q-gp.com">
<!-- <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>
/* stylelint-disable */ /* stylelint-disable */
......
module.exports = {
extends: ['@commitlint/config-angular'],
};
{ {
"api": { "api": {
"apiHost": "https://quantum-blocks-bfe.liangkebang.net", "apiHost": "https://quantum-blocks-test1.liangkebang.net",
"h5Host": "https://quantum-h5-bfe.liangkebang.net", "h5Host": "https://quantum-h5-test1.liangkebang.net",
"opapiHost": "https://opapi-bfe.liangkebang.net", "opapiHost": "https://opapi-test1.liangkebang.net",
"passportHost": "https://passportapi-bfe.liangkebang.net", "passportHost": "https://passportapi-test1.liangkebang.net",
"kdspHost": "https://talos-bfe.liangkebang.net", "kdspHost": "https://talos-test1.liangkebang.net",
"loginUrl": "", "loginUrl": "",
"mallHost": "https://mall-bfe.liangkebang.net", "h5ShopHost": "https://tenet-test1.liangkebang.net/#",
"h5ShopHost": "https://tenet-bfe.liangkebang.net/#" "yxmTenantId": 560761,
"appIdMap": {
"560761": "wxe16bf9293671506c",
"560867": "wxccb8435d68e8c7d6"
}
}, },
"mysql": { "mysql": {
"low_code": { "low_code": {
"host": "172.17.5.17", "host": "172.17.5.45",
"port": "31548", "port": "32696",
"username": "qa", "username": "qa",
"password": "qatest", "password": "qatest",
"database": "low_code" "database": "low_code"
} }
}, },
"redis": { "redis": {
"port": "172.17.5.14", "host": "172.17.5.48",
"host": "31226", "port": "32625",
"password": "", "password": "",
"db": 0 "db": 0
}, },
......
{ {
"apiHost": "https://quantum-blocks-bfe.liangkebang.net", "apiHost": "https://quantum-blocks-test1.liangkebang.net",
"h5Host": "https://quantum-h5-bfe.liangkebang.net", "h5Host": "https://quantum-h5-test1.liangkebang.net",
"opapiHost": "https://opapi-bfe.liangkebang.net", "opapiHost": "https://opapi-test1.liangkebang.net",
"passportHost": "https://passportapi-bfe.liangkebang.net", "passportHost": "https://passportapi-test1.liangkebang.net",
"kdspHost": "https://talos-bfe.liangkebang.net", "kdspHost": "https://talos-test1.liangkebang.net",
"loginUrl": "", "loginUrl": "",
"mallHost": "https://mall-bfe.liangkebang.net", "h5ShopHost": "https://tenet-test1.liangkebang.net/#",
"h5ShopHost": "https://tenet-bfe.liangkebang.net/#", "yxmTenantId": 560761,
"qiniuUpHost": "https://up-z0.qiniup.com", "appIdMap": {
"qiniuHost": "https://appsync.lkbang.net" "560761": "wxe16bf9293671506c",
} "560867": "wxccb8435d68e8c7d6"
}
}
\ No newline at end of file
...@@ -2,12 +2,12 @@ import { EggAppConfig } from 'egg'; ...@@ -2,12 +2,12 @@ import { EggAppConfig } from 'egg';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import wxVertify from './wxVertify'; import wxVertify from './wxVertify';
const { redis, api, qiniu } = require(path.resolve(__dirname, './apollo.json'));
export default (appInfo: EggAppConfig) => { export default (appInfo: EggAppConfig) => {
const config: any = {}; const config: any = {};
const siteFile = wxVertify; const siteFile = wxVertify;
siteFile['/favicon.ico'] = fs.readFileSync(path.join(appInfo.baseDir, 'app/web/asset/images/favicon.ico'));
config.siteFile = siteFile; config.siteFile = siteFile;
config.view = { config.view = {
...@@ -48,5 +48,11 @@ export default (appInfo: EggAppConfig) => { ...@@ -48,5 +48,11 @@ export default (appInfo: EggAppConfig) => {
enable: false enable: false
} }
}; };
config.redis = {
client: redis
};
config.apollo = {
...api, ...qiniu
};
return config; return config;
}; };
...@@ -27,14 +27,6 @@ export default (appInfo: EggAppConfig) => { ...@@ -27,14 +27,6 @@ export default (appInfo: EggAppConfig) => {
browser: 'http://localhost:7001/' browser: 'http://localhost:7001/'
}; };
exports.redis = {
client: {
port: 31226, // Redis port
host: '172.17.5.14', // Redis host
password: '',
db: 0
}
};
return exports; return exports;
}; };
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* *
* prod + default(override) * prod + default(override)
*/ */
import { Application, EggAppConfig } from 'egg'; import { Application, EggAppConfig } from 'egg';
export default (appInfo: EggAppConfig) => { export default (appInfo: EggAppConfig) => {
...@@ -13,14 +12,5 @@ export default (appInfo: EggAppConfig) => { ...@@ -13,14 +12,5 @@ export default (appInfo: EggAppConfig) => {
dir: '/home/quant_group/logs', dir: '/home/quant_group/logs',
}; };
exports.redis = { return exports;
client: {
port: 6379, // Redis port
host: 'front-redis.quantgroups.com', // Redis host
password: 'ln4^ESq80j4nrTMZ',
db: 0
}
};
return {...exports, apollo: {}};
}; };
import { Application, EggAppConfig } from 'egg'; import { Application, EggAppConfig } from 'egg';
const path = require('path'); const path = require('path');
const { redis, api, qiniu } = require(path.resolve(__dirname, './apollo.json'));
export default (appInfo: EggAppConfig) => { export default (appInfo: EggAppConfig) => {
const exports: any = {}; const exports: any = {};
exports.logger = { exports.logger = {
dir: '/home/quant_group/logs', dir: '/home/quant_group/logs',
}; };
exports.redis = {
client: redis
};
return {...exports, apollo: { ...api, ...qiniu }}; return exports;
}; };
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,13 +4,15 @@ ...@@ -4,13 +4,15 @@
"description": "低代码平台", "description": "低代码平台",
"scripts": { "scripts": {
"start": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C egg-scripts start --port 9050", "start": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C egg-scripts start --port 9050",
"start:pre": "cross-env NODE_ENV=production APOLLO_CLUSTER=3PRE egg-scripts start --port 9050",
"test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit DEBUG=apollo APOLLO_CLUSTER=k8s NAMESPACE=qa2 egg-scripts start --port 80 --workers 1", "test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit DEBUG=apollo APOLLO_CLUSTER=k8s NAMESPACE=qa2 egg-scripts start --port 80 --workers 1",
"stop": "egg-scripts stop", "stop": "egg-scripts stop",
"backend": "nohup egg-scripts start --port 7001 --workers 4", "backend": "nohup egg-scripts start --port 7001 --workers 4",
"dev": "egg-bin dev -r egg-ts-helper/register", "dev": "egg-bin dev -r egg-ts-helper/register",
"debug": "egg-bin debug -r egg-ts-helper/register", "debug": "egg-bin debug -r egg-ts-helper/register",
"apollo": "node bin/apollo.js", "apollo": "node bin/apollo.js",
"build": "npm run apollo && cross-env COS_ENV=production easy build --devtool", "build": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool",
"build:pre": "cross-env NODE_ENV=production APOLLO_CLUSTER=3PRE npm run apollo && cross-env COS_ENV=production easy build --devtool",
"build:test": "cross-env COS_ENV=test easy build --devtool", "build:test": "cross-env COS_ENV=test easy build --devtool",
"tsc": "ets && tsc -p tsconfig.json", "tsc": "ets && tsc -p tsconfig.json",
"clean": "ets clean", "clean": "ets clean",
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
"@better-scroll/core": "^2.0.5", "@better-scroll/core": "^2.0.5",
"@qg/apollo-nodejs": "^2.1.2", "@qg/apollo-nodejs": "^2.1.2",
"@qg/cherry-ui": "2.23.10", "@qg/cherry-ui": "2.23.10",
"@qg/citrus-ui": "0.3.16-bata2", "@qg/citrus-ui": "0.3.22",
"@qg/js-bridge": "^1.1.12", "@qg/js-bridge": "^1.1.12",
"babel-plugin-transform-vue-jsx": "^4.0.1", "babel-plugin-transform-vue-jsx": "^4.0.1",
"cos-nodejs-sdk-v5": "^2.9.12", "cos-nodejs-sdk-v5": "^2.9.12",
...@@ -65,7 +67,11 @@ ...@@ -65,7 +67,11 @@
"tslint-eslint-rules": "^5.4.0", "tslint-eslint-rules": "^5.4.0",
"tslint-loader": "^3.5.3", "tslint-loader": "^3.5.3",
"typescript": "^3.9.2", "typescript": "^3.9.2",
"webpack-sentry-plugin": "^2.0.3" "webpack-sentry-plugin": "^2.0.3",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"@commitlint/cli": "^13.2.1",
"@commitlint/config-angular": "^13.2.0"
}, },
"egg": { "egg": {
"typescript": true "typescript": true
...@@ -87,5 +93,17 @@ ...@@ -87,5 +93,17 @@
"commitizen": { "commitizen": {
"path": "./node_modules/cz-conventional-changelog" "path": "./node_modules/cz-conventional-changelog"
} }
},
"lint-staged": {
"src/**/*.{js,vue}": [
"tslint --fix --project . -c tslint.json 'app/web/**/*{.ts}'",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
} }
} }
#!/bin/sh
source /etc/profile
NODE_ENV=production APOLLO_CLUSTER=3PRE pm2 start bin/server.js --node-args=\"--harmony\" -n quantum-block-h5
#!/bin/sh
source /etc/profile
pm2 start bin/server.js --node-args=\"--harmony\" -n quantum-block-h5
#!/bin/sh
source /etc/profile
pm2 stop quantum-block-h5
pm2 stop quantum-blocks-h5
\ No newline at end of file
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