Commit 04db8869 by 梁建民

Merge branch 'master' of http://119.23.72.7/shiyu/icsalesProgram

parents de1d5460 188b38a1
......@@ -42,7 +42,8 @@
"pages/person/packet/index",
"pages/person/invitation/index",
"pages/person/invitationrecord/index",
"pages/form/report/index"
"pages/form/report/index",
"pages/list/notice/index"
],
"subPackages": [
{
......
......@@ -341,7 +341,56 @@ image {
.tip-c .pc-url {
color: #61a0f2;
}
/***消息模块的公共样式*/
.message-item {
margin-left: 25rpx;
padding: 24rpx 24rpx 24rpx 0;
}
.message-avar {
height: 68rpx;
width: 68rpx;
border-radius: 50% 50%;
}
.system-avar {
flex: 0 0 68rpx;
background-color: #52cca8;
text-align: center;
line-height: 68rpx;
border-radius: 50% 50%;
}
.system-avar .icon {
font-size: 40rpx;
color: #fff;
}
.message-l-view {
margin-left: 24rpx;
}
.message-c {
color: #515559;
font-size: 28rpx;
}
.message-t {
font-size: 22rpx;
color: #8a9299;
margin-top: 4rpx;
}
.message-r {
font-size: 22rpx;
text-align: right;
}
.message-r-t {
color: #adb6bf;
padding-bottom: 12rpx;
}
.message-t-text{
white-space: normal;
}
/**询报价列表**/
/**字体**/
@import 'res/fonts/iconfont.wxss'
\ No newline at end of file
......@@ -2,7 +2,7 @@
<view class="chat-view {{isShowTip?'':'nopadding'}}">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left">
<view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="tip-c">如实填写申诉信息,以便客服人员进行判断!</text>
</view>
......
<!--pages/form/appeal/index.wxml-->
<view class="appeal-view">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left">
<view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="tip-c">如实填写申诉信息,以便客服人员进行判断!</text>
</view>
......
<!--pages/form/bj/index.wxml-->
<view class="form-view">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left">
<view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="tip-c">请回复真实价格,否则将会影响您的排名</text>
</view>
......
<!--pages/form/good/index.wxml-->
<view class="form-view">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left">
<view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="tip-c">批量商品上传请到<text class="pc-url">www.icsales.com</text>操作</text>
</view>
......
<!--pages/form/rate/index.wxml-->
<view class="rate-form">
<view class="tip row bothSide verCenter tip-error">
<view class="tip-left">
<view class="tip-left row verCenter">
<!-- <text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text> -->
<!-- <text class="tip-c">评论内容,一条回复报价仅评价一次</text> -->
<text class="icon iconfont iconiconxiantiaoshouji1 tip-icon error-icon"></text>
......
<!--pages/form/xj/index.wxml-->
<view class="form-view">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left">
<view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="tip-c">填写完整信息,有利于提高回复报价效率</text>
</view>
......
// pages/list/notice/index.js
import {
judgeToken,
getData,
interval,
matchReg
} from '../../../utils/util.js';
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
tabIndex: 1, //导航初始化
messageList: null, //商品数据
limit: 10, //每页的条数
p: 1, //当前页面
total: 1,
isShowBottom: false,
unreadSys: 0,
unreadAct: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getData();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
},
onReachBottom: function() {
let allPage = Math.ceil(this.data.total / this.data.limit);
let p = this.data.p;
if (p == allPage) {
this.setData({
isShowBottom: true
});
return
} else {
this.setData({
p: p + 1
});
this.getData();
}
},
getData: function() {
let me = this;
let token = wx.getStorageSync('access_token') || '';
let params = {
limit: me.data.limit,
page: me.data.p,
"token": token
};
let url = me.data.tabIndex == 1 ? apis.userActmsg : apis.userSysmsg;
let nowDate = Date.parse(new Date());
getData(url, 'get', params, function(res) {
if (res.errcode === 0) {
let newArr = [];
let arr = me.data.tabIndex == 1 ? res.data['act_msg'].data : res.data['sys_msg'].data;
if (me.data.p > 1) {
newArr = me.data.messageList;
}
newArr = newArr.concat(arr);
for (let i = 0; i < newArr.length; i++) {
let etime = Date.parse(new Date(newArr[i]['create_time']));
newArr[i].content = matchReg(newArr[i].content);
newArr[i].create_time = interval(nowDate - etime);
}
me.setData({
messageList: newArr,
total: me.data.tabIndex == 1 ? res.data['act_msg'].count : res.data['sys_msg'].count,
unreadSys: res.data.sys_unread_msg,
unreadAct: res.data.act_unread_msg
});
} else {
if (me.data.p == 1) {
me.setData({
messageList: [],
unreadSys: 0,
unreadAct: 0
})
}
}
}, true)
},
switchTab: function(e) {
let i = e.currentTarget.dataset.index;
if (i == this.data.tabIndex) {
return
} else {
this.setData({
messageList: null,
p: 1,
total: 1,
tabIndex: i,
isShowBottom: false,
});
this.getData();
}
},
readMessage: function(e) {
let id = e.currentTarget.dataset.id;
let index = e.currentTarget.dataset.index;
let status = 'messageList[' + index + '].status';
if (this.data.messageList[index].status == 0) {
this.markmsg(id);
this.setData({
[status]: 1
});
let newArr = this.data.messageList.filter(function(item) {
if (item.status == 0) {
return item;
}
});
if (newArr.length == 0) {
if (this.data.tabIndex == 1) {
this.setData({
unreadAct: 0
});
} else {
this.setData({
unreadSys: 0
})
}
}
}
},
markmsg: function(id) {
let token = wx.getStorageSync('access_token') || '';
getData(apis.userMarkmsg, 'get', {
token: token,
log_id: id
}, function(res) {}, false)
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "消息通知"
}
\ No newline at end of file
<!--pages/list/notice/index.wxml-->
<view class="notice-view">
<view class="switch-tab-com row notice-tab">
<view bindtap="switchTab" class="{{tabIndex == 1&&'active'}}" data-index="1">
<text>业务消息</text>
<text class="nav-dian dian" wx:if="{{unreadAct}}"></text>
<text class="active-bg"></text>
</view>
<view bindtap="switchTab" class="{{tabIndex == 2&&'active'}}" data-index="2">
<text>系统通知</text>
<text class="nav-dian dian" wx:if="{{unreadSys}}"></text>
<text class="active-bg"></text>
</view>
</view>
<view class="notice-content">
<view wx:if="{{messageList&&messageList.length==0}}" class="nodata">
<image src="/res/images/imgs/noxb.png" class="img"></image>
<view class="h3 bold">暂无数据</view>
</view>
<view wx:if="{{messageList&&messageList.length!==0}}" wx:for="{{messageList}}" wx:key="{{index}}" bindtap="readMessage" data-id="{{item.log_id}}" hover-class="hoverClass" data-index="{{index}}">
<view class="message-item px-hr-bottom row bothSide nowrap">
<view class="message-l row ellipsis">
<view class="message-avar system-avar">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
</view>
<view class="message-l-view ellipsis">
<view class="message-c bold">
<text class="message-title ellipsis">{{item.title||''}}<text class="title-dian dian" wx:if="{{item.status == 0}}"></text>
</text>
</view>
<view class="message-t">
<text class="message-t-text">{{item.content||''}}</text>
</view>
</view>
</view>
<view class="message-r">
<view class="message-r-t">{{item.create_time}}</view>
</view>
</view>
</view>
<view class="data-bottom row verCenter rowCenter" wx:if="{{isShowBottom}}">
<text class="line"></text>
<text class="text">我是有底线的</text>
<text class="line"></text>
</view>
</view>
</view>
\ No newline at end of file
/* pages/list/notice/index.wxss */
.notice-view{
box-sizing: border-box;
padding-top: 88rpx;
}
.notice-tab{
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #fff;
z-index: 2;
}
.dian {
position: absolute;
height: 16rpx;
width: 16rpx;
background-color: #f03737;
border-radius: 50%;
}
.system-avar{
background-color: #EAA217
}
.message-title{
position: relative;
display: inline-block;
max-width:100%;
padding-right:22rpx;
box-sizing: border-box;
}
.nav-dian {
top: 25rpx;
right: 100rpx;
}
.title-dian {
top: 0;
right: 0;
}
.hoverClass{
background-color: #F5F9FC;
}
// pages/tab/home/home.js
import {
getData,
judgeToken
judgeToken,
interval
} from '../../../utils/util.js';
import {
apis
......@@ -51,7 +52,7 @@ Page({
let nowDate = Date.parse(new Date());
for (let i = 0; i < newArr.length; i++) {
let etime = newArr[i].add_time * 1000;
let usedTime = me.interval(nowDate - etime);
let usedTime = interval(nowDate - etime);
newArr[i].usedTime = usedTime
}
me.setData({
......@@ -115,32 +116,6 @@ Page({
}, bool)
}
},
interval: function(usedTime) {
let days = Math.floor(usedTime / (24 * 3600 * 1000));
//计算出小时数
let leave1 = usedTime % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000));
if (days) {
return days + "天前";
} else {
if (hours) {
if (minutes) {
return hours + "小时" + minutes + "分钟前";
} else {
return hours + "小时前";
}
} else {
if (minutes) {
return minutes + "分钟前";
} else {
return '刚刚';
}
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......
......@@ -2,8 +2,15 @@
let disp = require("../../../utils/broadcast");
let WebIM = require("../../../utils/WebIM")["default"];
import {
judgeToken
judgeToken,
getData,
interval,
matchReg
} from '../../../utils/util.js';
import {
apis
} from '../../../utils/api.js';
Page({
/**
......@@ -14,30 +21,32 @@ Page({
userId: "",
customer: {},
isCustomer: true,
isShowTip: true
isShowTip: true,
count: 0,
sysObj: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
if (judgeToken(true)) {
let me = this;
let my = wx.getStorageSync("myUsername");
//监听未读消息数
disp.on("em.xmpp.unreadspot", function(message) {
disp.on("em.xmpp.unreadspot", function (message) {
if (getApp().globalData.customerNum != my) {
me.getCustom();
}
me.setData({
arr: me.getChatList()
});
});
}
},
getCustom: function() {
getCustom: function () {
let my = wx.getStorageSync("myUsername");
let companyName = wx.getStorageSync("company_name") || '';
let userId = wx.getStorageSync("user_id") || '';
......@@ -110,7 +119,7 @@ Page({
return array;
},
into_singleChatRoom: function(detail) {
into_singleChatRoom: function (detail) {
let my = wx.getStorageSync("myUsername");
let nameList = {
myName: my,
......@@ -127,14 +136,14 @@ Page({
url: "/pages/detail/chat/index?username=" + JSON.stringify(nameList)
});
},
into_chatRoom: function(event) {
into_chatRoom: function (event) {
let detail = event.currentTarget.dataset.item;
this.into_singleChatRoom(detail)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
onReady: function () {
},
......@@ -142,8 +151,10 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function () {
let my = wx.getStorageSync("myUsername");
let token = wx.getStorageSync('access_token') || '';
this.getSys(token)
if (getApp().globalData.customerNum != my) {
this.getCustom();
this.setData({
......@@ -163,44 +174,98 @@ Page({
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
},
getSys: function (token) {
let me = this;
getData(apis.userSysmsg, 'get', {
token: token,
"limit": 1,
"page": 1,
}, function (res) {
if (res.errcode == 0) {
me.setData({
count: res.data.act_unread_msg + res.data.sys_unread_msg
});
me.getAct(token, res.data['sys_msg'].data)
}
}, true)
},
getAct: function (token, sysarr) {
let me = this;
getData(apis.userActmsg, 'get', {
token: token,
"limit": 1,
"page": 1,
}, function (res) {
if (res.errcode == 0) {
let actarr = res.data['act_msg'].data;
let nowDate = Date.parse(new Date());
let etime, text;
if (!sysarr.length && !actarr.length) {
return
} else if (sysarr.length && !actarr.length) {
etime = Date.parse(new Date(sysarr[0]['create_time']));
text = sysarr[0].content
} else if (!sysarr.length && actarr.length) {
etime = Date.parse(new Date(actarr[0]['create_time']));
text = actarr[0].content
} else {
let sysTime = Date.parse(new Date(sysarr[0]['create_time']));
let actTime = Date.parse(new Date(actarr[0]['create_time']));
if (sysTime > actTime) {
etime = sysTime;
text = sysarr[0].content
} else {
etime = actTime;
text = actarr[0].content
}
};
me.setData({
sysObj: {
text: matchReg(text),
time: interval(nowDate - etime)
}
})
}
}, false)
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
onShareAppMessage: function () {
},
deleteChatItem: function(e) { //拉黑
deleteChatItem: function (e) { //拉黑
this.del_chat(e, 2)
},
deleteChat: function(e) { //删除记录
deleteChat: function (e) { //删除记录
this.del_chat(e, 1)
},
del_chat: function(event, type) {
del_chat: function (event, type) {
let detail = event.currentTarget.dataset.item;
let your = detail.username;
let myName = wx.getStorageSync("myUsername");
......@@ -209,7 +274,7 @@ Page({
wx.showModal({
title: title,
confirmText: "确定",
success: function(res) {
success: function (res) {
if (res.confirm) {
if (type == 1) {
let member = wx.getStorageSync('member');
......@@ -233,7 +298,7 @@ Page({
WebIM.conn.addToBlackList({
list: list,
type: 'jid',
success: function() {
success: function () {
let member = wx.getStorageSync('member');
let index = member.indexOf(your);
member.splice(index, 1);
......@@ -245,7 +310,7 @@ Page({
}
disp.fire("em.chat.session.remove");
},
error: function() {
error: function () {
wx.showToast({
title: '加入黑名单失败',
icon: 'none',
......@@ -258,12 +323,17 @@ Page({
}
},
fail: function(err) {}
fail: function (err) { }
});
},
closeTip: function() {
closeTip: function () {
this.setData({
isShowTip: false
})
},
toSys: function () {
wx.navigateTo({
url: "/pages/list/notice/index"
});
}
})
\ No newline at end of file
<!--pages/tab/message/message.wxml-->
<scroll-view scroll-y="true" class="message-view">
<view class="nodata" wx:if="{{arr.length==0&&isCustomer}}">
<!-- <view class="nodata" wx:if="{{arr.length==0&&isCustomer}}">
<image src="/res/images/imgs/nomessage.png" class="img"></image>
<view class="h3 bold">暂无询价消息</view>
</view>
</view> -->
<view class="message-content" wx:if="{{!isCustomer||arr.length}}">
<view class="tip row bothSide verCenter {{isShowTip?'':'noheight'}}">
<view class="tip-left">
<view class="tip-left row verCenter">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="tip-c">风险提示文字风险提示文字风险提示文字风险</text>
</view>
<text class="icon iconfont iconiconxiantiaoshouji13 close-icon" bindtap="closeTip"></text>
</view>
<view bindtap="toSys">
<view class="message-item row bothSide nowrap">
<view class="message-l row ellipsis">
<view class="message-avar system-avar">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
</view>
<view class="message-l-view ellipsis">
<view class="message-c bold ellipsis">系统消息</view>
<view class="message-t ellipsis">{{sysObj.text}}</view>
</view>
</view>
<view class="message-r">
<view class="message-r-t">{{sysObj.time}}</view>
<view class="message-r-n system-count" wx:if="{{ count > 0 || count == '99+' }}">{{count}}</view>
</view>
</view>
</view>
<view class="message-list">
<view catchtap="into_chatRoom" data-item="{{customer}}" wx:if="{{!isCustomer}}">
<view class="message-item px-hr-bottom row bothSide nowrap">
......
......@@ -11,42 +11,6 @@ page{
overflow: hidden;
}
.message-item {
margin-left: 25rpx;
padding: 24rpx 24rpx 24rpx 0;
}
.message-avar {
height: 68rpx;
width: 68rpx;
border-radius: 50% 50%;
}
.message-l-view {
margin-left: 24rpx;
}
.message-c {
color: #515559;
font-size: 28rpx;
}
.message-t {
font-size: 22rpx;
color: #8a9299;
margin-top: 4rpx;
}
.message-r {
font-size: 22rpx;
text-align: right;
}
.message-r-t {
color: #adb6bf;
padding-bottom: 12rpx;
}
.message-r-n {
color: #fff;
padding: 0rpx 10rpx;
......@@ -54,3 +18,9 @@ page{
display: inline;
background-color: #fc4c4c;
}
.system-count{
background-color: #0D84D1;
}
.message-list{
border-top:10rpx solid #F5F9FC;
}
\ No newline at end of file
......@@ -48,7 +48,7 @@
"list": []
},
"miniprogram": {
"current": 23,
"current": 25,
"list": [
{
"id": -1,
......@@ -215,6 +215,20 @@
"id": -1,
"name": "pages/person/auth/index",
"pathName": "pages/person/auth/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/list/notice/index",
"pathName": "pages/list/notice/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/tab/home/home",
"pathName": "pages/tab/home/home",
"scene": null
}
]
......
......@@ -195,6 +195,18 @@ const apis = {
* 获取热门搜索商品
*/
hotgoods: home_url + '/hotgoods',
/**
* 获取会员系统通知
*/
userSysmsg: user_url + '/user/sysmsg',
/**
* 获取会员活动通知
*/
userActmsg: user_url + '/user/actmsg',
/**
* 标记会员通知(已读)
*/
userMarkmsg: user_url + '/user/markmsg'
}
......
......@@ -280,12 +280,44 @@ const judgeToken = (boolen) => {
return false;
}
};
const interval = (usedTime) => {
let days = Math.floor(usedTime / (24 * 3600 * 1000));
//计算出小时数
let leave1 = usedTime % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
let hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
let minutes = Math.floor(leave2 / (60 * 1000));
if (days) {
return days + "天前";
} else {
if (hours) {
if (minutes) {
return hours + "小时" + minutes + "分钟前";
} else {
return hours + "小时前";
}
} else {
if (minutes) {
return minutes + "分钟前";
} else {
return '刚刚';
}
}
}
}
const matchReg = (str)=>{
let reg = /<\/?.+?\/?>/g;
let newStr = str.replace(reg, '');
return newStr
}
module.exports = {
getData: getData,
chooseImg: chooseImg,
tips: tips,
changeTime: changeTime,
dataEncryption: dataEncryption,
judgeToken: judgeToken
judgeToken: judgeToken,
interval: interval,
matchReg: matchReg
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment