修复bug

This commit is contained in:
weipengfei 2023-09-19 18:19:39 +08:00
parent 4a7f2945f8
commit e1795bb284
5 changed files with 219 additions and 242 deletions

View File

@ -4,8 +4,8 @@
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "讯飞AI", "navigationBarTitleText": "讯飞AI",
"bounce": "none", "bounce": "none"
"softinputMode": "adjustResize" // "softinputMode": "adjustResize"
} }
}, { }, {
"path": "pages/index/chat", "path": "pages/index/chat",

View File

@ -1,12 +1,10 @@
<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 class="tips color_fff size_12 align_c" :class="{ 'show':ajax.loading }" @tap="getHistoryMsg">{{ajax.loadText}}
</view> </view>
<view class="placeholder"></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,7 +19,7 @@
</view> </view>
</view> </view>
</view> </view>
</scroll-view> <view id="bottom-box"></view>
</view> </view>
</view> </view>
<view class="box-2"> <view class="box-2">
@ -53,7 +51,7 @@
return { return {
talkList: [], talkList: [],
ajax: { ajax: {
rows: 20, // rows: 10, //
page: 1, // page: 1, //
flag: false, // flag: false, //
loading: false, // loading: false, //
@ -69,7 +67,8 @@
TEXT: '', TEXT: '',
historyTextList: [], // token12000,使 historyTextList: [], // token12000,使
tempRes: '', // tempRes: '', //
scrollTop: 0 scrollTop: 0,
shouldScrollToBottom: true
} }
}, },
mounted() { mounted() {
@ -79,20 +78,14 @@
uni.onKeyboardHeightChange(e => { uni.onKeyboardHeightChange(e => {
let h = this.keyboardHeight; let h = this.keyboardHeight;
this.keyboardHeight = e.height; this.keyboardHeight = e.height;
if(e.height==0)h *= -1; this.$nextTick(()=>{
else h = e.height; setTimeout(()=>{
uni.createSelectorQuery().selectViewport().scrollOffset(function(res) { uni.pageScrollTo({
let scrollTop = res.scrollTop; // scrollTop: 9999999, //
// let os = uni.getSystemInfoSync(); duration: 300 // 300ms300ms
// // = 使 - - });
// const viewportHeight = os.windowHeight - os.statusBarHeight - (os.platform == "android" ? 50 : 45)-10; }, 0)
// if(scrollTop<viewportHeight)scrollTop=viewportHeight; })
scrollTop+=h;
uni.pageScrollTo({
scrollTop: scrollTop, //
duration: 0 // 300ms300ms
});
}).exec();
}) })
}, },
beforeDestroy() { beforeDestroy() {
@ -145,7 +138,8 @@
}, },
// //
getHistoryMsg() { getHistoryMsg() {
if (!this.ajax.flag) { return ;
if (this.ajax.flag) {
return; // return; //
} }
@ -442,6 +436,9 @@
this.getMerHistory(); this.getMerHistory();
} }
}, },
touchmove(e){
uni.hideKeyboard()
}
} }
} }
</script> </script>
@ -493,8 +490,12 @@
.box-1 { .box-1 {
width: 100%; width: 100%;
height: auto; height: auto;
min-height: calc(100vh - 100rpx);
padding-bottom: 100rpx; padding-bottom: 100rpx;
box-sizing: content-box; box-sizing: content-box;
display: flex;
flex-direction: column;
justify-content: flex-end;
/* 兼容iPhoneX */ /* 兼容iPhoneX */
margin-bottom: 0; margin-bottom: 0;

View File

@ -2,7 +2,7 @@
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; 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 __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.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()})}}); __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}}}}); 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