You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
// subPage/chat/index.js
|
|
|
|
|
|
Page({
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
data: {
|
|
|
|
|
|
eventType:'input',// 底部事件类型 input 键盘输入,voice 语音输入
|
|
|
|
|
|
list:[
|
|
|
|
|
|
{
|
|
|
|
|
|
id:-1,
|
|
|
|
|
|
type:'text',
|
|
|
|
|
|
isUp:false,
|
|
|
|
|
|
isDown:false,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id:-1,
|
|
|
|
|
|
type:'text',
|
|
|
|
|
|
isUp:false,
|
|
|
|
|
|
isDown:false,
|
|
|
|
|
|
content:'测试输入框发送测试输入框发送测试输入框发送测试输入框发送'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id:0,
|
|
|
|
|
|
type:'text',
|
|
|
|
|
|
isUp:false,
|
|
|
|
|
|
isDown:false,
|
|
|
|
|
|
content:'我是AI回复,自定义回复'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id:1,
|
|
|
|
|
|
type:'text',
|
|
|
|
|
|
isUp:false,
|
|
|
|
|
|
isDown:false,
|
|
|
|
|
|
content:'再次发送再次发送再次发送'
|
|
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
|
*/
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
|
|
title: options.title,
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
|
|
*/
|
|
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
|
|
*/
|
|
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
|
|
*/
|
|
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
|
|
*/
|
|
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
|
|
*/
|
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
|
*/
|
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户点击右上角分享
|
|
|
|
|
|
*/
|
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleEvent(e){
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
that.animate();
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
eventType:e.currentTarget.dataset.type == 'input' ? 'voice':'input'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
handleUp(e){
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
that.animate();
|
|
|
|
|
|
const list = [...that.data.list];
|
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
|
list[index].isUp = !list[index].isUp;
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
list: list
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
handleDown(e){
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
that.animate();
|
|
|
|
|
|
const list = [...that.data.list];
|
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
|
list[index].isDown = !list[index].isDown;
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
list: list
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
handleCopy(e){
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
that.animate();
|
|
|
|
|
|
const index = e.currentTarget.dataset.index;
|
|
|
|
|
|
let content = that.data.list[index].content; // 获取要复制的内容
|
|
|
|
|
|
if(index == 0){
|
|
|
|
|
|
content = "Hi,我是大鹏,你的智能工作助理。以后找工作不用跟老板谈了,直接来跟大鹏谈。来说说你的要求,我们开始吧…"
|
|
|
|
|
|
}
|
|
|
|
|
|
wx.setClipboardData({
|
|
|
|
|
|
data: content,
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
title: '复制成功',
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: function (res) {
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
title: '复制失败',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
handleShare(){
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
that.animate();
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
animate($type='light') {
|
|
|
|
|
|
wx.vibrateShort({
|
|
|
|
|
|
type:$type
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|