消息@我的

This commit is contained in:
zhaofang
2022-11-09 19:16:20 +08:00
parent 1bbd397ba4
commit 6f961650d2
6 changed files with 343 additions and 77 deletions

161
components/at-my/at-my.vue Normal file
View File

@@ -0,0 +1,161 @@
<template>
<view class="at-my-com">
<view class="at-my-index" v-for="at in items">
<view class="at-who">
<view class="who-img">
<author-img :avatar="at.authorInfo.avatar" :sex="at.authorInfo.sex"></author-img>
<!-- <image style="width: 80upx;height: 80upx;" src="../../static/images/woman.png" mode=""></image> -->
</view>
<view class="who-name">
<view class="name-info">
{{at.sysCreateBy}} <view class="who-time">{{at.sysCreateTime}}</view>
</view>
<view class="info-text">
<text class="name-text-at">@</text>
{{filterObjType(at.objType)}}不错你也来看看吧
</view>
</view>
</view>
<view class="at-title-box" @click="toArticleDetail(at)">
<view class="at-name">{{at.title}}</view>
</view>
</view>
</view>
</template>
<script>
import apiQa from '@/api/modules/qa.js'
import apiComments from '../../api/modules/comments.js';
export default {
props:{
items:{
type:Array,
}
},
data() {
return {
// data:[],//拿到的数据
// total:0,//总条数
// loadStatus:'more',//more,loading,noMore
// query:{
// pageIndex:1,//当前页
// type:null,//当前只限于文章
// pageSize:10,//条数
// },//查询条件
}
},
// onLoad() {
// this.findData(true);
// },
// onPullDownRefresh() {
// this.onReachBottom();
// },
// onReachBottom() {
// console.log('111111')
// this.loadStatus='loading';//more,loading,noMore
// if(this.data.length<this.total){
// this.query.pageIndex++;
// this.findData(false);
// this.loadStatus='more'
// }else{
// this.loadStatus='noMore'
// }
// },
mounted() {
// this.findData(true);
},
methods: {
filterObjType(objType){
switch(objType){
case 1:{
return '课程'
}
case 2:{
return '文章'
}
case 3:{
return '案例'
}
case 4:{
return '问答'
}
}
},
toArticleDetail(item) {
if(item.objType == 2){
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.objId
});
}else if(item.objType == 1){
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + item.objId
});
}else if(item.objType == 4){
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.objId
});
}
},
}
}
</script>
<style scoped lang="scss">
.at-my-com{
padding: 0 32upx;
.at-my-index{
padding: 60upx 0 50upx 0;
border-bottom: 2upx solid rgba(153,153,153,0.1);
.at-who{
display: flex;
.who-img{
margin-right: 20upx;
}
.who-name{
width: 100%;
font-size: 28upx;
.name-info{
font-weight: 600;
color: #333333;
}
.who-time{
float: right;
font-weight: 400;
font-size: 24upx;
color: #999999;
}
.info-text{
margin-top: 8upx;
color: #333333;
.name-text-at{
margin-right: 20upx;
color: #387DF7;
}
}
}
}
.at-title-box{
margin-top: 22upx;
padding: 40upx 60upx;
background: #F6F6F6;
font-size: 32upx;
font-weight: 600;
color: #333333;
}
.at-name{
word-break:break-all;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 1;
}
}
}
</style>

View File

@@ -103,7 +103,7 @@
return{ return{
courseSysTypeTree:[], courseSysTypeTree:[],
courseScenceList:[], courseScenceList:[],
filterShow:true,//是否显示过虑器 filterShow:false,//是否显示过虑器
// filterWidth:'300px', // filterWidth:'300px',
sysTypeTow:[], sysTypeTow:[],
sysTypeThree:[], sysTypeThree:[],

View File

@@ -0,0 +1,95 @@
<template>
<view>
<view class="news-page-btn">
<view class="btn-index">多选</view>
<view class="btn-index">清空</view>
<view class="btn-index">一键已读</view>
</view>
<view class="news-page-list">
<view class="list-index" v-for="item in 5">
<view class="list-index-img">
<image style="width:80upx;height:80upx" src="../../static/images/woman.png" mode=""></image>
</view>
<view class="list-index-cen">
<view class="cen-name">
李沐沐
</view>
<view class="cen-text">
收藏了你发布的课程···
</view>
</view>
<view class="list-index-time">
2022/9/20
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
.news-page-btn{
height: 80upx;
padding: 30upx 32upx 0 36upx;
.btn-index{
font-size: 28upx;
color: #666666;
float: right;
margin-left: 20upx;
padding: 6upx 32upx 6upx 28upx;
border: 2upx solid rgba(153,153,153,0.2);
border-radius: 26upx;
}
.btn-index:first-child{
margin-left: 0;
float: left;
}
}
.news-page-list{
padding: 0 32upx 0 36upx;
box-sizing: border-box;
.list-index{
display: flex;
padding: 40upx 0;
border-bottom: 2upx solid rgba(153,153,153,0.1);;
.list-index-img{
width: 80upx;
}
.list-index-cen{
margin-left: 30upx;
width: 100%;
.cen-name{
font-size: 28upx;
font-weight: 500;
color: #333333;
margin-top: 4upx;
}
.cen-text{
font-size: 24upx;
color: #999999;
margin-top: 4upx;
}
}
.list-index-time{
margin-top: 4upx;
width: 130upx;
font-size: 24upx;
color: #999999;
}
}
}
</style>

View File

@@ -27,7 +27,7 @@
{"path" : "pages/study/courseAssess","style" : {"navigationBarTitleText": "课程评估","enablePullDownRefresh": false}}, {"path" : "pages/study/courseAssess","style" : {"navigationBarTitleText": "课程评估","enablePullDownRefresh": false}},
{"path" : "pages/study/loaddetail","style" : {"navigationBarTitleText": "学习任务详细信息","enablePullDownRefresh": false}}, {"path" : "pages/study/loaddetail","style" : {"navigationBarTitleText": "学习任务详细信息","enablePullDownRefresh": false}},
{"path" : "pages/study/studydetail","style" : {"navigationBarTitleText": "自主学习详细信息","enablePullDownRefresh": false}}, {"path" : "pages/study/studydetail","style" : {"navigationBarTitleText": "自主学习详细信息","enablePullDownRefresh": false}},
{"path" : "pages/news/index","style" : {"navigationBarTitleText": "消息","enablePullDownRefresh": false}}, {"path" : "pages/news/index","style" : {"navigationBarTitleText": "消息","enablePullDownRefresh": true}},
{"path" : "pages/my/index","style" : {"navigationBarTitleText": "我的","enablePullDownRefresh": false}}, {"path" : "pages/my/index","style" : {"navigationBarTitleText": "我的","enablePullDownRefresh": false}},
{"path" : "pages/my/myub","style" : {"navigationBarTitleText": "我的u币","enablePullDownRefresh": false}}, {"path" : "pages/my/myub","style" : {"navigationBarTitleText": "我的u币","enablePullDownRefresh": false}},
{"path" : "pages/my/myubrules","style" : {"navigationBarTitleText": "u币规则","enablePullDownRefresh": false}}, {"path" : "pages/my/myubrules","style" : {"navigationBarTitleText": "u币规则","enablePullDownRefresh": false}},

View File

@@ -15,35 +15,23 @@
}" }"
></u-tabs> ></u-tabs>
</view> </view>
<view class="news-page-btn"> <view class="" v-show="tab == 0">
<view class="btn-index">多选</view> <system-news></system-news>
<view class="btn-index">清空</view>
<view class="btn-index">一键已读</view>
</view> </view>
<view class="news-page-list"> <view class="" v-show="tab == 1">
<view class="list-index" v-for="item in 5"> <at-my :items="data"></at-my>
<view class="list-index-img"> </view>
<image style="width:80upx;height:80upx" src="../../static/images/woman.png" mode=""></image> <view v-if="total>query.pageSize">
</view> <uni-load-more :status="loadStatus"></uni-load-more>
<view class="list-index-cen">
<view class="cen-name">
李沐沐
</view>
<view class="cen-text">
收藏了你发布的课程···
</view>
</view>
<view class="list-index-time">
2022/9/20
</view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import apiQa from '@/api/modules/qa.js'
import apiComments from '../../api/modules/comments.js';
import apiUser from '@/api/system/user.js'
export default { export default {
data() { data() {
return { return {
@@ -51,7 +39,32 @@
{name:'系统'}, {name:'系统'},
{name:'@我的'} {name:'@我的'}
], ],
tab:1, tab:0,
data:[],//拿到的数据
total:0,//总条数
loadStatus:'more',//more,loading,noMore
query:{
pageIndex:1,//当前页
type:null,//当前只限于文章
pageSize:10,//条数
},//查询条件
}
},
onLoad() {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
onReachBottom() {
console.log('111111')
this.loadStatus='loading';//more,loading,noMore
if(this.data.length<this.total){
this.query.pageIndex++;
this.findData(false);
this.loadStatus='more'
}else{
this.loadStatus='noMore'
} }
}, },
methods: { methods: {
@@ -60,7 +73,54 @@
}, },
ubtab(num){ ubtab(num){
this.tab = num this.tab = num
} },
findData(flag) {
uni.showLoading({ title: '加载中...' });
if(flag){
this.data=[]
this.pageIndex=1
}
apiComments.pagelist(this.query).then(res=>{
if (res.status == 200) {
this.total=res.result.count;
let ids = [];
if (res.result.list.length != 0) {
res.result.list.forEach(item=>{
ids.push(item.sysCreateAid);
item.authorInfo={avatar:'',name:'',code:'',sex:null};
this.data.push(item)
})
this.loadAuthorInfo(res.result.list,ids);
}
}else{
this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'});
}
uni.hideLoading();
})
},
loadAuthorInfo(list, ids) {
//加载作者信息,头像,机构信息
if (ids.length == 0) {
return;
}
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then(res => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
item.authorInfo = author;
return true;
} else {
return false;
}
});
});
} else {
console.log('加载用户信息失败:' + res.error);
}
});
},
} }
} }
</script> </script>
@@ -72,57 +132,7 @@
.tabs-info{ .tabs-info{
padding: 0 254upx; padding: 0 254upx;
} }
.news-page-btn{
height: 80upx;
padding: 30upx 32upx 0 36upx;
.btn-index{
font-size: 28upx;
color: #666666;
float: right;
margin-left: 20upx;
padding: 6upx 32upx 6upx 28upx;
border: 2upx solid rgba(153,153,153,0.2);
border-radius: 26upx;
}
.btn-index:first-child{
margin-left: 0;
float: left;
}
}
.news-page-list{
padding: 0 32upx 0 36upx;
box-sizing: border-box;
.list-index{
display: flex;
padding: 40upx 0;
border-bottom: 2upx solid rgba(153,153,153,0.1);;
.list-index-img{
width: 80upx;
}
.list-index-cen{
margin-left: 30upx;
width: 100%;
.cen-name{
font-size: 28upx;
font-weight: 500;
color: #333333;
margin-top: 4upx;
}
.cen-text{
font-size: 24upx;
color: #999999;
margin-top: 4upx;
}
}
.list-index-time{
margin-top: 4upx;
width: 130upx;
font-size: 24upx;
color: #999999;
}
}
}
} }
</style> </style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB