Commit f6f2f613 by 施宇

1111

parent 1d4bac63
...@@ -79,7 +79,7 @@ Component({ ...@@ -79,7 +79,7 @@ Component({
filename: tempFilePaths[0] filename: tempFilePaths[0]
}; };
let userId = wx.getStorageSync('user_id'); let userId = wx.getStorageSync('user_id');
let companyName = wx.getStorageSync('company_name'); let companyName = wx.getStorageSync('imNick');
let avatar = wx.getStorageSync('avatar'); let avatar = wx.getStorageSync('avatar');
msg.set({ msg.set({
apiUrl: WebIM.config.apiURL, apiUrl: WebIM.config.apiURL,
......
...@@ -85,7 +85,7 @@ Component({ ...@@ -85,7 +85,7 @@ Component({
let id = WebIM.conn.getUniqueId(); let id = WebIM.conn.getUniqueId();
let msg = new WebIM.message(msgType.TEXT, id); let msg = new WebIM.message(msgType.TEXT, id);
let userId = wx.getStorageSync('user_id'); let userId = wx.getStorageSync('user_id');
let companyName = wx.getStorageSync('company_name'); let companyName = wx.getStorageSync('imNick');
let avatar = wx.getStorageSync('avatar'); let avatar = wx.getStorageSync('avatar');
msg.set({ msg.set({
msg: this.data.userMessage, msg: this.data.userMessage,
...@@ -132,7 +132,7 @@ Component({ ...@@ -132,7 +132,7 @@ Component({
let id = WebIM.conn.getUniqueId(); let id = WebIM.conn.getUniqueId();
let msg = new WebIM.message(msgType.CMD, id); let msg = new WebIM.message(msgType.CMD, id);
let userId = wx.getStorageSync('user_id'); let userId = wx.getStorageSync('user_id');
let companyName = wx.getStorageSync('company_name'); let companyName = wx.getStorageSync('imNick');
let avatar = wx.getStorageSync('avatar'); let avatar = wx.getStorageSync('avatar');
let touserid = this.data.username.id == userId ? this.data.username.touserid : this.data.username.id; let touserid = this.data.username.id == userId ? this.data.username.touserid : this.data.username.id;
let members = wx.getStorageSync('member') || ''; let members = wx.getStorageSync('member') || '';
...@@ -146,6 +146,7 @@ Component({ ...@@ -146,6 +146,7 @@ Component({
img1: this.data.username.name == companyName ? this.data.username.img1 : this.data.username.img, img1: this.data.username.name == companyName ? this.data.username.img1 : this.data.username.img,
timer: WebIM.time() timer: WebIM.time()
}); });
console.log(params)
msg.set({ msg.set({
msg: 'template', msg: 'template',
from: me.data.username.myName, from: me.data.username.myName,
......
...@@ -23,7 +23,7 @@ Page({ ...@@ -23,7 +23,7 @@ Page({
}); });
}else{ }else{
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: username.title title: username.title||'--'
}); });
} }
if (getApp().globalData.imBoolean) { if (getApp().globalData.imBoolean) {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<view class="item-top row bothSide verCenter special-top"> <view class="item-top row bothSide verCenter special-top">
<view class="top-left row verCenter"> <view class="top-left row verCenter">
<image src="{{item.avatar||'/res/images/imgs/s.png'}}" class="img"></image> <image src="{{item.avatar||'/res/images/imgs/s.png'}}" class="img"></image>
<text class="name">{{item.evaluate_company_name||'--'}}</text> <text class="name">{{item.company_name||'--'}}</text>
</view> </view>
<view class="top-right row verCenter"> <view class="top-right row verCenter">
<block wx:if="{{item.is_praise == 1}}"> <block wx:if="{{item.is_praise == 1}}">
......
...@@ -93,6 +93,7 @@ Page({ ...@@ -93,6 +93,7 @@ Page({
wx.removeStorageSync('myUsername'); wx.removeStorageSync('myUsername');
wx.removeStorageSync('myPassword'); wx.removeStorageSync('myPassword');
wx.removeStorageSync('auth'); wx.removeStorageSync('auth');
wx.removeStorageSync('imNick');
wx.reLaunch({ wx.reLaunch({
url: '/pages/person/auth/index', url: '/pages/person/auth/index',
}); });
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<cover-image class="im" src="{{headPic ? headPic:'/res/images/imgs/heads.png'}}"></cover-image> <cover-image class="im" src="{{headPic ? headPic:'/res/images/imgs/heads.png'}}"></cover-image>
</view> </view>
<view class="text"> <view class="text">
<text class="t1">{{userInfo.company_name}}</text> <text class="t1">{{userInfo.company_name||userInfo.wechat_oauth.oauth_nickname||'--'}}</text>
<view class="row verCenter"> <view class="row verCenter">
<text class="t2" selectable="false" space="false" decode="false">普通会员</text> <text class="t2" selectable="false" space="false" decode="false">普通会员</text>
<view> <view>
......
...@@ -133,6 +133,7 @@ Page({ ...@@ -133,6 +133,7 @@ Page({
img: detail.ext.img, img: detail.ext.img,
img1: detail.ext.img1 img1: detail.ext.img1
}; };
console.log(nameList)
wx.navigateTo({ wx.navigateTo({
url: "/pages/detail/chat/index?username=" + JSON.stringify(nameList) url: "/pages/detail/chat/index?username=" + JSON.stringify(nameList)
}); });
......
...@@ -37,28 +37,22 @@ const onMessageError = (err) => { ...@@ -37,28 +37,22 @@ const onMessageError = (err) => {
return true; return true;
} }
const getImUser = () => { const getImUser = () => {
let token = wx.getStorageSync('access_token') || ''; let token = wx.getStorageSync('access_token') || '';
// let imName = wx.getStorageSync('myUsername') || ''; let reg = /(\d{3})\d{4}(\d{4})/;
// let imPassword = wx.getStorageSync('myPassword') || ''; // let userId = wx.getStorageSync('user_id') || ''
// if (imName && imPassword) {
// conn.open({
// apiUrl: WebIM.config.apiURL,
// user: imName,
// pwd: imPassword,
// appKey: WebIM.config.appkey
// });
// return;
// }
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 || res.data.wechat_oauth.oauth_head); wx.setStorageSync('avatar', res.data.avatar || res.data.wechat_oauth.oauth_head || '');
wx.setStorageSync('company_name', res.data.company_name || res.data.wechat_oauth.oauth_nickname); wx.setStorageSync('company_name', res.data.company_name || res.data.wechat_oauth.oauth_nickname || '');
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 || '');
// if(!userId){
// setAvatarAndName(res.data)
// }
conn.open({ conn.open({
apiUrl: WebIM.config.apiURL, apiUrl: WebIM.config.apiURL,
user: res.data.im_username, user: res.data.im_username,
...@@ -71,6 +65,19 @@ const getImUser = () => { ...@@ -71,6 +65,19 @@ const getImUser = () => {
} }
}, false) }, false)
}; };
const setAvatarAndName = (data) => {//设置用户名和头像
if (data.avatar && data.company_name) {
return
} else {
if (data.avatar) {
} else if (data.company_name) {
} else {
}
}
};
const addImUser = (message) => { //接收消息后进行用户的处理,以便同步到pc const addImUser = (message) => { //接收消息后进行用户的处理,以便同步到pc
let fromUserId = message.ext.id; let fromUserId = message.ext.id;
let fromImId = message.from; let fromImId = message.from;
...@@ -87,7 +94,7 @@ const addImUser = (message) => { //接收消息后进行用户的处理,以便 ...@@ -87,7 +94,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 {
...@@ -172,7 +179,7 @@ const webimListen = () => { ...@@ -172,7 +179,7 @@ const webimListen = () => {
calcUnReadSpot(message); calcUnReadSpot(message);
} }
}, },
onBlacklistUpdate: function(list) { //黑名单变动 onBlacklistUpdate: function (list) { //黑名单变动
// 查询黑名单,将好友拉黑,将好友从黑名单移除都会回调这个函数,list则是黑名单现有的所有好友信息 // 查询黑名单,将好友拉黑,将好友从黑名单移除都会回调这个函数,list则是黑名单现有的所有好友信息
console.log(list); console.log(list);
}, },
......
...@@ -76,6 +76,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => { ...@@ -76,6 +76,7 @@ const getData = (url, type, param, callBack, loading, isheader, istoken) => {
wx.removeStorageSync('myUsername'); wx.removeStorageSync('myUsername');
wx.removeStorageSync('myPassword'); wx.removeStorageSync('myPassword');
wx.removeStorageSync('auth'); wx.removeStorageSync('auth');
wx.removeStorageSync('imNick');
wx.reLaunch({ wx.reLaunch({
url: '/pages/person/auth/index', url: '/pages/person/auth/index',
}); });
......
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