Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yma16
yma16_miniprogram
提交
37fe5428
Y
yma16_miniprogram
项目概览
yma16
/
yma16_miniprogram
通知
11
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yma16_miniprogram
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
37fe5428
编写于
2月 13, 2023
作者:
yma16
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add spring cloud record
上级
994999f9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
54 addition
and
15 deletion
+54
-15
miniprogram/pages/future/future.js
miniprogram/pages/future/future.js
+41
-6
miniprogram/pages/future/future.wxml
miniprogram/pages/future/future.wxml
+10
-7
miniprogram/pages/future/future.wxss
miniprogram/pages/future/future.wxss
+3
-2
未找到文件。
miniprogram/pages/future/future.js
浏览文件 @
37fe5428
...
@@ -33,7 +33,10 @@ Component({
...
@@ -33,7 +33,10 @@ Component({
mode
:
'
introduce
'
,
mode
:
'
introduce
'
,
article
:{},
article
:{},
articleId
:
44
,
articleId
:
44
,
isShowOenAi
:
false
,
baseUrl
:
'
https://yongma16.xyz/api/
'
,
baseUrl
:
'
https://yongma16.xyz/api/
'
,
baseCloudUrl
:
'
https://yongma16.xyz/cloudApi/
'
,
baseCloudPath
:
'
openAiRecord/add
'
,
path
:
'
article/blog/
'
,
path
:
'
article/blog/
'
,
currentUserInfo
:{
currentUserInfo
:{
nickName
:
''
,
nickName
:
''
,
...
@@ -59,21 +62,26 @@ Component({
...
@@ -59,21 +62,26 @@ Component({
// 生命周期函数,可以为函数,或一个在 methods 段中定义的方法名
// 生命周期函数,可以为函数,或一个在 methods 段中定义的方法名
attached
:
function
()
{
attached
:
function
()
{
this
.
getRemoteArticle
(
this
.
data
.
articleId
)
this
.
getRemoteArticle
(
this
.
data
.
articleId
)
if
(
wx
.
getStorageSync
(
'
openAiOptions
'
)){
const
openAiOptions
=
wx
.
getStorageSync
(
'
openAiOptions
'
)
if
(
openAiOptions
){
this
.
setData
(
this
.
setData
(
{
{
chatObjConfig
:
wx
.
getStorageSync
(
'
openAiOptions
'
)
chatObjConfig
:
openAiOptions
}
}
)
)
}
}
if
(
wx
.
getStorageSync
(
'
currentUserInfo
'
)){
const
currentUserInfo
=
wx
.
getStorageSync
(
'
currentUserInfo
'
)
console
.
log
(
'
currentUserInfo
'
,
wx
.
getStorageSync
(
'
currentUserInfo
'
))
if
(
currentUserInfo
&&
currentUserInfo
.
nickName
){
console
.
log
(
'
currentUserInfo
'
,
currentUserInfo
)
this
.
setData
(
this
.
setData
(
{
{
currentUserInfo
:
wx
.
getStorageSync
(
'
currentUserInfo
'
)
currentUserInfo
:
currentUserInfo
}
}
)
)
this
.
setData
({
isShowOenAi
:
true
})
}
}
},
},
...
@@ -84,6 +92,25 @@ Component({
...
@@ -84,6 +92,25 @@ Component({
},
},
methods
:
{
methods
:
{
createOpenRecord
(
params
){
const
headers
=
{
'
Content-Type
'
:
'
application/json;charset=UTF-8
'
}
wx
.
request
({
url
:
this
.
data
.
baseCloudUrl
+
this
.
data
.
baseCloudPath
,
headers
:
headers
,
data
:
params
,
method
:
'
POST
'
,
success
:(
res
=>
{
console
.
log
(
'
cloud res
'
,
res
)
}),
fail
:
r
=>
{
console
.
log
(
'
cloud r
'
,
r
)
}
})
},
scrollToBottom
(){
const
viewComponent
=
this
.
getEle
(
'
#chat-container-id
'
)
console
.
log
(
'
viewComponent
'
,
viewComponent
)
},
getRemoteArticle
:
function
(
id
){
getRemoteArticle
:
function
(
id
){
this
.
setData
({
this
.
setData
({
isLoading
:
true
isLoading
:
true
...
@@ -184,14 +211,21 @@ Component({
...
@@ -184,14 +211,21 @@ Component({
const
currentIndex
=
thisBack
.
data
.
chatObjConfig
.
currentIndex
const
currentIndex
=
thisBack
.
data
.
chatObjConfig
.
currentIndex
const
choices
=
data
.
choices
const
choices
=
data
.
choices
console
.
log
(
'
choices
'
,
choices
)
console
.
log
(
'
choices
'
,
choices
)
const
answer
=
choices
?
choices
.
map
(
choicesItem
=>
{
return
choicesItem
.
text
}).
join
(
'
\n
'
):
'
。。。未知
'
option
.
some
((
item
,
index
)
=>
{
option
.
some
((
item
,
index
)
=>
{
if
(
currentIndex
===
index
){
if
(
currentIndex
===
index
){
item
.
answer
=
choices
?
choices
.
map
(
choicesItem
=>
{
return
choicesItem
.
text
}).
join
(
'
\n
'
):
'
。。。未知
'
item
.
answer
=
answer
item
.
isEdit
=
false
item
.
isEdit
=
false
return
true
return
true
}
}
return
false
return
false
})
})
thisBack
.
createOpenRecord
({
wx_name
:
thisBack
.
data
.
currentUserInfo
.
nickName
,
wx_img
:
thisBack
.
data
.
currentUserInfo
.
avatarUrl
,
search_text
:
params
.
text
,
search_response
:
answer
})
const
chatObjConfig
=
{
const
chatObjConfig
=
{
option
:
option
,
option
:
option
,
currentIndex
:
currentIndex
+
1
currentIndex
:
currentIndex
+
1
...
@@ -209,6 +243,7 @@ Component({
...
@@ -209,6 +243,7 @@ Component({
}
}
)
)
wx
.
hideLoading
()
wx
.
hideLoading
()
thisBack
.
scrollToBottom
()
resolve
(
res
)
resolve
(
res
)
},
},
fail
:
error
=>
{
fail
:
error
=>
{
...
...
miniprogram/pages/future/future.wxml
浏览文件 @
37fe5428
...
@@ -10,10 +10,13 @@
...
@@ -10,10 +10,13 @@
</view> -->
</view> -->
<view class="form-container-introduce" wx:if="{{mode==='introduce'}}">
<view class="form-container-introduce" wx:if="{{mode==='introduce'}}">
<view class="header-box" style="display: flex;">
<view class="header-box" style="display: flex;">
<view style="width: 50%;">
<view style="width: 50%;"
wx:if="{{isShowOenAi}}"
>
<button style="width: 100%;" type="primary" style="background: rgb(8, 183, 252);" loading="{{isLoading}}">api介绍</button>
<button style="width: 100%;" type="primary" style="background: rgb(8, 183, 252);" loading="{{isLoading}}">api介绍</button>
</view>
</view>
<view style="width:50%">
<view style="width: 100%;" wx:else>
<button style="width: 100%;" type="primary" style="background: rgb(8, 183, 252);" loading="{{isLoading}}">api介绍</button>
</view>
<view style="width:50%" wx:if="{{isShowOenAi}}">
<button style="width: 100%;" type="primary" style="background: rgb(0, 114, 221);" bindtap="changeMode" loading="{{isLoading}}" data-mode='openAiUse'>使用</button>
<button style="width: 100%;" type="primary" style="background: rgb(0, 114, 221);" bindtap="changeMode" loading="{{isLoading}}" data-mode='openAiUse'>使用</button>
</view>
</view>
</view>
</view>
...
@@ -25,8 +28,8 @@
...
@@ -25,8 +28,8 @@
<view>
<view>
<button style="width: 100%;" type="primary" bindtap="changeMode" loading="{{isLoading}}" data-mode='introduce'>返回介绍</button>
<button style="width: 100%;" type="primary" bindtap="changeMode" loading="{{isLoading}}" data-mode='introduce'>返回介绍</button>
</view>
</view>
<view class="chat-container">
<view class="chat-container"
id="chat-container-id"
>
<view wx:for="{{ chatObjConfig.option }}" wx:for-index="index" wx:for-item="item" wx:key="
index
">
<view wx:for="{{ chatObjConfig.option }}" wx:for-index="index" wx:for-item="item" wx:key="
*this
">
<view class="form-request">
<view class="form-request">
<view wx:if="{{item.isEdit}}">
<view wx:if="{{item.isEdit}}">
<image class="user-image" src="{{currentUserInfo.avatarUrl}}"></image>
<image class="user-image" src="{{currentUserInfo.avatarUrl}}"></image>
...
@@ -47,12 +50,12 @@
...
@@ -47,12 +50,12 @@
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="form-submit" wx:if="{{mode==='openAiUse'}}">
<view class="form-submit" wx:if="{{mode==='openAiUse'}}">
<button style="width: 100%;" type="primary" bindtap="search" loading="{{isLoading}}">发送</button>
<button style="width: 100%;" type="primary" bindtap="search" loading="{{isLoading}}">发送</button>
</view>
</view>
</view>
</view>
</view>
<view class="loading" wx:if="{{isLoading}}">
<view class="loading" wx:if="{{isLoading}}">
<view class="loader-child" />
<view class="loader-child" />
<view class="loader-child" />
<view class="loader-child" />
...
...
miniprogram/pages/future/future.wxss
浏览文件 @
37fe5428
...
@@ -139,8 +139,9 @@ button {
...
@@ -139,8 +139,9 @@ button {
.chat-container {
.chat-container {
margin-top: 10px;
margin-top: 10px;
width: 100%;
width: 100%;
height: calc(100vh - 100px);
height: calc(100vh - 120px);
overflow: auto;
overflow-y: auto;
overflow-x: hidden;
position: relative;
position: relative;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录