<template>
  <div id="wsdc">
    <el-row>
      <el-col :span="24" class="wsdc">
        <el-image :src="cha"></el-image>
        <el-form ref="form" :model="form">
          <el-form-item>
            <span slot="label">您是否愿意继续关注本平台 </span>
            <el-radio-group v-model="form.resource">
              <el-radio label="愿意"></el-radio>
              <el-radio label="不愿意"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-col :span="24" class="btn">
            <el-button type="primary" @click="onSubmit">确认提交</el-button>
          </el-col>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: survey } = createNamespacedHelpers('survey');
export default {
  name: 'wsdc',
  props: {},
  components: {},
  data: function() {
    return {
      cha: require('@a/cha.png'),
      form: {},
    };
  },
  created() {},
  methods: {
    ...survey(['create']),
    async onSubmit() {
      let data = this.form;
      data.uid = this.user.uid;
      if (data.uid) {
        let res = await this.create(data);
        if (res.errcode === 0) {
          this.$message({
            message: '提交成功',
            type: 'success',
          });
          this.form = {};
          this.$emit('handleClose');
        }
      } else {
        this.$message({
          message: '游客不可参与网上调查！',
          type: 'warning',
        });
      }
    },
  },
  computed: {
    ...mapState(['user']),
  },
  watch: {},
};
</script>

<style lang="less" scoped>
.wsdc {
  .el-image {
    padding: 0px 40%;
  }
  .btn {
    text-align: center;
  }
}
/deep/.el-form-item__label {
  width: 100%;
  text-align: center;
  font-size: 22px;
  margin: 15px 0;
}
/deep/.el-radio-group {
  padding: 0 35%;
}
</style>
