Commit 571a0125 by 梁建民

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

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