guhongwei 3 years ago
parent
commit
3fa37fd5c5
1 changed files with 19 additions and 2 deletions
  1. 19 2
      src/views/customer/index.vue

+ 19 - 2
src/views/customer/index.vue

@@ -9,7 +9,14 @@
             </el-input>
           </el-col>
           <el-col :span="24" class="left_2">
-            <el-col :span="24" class="list" v-for="(item, index) in userList" :key="index" @click.native="chatBtn(item)">
+            <el-col
+              :span="24"
+              class="list"
+              :class="`${index === activeIndex ? 'active' : ''}`"
+              v-for="(item, index) in userList"
+              :key="index"
+              @click.native="chatBtn(item, index)"
+            >
               <el-col :span="4" class="icon">
                 <el-image :src="leftIcon"></el-image>
               </el-col>
@@ -105,6 +112,7 @@ export default {
       chatUserInfo: {},
       chatList: [],
       content: '',
+      activeIndex: '',
     };
   },
   created() {
@@ -118,7 +126,8 @@ export default {
     ...customer(['online', 'record', 'createChat', 'chatRecord']),
     search() {},
     // 点击获取客户聊天列表
-    async chatBtn(data) {
+    async chatBtn(data, index) {
+      this.$set(this, `activeIndex`, index);
       this.$set(this, `chatUserInfo`, data);
       let arr = await this.chatRecord({ client_id: data.client_id, customer_id: data.customer_id });
       if (this.$checkRes(arr)) {
@@ -275,6 +284,14 @@ export default {
           }
         }
       }
+      .active {
+        background-color: #f9f9f9;
+        .info {
+          .name {
+            color: #409eff;
+          }
+        }
+      }
     }
   }
   .right {