Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust chat function #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions client/pages/chat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,22 @@ Page({
//录音文件地址
filePath: null,
contactFlag: true,
imgUrl: null,
imgUrl: "../image/user_default.png",

/////////
// 印刷体识别
ocrImgUrl: '',
ocrResult: [],
showOcrResult: false,


// 身份证识别
imgUrl: '',
IDimgUrl: '../image/album.png',
idCardInfo: {},
showResult: false,

//名片识别
idImgUrl: '',
idImgUrl: '../image/camera.png',
idInfo: [],
showidResult: false,

Expand Down Expand Up @@ -166,15 +167,16 @@ Page({
},
success: function (res) {
util.showSuccess('识别成功')
console.log(res)
// var data = JSON.parse(res.data)
var data = res.data
if (data.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败')
return
}
var info = data.data
if (info.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败')
return
}

Expand All @@ -186,7 +188,7 @@ Page({
},
fail: function (res) {
console.log(e)
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败,请重试或更换识别方式')
}
})
},
Expand All @@ -211,12 +213,12 @@ Page({
// var data = JSON.parse(res.data)
var data = res.data
if (data.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败')
return
}
var info = data.data[0]
if (info.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + info.message)
return
}

Expand All @@ -228,7 +230,7 @@ Page({
},
fail: function (res) {
console.log(e)
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + e.message)
}
})
},
Expand All @@ -254,12 +256,12 @@ Page({
// var data = JSON.parse(res.data)
var data = res.data
if (data.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败')
return
}
var info = data.data[0]
if (info.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + info.message)
return
}

Expand All @@ -271,7 +273,7 @@ Page({
},
fail: function (res) {
console.log(e)
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + e.message)
}
})
},
Expand All @@ -297,12 +299,12 @@ Page({
// var data = JSON.parse(res.data)
var data = res.data
if (data.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败')
return
}
var info = data.data
if (info.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + info.message)
return
}

Expand All @@ -314,7 +316,7 @@ Page({
},
fail: function (res) {
console.log(e)
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + e.message)
}
})
},
Expand All @@ -340,12 +342,12 @@ Page({
// var data = JSON.parse(res.data)
var data = res.data
if (data.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败')
return
}
var info = data.data
if (info.code !== 0) {
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + info.message)
return
}

Expand All @@ -357,7 +359,7 @@ Page({
},
fail: function (res) {
console.log(e)
util.showModel('识别失败','请更换识别方式或人工识别')
util.showModel('识别失败' + e.message)
}
})
},
Expand Down
40 changes: 18 additions & 22 deletions client/pages/chat/chat.wxml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!--pages/chat/chat.wxml-->

<view style='height: 65rpx;'>
<view bindtap='doIdCardIdentify' style='position: absolute;width: 20%;height: 150rpx;left: 0%;bottom: 87%;'>ID</view>
<view bindtap='doCardIndentity' style='position: absolute;width: 20%;height: 150rpx;left: 10%;bottom: 87%;'>银行卡</view>
<view bindtap='doIdIndentify' style='position: absolute;width: 20%;height: 150rpx;left: 30%;bottom: 87%;'>卡片</view>
<view bindtap='doWordIndentify' style='position: absolute;width: 20%;height: 150rpx;left: 42%;bottom: 87%;'>ocr</view>
<view bindtap='doTxtToRecord' style='position: absolute;width: 20%;height: 150rpx;left: 55%;bottom: 87%;'>语音</view>
<view bindtap='doConIndentity' style='position: absolute;width: 20%;height: 150rpx;left: 70%;bottom: 87%;'>内容</view>
<view class='bottom-content'>
<image bindtap='doIdCardIdentify' class='bottom-item' src="{{IDimgUrl}}"></image>
<image bindtap='doCardIndentity' class='bottom-item' src="{{idImgUrl}}"></image>
<view bindtap='doIdIndentify' class='bottom-item'>卡片</view>
<view bindtap='doWordIndentify' class='bottom-item'>ocr</view>
<view bindtap='doTxtToRecord' class='bottom-item'>语音</view>
<view bindtap='doConIndentity' class='bottom-item'>内容</view>
<!-- <view bindtap='submitInfo' style='position: absolute;width: 20%;height: 150rpx;left: 50%;bottom: 87%;'>求助志愿者</view> -->
</view>

<view style='position: absolute;width: 100%;height: 3rpx;background-color: black;bottom: 100%;'></view>
<!-- <view style='position: absolute;width: 100%;height: 3rpx;background-color: black;bottom: 100%;'></view> -->

<view class="container">
<scroll-view class="scrool-view" scroll-y="true" scroll-with-animation="true" scroll-into-view="{{scrolltop}}" enable-back-to-top="true">
Expand All @@ -21,7 +21,7 @@
<view id="roll{{index + 1}}" class="chat-left" wx:if="{{item.orientation == 'l' && item.text == '<<<'}}">
<image class="avatar-img" src="../image/chat_logo.png" alt="头像" ></image>
<!-- ocr == 通用印刷体识别 -->
<view wx:if="{{showOcrResult}}">
<view wx:if="{{showOcrResult}}" class='text-box'>
<text wx:for="{{ocrResult}}" wx:for-item="item" wx:for-index="idx" class='chat-text-left'>
{{idx}}:{{item.itemstring}}
</text>
Expand Down Expand Up @@ -66,37 +66,33 @@
<image src='../image/speaker6.png' mode='aspectFit'></image>
</view>
</view>
<!-- 用户头像 -->
<image class="avatar-img" src="{{userLogoUrl}}"></image>
<!-- 图片 -->
<view wx:if="{{item.orientation == 'p'}}">
<image src='{{imgUrl}}' mode='aspectFit'></image>
<view class='request-img-wrapper'>
<image src='{{imgUrl}}' mode='aspectFit' class="request-img"></image>
</view>
</view>


<!-- 文本输入 -->
<view class='chat-text-right' wx:if="{{item.orientation == 'r'}}">
<text>{{item.text}}{{item.url}}</text>
</view>
<!-- 用户头像 -->
<image class="avatar-img" src="{{userLogoUrl}}"></image>
</view>
</block>
</view>
</scroll-view>


<!--form bindsubmit="sendChat" -->
<!--form bindsubmit="sendChat">
<view class="ask-input-word" style='left: 10rpx;'>
<input class="input-big" confirm-type="send" name="ask_word" type="text" bindconfirm="sendChat" bindinput="Typing" value="{{askWord}}" ></input>
<form bindsubmit="submitInfo" report-submit='true' >
<button form-type="submit" type="primary" class="button-send" >求助志愿者</button>
</form>
</view>
</form-->

</view>
<form bindsubmit="sendChat">
<view class="ask-input-word" style='left: 10rpx;'>
<input class="input-big" confirm-type="send" name="ask_word" type="text" bindconfirm="sendChat" bindinput="Typing" placeholder="请点击此处输入文字" value="{{askWord}}" focus='true' ></input>
<form bindsubmit="submitInfo" report-submit='true' >
<button form-type="submit" type="primary" class="button-send" >求助志愿者</button>
<button form-type="submit" class="button-send" >求助志愿者</button>
</form>
</view>
</form>
Expand Down
76 changes: 59 additions & 17 deletions client/pages/chat/chat.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,24 @@
height: 100%;
position: fixed;
}

image{
width:240px;
}
.bottom-content{
height: 90rpx;
position: fixed;
bottom: 0;
padding-left:30rpx;
width:100%;
}
.bottom-item{
float:left;
width: 15%;
height: 90rpx;
border-radius:10rpx;
}
.container {
height: 90%;
height: 100%;
width: 750rpx;
min-height: 97.6%;
display: flex;
Expand All @@ -27,39 +42,65 @@
}

.chat-left {
display: flex;
align-items: center;
/* display: flex; */
/* align-items: center; */
margin-top: 20rpx;
width: 100%;
float: right;
}

.chat-text-left {
flex: 1;
/* flex: 1; */
margin-left: 10rpx;
padding: 5rpx 10rpx;
background-color: white;
/* padding: 5rpx 10rpx; */
background-color: #a0e959;
border-radius: 11rpx;
word-break: break-all;
/* word-break: break-all; */
float: left;
margin-bottom: 10rpx;
line-height:35rpx;
padding-left:10rpx;
padding-right:10rpx;
padding-bottom:30rpx;
}

.chat-right {
display: flex;
align-items: center;
margin-top: 20rpx;
/* display: flex; */
/* align-items: center; */
margin-top: 20rpx;
float:right;
width: 100%
}
.request-img-wrapper{
width: 240px;
height: 240px;
border-radius:5px;
float:right;
margin-right:45rpx;
}
.request-img{
float: right;
border-radius:15%;
width:100%;
height:100%;
}

.chat-text-right {
flex: 1;
margin-right: 10rpx;
/* flex: 1; */
margin-right: 45rpx;
margin-left:30rpx;
padding: 5rpx 10rpx;
background-color: #CDB5CD;
background-color: #a0e959;
border-radius: 11rpx;
word-break: break-all;
float: right;
max-width: 75%;
}

.avatar-img {
width: 70rpx;
height: 70rpx;
border-radius: 70rpx;
float: right
}

.text-video-img {
Expand All @@ -80,7 +121,7 @@
width: 96%;
position: fixed;
padding: 5rpx;
bottom: 5rpx;
bottom: 39px;
display: flex;
align-items: center;
}
Expand Down Expand Up @@ -109,11 +150,12 @@
padding-right: 14px;
box-sizing: border-box;
text-decoration: none;
color: #000000;
color: #ffffff;
line-height: 2rem;
border-radius: 5px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
overflow: hidden;
background-color: #c1c1c1;
}

.button-hover{
Expand Down