@nebulars/sseengine 1.3.108 → 1.3.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulars/sseengine",
|
|
3
3
|
"description": "An engine for sse",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.109",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "forage serve --name sseengine",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"axios": "^1.11.0",
|
|
20
20
|
"vuex-fast": "^2.2.2"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "8b2a42ced2001e8cd50f1e2d8ef74744b9f21ecb"
|
|
23
23
|
}
|
|
@@ -67,7 +67,10 @@
|
|
|
67
67
|
</template>
|
|
68
68
|
|
|
69
69
|
<!-- Feedback -->
|
|
70
|
-
<sse-feedback :id="item.id" v-model:feedback="item.feedback" :visible="!sseengine.produce" />
|
|
70
|
+
<sse-feedback :id="item.id" v-model:feedback="item.feedback" v-model:open="item.open" :visible="!sseengine.produce" />
|
|
71
|
+
|
|
72
|
+
<!-- Reply -->
|
|
73
|
+
<sse-reply :id="item.id" :feedback="item.feedback" v-model:open="item.open" />
|
|
71
74
|
|
|
72
75
|
<!-- Next -->
|
|
73
76
|
<sse-recursion v-if="item.children.length" :source="item.children" :active="active" />
|
|
@@ -88,6 +88,11 @@ export default {
|
|
|
88
88
|
type: [Boolean],
|
|
89
89
|
default: false,
|
|
90
90
|
},
|
|
91
|
+
|
|
92
|
+
open: {
|
|
93
|
+
type: [Boolean],
|
|
94
|
+
default: false,
|
|
95
|
+
},
|
|
91
96
|
},
|
|
92
97
|
|
|
93
98
|
data() {
|
|
@@ -159,8 +164,11 @@ export default {
|
|
|
159
164
|
|
|
160
165
|
// Success
|
|
161
166
|
if (status === 'success') {
|
|
162
|
-
// Update
|
|
167
|
+
// Update Feedback
|
|
163
168
|
this.$emit('update:feedback', feedback);
|
|
169
|
+
|
|
170
|
+
// Update Open
|
|
171
|
+
this.$emit('update:open', !!feedback);
|
|
164
172
|
}
|
|
165
173
|
},
|
|
166
174
|
},
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<style lang="less" scoped>
|
|
2
|
+
.sse-reply {
|
|
3
|
+
background-color: white;
|
|
4
|
+
padding: @gap;
|
|
5
|
+
border-radius: @radiu;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
&-container {
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-input {
|
|
13
|
+
width: calc(100% - 60px - @gap);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-submit {
|
|
17
|
+
width: 60px;
|
|
18
|
+
right: @gap;
|
|
19
|
+
bottom: @gap;
|
|
20
|
+
position: absolute;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-close {
|
|
24
|
+
top: @gap;
|
|
25
|
+
right: @gap;
|
|
26
|
+
position: absolute;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div class="sse-reply" v-if="open">
|
|
33
|
+
<a-space direction="vertical" class="sse-reply-container">
|
|
34
|
+
<div class="sse-reply-title">
|
|
35
|
+
<span>{{ titles[active] }}</span>
|
|
36
|
+
<span v-if="feedback === 2"></span>
|
|
37
|
+
</div>
|
|
38
|
+
<div></div>
|
|
39
|
+
<div class="sse-reply-select">
|
|
40
|
+
<a-checkbox-group v-model:value="reply" :options="replies[active]" />
|
|
41
|
+
</div>
|
|
42
|
+
<div class="sse-reply-remark" v-if="other">
|
|
43
|
+
<a-input class="sse-reply-input" v-model:value="remark" placeholder="(可选)告诉我们更多关于你的使用体验" />
|
|
44
|
+
</div>
|
|
45
|
+
</a-space>
|
|
46
|
+
|
|
47
|
+
<a-button type="primary" class="sse-reply-submit" @click="submit">提交</a-button>
|
|
48
|
+
|
|
49
|
+
<fqa-icon icon="CloseOutlined" class="sse-reply-close" @click="close" />
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
export default {
|
|
55
|
+
props: {
|
|
56
|
+
id: {
|
|
57
|
+
type: [String],
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
60
|
+
feedback: {
|
|
61
|
+
type: [Number, String],
|
|
62
|
+
default: 0,
|
|
63
|
+
},
|
|
64
|
+
open: {
|
|
65
|
+
type: [Boolean],
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
titles: [
|
|
73
|
+
// 1 as 0
|
|
74
|
+
'你觉得什么让你满意?',
|
|
75
|
+
// 2 as 1
|
|
76
|
+
'你觉得什么让你不满意?',
|
|
77
|
+
],
|
|
78
|
+
replies: [
|
|
79
|
+
// 1 as 0
|
|
80
|
+
[
|
|
81
|
+
{ label: '内容准确', value: '内容准确' },
|
|
82
|
+
{ label: '内容完善', value: '内容完善' },
|
|
83
|
+
{ label: '数据准确', value: '数据准确' },
|
|
84
|
+
{ label: '逻辑清晰', value: '逻辑清晰' },
|
|
85
|
+
{ label: '其他', value: 0 },
|
|
86
|
+
],
|
|
87
|
+
// 2 as 1
|
|
88
|
+
[
|
|
89
|
+
{ label: '没有帮助', value: '没有帮助' },
|
|
90
|
+
{ label: '内容不完善', value: '内容不完善' },
|
|
91
|
+
{ label: '数据不准确', value: '数据不准确' },
|
|
92
|
+
{ label: '逻辑不清晰', value: '逻辑不清晰' },
|
|
93
|
+
{ label: '其他', value: 0 },
|
|
94
|
+
],
|
|
95
|
+
],
|
|
96
|
+
reply: [],
|
|
97
|
+
remark: '',
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
watch: {
|
|
102
|
+
feedback: {
|
|
103
|
+
handler(value) {
|
|
104
|
+
this.reset();
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
deep: true,
|
|
108
|
+
immediate: true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
computed: {
|
|
113
|
+
active() {
|
|
114
|
+
return this.feedback - 1;
|
|
115
|
+
},
|
|
116
|
+
other() {
|
|
117
|
+
return this.reply.includes(0);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
methods: {
|
|
122
|
+
reset() {
|
|
123
|
+
this.reply = [];
|
|
124
|
+
this.other = false;
|
|
125
|
+
this.remark = '';
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
async submit() {
|
|
129
|
+
// Set Cloner
|
|
130
|
+
const cloner = [...this.reply];
|
|
131
|
+
|
|
132
|
+
// Get Has
|
|
133
|
+
const has = cloner.includes(0);
|
|
134
|
+
|
|
135
|
+
// Check Has
|
|
136
|
+
if (has) {
|
|
137
|
+
// Get Remark
|
|
138
|
+
const remark = this.remark.replace(/^\s+|\s+$/g, '');
|
|
139
|
+
|
|
140
|
+
// Check Empty
|
|
141
|
+
if (!remark.length) {
|
|
142
|
+
return this.$util.toast.info('提交信息不能为空');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Update
|
|
146
|
+
cloner[cloner.length - 1] = this.remark;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Submit
|
|
150
|
+
const success = await this.$store.dispatch('sseengine/REPLY_SUBMIT', { answer_id: this.id, type: this.feedback, feedback_content: cloner.join(',') });
|
|
151
|
+
|
|
152
|
+
// Close
|
|
153
|
+
this.$emit('update:open', false);
|
|
154
|
+
|
|
155
|
+
// Update Open
|
|
156
|
+
if (success) {
|
|
157
|
+
this.$util.toast.success('反馈成功');
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
close() {
|
|
162
|
+
// Reset
|
|
163
|
+
this.reset();
|
|
164
|
+
|
|
165
|
+
// Close
|
|
166
|
+
this.$emit('update:open', false);
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
</script>
|
package/src/store/index.js
CHANGED
|
@@ -25,6 +25,9 @@ import { default as SNAP } from './snap';
|
|
|
25
25
|
// Use Hots
|
|
26
26
|
import { default as HOTS } from './hots';
|
|
27
27
|
|
|
28
|
+
// Use Reply
|
|
29
|
+
import { default as REPLY } from './reply';
|
|
30
|
+
|
|
28
31
|
// Use Session
|
|
29
32
|
import { default as SESSION } from './session';
|
|
30
33
|
|
|
@@ -205,6 +208,9 @@ export default (proxy = {}) => {
|
|
|
205
208
|
// Snap
|
|
206
209
|
...SNAP(proxy),
|
|
207
210
|
|
|
211
|
+
// Reply
|
|
212
|
+
...REPLY(proxy),
|
|
213
|
+
|
|
208
214
|
// Hots
|
|
209
215
|
...HOTS(proxy),
|
|
210
216
|
|