Commit 81c086f6 authored by 郭志伟's avatar 郭志伟

fix(backTop): ios双击修复

parent 2384150b
......@@ -2,20 +2,24 @@ import { Controller, Context } from 'egg';
export default class ActivityController extends Controller {
public async home(ctx: Context) {
// 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.renderView('activity.js', { url: ctx.url, apollo });
// await ctx.service.redis.set(redisKey, body);
// }
// ctx.body = body;
// 开发环境不走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}`;
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.renderView('activity.js', { url: ctx.url, apollo });
await ctx.service.redis.set(redisKey, body);
}
ctx.body = body;
}
}
\ No newline at end of file
......@@ -23,11 +23,12 @@ if (process.env.SENTRY_ENV !== 'test' && process.env.NODE_ENV === 'production')
if (EASY_ENV_IS_BROWSER) {
// ! 上线后务必取掉;
const vConsole = require('vconsole');
new vConsole();
// const vConsole = require('vconsole');
// new vConsole();
}
if (EASY_ENV_IS_BROWSER) {
// ios回退刷新,防止缓存
const isSafari = /^.*((iPhone)|(iPad)|(Safari))+.*$/;
const fromHost = getParameterByName('fromHost', window.location.href);
if (isSafari.test(navigator.userAgent) && fromHost?.indexOf('xc.bmall') === -1 && fromHost?.indexOf('tob') === -1) {
......@@ -41,6 +42,7 @@ if (EASY_ENV_IS_BROWSER) {
const saDirective = new SaDirective();
Vue.directive('track', saDirective.directive);
Vue.config.ignoredElements = ['wx-open-launch-weapp', 'wx-open-launch-app'];
// 全局app登录态监听
window.xyqbNativeEvent = function(res) {
const json = typeof res === 'string' ? JSON.parse(res) : res;
console.log('xyqbNativeEvent toggle');
......
<template>
<div>
<cr-back-top :show-back-top="showTop" :list="backTopList" @click="handleBackTopClick" ref="crBackTop" />
<cr-back-top :show-back-top="showTop" :list="backTopList" @click="handleBackTopClick" ref="crBackTop" @touchend.native="disTouch" />
<cr-popover
class="wxmp-tip"
:value="showMpTip"
......@@ -24,6 +24,8 @@ import { mapGetters } from 'vuex';
import { isApp, isWxMp, isWechat, isH5Normal } from '@/service/utils.service';
import api from '@/api/editor.api';
import localStorage from '@/service/localStorage.service';
import DisableTouchMixin from '../../../mixins/disableTouch.mixin';
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils';
import LaunchWeapp from './components/LaunchWeapp.vue';
import LaunchApp from './components/LaunchApp.vue';
const SHARE_CONFIG = {
......@@ -34,6 +36,7 @@ const SHARE_CONFIG = {
};
export default {
name: 'BackTop',
mixins: [DisableTouchMixin],
components: {
LaunchWeapp,
LaunchApp
......@@ -69,7 +72,7 @@ export default {
return [];
},
appSchema() {
return `xyqb://openhttp?jumpurl=${this.link}`;
return `xyqb://openHttp?jumpUrl=${this.link}`;
},
shareOpenMethod() {
return this.pageInfo.shareOpenMethod;
......@@ -79,7 +82,7 @@ export default {
if (!EASY_ENV_IS_NODE) {
this.renderTpl = true;
this.jsBridge = new Bridge();
this.link = `${window.location.origin}${window.location.pathname}?vccToken={token}&vccChannel={registerFrom}`;
this.link = `${window.location.origin}${window.location.pathname}`;
this.getMpSchema();
this.initShareInfo();
}
......@@ -102,6 +105,9 @@ export default {
onShareOverlayClick() {
if (isH5Normal) {
window.location.href = this.shareOpenMethod === 1 ? this.mpSchema : this.appSchema;
setTimeout(() => {
this.shareOpenMethod === 2 && navToDlApp();
}, 2000);
}
},
handleBackTopClick(e) {
......@@ -125,7 +131,7 @@ export default {
platform: ["weChat", "timeLine", "CopyLink"],
shareDic: {
title: pageName || '羊小咩',
desc: pageDescribe || '羊小咩',
desc: pageDescribe || '美好生活更从容',
link,
imgUrl: shareCoverImage || coverImage // 图片地址
}
......
......@@ -7,12 +7,13 @@ import GridLayout from '../../component/VueGridLayout/GridLayout.vue';
import GridItem from '../../component/VueGridLayout/GridItem.vue';
import TransformStyleMixin from '@/page/mixins/transformStyle.mixin';
import SaMixin from '@/page/mixins/sa.mixin';
import { getStyle, debounce, isApp, isWechat, isH5Normal } from '@/service/utils.service';
import DisableTouchMixin from '@/page/mixins/disableTouch.mixin';
import { getStyle, debounce, isApp } from '@/service/utils.service';
import { EventBus } from '@qg/citrus-ui/src/helper/service/eventBus';
import { setAppTitleColor } from '@/service/color.service';
import localStorage from '@/service/localStorage.service';
@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;
@State(state => state.activity.pageInfo.pageName) pageName;
@State(state => state.activity.pageInfo.appLoginState) appLoginState;
......
......@@ -23,6 +23,7 @@
:i="item.point.i"
:key="item.point.i"
@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>
</grid-item>
......
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;
}
}
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