Commit 17251502 by 施宇

1111

parent dfddc2da
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
"pages/form/report/index", "pages/form/report/index",
"pages/list/notice/index", "pages/list/notice/index",
"pages/person/notice/index", "pages/person/notice/index",
"pages/person/helpfriend/index" "pages/person/helpfriend/index",
"pages/list/blacklist/index"
], ],
"subPackages": [ "subPackages": [
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<block> <block>
<!-- 询报价展示 --> <!-- 询报价展示 -->
<block wx:if="{{priceType==1}}"> <block wx:if="{{priceType==1}}">
<view class="price-item" wx:for="{{priceList}}" wx:key="{{index}}" bindtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="1"> <view class="price-item" wx:for="{{priceList}}" wx:key="{{index}}" bindtap="emitevent" data-inquiryitemsid="{{item['inquiry_items_id']}}" data-offerid="{{item['offer_id']}} " data-type="{{xb}}" data-pricetype="1" data-isclick="{{isClick}}">
<view class="item-header px-hr-bottom row verCenter bothSide nowrap"> <view class="item-header px-hr-bottom row verCenter bothSide nowrap">
<view class="row verCenter"> <view class="row verCenter">
<text class="mark xun" wx:if="{{xb==1}}">询</text> <text class="mark xun" wx:if="{{xb==1}}">询</text>
......
...@@ -47,11 +47,11 @@ Component({ ...@@ -47,11 +47,11 @@ Component({
}) })
} }
} else { // 左滑 显示删除 } else { // 左滑 显示删除
if (Math.abs(this.data.translateX) >= 320) { if (Math.abs(this.data.translateX) >= 160) {
return return
} else { } else {
this.setData({ this.setData({
translateX: -320 translateX: -160
}) })
} }
} }
......
<view class='swipedelete-wrapper' bindtouchmove='touchMoveHandler' bindtouchstart='touchStartHandler' style="transform:translateX({{translateX}}rpx)"> <view class='swipedelete-wrapper' bindtouchmove='touchMoveHandler' bindtouchstart='touchStartHandler' style="transform:translateX({{translateX}}rpx)">
<slot></slot> <slot></slot>
<view class='swipedelete-btn' bindtap='deleteItem'>拉入黑名单</view> <!-- <view class='swipedelete-btn' bindtap='deleteItem'>拉入黑名单</view> -->
<view class='delete-btn' bindtap='deleteChat'>删除聊天</view> <view class='delete-btn' bindtap='deleteChat'>删除聊天</view>
</view> </view>
\ No newline at end of file
...@@ -201,7 +201,7 @@ Page({ ...@@ -201,7 +201,7 @@ Page({
this.getListData(false, false) this.getListData(false, false)
} }
} else { } else {
priceType = 3; priceType = 1;
xb = 2; xb = 2;
this.setData({ this.setData({
priceType: priceType, priceType: priceType,
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<image src="/res/images/imgs/noxb.png" class="img"></image> <image src="/res/images/imgs/noxb.png" class="img"></image>
<view class="h3 bold"> <view class="h3 bold">
<text wx:if="{{isShowData}}">暂无数据</text> <text wx:if="{{isShowData}}">暂无数据</text>
<text wx:else="{{isShowData}}">当前信息不展示</text> <text wx:else>当前信息不展示</text>
</view> </view>
</view> </view>
<priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="{{priceType}}" xb="{{xb}}" is-click="{{isClick}}"></priceItem> <priceItem price-list="{{priceList}}" wx:if="{{priceList&&priceList.length!==0}}" price-type="{{priceType}}" xb="{{xb}}" is-click="{{isClick}}"></priceItem>
......
// pages/list/blacklist/index.js
import {
getData,
} from '../../../utils/util.js';
import {
apis
} from '../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
blackList: null,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getBlackList()
},
getBlackList:function(){
let token = wx.getStorageSync('access_token') || '';
let me = this;
getData(apis.imBlackList, 'get', {
"token": token,
}, function (res) {
if (res.errcode == 0) {
me.setData({
blackList:res.data
})
} else {
me.setData({
blackList: []
})
}
}, true)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "黑名单"
}
\ No newline at end of file
<!--pages/list/blacklist/index.wxml-->
<view class="blacklist-view">
<view class="black-list" wx:if="{{blackList&&blackList.length!==0}}">
<view class="black-item px-hr-bottom row verCenter" wx:for="{{blackList}}" wx:key="{{index}}">
<view class="pic">
<image src="{{item.avatar||'/res/images/imgs/heads.png'}}" class="company-img"></image>
</view>
<view class="black-right column">
<text class="bold name">{{item.company_name||''}}</text>
<text class="time">{{item.update_time||''}}</text>
</view>
</view>
</view>
<view wx:if="{{blackList&&blackList.length==0}}" class="nodata">
<image src="/res/images/imgs/noxb.png" class="img"></image>
<view class="h3 bold">
<text>暂无数据</text>
</view>
</view>
</view>
\ No newline at end of file
/* pages/list/blacklist/index.wxss */
.black-item {
margin-left: 25rpx;
padding: 25rpx 25rpx 25rpx 0;
}
.pic {
flex: 0 0 68rpx;
height: 68rpx;
background: #E6ECF2;
margin-right: 25rpx;
border-radius: 50% 50%;
}
.company-img {
width:100%;
height:100%;
border-radius: 50% 50%;
}
.black-right {
flex: 1;
}
.name {
color: #515559;
font-size: 28rpx;
}
.time {
color: #adb6bf;
font-size: 22rpx;
margin-top: 4rpx;
}
<view class="setting" hover-class="none" hover-stop-propagation="false"> <view class="setting" hover-class="none" hover-stop-propagation="false">
<view class="boxsiz bar row bothSide verCenter bor" bind:tap="toUrl" data-url="/pages/person/setpassword/index"> <view class="boxsiz bar row bothSide verCenter bor" bind:tap="toUrl" data-url="/pages/person/setpassword/index">
<view> <view>
<text class="t1">登录密码</text> <text class="t1">登录密码</text>
</view>
<view>
<text class="t2">已设置</text>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="boxsiz bar row bothSide verCenter">
<view>
<text class="t1">绑定微信</text>
</view>
<view>
<text class="t2">已绑定</text>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter" bind:tap="toUrl" data-url="/pages/person/notice/index">
<view>
<text class="t1">通知设置</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="boxsiz bar row bothSide verCenter" bind:tap="toUrl" data-url="/pages/person/privacy/index">
<view>
<text class="t1">隐私设置</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter bor">
<view>
<text class="t1">版本信息</text>
</view>
<view>
<text class="t2">V1.20</text>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="boxsiz bar row bothSide verCenter">
<view>
<text class="t1">关于我们</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter bor" bind:tap="logout">
<view>
<text class="t1">退出登录</text>
</view>
</view> </view>
<view>
<text class="t2">已设置</text>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="boxsiz bar row bothSide verCenter">
<view>
<text class="t1">绑定微信</text>
</view>
<view>
<text class="t2">已绑定</text>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter" bind:tap="toUrl" data-url="/pages/list/blacklist/index">
<view>
<text class="t1">黑名单</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter" bind:tap="toUrl" data-url="/pages/person/notice/index">
<view>
<text class="t1">通知设置</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="boxsiz bar row bothSide verCenter" bind:tap="toUrl" data-url="/pages/person/privacy/index">
<view>
<text class="t1">隐私设置</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter bor">
<view>
<text class="t1">版本信息</text>
</view>
<view>
<text class="t2">V1.20</text>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="boxsiz bar row bothSide verCenter">
<view>
<text class="t1">关于我们</text>
</view>
<view>
<text class="icon iconfont iconChevron"></text>
</view>
</view>
<view class="hr"></view>
<view class="boxsiz bar row bothSide verCenter bor" bind:tap="logout">
<view>
<text class="t1">退出登录</text>
</view>
</view>
</view> </view>
\ No newline at end of file
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 0, "current": 16,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -163,6 +163,13 @@ ...@@ -163,6 +163,13 @@
"id": -1, "id": -1,
"name": "pages/person/invitation/index", "name": "pages/person/invitation/index",
"pathName": "pages/person/invitation/index", "pathName": "pages/person/invitation/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/list/blacklist/index",
"pathName": "pages/list/blacklist/index",
"scene": null "scene": null
} }
] ]
......
...@@ -277,6 +277,10 @@ const apis = { ...@@ -277,6 +277,10 @@ const apis = {
*/ */
evaluateAppeal: user_url + '/evaluate/appeal/add', evaluateAppeal: user_url + '/evaluate/appeal/add',
/** /**
* 获取环信黑名单
*/
imBlackList: user_url + '/im/blacklist',
/**
* 红包活动列表 * 红包活动列表
*/ */
integralsList: welfare_url + '/integrals/list', integralsList: welfare_url + '/integrals/list',
......
...@@ -41,23 +41,46 @@ const getImUser = () => { ...@@ -41,23 +41,46 @@ const getImUser = () => {
let reg = /(\d{3})\d{4}(\d{4})/; let reg = /(\d{3})\d{4}(\d{4})/;
getData(apis.userInfo, 'get', { getData(apis.userInfo, 'get', {
"token": token, "token": token,
}, function (res) { }, function(res) {
if (res.errcode == 0) { if (res.errcode == 0) {
wx.setStorageSync('user_id', res.data.user_id + ''); wx.setStorageSync('user_id', res.data.user_id + '');
wx.setStorageSync('avatar', res.data.avatar||''); wx.setStorageSync('avatar', res.data.avatar || '');
wx.setStorageSync('company_name', res.data.company_name || ''); wx.setStorageSync('company_name', res.data.company_name || '');
wx.setStorageSync("myUsername", res.data.im_username); wx.setStorageSync("myUsername", res.data.im_username);
wx.setStorageSync("myPassword", res.data.im_password); wx.setStorageSync("myPassword", res.data.im_password);
wx.setStorageSync("imNick", res.data.company_name || (res.data.mobile ? res.data.mobile.replace(reg, '$1****$2') : '') || res.data.wechat_oauth.oauth_nickname || ''); wx.setStorageSync("imNick", res.data.company_name || (res.data.mobile ? res.data.mobile.replace(reg, '$1****$2') : '') || res.data.wechat_oauth.oauth_nickname || '');
getBlackList(token, res.data.im_username, res.data.im_password);
// conn.open({
// apiUrl: WebIM.config.apiURL,
// user: res.data.im_username,
// pwd: res.data.im_password,
// appKey: WebIM.config.appkey
// })
} else {
console.log('获取环信账号失败')
}
}, false)
};
const getBlackList = (token,name,pwd) => { //获取黑名单列表
getData(apis.imBlackList, 'get', {
"token": token,
}, function(res) {
if (res.errcode == 0) {
let arr = res.data||[];
let blackLsit = []
for(let i=0;i<arr.length;i++){
blackLsit.push(arr[i].im_username)
}
wx.setStorageSync("black", blackLsit);
conn.open({ conn.open({
apiUrl: WebIM.config.apiURL, apiUrl: WebIM.config.apiURL,
user: res.data.im_username, user:name,
pwd: res.data.im_password, pwd: pwd,
appKey: WebIM.config.appkey appKey: WebIM.config.appkey
}) })
} else { } else {
console.log('获取环信账号失败') console.log('获取黑名单列表失败')
} }
}, false) }, false)
}; };
...@@ -77,7 +100,7 @@ const addImUser = (message) => { //接收消息后进行用户的处理,以便 ...@@ -77,7 +100,7 @@ const addImUser = (message) => { //接收消息后进行用户的处理,以便
}; };
const registerIm = () => { const registerIm = () => {
let token = wx.getStorageSync('access_token') || ''; let token = wx.getStorageSync('access_token') || '';
getData(apis.authregistim, 'post', {}, function (res) { getData(apis.authregistim, 'post', {}, function(res) {
if (res.errcode == 0) { if (res.errcode == 0) {
getImUser(); getImUser();
} else { } else {
...@@ -89,6 +112,15 @@ const registerIm = () => { ...@@ -89,6 +112,15 @@ const registerIm = () => {
} }
}, false, true) }, false, true)
}; };
const isBlack = (name) => {//判断是否在黑名单中
let blackList = wx.getStorageSync('black') || [];
let index = blackList.indexOf(name);
if(index!==-1){//在黑名单中
return true
}else{//不在黑名单中
return false
}
};
const webimListen = () => { const webimListen = () => {
let my = wx.getStorageSync('myUsername') || ''; let my = wx.getStorageSync('myUsername') || '';
WebIM.conn.listen({ WebIM.conn.listen({
...@@ -134,6 +166,9 @@ const webimListen = () => { ...@@ -134,6 +166,9 @@ const webimListen = () => {
// } // }
// }, // },
onTextMessage(message) { onTextMessage(message) {
if(isBlack(message.from)){
return;
}
if (message) { if (message) {
if (onMessageError(message)) { if (onMessageError(message)) {
addImUser(message) addImUser(message)
...@@ -145,6 +180,9 @@ const webimListen = () => { ...@@ -145,6 +180,9 @@ const webimListen = () => {
}, },
onEmojiMessage(message) { onEmojiMessage(message) {
if (isBlack(message.from)) {
return;
}
if (message) { if (message) {
if (onMessageError(message)) { if (onMessageError(message)) {
addImUser(message) addImUser(message)
...@@ -154,6 +192,9 @@ const webimListen = () => { ...@@ -154,6 +192,9 @@ const webimListen = () => {
} }
}, },
onPictureMessage(message) { onPictureMessage(message) {
if (isBlack(message.from)) {
return;
}
if (message) { if (message) {
if (onMessageError(message)) { if (onMessageError(message)) {
addImUser(message) addImUser(message)
...@@ -162,20 +203,20 @@ const webimListen = () => { ...@@ -162,20 +203,20 @@ const webimListen = () => {
calcUnReadSpot(message); calcUnReadSpot(message);
} }
}, },
onBlacklistUpdate: function (list) { //黑名单变动 onBlacklistUpdate: function(list) { //黑名单变动
// 查询黑名单,将好友拉黑,将好友从黑名单移除都会回调这个函数,list则是黑名单现有的所有好友信息 // 查询黑名单,将好友拉黑,将好友从黑名单移除都会回调这个函数,list则是黑名单现有的所有好友信息
console.log(list); console.log(list);
}, },
// 各种异常 // 各种异常
onError(error) { onError(error) {
if (error.type == 8) {//异地登录 if (error.type == 8) { //异地登录
let pages = getCurrentPages(); let pages = getCurrentPages();
let curPage = pages[pages.length - 1]; let curPage = pages[pages.length - 1];
getApp().globalData.imBoolean = true; getApp().globalData.imBoolean = true;
if (curPage.route == "pages/detail/chat/index" || curPage.route == 'pages/tab/message/message') { if (curPage.route == "pages/detail/chat/index" || curPage.route == 'pages/tab/message/message') {
reloginIm() reloginIm()
} }
} else if (error.type == 1) {//用户名或者账号错误 } else if (error.type == 1) { //用户名或者账号错误
if (getApp().globalData.isRelogin) { if (getApp().globalData.isRelogin) {
getApp().globalData.isRelogin = false; getApp().globalData.isRelogin = false;
registerIm() registerIm()
......
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