twt 1 month ago
parent
commit
25cb32f1ce
7 changed files with 47 additions and 20 deletions
  1. 11 5
      pages/conversations.vue
  2. 7 3
      pages/inquiry.vue
  3. 2 1
      pages/login.vue
  4. 22 8
      pages/mine.vue
  5. 3 2
      pages/privateChat.vue
  6. 2 1
      pages/privateChatG.vue
  7. BIN
      static/img/yonghu.png

+ 11 - 5
pages/conversations.vue

@@ -16,7 +16,7 @@
       <view class="scroll-item" v-for="(conversation, key) in conversations" :key="key">
         <view class="item-head">
          <!-- <image :src="conversation.data.avatar" class="head-icon"></image> -->
-		  <image src="/static/img/touxiang.png" class="head-icon"></image>
+		  <image src="/static/img/yonghu.png" class="head-icon"></image>
           <view class="item-head_unread" v-if="conversation.unread">{{ conversation.unread }}</view>
         </view>
         <view class="scroll-item_info" @click="chat(conversation)">
@@ -92,6 +92,7 @@
 		 this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
 	},
     onShow() {
+	  
 	  this.loginInfo=uni.getStorageSync('loginInfo');
 	  /* uni.setNavigationBarTitle({
 		  title:this.loginInfo.supplierName
@@ -103,10 +104,11 @@
         uni.navigateTo({ url: './login' });
         return;
       }
-      if (GoEasy.getConnectionStatus() === 'disconnected') {
+	  console.log("onShowconversations")
+     // if (GoEasy.getConnectionStatus() === 'disconnected') {
         this.connectGoEasy(); //连接goeasy
         this.subscribeGroup(); //建立连接后,就应该订阅群聊消息,避免漏掉
-      }
+     // }
       this.loadConversations(); //加载会话列表
       this.initGoEasyListeners();
     },
@@ -334,8 +336,8 @@
 
   .conversations .scroll-item_info .item-info-top {
     padding-top: 20rpx;
-   /* height: 60rpx;
-    line-height: 60rpx; */
+    height: 60rpx;
+    line-height: 60rpx;
     display: flex;
     align-items: center;
     justify-content: space-between;
@@ -345,6 +347,10 @@
   .conversations .item-info-top_name {
     font-size: 30rpx;
     color: #262628;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	width: 370rpx;
+	white-space: nowrap;
   }
 
   .conversations .item-info-top_time {

+ 7 - 3
pages/inquiry.vue

@@ -22,7 +22,7 @@
 		    <view class="scroll-item" v-for="(conversation, key) in conversations" :key="key">
 		      <view class="item-head">
 		       <!-- <image :src="conversation.data.avatar" class="head-icon"></image> -->
-			    <image src="/static/img/icon_me.png" class="head-icon"></image>
+			    <image src="/static/img/pic_def_ava@2x.png" class="head-icon"></image>
 		        <view class="item-head_unread" v-if="conversation.unread">{{ conversation.unread }}</view>
 		      </view>
 		      <view class="scroll-item_info" @click="chat(conversation)">
@@ -411,8 +411,8 @@
 
   .conversations .scroll-item_info .item-info-top {
     padding-top: 20rpx;
-   /* height: 60rpx;
-    line-height: 60rpx; */
+    height: 60rpx;
+    line-height: 60rpx;
     display: flex;
     align-items: center;
     justify-content: space-between;
@@ -422,6 +422,10 @@
   .conversations .item-info-top_name {
     font-size: 30rpx;
     color: #262628;
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	width: 370rpx;
   }
 
   .conversations .item-info-top_time {

+ 2 - 1
pages/login.vue

@@ -142,12 +142,13 @@
 		   
 		   },'POST').then(res => {
 		  	  console.log(res)	
+			 
 			  uni.setStorageSync('loginInfo', res.data);
 			  obj.name=res.data.supplierName
 			  obj.id=res.data.userId
 			  obj.password=this.form.password
 			  obj.phone=this.form.phone
-			  uni.setStorageSync('currentUser', obj);
+			  //uni.setStorageSync('currentUser', obj);
 			  uni.setStorageSync('token', res.data.imAccessToken.accessToken);
 			  uni.setStorageSync('accessToken', res.data.imAccessToken.accessToken);
 			  uni.switchTab({url: './conversations'});

+ 22 - 8
pages/mine.vue

@@ -81,10 +81,8 @@
 			  },'POST').then(res => {
 			 	  console.log(res)	
 				  if(res.code!=0){
-					  uni.clearStorageSync();
-					  uni.navigateTo({
-					    url: './login'
-					  })
+					 // uni.clearStorageSync();
+					this.logout()
 				  }
 			  }) 
 		},
@@ -106,10 +104,26 @@
 			})
 		},
       logout() {
-		  uni.clearStorageSync();
-		  uni.navigateTo({
-		    url: './login'
-		  })
+		 // uni.clearStorageSync();
+		  GoEasy.disconnect({
+			 onSuccess: function(){
+				 console.log("GoEasy disconnect successfully.")
+				 uni.removeStorageSync('accessToken');
+				 uni.removeStorageSync('loginInfo')
+				  uni.navigateTo({
+				    url: './login'
+				  })
+			 },
+			 onFailed: function(error){
+				 uni.removeStorageSync('accessToken');
+				 uni.removeStorageSync('loginInfo')
+				  uni.navigateTo({
+				    url: './login'
+				  })
+				 console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
+			 }
+		 });
+		 
        /* if(GoEasy.getConnectionStatus() === 'disconnected') {
           return
         }

+ 3 - 2
pages/privateChat.vue

@@ -29,7 +29,8 @@
             <view class="message-item-content" :class="{'self' : message.senderId ===  currentUser.id}">
               <view class="avatar">
                 <!-- <image :src="message.senderId === currentUser.id? currentUser.avatar : friend.avatar"></image> -->
-                <image src="/static/img/touxiang.png"></image>
+                <image v-if="message.senderId ===  currentUser.id" src="/static/img/yonghu.png"></image>
+				 <image v-else src="/static/img/pic_def_ava@2x.png"></image>
 			  </view>
 
               <view class="content" @click.right="showActionPopup(message)" @longpress="showActionPopup(message)">
@@ -285,7 +286,7 @@
         type: GoEasy.IM_SCENE.PRIVATE,
         data: {
           name: this.friend.supplierName,
-          avatar: '/static/images/Avatar-1.png'
+          avatar: '/static/img/pic_def_ava@2x.png'
         }
       };
 

+ 2 - 1
pages/privateChatG.vue

@@ -29,7 +29,8 @@
             <view class="message-item-content" :class="{'self' : message.senderId ===  currentUser.userId}">
               <view class="avatar">
                 <!-- <image :src="message.senderId === currentUser.id? currentUser.avatar : friend.avatar"></image> -->
-                <image src="/static/img/touxiang.png"></image>
+                <image v-if="message.senderId === currentUser.userId" src="/static/img/pic_def_ava@2x.png"></image>
+				<image v-else src="/static/img/yonghu.png"></image>
 			  </view>
 
               <view class="content" @click.right="showActionPopup(message)" @longpress="showActionPopup(message)">

BIN
static/img/yonghu.png