vue2-client 1.8.48 → 1.8.49
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 +4 -3
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/assets/svg/badtwo.svg +1 -0
- package/src/assets/svg/goodtwo.svg +1 -0
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/pages/DynamicStatistics/ChartSelector.vue +226 -155
- package/src/pages/DynamicStatistics/DataTabs.vue +63 -112
- package/src/pages/DynamicStatistics/DynamicTable.vue +76 -76
- package/src/pages/DynamicStatistics/EvaluationArea.vue +56 -54
- package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
- package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +279 -0
- package/src/pages/DynamicStatistics/SearchBar.vue +167 -130
- package/src/pages/DynamicStatistics/index.vue +203 -201
- package/src/pages/ServiceReview/index.vue +284 -284
- package/src/services/api/restTools.js +24 -24
- package/src/utils/waterMark.js +31 -31
- package/vue.config.js +6 -0
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="table-main">
|
|
3
|
-
<a-table
|
|
4
|
-
:scroll="{ x: scrollXWidth, y: scrollYHeight }"
|
|
5
|
-
size="middle"
|
|
6
|
-
:columns="tableColumns"
|
|
7
|
-
:dataSource="tableData"
|
|
8
|
-
:rowKey="record => record.id">
|
|
9
|
-
</a-table>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
name: 'DynamicTable',
|
|
17
|
-
data () {
|
|
18
|
-
return {
|
|
19
|
-
tableColumns: [],
|
|
20
|
-
// x滚动条宽度
|
|
21
|
-
scrollXWidth: 1600,
|
|
22
|
-
scrollYHeight: 400
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
mounted () {
|
|
26
|
-
this.initData()
|
|
27
|
-
},
|
|
28
|
-
props: {
|
|
29
|
-
tableData: {
|
|
30
|
-
type: Array,
|
|
31
|
-
required: true
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
watch: {
|
|
35
|
-
tableData: {
|
|
36
|
-
deep: true,
|
|
37
|
-
handler (newVal) {
|
|
38
|
-
this.initData()
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
methods: {
|
|
43
|
-
async initData () {
|
|
44
|
-
try {
|
|
45
|
-
// 从数据第一项推断列信息
|
|
46
|
-
const sample = this.tableData[0]
|
|
47
|
-
this.tableColumns = Object.keys(sample).map(key => ({
|
|
48
|
-
title: key, // 使用键名作为列标题
|
|
49
|
-
dataIndex: key, // 数据索引与键名相同
|
|
50
|
-
key: key,
|
|
51
|
-
ellipsis: true,
|
|
52
|
-
}))
|
|
53
|
-
let totalWidth = 0
|
|
54
|
-
// 设置表格宽度
|
|
55
|
-
for (let i = 0; i < this.tableColumns.length; i++) {
|
|
56
|
-
totalWidth = totalWidth + 180
|
|
57
|
-
}
|
|
58
|
-
// 设置表格高度为固定值
|
|
59
|
-
this.scrollYHeight = 'calc(100vh - 40rem)'
|
|
60
|
-
// 横向滚动长度大于所有宽度,才能实现固定表头
|
|
61
|
-
this.scrollXWidth = totalWidth
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error('Fetching data failed:', error)
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
</script>
|
|
69
|
-
<style lang="less" scoped>
|
|
70
|
-
.table-main {
|
|
71
|
-
margin-top: 8px;
|
|
72
|
-
:deep(.ant-table) {
|
|
73
|
-
background-color: #fff;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-main">
|
|
3
|
+
<a-table
|
|
4
|
+
:scroll="{ x: scrollXWidth, y: scrollYHeight }"
|
|
5
|
+
size="middle"
|
|
6
|
+
:columns="tableColumns"
|
|
7
|
+
:dataSource="tableData"
|
|
8
|
+
:rowKey="record => record.id">
|
|
9
|
+
</a-table>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'DynamicTable',
|
|
17
|
+
data () {
|
|
18
|
+
return {
|
|
19
|
+
tableColumns: [],
|
|
20
|
+
// x滚动条宽度
|
|
21
|
+
scrollXWidth: 1600,
|
|
22
|
+
scrollYHeight: 400
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
mounted () {
|
|
26
|
+
this.initData()
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
tableData: {
|
|
30
|
+
type: Array,
|
|
31
|
+
required: true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
watch: {
|
|
35
|
+
tableData: {
|
|
36
|
+
deep: true,
|
|
37
|
+
handler (newVal) {
|
|
38
|
+
this.initData()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
async initData () {
|
|
44
|
+
try {
|
|
45
|
+
// 从数据第一项推断列信息
|
|
46
|
+
const sample = this.tableData[0]
|
|
47
|
+
this.tableColumns = Object.keys(sample).map(key => ({
|
|
48
|
+
title: key, // 使用键名作为列标题
|
|
49
|
+
dataIndex: key, // 数据索引与键名相同
|
|
50
|
+
key: key,
|
|
51
|
+
ellipsis: true,
|
|
52
|
+
}))
|
|
53
|
+
let totalWidth = 0
|
|
54
|
+
// 设置表格宽度
|
|
55
|
+
for (let i = 0; i < this.tableColumns.length; i++) {
|
|
56
|
+
totalWidth = totalWidth + 180
|
|
57
|
+
}
|
|
58
|
+
// 设置表格高度为固定值
|
|
59
|
+
this.scrollYHeight = 'calc(100vh - 40rem)'
|
|
60
|
+
// 横向滚动长度大于所有宽度,才能实现固定表头
|
|
61
|
+
this.scrollXWidth = totalWidth
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error('Fetching data failed:', error)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
<style lang="less" scoped>
|
|
70
|
+
.table-main {
|
|
71
|
+
margin-top: 8px;
|
|
72
|
+
:deep(.ant-table) {
|
|
73
|
+
background-color: #fff;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="evaluation-card">
|
|
3
|
-
<div v-if="!action">
|
|
4
|
-
<p>您对这次搜索结果满意吗?</p>
|
|
5
|
-
<a-button-group>
|
|
6
|
-
<a-
|
|
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
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="evaluation-card">
|
|
3
|
+
<div v-if="!action">
|
|
4
|
+
<p>您对这次搜索结果满意吗?</p>
|
|
5
|
+
<a-button-group>
|
|
6
|
+
<a-space>
|
|
7
|
+
<a-button type="primary" icon="like" @click="submitEvaluation(true)">满意</a-button>
|
|
8
|
+
<a-button type="danger" icon="dislike" @click="submitEvaluation(false)">不满意</a-button>
|
|
9
|
+
</a-space>
|
|
10
|
+
</a-button-group>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import { post } from '@vue2-client/services/api'
|
|
17
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
data () {
|
|
21
|
+
return {
|
|
22
|
+
action: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
uuid: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
submitEvaluation (result) {
|
|
33
|
+
const key = 'question-' + this.uuid
|
|
34
|
+
indexedDB.get(key, (item) => {
|
|
35
|
+
const content = Object.assign(item, {
|
|
36
|
+
evaluation: result
|
|
37
|
+
})
|
|
38
|
+
post('/api/af-system/logic/openapi/addCommonData', {
|
|
39
|
+
type: 'ai-evaluation',
|
|
40
|
+
content: content
|
|
41
|
+
}).then(res => {
|
|
42
|
+
this.action = true
|
|
43
|
+
this.$message.success('评论成功')
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
<style lang="less" scoped>
|
|
51
|
+
.evaluation-card {
|
|
52
|
+
width: 50%;
|
|
53
|
+
text-align: center;
|
|
54
|
+
margin: 20px auto 0 auto;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a-list v-show="!loading" size="small" :data-source="data">
|
|
4
|
-
<a-list-item slot="renderItem" slot-scope="item">
|
|
5
|
-
<div>
|
|
6
|
-
<p><a @click="$emit('openFavorites', item.uuid)">{{ item.question }} </a></p>
|
|
7
|
-
<p>{{ item.date }}</p>
|
|
8
|
-
</div>
|
|
9
|
-
<a class="delete_item">
|
|
10
|
-
<a-icon type="close" @click="$emit('saveToFavorites', item.uuid)"/>
|
|
11
|
-
</a>
|
|
12
|
-
</a-list-item>
|
|
13
|
-
</a-list>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
name: 'FavoriteList',
|
|
22
|
-
data () {
|
|
23
|
-
return {
|
|
24
|
-
data: [],
|
|
25
|
-
loading: false
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
mounted () {
|
|
29
|
-
this.loadData()
|
|
30
|
-
},
|
|
31
|
-
methods: {
|
|
32
|
-
loadData () {
|
|
33
|
-
console.warn(123)
|
|
34
|
-
indexedDB.getAll((data) => {
|
|
35
|
-
const realData = data.filter(item => item.data && item.data.uuid)
|
|
36
|
-
.map(item => item.data)
|
|
37
|
-
this.data = realData
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
</script>
|
|
43
|
-
<style lang="less" scoped>
|
|
44
|
-
.delete_item {
|
|
45
|
-
margin-left: 8px;
|
|
46
|
-
color: #333;
|
|
47
|
-
}
|
|
48
|
-
p {
|
|
49
|
-
margin: 0
|
|
50
|
-
}
|
|
51
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-list v-show="!loading" size="small" :data-source="data">
|
|
4
|
+
<a-list-item slot="renderItem" slot-scope="item">
|
|
5
|
+
<div>
|
|
6
|
+
<p><a @click="$emit('openFavorites', item.uuid)">{{ item.question }} </a></p>
|
|
7
|
+
<p>{{ item.date }}</p>
|
|
8
|
+
</div>
|
|
9
|
+
<a class="delete_item">
|
|
10
|
+
<a-icon type="close" @click="$emit('saveToFavorites', item.uuid)"/>
|
|
11
|
+
</a>
|
|
12
|
+
</a-list-item>
|
|
13
|
+
</a-list>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
name: 'FavoriteList',
|
|
22
|
+
data () {
|
|
23
|
+
return {
|
|
24
|
+
data: [],
|
|
25
|
+
loading: false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
mounted () {
|
|
29
|
+
this.loadData()
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
loadData () {
|
|
33
|
+
console.warn(123)
|
|
34
|
+
indexedDB.getAll((data) => {
|
|
35
|
+
const realData = data.filter(item => item.data && item.data.uuid)
|
|
36
|
+
.map(item => item.data)
|
|
37
|
+
this.data = realData
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
<style lang="less" scoped>
|
|
44
|
+
.delete_item {
|
|
45
|
+
margin-left: 8px;
|
|
46
|
+
color: #333;
|
|
47
|
+
}
|
|
48
|
+
p {
|
|
49
|
+
margin: 0
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-card class="question-history" id="question-history" size="small">
|
|
3
|
+
<a-tabs v-model="activeKey">
|
|
4
|
+
<a-tab-pane key="1" tab="对话历史">
|
|
5
|
+
<a-list item-layout="horizontal" :data-source="questions">
|
|
6
|
+
<a-list-item
|
|
7
|
+
slot="renderItem"
|
|
8
|
+
:class="item.uuid === currentuuid ? 'question-history-active' : 'question-history-inactive'"
|
|
9
|
+
slot-scope="item,index"
|
|
10
|
+
@click="handleOpenFavorite(item)">
|
|
11
|
+
<a-list-item-meta
|
|
12
|
+
:title="item.question"
|
|
13
|
+
:description="item.date"
|
|
14
|
+
/>
|
|
15
|
+
<a-space>
|
|
16
|
+
<a-icon
|
|
17
|
+
type="delete"
|
|
18
|
+
theme="filled"
|
|
19
|
+
class="delClass"
|
|
20
|
+
@click.stop="delQuestion(item,index)"
|
|
21
|
+
/>
|
|
22
|
+
<span> </span>
|
|
23
|
+
<a-icon
|
|
24
|
+
v-if="item.data"
|
|
25
|
+
type="star"
|
|
26
|
+
:class="item.isFavorite ? 'startActive' : 'startInactive'"
|
|
27
|
+
@click.stop="toFavorites(item,index)"
|
|
28
|
+
:theme=" item.isFavorite ? 'filled': 'twoTone'"
|
|
29
|
+
two-tone-color="#FFD700"/>
|
|
30
|
+
<a-icon
|
|
31
|
+
v-else
|
|
32
|
+
@click.stop="reTrySearch(item)"
|
|
33
|
+
type="sync"
|
|
34
|
+
class="reSearch"
|
|
35
|
+
title="重新查询"/>
|
|
36
|
+
</a-space>
|
|
37
|
+
</a-list-item>
|
|
38
|
+
</a-list>
|
|
39
|
+
</a-tab-pane>
|
|
40
|
+
<a-tab-pane key="2" tab="收藏的对话" force-render>
|
|
41
|
+
<a-list item-layout="horizontal" :data-source="favorites">
|
|
42
|
+
<a-list-item
|
|
43
|
+
slot="renderItem"
|
|
44
|
+
slot-scope="item, index"
|
|
45
|
+
:class="item.uuid === currentuuid ? 'question-history-active' : 'question-history-inactive'"
|
|
46
|
+
@click="handleOpenFavorite(item)">
|
|
47
|
+
<a-list-item-meta
|
|
48
|
+
:title="item.question"
|
|
49
|
+
:description="item.date"
|
|
50
|
+
/>
|
|
51
|
+
<a-space>
|
|
52
|
+
<a-icon
|
|
53
|
+
type="star"
|
|
54
|
+
:class="item.isFavorite ? 'startActive' : 'startInactive'"
|
|
55
|
+
@click.stop="delFavorites(item,index)"
|
|
56
|
+
:theme=" item.isFavorite ? 'filled': 'twoTone'"
|
|
57
|
+
two-tone-color="#FFD700"/>
|
|
58
|
+
</a-space>
|
|
59
|
+
</a-list-item>
|
|
60
|
+
</a-list>
|
|
61
|
+
</a-tab-pane>
|
|
62
|
+
</a-tabs>
|
|
63
|
+
</a-card>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
import { indexedDB } from '@/utils/indexedDB'
|
|
68
|
+
import { formatDate } from '@/utils/util'
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
props: {
|
|
72
|
+
currentuuid: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: ''
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
data () {
|
|
78
|
+
return {
|
|
79
|
+
activeKey: '1',
|
|
80
|
+
questions: [], // 你的问题历史
|
|
81
|
+
favorites: [] // 你的收藏问题
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
mounted () {
|
|
85
|
+
this.loadData()
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
loadData () {
|
|
89
|
+
indexedDB.getAll((data) => {
|
|
90
|
+
// 遍历data,将question和favorites分别赋值给questions和favorites
|
|
91
|
+
for (const datum of data) {
|
|
92
|
+
if (datum.key.includes('question')) {
|
|
93
|
+
this.questions.push(datum.data)
|
|
94
|
+
} else if (datum.key.includes('favorites')) {
|
|
95
|
+
this.favorites.push(datum.data)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
},
|
|
101
|
+
handleOpenFavorite (item) {
|
|
102
|
+
this.$emit('handleOpenFavorite', item)
|
|
103
|
+
},
|
|
104
|
+
reTrySearch (item) {
|
|
105
|
+
this.$emit('handleSearch', item.question, null, item.uuid)
|
|
106
|
+
},
|
|
107
|
+
add (question) {
|
|
108
|
+
// 检查 questions 数组中是否已经存在这个问题 替换掉
|
|
109
|
+
const index = this.questions.findIndex(item => item.uuid === question.uuid)
|
|
110
|
+
if (index !== -1) {
|
|
111
|
+
if (question.data) {
|
|
112
|
+
this.questions.splice(index, 1, Object.assign(question, { date: this.questions[index].date }))
|
|
113
|
+
} else {
|
|
114
|
+
this.questions.splice(index, 1, question)
|
|
115
|
+
}
|
|
116
|
+
this.updateQuestion(question)
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
this.questions.push(question)
|
|
120
|
+
indexedDB.add('question-' + question.uuid, question)
|
|
121
|
+
},
|
|
122
|
+
updateQuestion (question) {
|
|
123
|
+
const questionKey = 'question-' + question.uuid
|
|
124
|
+
indexedDB.delete(questionKey)
|
|
125
|
+
indexedDB.add(questionKey, question)
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
toFavorites (question, index) {
|
|
129
|
+
this.questions[index].isFavorite = !this.questions[index].isFavorite
|
|
130
|
+
if (this.questions[index].isFavorite) {
|
|
131
|
+
const key = 'favorites-' + question.uuid
|
|
132
|
+
question.date = formatDate('now')
|
|
133
|
+
question.isFavorite = true
|
|
134
|
+
indexedDB.add(key, question)
|
|
135
|
+
this.favorites.push(question)
|
|
136
|
+
this.$message.success('收藏成功')
|
|
137
|
+
} else {
|
|
138
|
+
// 根据 uuid 删除 favorites 中的对应项
|
|
139
|
+
this.favorites = this.favorites.filter(item => item.uuid !== question.uuid)
|
|
140
|
+
// 删除收藏的储存
|
|
141
|
+
const key = 'favorites-' + question.uuid
|
|
142
|
+
indexedDB.delete(key)
|
|
143
|
+
}
|
|
144
|
+
this.updateQuestion(question)
|
|
145
|
+
},
|
|
146
|
+
delQuestion (item, index) {
|
|
147
|
+
// 删除对话历史
|
|
148
|
+
this.questions.splice(index, 1)
|
|
149
|
+
const key = 'question-' + item.uuid
|
|
150
|
+
indexedDB.delete(key)
|
|
151
|
+
// 删除收藏
|
|
152
|
+
const favoritesKey = 'favorites-' + item.uuid
|
|
153
|
+
indexedDB.delete(favoritesKey)
|
|
154
|
+
// 删除收藏数组中的对应项
|
|
155
|
+
this.favorites = this.favorites.filter(favorite => favorite.uuid !== item.uuid)
|
|
156
|
+
this.$message.success('删除成功')
|
|
157
|
+
},
|
|
158
|
+
delFavorites (item, index) {
|
|
159
|
+
this.favorites.splice(index, 1)
|
|
160
|
+
// 根据uuid寻找 questions 中的对应项
|
|
161
|
+
// 重新赋值给 questions
|
|
162
|
+
this.questions = this.questions.map(_item => {
|
|
163
|
+
if (_item.uuid === item.uuid) {
|
|
164
|
+
_item.isFavorite = false
|
|
165
|
+
}
|
|
166
|
+
return _item
|
|
167
|
+
})
|
|
168
|
+
const key = 'favorites-' + item.uuid
|
|
169
|
+
indexedDB.delete(key)
|
|
170
|
+
this.$message.success('取消收藏成功')
|
|
171
|
+
// 如果favorites为空,切换到对话历史
|
|
172
|
+
if (this.favorites.length === 0) {
|
|
173
|
+
this.activeKey = '1'
|
|
174
|
+
}
|
|
175
|
+
this.updateQuestion(item)
|
|
176
|
+
}
|
|
177
|
+
,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<style scoped lang="less">
|
|
183
|
+
|
|
184
|
+
#question-history {
|
|
185
|
+
|
|
186
|
+
margin-right: 10px;
|
|
187
|
+
height: 100%;
|
|
188
|
+
|
|
189
|
+
.question-history-active {
|
|
190
|
+
border-left: 4px solid #1890FF;
|
|
191
|
+
// 左上左下圆角
|
|
192
|
+
border-radius: 4px 0 0 4px;
|
|
193
|
+
padding-left : 4px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.question-history-inactive {
|
|
197
|
+
padding-left : 8px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ant-list-item-meta /deep/ {
|
|
201
|
+
width: 60%;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.ant-list-item-meta-content /deep/ {
|
|
205
|
+
width: 98%;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.ant-list-item-meta-title /deep/ {
|
|
209
|
+
width: 90%;
|
|
210
|
+
white-space: nowrap;
|
|
211
|
+
overflow: hidden;
|
|
212
|
+
text-overflow: ellipsis;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.ant-card {
|
|
216
|
+
height: 100%;
|
|
217
|
+
overflow-y: auto;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.startActive {
|
|
221
|
+
color: #FFD700;
|
|
222
|
+
font-size: 1rem;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.startInactive {
|
|
226
|
+
font-size: 1rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.delClass {
|
|
230
|
+
font-size: 1rem;
|
|
231
|
+
color: #777;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.reSearch {
|
|
235
|
+
font-size: 1rem;
|
|
236
|
+
color: #1890FF;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.reSearch:hover {
|
|
240
|
+
animation: rotate 0.5s ease-in-out both;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@keyframes rotate {
|
|
244
|
+
0% {
|
|
245
|
+
transform: rotate(0deg);
|
|
246
|
+
}
|
|
247
|
+
100% {
|
|
248
|
+
transform: rotate(180deg);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.startActive, .startInactive, .reSearch {
|
|
253
|
+
transition: transform 0.1s;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.startActive:hover, .startInactive:hover {
|
|
257
|
+
animation: shake 0.5s ease-in-out both;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@keyframes shake {
|
|
261
|
+
0% {
|
|
262
|
+
transform: rotate(0deg);
|
|
263
|
+
}
|
|
264
|
+
25% {
|
|
265
|
+
transform: rotate(-20deg);
|
|
266
|
+
}
|
|
267
|
+
50% {
|
|
268
|
+
transform: rotate(0deg);
|
|
269
|
+
}
|
|
270
|
+
75% {
|
|
271
|
+
transform: rotate(20deg);
|
|
272
|
+
}
|
|
273
|
+
100% {
|
|
274
|
+
transform: rotate(0deg);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
</style>
|