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
116
117
118
119
120
121
122
123
124
125
126
127
| <template>
| <div class="ChatPage" >
| <div class="chatBox">
| <JwChat :taleList="taleList" @enter="enter" v-model="msg" :toolConfig="toolConfig"
| />
| </div>
| </div>
| </template>
|
| <script>
| export default {
| name: "JwChat-index",
| props: {
| config: {
| type: Object,
| default: () => ({
|
| callback: () => { }
| })
| },
| taleList: {
| type: Array,
| default: () => {
| return []
| }
| },
| height: {
| type: String,
| default: "100vh"
| },
| width: {
| default: "100vh"
| },
| value: {
| default: ''
| },
| toolConfig: {
| type: Object
| }
| },
| data() {
| return {
| chatHeight: '',
| chatWidth: "",
| msg: ''
| }
| },
| computed: {
| faceSize() {
| let height = this.height
| let width = this.width
| if (height.match(/\d$/)) {
| height += 'px'
| }
| if (width.match(/\d$/)) {
| width += 'px'
| }
| const style = { height, width }
| return style
| },
| },
| watch: {
| height: {
| handler() {
| this.chatHeight = this.height - 90 + ''
| },
| immediate: true
| },
| width: {
| handler() {
| this.chatWidth = this.width * .7 + ''
| },
| immediate: true
| },
| value: {
| handler() {
| this.msg = this.value;
| },
| immediate: true
| },
| msg: {
| handler() {
| this.$emit('input', this.msg);
| },
| immediate: true
| }
| },
| methods: {
| bindClick(type) {
| const { callback } = this.config || {}
| if (callback) {
| callback(type)
| }
| },
| enter(msg) {
| this.$emit('enter', msg)
| }
| }
| }
| </script>
|
| <style scoped>
| .ChatPage {
| margin: 0 auto;
| background: #fff;
| width: 100% !important;
| height:100% !important;
| position: absolute;
|
| box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
| }
|
| .ChatPage .header {
| display: none;
| }
|
| .ChatPage .main {
|
| height:100vh;
| width: 100vh;
| position: absolute;
| }
|
| .ChatPage .main .rightBox {
| display: none;
| }
| </style>
|
|