<template>
|
<view>
|
<v-header class="nav_bar m-y-xs" :left-text="$t('base.a1')" :title="$t('otc.k4')"
|
:left-arrow="true">
|
<template #right>
|
<v-link to="/pages/otc/order" class="d-flex align-center">
|
{{$t('otc.k2')}}
|
</v-link>
|
</template>
|
</v-header>
|
<!-- <view class="cu-bar"></view> -->
|
<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
|
<view class="cu-bar bg-white solid-bottom margin-top">
|
<!-- <view class="action">
|
<text class="cuIcon-title text-orange "></text>
|
</view> -->
|
</view>
|
|
<view class="cu-list menu-avatar" v-for="item in List_Info" :key="item.id" >
|
<view class="cu-item" @click="chat_detail(item.last_message.toid)">
|
<view class="cu-avatar radius lg"
|
:style="{ 'background-image':'url('+ item.head_url +')' }">
|
</view>
|
<view class="content">
|
<!-- <view class="text-grey">{{item.username}}</view> -->
|
<view class="text-gray text-sm flex" >
|
<view class="text-cut">{{item.username}}</view>
|
<view class="cu-tag round bg-orange sm">买家</view>
|
</view>
|
<view class="text-gray text-sm flex">
|
<view class="text-cut">{{item.last_message.content}}</view>
|
</view>
|
</view>
|
<view class="action">
|
<view class="text-grey text-xs">{{new Date(parseInt(item.last_message.time)).toTimeString().substr(0, 8)}}</view>
|
<view class="cu-tag round bg-green sm">{{item.last_message.isread}}</view>
|
</view>
|
</view>
|
</view>
|
|
</scroll-view>
|
</view>
|
|
</template>
|
|
<script>
|
import Profile from "@/api/profile";
|
export default {
|
data() {
|
return {
|
connected: false,
|
connecting: false,
|
socketTask: false,
|
msg: false,
|
API_URL: "https://socket.kocoinlab.com/index.php/api/chat2/",
|
from_id: 0,
|
List_Info:{},
|
modalName:null,
|
|
};
|
},
|
computed: {
|
|
|
},
|
// onLoad() {
|
// this.getUserInfo()
|
// this.get_list();
|
// },
|
onLoad() {
|
this.getUserInfo();
|
},
|
methods: {
|
chat_detail(toid){
|
console.log(toid);
|
this.$router.push({ path: "/pages/otc/chat", query: { id:toid} });
|
},
|
|
//获取聊天列表
|
get_list() {
|
//console.log(this.fromid);
|
//console.log(this.List_info);
|
uni.request({
|
method:'POST',
|
url:this.API_URL+"get_list",
|
data:{"id":this.from_id},
|
success: (res) => {
|
//console.log(res);
|
var data = res.data
|
if (data.code == 0) {
|
console.log(data.data)
|
this.List_Info = data.data
|
this.$forceUpdate()
|
} else{
|
console.log("false")
|
}
|
|
}
|
})
|
},
|
getUserInfo() {
|
Profile.getUserInfo().then((res) => {
|
console.log(res.data)
|
this.from_id = res.data.user_id
|
console.log(this.from_id)
|
this.get_list();
|
});
|
},
|
}
|
|
}
|
</script>
|
|
<style>
|
.page {
|
height: 100Vh;
|
width: 100vw;
|
}
|
|
.page.show {
|
overflow: hidden;
|
}
|
|
.switch-sex::after {
|
content: "\e716";
|
}
|
|
.switch-sex::before {
|
content: "\e7a9";
|
}
|
|
.switch-music::after {
|
content: "\e66a";
|
}
|
|
.switch-music::before {
|
content: "\e6db";
|
}
|
</style>
|