Ver código fonte

临时提交代码~

release/210823_需求对对碰
王饶冀 3 anos atrás
pai
commit
722b9483fd

+ 0
- 7
components/tabbar/tabbar.js Ver arquivo

*/ */
methods: { methods: {
tabChange(e) { tabChange(e) {
wx.closeSocket();
if (e.detail.item.text == "发布需求" || e.detail.item.text == "消息") {
if (!app.globalData.customerId) {
app.goLogin();
return
}
}
const url = e.detail.item.pagePath; const url = e.detail.item.pagePath;
wx.redirectTo({ url }); wx.redirectTo({ url });
} }

+ 19
- 0
pages/index/components/homepage/homepage.js Ver arquivo

// 底部按钮点击 // 底部按钮点击
footBtnClick(){ footBtnClick(){
console.log(`点击了底部按钮`) console.log(`点击了底部按钮`)
console.log(this.data.isOther)
// 前往聊一聊
if(this.data.isOther){
console.log(this.data.customer)
let customer = this.data.customer;
wx.navigateTo({
url: "/pages/msgModule/wechat2/wechat2",
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('customerid', { customerid: customer.customerId, chatHeads: customer.chatHeads })
}
})
}
// 前往发布需求
else{
wx.navigateTo({
url: '/pages/releaseModule/index',
})
}
}, },
getListData() { getListData() {
let { page, size, customerId } = this.data; let { page, size, customerId } = this.data;

+ 2
- 2
pages/index/components/homepage/homepage.wxss Ver arquivo

padding: 26rpx 42rpx; padding: 26rpx 42rpx;
padding-bottom: 0; padding-bottom: 0;
position: relative; position: relative;
position: sticky;
/* position: sticky;
top: 0; top: 0;
z-index: 999;
z-index: 999; */
} }
.header-view .user-view{ .header-view .user-view{
height: 104rpx; height: 104rpx;

+ 12
- 10
pages/msgModule/index.js Ver arquivo

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() { onLoad() {
if (!app.globalData.customerId) {
app.goLogin();
return
}
}, },
onShow() { onShow() {
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null; const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null;
// 接收服务器的消息事件 // 接收服务器的消息事件
wx.onSocketMessage(function (res) { wx.onSocketMessage(function (res) {
// 接收到的消息{date,message,type} type类型为 1 是对方的消息 为 0 是自己的消息 // 接收到的消息{date,message,type} type类型为 1 是对方的消息 为 0 是自己的消息
console.log(res,'消息页----收到新消息')
console.log(res, '消息页----收到新消息')
// _this.initData(); // _this.initData();
let _data = JSON.parse(res.data); let _data = JSON.parse(res.data);
_data.chatRecord = JSON.parse(_data.chatRecord); _data.chatRecord = JSON.parse(_data.chatRecord);
let msgData = _this.data.msgData; let msgData = _this.data.msgData;
msgData.forEach(el=>{
msgData.forEach(el => {
// 如果当前消息的 customerId = 发送人的ID // 如果当前消息的 customerId = 发送人的ID
if(el.businessCommunicationCustomerVO.customerId == _data.chatRecord.sender){
if (el.businessCommunicationCustomerVO.customerId == _data.chatRecord.sender) {
el.lastContent = _data.chatRecord.content; el.lastContent = _data.chatRecord.content;
el.lastContentDate = $util.formatTime(new Date(_data.chatRecord.sendTime)); el.lastContentDate = $util.formatTime(new Date(_data.chatRecord.sendTime));
el.lastContentDate = el.lastContentDate.replaceAll('/', '-'); el.lastContentDate = el.lastContentDate.replaceAll('/', '-');
} }
}, },
// 去关注 // 去关注
followApplets(){
followApplets() {
wx.navigateTo({ wx.navigateTo({
url: "/pages/outLink/outLink?followApplets=true", //跳转页面的路径,可带参数 ?隔开,不同参数用 & 分隔;相对路径,不需要.wxml后缀 url: "/pages/outLink/outLink?followApplets=true", //跳转页面的路径,可带参数 ?隔开,不同参数用 & 分隔;相对路径,不需要.wxml后缀
success: function () {}, //成功后的回调;
fail: function () {}, //失败后的回调;
complete: function () {} //结束后的回调(成功,失败都会执行)
success: function () { }, //成功后的回调;
fail: function () { }, //失败后的回调;
complete: function () { } //结束后的回调(成功,失败都会执行)
}) })
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () {
onHide: function () {
wx.closeSocket(); wx.closeSocket();
}, },



+ 43
- 10
pages/msgModule/wechat2/wechat2.js Ver arquivo

input: null, input: null,
openid: null, openid: null,
// 表情 // 表情
connectemoji:[],
connectemoji: [],
emoji_list: ['emoji1i1', 'emoji2i2', 'emoji3i3', 'emoji4i4', 'emoji5i5'], emoji_list: ['emoji1i1', 'emoji2i2', 'emoji3i3', 'emoji4i4', 'emoji5i5'],
emotionVisible: false, emotionVisible: false,
inputShowed: false, inputShowed: false,
// 当前产品详情 // 当前产品详情
productInfo: null, productInfo: null,
// 发送框是否获取焦点 // 发送框是否获取焦点
inputShowed:false,
inputShowed: false,
}, },


/** /**
this.setData({ this.setData({
receiveMemberId: customerId, receiveMemberId: customerId,
sendAvatar, sendAvatar,
connectemoji:$faces.getfaces(),
connectemoji: $faces.getfaces(),
}) })
// 获取内存中的数据 // 获取内存中的数据
this.getStorageBaseInfo() this.getStorageBaseInfo()
console.log(businessCommunicationDemandId, '产品ID是否存在') console.log(businessCommunicationDemandId, '产品ID是否存在')
if (businessCommunicationDemandId) { if (businessCommunicationDemandId) {
if (historyList.length > 0) { if (historyList.length > 0) {
let tempArr = [];
for (let index = historyList.length - 1; index >= 0; index--) { for (let index = historyList.length - 1; index >= 0; index--) {
const element = historyList[index]; const element = historyList[index];
if (element.messageType == 1) { if (element.messageType == 1) {
tempArr.push(element);
if (element.transactionId == businessCommunicationDemandId) { if (element.transactionId == businessCommunicationDemandId) {
break; break;
} else { } else {
this.sendmsgApi("", 1); this.sendmsgApi("", 1);
console.log(`走这里1`)
} }
} }
} }
// 说明没有一条是messageType == 1 的
if(tempArr.length < 1){
this.sendmsgApi("", 1);
console.log(`走这里3`)
}
} else { } else {
this.sendmsgApi("", 1); this.sendmsgApi("", 1);
console.log(`走这里2`)
} }
} }
} }
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
wx.closeSocket();
// wx.closeSocket();
}, },


/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function () {
wx.closeSocket();
// wx.closeSocket();
}, },


/** /**
let { sendMemberId, receiveMemberId, businessCommunicationDemandId } = this.data; let { sendMemberId, receiveMemberId, businessCommunicationDemandId } = this.data;
let transactionId = businessCommunicationDemandId; let transactionId = businessCommunicationDemandId;
if (!businessCommunicationDemandId) { if (!businessCommunicationDemandId) {
transactionId = this.data.historyList[this.data.historyList.length - 1].transactionId;
if(this.data.historyList.length > 0){
transactionId = this.data.historyList[this.data.historyList.length - 1].transactionId;
}
}
if(!transactionId){
transactionId = "";
} }
let params = { let params = {
sender: receiveMemberId, // 发件人Id sender: receiveMemberId, // 发件人Id
console.log(input, '输入框额值') console.log(input, '输入框额值')
this.setData({ this.setData({
input, input,
emotionVisible:false,
inputShowed:true,
emotionVisible: false,
inputShowed: true,
}) })
}, },
closeEmotionVisible(){
closeEmotionVisible() {
this.setData({ this.setData({
emotionVisible:false,
emotionVisible: false,
})
},
// 发送图片
upImg() {
wx.chooseImage({
count: 1,
success: (res) => {
console.log(res);
console.log(res.tempFilePaths[0], '拿到的URL');
wx.uploadFile({
filePath: res.tempFilePaths[0],
name: "file",
url: "/file/uploading.action?fileType=TinymceImg",
success: (res2) => {
console.log(`上传之后的res2`,res2)
}
})
// /file/uploading.action?fileType=TinymceImg
}
}) })
}, },
// 公共聚焦方法,方法比较笨,但是过度效果平滑流畅 // 公共聚焦方法,方法比较笨,但是过度效果平滑流畅

+ 10
- 1
pages/releaseModule/index.js Ver arquivo

* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() { onLoad() {
if (!app.globalData.customerId) {
app.goLogin();
return
}
const eventChannel = this.getOpenerEventChannel() const eventChannel = this.getOpenerEventChannel()
if (eventChannel.on) { if (eventChannel.on) {
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
success(res1) { success(res1) {
if (res1.confirm) { if (res1.confirm) {
that.clearData(); that.clearData();
console.log('用户点击确定')
wx.navigateTo({
url: "/pages/outLink/outLink?followApplets=true", //跳转页面的路径,可带参数 ?隔开,不同参数用 & 分隔;相对路径,不需要.wxml后缀
success: function () { }, //成功后的回调;
fail: function () { }, //失败后的回调;
complete: function () { } //结束后的回调(成功,失败都会执行)
})
} else if (res1.cancel) { } else if (res1.cancel) {
let listDetail = res.data; let listDetail = res.data;
that.clearData(); that.clearData();

Carregando…
Cancelar
Salvar