<template>
    <div class="people">
        <div class="people-content">
            <!-- <van-radio-group v-model="radio"> -->
            <div class="people-item" v-for="item in people.peopleList" :key="item.id" @click="contactPeople(item)">
                <div class="people-item-left">
                    <img :src="item.avatar" alt="">
                    <div>
                        <div class="flex a-i-c">
                            <div class="people-item-nickName">{{item.repairName}}</div>
                            <div class="people-item-city"><van-icon name="location" />{{item.location}}</div>
                        </div>
                        <div class="skills">范围：{{item.repairScope}}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
// import wx from 'weixin-js-sdk'
export default {
  data () {
    return {
      people: {
        peopleList: []
      }
    }
  },
  methods: {
    /**
         * 查询维修人员列表
         */
    // async getRepairMan () {
    //     let {list} = await this.postHttps('manage/emp/queryRepairMan',{reqdata:{type:1}})
    //     this.$set(this.people,'peopleList',list)
    // },
    getRepairMan () {
      this.postHttps('manage/emp/queryRepairMan', { reqdata: { type: 1 } }).then(r => {
        this.$set(this.people, 'peopleList', r.list)
      })
    },
    /**
         * 打开用户名片
         * @param item 用户信息
         */
    contactPeople ({ repairWxUserId }) {
      alert(repairWxUserId)
      alert(JSON.stringify(window.wx))
      window.wx.invoke('openUserProfile', {
        'type': 1, // 1表示该userid是企业成员，2表示该userid是外部联系人
        'userid': repairWxUserId // 可以是企业成员，也可以是外部联系人
      }, (res) => {
        alert(JSON.stringify(res))
        if (res.err_msg !== 'openUserProfile:ok') {
          // 错误处理
          this.Toast({
            message: '无此联系人！'
          })
        }
      })
    }
  },
  created () {
    this.getRepairMan()
  }
}
</script>
