Commit 2df8634d by 李嘉林

优化

parent 3993ffe8
...@@ -18,16 +18,15 @@ ...@@ -18,16 +18,15 @@
> >
<div class="img" v-if="!imgRight" :style="{'background': listStyle != 5 ? bgColor : ''}"> <div class="img" v-if="!imgRight" :style="{'background': listStyle != 5 ? bgColor : ''}">
<div <div
class="tagList flex" class="tagList"
v-if="info.tagList && info.tagList.length > 0 && tagShow" v-if="info.tagList && info.tagList.length > 0 && tagShow"
> >
<div <div
class="tag" class="tag"
v-for="(item, index) in info.tagShowList" v-for="(item, index) in info.tagList"
:key="index" :key="index"
> >
<i class="tag-i">#</i> <span class="tag-i">#</span><span class="tagName">{{ item.tagName }}</span>
<span class="tagName">{{ item.tagName }}</span>
</div> </div>
</div> </div>
<image :src="info.coverUrl" mode="widthFix" lazy-load></image> <image :src="info.coverUrl" mode="widthFix" lazy-load></image>
...@@ -58,16 +57,15 @@ ...@@ -58,16 +57,15 @@
<!-- 针对图片在右边 --> <!-- 针对图片在右边 -->
<div class="img" v-if="imgRight"> <div class="img" v-if="imgRight">
<div <div
class="tagList flex" class="tagList"
v-if="info.tagList && info.tagList.length > 0 && tagShow" v-if="info.tagList && info.tagList.length > 0 && tagShow"
> >
<div <div
class="tag" class="tag"
v-for="(item, index) in info.tagShowList" v-for="(item, index) in info.tagList"
:key="index" :key="index"
> >
<i class="tag-i">#</i> <span class="tag-i">#</span><span class="tagName">{{ item.tagName }}</span>
<span class="tagName">{{ item.tagName }}</span>
</div> </div>
</div> </div>
<image :src="info.coverUrl" lazy-load mode="widthFix"></image> <image :src="info.coverUrl" lazy-load mode="widthFix"></image>
...@@ -156,7 +154,7 @@ img { ...@@ -156,7 +154,7 @@ img {
.img { .img {
width: 100%; width: 100%;
position: relative; position: relative;
background: #fdfdfd; background: #f5f5f5;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -168,12 +166,14 @@ img { ...@@ -168,12 +166,14 @@ img {
} }
.tagList { .tagList {
position: absolute; position: absolute;
bottom: 4px; bottom: -20px;
left: 4px; left: 4px;
max-width: 92%; padding-bottom: 24px;
flex-wrap: wrap; overflow-x: auto;
overflow: hidden; white-space: nowrap;
width: 90%;
.tag { .tag {
display: inline-block;
padding: 0 8px; padding: 0 8px;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
...@@ -181,8 +181,8 @@ img { ...@@ -181,8 +181,8 @@ img {
border-radius: 4px; border-radius: 4px;
margin-left: 4px; margin-left: 4px;
margin-bottom: 4px; margin-bottom: 4px;
display:flex;
.tag-i { .tag-i {
font-size: italic;
font-weight: 400; font-weight: 400;
color: var(--main-color); color: var(--main-color);
font-size: 12px; font-size: 12px;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<h3 class="line-clamp1">{{title}}</h3> <h3 class="line-clamp1">{{title}}</h3>
<div <div
class="more" class="more"
v-if="datas.componentData['moreShow']&&datas.componentData.status==1" v-if="showMoreBtn"
@click="viewMore" @click="viewMore"
> >
<div class="moreTop"> <div class="moreTop">
...@@ -223,6 +223,7 @@ export default { ...@@ -223,6 +223,7 @@ export default {
//图片方块宽度 //图片方块宽度
waterfallImgWidth: null, waterfallImgWidth: null,
// 瀑布流使用参数结束 // 瀑布流使用参数结束
total:0,
}; };
}, },
components: { components: {
...@@ -263,6 +264,10 @@ export default { ...@@ -263,6 +264,10 @@ export default {
classifId() { classifId() {
return this.datas.componentData.classifId || ""; return this.datas.componentData.classifId || "";
}, },
// 排序条件
orderByField() {
return this.datas.componentData.orderByField || 1;
},
// 分类名 // 分类名
classifName() { classifName() {
if ( if (
...@@ -283,6 +288,24 @@ export default { ...@@ -283,6 +288,24 @@ export default {
this.datas.componentData.articityList = newValue; this.datas.componentData.articityList = newValue;
}, },
}, },
// 标签列表
tagIds: {
get() {
return this.datas.componentData.tagIds || [];
},
set(newValue) {
this.datas.componentData.tagIds = newValue;
},
},
// 展示数量
showNum: {
get() {
return this.datas.componentData.showNum || 6;
},
set(newValue) {
this.datas.componentData.showNum = newValue;
},
},
// 展示骨架屏数量 // 展示骨架屏数量
skeletonNum() { skeletonNum() {
if (this.addArticleType == 1 && this.articleStatus == 2) { if (this.addArticleType == 1 && this.articleStatus == 2) {
...@@ -295,6 +318,13 @@ export default { ...@@ -295,6 +318,13 @@ export default {
return 4; return 4;
} }
}, },
// 展示查看更多按钮
showMoreBtn(){
if(this.datas.componentData['moreShow']&&(this.articleStatus==1 || this.articleStatus==4) && this.total>=this.showNum){
return true;
}
return false;
}
}, },
mounted() { mounted() {
this.DFSImg = app.DFSImg; this.DFSImg = app.DFSImg;
...@@ -313,6 +343,9 @@ export default { ...@@ -313,6 +343,9 @@ export default {
this.itemShow = false; this.itemShow = false;
} }
this.loading = true; this.loading = true;
} else if(this.datas.componentData.status == 4){
// 指定标签
this.getArticle(4);
} }
}, },
initNoListShow() { initNoListShow() {
...@@ -341,7 +374,7 @@ export default { ...@@ -341,7 +374,7 @@ export default {
query = { query = {
classifyName: this.classifName, classifyName: this.classifName,
pageNum : 1, pageNum : 1,
pageSize: 6, pageSize: this.showNum,
articleStatus: 1, articleStatus: 1,
}; };
if ( if (
...@@ -384,7 +417,25 @@ export default { ...@@ -384,7 +417,25 @@ export default {
articleStatus: 1, articleStatus: 1,
}; };
} }
} else if(val == 4){
if (this.tagIds.length == 0) {
this.initQuery();
if (!this.render) {
this.initNoListShow();
} else {
this.itemShow = false;
}
return;
} }
query = {
tagIds: this.tagIds,
pageNum : 1,
pageSize: this.showNum,
articleStatus: 1,
};
}
query.orderByAscOrDesc=1;
query.orderByField=this.orderByField;
console.log(query, "-----------------314"); console.log(query, "-----------------314");
app.classificationApi.getArticleList(query).then((res) => { app.classificationApi.getArticleList(query).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -392,20 +443,23 @@ export default { ...@@ -392,20 +443,23 @@ export default {
if (this.articityList.length > 0) { if (this.articityList.length > 0) {
this.articityList.forEach((item, index) => { this.articityList.forEach((item, index) => {
item.coverUrl = app.DFSImg(item.coverUrl,400,400,1); item.coverUrl = app.DFSImg(item.coverUrl,400,400,1);
item.tagShowList=[];
console.log(item.tagList,'-------tagList')
item.tagShowList=item.tagList?this.initTagList(item.tagList):[];
}); });
} else { } else {
this.itemShow = false; this.itemShow = false;
} }
this.total=res.data.total;
this.loading = true; this.loading = true;
} }
}); });
}, },
// 查看更多 // 查看更多
viewMore() { viewMore() {
let link = `/article/articleList?classifyId=${this.classifId}&categoryName=${this.classifName}` let link ="";
if(this.articleStatus==1){
link= `/article/articleList?classifyId=${this.classifId}&categoryName=${this.classifName}`;
} else if(this.articleStatus==4){
link= `/article/articleList?tagIds=${this.tagIds.join(",")}`;
}
app.$themeToLink({ app.$themeToLink({
type :1, type :1,
link : link link : link
...@@ -416,7 +470,8 @@ export default { ...@@ -416,7 +470,8 @@ export default {
console.log(item, "--------------------494"); console.log(item, "--------------------494");
if ( if (
this.datas.componentData.status == 1 || this.datas.componentData.status == 1 ||
this.datas.componentData.status == 2 this.datas.componentData.status == 2 ||
this.datas.componentData.status == 4
) { ) {
let query = { let query = {
articityId: item.id, articityId: item.id,
...@@ -453,8 +508,8 @@ export default { ...@@ -453,8 +508,8 @@ export default {
} else if (this.listStyle == 5 && this.num > 0) { } else if (this.listStyle == 5 && this.num > 0) {
i = 6; i = 6;
} }
newTagList = finalFun(list, i); // newTagList = finalFun(list, i);
console.log(newTagList,'---------------------------457') // console.log(newTagList,'---------------------------457')
return newTagList; return newTagList;
}, },
}, },
......
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