pushStoreInfo.vue 2.53 KB
Newer Older
xd's avatar
xd committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<template>
  <div class="container">
    <div>
      <!-- 搜索框 -->
      <van-search v-model="inputValue" placeholder="请输入搜索关键词" />      
    </div>
    <van-checkbox-group v-model="list" @change="onChange">
      <van-cell-group >
        <van-cell  class="content"  v-for="(item, index) in newMemberList" :key="index"  clickable  data-index="index"  bind:click="toggle">
          <template slot="title">
            <img src="../../../public/img/photo.png" alt="" />
            <span class="custom-title">{{ item.name }}</span>
          </template>
          <van-checkbox slot="right-icon" catch:tap="noop" :name="item.id" />
        </van-cell>
      </van-cell-group>
    </van-checkbox-group>
    <div>外部联系人{{ info }}</div>
  </div>
</template>

<script>
xd's avatar
xd committed
23
import axios from "axios";
xd's avatar
xd committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
export default {
    data() {
        return {
            inputValue: '',
            newMemberList: [
                {
                  id: 1,
                  src: "",
                  name: "Solomon"
                },
                {
                  id: 2,
                  src: "",
                  name: "Solomon"
                }
            ],
            list: [],
xd's avatar
xd committed
41 42
            info: '',
            userId: ''
xd's avatar
xd committed
43 44 45 46
        }
    },
    mounted() {
      this.getAgentAuth()
xd's avatar
xd committed
47
      this.getList()
xd's avatar
xd committed
48 49 50
    },
    methods: {
      getList() {
xd's avatar
xd committed
51 52 53 54 55 56 57 58
        alert('获取外部联系人')
        alert(sessionStorage.getItem('userId'))
        sessionStorage.getItem('userId')
        this.userId = sessionStorage.getItem('userId')
        axios({
          url: "/workWx/auth/contact/listExternalContacts?userId=" + this.userId,
          method: "get",
          headers: headerData
xd's avatar
xd committed
59
        })
xd's avatar
xd committed
60 61 62 63 64 65 66 67
          .then(res => {
            alert('获取外部联系人成功')
            alert('JSON.stringify(res)')
            this.userInfo = JSON.stringify(res)
          })
          .catch(err => {
            this.zcache.userInfoResNew = "RESERR.";
          });
xd's avatar
xd committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
      },
      onChange(val) { },      
      toggle(event) {
        const { index } = event.currentTarget.dataset;
        const checkbox = this.selectComponent(`.checkboxes-${index}`);
        checkbox.toggle();
      },
      noop() {}
    }
}
</script>

<style scoped>
.content {
  align-items: center;
}
.content >>> .van-icon-arrow:before {
  margin-top: 10px;
  color: #2d476a;
}

.custom-title {
  margin-left: 12px;
  font-size: 16px;
  font-weight: bold;
  color: rgba(45, 71, 106, 1);
}
.content img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  vertical-align: middle;
}
</style>