商机信息滚动条
This commit is contained in:
parent
2e6ea98e21
commit
c10460b9b6
15
pages.json
15
pages.json
@ -30,20 +30,15 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "商机信息",
|
"navigationBarTitleText": "商机信息",
|
||||||
"navigationBarBackgroundColor": "#0122C7",
|
"navigationBarBackgroundColor": "#0122C7",
|
||||||
"navigationBarTextStyle": "white"
|
"navigationBarTextStyle": "white",
|
||||||
|
"app-plus": {
|
||||||
|
//手机软键盘升起不让其将页面头部上推
|
||||||
|
"softinputMode": "adjustResize"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/business/talkDetail",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "商机信息",
|
|
||||||
"enablePullDownRefresh": true,
|
|
||||||
"navigationBarBackgroundColor": "#0122C7",
|
|
||||||
"navigationBarTextStyle": "white"
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -1,20 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<view style="background-color: #F6F7FD;">
|
<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="content" @click="showPlus=false" id="content">
|
||||||
<view class="">
|
<view class="">
|
||||||
<u-loadmore :status="status" />
|
<u-loadmore :status="status"
|
||||||
|
:loadmore-text="`你正在与${'wo'}聊天`"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="task-li" v-for="item,index in list" :key="index">
|
<view class="task-li" v-for="item,index in list" :key="index">
|
||||||
@ -41,10 +32,7 @@
|
|||||||
<view class="yl-text">
|
<view class="yl-text">
|
||||||
<u-icon name="play-circle" color='white' size='30'></u-icon>
|
<u-icon name="play-circle" color='white' size='30'></u-icon>
|
||||||
</view>
|
</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>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -78,10 +66,6 @@
|
|||||||
<u--image :showLoading="true" :src="a" shape="circle" width="40px" height="40px"></u--image>
|
<u--image :showLoading="true" :src="a" shape="circle" width="40px" height="40px"></u--image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 本地 -->
|
<!-- 本地 -->
|
||||||
<view v-if="local">
|
<view v-if="local">
|
||||||
@ -107,8 +91,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</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>
|
</view>
|
||||||
@ -118,7 +105,7 @@
|
|||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<view class="send-col">
|
<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">
|
placeholder-style="color:#DDD;" :cursor-spacing="6">
|
||||||
|
|
||||||
<u--image :showLoading="true" src="/static/img/bussness/Plus.png" width="32px" height="32px"
|
<u--image :showLoading="true" src="/static/img/bussness/Plus.png" width="32px" height="32px"
|
||||||
@ -139,7 +126,7 @@
|
|||||||
|
|
||||||
<text>视频</text>
|
<text>视频</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- asdas -->
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -173,58 +160,32 @@
|
|||||||
showPlus: false,
|
showPlus: false,
|
||||||
num: 0,
|
num: 0,
|
||||||
flags: true,
|
flags: true,
|
||||||
scollNum: 999999999999,
|
scollNum: 0,
|
||||||
client_id: "",
|
client_id: "",
|
||||||
fromId: "",
|
fromId: "",
|
||||||
toId:"",
|
toId:"",
|
||||||
name: "",
|
name: "",
|
||||||
status: "lodemore",
|
status: "loadmore",
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
formUser: "",
|
formUser: "",
|
||||||
show: false,
|
show: false,
|
||||||
overLaySrc: "",
|
overLaySrc: "",
|
||||||
overLayType: "",
|
overLayType: "",
|
||||||
canvasContext: null,
|
|
||||||
timer: "",
|
|
||||||
local: "",
|
local: "",
|
||||||
localType: "",
|
localType: "",
|
||||||
progress: "",
|
progress: "",
|
||||||
showNotice: false,
|
|
||||||
sendData:{}
|
sendData:{}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
timeFn(time) {
|
toast(msg){
|
||||||
const currentDate = new Date(); // 当前日期对象
|
uni.showToast({
|
||||||
const targetDate = new Date(1695722299000);
|
title: msg,
|
||||||
if (this.isSameDay(currentDate, targetDate)) {
|
icon: 'none'
|
||||||
const hours = targetDate.getHours(); // 小时
|
});
|
||||||
const minutes = targetDate.getMinutes(); // 分钟
|
|
||||||
return hours + ':' + minutes;
|
|
||||||
|
|
||||||
} else if (this.isYesterday(currentDate, targetDate)) {
|
|
||||||
return '昨天';
|
|
||||||
}
|
|
||||||
const month = targetDate.getMonth() + 1; // 月份(注意月份从0开始,需要加1)
|
|
||||||
const day = targetDate.getDate(); // 日期
|
|
||||||
return month + '月' + day + '日';
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
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) {
|
saveImage(src) {
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath: src,
|
filePath: src,
|
||||||
@ -235,10 +196,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail() {
|
fail() {
|
||||||
uni.showToast({
|
toast('保存失败')
|
||||||
title: '保存失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -260,46 +218,42 @@
|
|||||||
this.overLayType = type
|
this.overLayType = type
|
||||||
},
|
},
|
||||||
getListFn() {
|
getListFn() {
|
||||||
// getMsgListApi({})
|
|
||||||
return
|
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) {
|
scrollFn() {
|
||||||
this.scollNum += 100000
|
return
|
||||||
|
this.scollNum += 1000
|
||||||
let that=this
|
let that=this
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.pageScrollTo({
|
uni.pageScrollTo({
|
||||||
scrollTop:that.scollNum,
|
scrollTop:that.scollNum,
|
||||||
});
|
});
|
||||||
console.log("滚动")
|
console.log("滚动1",that.scollNum)
|
||||||
}, 100)
|
}, 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() {
|
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
|
if (!this.value) return
|
||||||
this.num++
|
this.num++
|
||||||
this.flags = !this.flags
|
this.flags = !this.flags
|
||||||
@ -315,58 +269,16 @@
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.list.push(data)
|
this.list.push(data)
|
||||||
this.scrollFn(100)
|
this.scrollFn(100)
|
||||||
|
this.value = ""
|
||||||
}).catch(err => {
|
}).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() {
|
showPlusFn() {
|
||||||
this.showPlus = !this.showPlus
|
this.showPlus = !this.showPlus
|
||||||
this.scrollFn(200)
|
|
||||||
},
|
},
|
||||||
choseImgFn() {
|
choseImgFn() {
|
||||||
this.login()
|
|
||||||
let time = Date.now()
|
let time = Date.now()
|
||||||
let that = this
|
let that = this
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
@ -376,7 +288,7 @@
|
|||||||
that.local = tempFilePath
|
that.local = tempFilePath
|
||||||
that.localType = 'image'
|
that.localType = 'image'
|
||||||
that.showPlus = false
|
that.showPlus = false
|
||||||
that.scrollFn(200)
|
|
||||||
const uploadTask = uni.uploadFile({
|
const uploadTask = uni.uploadFile({
|
||||||
url: "http://192.168.1.9:8081/common/im/sendFileMsg",
|
url: "http://192.168.1.9:8081/common/im/sendFileMsg",
|
||||||
filePath: tempFilePath, // 选择的图片文件路径
|
filePath: tempFilePath, // 选择的图片文件路径
|
||||||
@ -387,16 +299,13 @@
|
|||||||
formData: {
|
formData: {
|
||||||
...this.sendData,
|
...this.sendData,
|
||||||
type:'image'
|
type:'image'
|
||||||
}, // 服务端接收文件的字段名
|
},
|
||||||
success: function(uploadRes) {
|
success: function(uploadRes) {
|
||||||
that.local = ""
|
that.local = ""
|
||||||
that.list.push(JSON.parse(uploadRes.data).data)
|
that.list.push(JSON.parse(uploadRes.data).data)
|
||||||
|
|
||||||
// 处理上传成功的逻辑
|
|
||||||
},
|
},
|
||||||
fail: function(error) {
|
fail: function(error) {
|
||||||
console.log('上传失败', error);
|
toast('上传失败')
|
||||||
// 处理上传失败的逻辑
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
uploadTask.onProgressUpdate((res) => {
|
uploadTask.onProgressUpdate((res) => {
|
||||||
@ -404,7 +313,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.log(err, "没有选择图片");
|
toast('操作取消')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -419,7 +328,7 @@
|
|||||||
that.local = res.tempFilePath
|
that.local = res.tempFilePath
|
||||||
that.localType = 'video'
|
that.localType = 'video'
|
||||||
that.showPlus = false
|
that.showPlus = false
|
||||||
that.scrollFn(200)
|
|
||||||
const uploadTask = uni.uploadFile({
|
const uploadTask = uni.uploadFile({
|
||||||
url: "http://192.168.1.9:8081/common/im/sendFileMsg",
|
url: "http://192.168.1.9:8081/common/im/sendFileMsg",
|
||||||
filePath: tempFilePath, // 选择的图片文件路径
|
filePath: tempFilePath, // 选择的图片文件路径
|
||||||
@ -465,6 +374,8 @@
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
this.fromId= JSON.parse( uni.getStorageSync("USER_INFO")).id
|
this.fromId= JSON.parse( uni.getStorageSync("USER_INFO")).id
|
||||||
getAreaManagerApi({user_id:this.fromId}).then(res=>{
|
getAreaManagerApi({user_id:this.fromId}).then(res=>{
|
||||||
this.toId=res.data.to_user_id
|
this.toId=res.data.to_user_id
|
||||||
@ -482,28 +393,8 @@
|
|||||||
this.scrollFn()
|
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() {
|
// async onPullDownRefresh() {
|
||||||
@ -515,6 +406,7 @@
|
|||||||
|
|
||||||
// },
|
// },
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
return
|
||||||
uni.connectSocket({
|
uni.connectSocket({
|
||||||
url: 'ws://192.168.1.9:8282'
|
url: 'ws://192.168.1.9:8282'
|
||||||
});
|
});
|
||||||
@ -549,16 +441,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this.getListFn()
|
|
||||||
return
|
|
||||||
uni.sendSocketMessage({
|
|
||||||
data: msg
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onUnload() {
|
|
||||||
clearInterval(this.timer)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -572,22 +458,6 @@
|
|||||||
font-size: 24rpx;
|
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 {
|
.topflag {
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
background-color: #F6F7FD;
|
background-color: #F6F7FD;
|
||||||
@ -596,9 +466,8 @@
|
|||||||
.content {
|
.content {
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
// min-height: 100vh;
|
// min-height: 100vh;
|
||||||
height: 89vh;
|
min-height: 95vh;
|
||||||
background-color: #F6F7FD;
|
background-color: #F6F7FD;
|
||||||
overflow: auto;
|
|
||||||
padding-top: 10rpx;
|
padding-top: 10rpx;
|
||||||
// padding-bottom: 50px;
|
// padding-bottom: 50px;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user