modal-answer-edit.vue
2.32 KB
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
<template>
<Modal
class-name="vertical-center-modal"
width="500"
v-model="model">
<p slot="header">
咨询回复
</p>
<div style="text-align: center">
<Input
type = "textarea"
:rows = "10"
placeholder="请输入文字内容"
:maxlength="250"
v-model="answer"/>
</div>
<div style="text-align: right">
<span style="color: #999; font-size: 10px; margin-top: 2px;">{{textMsg}}</span>
</div>
<div slot="footer" style="text-align: center">
<Button type="primary" size="large" :loading="modal_loading" @click="submit">回复</Button>
<Button size="large" @click="cancel">取消</Button>
</div>
</Modal>
</template>
<script>
import FeedbackService from 'services/product/feedback-service';
export default {
name: 'modal-answer-edit',
created() {
this.feedbackService = new FeedbackService();
},
data() {
return {
model: false,
modal_loading: false,
userId: '',
id: '',
answer: ''
};
},
computed: {
textMsg() {
if (this.answer) {
let num = 250 - this.answer.length;
return `还能输${num >= 0 ? num : 0}个字`;
}
}
},
methods: {
show(row) {
this.reset();
this.userId = row.userId;
this.id = row.id;
this.answer = row.answer;
this.model = true;
},
close() {
this.reset();
this.model = false;
},
reset() {
this.userId = null;
this.id = null;
this.answer = null;
},
submit() {
this.modal_loading = true;
this.submitData().then(() => {
this.modal_loading = false;
this.$emit('on-success');
this.close();
});
},
cancel() {
this.close();
},
submitData() {
return this.feedbackService.consultReply(this.userId, this.id, this.answer);
}
}
};
</script>
<<<<<<< HEAD
<style lang="scss">
</style>
=======
>>>>>>> feature/suggestDev