This commit is contained in:
weipengfei 2023-09-18 16:02:32 +08:00
parent 4a7f2945f8
commit 5ef7538790
5 changed files with 214 additions and 274 deletions

View File

@ -1,12 +1,7 @@
<template> <template>
<view class="wrapper"> <view class="wrapper" @touchmove="touchmove">
<view class="tips color_fff size_12 align_c" :class="{ 'show':ajax.loading }" @tap="getHistoryMsg">{{ajax.loadText}}
</view>
<view class="placeholder"></view>
<view class="box-1" id="list-box" ref="box"> <view class="box-1" id="list-box" ref="box">
<view class="talk-list"> <view class="talk-list">
<scroll-view :scroll-y="true" style="height: 100%;overflow: hidden;" :scroll-top="scrollTop"
:scroll-with-animation="true" @scrolltoupper="bindScroll">
<view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`"> <view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`">
<view class="item flex_col" :class=" item.type == 1 ? 'push':'pull' "> <view class="item flex_col" :class=" item.type == 1 ? 'push':'pull' ">
<image :src="item.pic" mode="aspectFill" class="pic"></image> <image :src="item.pic" mode="aspectFill" class="pic"></image>
@ -21,14 +16,13 @@
</view> </view>
</view> </view>
</view> </view>
</scroll-view>
</view> </view>
</view> </view>
<view class="box-2"> <view class="box-2">
<view class="flex_col"> <view class="flex_col">
<view class="flex_grow"> <view class="flex_grow">
<input type="text" class="content" v-model="content" placeholder="请输入聊天内容" @focus="focus" @confirm="send" <input type="text" class="content" v-model="content" placeholder="请输入聊天内容" @focus="focus" @confirm="send"
placeholder-style="color:#DDD;" :cursor-spacing="6"> placeholder-style="color:#DDD;" :cursor-spacing="6" auto-blur>
</view> </view>
<button class="send" @tap="send">发送</button> <button class="send" @tap="send">发送</button>
</view> </view>
@ -77,16 +71,12 @@
this.getHistoryMsg(); this.getHistoryMsg();
}); });
uni.onKeyboardHeightChange(e => { uni.onKeyboardHeightChange(e => {
let h = this.keyboardHeight; let h = this.keyboardHeight+0;
this.keyboardHeight = e.height; this.keyboardHeight = e.height;
if(e.height==0)h *= -1; if(e.height==0)h *= -1;
else h = e.height; else h = e.height;
uni.createSelectorQuery().selectViewport().scrollOffset(function(res) { uni.createSelectorQuery().selectViewport().scrollOffset(function(res) {
let scrollTop = res.scrollTop; // let scrollTop = res.scrollTop; //
// let os = uni.getSystemInfoSync();
// // = 使 - -
// const viewportHeight = os.windowHeight - os.statusBarHeight - (os.platform == "android" ? 50 : 45)-10;
// if(scrollTop<viewportHeight)scrollTop=viewportHeight;
scrollTop+=h; scrollTop+=h;
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop: scrollTop, // scrollTop: scrollTop, //
@ -117,7 +107,7 @@
cl++; cl++;
if (cl % 6 == 0) this.$nextTick(()=>{ if (cl % 6 == 0) this.$nextTick(()=>{
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop: 999999, scrollTop: 9999999,
}) })
}) })
} else { } else {
@ -145,7 +135,7 @@
}, },
// //
getHistoryMsg() { getHistoryMsg() {
if (!this.ajax.flag) { if (this.ajax.flag) {
return; // return; //
} }
@ -305,7 +295,7 @@
// //
this.content = ''; this.content = '';
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop: 999999, // scrollTop: 9999999, //
duration: 0 duration: 0
}); });
}) })
@ -442,6 +432,17 @@
this.getMerHistory(); this.getMerHistory();
} }
}, },
//
touchmove(e){
console.log('隐藏');
uni.hideKeyboard();
},
scrollBottom(){
uni.pageScrollTo({
scrollTop: 9999999, //
duration: 0 // 300ms300ms
});
}
} }
} }
</script> </script>
@ -470,6 +471,7 @@
.wrapper { .wrapper {
height: auto !important; height: auto !important;
min-height: 100vh !important;
} }
/* 加载数据提示 */ /* 加载数据提示 */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__9620511","name":"xunfeiAi","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false},"arguments":"{\"name\":\"\",\"path\":\"\",\"query\":\"\",\"id\":0}","allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.8.12","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"}} {"@platforms":["android","iPhone","iPad"],"id":"__UNI__9620511","name":"xunfeiAi","version":{"name":"1.0.0","code":"100"},"description":"","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"target":"id:1","autoclose":true,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"render":"always","id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"distribute":{"google":{"permissions":["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-feature android:name=\"android.hardware.camera\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"uniStatistics":{"enable":false},"arguments":"{\"name\":\"\",\"path\":\"\",\"query\":\"\",\"id\":0}","allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.8.12","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"launch_path":"__uniappview.html"},"arguments":{"pathName":"pages/index/test/test","query":""}}