wsdc.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div id="wsdc">
  3. <el-row>
  4. <el-col :span="24" class="wsdc">
  5. <el-image :src="cha"></el-image>
  6. <el-form ref="form" :model="form">
  7. <el-form-item>
  8. <span slot="label">您是否愿意继续关注本平台 </span>
  9. <el-radio-group v-model="form.resource">
  10. <el-radio label="愿意"></el-radio>
  11. <el-radio label="不愿意"></el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. <el-col :span="24" class="btn">
  15. <el-button type="primary" @click="onSubmit">确认提交</el-button>
  16. </el-col>
  17. </el-form>
  18. </el-col>
  19. </el-row>
  20. </div>
  21. </template>
  22. <script>
  23. import { mapState, createNamespacedHelpers } from 'vuex';
  24. const { mapActions: survey } = createNamespacedHelpers('survey');
  25. export default {
  26. name: 'wsdc',
  27. props: {},
  28. components: {},
  29. data: function() {
  30. return {
  31. cha: require('@a/cha.png'),
  32. form: {},
  33. };
  34. },
  35. created() {},
  36. methods: {
  37. ...survey(['create']),
  38. async onSubmit() {
  39. let data = this.form;
  40. data.uid = this.user.uid;
  41. if (data.uid) {
  42. let res = await this.create(data);
  43. if (res.errcode === 0) {
  44. this.$message({
  45. message: '提交成功',
  46. type: 'success',
  47. });
  48. this.form = {};
  49. this.$emit('handleClose');
  50. }
  51. } else {
  52. this.$message({
  53. message: '游客不可参与网上调查!',
  54. type: 'warning',
  55. });
  56. }
  57. },
  58. },
  59. computed: {
  60. ...mapState(['user']),
  61. },
  62. watch: {},
  63. };
  64. </script>
  65. <style lang="less" scoped>
  66. .wsdc {
  67. .el-image {
  68. padding: 0px 40%;
  69. }
  70. .btn {
  71. text-align: center;
  72. }
  73. }
  74. /deep/.el-form-item__label {
  75. width: 100%;
  76. text-align: center;
  77. font-size: 22px;
  78. margin: 15px 0;
  79. }
  80. /deep/.el-radio-group {
  81. padding: 0 35%;
  82. }
  83. </style>