Blame view

src/components/community/syncSubscribeWechat.vue 1.44 KB
316052fa   wuxw   加入用户关注功能
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  <template>
    <el-dialog
      :title="$t('wechatSubscribe.confirmTitle')"
      :visible.sync="visible"
      width="500px"
      @close="handleClose">
      <div class="dialog-content">
        <p>{{ $t('wechatSubscribe.syncConfirmText') }}</p>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleClose">{{ $t('common.cancel') }}</el-button>
        <el-button type="primary" @click="syncSubscribeWechat">{{ $t('common.submit') }}</el-button>
      </div>
    </el-dialog>
  </template>
  
  <script>
  import { synchronizeWechatSubscribe } from '@/api/community/wechatSubscribeApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'SyncSubscribeWechat',
    data() {
      return {
        visible: false
      }
    },
    methods: {
      open() {
        this.visible = true
      },
      handleClose() {
        this.visible = false
      },
      async syncSubscribeWechat() {
        try {
          const params = {
            communityId: getCommunityId()
          }
          await synchronizeWechatSubscribe(params)
          this.$message.success(this.$t('wechatSubscribe.syncSuccess'))
          this.$emit('success')
          this.handleClose()
        } catch (error) {
          this.$message.error(this.$t('wechatSubscribe.syncError'))
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .dialog-content {
    padding: 20px;
    text-align: center;
    
    p {
      margin: 0;
      line-height: 1.5;
    }
  }
  
  .dialog-footer {
    text-align: right;
  }
  </style>