<template>
  <div class="initiate">
    <!-- <div v-if="isFounder === 0" class="w-full h-screen flex flex-col items-center justify-center">
      <button class="block w-1/2 py-4 my-5 border border-app-white border-solid rounded-lg" @click="isFounder = 1">发起提案</button>
      <button class="block w-1/2 py-4 my-5 border border-app-white border-solid rounded-lg" @click="isFounder = 2">发起社区活动</button>
    </div> -->
    <initiate-founder v-if="isFounder === false"></initiate-founder>
    <initiate-user v-else></initiate-user>
    <!-- <attend-form v-else-if="isFounder === 3" @submitForm="submitForm" /> -->
  </div>
</template>

<script lang="ts">

import Vue from "vue";
// import { service } from '@/service/index'
import { permissionList } from '@/constants/permission'
export default Vue.extend({
  name: "Initiate",
  data() {
    return {
      isFounder: true,
    };
  },
  created() {
    const addr = this.$store.state.app.address
    console.log(addr)
    if (permissionList.indexOf(addr) > -1) {
      this.isFounder = false
      this.$route.meta.text = '发起活动'
    } else {
      this.$route.meta.text = '发起提案'
    }
    // // 测试关闭投票
    // service.memberCloseVote({
    //   voteId: '000000000608800001'
    // }).then(res => {
    //   console.log(res)
    // })
  },
  components:{
    'initiate-founder':()=>import('./initiate_comp/founder_initiate.vue'),
    'initiate-user':()=>import('./initiate_comp/user_initiate.vue')
  },
  methods: {
    // submitForm(v: boolean) {
    //   if (!v) {
    //     this.isFounder = 0
    //   }
    // }
  }

});
</script>

<style scoped>
  .initiate {
    background-image: url('../assets/home/banner.png');
    background-size: 100%;
    background-position-x: 50%;
    background-position-y: top;
    background-repeat: no-repeat;
  }
</style>
