|
@@ -2,13 +2,14 @@
|
|
<view class="main">
|
|
<view class="main">
|
|
<view class="padding-lr-sm">
|
|
<view class="padding-lr-sm">
|
|
<u-search placeholder="请输入搜索用户姓名" v-if="qiehuan" action-text="通话记录" @custom="tonghua" :action-style="{width:'110rpx'}"
|
|
<u-search placeholder="请输入搜索用户姓名" v-if="qiehuan" action-text="通话记录" @custom="tonghua" :action-style="{width:'110rpx'}"
|
|
- v-model="keyword" @search="search"></u-search>
|
|
|
|
|
|
+ v-model="ltkeyword" @search="search"></u-search>
|
|
<u-search placeholder="请输入搜索用户姓名" v-else action-text="聊天列表" @custom="tonghua" :action-style="{width:'110rpx'}"
|
|
<u-search placeholder="请输入搜索用户姓名" v-else action-text="聊天列表" @custom="tonghua" :action-style="{width:'110rpx'}"
|
|
- v-model="keyword" @search="search"></u-search>
|
|
|
|
|
|
+ v-model="thkeyword" @search="search"></u-search>
|
|
</view>
|
|
</view>
|
|
<!-- 这是聊天列表 当值为true时显示-->
|
|
<!-- 这是聊天列表 当值为true时显示-->
|
|
<view class="cu-list menu-avatar margin-top-xs" v-if="qiehuan">
|
|
<view class="cu-list menu-avatar margin-top-xs" v-if="qiehuan">
|
|
- <view class="cu-item u-border-bottom" v-for="(item,index) in formatData" :key="index" @click="goliaotian(index)">
|
|
|
|
|
|
+ <view class="cu-item u-border-bottom" v-for="(item,index) in formatData" :key="index" @click="goliaotian(index)"
|
|
|
|
+ v-if="ltkeyword==''?true:item.nickname.indexOf(ltkeyword)>=0">
|
|
<view class="cu-avatar radius lg" :style="'background-image:url('+item.avatar+');'">
|
|
<view class="cu-avatar radius lg" :style="'background-image:url('+item.avatar+');'">
|
|
<view class="cu-tag badge" v-if="item.unread">{{item.unread}}</view>
|
|
<view class="cu-tag badge" v-if="item.unread">{{item.unread}}</view>
|
|
</view>
|
|
</view>
|
|
@@ -27,22 +28,33 @@
|
|
<view class="text-grey text-xs">{{formatDate(item.lastMessage.timestamp)}}</view>
|
|
<view class="text-grey text-xs">{{formatDate(item.lastMessage.timestamp)}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ <view v-else>
|
|
|
|
+ <u-empty text="暂无搜索数据" mode="order" margin-top="250"></u-empty>
|
|
|
|
+ </view>
|
|
<u-empty text="暂无数据" v-if="list.length<=0" mode="order" margin-top="250"></u-empty>
|
|
<u-empty text="暂无数据" v-if="list.length<=0" mode="order" margin-top="250"></u-empty>
|
|
</view>
|
|
</view>
|
|
<!-- 这是通话记录 当值为false1时显示 -->
|
|
<!-- 这是通话记录 当值为false1时显示 -->
|
|
<view class="cu-list menu-avatar margin-top-xs" v-else>
|
|
<view class="cu-list menu-avatar margin-top-xs" v-else>
|
|
- <view class="cu-item u-border-bottom" v-for="(item,index) in listPhone" :key="index" @click="call">
|
|
|
|
- <view class="cu-avatar radius lg" style="background-image:url(https://ossweb-img.qq.com/images/lol/img/champion/Taric.png);border-radius: 50%;">
|
|
|
|
- <view class="cu-tag badge"></view>
|
|
|
|
|
|
+ <view class="cu-item u-border-bottom" v-for="(item,index) in listPhone" :key="index" @click="call(item.img,item.name,item.id,item.remark)"
|
|
|
|
+ v-if="thkeyword==''?true:item.name.indexOf(thkeyword)>=0">
|
|
|
|
+ <!-- 头像 -->
|
|
|
|
+ <view class="cu-avatar radius lg" :style="'background-image:url('+item.img+');border-radius: 50%;'">
|
|
|
|
+ <!-- <view class="cu-tag badge"></view> -->
|
|
</view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="content">
|
|
<view class="text-grey">
|
|
<view class="text-grey">
|
|
<!-- 用户昵称 -->
|
|
<!-- 用户昵称 -->
|
|
- <text class="text-cut"></text>
|
|
|
|
|
|
+ <text class="text-cut">{{item.name}}</text>
|
|
<!-- 备注 -->
|
|
<!-- 备注 -->
|
|
- <view class="cu-tag round bg-orange sm"></view>
|
|
|
|
|
|
+ <view class="cu-tag round bg-orange sm" v-if="item.remark!=null">{{item.remark}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ <view class="action">
|
|
|
|
+ <view class="text-grey text-xs">{{item.date}}</view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view v-else>
|
|
|
|
+ <u-empty text="暂无搜索数据" mode="order" margin-top="250"></u-empty>
|
|
</view>
|
|
</view>
|
|
<u-empty text="暂无数据" v-if="listPhone.length<=0" mode="order" margin-top="250"></u-empty>
|
|
<u-empty text="暂无数据" v-if="listPhone.length<=0" mode="order" margin-top="250"></u-empty>
|
|
</view>
|
|
</view>
|
|
@@ -114,9 +126,11 @@
|
|
console.log(e)
|
|
console.log(e)
|
|
});
|
|
});
|
|
this.getcnversationList()
|
|
this.getcnversationList()
|
|
|
|
+ // this.listPhone=[]
|
|
|
|
+
|
|
},
|
|
},
|
|
onLoad() {
|
|
onLoad() {
|
|
-
|
|
|
|
|
|
+ this.getLists()
|
|
// console.log(this.imService.sendPrivateTextMessage())
|
|
// console.log(this.imService.sendPrivateTextMessage())
|
|
// console.log(this.imService.getFrindList())
|
|
// console.log(this.imService.getFrindList())
|
|
|
|
|
|
@@ -129,9 +143,10 @@
|
|
//false为通话记录,true为聊天列表
|
|
//false为通话记录,true为聊天列表
|
|
qiehuan: true,
|
|
qiehuan: true,
|
|
index: 0,
|
|
index: 0,
|
|
- keyword: "",
|
|
|
|
|
|
+ thkeyword: "",
|
|
|
|
+ ltkeyword: "",
|
|
list: [],
|
|
list: [],
|
|
- listPhone: [],
|
|
|
|
|
|
+ listPhone: [], //假装这里有个人
|
|
conversations: {
|
|
conversations: {
|
|
unreadTotal: 0,
|
|
unreadTotal: 0,
|
|
conversations: []
|
|
conversations: []
|
|
@@ -140,8 +155,28 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getLists: async function() {
|
|
|
|
+ let res = await this.$request.post("Doctor/user_call");
|
|
|
|
+ if (res.status == 0) {
|
|
|
|
+ if (res.data.length != 0) {
|
|
|
|
+ let data = res.data;
|
|
|
|
+ console.log('data', data)
|
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
|
+ this.listPhone.push({
|
|
|
|
+ img: data[i].user.avatar, //头像
|
|
|
|
+ name: data[i].user.nickname, //名字
|
|
|
|
+ remark: data[i].user.remark, //备注
|
|
|
|
+ date: data[i].user.dates, //日期
|
|
|
|
+ id:data[i].user.id
|
|
|
|
+ // id: data[i].user.id, //日期
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // console.log(res);
|
|
|
|
+ },
|
|
setUnreadAmount() {
|
|
setUnreadAmount() {
|
|
- console.log(this.conversations)
|
|
|
|
|
|
+ // console.log(this.conversations)
|
|
if (this.conversations.unreadTotal > 0) {
|
|
if (this.conversations.unreadTotal > 0) {
|
|
uni.setTabBarBadge({
|
|
uni.setTabBarBadge({
|
|
index: 1,
|
|
index: 1,
|
|
@@ -155,13 +190,13 @@
|
|
},
|
|
},
|
|
//搜索
|
|
//搜索
|
|
search(e) {
|
|
search(e) {
|
|
- console.log(e) //输入框的值
|
|
|
|
|
|
+ // console.log(e) //输入框的值
|
|
},
|
|
},
|
|
|
|
|
|
tonghua() {
|
|
tonghua() {
|
|
- uni.navigateTo({
|
|
|
|
- url: "call"
|
|
|
|
- })
|
|
|
|
|
|
+ // uni.navigateTo({
|
|
|
|
+ // url: "call"
|
|
|
|
+ // })
|
|
this.qiehuan = !this.qiehuan
|
|
this.qiehuan = !this.qiehuan
|
|
},
|
|
},
|
|
goliaotian(e) {
|
|
goliaotian(e) {
|
|
@@ -185,9 +220,16 @@
|
|
url: urls
|
|
url: urls
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- call() {
|
|
|
|
|
|
+ call(img, name,id,remark) {
|
|
|
|
+ let callObject = {
|
|
|
|
+ img: img+'',
|
|
|
|
+ name: name+'',
|
|
|
|
+ id:id,
|
|
|
|
+ remark:remark
|
|
|
|
+ }
|
|
|
|
+ // console.log(callObject)
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: "call"
|
|
|
|
|
|
+ url: 'call?callObject=' + JSON.stringify(callObject),//跳转页面不能传对象,只能转为字符串
|
|
})
|
|
})
|
|
},
|
|
},
|
|
getcnversationList: async function() {
|
|
getcnversationList: async function() {
|