Authored by 杨延青

Merge branch 'feature/0430' into 'release/6.9.2'

fix immersed head



See merge request !71
<template>
<div class="article-item-slide-wrap">
<div class="article-item-slide" :style="slideItemStyle" @touchend="praiseArticle">
<ArticleItemSlideImage v-if="data.blockList.length === 1" :lazy="false" :data="data.blockList[0]" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
<ArticleItemSlideImage v-if="data.blockList.length === 1" :lazy="false" :data="data.blockList[0]" :thumb-size="firstBlockSize" :share="share"></ArticleItemSlideImage>
<Slide :key="`slide${data.articleId}`" v-else ref="slide" :data="data.blockList" :refresh-reset-current="false" :initial-index="slideIndex - 1" :threshold="0.2" :auto-play="false" :loop="false" :options="scrollOption" @change="onChange">
<SlideItem class="slide-item" :style="slideItemStyle" v-for="(item, inx) in data.blockList" :key="inx">
<ArticleItemSlideImage v-if="!thumb || inx === 0" :lazy="lazy || inx > 0" :data="item" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
<ArticleItemSlideImage v-if="!thumb || inx === 0" :lazy="lazy || inx > 0" :data="item" :thumb-size="firstBlockSize" :share="share"></ArticleItemSlideImage>
</SlideItem>
</Slide>
<div class="pages" v-if="data.blockList.length > 1">
... ...
... ... @@ -105,7 +105,11 @@ export default function(state = {}) {
}
},
actions: {
async fetchUserProfile({commit}) {
async fetchUserProfile({commit, state}) {
if (!state.context.isLogin) {
return {};
}
const result = await this.$api.get('/api/grass/userProfile');
if (result && result.code === 200) {
... ...
... ... @@ -53,31 +53,6 @@ const asyncLoadScripts = (renderScripts) => {
return scripts;
};
const versionToNumber = (str, len = 3) => {
let verNum = 0;
const ver = str.split('.').map(i => Number(i));
for (let i = 0; i < len; i++) {
verNum += (ver[i] || 0) * Math.pow(100, len - i - 1);
}
return verNum;
};
const getImmersedStatus = (req) => {
let status = false;
if (req.yoho.isYohoApp && req.yoho.isiOS) {
let appVersion = req.cookies.app_version || req.query.app_version;
if (appVersion && versionToNumber(appVersion) >= versionToNumber('6.9.2')) {
status = true;
}
}
return status;
};
const getContext = (req) => {
return {
url: req.url,
... ... @@ -184,8 +159,7 @@ const render = (route) => {
resources,
states,
zk,
routeHash: routeEncode.getRouter(req),
needImmersed: getImmersedStatus(req)
routeHash: routeEncode.getRouter(req)
});
if (config.useCache && route.cache && ck) {
... ... @@ -252,8 +226,7 @@ const devRender = (route) => {
scripts,
resources,
states,
routeHash: routeEncode.getRouter(req),
needImmersed: getImmersedStatus(req)
routeHash: routeEncode.getRouter(req)
});
if (config.useCache && route.cache && ck) {
... ...
... ... @@ -23,11 +23,9 @@
</script>
</head>
<body>
{{#if needImmersed}}
<script type="text/javascript">
(function(d){var e=d.documentElement,n=(e.clientHeight/e.clientWidth)>2.1?'-high':'';d.getElementsByTagName("body")[0].className="immerse-body" + n})(document);
(function(d){function vtn(e){var n,t=0,o=e.split(".").map(e=>Number(e));for(n=0;n<3;n++)t+=(o[n]||0)*Math.pow(100,2-n);return t}function gtc(e){if(document.cookie.length>0){var n=document.cookie.indexOf(e+"=");if(-1!=n)return n=n+e.length+1,end=document.cookie.indexOf(";",n),-1==end&&(end=document.cookie.length),unescape(document.cookie.substring(n,end))}return""}var appv=gtc("app_version");if(/YohoBuy/i.test(navigator.userAgent||"")&&/\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent||"")&&appv&&vtn(appv)>=vtn("6.9.2")){var e=d.documentElement,n=e.clientHeight/e.clientWidth>2.1?"-high":"";d.getElementsByTagName("body")[0].className="immerse-body"+n}})(document);
</script>
{{/if}}
{{{html}}}
<div id="degrade-app"></div>
<div id="main-wrap">
... ...