Authored by TaoHuang

Merge remote-tracking branch 'origin/master'

... ... @@ -65,9 +65,10 @@ export default {
}
.layout-content {
width: 100%;
height: 100%;
flex: 1;
overflow-y: auto;
overflow-x: hidden;
overflow: hidden;
-webkit-overflow-scrolling: touch;
}
}
... ...
... ... @@ -157,6 +157,7 @@ export default {
},
getItems(reload) {
if (reload) {
this.noMore = false;
this.list = [];
this.items = [];
}
... ...
... ... @@ -20,15 +20,6 @@ export default {
type: ''
};
},
serverPrefetch() {
return this.fetchArticleList({
articleId: this.$route.params.id,
page: this.page,
authorUid: this.authorUid,
authorType: this.authorType,
type: this.type
});
},
created() {
this.id = this.$route.params.id;
this.authorUid = this.$route.query.authorUid;
... ...
<template>
<ImageFormat :mode="1" :lazy="lazy" :style="imageStyle" class="image-slide-item" :src="data.contentData" :width="imageSize.width" :height="imageSize.height"></ImageFormat>
</template>
<script>
import {mapState} from 'vuex';
export default {
name: 'ArticleItemSlideImage',
props: {
thumbSize: Object,
data: Object,
lazy: Boolean
},
computed: {
...mapState(['yoho']),
imageStyle() {
const {width, height} = this.itemSize;
return {
width: `${width}px`,
height: `${height}px`
};
},
itemSize() {
const {height: fHeight} = this.thumbSize;
const scale = this.data.width / this.data.height;
if (scale > 1) {
return {
width: parseInt(this.yoho.window.clientWidth, 10),
height: parseInt(this.yoho.window.clientWidth / scale, 10)
};
} else if (scale < 1) {
return {
width: parseInt(fHeight * scale, 10),
height: parseInt(fHeight, 10)
};
} else {
return {
width: this.yoho.window.clientWidth,
height: this.yoho.window.clientWidth
};
}
},
imageSize() {
const {width, height} = this.itemSize;
if (this.data.width < width && this.data.height < height) {
return this.itemSize;
}
return this.data;
}
}
};
</script>
<style lang="scss" scoped>
.image-slide-item {
overflow: hidden;
}
</style>
... ...
... ... @@ -2,7 +2,7 @@
<div class="article-item-slide">
<Slide :data="data.blockList" :threshold="0.2" :auto-play="false" :loop="false" :options="scrollOption" @change="onChange">
<SlideItem :style="slideItemStyle" v-for="(item, inx) in data.blockList" :key="inx">
<ImageFormat :mode="1" :lazy="lazy" :style="getImageStyle(item)" class="image-slide-item" :src="item.contentData" :width="item.width" :height="item.height"></ImageFormat>
<ArticleItemSlideImage :lazy="lazy" :data="item" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
</SlideItem>
<template slot="dots" slot-scope="props">
<span class="slide-dot"
... ... @@ -22,6 +22,7 @@
import {first} from 'lodash';
import {Slide} from 'cube-ui';
import {mapState} from 'vuex';
import ArticleItemSlideImage from './article-item-slide-image';
export default {
name: 'ArticleItemSlide',
... ... @@ -75,22 +76,6 @@ export default {
}
},
methods: {
getImageStyle({width, height}) {
const {height: fHeight} = this.firstBlockSize;
const scale = width / height;
if (scale > 1) {
return {
width: `${this.yoho.window.clientWidth}px`,
height: `${this.yoho.window.clientWidth / scale}px`
};
} else if (scale < 1) {
return {
width: `${fHeight * scale}px`,
height: `${fHeight}px`
};
}
},
onChange(inx) {
this.currentIndex = inx + 1;
},
... ... @@ -127,7 +112,7 @@ export default {
};
}
},
components: {Slide, SlideItem: Slide.Item}
components: {Slide, SlideItem: Slide.Item, ArticleItemSlideImage}
};
</script>
... ... @@ -165,10 +150,6 @@ export default {
}
}
.image-slide-item {
overflow: hidden;
}
.pages {
position: absolute;
top: 0;
... ...
... ... @@ -10,7 +10,7 @@
<WidgetFollow class="widget-follow" :author-uid="currentAuthor.authorUid" :follow="currentAuthor.hasAttention === 'Y'" @on-follow="follow => onFollow(currentAuthor, follow)"></WidgetFollow>
</template>
</LayoutHeader>
<LayoutRecycleList v-if="isMounted" ref="scroll" @scroll="onScroll" :offset="1000" :on-fetch="onFetch">
<LayoutRecycleList v-if="isMounted" :size="50" ref="scroll" @scroll="onScroll" :offset="1000" :on-fetch="onFetch">
<template class="article-item" v-slot:item="{ data }">
<ArticleItem
:id="`item${data.index}`"
... ...
... ... @@ -613,11 +613,6 @@ ul {
white-space: nowrap;
}
img[lazy] {
-webkit-transition: all 100ms;
transition: all 100ms;
}
img[lazy=loading] {
opacity: 0.2;
}
... ...
... ... @@ -11,6 +11,11 @@ export default {
},
[Types.FETCH_ARTICLE_LIST_SUCCESS](state, {data}) {
state.fetchArticleList = false;
data.forEach(item => {
get(item, 'productList', []).forEach(product => {
product.favorite = false;
});
});
state.articleList = state.articleList.concat(data);
state.articleList.forEach((item, index) => {
... ... @@ -25,11 +30,6 @@ export default {
}
item.index = index;
});
data.forEach(item => {
get(item, 'productList', []).forEach(product => {
product.favorite = false;
});
});
},
[Types.FETCH_ARTICLE_LIST_FAILD](state) {
state.fetchArticleList = false;
... ...
... ... @@ -33,6 +33,7 @@ export default function() {
state.context.title = context.title;
state.context.route = context.route;
state.context.path = context.path;
state.context.isLogin = context.user.uid > 1;
},
[Types.SET_TITLE](state, {title}) {
state.context.title = title;
... ...
... ... @@ -46,12 +46,12 @@ const webpackConfig = {
{
resourceQuery: /blockType=client/,
use: 'babel-loader',
exclude: /node_modules/
exclude: /node_modules/,
},
{
test: /\.js$/,
use: 'babel-loader',
include: [resolve('apps'), /cube-ui/]
include: [resolve('apps'), /cube-ui/, /yoho-activity-sdk/]
},
]
},
... ...
... ... @@ -85,6 +85,29 @@ exports.createApp = async(app) => {
// YOHO 前置中间件
app.use(setYohoDataMiddleware);
app.use(userMiddleware);
if (!app.locals.proEnv) {
app.use((req, res, next) => {
if (/cordova/.test(req.url)) {
return res.status(404).end();
}
return next();
});
app.use('/passport/login/user', (req, res) => {
let result = {
code: 403,
message: '未登录',
data: ''
};
if (req.user.uid) {
result.code = 200;
result.message = '已登录';
result.data = req.user.uid.toString();
}
res.jsonp(result);
});
}
app.get('/grass/getToken', qiniuMiddleware.getToken);
app.use('/grass', ssrApiMiddleware);
... ...