This commit is contained in:
daihh
2022-11-11 19:07:17 +08:00
3 changed files with 95 additions and 85 deletions

View File

@@ -1,9 +1,10 @@
<template> <template>
<view class="top"> <view class="top">
<view v-show="showBack" class="back" @click="toBack()"> <view v-show="showBack" class="back" @click="toBack()">
<text class="arrow"></text> <u-icon name="arrow-left"></u-icon>
</view> </view>
<view class="title"><slot></slot> </view> <view><slot></slot> </view>
<view @click="topgae()" style="color: #387DF7;"><slot name="right"></slot> </view>
</view> </view>
</template> </template>
@@ -17,6 +18,10 @@
showBack:{ showBack:{
type:Boolean, type:Boolean,
default:false default:false
},
goPgae:{
type:String,
default:''
} }
}, },
data() { data() {
@@ -25,6 +30,13 @@
} }
}, },
methods: { methods: {
topgae() {
if(this.goPgae!=''){
uni.navigateTo({
url:this.goPgae
});
}
},
toBack(){ toBack(){
if(this.backUrl!=''){ if(this.backUrl!=''){
if(this.backUrl == '/pages/my/index'){ if(this.backUrl == '/pages/my/index'){
@@ -60,11 +72,15 @@
// display: none; // display: none;
// background:linear-gradient(to bottom,#6BA0FC, #6297FD); // background:linear-gradient(to bottom,#6BA0FC, #6297FD);
background-color: #fff; background-color: #fff;
display: flex;
justify-content: space-between;
.back{ .back{
float: left; // float: left;
color: #000; color: #000;
padding-top:8px; padding-top:6px;
padding-left: 15px; height: 40px;
line-height: 40px;
// padding-left: 15px;
} }
.title{ .title{
text-align: center; text-align: center;
@@ -79,18 +95,18 @@
line-height: 40px; line-height: 40px;
} }
} }
.arrow:before { // .arrow:before {
content: " "; // content: " ";
display: inline-block; // display: inline-block;
-webkit-transform: rotate(45deg); // -webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg); // -ms-transform: rotate(45deg);
transform: rotate(45deg); // transform: rotate(45deg);
height: .5rem; // height: .5rem;
width: .5rem; // width: .5rem;
border-width: 0 0 2px 2px; // border-width: 0 0 2px 2px;
border-color: #FFFFFF; // border-color: #FFFFFF;
border-style: solid; // border-style: solid;
position: relative; // position: relative;
top: 0 // top: 0
} // }
</style> </style>

View File

@@ -2,18 +2,18 @@
<!--我的文章--> <!--我的文章-->
<view class="article"> <view class="article">
<u-toast ref="articleToast"></u-toast> <u-toast ref="articleToast"></u-toast>
<page-title :showBack="true">我的文章</page-title> <page-title :showBack="true" goPgae="/pages/plus/addArticle">
<template #right>
<p>去发表</p>
</template>
</page-title>
<view class="top-filter"> <view class="top-filter">
<view class="top-content"> <view class="top-content">
<view class="put-articles" @click="toAdd()"> <!-- <view class="put-articles" @click="toAdd()">
去发表 去发表
</view> </view> -->
<view class="top-content-options"> <view class="top-content-options">
<!-- <view style="margin-right: 20upx;">
<text class="textbtn" style="color:#666;font-size: 28upx;" @click="statusSelectShow = !statusSelectShow">状态</text>
</view> -->
<view class="input-search"> <view class="input-search">
<u-search <u-search
@search="findData(true)" @search="findData(true)"
@@ -27,18 +27,28 @@
<u-icon @click="findData(true)" name="search"></u-icon> <u-icon @click="findData(true)" name="search"></u-icon>
</template> --> </template> -->
</u-search> </u-search>
</view>
<view class="addition">
<view class="textbtn" style="color:#666;font-size: 28upx;" @click="statusSelectShow = !statusSelectShow">
<text>状态</text>
<u-icon style="margin-left: 18upx;" name="arrow-down"></u-icon>
</view>
<view class="sea-show" v-show="statusSelectShow">
<view v-for="(status,index) in selectData" :key="index" :class="[articleList.status == status.value? 'sea-active':'','sea-index']" @click="chooseStatus(status)">
{{status.label}}
</view>
</view>
</view> </view>
<!-- <view style="width: 70upx;">
<view class="textbtn" @click="toAdd()"><u-icon name="plus" color="#2979ff" size="18"></u-icon></view>
</view> -->
</view> </view>
</view> </view>
</view> </view>
<view class="uni-list"> <view class="uni-list">
<view v-show="statusSelectShow" class="sea-show"> <!-- <view v-show="statusSelectShow" class="sea-show">
<text :class="[articleList.status == status.value? 'sea-active':'','sea-index']" v-for="(status,index) in selectData" :key="index" @click="chooseStatus(status)">{{status.label}}</text> <text :class="[articleList.status == status.value? 'sea-active':'','sea-index']" v-for="(status,index) in selectData" :key="index" @click="chooseStatus(status)">{{status.label}}</text>
</view> </view> -->
<view style="padding-top: 14upx;"> <view style="padding-top: 14upx;">
<!-- 文章内容 下面需要把样式提到class中--> <!-- 文章内容 下面需要把样式提到class中-->
<view class="article_one" v-for="(item, index) of articleList.list" :key="item.id"> <view class="article_one" v-for="(item, index) of articleList.list" :key="item.id">
@@ -221,10 +231,11 @@ export default {
}); });
}, },
chooseStatus(e) { chooseStatus(e) {
console.log(e,'e')
if(this.flagLoading) { if(this.flagLoading) {
return; return;
} }
// this.statusSelectShow = false; this.statusSelectShow = false;
// this.statusBtn = e.value[0].label; // this.statusBtn = e.value[0].label;
this.articleList.pageIndex = 1; this.articleList.pageIndex = 1;
this.articleList.status = e.value; this.articleList.status = e.value;
@@ -338,11 +349,13 @@ export default {
} }
.top-filter { .top-filter {
.top-content { .top-content {
position: relative; // position: relative;
.put-articles{ .put-articles{
position: absolute; text-align: right;
right:0; // float: right;
top:-60upx; // position: absolute;
// right:0;
// top:-60upx;
font-size: 32upx; font-size: 32upx;
font-weight: 600; font-weight: 600;
color: #387DF7; color: #387DF7;
@@ -351,17 +364,7 @@ export default {
.top-content-options { .top-content-options {
// height: 40px; // height: 40px;
display: flex; display: flex;
justify-content: space-between;
align-items: center;
line-height: 40px; line-height: 40px;
// padding:20upx 30upx 0 30upx ;
// .textbtn {
// background-color: #ffffff;
// color: #4f4f4f;
// border-radius: 8upx;
// font-size: 24upx;
// }
.input-search { .input-search {
flex: 1; flex: 1;
// padding: 28upx 20upx; // padding: 28upx 20upx;
@@ -380,47 +383,47 @@ export default {
} }
} }
.textbtn {
background-color: #ffffff;
padding: 18upx 20upx;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
.addition { .addition {
margin-left: 20rpx; width: 108upx;
.textbtn { margin-left: 90rpx;
background-color: #ffffff; position: relative;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
}
.uni-list {
.textbtn {
display: flex;
width: 108upx;
color: #4f4f4f;
font-size: 28upx;
}
.sea-show{ .sea-show{
// padding: 10rpx 30upx 0 30upx; width: 130upx;
// padding-top: 10upx; position: absolute;
line-height: 60upx; top: 80upx;
right: 0;
background: #FFFFFF;
box-shadow: 0px 2upx 8upx 4upx rgba(0,0,0,0.07);
border-radius: 12upx;
padding: 20upx 60upx;
z-index: 99;
.sea-active{ .sea-active{
border: 1rpx solid #679cfc !important; color: #387DF7 !important;
color: #679cfc;
} }
.sea-index{ .sea-index{
font-size: 26rpx; font-size: 28upx;
padding: 6rpx 16rpx; color: #666666;
border: 1rpx solid #ccc; line-height: 60upx;
border-radius: 20rpx; text-align: center;
margin-right: 16rpx;
background-color: #fff;
} }
.sea-index:last-child{ .sea-index:last-child{
margin-right: 0; margin-right: 0;
} }
} }
}
.uni-list {
.article_one{ .article_one{
// padding: 20upx 30upx; // padding: 20upx 30upx;
// padding-top: 10upx; // padding-top: 10upx;

View File

@@ -43,7 +43,7 @@
tab:0, tab:0,
data:[],//拿到的数据 data:[],//拿到的数据
total:0,//总条数 total:0,//总条数
loadStatus:'more',//more,loading,noMore loadStatus:'noMore',//more,loading,noMore
query:{ query:{
pageIndex:1,//当前页 pageIndex:1,//当前页
type:null,//当前只限于文章 type:null,//当前只限于文章
@@ -96,6 +96,7 @@
this.message.list = []; this.message.list = [];
this.queryData.pageIndex = 1; this.queryData.pageIndex = 1;
} }
let $this = this;
uni.showLoading({ title: '加载中...' }); uni.showLoading({ title: '加载中...' });
apiMessage.list(this.queryData).then(res => { apiMessage.list(this.queryData).then(res => {
if (res.status == 200) { if (res.status == 200) {
@@ -111,11 +112,6 @@
}); });
this.loadAuthorInfo(res.result.list,ids) this.loadAuthorInfo(res.result.list,ids)
} }
if(this.message.list.length<this.message.total){
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
} else { } else {
this.$refs.toast.show({ message: '获取数据失败', type: 'error' }) this.$refs.toast.show({ message: '获取数据失败', type: 'error' })
} }
@@ -146,11 +142,6 @@
}) })
this.loadAuthorInfo(res.result.list,ids); this.loadAuthorInfo(res.result.list,ids);
} }
if(this.data.length<this.total){
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
}else{ }else{
this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'}); this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'});
} }