Преглед на файлове

3 修复底部tabbar收到消息 & 有未读消息时 右上角有个小红点。

4 更换底部tabbar选中时的ICON
release/210823_需求对对碰
王饶冀 преди 3 години
родител
ревизия
ce39943d13
променени са 6 файла, в които са добавени 52 реда и са изтрити 40 реда
  1. 30
    18
      components/tabbar/tabbar.js
  2. Двоични данни
      images/tabbar/home-bar-selected.png
  3. Двоични данни
      images/tabbar/msg-bar-selected.png
  4. Двоични данни
      images/tabbar/my-bar-selected.png
  5. Двоични данни
      images/tabbar/release-bar-selected.png
  6. 22
    22
      pages/msgModule/index.js

+ 30
- 18
components/tabbar/tabbar.js Целия файл

@@ -1,5 +1,6 @@
// components/tabbar/tabbar.js
const app = getApp()
const $request = require('../../utils/request.js');
Component({
/**
* 组件的属性列表
@@ -21,26 +22,26 @@ Component({
text: "首页",
pagePath: "/pages/index/index",
iconPath: "/images/tabbar/home-bar.png",
selectedIconPath: "/images/tabbar/home-bar.png",
selectedIconPath: "/images/tabbar/home-bar-selected.png",
},
{
text: "发布需求",
pagePath: "/pages/releaseModule/index",
iconPath: "/images/tabbar/release-bar.png",
selectedIconPath: "/images/tabbar/release-bar.png",
selectedIconPath: "/images/tabbar/release-bar-selected.png",
},
{
text: "消息",
pagePath: "/pages/msgModule/index",
iconPath: "/images/tabbar/msg-bar.png",
selectedIconPath: "/images/tabbar/msg-bar.png",
selectedIconPath: "/images/tabbar/msg-bar-selected.png",
dot: false,
},
{
text: "我的",
pagePath: "/pages/myModule/index",
iconPath: "/images/tabbar/my-bar.png",
selectedIconPath: "/images/tabbar/my-bar.png",
selectedIconPath: "/images/tabbar/my-bar-selected.png",
},
]
},
@@ -56,30 +57,41 @@ Component({
customerId: businessCommunicationCustomer.customerId
})
}
// 获取当前路由,如果是消息页的话要把消息的红点取消
this.getCurrentRouter();

// 如果 websocket 没有连接,连接
if (!app.globalData.isOnSocketOpen) {
this.initWebSocket();
}

// let _this = this;
let tiems = setInterval(() => {
// 如果此时openid已被赋值
if (!!app.globalData.openid) {
this.getChatRecordTable();
clearInterval(tiems)
}
}, 500);
},
/**
* 组件的方法列表
*/
methods: {
// 获取当前路由
getCurrentRouter() {
let pages = getCurrentPages();
let currentPage = null;
if (pages.length) {
currentPage = pages[pages.length - 1];
}
// 如果是消息页,置空红点
if (currentPage.route == "pages/msgModule/index") {
this.setListDot(false);
}
getChatRecordTable() {
this.setListDot(false);
$request.get('/businessCommunicationDemand/getChatRecordTable.action').then(res => {
// console.log(res,'res');
if(res.status == 0){
let chatRecordTable = res.data.chatRecordTable;
let sum = 0;
chatRecordTable.forEach(el=>{
sum += el.size;
})
if(sum > 0){
this.setListDot(true);
}
}
}).catch(err=>{
console.log(err);
})
},
// init websocket
initWebSocket() {

Двоични данни
images/tabbar/home-bar-selected.png Целия файл


Двоични данни
images/tabbar/msg-bar-selected.png Целия файл


Двоични данни
images/tabbar/my-bar-selected.png Целия файл


Двоични данни
images/tabbar/release-bar-selected.png Целия файл


+ 22
- 22
pages/msgModule/index.js Целия файл

@@ -118,8 +118,8 @@ Page({
this.getMsgData();
},
getMsgData() {
let { page, size } = this.data;
$request.get('/businessCommunicationDemand/getChatRecordTable.action', { page, size }).then(res => {
// let { page, size } = this.data;
$request.get('/businessCommunicationDemand/getChatRecordTable.action').then(res => {
let tempListData = this.data.msgData;
if (res.status == 0) {
let datas = res.data;
@@ -137,20 +137,20 @@ Page({
msgData: tempListData,
total: datas.total,
})
// 如果数据大于了返回的总数
if (tempListData.length >= this.data.total) {
// 停止累加数据
this.setData({
onRefresh: false,
itemLoading: false,
})
} else {
this.setData({
onRefresh: true,
itemLoading: false,
page: page + 1
})
}
// // 如果数据大于了返回的总数
// if (tempListData.length >= this.data.total) {
// // 停止累加数据
// this.setData({
// onRefresh: false,
// itemLoading: false,
// })
// } else {
// this.setData({
// onRefresh: true,
// itemLoading: false,
// page: page + 1
// })
// }
console.log('-------------消息 beg-------------------')
console.log(this.data.msgData);
console.log('-------------消息 end-------------------')
@@ -167,12 +167,12 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if (this.data.onRefresh) {
this.setData({
itemLoading: true
})
this.getListData();
}
// if (this.data.onRefresh) {
// this.setData({
// itemLoading: true
// })
// this.getListData();
// }
},
// 去关注
followApplets() {

Loading…
Отказ
Запис