商机信息滚动条

This commit is contained in:
zmj 2023-10-07 23:13:27 +08:00
parent 2e6ea98e21
commit c10460b9b6
2 changed files with 67 additions and 203 deletions

View File

@ -30,20 +30,15 @@
"style": {
"navigationBarTitleText": "商机信息",
"navigationBarBackgroundColor": "#0122C7",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/business/talkDetail",
"style": {
"navigationBarTitleText": "商机信息",
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#0122C7",
"navigationBarTextStyle": "white"
"navigationBarTextStyle": "white",
"app-plus": {
//
"softinputMode": "adjustResize"
}
}
},
{
"path": "pages/index/index",
"style": {

View File

@ -1,20 +1,11 @@
<template>
<view style="background-color: #F6F7FD;">
<!-- <view class="storeName" style="padding-top:var(--status-bar-height) ;">
<u--image src="/static/right.png" width="50rpx" height="50rpx" @click='backFn'></u--image>
<view class="" @click="timeFn">
{{timeFn()}}
</view>
<view class="">
</view>
</view> -->
<!-- 消息 -->
<view class="content" @click="showPlus=false" id="content">
<view class="">
<u-loadmore :status="status" />
<u-loadmore :status="status"
:loadmore-text="`你正在与${'wo'}聊天`"
/>
</view>
<!-- -->
<view class="task-li" v-for="item,index in list" :key="index">
@ -41,10 +32,7 @@
<view class="yl-text">
<u-icon name="play-circle" color='white' size='30'></u-icon>
</view>
<!-- <video :src="item.content" @loadedmetadata="onVideoLoaded" controls id="vi1"
style="width: 400rpx; height: 100px;"></video> -->
<!-- <image src="item.content" style="width:200rpx" mode="widthFix"></image> -->
<!-- <canvas canvas-id="videoCanvas1" style="width: 100px; height: 100px;"></canvas> -->
</view>
</view>
@ -78,10 +66,6 @@
<u--image :showLoading="true" :src="a" shape="circle" width="40px" height="40px"></u--image>
</view>
</view>
</view>
<!-- 本地 -->
<view v-if="local">
@ -107,8 +91,11 @@
</view>
</view>
</view>
<view style="height: 300rpx;background-color: #F6F7FD;" v-if="showPlus">
<view style="height: 50px;background-color: #F6F7FD;">
</view>
<view style="height: 150rpx;background-color: #F6F7FD;" v-else>
</view>
@ -118,7 +105,7 @@
<view class="bottom">
<!-- -->
<view class="send-col">
<input type="text" class="send-ipt" @click="scrollFn(300)" v-model="value" placeholder="请输入聊天内容"
<input type="text" class="send-ipt" v-model="value" placeholder="请输入聊天内容"
placeholder-style="color:#DDD;" :cursor-spacing="6">
<u--image :showLoading="true" src="/static/img/bussness/Plus.png" width="32px" height="32px"
@ -139,7 +126,7 @@
<text>视频</text>
</view>
<!-- asdas -->
</view>
</view>
@ -173,58 +160,32 @@
showPlus: false,
num: 0,
flags: true,
scollNum: 999999999999,
scollNum: 0,
client_id: "",
fromId: "",
toId:"",
name: "",
status: "lodemore",
status: "loadmore",
page: 1,
limit: 10,
formUser: "",
show: false,
overLaySrc: "",
overLayType: "",
canvasContext: null,
timer: "",
local: "",
localType: "",
progress: "",
showNotice: false,
sendData:{}
}
},
methods: {
timeFn(time) {
const currentDate = new Date(); //
const targetDate = new Date(1695722299000);
if (this.isSameDay(currentDate, targetDate)) {
const hours = targetDate.getHours(); //
const minutes = targetDate.getMinutes(); //
return hours + ':' + minutes;
} else if (this.isYesterday(currentDate, targetDate)) {
return '昨天';
}
const month = targetDate.getMonth() + 1; // 01
const day = targetDate.getDate(); //
return month + '月' + day + '日';
toast(msg){
uni.showToast({
title: msg,
icon: 'none'
});
},
isSameDay(date1, date2) {
return (
date1.getFullYear() === date2.getFullYear() &&
date1.getMonth() === date2.getMonth() &&
date1.getDate() === date2.getDate()
);
},
isYesterday(currentDate, targetDate) {
const yesterday = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - 1);
return this.isSameDay(yesterday, targetDate);
},
saveImage(src) {
uni.saveImageToPhotosAlbum({
filePath: src,
@ -235,10 +196,7 @@
});
},
fail() {
uni.showToast({
title: '保存失败',
icon: 'none'
});
toast('保存失败')
}
});
},
@ -260,46 +218,42 @@
this.overLayType = type
},
getListFn() {
// getMsgListApi({})
return
// request("POST", "enterprise/im/getMessageList", {
// limit: this.limit,
// page: this.page,
// toContactId: this.formId,
// }).then(res => {
// if (res.data.data.length == 0) {
// this.status = "nomore"
// return
// }
// this.list.unshift(...res.data.data)
// this.status = "loadmore"
// }).catch(err => {
// console.log(err, "")
// })
},
scrollFn(time) {
this.scollNum += 100000
scrollFn() {
return
this.scollNum += 1000
let that=this
setTimeout(() => {
uni.pageScrollTo({
scrollTop: that.scollNum,
scrollTop:that.scollNum,
});
console.log("滚动")
}, 100)
console.log("滚动1",that.scollNum)
}, 200)
},
// generateRandId() {
// var d = new Date().getTime();
// var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
// var r = (d + Math.random() * 16) % 16 | 0;
// d = Math.floor(d / 16);
// return (c == "x" ? r : r & 0x3 | 0x8).toString(16);
// });
// return uuid;
// },
// wn
sendFn() {
this.list.push({
content:this.value,
from_user_id:10,
type:"text",
from_user_avatar:"https://ts1.cn.mm.bing.net/th/id/R-C.2079d983dc3db1b0282e9d6044588021?rik=rO6pzNsFk%2f5Wlg&riu=http%3a%2f%2fwww.d2ziran.com%2fpublic%2fupload%2fimage%2f20190918%2f1568820586479461.jpg&ehk=4poVBmEdgXhqVLgf%2bjIlFtR6oUrNtHg3%2fu2qWk8b6aw%3d&risl=&pid=ImgRaw&r=0"
})
let that=this
this.scollNum += 1000
this.value = ""
// this.scrollFn()
setTimeout(() => {
uni.pageScrollTo({
    duration: 0,//
   
 scrollTop: that.scollNum,//
success:function(){
console.log('成功了', that.scollNum)
}
  })
}, 100)
return
if (!this.value) return
this.num++
this.flags = !this.flags
@ -315,58 +269,16 @@
}).then(res => {
this.list.push(data)
this.scrollFn(100)
this.value = ""
}).catch(err => {
console.log(err, "发送消息失败")
toast('发送失败')
})
this.value = ""
return
request("POST", "enterprise/im/sendMessage", {
content: this.value,
extends: null,
fileName: "",
fileSize: 0,
file_cate: 0,
file_id: 0,
fromUser: {
...this.fromUser
},
from_user: this.fromUser.id,
id: this.generateRandId(),
is_group: 0,
is_read: 0,
sendTime: Date.now(),
status: "going",
toContactId: this.fromId,
type: "text",
}).then(res => {
console.log("发送消息成功")
// this.list.push(res.data.data)
})
this.value = ""
this.scrollFn(100)
},
login() {
return
// request("POST", "common/Pub/login", {
// account: 13800000006,
// password: "123456",
// rememberMe: false,
// }).then(res => {
// uni.setStorageSync("token", (res.data.data.authToken))
// uni.setStorageSync("userinfo", JSON.stringify(res.data.data.userInfo))
// })
},
showPlusFn() {
this.showPlus = !this.showPlus
this.scrollFn(200)
},
choseImgFn() {
this.login()
let time = Date.now()
let that = this
uni.chooseImage({
@ -376,7 +288,7 @@
that.local = tempFilePath
that.localType = 'image'
that.showPlus = false
that.scrollFn(200)
const uploadTask = uni.uploadFile({
url: "http://192.168.1.9:8081/common/im/sendFileMsg",
filePath: tempFilePath, //
@ -387,16 +299,13 @@
formData: {
...this.sendData,
type:'image'
}, //
},
success: function(uploadRes) {
that.local = ""
that.list.push(JSON.parse(uploadRes.data).data)
//
},
fail: function(error) {
console.log('上传失败', error);
//
toast('上传失败')
}
});
uploadTask.onProgressUpdate((res) => {
@ -404,7 +313,7 @@
});
},
fail: err => {
console.log(err, "没有选择图片");
toast('操作取消')
}
});
},
@ -419,7 +328,7 @@
that.local = res.tempFilePath
that.localType = 'video'
that.showPlus = false
that.scrollFn(200)
const uploadTask = uni.uploadFile({
url: "http://192.168.1.9:8081/common/im/sendFileMsg",
filePath: tempFilePath, //
@ -464,6 +373,8 @@
},
},
onShow() {
return
this.fromId= JSON.parse( uni.getStorageSync("USER_INFO")).id
getAreaManagerApi({user_id:this.fromId}).then(res=>{
@ -482,28 +393,8 @@
this.scrollFn()
})
})
// 08302669767
return
let that = this
this.scrollFn(500)
this.timer = setInterval(() => {
request("POST", "enterprise/im/getMessageList", {
limit: 1,
page: 1,
toContactId: this.fromId,
}).then(res => {
if (res.data.data[0]?.id != this.list[this.list.length - 1]?.id) {
this.list.push(res.data.data[0])
if (res.data.data[0].type == 'video' || res.data.data[0].type == 'image') {
this.local = ""
}
// console.log(res.data.data)
}
// this.list.unshift(...res.data.data)
// this.status = "loadmore"
})
}, 3000)
},
// async onPullDownRefresh() {
@ -515,6 +406,7 @@
// },
onLoad() {
return
uni.connectSocket({
url: 'ws://192.168.1.9:8282'
});
@ -549,16 +441,10 @@
// this.getListFn()
return
uni.sendSocketMessage({
data: msg
});
},
onUnload() {
clearInterval(this.timer)
},
}
</script>
@ -572,22 +458,6 @@
font-size: 24rpx;
}
// .storeName {
// position: fixed;
// text-align: center;
// background-color: white;
// font-weight: bold;
// height: 80rpx;
// width: 100vw;
// z-index: 9;
// display: flex;
// align-items: center;
// justify-content: space-between;
// }
.topflag {
height: 80rpx;
background-color: #F6F7FD;
@ -596,9 +466,8 @@
.content {
padding: 0 20rpx;
// min-height: 100vh;
height: 89vh;
min-height: 95vh;
background-color: #F6F7FD;
overflow: auto;
padding-top: 10rpx;
// padding-bottom: 50px;