quanwei
2 days ago 73b874c72ad55eb9eef21c36160ac0de58f0189e
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
  <!--
    作者:luoyiming
    时间:2020-06-04
    描述:插件中心-直播-直播房间列表-审核房间
  -->
  <el-dialog title="审核编辑" :visible.sync="dialogVisible" @close="dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false" width="500px">
    <el-form size="small" :model="form" :rules="formRules" ref="form">
      <el-form-item label="是否通过" prop="audit_status" :label-width="formLabelWidth">
        <el-radio v-model="form.audit_status" label="10">通过</el-radio>
        <el-radio v-model="form.audit_status" label="20">未通过</el-radio>
      </el-form-item>
      <el-form-item label="备注" :label-width="formLabelWidth" v-if="form.audit_status==20">
        <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入备注"
          v-model="form.audit_remark">
        </el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible">取 消</el-button>
      <el-button type="primary" @click="eidtLive" :loading="loading">确 定</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
import LiveApi from '@/api/live.js';
export default {
  components: {},
  data() {
 
    var audit_status = (rule, value, callback) => {
            if (value === ''||value===0) {
              callback(new Error('请选择状态'));
            } else {
              callback();
            }
          };
 
    return {
      file_path: '',
      formRules: {
        audit_status: [
          {
            validator: audit_status,
            required: true,
            trigger: ['blur','change']
          }
        ]
      },
      /*左边长度*/
      formLabelWidth: '120px',
      /*是否显示*/
      dialogVisible: true,
      loading: false
    };
  },
  props: ['form', 'categorys'],
  created() {
  },
  methods: {
    /*审核*/
    eidtLive() {
      let self = this;
      let params = {
        room_id:self.form.room_id,
        status:self.form.audit_status,
        remark:self.form.audit_remark
      }
      self.$refs.form.validate(valid => {
        if (valid) {
          self.loading = true;
          LiveApi
            .auditRoom(params, true)
            .then(data => {
              self.loading = false;
              self.$message({
                message: '审核成功',
                type: 'success'
              });
              self.dialogFormVisible(true);
            })
            .catch(error => {
              self.loading = false;
            });
        }
      });
    },
 
    /*关闭弹窗*/
    dialogFormVisible(e) {
      if (e) {
        this.$emit('close', {
          type: 'success',
          openDialog: false
        });
      } else {
        this.$emit('close', {
          type: 'error',
          openDialog: false
        });
      }
    }
  }
};
</script>
 
<style>
.img {
  margin-top: 10px;
}
</style>