im聊天室接口报错问题

master
2023-02-08 11:59:15 +08:00
parent 83031507b9
commit e7879aac65
6 changed files with 72 additions and 59 deletions

View File

@ -67,7 +67,7 @@ export function getTalk(talkId) {
// 从商品页点击 客服 跳转 获取商品详情
export function jumpObtain(skuId, goodsId) {
return http.request({
url: `${api.im}/goods/goods/sku/${goodsId}/${skuId}`,
url: `/goods/goods/sku/${goodsId}/${skuId}`,
method: Method.GET,
});
}

View File

@ -7,6 +7,9 @@ const dev = {
im: "https://im-api.pickmall.cn",
common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn",
// common: "http://192.168.0.113:8890",
// buyer: "http://192.168.0.113:8888",
// im: "http://192.168.0.113:8885",
};
// 生产环境
const prod = {

View File

@ -1,12 +1,7 @@
<template>
<view class="log-list">
<!-- 提现记录 -->
<view
class="log-way"
v-if="cashLogData.length != 0"
v-for="(item, index) in cashLogData"
:key="index"
>
<view class="log-way" v-if="cashLogData.length != 0" v-for="(item, index) in cashLogData" :key="index">
<view class="log-item">
<view class="log-item-view">
<view class="title">{{
@ -25,12 +20,7 @@
</view>
</view>
<!-- 分销业绩 -->
<view
class="log-way"
v-if="achievementData.length != 0"
v-for="(item, index) in achievementData"
:key="index"
>
<view class="log-way" v-if="achievementData.length != 0" v-for="(item, index) in achievementData" :key="index">
<view class="log-item">
<view class="log-item-view">
<view class="title">{{ item.goodsName }}</view>
@ -131,15 +121,18 @@ export default {
.empty {
margin: 40rpx 0;
}
.price {
color: $main-color;
font-weight: bold;
}
.log-list {
padding: 0 8rpx;
overflow: hidden;
margin: 20rpx 0;
}
.log-way {
margin: 10rpx 0;
overflow: hidden;
@ -147,22 +140,26 @@ export default {
border-radius: 10rpx;
padding: 20rpx 0;
}
.title {
font-size: 30rpx;
font-weight: bold;
}
.log-item-view {
padding: 8rpx 32rpx;
display: flex;
font-size: 13px;
justify-content: space-between;
}
.log-item-footer {
padding: 8rpx 32rpx;
display: flex;
font-size: 13px;
justify-content: space-between;
}
.log-item-footers {
padding: 8rpx 32rpx;
display: flex;

View File

@ -10,7 +10,8 @@
<!-- 消息 -->
<view class="flex-column-start" v-if="msgList.length" v-for="(item, index) in msgList" :key="index">
<view class="flex-row-start column-time">
<view v-show="compareTime(index, item.createTime)" class="flex-row-start date-text">
<view v-show="compareTime(index, item.createTime)" class="flex-row-start date-text"
v-text="beautifyTime(item.createTime)">
</view>
</view>
<!-- 用户消息 头像可选加入-->
@ -122,9 +123,13 @@
</view>
</view>
</view>
<!-- 防止消息底部被遮 -->
<view v-if="showHide && !localImGoodsId && showHideModel" class="flex-row-start margin-left margin-top"
style="height: 120rpx;">
</view>
<!-- 如果没有聊天记录定位到底部 -->
<view
:style="{ position: msgList.length == 0 ? 'fixed' : '', bottom: msgList.length == 0 ? '50px' : '', width: msgList.length == 0 ? '100%' : '' }">
:style="{ position: msgList.length == 0 ? 'fixed' : '', bottom: msgList.length == 0 ? '66px' : '', width: msgList.length == 0 ? '100%' : '' }">
<view class="cartMessage" v-if="showHide && !localImGoodsId && showHideModel">
<view class="goodsCard u-flex u-row-between u-p-b-0">
<view class="imagebox" @click="jumpGoodDelic(item)">
@ -148,20 +153,21 @@
</view>
</view>
</view>
<!-- loading是显示 -->
<view v-show="msgLoad" class="flex-row-start margin-left margin-top">
<!-- <view v-show="msgLoad" class=" margin-left margin-top">
<view class="chat-img flex-row-center">
<!-- <image style="height: 75rpx;width: 75rpx;" src="../../static/image/robt.png" mode="aspectFit"></image> -->
<image style="height: 75rpx;width: 75rpx;" src="../../static/image/robt.png" mode="aspectFit"></image>
</view>
<view class="flex" style="width: 500rpx;">
<view class="margin-left padding-chat flex-column-start"
style="border-radius: 35rpx;background-color: #f9f9f9;">
<!-- <view class="cuIcon-loading turn-load" style="font-size: 35rpx;color: #3e9982;">
<view class="cuIcon-loading turn-load" style="font-size: 35rpx;color: #3e9982;">
</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
<!-- 防止消息底部被遮 -->
<view style="height: 120rpx;">
</view>
@ -223,8 +229,6 @@ export default {
}
},
onLoad (options) {
console.log(5555555555555555);
console.log(emojistwo);
// goodsid
this.showHideModel = options.goodsid
// localimGoodId
@ -275,7 +279,6 @@ export default {
// this.ws.connect();
this.sokcet();
},
onPullDownRefresh () {
this.params.pageNumber = this.params.pageNumber + 1
this.getTalkMessage()
@ -433,12 +436,11 @@ export default {
uni.connectSocket({
url: url,
});
}, 5 * 1000)
}, 999999)
}
});
//
uni.onSocketMessage(function (res) {
console.log(res.data);
res.data = JSON.parse(res.data)
console.log(res.data.result);
if (res.data.messageResultType == 'MESSAGE') {

View File

@ -94,8 +94,7 @@ export function unixToDate(unix, format) {
if (datetime == null || datetime == undefined || !datetime) {
return "";
}
datetime = datetime.replace(/-/g, "/");
datetime = timestampToTime(datetime).replace(/-/g, "/");
let time = new Date();
let outTime = new Date(datetime);
@ -140,6 +139,17 @@ export function unixToDate(unix, format) {
minutes = Math.abs(minutes);
return `${minutes}分钟前`;
}
// 时间转换
function timestampToTime (timestamp) {
var date = new Date(timestamp);//时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
var h = date.getHours() + ':';
var m = date.getMinutes() + ':';
var s = date.getSeconds();
return Y + M + D + h + m + s;
}
/**
* 13888888888 -> 138****8888

View File

@ -54,6 +54,7 @@ export default class SocketService {
};
// 得到服务端发送过来的数据
this.ws.onmessage = (msg) => {
// console.log(msg.data)
this.registerCallBack(msg.data);
};
}