Authored by QC-L

1. 修改消息列表页面展示的逻辑,取消掉自动调整登录页面 2. 添加消息详情为空的界面展示 review by 黄敬囿

... ... @@ -120,9 +120,10 @@ class App extends Component {
}).catch(error => {
console.log(error);
});
event.on('user-is-login', (loginedCallBack, loginSuccess) => {
let userInfo = Taro.getStorageSync('userInfo');
if (userInfo && userInfo.uid && userInfo.session_key) {
let userInfo = Taro.getStorageSync('userInfo');
if (userInfo && userInfo.uid && userInfo.session_key) {
if (loginedCallBack) {
loginedCallBack();
}
... ... @@ -138,6 +139,20 @@ class App extends Component {
});
}
});
event.on('judge-user-is-login', (isLogined, isLoginCallback) => {
let userInfo = Taro.getStorageSync('userInfo');
if (userInfo && userInfo.uid && userInfo.session_key) {
if (isLogined) {
isLogined(true);
isLoginCallback();
}
} else {
if (isLogined) {
isLogined(false);
}
}
});
}
componentDidHide () {}
... ...
// src/components/no-data-show-view/no-data-show-view.js
import router from '../../router/index.js'
Component({
/**
* 组件的属性列表
*/
properties: {
emptyText: {
type: String,
value: '这里什么都没有...'
},
isLogin: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
goToLogin() {
router.go('nativeLogin');
}
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--src/components/no-data-show-view/no-data-show-view.wxml-->
<view class='no-data'>
<image class='no-data-image' src='../../assets/images/no-data@3x.png'></image>
<text class='no-data-text'>{{emptyText}}</text>
<block wx:if="isLogin">
<text class='no-data-text no-data-btn' bindtap='goToLogin'>登录后查看更多</text>
</block>
</view>
... ...
/* src/components/no-data-show-view/no-data-show-view.wxss */
.no-data {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.no-data .no-data-image {
width: 280rpx;
height: 280rpx;
margin-bottom: 20rpx;
}
.no-data .no-data-text {
font-size: 28rpx;
color: #CCCCCC;
}
.no-data .no-data-btn {
margin-top: 20rpx;
line-height: 88rpx;
color: #fff;
text-align: center;
background-color: #000;
border-radius: 20rpx;
width: 300rpx;
}
\ No newline at end of file
... ...
... ... @@ -16,6 +16,7 @@ Page({
currentPage: 1,
messageList: [],
},
isLogined: false,
},
/**
... ... @@ -118,17 +119,19 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
event.emit('user-is-login', this.isLoginCallback, this.loginSuccess);
event.emit('judge-user-is-login', this.isJudgeLogined, this.isLoginCallback);
},
isLoginCallback() {
console.log('已经登录');
this.fetchMessageTypeInfo();
this.fetchNewMessageList();
},
loginSuccess() {
console.log('登录成功');
isJudgeLogined(isLogined) {
console.log(isLogined);
this.setData({
isLogined
})
},
/**
... ...
{
"navigationBarBackgroundColor": "#ffffff"
"navigationBarBackgroundColor": "#ffffff",
"usingComponents": {
"no-data-show-view": "../../../components/no-data-show-view/no-data-show-view"
}
}
\ No newline at end of file
... ...
... ... @@ -2,33 +2,39 @@
<view class="message-title">
<text class='message-title'>消息</text>
</view>
<!-- 三个通知 -->
<view class='message-header'>
<block wx:for="{{messageTypeList}}" wx:key="{{index}}">
<view class="type-item" data-item="{{item}}" bindtap="navToDetail">
<view class="iconfont">
<image src="{{item.imgUrl}}" class="icon-image"></image>
<view class='red-point' hidden='{{item.unReadCount?false:true}}'>
<view wx:if="{{item.unReadCount < 10}}" class='normal-red-point'>{{item.unReadCount}}</view>
<view wx:else class='long-red-point'>{{item.unReadCount}}</view>
<block wx:if="{{isLogined}}">
<!-- 三个通知 -->
<view class='message-header'>
<block wx:for="{{messageTypeList}}" wx:key="{{index}}">
<view class="type-item" data-item="{{item}}" bindtap="navToDetail">
<view class="iconfont">
<image src="{{item.imgUrl}}" class="icon-image"></image>
<view class='red-point' hidden='{{item.unReadCount?false:true}}'>
<view wx:if="{{item.unReadCount < 10}}" class='normal-red-point'>{{item.unReadCount}}</view>
<view wx:else class='long-red-point'>{{item.unReadCount}}</view>
</view>
</view>
{{item.description}}
</view>
{{item.description}}
</view>
</block>
</view>
</block>
</view>
<view class='latest-message'>最新消息</view>
<view class='latest-message'>最新消息</view>
<!-- 消息列表 -->
<view class='message-list'>
<block wx:for="{{messageInfo.messageList}}" wx:key="{{index}}">
<view class='cell'>
<view class='content'>{{item.content}}</view>
<view class='time'>{{item.createTime}}</view>
<view class='space-line'></view>
</view>
</block>
</view>
<!-- 消息列表 -->
<view class='message-list'>
<block wx:for="{{messageInfo.messageList}}" wx:key="{{index}}">
<view class='cell'>
<view class='content'>{{item.content}}</view>
<view class='time'>{{item.createTime}}</view>
<view class='space-line'></view>
</view>
</block>
</view>
</block>
<block wx:else>
<view class='empty'>
<no-data-show-view isLogin="{{true}}"></no-data-show-view>
</view>
</block>
</view>
\ No newline at end of file
... ...
... ... @@ -94,4 +94,15 @@
background-color: #eee;
margin-top: 20rpx;
height: 2rpx;
}
.empty {
display: flex;
justify-content: center;
font-family: PingFang-SC-Regular;
color: #999;
font-size: 30rpx;
letter-spacing: 0.8px;
margin-top: 300rpx;
height: 80%;
}
\ No newline at end of file
... ...
{
"navigationBarBackgroundColor": "#ffffff"
"navigationBarBackgroundColor": "#ffffff",
"usingComponents": {
"no-data-show-view": "../../../components/no-data-show-view/no-data-show-view"
}
}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,8 @@
</view>
</block>
</view>
<view wx:else class='empty'>暂无数据</view>
<view wx:else class='empty'>
<no-data-show-view></no-data-show-view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -40,4 +40,5 @@
font-size: 30rpx;
letter-spacing: 0.8px;
margin-top: 300rpx;
height: 100%;
}
\ No newline at end of file
... ...
... ... @@ -37,4 +37,7 @@ export default {
filter: {
path: '/pages/filter/index'
},
nativeLogin: {
path: '/pages/nativeLogin/nativeLogin'
}
}
\ No newline at end of file
... ...