|
@@ -0,0 +1,147 @@
|
|
|
+<template>
|
|
|
+ <div class="add-person">
|
|
|
+ <back-bar title="选择联系人">
|
|
|
+ <button class="complete-btn">完成</button>
|
|
|
+ </back-bar>
|
|
|
+ <div class="input-wrap">
|
|
|
+ <i class="el-icon-search"></i>
|
|
|
+ <input type="text" placeholder="搜索">
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ class="user-item"
|
|
|
+ v-for="(item, key) in checkList"
|
|
|
+ :key="key"
|
|
|
+ :class="{'checked': item.isChecked}"
|
|
|
+ @click="changeState(item.user_id)"
|
|
|
+ >
|
|
|
+ <i v-if="item.isChoosed" class="el-icon-circle-check is-choosed"></i>
|
|
|
+ <template v-else-if="item.is_admin!=2">
|
|
|
+ <i v-if="item.isChecked" class="el-icon-circle-check"></i>
|
|
|
+ <i v-else class="el-icon-circle-uncheck"></i>
|
|
|
+ </template>
|
|
|
+ <img v-if="item.cover_photo" class="user-avatar" :src="item.cover_photo" alt>
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ class="user-avatar"
|
|
|
+ :class="`avatar_bg${item.user_id % 9}`"
|
|
|
+ :data-name="item.nick_name.slice(0,2).toUpperCase()"
|
|
|
+ ></div>
|
|
|
+ <span class="name">{{item.nick_name}}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState } from 'vuex'
|
|
|
+import backBar from '@/components/backBar'
|
|
|
+// import API from '@/api'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'chatList',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ checkList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ backBar
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ userInfo: state => {
|
|
|
+ return state.userInfo
|
|
|
+ },
|
|
|
+ friendList: state => state.chat.friendList
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getItemByUid (uid) {
|
|
|
+ if (this.isSearchGroup) {
|
|
|
+ return this.searchGroupList.filter((item, index) => {
|
|
|
+ if (item.user_id == uid) this.curItemIndex = index
|
|
|
+ return item.user_id == uid
|
|
|
+ })[0]
|
|
|
+ } else {
|
|
|
+ return this.checkList.filter((item, index) => {
|
|
|
+ if (item.user_id == uid) this.curItemIndex = index
|
|
|
+ return item.user_id == uid
|
|
|
+ })[0]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeState (uid, flag = true) {
|
|
|
+ let item = this.getItemByUid(uid)
|
|
|
+ item['isChecked'] = flag
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async created () {
|
|
|
+ await this.$store.dispatch('getFriendList')
|
|
|
+ this.checkList = this.friendList
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.add-person{
|
|
|
+ background-color: #ffffff;
|
|
|
+}
|
|
|
+.complete-btn{
|
|
|
+ position: absolute;
|
|
|
+ top: px2rem(14);
|
|
|
+ right: px2rem(10);
|
|
|
+ background-color: #279bf3;
|
|
|
+ height: px2rem(58);
|
|
|
+ line-height: px2rem(58);
|
|
|
+ padding: 0 px2rem(26);
|
|
|
+ font-size: px2rem(30);
|
|
|
+ color: #ffffff;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.input-wrap{
|
|
|
+ background-color: #ffffff;
|
|
|
+ height: px2rem(100);
|
|
|
+ line-height: px2rem(100);
|
|
|
+ position: relative;
|
|
|
+ padding-left: px2rem(80);
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+ .el-icon-search{
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: px2rem(36);
|
|
|
+ width: px2rem(80);
|
|
|
+ height: px2rem(40);
|
|
|
+ text-align: center;
|
|
|
+ bottom: 0;
|
|
|
+ vertical-align: middle;
|
|
|
+ color: #999;
|
|
|
+ font-size: px2rem(40);
|
|
|
+ }
|
|
|
+ input{
|
|
|
+ height: px2rem(70);
|
|
|
+ line-height: px2rem(70);
|
|
|
+ padding-left: px2rem(12);
|
|
|
+ width: 100%;
|
|
|
+ font-size: px2rem(28);
|
|
|
+ outline: none;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+}
|
|
|
+.user-item{
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+ padding: px2rem(20) 0;
|
|
|
+ .name{
|
|
|
+ display: inline-block;
|
|
|
+ margin-left: px2rem(20);
|
|
|
+ font-size: px2rem(34);
|
|
|
+ color: #333333;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-icon-circle-uncheck{
|
|
|
+ display: inline-block;
|
|
|
+ vertical-align: middle;
|
|
|
+ width: px2rem(50);
|
|
|
+ height: px2rem(50);
|
|
|
+ margin: 0 px2rem(26);
|
|
|
+}
|
|
|
+</style>
|