|
@@ -27,7 +27,7 @@ export const hotInit = (that) => {
|
|
// circular: true
|
|
// circular: true
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
+ }
|
|
// 搜索方法
|
|
// 搜索方法
|
|
that.searchHandler = () => {
|
|
that.searchHandler = () => {
|
|
if (that.data.hotInput.lenght !== 0) {
|
|
if (that.data.hotInput.lenght !== 0) {
|
|
@@ -135,12 +135,15 @@ export const hotInit = (that) => {
|
|
console.log(that.data.hotData.hotWorks.length)
|
|
console.log(that.data.hotData.hotWorks.length)
|
|
if (that.data.hotData.hotWorks.length > 0) {
|
|
if (that.data.hotData.hotWorks.length > 0) {
|
|
const myCourseStr = 'hotData.myCourse'
|
|
const myCourseStr = 'hotData.myCourse'
|
|
- const unReadMessageNum = 'hotData.unReadMessageNum'
|
|
|
|
- console.log(recommendRes)
|
|
|
|
|
|
+ const isMessageNormal = 'hotData.isMessageNormal'
|
|
|
|
+ const unReadMessageContent = 'hotData.unReadMessageContent'
|
|
|
|
+ // unread为true时显示 未读消息,unread为false时显示通知消息,并且通知消息不可读
|
|
that.setData({
|
|
that.setData({
|
|
[myCourseStr]: recommendRes.myCourse,
|
|
[myCourseStr]: recommendRes.myCourse,
|
|
- [unReadMessageNum]: recommendRes.unreadCount
|
|
|
|
|
|
+ [isMessageNormal]: recommendRes.unread,
|
|
|
|
+ [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.content : recommendRes.annunciateMsg.content,
|
|
})
|
|
})
|
|
|
|
+
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
recommendRes.hotReader.forEach(item => {
|
|
recommendRes.hotReader.forEach(item => {
|
|
@@ -153,31 +156,32 @@ export const hotInit = (that) => {
|
|
temp.classId = item.userRead.id;
|
|
temp.classId = item.userRead.id;
|
|
temp.time = formatDate(item.userRead.gmtCreated, 3);
|
|
temp.time = formatDate(item.userRead.gmtCreated, 3);
|
|
temp.avatar = item.user ? item.user.avatar : '';
|
|
temp.avatar = item.user ? item.user.avatar : '';
|
|
- temp.profession = item.user ? item.user.profession : '';
|
|
|
|
- temp.uid = item.user ? item.user.uid : '';
|
|
|
|
|
|
+ temp.profession = item.user ? item.user.profession : '';
|
|
|
|
+ temp.uid = item.user ? item.user.uid : '';
|
|
// temp.avatar = item.user.avatar;
|
|
// temp.avatar = item.user.avatar;
|
|
- temp.nickName = item.user ? item.user.wechatName : '';
|
|
|
|
|
|
+ temp.nickName = item.user ? item.user.wechatName : '';
|
|
// recommendWorks.push(temp);
|
|
// recommendWorks.push(temp);
|
|
that.data.hotData.hotWorks.push(temp);
|
|
that.data.hotData.hotWorks.push(temp);
|
|
});
|
|
});
|
|
const hotStr = 'hotData.hotWorks'
|
|
const hotStr = 'hotData.hotWorks'
|
|
const myCourseStr = 'hotData.myCourse'
|
|
const myCourseStr = 'hotData.myCourse'
|
|
- const unReadMessageNum = 'hotData.unReadMessageNum'
|
|
|
|
- console.log(recommendRes)
|
|
|
|
|
|
+ const isMessageNormal = 'hotData.isMessageNormal'
|
|
|
|
+ const unReadMessageContent = 'hotData.unReadMessageContent'
|
|
that.setData({
|
|
that.setData({
|
|
[hotStr]: that.data.hotData.hotWorks,
|
|
[hotStr]: that.data.hotData.hotWorks,
|
|
[myCourseStr]: recommendRes.myCourse,
|
|
[myCourseStr]: recommendRes.myCourse,
|
|
- [unReadMessageNum]: recommendRes.unreadCount,
|
|
|
|
|
|
+ [isMessageNormal]: recommendRes.unread,
|
|
|
|
+ [unReadMessageContent]: recommendRes.unread ? recommendRes.unreadMsg.content : recommendRes.annunciateMsg.content,
|
|
unfinishedCount: recommendRes.unfinishedCount
|
|
unfinishedCount: recommendRes.unfinishedCount
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
- that.getHotRecommendSecond = (uid,pageNo,pageSize) =>{
|
|
|
|
- httpRequestApi.getHotRecommendSecond(uid,pageNo,pageSize).success(res => {
|
|
|
|
|
|
+ that.getHotRecommendSecond = (uid, pageNo, pageSize) => {
|
|
|
|
+ httpRequestApi.getHotRecommendSecond(uid, pageNo, pageSize).success(res => {
|
|
console.log(res)
|
|
console.log(res)
|
|
const recommendRes = res.data.data.list;
|
|
const recommendRes = res.data.data.list;
|
|
- if(recommendRes.length === 0) return;
|
|
|
|
|
|
+ if (recommendRes.length === 0) return;
|
|
// const recommendWorks = [];
|
|
// const recommendWorks = [];
|
|
recommendRes.forEach(item => {
|
|
recommendRes.forEach(item => {
|
|
const temp = {};
|
|
const temp = {};
|
|
@@ -231,7 +235,7 @@ export const hotInit = (that) => {
|
|
}
|
|
}
|
|
console.log(that.data.hotData.recommend)
|
|
console.log(that.data.hotData.recommend)
|
|
|
|
|
|
- if(wx.getStorageSync('uid')){
|
|
|
|
|
|
+ if (wx.getStorageSync('uid')) {
|
|
that.getIndex();
|
|
that.getIndex();
|
|
that.getHotRecommend(wx.getStorageSync('uid'));
|
|
that.getHotRecommend(wx.getStorageSync('uid'));
|
|
}
|
|
}
|