ai-read-over-mobile 0.0.1

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.
Files changed (44) hide show
  1. package/README.md +33 -0
  2. package/components/demo/api/index.js +104 -0
  3. package/components/demo/index.js +7 -0
  4. package/components/demo/plugins/cache.js +77 -0
  5. package/components/demo/src/chat-tools.vue +420 -0
  6. package/components/demo/src/main.vue +783 -0
  7. package/components/demo/src/member-table.vue +298 -0
  8. package/components/demo/src/read-over.vue +398 -0
  9. package/components/demo/src/tab-filter.vue +313 -0
  10. package/components/demo/static/bg-img.svg +10 -0
  11. package/components/demo/static/cai-active.png +0 -0
  12. package/components/demo/static/cai.png +0 -0
  13. package/components/demo/static/correct.png +0 -0
  14. package/components/demo/static/error.png +0 -0
  15. package/components/demo/static/filter-block.svg +23 -0
  16. package/components/demo/static/filter-block_hover.svg +23 -0
  17. package/components/demo/static/filter-block_selected.svg +23 -0
  18. package/components/demo/static/filter.png +0 -0
  19. package/components/demo/static/iconfont/iconfont.css +29 -0
  20. package/components/demo/static/iconfont/iconfont.js +1 -0
  21. package/components/demo/static/iconfont/iconfont.json +37 -0
  22. package/components/demo/static/iconfont/iconfont.ttf +0 -0
  23. package/components/demo/static/logo.png +0 -0
  24. package/components/demo/static/robot.png +0 -0
  25. package/components/demo/static/send-icon.png +0 -0
  26. package/components/demo/static/zan-active.png +0 -0
  27. package/components/demo/static/zan.png +0 -0
  28. package/components/demo/utils/aes-utils.js +35 -0
  29. package/components/demo/utils/config.js +46 -0
  30. package/components/demo/utils/constants.js +15 -0
  31. package/components/demo/utils/request.js +74 -0
  32. package/components/index.js +15 -0
  33. package/dist/ai-read-over-mobile.common.js +12129 -0
  34. package/dist/ai-read-over-mobile.common.js.map +1 -0
  35. package/dist/ai-read-over-mobile.css +1 -0
  36. package/dist/ai-read-over-mobile.umd.js +12148 -0
  37. package/dist/ai-read-over-mobile.umd.js.map +1 -0
  38. package/dist/ai-read-over-mobile.umd.min.js +18 -0
  39. package/dist/ai-read-over-mobile.umd.min.js.map +1 -0
  40. package/dist/demo.html +1 -0
  41. package/dist/img/filter-block.6f369747.svg +23 -0
  42. package/dist/img/filter-block_hover.5314be0a.svg +23 -0
  43. package/dist/img/filter-block_selected.f523d7f3.svg +23 -0
  44. package/package.json +44 -0
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # ai-questtion
2
+
3
+ ## Project setup
4
+ ```
5
+ npm install
6
+ ```
7
+
8
+ ### Compiles and minifies for production
9
+ ```
10
+ npm run build
11
+ ```
12
+
13
+ ### Customize configuration
14
+ See [Configuration Reference](https://cli.vuejs.org/config/).
15
+
16
+
17
+ ### test-project是测试组件项目
18
+
19
+ ### 公司自用组件 npm i ai-question
20
+
21
+ ### 调用方法
22
+ ...
23
+
24
+ this.$refs.name.showAddQuestion()
25
+ ...
26
+
27
+ ### top控制侧边弹框到顶部的距离
28
+
29
+ ### knowledgeList根据elment传参格式传入树形数据
30
+
31
+ ### propFormat知识点传参格式修改 {value : 'xxx',label : 'xxx','children' : 'xxx'}
32
+
33
+ ### join加入题库
@@ -0,0 +1,104 @@
1
+ import request from '../utils/request';
2
+ import constants from '../utils/constants';
3
+ const baseURL = sessionStorage.getItem('AI-INTELLIGENT-TOOLS_BASE_URL') || constants.publicPath;
4
+ let prefix = sessionStorage.getItem('AI-INTELLIGENT-TOOLS_PRE_FIX') || constants.publicPrefix;
5
+ // import cache from '../plugins/cache';
6
+ // import { EventSourcePolyfill } from 'event-source-polyfill';
7
+
8
+ // 0.0.9 版本接口升级
9
+ prefix += '/plugin/v2';
10
+ export const ssoAuth = (token, businessSource) => {
11
+ return request({
12
+ url: prefix + '/sso/assistant',
13
+ method: 'get',
14
+ params: {
15
+ token: token,
16
+ businessSource
17
+ },
18
+ });
19
+ }
20
+
21
+ export const authUser = (headers) => {
22
+ return request({
23
+ url: '/uc/authuser',
24
+ method: 'get',
25
+ headers: headers,
26
+ });
27
+ }
28
+
29
+ export const criticismApply = (id) => {
30
+ return request({
31
+ url: prefix + `/criticism/${id}/apply`,
32
+ method: 'post',
33
+ });
34
+ }
35
+
36
+ export const generateReview = (data, sseSessionId, courseId) =>{
37
+ return request({
38
+ url: prefix + '/criticism',
39
+ method: 'post',
40
+ data: data,
41
+ // headers: {
42
+ // 'X-Sse-SessionId': sseSessionId
43
+ // },
44
+ params: {
45
+ courseId: courseId
46
+ }
47
+ });
48
+ }
49
+
50
+ export const reanswerReview = (sseSessionId, courseId) =>{
51
+ return request({
52
+ url: prefix + '/criticism/comment',
53
+ method: 'put',
54
+ // headers: {
55
+ // 'X-Sse-SessionId': sseSessionId
56
+ // },
57
+ params: {
58
+ commentId: courseId
59
+ }
60
+ });
61
+ }
62
+
63
+ export const setFeedback = (params, data) => {
64
+ return request({
65
+ url: prefix + `/criticism/feedback`,
66
+ method: 'post',
67
+ data,
68
+ params
69
+ });
70
+ }
71
+
72
+ export const loopPoll = (data) => {
73
+ return request({
74
+ url: prefix + `/criticism/poll`,
75
+ method: 'post',
76
+ data,
77
+ });
78
+ }
79
+
80
+ // export const registerSse = (sseSessionId, fn, successFn) => {
81
+ // const source = new EventSourcePolyfill(baseURL + prefix + '/sse?id=' + sseSessionId, {
82
+ // headers: {
83
+ // 'X-Id-Token': cache.session.getJSON('SRKJ_TOKEN_CACHE'),
84
+ // },
85
+ // // heartbeatTimeout: 120000,
86
+ // heartbeatTimeout: 8000,
87
+ // });
88
+ // source.onmessage = function (event) {
89
+ // const { data } = event;
90
+ // if (data === '连接成功') {
91
+ // if (successFn) successFn();
92
+ // }
93
+ // };
94
+ // source.addEventListener('CRITICISM_ANSWER', (event) => {
95
+ // const data = event.data;
96
+ // fn(JSON.parse(data))
97
+ // });
98
+ // source.addEventListener('CRITICISM_COMMENT', (event) => {
99
+ // const data = event.data;
100
+ // fn({comments: [JSON.parse(data)]}, 'reanswer');
101
+ // });
102
+ //
103
+ // return source;
104
+ // }
@@ -0,0 +1,7 @@
1
+ import AiReadOverMobile from './src/main.vue'
2
+
3
+ AiReadOverMobile.install = function (Vue) {
4
+ Vue.component(AiReadOverMobile.name,AiReadOverMobile)
5
+ }
6
+
7
+ export default AiReadOverMobile
@@ -0,0 +1,77 @@
1
+ const sessionCache = {
2
+ set (key, value) {
3
+ if (!sessionStorage) {
4
+ return
5
+ }
6
+ if (key != null && value != null) {
7
+ sessionStorage.setItem(key, value)
8
+ }
9
+ },
10
+ get (key) {
11
+ if (!sessionStorage) {
12
+ return null
13
+ }
14
+ if (key == null) {
15
+ return null
16
+ }
17
+ return sessionStorage.getItem(key)
18
+ },
19
+ setJSON (key, jsonValue) {
20
+ if (jsonValue != null) {
21
+ this.set(key, JSON.stringify(jsonValue))
22
+ }
23
+ },
24
+ getJSON (key) {
25
+ const value = this.get(key)
26
+ if (value != null) {
27
+ return JSON.parse(value)
28
+ }
29
+ },
30
+ remove (key) {
31
+ sessionStorage.removeItem(key);
32
+ }
33
+ }
34
+ const localCache = {
35
+ set (key, value) {
36
+ if (!localStorage) {
37
+ return
38
+ }
39
+ if (key != null && value != null) {
40
+ localStorage.setItem(key, value)
41
+ }
42
+ },
43
+ get (key) {
44
+ if (!localStorage) {
45
+ return null
46
+ }
47
+ if (key == null) {
48
+ return null
49
+ }
50
+ return localStorage.getItem(key)
51
+ },
52
+ setJSON (key, jsonValue) {
53
+ if (jsonValue != null) {
54
+ this.set(key, JSON.stringify(jsonValue))
55
+ }
56
+ },
57
+ getJSON (key) {
58
+ const value = this.get(key)
59
+ if (value != null) {
60
+ return JSON.parse(value)
61
+ }
62
+ },
63
+ remove (key) {
64
+ localStorage.removeItem(key);
65
+ }
66
+ }
67
+
68
+ export default {
69
+ /**
70
+ * 会话级缓存
71
+ */
72
+ session: sessionCache,
73
+ /**
74
+ * 本地缓存
75
+ */
76
+ local: localCache
77
+ }
@@ -0,0 +1,420 @@
1
+ <template>
2
+ <div class="robot-tools">
3
+ <div class="robot-reanswer" @click="reAnswer(listData)">
4
+ <i class="el-icon-refresh-right"></i>
5
+ 重新回答
6
+ </div>
7
+ <div class="stopMsg" style="color: #cfcfcf; cursor: default" v-if="type !== 'error'">已停止生成</div>
8
+ <div class="stopMsg" v-if="type !== 'error'">
9
+ 停止输出
10
+ </div>
11
+ <div class="right-tools">
12
+ <el-tooltip content="赞" effect="light" placement="top">
13
+ <div class="tools-icon" @click="doZan(listData)">
14
+ <img src="../static/zan.png" alt="" v-if="listData.feedback !== 1">
15
+ <img alt="" src="../static/zan-active.png" v-else>
16
+ </div>
17
+ </el-tooltip>
18
+ <el-popover v-model="popover" placement="top-start" trigger="manual">
19
+ <div slot="reference">
20
+ <el-tooltip content="踩" effect="light" placement="bottom">
21
+ <div class="tools-icon" @click="openPopover" v-if="listData.feedback !== 2">
22
+ <img alt="" src="../static/cai.png">
23
+ </div>
24
+ <div class="tools-icon" v-else @click="doCai(listData)">
25
+ <img alt="" src="../static/cai-active.png">
26
+ </div>
27
+ </el-tooltip>
28
+ </div>
29
+ <div class="popover-box">
30
+ <div class="pop-title">
31
+ 你的反馈将 <br/>
32
+ 帮助职教一问优化进步
33
+ </div>
34
+ <i class="el-icon-close" style="font-size: 2rem"
35
+ @click="cancelPopover()"></i>
36
+ <div class="error-list">
37
+ <el-checkbox-group v-model="errors">
38
+ <el-checkbox v-for="item in errorList"
39
+ :key="item.code"
40
+ :label="item.code"
41
+ border
42
+ class="check">
43
+ {{ item.name }}
44
+ </el-checkbox>
45
+ </el-checkbox-group>
46
+ <el-input v-model="input" :rows="4"
47
+ maxlength="30"
48
+ placeholder="其他"
49
+ resize="none"
50
+ show-word-limit
51
+ type="textarea"/>
52
+ <div class="sumit-button">
53
+ <el-button :disabled="canSubmit" @click="doCai(listData)">提交</el-button>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </el-popover>
58
+ </div>
59
+ </div>
60
+ </template>
61
+ <script>
62
+ import {errorList} from "../utils/config";
63
+ import {setFeedback} from '../api/index';
64
+
65
+ export default {
66
+ name: 'ChatTools',
67
+ props: {
68
+ type: {
69
+ type: String,
70
+ default: 'chart'
71
+ },
72
+ detailData: {
73
+ type: Object,
74
+ default: () => {
75
+ }
76
+ },
77
+ },
78
+ data() {
79
+ return {
80
+ input: "",
81
+ popover: false,
82
+ errors: [],
83
+ errorList: errorList,
84
+ }
85
+ },
86
+ computed: {
87
+ canSubmit() {
88
+ return this.errors.length === 0 && this.input === "";
89
+ },
90
+ listData() {
91
+ return this.detailData;
92
+ },
93
+ },
94
+ methods: {
95
+ cancelPopover() {
96
+ this.popover = false;
97
+ },
98
+ openPopover() {
99
+ this.popover = true;
100
+ },
101
+ reAnswer(list) {
102
+ this.$emit('on-reanswer', list);
103
+ },
104
+ async doZan(list) {
105
+ list.feedback = list.feedback === 1 ? 0 : 1;
106
+ const param = {
107
+ commentId: list.id,
108
+ feedbackId: list.feedbackId,
109
+ type: list.feedback,
110
+ }
111
+ list.feedbackId = await setFeedback(param);
112
+ this.$forceUpdate();
113
+ },
114
+ async doCai(list) {
115
+ let caiOption = {};
116
+ if (!list.cai) {
117
+ caiOption = {
118
+ desc: this.input,
119
+ tags: this.errors
120
+ }
121
+ }
122
+ list.feedback = list.feedback !== 2 ? 2 : 0;
123
+ const param = {
124
+ commentId: list.id,
125
+ feedbackId: list.feedbackId,
126
+ type: list.feedback,
127
+ }
128
+ list.feedbackId = await setFeedback(param, caiOption);
129
+ this.$forceUpdate();
130
+ if (list.feedback === 2) {
131
+ this.$message.success('感谢您的反馈');
132
+ }
133
+ this.popover = false;
134
+ this.input = '';
135
+ this.errors = [];
136
+ }
137
+ }
138
+ }
139
+ </script>
140
+ <style lang="scss" scoped>
141
+ .robot-tools {
142
+ position: relative;
143
+ margin-top: 8px;
144
+ display: flex;
145
+ align-items: center;
146
+ flex-wrap: wrap;
147
+ gap: 8px;
148
+
149
+ .robot-reanswer {
150
+ width: 104px;
151
+ height: 32px;
152
+ background-color: rgba(32, 40, 64, 0.078);
153
+ border-radius: 16px;
154
+ font-size: 13px;
155
+ text-align: center;
156
+ line-height: 32px;
157
+ cursor: pointer;
158
+ transition: all 0.3s ease;
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ gap: 4px;
163
+
164
+ &:hover {
165
+ background: #ced0f0;
166
+ transform: translateY(-1px);
167
+ }
168
+
169
+ i {
170
+ font-size: 16px;
171
+ }
172
+ }
173
+
174
+ .stopMsg {
175
+ cursor: pointer;
176
+ height: 20px;
177
+ width: 100px;
178
+ font-size: 16px;
179
+ color: #316cff;
180
+ transition: all 0.3s ease;
181
+
182
+ &:hover {
183
+ opacity: 0.8;
184
+ }
185
+ }
186
+
187
+ .tools-icon {
188
+ width: 40px;
189
+ height: 32px;
190
+ background-color: rgba(32, 40, 64, 0.078);
191
+ border-radius: 16px;
192
+ text-align: center;
193
+ line-height: 34px;
194
+ cursor: pointer;
195
+ transition: all 0.3s ease;
196
+ display: flex;
197
+ align-items: center;
198
+ justify-content: center;
199
+
200
+ img {
201
+ width: 20px;
202
+ height: 20px;
203
+ }
204
+
205
+ &:hover {
206
+ background: #ced0f0;
207
+ transform: translateY(-1px);
208
+ }
209
+ }
210
+
211
+ .right-tools {
212
+ position: absolute;
213
+ right: 0;
214
+ top: 0;
215
+ display: flex;
216
+ gap: 8px;
217
+ }
218
+ }
219
+
220
+ .popover-box {
221
+ width: 380px;
222
+ height: 450px;
223
+ border-radius: 20px;
224
+ padding: 20px;
225
+ box-sizing: border-box;
226
+ position: relative;
227
+ background: #fff;
228
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
229
+
230
+ .pop-title {
231
+ width: 220px;
232
+ height: 60px;
233
+ font-family: PingFangSC, PingFang SC;
234
+ font-weight: 500;
235
+ font-size: 22px;
236
+ color: #333333;
237
+ line-height: 30px;
238
+ text-align: left;
239
+ font-style: normal;
240
+ }
241
+
242
+ .el-icon-close {
243
+ position: absolute;
244
+ right: 20px;
245
+ top: 20px;
246
+ color: #333333;
247
+ cursor: pointer;
248
+ transition: all 0.3s;
249
+ padding: 4px;
250
+ border-radius: 50%;
251
+
252
+ &:hover {
253
+ transform: rotate(-180deg);
254
+ background-color: rgba(0, 0, 0, 0.05);
255
+ }
256
+ }
257
+
258
+ .error-list {
259
+ display: flex;
260
+ flex-direction: column;
261
+ gap: 16px;
262
+ margin-top: 20px;
263
+
264
+ .el-checkbox-group {
265
+ display: flex;
266
+ flex-wrap: wrap;
267
+ gap: 8px;
268
+ }
269
+
270
+ .el-textarea__inner {
271
+ resize: none;
272
+ border-radius: 8px;
273
+ padding: 12px;
274
+ font-size: 14px;
275
+ }
276
+
277
+ .sumit-button {
278
+ margin-top: 20px;
279
+ display: flex;
280
+ justify-content: center;
281
+
282
+ .el-button {
283
+ width: 112px;
284
+ height: 42px;
285
+ background: linear-gradient(180deg, #5fa5ff 0%, #316cff 100%);
286
+ border-radius: 21px;
287
+ color: #fff;
288
+ transition: all 0.3s ease;
289
+
290
+ &:hover {
291
+ transform: translateY(-1px);
292
+ box-shadow: 0 4px 12px rgba(49, 108, 255, 0.2);
293
+ }
294
+
295
+ &:disabled {
296
+ opacity: 0.6;
297
+ cursor: not-allowed;
298
+ transform: none;
299
+ box-shadow: none;
300
+ }
301
+ }
302
+ }
303
+
304
+ .check.is-bordered {
305
+ margin: 0;
306
+ padding: 8px 16px;
307
+ border-radius: 8px;
308
+ transition: all 0.3s ease;
309
+
310
+ &:hover {
311
+ border-color: #316cff;
312
+ }
313
+ }
314
+ }
315
+ }
316
+
317
+ // 响应式设计
318
+ @media screen and (max-width: 768px) {
319
+ .robot-tools {
320
+ .robot-reanswer {
321
+ width: 90px;
322
+ height: 28px;
323
+ font-size: 12px;
324
+ line-height: 28px;
325
+
326
+ i {
327
+ font-size: 14px;
328
+ }
329
+ }
330
+
331
+ .stopMsg {
332
+ width: 80px;
333
+ font-size: 14px;
334
+ }
335
+
336
+ .tools-icon {
337
+ width: 36px;
338
+ height: 28px;
339
+ line-height: 28px;
340
+
341
+ img {
342
+ width: 18px;
343
+ height: 18px;
344
+ }
345
+ }
346
+ }
347
+
348
+ .popover-box {
349
+ width: 320px;
350
+ height: 400px;
351
+ padding: 16px;
352
+
353
+ .pop-title {
354
+ font-size: 18px;
355
+ line-height: 24px;
356
+ }
357
+
358
+ .error-list {
359
+ .el-checkbox-group {
360
+ gap: 6px;
361
+ }
362
+
363
+ .el-textarea__inner {
364
+ padding: 8px;
365
+ font-size: 13px;
366
+ }
367
+
368
+ .sumit-button {
369
+ .el-button {
370
+ width: 100px;
371
+ height: 36px;
372
+ font-size: 14px;
373
+ }
374
+ }
375
+
376
+ .check.is-bordered {
377
+ padding: 6px 12px;
378
+ font-size: 13px;
379
+ }
380
+ }
381
+ }
382
+ }
383
+
384
+ // 平板设备
385
+ @media screen and (min-width: 769px) and (max-width: 1024px) {
386
+ .popover-box {
387
+ width: 340px;
388
+ height: 420px;
389
+ }
390
+ }
391
+
392
+ // 大屏幕设备
393
+ @media screen and (min-width: 1025px) {
394
+ .robot-tools {
395
+ .robot-reanswer {
396
+ &:hover {
397
+ transform: translateY(-2px);
398
+ }
399
+ }
400
+
401
+ .tools-icon {
402
+ &:hover {
403
+ transform: translateY(-2px);
404
+ }
405
+ }
406
+ }
407
+
408
+ .popover-box {
409
+ .error-list {
410
+ .sumit-button {
411
+ .el-button {
412
+ &:hover {
413
+ transform: translateY(-2px);
414
+ }
415
+ }
416
+ }
417
+ }
418
+ }
419
+ }
420
+ </style>