Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-community-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
陈峰
6 years ago
Commit
3fd4d870baa1eae44b073edaaa9c32d2d11ac97e
2 parents
acabec8c
c4b85cb0
commit
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
35 deletions
apps/components/action-sheet/action-sheet.vue
apps/components/widgets/widget-avatar.vue
apps/pages/userpage/author.vue
apps/pages/userpage/components/water-fall.vue
apps/store/article/actions.js
apps/store/article/guangProcess.js
apps/components/action-sheet/action-sheet.vue
View file @
3fd4d87
...
...
@@ -28,7 +28,7 @@ export default {
transfer: Boolean,
zIndex: {
type: Number,
default:
100
default:
5
},
visible: {
type: Boolean,
...
...
apps/components/widgets/widget-avatar.vue
View file @
3fd4d87
<template>
<ImageFormat :lazy="lazy" class="img-avatar" :src="
s
rc" :width="width" :height="height"></ImageFormat>
<ImageFormat :lazy="lazy" class="img-avatar" :src="
imageS
rc" :width="width" :height="height"></ImageFormat>
</template>
<script>
...
...
@@ -24,6 +24,9 @@ export default {
}
},
computed: {
imageSrc() {
return this.src || 'http://img11.static.yhbimg.com/yhb-img01/2016/07/05/13/017ec560b82c132ab2fdb22f7cf6f42b83.png?imageView/2/w/{width}/h/{height}';
}
}
};
</script>
...
...
apps/pages/userpage/author.vue
View file @
3fd4d87
...
...
@@ -54,7 +54,7 @@
<FavTabBlock :tabs-num="tabsNum" :active-index="activeIndex" @change="changeTab"></FavTabBlock>
</cube-sticky-ele>
<div class="contant-list">
<WaterFall class="pannel-wrap" :list="list" :pos="scrollY"></WaterFall>
<WaterFall class="pannel-wrap" :list="list" :pos="scrollY"
:link-tpl="linkTpl"
></WaterFall>
</div>
<div v-if="loadStatus" class="loading">
...
...
@@ -100,8 +100,19 @@
if (!this.$route.params.id) {
this._apiNamePre += 'Mine';
try {
this.$sdk.getUser().then(res => {
this.$route.params.id = res.uid;
this.autherInfo = assign({}, this.autherInfo, {
authorUid: res.uid
});
});
} catch(e){
console.log(e);
}
}
console.log(this.$route.params);
this.autherInfo = {
authorUid: this.$route.params.id,
authorType: this.$route.params.type || 1
...
...
@@ -163,6 +174,12 @@ console.log(this.$route.params);
computed: {
list() {
return get(this.fetchInfo, `${this.activeIndex}.list`) || [];
},
linkTpl() {
return `/grass/article/{articleId}?authorUid=${this.autherInfo.authorUid}&authorType=${this.autherInfo.authorType}&type=${['publish', 'fav'][this.activeIndex]}`;
},
waterFallType() {
return ['publish', 'fav'][this.activeIndex];
}
},
methods: {
...
...
@@ -188,7 +205,7 @@ console.log(this.$route.params);
if (res.code === 200) {
this.baseData = res.data;
this.isOwner = +res.data.userType === 1;
this.isAttention = res.data.
i
sAttention === 'Y';
this.isAttention = res.data.
ha
sAttention === 'Y';
}
});
...
...
@@ -208,7 +225,7 @@ console.log(this.$route.params);
info.page = info.page || 1;
if (info.page >
=
info.totalPage) {
if (info.page > info.totalPage) {
return;
}
...
...
apps/pages/userpage/components/water-fall.vue
View file @
3fd4d87
...
...
@@ -7,9 +7,9 @@
:class="{'wf-item-default': i._default, 'wf-item-temp': i._temporary}"
:style="`width: ${100 / cols}%;transform: translate(${i.left}px, ${i.top}px)`">
<div class="wf-item-mid">
<router-link :to="
`/grass/article/${i.articleId}`
">
<router-link :to="
link(i)
">
<div class="layer-image" :style="{'height': i.coverHeight + 'px'}">
<ImageFormat v-if="!i._temporary" :src="i[srcKey]" :width="coverImageWidth" :height="i.coverHeight"></ImageFormat>
<ImageFormat v-if="!i._temporary" :
mode="1" :
src="i[srcKey]" :width="coverImageWidth" :height="i.coverHeight"></ImageFormat>
</div>
<div class="description">
<p>{{i.content}}</p>
...
...
@@ -17,7 +17,7 @@
</router-link>
<div class="attribution">
<router-link :to="
`/grass/article/${i.articleId}`
" class="auther">
<router-link :to="
link(i)
" class="auther">
<span class="avatar">
<WidgetAvatar v-if="!i._temporary" :src="i.authorHeadIco" :width="70" :height="70"></WidgetAvatar>
</span>
...
...
@@ -34,7 +34,8 @@
</template>
<script>
import {assign, get} from 'lodash';
import {assign, get, forEach} from 'lodash';
import {getArticleImageSize} from 'utils/image-handler';
export default {
data() {
...
...
@@ -70,14 +71,20 @@ export default {
type: Number,
default: 2
},
space: {
type: Number,
default: 14
}
linkTpl: String
},
mounted() {
this.$on('calced', (nlist) => {
this.viewList = this.viewList.concat(nlist);
nlist = [...nlist];
forEach(this.viewList, value => {
if (!value._temporary) {
nlist.push(value);
}
}),
this.viewList = nlist;
this.$nextTick(() => {
this.calcLayout();
})
...
...
@@ -115,9 +122,16 @@ export default {
for (let i = this.calcIndex; i < this.list.length; i++) {
let item = this.list[i];
let {width, height} = getArticleImageSize({
width: item.imageWidth,
height: item.imageHeight
});
item = assign(item, {imageWidth: width, imageHeight: height});
item.coverHeight = Math.floor(item.imageHeight / item.imageWidth * this.coverImageWidth);
nlist.push(assign({_temporary: true}, item));
this.calcIndex++;
};
this.$emit('calced', nlist);
...
...
@@ -169,6 +183,7 @@ export default {
}
this.loadedIndex = this.list.length;
this.colsHeight = [...this.colsHeight];
this.resetViewList();
},
...
...
@@ -267,6 +282,9 @@ export default {
this.lastPos = this.pos;
this.viewIndex = viewIndex;
}
},
link(item) {
return (this.linkTpl || '').replace('{articleId}', item.articleId);
}
}
};
...
...
@@ -339,8 +357,12 @@ export default {
}
.name {
max-width: 170px;
display: inline-block;
vertical-align: middle;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.fav {
...
...
apps/store/article/actions.js
View file @
3fd4d87
...
...
@@ -131,12 +131,12 @@ export default {
// 插入商品
const
[
goodsList
,
favsList
]
=
await
Promise
.
all
([
this
.
$api
.
post
(
'/api/guang/article/queryGoods'
,
{
query
:
processContents
.
allgoods
.
join
(
','
),
query
:
processContents
.
allgoods
.
skn
.
join
(
','
),
order
:
's_t_desc'
,
limit
:
processContents
.
allgoods
.
length
||
1
limit
:
processContents
.
allgoods
.
skn
.
length
||
1
}),
this
.
$api
.
post
(
'/api/favorite/batchCheckIsFavorite'
,
{
favIds
:
processContents
.
allgoods
.
join
(
','
),
favIds
:
processContents
.
allgoods
.
id
.
join
(
','
),
type
:
'product'
})
]).
then
(([
res1
,
res2
])
=>
{
...
...
apps/store/article/guangProcess.js
View file @
3fd4d87
...
...
@@ -81,7 +81,7 @@ function productGlobalUrl(skn) {
export
function
processArticleDetail
(
articleContent
)
{
let
finalDetail
=
[];
let
allgoods
=
[]
;
let
allgoods
=
{
id
:
[],
skn
:
[]}
;
let
recommends
=
[];
for
(
let
value
of
articleContent
)
{
...
...
@@ -160,18 +160,21 @@ export function processArticleDetail(articleContent) {
// 普通商品
forEach
(
goodsData
,
(
item
)
=>
{
allgoods
.
push
(
item
.
id
);
allgoods
.
id
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
skn
.
push
(
get
(
item
,
'id'
,
0
));
});
// 全球购商品
forEach
(
goodsDataGlobal
,
(
item
)
=>
{
allgoods
.
push
(
item
.
id
);
allgoods
.
id
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
skn
.
push
(
get
(
item
,
'id'
,
0
));
goodsData
.
push
(
item
);
});
// 限定商品
forEach
(
goodsDataLimit
,
(
item
)
=>
{
allgoods
.
push
(
item
.
id
);
allgoods
.
id
.
push
(
get
(
item
,
'productId'
,
0
));
allgoods
.
skn
.
push
(
get
(
item
,
'id'
,
0
));
goodsData
.
push
(
item
);
});
...
...
@@ -295,8 +298,7 @@ function processProductList(list, favsList) {
product
.
id
=
product
.
product_id
;
product
.
productType
=
1
;
product
.
favorite
=
fav
.
favorite
||
false
;
product
.
favorite
=
get
(
fav
,
'favorite'
,
false
);
/**
* 全球购商品标记
...
...
@@ -338,30 +340,34 @@ export function pushGoodsInfo(finalDetail, goodsList, favsList) {
forEach
(
finalDetail
,
(
value
,
key
)
=>
{
if
(
value
.
relatedReco
)
{
let
goods
Ids
=
[];
let
goods
Skn
=
[];
forEach
(
value
.
relatedReco
.
goods
,
relatedGoods
=>
{
goods
Ids
.
push
(
relatedGoods
.
id
);
goods
Skn
.
push
(
relatedGoods
.
id
);
});
goods
Ids
=
uniq
(
goodsIds
);
goods
Skn
=
uniq
(
goodsSkn
);
finalDetail
[
key
].
relatedReco
.
goods
=
[];
forEach
(
goodsIds
,
(
item
,
subKey
)
=>
{
forEach
(
goodsSkn
,
(
item
,
subKey
)
=>
{
console
.
log
(
goodsObj
,
item
)
if
(
goodsObj
[
item
])
{
console
.
log
(
goodsObj
[
item
])
finalDetail
[
key
].
relatedReco
.
goods
[
subKey
]
=
goodsObj
[
item
];
}
else
{
console
.
log
(
'delete'
);
delete
finalDetail
[
key
].
relatedReco
.
goods
[
subKey
];
}
});
finalDetail
[
key
].
relatedReco
.
goods
=
remove
(
finalDetail
[
key
].
relatedReco
.
goods
,
(
obj
)
=>
{
return
obj
;
});
let
moreNum
=
get
(
finalDetail
[
key
],
'relatedReco.goods.length'
,
0
);
finalDetail
[
key
].
relatedReco
.
moreNum
=
moreNum
-
4
>
0
?
moreNum
-
4
:
0
;
// 改成第一屏幕最多展示4个
//
// finalDetail[key].relatedReco.goods = remove(finalDetail[key].relatedReco.goods, (obj) => {
// return obj;
// });
//
// let moreNum = get(finalDetail[key], 'relatedReco.goods.length', 0);
//
// finalDetail[key].relatedReco.moreNum = moreNum - 4 > 0 ? moreNum - 4 : 0; // 改成第一屏幕最多展示4个
}
if
(
value
.
collocation
)
{
...
...
Please
register
or
login
to post a comment