Commit 9def40d4 authored by 郭志伟's avatar 郭志伟

Merge branch 'feat/share' into 'master'

Feat/share

See merge request !39
parents 2c8598a8 02cd79d5
...@@ -2,6 +2,11 @@ import { Controller, Context } from 'egg'; ...@@ -2,6 +2,11 @@ import { Controller, Context } from 'egg';
export default class ActivityController extends Controller { export default class ActivityController extends Controller {
public async home(ctx: Context) { public async home(ctx: Context) {
// 开发环境不走redis缓存
if (process.env.NODE_ENV === 'development') {
ctx.body = await ctx.renderView('activity.js', { url: ctx.url });
return;
}
const redisKey = `quantum-blocks:page:${ctx.params.id}`; const redisKey = `quantum-blocks:page:${ctx.params.id}`;
let body = await ctx.service.redis.get(redisKey); let body = await ctx.service.redis.get(redisKey);
if (body) { if (body) {
...@@ -16,6 +21,5 @@ export default class ActivityController extends Controller { ...@@ -16,6 +21,5 @@ export default class ActivityController extends Controller {
await ctx.service.redis.set(redisKey, body); await ctx.service.redis.set(redisKey, body);
} }
ctx.body = body; ctx.body = body;
// ctx.body = await ctx.renderView('activity.js', { url: ctx.url });
} }
} }
\ No newline at end of file
...@@ -4,5 +4,14 @@ import config from '../config'; ...@@ -4,5 +4,14 @@ 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}`);
},
getMpSchema(params) {
return http.post(`${config.kdspHost}/api/kdsp/ka/info/getShareMiniUrl`, params, { emulateJSON: true });
},
getWxConfig(url = window.location.href.split('#')[0]) {
return http.post(`${config.kdspHost}/api/kdsp/wx/mp/getJsapiSign`, {
url,
appId: 'wx2f44c7fe7b08458d'
});
} }
}; };
\ No newline at end of file
...@@ -21,13 +21,14 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production') ...@@ -21,13 +21,14 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
.install(); .install();
} }
// if (EASY_ENV_IS_BROWSER && process.env.SENTRY_ENV === 'test' || process.env.NODE_ENV !== 'production') { if (EASY_ENV_IS_BROWSER) {
// // ! 上线后务必取掉; // ! 上线后务必取掉;
// const vConsole = require('vconsole'); // const vConsole = require('vconsole');
// new vConsole(); // new vConsole();
// } }
if (EASY_ENV_IS_BROWSER) { if (EASY_ENV_IS_BROWSER) {
// ios回退刷新,防止缓存
const isSafari = /^.*((iPhone)|(iPad)|(Safari))+.*$/; const isSafari = /^.*((iPhone)|(iPad)|(Safari))+.*$/;
const fromHost = getParameterByName('fromHost', window.location.href); const fromHost = getParameterByName('fromHost', window.location.href);
if (isSafari.test(navigator.userAgent) && fromHost?.indexOf('xc.bmall') === -1 && fromHost?.indexOf('tob') === -1) { if (isSafari.test(navigator.userAgent) && fromHost?.indexOf('xc.bmall') === -1 && fromHost?.indexOf('tob') === -1) {
...@@ -40,6 +41,8 @@ if (EASY_ENV_IS_BROWSER) { ...@@ -40,6 +41,8 @@ if (EASY_ENV_IS_BROWSER) {
Vue.use(lazyload); Vue.use(lazyload);
const saDirective = new SaDirective(); const saDirective = new SaDirective();
Vue.directive('track', saDirective.directive); Vue.directive('track', saDirective.directive);
Vue.config.ignoredElements = ['wx-open-launch-weapp', 'wx-open-launch-app'];
// 全局app登录态监听
window.xyqbNativeEvent = function(res) { window.xyqbNativeEvent = function(res) {
const json = typeof res === 'string' ? JSON.parse(res) : res; const json = typeof res === 'string' ? JSON.parse(res) : res;
console.log('xyqbNativeEvent toggle'); console.log('xyqbNativeEvent toggle');
......
...@@ -3,7 +3,9 @@ const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https'; ...@@ -3,7 +3,9 @@ const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
const hostMap = { const hostMap = {
apiHost: `${protocol}//quantum-blocks-vcc2.liangkebang.net`, apiHost: `${protocol}//quantum-blocks-vcc2.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`,
test: true test: true
}; };
......
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.q-gp.com`, apiHost: `https://quantum-blocks.q-gp.com`,
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=production`, kdspHost: `https://talos.q-gp.com`,
// opapiHost: `${protocol}//opapi.q-gp.com`, shenceUrl: `https://bn.xyqb.com/sa?project=production`,
mallHost: `https://mall.q-gp.com`,
test: false test: false
}; };
...@@ -3,7 +3,9 @@ const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https'; ...@@ -3,7 +3,9 @@ const protocol = EASY_ENV_IS_BROWSER ? window.location.protocol : 'https';
const hostMap = { const hostMap = {
apiHost: `${protocol}//quantum-blocks-vcc2.liangkebang.net`, apiHost: `${protocol}//quantum-blocks-vcc2.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`,
test: true test: true
}; };
......
import Vue from 'vue'; import Vue from 'vue';
import { sync } from 'vuex-router-sync'; import { sync } from 'vuex-router-sync';
import api from '@/api/editor.api';
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;
...@@ -25,6 +27,7 @@ export default class App { ...@@ -25,6 +27,7 @@ export default class App {
const { initSa } = require('@/service/sa.service'); const { initSa } = require('@/service/sa.service');
initService.init(router); initService.init(router);
initSa(router); initSa(router);
this.setWxConfig();
} }
return { return {
router, router,
...@@ -35,6 +38,18 @@ export default class App { ...@@ -35,6 +38,18 @@ export default class App {
}; };
} }
async setWxConfig() {
if (!isWechat) { return; }
const wx = require('weixin-js-sdk');
const [res] = await api.getWxConfig();
wx.config({
debug: false,
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'], // 必填,需要使用的JS接口列表
openTagList: ['wx-open-launch-weapp', 'wx-open-launch-app'],
...res
});
}
fetch(vm): Promise<any> { fetch(vm): Promise<any> {
const { store, router } = vm; const { store, router } = vm;
const matchedComponents = router.getMatchedComponents(); const matchedComponents = router.getMatchedComponents();
......
<template>
<wx-open-launch-app
class="launch-btn"
@launch="launch"
@error="launchError"
id="launch-btn"
appid="wx75d5a207551d0b4d"
:extinfo="extinfo"
>
<script type="text/wxtag-template">
<style>.btn {height: 100vh;width: 100vw;}</style>
<div class="btn">打开APP</div>
</script>
</wx-open-launch-app>
</template>
<script>
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils';
export default {
name: "LaunchApp",
props: {
jumpUrl: String,
appSchema: String
},
computed: {
extinfo() {
return JSON.stringify({
url: this.jumpUrl,
data: {}
});
}
},
methods: {
launch() {
setTimeout(() => {
navToDlApp();
}, 2500);
window.location.href = this.appSchema;
},
launchError(e) {
if (e.detail.errMsg === "launch:fail") {
navToDlApp();
}
},
}
};
</script>
<style lang="less">
.launch-btn {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
opacity: 0;
z-index: 100;
left: 0;
}
</style>
<template>
<wx-open-launch-weapp
class="launch-btn"
username="gh_a976018bfb9e"
:path="jumpUrl"
@launch="launch"
@error="launchError"
>
<script type="text/wxtag-template">
<style>.btn {height: 100vh;width: 100vw;}</style>
<div class="btn">打开小程序</div>
</script>
</wx-open-launch-weapp>
</template>
<script>
export default {
name: "LaunchWeapp",
props: {
jumpUrl: String
},
data() {
return {};
},
methods: {
launch() {
console.log("launch");
},
launchError() {
console.log("launchError");
}
}
};
</script>
<style lang="less">
.launch-btn {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
opacity: 0;
z-index: 100;
left: 0;
}
</style>
<template>
<div>
<cr-back-top :show-back-top="showTop" :list="backTopList" @click="handleBackTopClick" ref="crBackTop" @touchend.native="disTouch" />
<cr-popover
class="wxmp-tip"
:value="showMpTip"
placement="bottom-end"
>
<div class="wxmp-tip__content" ref="content">
点击“<cr-icon type="weapp-nav" />”分享当前页面
</div>
<template #reference>提示</template>
</cr-popover>
<div v-if="showShareOverlay" class="share-overlay" @click.self="onShareOverlayClick" />
</div>
</template>
<script>
import Bridge from '@qg/js-bridge';
import { mapGetters } from 'vuex';
import { isApp, isWxMp, isWechat, isH5Normal } from '@/service/utils.service';
import api from '@/api/editor.api';
import cfg from '@/config/index';
import localStorage from '@/service/localStorage.service';
import DisableTouchMixin from '../../../mixins/disableTouch.mixin';
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils';
const SHARE_CONFIG = {
name: 'share',
txt: '',
icon: 'share',
url: '',
};
const WEAPP_PATH = 'pages/webview/webview';
const APP_PATH = 'xyqb://openHttp';
export default {
name: 'BackTop',
mixins: [DisableTouchMixin],
props: {
showBackTop: Boolean
},
data() {
return {
renderTpl: false,
showMpTip: false,
tipTimer: null,
jsBridge: null,
wx: null,
mpSchema: '',
link: '',
shareInfo: {},
showShareOverlay: ((isWechat && !isWxMp) || isH5Normal) && !localStorage.get('vccChannel'),
isWechat
};
},
computed: {
...mapGetters(['pageData', 'pageInfo']),
showTop() {
return this.showBackTop && this.pageData.props && this.pageData.props.showBackTop;
},
backTopList() {
if (this.pageData.props && this.pageData.props.btAttachVal) {
const { btAttachVal, showShare } = this.pageData.props;
const btAttachValDeep = JSON.parse(JSON.stringify(btAttachVal));
showShare && (isApp || isWxMp) && btAttachValDeep.push(SHARE_CONFIG);
return btAttachValDeep;
}
return [];
},
appSchema() {
return `${APP_PATH}?jumpUrl=${this.link}`;
},
shareOpenMethod() {
return this.pageInfo.shareOpenMethod;
}
},
created() {
if (!EASY_ENV_IS_NODE) {
this.renderTpl = true;
this.jsBridge = new Bridge();
this.initShareInfo();
this.getMpSchema();
}
},
methods: {
async getMpSchema() {
if (isH5Normal && EASY_ENV_IS_BROWSER) {
try {
const [schema] = await api.getMpSchema({
miniUrl: WEAPP_PATH,
params: `url=${encodeURIComponent(JSON.stringify(this.link))}`
});
this.mpSchema = schema;
} catch (error) {
}
}
},
onShareOverlayClick() {
if (isH5Normal) {
window.location.href = this.shareOpenMethod === 1 ? this.mpSchema : this.appSchema;
setTimeout(() => {
this.shareOpenMethod === 2 && navToDlApp();
}, 2000);
} else if (isWechat && !isWxMp) {
const { shareOpenMethod, link: url } = this;
const jumpUrl = shareOpenMethod === 1 ? WEAPP_PATH : APP_PATH;
window.location.href = `${cfg.mallHost}/common/launch?jumpUrl=${jumpUrl}&terminal=${shareOpenMethod}&extraInfo=${encodeURIComponent(JSON.stringify({ url }))}`;
}
},
handleBackTopClick(e) {
// ! 此处以1.3为准,但需要对齐分享功能
if (e && e.name === 'share') {
if (this.tipTimer) {
clearTimeout(this.tipTimer);
}
this.tipTimer = setTimeout(() => {
this.share();
}, 600);
}
},
initShareInfo() {
if (EASY_ENV_IS_NODE) return;
const { coverImage, pageName, pageDescribe, shareCoverImage } = this.pageInfo;
const link = `${window.location.origin}${window.location.pathname}`;
this.link = link;
this.shareInfo = {
event: "showShareView",
data: {
platform: ["weChat", "timeLine"],
shareDic: {
title: pageName || '羊小咩',
desc: pageDescribe || '美好生活更从容',
link,
imgUrl: shareCoverImage || coverImage // 图片地址
}
}
};
if (isWxMp) {
this.postMpShareInfo();
}
},
share() {
if (EASY_ENV_IS_NODE) return;
if (isApp) {
this.appShare();
} else if (isWxMp) {
this.mpShare();
}
},
appShare() {
this.jsBridge.showShareView(this.shareInfo);
},
postMpShareInfo() {
if (EASY_ENV_IS_NODE) return;
const wx = require('weixin-js-sdk');
const { shareInfo } = this;
wx.miniProgram.postMessage({ data: shareInfo });
},
mpShare() {
this.showMpTip = true;
setTimeout(() => {
this.showMpTip = false;
}, 10000);
}
},
}
</script>
<style lang="less" scoped>
@deep: ~'>>>';
.wxmp-tip {
position: fixed !important;
top: -32px;
right: 60px;
z-index: 99;
@{deep} .cr-popover {
background-color: #fff;
color: #333;
box-shadow: 0 2px 12px 0 rgba(100, 101, 102, 28%);
&__reference {
font-size: 0;
}
&__angle::before {
border-color: transparent transparent rgb(255 255 255);
}
}
&__content {
width: 160px;
.cr-icon--weapp-nav {
vertical-align: sub;
margin: 0 5px;
}
}
}
.share-overlay {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 8;
}
</style>
\ No newline at end of file
...@@ -12,6 +12,7 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi ...@@ -12,6 +12,7 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi
@Prop({type: Object, default: () => ({ child: [] })}) childItem; @Prop({type: Object, default: () => ({ child: [] })}) childItem;
@Prop({type: Object, default: () => ({})}) saInfo; @Prop({type: Object, default: () => ({})}) saInfo;
@Prop(String) link;
@Prop(String) backgroundImage; @Prop(String) backgroundImage;
mounted() { mounted() {
...@@ -24,4 +25,5 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi ...@@ -24,4 +25,5 @@ export default class FreedomContainer extends Mixins(TransformStyleMixin, SaMixi
// }); // });
// } // }
} }
}
\ No newline at end of file }
<template> <template>
<div class="freedom" v-track> <div class="freedom" v-track="{ link }">
<div class="freedom-body"> <div class="freedom-body">
<component :class="['freedom-body-item', { 'Fb-item_selected': curChildIndex === index }]" v-for="(item, index) in childItem.child" :style="transformStyle(item.commonStyle, 'container')" :is="item.name" :key="index" :sa-info="getSaInfo(item)" v-bind="item.props"></component> <component :class="['freedom-body-item', { 'Fb-item_selected': curChildIndex === index }]" v-for="(item, index) in childItem.child" :style="transformStyle(item.commonStyle, 'container')" :is="item.name" :key="index" :sa-info="getSaInfo(item)" v-bind="item.props"></component>
</div> </div>
...@@ -31,4 +31,4 @@ ...@@ -31,4 +31,4 @@
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -2,16 +2,18 @@ import { Vue, Component, Watch, Provide, Mixins } from 'vue-property-decorator'; ...@@ -2,16 +2,18 @@ import { Vue, Component, Watch, Provide, Mixins } from 'vue-property-decorator';
import { Getter, State, Mutation } from 'vuex-class'; import { Getter, State, Mutation } from 'vuex-class';
import FreedomContainer from '../../component/FreedomContainer/index.vue'; import FreedomContainer from '../../component/FreedomContainer/index.vue';
import PageBottomTip from '../../component/PageBottomTip/index.vue'; import PageBottomTip from '../../component/PageBottomTip/index.vue';
import BackTop from '../../component/BackTop/index.vue';
import GridLayout from '../../component/VueGridLayout/GridLayout.vue'; import GridLayout from '../../component/VueGridLayout/GridLayout.vue';
import GridItem from '../../component/VueGridLayout/GridItem.vue'; import GridItem from '../../component/VueGridLayout/GridItem.vue';
import TransformStyleMixin from '@/page/mixins/transformStyle.mixin'; import TransformStyleMixin from '@/page/mixins/transformStyle.mixin';
import SaMixin from '@/page/mixins/sa.mixin'; import SaMixin from '@/page/mixins/sa.mixin';
import DisableTouchMixin from '@/page/mixins/disableTouch.mixin';
import { getStyle, debounce, isApp } from '@/service/utils.service'; import { getStyle, debounce, isApp } from '@/service/utils.service';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus'; import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import { setAppTitleColor } from '@/service/color.service'; import { setAppTitleColor } from '@/service/color.service';
import localStorage from '@/service/localStorage.service'; import localStorage from '@/service/localStorage.service';
@Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip }, name: 'Activity'}) @Component({ components: { FreedomContainer, GridLayout, GridItem, PageBottomTip, BackTop }, name: 'Activity'})
export default class Activity extends Mixins(TransformStyleMixin, SaMixin) { export default class Activity extends Mixins(TransformStyleMixin, SaMixin, DisableTouchMixin) {
@Getter('pageData') pageData; @Getter('pageData') pageData;
@State(state => state.activity.pageInfo.pageName) pageName; @State(state => state.activity.pageInfo.pageName) pageName;
@State(state => state.activity.pageInfo.appLoginState) appLoginState; @State(state => state.activity.pageInfo.appLoginState) appLoginState;
...@@ -30,19 +32,13 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) { ...@@ -30,19 +32,13 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
}; };
isLayoutComReady = false; isLayoutComReady = false;
showBackTop = false; showBackTop = false;
targetEle: HTMLElement | null = null; targetEle: HTMLElement | null = null;
loading: boolean = true; loading: boolean = true;
modfiTabsStyleDebounce = debounce(this.modfiTabsStyle, 300); modfiTabsStyleDebounce = debounce(this.modfiTabsStyle, 300);
get layout() { get layout() {
return this.pageData && this.pageData.elements.map(v => v.point) || []; return this.pageData && this.pageData.elements.map(v => v.point) || [];
} }
get backTopList() {
return isApp && this.pageData && this.pageData.props.btAttachVal ? this.pageData.props.btAttachVal : [];
}
@Watch('pageData', { deep: true }) @Watch('pageData', { deep: true })
onPageDataChange(val) { onPageDataChange(val) {
const lastGridItem = val.elements[val.elements.length - 1]; const lastGridItem = val.elements[val.elements.length - 1];
...@@ -87,7 +83,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) { ...@@ -87,7 +83,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
mounted() { mounted() {
this.targetEle = document.querySelector('body'); this.targetEle = document.querySelector('body');
this.showBackTop = true; if (EASY_ENV_IS_BROWSER) { this.showBackTop = true; }
this.pageVisibilityChange(); this.pageVisibilityChange();
if (EASY_ENV_IS_BROWSER) { if (EASY_ENV_IS_BROWSER) {
EventBus.$on('NATIVE_EVENT_LOGIN', json => { EventBus.$on('NATIVE_EVENT_LOGIN', json => {
...@@ -127,7 +123,6 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) { ...@@ -127,7 +123,6 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin) {
dot(title) { dot(title) {
console.log(title, '点击了'); console.log(title, '点击了');
} }
layoutReadyEvent(newLayout) { layoutReadyEvent(newLayout) {
this.$nextTick(() => { this.$nextTick(() => {
console.log('layoutReadyEvent'); console.log('layoutReadyEvent');
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
:h="item.point.h" :h="item.point.h"
:i="item.point.i" :i="item.point.i"
:key="item.point.i" :key="item.point.i"
@click.native="dot(item.title)" @click.native="dot(item.title)"
@touchend.native="disTouch"
> >
<component :data-index="index" :id="item.id" :containerIndex="index" :childItem="item" :is="item.name" :key="item.id" :sa-info="getSaInfo(item)" v-bind="item.props"></component> <component :data-index="index" :id="item.id" :containerIndex="index" :childItem="item" :is="item.name" :key="item.id" :sa-info="getSaInfo(item)" v-bind="item.props"></component>
</grid-item> </grid-item>
...@@ -39,11 +40,12 @@ ...@@ -39,11 +40,12 @@
<page-bottom-tip /> <page-bottom-tip />
</grid-item> </grid-item>
</grid-layout> </grid-layout>
<cr-back-top v-if="showBackTop && pageData.props.showBackTop" :list="backTopList" /> <back-top v-if="showBackTop" :show-back-top="showBackTop" ref="backTop" />
</div> </div>
</template> </template>
<script lang="ts" src="./index.ts"></script> <script lang="ts" src="./index.ts"></script>
<style lang="less" scoped> <style lang="less" scoped>
@deep: ~'>>>';
.activity { .activity {
width: 100%; width: 100%;
min-height: 100%; min-height: 100%;
...@@ -77,4 +79,29 @@ ...@@ -77,4 +79,29 @@
overflow: visible !important; overflow: visible !important;
transform: none !important; transform: none !important;
} }
.wxmp-tip {
position: fixed !important;
top: -32px;
right: 10%;
z-index: 99;
@{deep} .cr-popover {
background-color: #fff;
color: #333;
box-shadow: 0 2px 12px 0 rgba(100, 101, 102, 28%);
&__reference {
font-size: 0;
}
&__angle::before {
border-color: transparent transparent rgb(255 255 255);
}
}
&__content {
width: 160px;
.cr-icon--weapp-nav {
vertical-align: sub;
margin: 0 5px;
}
}
}
</style> </style>
import { Component, Vue } from 'vue-property-decorator';
let lastTouchEnd = 0;
@Component({ name: 'DisableTouchMixin' })
export default class DisableTouchMixin extends Vue {
disTouch(e) {
const now = (new Date()).getTime();
if (now - lastTouchEnd <= 300) {
e.preventDefault();
return false;
}
lastTouchEnd = now;
}
}
...@@ -45,6 +45,8 @@ export interface PageInfo { ...@@ -45,6 +45,8 @@ export interface PageInfo {
enable?: number; enable?: number;
author?: string; author?: string;
coverImage?: string; coverImage?: string;
shareCoverImage?: string; // 分享缩略图
shareOpenMethod?: string; // 分享后的打开方式
isTemplate?: number; isTemplate?: number;
isPublish?: number | boolean; isPublish?: number | boolean;
appLoginState?: boolean; appLoginState?: boolean;
......
...@@ -42,9 +42,13 @@ import citrusUi from '@qg/citrus-ui'; ...@@ -42,9 +42,13 @@ import citrusUi from '@qg/citrus-ui';
import Loading from '@qg/cherry-ui/src/loading'; import Loading from '@qg/cherry-ui/src/loading';
import Text from '@qg/cherry-ui/src/text'; import Text from '@qg/cherry-ui/src/text';
import Tag from '@qg/cherry-ui/src/tag'; import Tag from '@qg/cherry-ui/src/tag';
import Popover from '@qg/cherry-ui/src/popover';
import Icon from '@qg/cherry-ui/src/icon';
Vue.use(Button); Vue.use(Button);
Vue.use(Image); Vue.use(Image);
Vue.use(Popover);
Vue.use(Icon);
// Vue.use(Cell); // Vue.use(Cell);
// Vue.use(CellGroup); // Vue.use(CellGroup);
// Vue.use(Row); // Vue.use(Row);
......
import Vue from 'vue'; import Vue from 'vue';
import sa from 'sa-sdk-javascript';
import config from '@/config'; import config from '@/config';
import Storage from '@/service/localStorage.service'; import Storage from '@/service/localStorage.service';
import { getParameterByName, isWxMp, isApp } from '@/service/utils.service'; import { getParameterByName, isWxMp, isApp } from '@/service/utils.service';
...@@ -9,6 +8,7 @@ export function initSa(router) { ...@@ -9,6 +8,7 @@ export function initSa(router) {
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 sa = require('sa-sdk-javascript');
sa.init({ sa.init({
server_url: config.shenceUrl, server_url: config.shenceUrl,
heatmap: { heatmap: {
...@@ -38,11 +38,13 @@ export function initSa(router) { ...@@ -38,11 +38,13 @@ export function initSa(router) {
} }
export function registeredEvents(eventName, eventData) { export function registeredEvents(eventName, eventData) {
const sa = require('sa-sdk-javascript');
sa.track(eventName, eventData); sa.track(eventName, eventData);
} }
// 用户登录神策埋点 // 用户登录神策埋点
export function loginSa(uuid = Storage.get('uuid')) { export function loginSa(uuid = Storage.get('uuid')) {
if (!uuid) { return; } if (!uuid) { return; }
Storage.set('uuid', uuid); Storage.set('uuid', uuid);
const sa = require('sa-sdk-javascript');
sa.login(uuid); sa.login(uuid);
} }
...@@ -139,6 +139,9 @@ export const isIOS = /iphone|ipad|ipod/.test(ua); ...@@ -139,6 +139,9 @@ export const isIOS = /iphone|ipad|ipod/.test(ua);
// 判读Android环境 // 判读Android环境
export const isAndroid = /android/.test(ua); export const isAndroid = /android/.test(ua);
// 判读非微信浏览器和appwebview和小程序webview
export const isH5Normal = !isWechat && !isWxMp && !isApp;
// 异常字段 // 异常字段
export const errorQueryValues = ['{token}', '{vccToken}', '{registerFrom}', '{vccChannel}', '{sonVccChannel}', '{h}', '{uuid}', '{}']; export const errorQueryValues = ['{token}', '{vccToken}', '{registerFrom}', '{vccChannel}', '{sonVccChannel}', '{h}', '{uuid}', '{}'];
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"passportHost": "https://passportapi-test1.liangkebang.net", "passportHost": "https://passportapi-test1.liangkebang.net",
"kdspHost": "https://talos-test1.liangkebang.net", "kdspHost": "https://talos-test1.liangkebang.net",
"loginUrl": "", "loginUrl": "",
"mallHost": "https://mall-test1.liangkebang.net",
"h5ShopHost": "https://tenet-test1.liangkebang.net/#" "h5ShopHost": "https://tenet-test1.liangkebang.net/#"
}, },
"mysql": { "mysql": {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"passportHost": "https://passportapi-test1.liangkebang.net", "passportHost": "https://passportapi-test1.liangkebang.net",
"kdspHost": "https://talos-test1.liangkebang.net", "kdspHost": "https://talos-test1.liangkebang.net",
"loginUrl": "", "loginUrl": "",
"mallHost": "https://mall-test1.liangkebang.net",
"h5ShopHost": "https://tenet-test1.liangkebang.net/#", "h5ShopHost": "https://tenet-test1.liangkebang.net/#",
"qiniuUpHost": "https://up-z0.qiniup.com", "qiniuUpHost": "https://up-z0.qiniup.com",
"qiniuHost": "https://appsync.lkbang.net" "qiniuHost": "https://appsync.lkbang.net"
......
...@@ -1638,9 +1638,9 @@ ...@@ -1638,9 +1638,9 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
}, },
"@popperjs/core": { "@popperjs/core": {
"version": "2.9.2", "version": "2.10.1",
"resolved": "http://npmprivate.quantgroups.com/@popperjs%2fcore/-/core-2.9.2.tgz", "resolved": "http://npmprivate.quantgroups.com/@popperjs%2fcore/-/core-2.10.1.tgz",
"integrity": "sha512-VZMYa7+fXHdwIq1TDhSXoVmSPEGM/aa+6Aiq3nVVJ9bXr24zScr+NlKFKC3iPljA7ho/GAZr+d2jOf5GIRC30Q==" "integrity": "sha1-co7NlasgequKmk5CHwQi2zKSMr4="
}, },
"@qg/apollo-nodejs": { "@qg/apollo-nodejs": {
"version": "2.1.2", "version": "2.1.2",
...@@ -1648,9 +1648,9 @@ ...@@ -1648,9 +1648,9 @@
"integrity": "sha512-uOCUKu5mvX3PWee+7ZFXQSNIR1V5SN2JVE2yANmW9/wQOgpEct291gXGok8VMw0009HlTWB4JATURPwyOP2DFg==" "integrity": "sha512-uOCUKu5mvX3PWee+7ZFXQSNIR1V5SN2JVE2yANmW9/wQOgpEct291gXGok8VMw0009HlTWB4JATURPwyOP2DFg=="
}, },
"@qg/cherry-ui": { "@qg/cherry-ui": {
"version": "2.21.1", "version": "2.23.7",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.21.1.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-2.23.7.tgz",
"integrity": "sha512-OQ9njfH6cs6FaNqPb7W+hEe/yftpdLXyjGXo2g4IwY7o/9Z5EH6Bn6B5X6dFGOka7LSyXyWRSfZzX0upIIpDFw==", "integrity": "sha512-ZQ5valaspUkQfyUzoj7nzGqGW287NkK5WH7BB1q5LIb3kAaL/1YSF5J1j8Azn8aqtHq/xNqYMFIfb8YBsq00nw==",
"requires": { "requires": {
"@popperjs/core": "^2.5.4", "@popperjs/core": "^2.5.4",
"vue-lazyload": "^1.3.3", "vue-lazyload": "^1.3.3",
...@@ -1658,12 +1658,12 @@ ...@@ -1658,12 +1658,12 @@
} }
}, },
"@qg/citrus-ui": { "@qg/citrus-ui": {
"version": "0.2.27", "version": "0.2.29",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.27.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.2.29.tgz",
"integrity": "sha512-RQWArNw0AVF/am50n0heECgqtFxeeG2wvYzwZSmWf0zRwOpqyad32lnFp32pgUgVZfLkNuOVW7klJzbKYMFPKA==", "integrity": "sha512-inMPAWHzFvNZSCqotDVlKnONmeYps98yGRck5V3cV/1dAiScBhWovyvxXGAnfCk0dfmjcm/5Tpw4pmjt04Xjnw==",
"requires": { "requires": {
"@better-scroll/core": "^2.1.1", "@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.21.1", "@qg/cherry-ui": "^2.23.7",
"@qg/js-bridge": "^1.1.11", "@qg/js-bridge": "^1.1.11",
"axios": "^0.21.1", "axios": "^0.21.1",
"intersection-observer": "^0.12.0", "intersection-observer": "^0.12.0",
...@@ -8362,9 +8362,9 @@ ...@@ -8362,9 +8362,9 @@
} }
}, },
"es5-shim": { "es5-shim": {
"version": "4.5.15", "version": "4.6.2",
"resolved": "http://npmprivate.quantgroups.com/es5-shim/-/es5-shim-4.5.15.tgz", "resolved": "http://npmprivate.quantgroups.com/es5-shim/-/es5-shim-4.6.2.tgz",
"integrity": "sha512-FYpuxEjMeDvU4rulKqFdukQyZSTpzhg4ScQHrAosrlVpR6GFyaw14f74yn2+4BugniIS0Frpg7TvwZocU4ZMTw==" "integrity": "sha1-gnzdDG+1vrJv02jWVDDoterrqUI="
}, },
"es6-iterator": { "es6-iterator": {
"version": "2.0.3", "version": "2.0.3",
...@@ -18814,9 +18814,9 @@ ...@@ -18814,9 +18814,9 @@
} }
}, },
"parse-headers": { "parse-headers": {
"version": "2.0.3", "version": "2.0.4",
"resolved": "http://npmprivate.quantgroups.com/parse-headers/-/parse-headers-2.0.3.tgz", "resolved": "http://npmprivate.quantgroups.com/parse-headers/-/parse-headers-2.0.4.tgz",
"integrity": "sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA==" "integrity": "sha512-psZ9iZoCNFLrgRjZ1d8mn0h9WRqJwFxM9q3x7iUjN/YT2OksthDJ5TiPCu2F38kS4zutqfW+YdVVkBZZx3/1aw=="
}, },
"parse-json": { "parse-json": {
"version": "4.0.0", "version": "4.0.0",
...@@ -20930,9 +20930,9 @@ ...@@ -20930,9 +20930,9 @@
} }
}, },
"sa-sdk-javascript": { "sa-sdk-javascript": {
"version": "1.18.17", "version": "1.18.19",
"resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.18.17.tgz", "resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.18.19.tgz",
"integrity": "sha1-mLW7PyfL2jmwcCTb3G/Bes6H0n8=" "integrity": "sha1-AkfLYb/Vu4Y6+s4JtNIAKPDl8U0="
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
...@@ -23440,9 +23440,9 @@ ...@@ -23440,9 +23440,9 @@
} }
}, },
"url-toolkit": { "url-toolkit": {
"version": "2.2.2", "version": "2.2.3",
"resolved": "http://npmprivate.quantgroups.com/url-toolkit/-/url-toolkit-2.2.2.tgz", "resolved": "http://npmprivate.quantgroups.com/url-toolkit/-/url-toolkit-2.2.3.tgz",
"integrity": "sha512-l25w6Sy+Iy3/IbogunxhWwljPaDnqpiKvrQRoLBm6DfISco7NyRIS7Zf6+Oxhy1T8kHxWdwLND7ZZba6NjXMug==" "integrity": "sha512-Da75SQoxsZ+2wXS56CZBrj2nukQ4nlGUZUP/dqUBG5E1su5GKThgT94Q00x81eVII7AyS1Pn+CtTTZ4Z0pLUtQ=="
}, },
"urllib": { "urllib": {
"version": "2.37.1", "version": "2.37.1",
......
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