<template>
<view id="gidList">
    <view class="gidItem mx-1px-bottom" v-for="(item, index) in list" :key="index">
        <view class="wap">
            <span class="title">群名称：</span>
            <open-data type="groupName" :open-gid="item.group_id"></open-data>
        </view>
        <view class="wap">
            <span class="title">群 I D：</span>
            <span class="name">{{item.group_id}}</span>
        </view>
    </view>
</view>
</template>
<script>
import {pageLogin, getUrl,config} from '@/common/js/utils.js';

export default {
  data() {
    return {
      list: []
    };
  },

  onLoad(e) {
    this.getGidList();
  },

  components: {},
  props: {},
  methods: {
    getGidList() {
      var token = this.$cookieStorage.get('user_token');
      this.$http.get({
        api: 'api/group/list',
        header: {
          Authorization: token
        },
        data: {
          limit: 1000
        }
      }).then(res => {
        if (res.statusCode == 200) {
          res = res.data;

          if (res.status) {
            this.setData({
              list: res.data
            });
          } else {}
        } else {}
      });
    },

    setData: function (obj) {
      let that = this;
      let keys = [];
      let val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }

          data = data[key2];
        });
      });
    }
  },
  computed: {},
  watch: {}
};
</script>

<style rel="stylesheet/less" lang="less">
    @import "gidList";
</style>