cyl/develop
wangxia 1 year ago
commit 2ebca03d50

@ -84,7 +84,8 @@
"pages/sendCreatorCode/index",
"pages/creatorSelectPage/index",
"components/chat/text",
"components/chat/hello"
"components/chat/hello",
"components/chat/html"
],
"permission": {
"scope.userLocation": {

@ -1,10 +1,13 @@
/* components/chat/hello.wxss */
.g_fw_600{
.g-components-chat-gree .g_fw_600{
font-weight: 600;
}
.g_ml_4{
.g-components-chat-gree .g_ml_4{
margin-left: 4px;
}
.g_mr_4{
.g-components-chat-gree .g_mr_4{
margin-right: 4px;
}
.g-components-chat-gree view{
font-size: 16px;
}

@ -0,0 +1,76 @@
// components/chat/text.js
Component({
properties: {
message: {
type: String,
value: ''
},
color: {
type: String,
value: ''
},
},
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,3 @@
<view class="panel-html {{color}}">
<rich-text nodes="{{message}}"/>
</view>

@ -0,0 +1,11 @@
/* components/chat/html.wxss */
.cblack{
color: #000;
}
.cwhite{
color: #fff;
}
.panel-text{
font-size: 16px;
}

@ -4,4 +4,8 @@
}
.cwhite{
color: #fff;
}
.panel-text{
font-size: 16px;
}

@ -6,6 +6,7 @@ Page({
*/
data: {
eventType:'input',// 底部事件类型 input 键盘输入voice 语音输入
sendText:'',// 发送的输入框内容
list:[
{
id:-1,
@ -13,27 +14,6 @@ Page({
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:'再次发送再次发送再次发送'
},
]
},
@ -152,11 +132,52 @@ Page({
let that = this;
that.animate();
},
handleInput(e){
let that = this;
that.setData({
sendText:e.detail.value
});
},
animate($type='light') {
wx.vibrateShort({
type:$type
});
},
// 文本消息发送
handleSend(){
let that = this;
if(that.data.sendText == ''){
wx.showToast({
title: '请输入内容',
icon: 'none',
});
return false;
}
that.animate();
that.setData({
list:[
...that.data.list,
{
id:that.data.list.length,
type:'text',
isUp:false,
isDown:false,
content:that.data.sendText
},
{
id:that.data.list.length + 1,
type:'html',
isUp:false,
isDown:false,
content:`【北京奔驰连接器日结工】<br /><br />🚻 男女 18-48 18-48周岁 男女不限, 要求26个英文字母 纹身烟疤拍照确认, 黑户,明显纹身,临时身份证不予接收,两班倒,站班<br /><br />💰 员工250元/天支付60天60天以后员工220元/天每月10号发薪。培训工资100元/天,员工 16 元/时以上部分含税6个点的打卡不满七天无工资60天以后员工缴纳社保`
},
],
sendText:''
});
}
})

@ -1,6 +1,7 @@
{
"usingComponents": {
"hello-panel": "../../components/chat/hello",
"text-panel": "../../components/chat/text"
"text-panel": "../../components/chat/text",
"html-panel": "../../components/chat/html"
}
}

@ -1,5 +1,7 @@
<view class="p-home-chat g_h_all g_flex_column_between">
<view class="chat-content g_flex_column_end g_flex_1">
<scroll-view scroll-y="{{true}}"
class="chat-content g_flex_column_end g_flex_1"
>
<view class="chat-card"
wx:for="{{list}}"
wx:for-item="item"
@ -18,7 +20,8 @@
<view wx:if="{{index % 2 == 0 && index != 0}}"
class="bg-obj g_flex_row_start min80"
>
<text-panel message="{{item.content}}" color="cblack" />
<text-panel message="{{item.content}}" color="cblack" wx:if="{{item.type == 'text'}}" />
<html-panel message="{{item.content}}" color="cblack" wx:if="{{item.type == 'html'}}" />
</view>
<view wx:if="{{index % 2 == 1}}"
class="main-obj g_flex_row_end max80"
@ -54,7 +57,7 @@
</view>
</view>
</view>
</view>
</scroll-view>
<view class="chat-operate g_flex_none">
<view class="m-input g_flex_row_between">
<!-- 左 -->
@ -74,15 +77,22 @@
<!-- 中 -->
<view class="g_flex_1 g_flex_column_center">
<view class="input-box" wx:if="{{eventType == 'input'}}">
<input type="text" placeholder="请输入内容" style="width: 100%;" />
<input type="text"
placeholder="请输入内容"
style="width: 100%;"
bindinput="handleInput"
value="{{sendText}}"
/>
</view>
<view class="voice-box" wx:if="{{eventType == 'voice'}}">
按住 说话
</view>
</view>
<!-- 右 -->
<view class="g_flex_none g_flex_column_center right-box g_text_l">
<i class="iconfont icon-fasong1 icon"></i>
<view class="g_flex_none g_flex_column_center right-box g_text_l"
bindtap="handleSend"
>
<i class="iconfont icon-fasong1 icon {{sendText ? 'icon-active' : ''}} "></i>
</view>
</view>
</view>

@ -203,11 +203,19 @@ textarea {
.chat-card{
padding: 0 10px;
margin-bottom: 10px;
}
.chat-card:nth-child(2n+1){
margin-bottom: 2px;
}
.chat-card:nth-child(2n){
margin-bottom: 12px;
}
.chat-card:last-child{
margin-bottom: 24px;
}
.chat-card:first-child{
margin-top: 12px;
}
.bg-obj{
background-color: #fff;
border-radius: 12px;
@ -233,13 +241,13 @@ textarea {
margin-right: 12px;
}
.icon-active{
color: #3578f6;
color: #3578f6 !important;
}
.g_w_all{
width: 100%;
}
.min80{
min-width: 80vw;
min-width: calc(100vw - 44px);
}
.max80{
max-width: 80vw;

Loading…
Cancel
Save