Commit e9928729 authored by 郭志伟's avatar 郭志伟

Merge branch 'master' into feat/v1.3

# Conflicts:
#	app/web/page/activity/view/activity/index.ts
#	package-lock.json
#	package.json
parents 86faf3e8 301fc277
......@@ -7,6 +7,7 @@ import { release } from '@/.sentryclirc';
import '@/service/qg.service';
import SaDirective from '@qg/citrus-ui/src/helper/directives/saTrack.directive.js';
import config from '@qg/citrus-ui/src/config/index.js';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import { getParameterByName } from '../../../service/utils.service';
import lazyload from '@qg/cherry-ui/src/lazyload/index';
......@@ -39,6 +40,16 @@ if (EASY_ENV_IS_BROWSER) {
Vue.use(lazyload);
const saDirective = new SaDirective();
Vue.directive('track', saDirective.directive);
window.xyqbNativeEvent = function(res) {
const json = typeof res === 'string' ? JSON.parse(res) : res;
console.log('xyqbNativeEvent toggle');
if (json.event === 'loginAndLogoutNotification') {
EventBus.$emit('NATIVE_EVENT_LOGIN', json);
}
if (json.event === 'getTokenSuccess') {
EventBus.$emit('NATIVE_EVENT_GET_TOKEN', json);
}
};
}
@Component({
name: 'Layout'
......
......@@ -3,5 +3,6 @@ declare var EASY_ENV_IS_BROWSER: boolean;
type PlainObject<T = any> = { [key: string]: T };
interface Window {
__INITIAL_STATE__: string | any;
xyqbNativeEvent: any;
}
declare var apollo: any;
......@@ -9,12 +9,17 @@ import TransformStyleMixin from '@/page/mixins/transformStyle.mixin';
import SaMixin from '@/page/mixins/sa.mixin';
import { getStyle, debounce, isApp, isWxMp } from '@/service/utils.service';
import { setAppTitleColor } from '@/service/color.service';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import localStorage from '@/service/localStorage.service';
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop }, 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;
@State(state => state.activity.pageInfo.appLoginState) appLoginState;
@State(state => state.activity.gridLayout.rowHeight) rowHeight;
@Mutation('SET_PAGE_ELEMENTS') setPageElement;
@Mutation('UPDATE_APP_LOGIN_STATE') updateAppLoginState;
@Provide() editor = this;
isEditor: boolean = false;
......@@ -53,6 +58,12 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
if (lastGridItemPoint.w > this.bottomInfo.w) { this.bottomInfo.w = lastGridItemPoint.w; }
this.bottomInfo.y = this.bottomInfo.y + lastGridItemPoint.y + lastGridItemPoint.h;
}
if (isApp) {
// 当页面数据改变,并且渲染完成后改变app 标题栏颜色
this.$nextTick(() => {
debounce(setAppTitleColor(this.pageData.props.titleBgColor), 300);
});
}
}
@Watch('pageName', { immediate: true })
......@@ -77,6 +88,22 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
mounted() {
this.targetEle = document.querySelector('body');
this.showBackTop = true;
this.pageVisibilityChange();
if (EASY_ENV_IS_BROWSER) {
EventBus.$on('NATIVE_EVENT_LOGIN', json => {
console.log('xyqbNativeEvent got', json);
if (json.event === 'loginAndLogoutNotification') {
const appData = json.data || {};
if (appData && appData.login) {
localStorage.set('vccToken', appData.token);
this.updateAppLoginState(true);
} else {
this.updateAppLoginState(false);
localStorage.remove('vccToken');
}
}
});
}
}
fetchApi(options) {
const { store, route } = options;
......@@ -124,6 +151,28 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
this.showBackTop = state;
}
// 计算商品导航组件位置
pageVisibilityChange() {
if (EASY_ENV_IS_NODE) { return; }
let hidden = 'hidden';
let visibilityChange = 'visibilitychange';
if (typeof document.hidden !== 'undefined') {
hidden = 'hidden';
visibilityChange = 'visibilitychange';
} else if (typeof document.webkitHidden !== 'undefined') {
hidden = 'webkitHidden';
visibilityChange = 'webkitvisibilitychange';
}
window.addEventListener(visibilityChange, () => {
this.handleChange(document[hidden]);
}, false);
}
handleChange(state) {
if (!state) {
if (isApp) {
setAppTitleColor(this.pageData.props.titleBgColor);
}
}
}
modfiTabsStyle() {
const tabsEle = document.querySelector('.tabs');
// console.log('tabsEle', tabsEle);
......
import api from '@/api/editor.api';
import { Module, GetterTree, ActionTree, MutationTree } from 'vuex';
import Vue from 'vue';
import { UPDATE_PAGE_INFO, SET_PAGE_INFO, SET_PAGE_DATA, SET_PAGE_ELEMENTS, SET_ELEMENT_POINT} from './type';
import { UPDATE_PAGE_INFO, SET_PAGE_INFO, SET_PAGE_DATA, SET_PAGE_ELEMENTS, SET_ELEMENT_POINT, UPDATE_APP_LOGIN_STATE } from './type';
import RootState from '../../state';
import EditorState, { PageInfo, defaultState, Page, PageElement } from './state';
......@@ -41,6 +41,9 @@ export default class EditorModule implements Module<EditorState, RootState> {
[SET_PAGE_DATA](state, data) {
state.pageInfo.page = data;
},
[UPDATE_APP_LOGIN_STATE](state, data) {
state.pageInfo.appLoginState = data;
},
[SET_PAGE_ELEMENTS](state, data) {
if (data) { (state.pageInfo.page as Page).elements = data; }
},
......
......@@ -47,6 +47,7 @@ export interface PageInfo {
coverImage?: string;
isTemplate?: number;
isPublish?: number | boolean;
appLoginState?: boolean;
}
export const defaultState = {
......
......@@ -13,4 +13,5 @@ export const UPDATE_COMMON_STYLE = 'UPDATE_COMMON_STYLE';
export const UPDATE_PAGE_STYLE = 'UPDATE_PAGE_STYLE';
export const UPDATE_PAGE_PROPS = 'UPDATE_PAGE_PROPS';
export const SET_PAGE_ELEMENTS = 'SET_PAGE_ELEMENTS';
export const SET_ELEMENT_POINT = 'SET_ELEMENT_POINT';
\ No newline at end of file
export const SET_ELEMENT_POINT = 'SET_ELEMENT_POINT';
export const UPDATE_APP_LOGIN_STATE = 'UPDATE_APP_LOGIN_STATE';
\ No newline at end of file
......@@ -4,7 +4,7 @@ import Cookies from './cookieStorage.service';
import localStorage from './localStorage.service';
// formXcxPage:标识是从小程序跳转过来的;
const localStorageParams = ['creditToken', 'vccToken', 'vccChannel', 'sonVccChannel', 'formXcxPage'];
const cookiesParams = ['h', 'vccToken'];
const cookiesParams = ['h'];
export default {
// token校验,整个流程都是登陆后的
......
......@@ -5,6 +5,7 @@ declare var EASY_ENV_IS_NODE: boolean;
interface Window {
__INITIAL_STATE__: any;
xyqbNativeEvent: any;
}
declare module 'axios' {
......
{
"apiHost": "https://quantum-blocks-vcc2.liangkebang.net",
"h5Host": "https://quantum-h5-vcc2.liangkebang.net",
"opapiHost": "https://opapi-vcc2.liangkebang.net",
"passportHost": "https://passportapi-vcc2.liangkebang.net",
"kdspHost": "https://talos-vcc2.liangkebang.net",
"apiHost": "https://quantum-blocks-test1.liangkebang.net",
"h5Host": "https://quantum-h5-test1.liangkebang.net",
"opapiHost": "https://opapi-test1.liangkebang.net",
"passportHost": "https://passportapi-test1.liangkebang.net",
"kdspHost": "https://talos-test1.liangkebang.net",
"loginUrl": "",
"h5ShopHost": "https://tenet-vcc2.liangkebang.net/#",
"h5ShopHost": "https://tenet-test1.liangkebang.net/#",
"qiniuUpHost": "https://up-z0.qiniup.com",
"qiniuHost": "https://appsync.lkbang.net"
}
......@@ -29,8 +29,8 @@ export default (appInfo: EggAppConfig) => {
exports.redis = {
client: {
port: 31565, // Redis port
host: '172.17.5.13', // Redis host
port: 32625, // Redis port
host: '172.17.5.17', // Redis host
password: '',
db: 0
}
......
......@@ -32380,9 +32380,9 @@
}
},
"@qg/citrus-ui": {
"version": "0.2.20",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.20.tgz",
"integrity": "sha512-eKyAqqsUgk34ztLfnL7XyCbariEtkVv30FltCfxm/zx9QhqzFLmB54VR6/F3lOeGQveQcT/NE9hXHsC9K+QjaQ==",
"version": "0.2.26",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.26.tgz",
"integrity": "sha512-34HkijsfhVLkcVE9+xfyc8DiEx/K79/ZQPOSr+dwwY8fZIEjpO812GGG1gu2PNjsoU3vJZqwHbHmBHTmMNxuZA==",
"requires": {
"@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.21.1",
......@@ -32394,22 +32394,12 @@
"swiper": "^4.5.1",
"vuex": "^3.6.0",
"weixin-js-sdk": "^1.6.0"
},
"dependencies": {
"@qg/js-bridge": {
"version": "1.1.11",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fjs-bridge/-/js-bridge-1.1.11.tgz",
"integrity": "sha512-WVvkSUg2zcc2nblzYGxM/bVo+VDcANy/dw7vcbxLoW1Jega9Jm2d5FGSb7uS6m4746waghUUqcAWNJZ0Q5yeqA==",
"requires": {
"rollup": "^2.41.3"
}
}
}
},
"@qg/js-bridge": {
"version": "1.1.7",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fjs-bridge/-/js-bridge-1.1.7.tgz",
"integrity": "sha512-t9ucNc5OFntMxhz5E1UFWZJsIM2CGbmgiyjzoOtpJL1s32s2liPnLXrRfnbryYJEiLNzNyhXQUbA0Z1qZlqq3w=="
"version": "1.1.12",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fjs-bridge/-/js-bridge-1.1.12.tgz",
"integrity": "sha512-KhSbaGMJvGZ7CNrl6nIhD56vAKwDCx6kjwm26UeCBb8KAAb2JjgRe3pIAw/XHjC5WZXjlwfwx6hwrgslQiFyxA=="
},
"@tootallnate/once": {
"version": "1.1.2",
......@@ -51604,22 +51594,6 @@
"resolved": "http://npmprivate.quantgroups.com/rndm/-/rndm-1.2.0.tgz",
"integrity": "sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w="
},
"rollup": {
"version": "2.56.2",
"resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.56.2.tgz",
"integrity": "sha512-s8H00ZsRi29M2/lGdm1u8DJpJ9ML8SUOpVVBd33XNeEeL3NVaTiUcSBHzBdF3eAyR0l7VSpsuoVUGrRHq7aPwQ==",
"requires": {
"fsevents": "~2.3.2"
},
"dependencies": {
"fsevents": {
"version": "2.3.2",
"resolved": "http://npmprivate.quantgroups.com/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"optional": true
}
}
},
"run-async": {
"version": "2.4.1",
"resolved": "http://npmprivate.quantgroups.com/run-async/-/run-async-2.4.1.tgz",
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