修复bug
This commit is contained in:
parent
4a7f2945f8
commit
e1795bb284
|
@ -4,8 +4,8 @@
|
|||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "讯飞AI",
|
||||
"bounce": "none",
|
||||
"softinputMode": "adjustResize"
|
||||
"bounce": "none"
|
||||
// "softinputMode": "adjustResize"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/index/chat",
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<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="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 class="item flex_col" :class=" item.type == 1 ? 'push':'pull' ">
|
||||
<image :src="item.pic" mode="aspectFill" class="pic"></image>
|
||||
|
@ -21,7 +19,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view id="bottom-box"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="box-2">
|
||||
|
@ -53,7 +51,7 @@
|
|||
return {
|
||||
talkList: [],
|
||||
ajax: {
|
||||
rows: 20, //每页数量
|
||||
rows: 10, //每页数量
|
||||
page: 1, //页码
|
||||
flag: false, // 请求开关
|
||||
loading: false, // 加载中
|
||||
|
@ -69,7 +67,8 @@
|
|||
TEXT: '',
|
||||
historyTextList: [], // 历史会话信息,由于最大token12000,可以结合实际使用,进行移出
|
||||
tempRes: '', // 临时答复保存
|
||||
scrollTop: 0
|
||||
scrollTop: 0,
|
||||
shouldScrollToBottom: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -79,20 +78,14 @@
|
|||
uni.onKeyboardHeightChange(e => {
|
||||
let h = this.keyboardHeight;
|
||||
this.keyboardHeight = e.height;
|
||||
if(e.height==0)h *= -1;
|
||||
else h = e.height;
|
||||
uni.createSelectorQuery().selectViewport().scrollOffset(function(res) {
|
||||
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;
|
||||
this.$nextTick(()=>{
|
||||
setTimeout(()=>{
|
||||
uni.pageScrollTo({
|
||||
scrollTop: scrollTop, // 当前位置向下滚动
|
||||
duration: 0 // 滚动过渡时间为300ms,默认值为300ms
|
||||
scrollTop: 9999999, // 当前位置向下滚动
|
||||
duration: 300 // 滚动过渡时间为300ms,默认值为300ms
|
||||
});
|
||||
}).exec();
|
||||
}, 0)
|
||||
})
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
@ -145,7 +138,8 @@
|
|||
},
|
||||
// 获取历史消息
|
||||
getHistoryMsg() {
|
||||
if (!this.ajax.flag) {
|
||||
return ;
|
||||
if (this.ajax.flag) {
|
||||
return; //
|
||||
}
|
||||
|
||||
|
@ -442,6 +436,9 @@
|
|||
this.getMerHistory();
|
||||
}
|
||||
},
|
||||
touchmove(e){
|
||||
uni.hideKeyboard()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -493,8 +490,12 @@
|
|||
.box-1 {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
min-height: calc(100vh - 100rpx);
|
||||
padding-bottom: 100rpx;
|
||||
box-sizing: content-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
|
||||
/* 兼容iPhoneX */
|
||||
margin-bottom: 0;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
var isReady=false;var onReadyCallbacks=[];
|
||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||
var __uniConfig = {"pages":["pages/index/index","pages/index/chat"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"人工智能","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"xunfeiAi","compilerVersion":"3.8.12","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"讯飞AI","bounce":"none","softinputMode":"adjustResize"}},{"path":"/pages/index/chat","meta":{},"window":{"navigationBarTitleText":"讯飞星火","bounce":"none"}}];
|
||||
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"讯飞AI","bounce":"none"}},{"path":"/pages/index/chat","meta":{},"window":{"navigationBarTitleText":"讯飞星火","bounce":"none"}}];
|
||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue