Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fns_front_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
fns_front_2
Commits
9a2b89f8
Commit
9a2b89f8
authored
Sep 26, 2021
by
CHENQIKUAI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faq list
parent
3ae247d1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
14 deletions
+33
-14
package-lock.json
package-lock.json
+0
-0
package.json
package.json
+1
-0
index.vue
src/components/CommonUseSentence/index.vue
+11
-7
index.ts
src/service/FaqService/index.ts
+5
-1
Chat.vue
src/views/Chat/Chat.vue
+16
-6
No files found.
package-lock.json
View file @
9a2b89f8
This diff is collapsed.
Click to expand it.
package.json
View file @
9a2b89f8
...
...
@@ -18,6 +18,7 @@
"
dayjs
"
:
"^1.10.7"
,
"
dexie
"
:
"^3.0.3"
,
"
enc-utils
"
:
"^3.0.0"
,
"
js-base64
"
:
"^3.7.2"
,
"
prepend-http
"
:
"^4.0.0"
,
"
quasar
"
:
"^2.0.4"
,
"
secp256k1
"
:
"^4.0.2"
,
...
...
src/components/CommonUseSentence/index.vue
View file @
9a2b89f8
<
template
>
<div
class=
"overflow-auto"
>
<div
v-for=
"item in list"
:key=
"item"
class=
"text-center sentence"
@
click=
"$emit('useSentence', item)"
>
{{
item
}}
</div>
<Skeleton
:loading=
"loading"
:row=
"5"
row-width=
"[100%]"
>
<div
v-for=
"item in list"
:key=
"item"
class=
"text-center sentence"
@
click=
"$emit('useSentence', item)"
>
{{
item
}}
</div>
</Skeleton>
</div>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
PropType
,
defineEmits
}
from
"@vue/runtime-core"
;
import
{
Skeleton
}
from
"vant"
defineEmits
([
"useSentence"
])
defineProps
({
list
:
{
type
:
Array
as
PropType
<
string
[]
>
,
}
},
loading
:
Boolean
})
</
script
>
...
...
src/service/FaqService/index.ts
View file @
9a2b89f8
import
baseAxios
from
'../index'
import
{
toBase64
}
from
"js-base64"
export
function
queryFaqList
()
{
return
baseAxios
<
{
...
...
@@ -10,9 +11,12 @@ export function queryFaqList() {
})
}
export
function
queryFaqAnswer
(
data
:
{
question
:
string
})
{
const
base64
=
toBase64
(
data
.
question
)
return
baseAxios
<
string
>
({
url
:
'/faq/query/answer'
,
method
:
'get'
,
params
:
data
,
params
:
{
question
:
base64
},
})
}
src/views/Chat/Chat.vue
View file @
9a2b89f8
...
...
@@ -18,7 +18,8 @@
<ChatInputVue
/>
<CommonUseSentence
class=
"transition-all h-0"
:class=
"
{ 'h-20': showShortSentences }"
:class=
"
{ 'h-40': showShortSentences }"
:loading="sentensesLoading"
@useSentence="useSentence"
:list="sentenceList"
/>
...
...
@@ -31,7 +32,6 @@
import
NavBar
from
"@/components/NavBar/index.vue"
;
import
{
defineComponent
,
onBeforeUnmount
,
onMounted
,
reactive
,
ref
,
watch
,
defineAsyncComponent
}
from
"vue"
;
import
{
connectionState
}
from
"@/store/connectionStore"
;
import
{
privateKey
,
publicKey
}
from
"@/store/appCallerStore"
;
import
{
getFromId
}
from
"@/store/appCallerStore"
;
import
{
messageStore
}
from
"@/store/messagesStore"
;
import
ChatMessageDB
from
"@/db/ChatMessageDB"
;
...
...
@@ -58,12 +58,13 @@ export default defineComponent({
const
showServiceRating
=
ref
(
false
);
const
selected
=
ref
(
""
);
const
selectedChatOption
=
ref
(
NaN
);
const
showShortSentences
=
ref
(
tru
e
);
const
showShortSentences
=
ref
(
fals
e
);
const
route
=
useRoute
()
const
target
=
route
.
query
.
targetId
as
string
;
const
sentenceList
=
ref
<
any
[]
>
([])
const
sentensesLoading
=
ref
(
false
)
const
optionList
=
[
{
name
:
'常用问题'
,
id
:
1
},
...
...
@@ -74,15 +75,23 @@ export default defineComponent({
const
handleSelect
=
(
select
:
string
)
=>
(
selected
.
value
=
select
);
const
handleSelectChatOption
=
(
select
:
number
)
=>
{
selectedChatOption
.
value
=
select
if
(
select
===
1
)
{
};
watch
(
selectedChatOption
,
()
=>
{
if
(
selectedChatOption
.
value
===
1
)
{
setShowSentences
(
true
)
sentensesLoading
.
value
=
true
;
queryFaqList
().
then
(
ret
=>
{
if
(
ret
.
code
===
200
)
{
sentenceList
.
value
=
ret
.
data
.
question
;
}
sentensesLoading
.
value
=
false
;
})
setShowSentences
(
true
)
}
else
{
setShowSentences
(
false
)
}
}
;
}
)
const
useSentence
=
(
content
:
string
)
=>
{
/* 问 */
...
...
@@ -143,7 +152,8 @@ export default defineComponent({
handleSelectChatOption
,
useSentence
,
sentenceList
,
optionList
optionList
,
sentensesLoading
};
},
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment