渣渣宝 4 năm trước cách đây
mục cha
commit
48d40b1787

+ 1 - 1
pages.json

xqd
@@ -237,7 +237,7 @@
 		"current": 0, //当前激活的模式(list 的索引项)
 		"list": [{
 			"name": "test", //模式名称
-			"path": "pages/scheduling/month_Scheduling", //启动页面,必选
+			"path": "pages/conversation/call", //启动页面,必选
 			"query": "" //启动参数,在页面的onLoad函数里面得到
 		}]
 	}

+ 98 - 34
pages/conversation/call.vue

xqd xqd
@@ -1,25 +1,32 @@
 <template class="bc#f6f6f6">
 	<view style="width: 100%;height: 100%;">
-		<u-gap height="30"></u-gap>
-		<view v-for="(item,index) in list" :key='index' @click="detail(item)" style="height: 200rpx;padding: 0 30rpx;background-color: #FFFFFF;">
-			<view class="flex" style="height: 199rpx;">
-				<!-- 头像 -->
-				<view style="width: 20%;" class="flex align-center">
-					<image :src="item.img" style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
+		<view class="title">
+			<!-- 头像 -->
+			<image :src="img" style="width: 100rpx;height: 100rpx;border-radius: 50%;"></image>
+			<!-- 名字 -->
+			<view style="font-size: 34rpx;font-weight: bold;margin-left: 30rpx;">{{name}}</view>
+			<view class="cu-tag round bg-orange sm" v-if="remark!=null">{{remark}}</view>
+		</view>
+		<view style="height: 100rpx;background-color: #FFF;padding: 0 40rpx;font-size: 34rpx;font-weight: bold;" class="flex align-center">
+			通话记录		</view>
+		<view v-for="(item,index) in list" :key="index" style="padding: 30rpx 30rpx;background-color: #FFF;border-top: 1rpx solid #d0d0d0;" class="flex justify-between align-end">
+			<view>
+				<view style="margin-bottom: 10rpx;">
+					<text style="font-size: 28rpx;margin-right: 10rpx;">订单号:</text>
+					<text style="font-size: 24rpx;">{{item.order}}</text>
 				</view>
-				<!-- 名字  时间  时长 -->
-				<view style="width: 45%;display: grid;align-content: center;">
-					<!-- 名字 -->
-					<view style="font-size: 34rpx;font-weight: bold;margin-bottom: 10rpx;">{{item.name}}</view>
-					<!-- 时间 -->
-					<view style="color: #a0a0a0;">最近通话时间: {{item.date}}</view>
-		 
+				<view >
+					<text style="font-size: 28rpx;margin-right: 10rpx">拨入时间:</text>
+					<text style="font-size: 24rpx;">{{item.time}}</text>
 				</view>
-			 
 			</view>
-			<u-line color="#f3f3f3" />
+			<view style="height: 100%;">
+				<text style="font-size: 28rpx;margin-right: 10rpx">通话时长:</text>
+				<text style="font-size: 24rpx;">{{item.duration}}</text>
+			</view>
 		</view>
 	</view>
+	</view>
 </template>
 
 <script>
@@ -27,44 +34,101 @@
 		components: {
 
 		},
-		onLoad() {
-			this.getLists();
+		// onLoad() {
+		// 	console.log(callObject)
+		// 	this.img = callObject.img
+		// 	this.name = callObject.name
+		// 	this.getLists();
+		// },
+		onLoad: function(options) {
+			let object = JSON.parse(options.callObject); //注意,此赋值方法不是微信官方赋值方法,页面奖无法获取数据
+			console.log(object);
+			this.img = object.img
+			this.name = object.name
+			this.id = object.id
+			this.remark = object.remark
+			this.getLists()
 		},
 		mounted() {
 
 		},
 		data() {
 			return {
+				id: 0,
+				img: '',
+				name: '',
+				object: '',
 				list: []
 			}
 		},
 		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;
-						for(let i=0;i<data.length;i++){
+			getLists: async function() {
+				console.log(this.id)
+				let res = await this.$request.post("Doctor/user_call", {
+					user_id: this.id
+				});
+				if (res.status == 0) {
+					if (res.data.length != 0) {
+						for (let k = 0; k < res.data.length; k++) {
 							this.list.push({
-								img: data[i].user.avatar, //头像
-								name: data[i].user.nickname, //名字
-								date: data[i].user.dates, //日期
-								id: data[i].user.id, //日期
+								time: res.data[k].time,
+								duration: this.getDuration(6524),
+								order: res.data[k].order_sn
 							})
 						}
 					}
 				}
-				console.log(res);
-			},
-			detail(e){
-				let id = e.id;	
-				// uni.navigateTo({
-				// 	url:  "../conversation/calldetail?id=" + id;
-				// })
+				console.log("res", res);
 			},
+			getDuration(second) {
+				// var hours = Math.floor((second % 86400) / 3600);
+				// var minutes = Math.floor(((second % 86400) % 3600) / 60);
+				// var seconds = Math.floor(((second % 86400) % 3600) % 60);
+				// var duration = hours + ":" + minutes + ":" + seconds;
+				// return duration;
+				 var theTime = parseInt(second);// 需要转换的时间秒 
+				 var theTime1 = 0;// 分 
+				 var theTime2 = 0;// 小时 
+				 var theTime3 = 0;// 天
+				 if(theTime > 60) { 
+				  theTime1 = parseInt(theTime/60); 
+				  theTime = parseInt(theTime%60); 
+				  if(theTime1 > 60) { 
+				   theTime2 = parseInt(theTime1/60); 
+				   theTime1 = parseInt(theTime1%60); 
+				   if(theTime2 > 24){
+				    //大于24小时
+				    theTime3 = parseInt(theTime2/24);
+				    theTime2 = parseInt(theTime2%24);
+				   }
+				  } 
+				 } 
+				 var result = '';
+				 if(theTime > 0){
+				  result = ""+parseInt(theTime)+"秒";
+				 }
+				 if(theTime1 > 0) { 
+				  result = ""+parseInt(theTime1)+"分"+result; 
+				 } 
+				 if(theTime2 > 0) { 
+				  result = ""+parseInt(theTime2)+"小时"+result; 
+				 } 
+				 if(theTime3 > 0) { 
+				  result = ""+parseInt(theTime3)+"天"+result; 
+				 }
+				 return result; 
+			}
 		}
 	};
 </script>
 
 <style>
+	.title {
+		display: flex;
+		align-items: center;
+		border-radius: 30rpx;
+		margin: 30rpx 50rpx;
+		padding: 20rpx;
+		box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);
+	}
 </style>

+ 60 - 18
pages/conversation/conversation.vue

xqd xqd xqd xqd xqd xqd xqd
@@ -2,13 +2,14 @@
 	<view class="main">
 		<view class="padding-lr-sm">
 			<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'}"
-			 v-model="keyword" @search="search"></u-search>
+			 v-model="thkeyword" @search="search"></u-search>
 		</view>
 		<!-- 这是聊天列表 当值为true时显示-->
 		<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-tag badge" v-if="item.unread">{{item.unread}}</view>
 				</view>
@@ -27,22 +28,33 @@
 					<view class="text-grey text-xs">{{formatDate(item.lastMessage.timestamp)}}</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>
 		</view>
 		<!-- 这是通话记录 当值为false1时显示 -->
 		<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 class="content">
 					<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 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>
 			<u-empty text="暂无数据" v-if="listPhone.length<=0" mode="order" margin-top="250"></u-empty>
 		</view>
@@ -114,9 +126,11 @@
 				console.log(e)
 			});
 			this.getcnversationList()
+			// this.listPhone=[]
+
 		},
 		onLoad() {
-
+			this.getLists()
 			// console.log(this.imService.sendPrivateTextMessage())
 			// console.log(this.imService.getFrindList())
 
@@ -129,9 +143,10 @@
 				//false为通话记录,true为聊天列表
 				qiehuan: true,
 				index: 0,
-				keyword: "",
+				thkeyword: "",
+				ltkeyword: "",
 				list: [],
-				listPhone: [],
+				listPhone: [], //假装这里有个人
 				conversations: {
 					unreadTotal: 0,
 					conversations: []
@@ -140,8 +155,28 @@
 			}
 		},
 		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() {
-				console.log(this.conversations)
+				// console.log(this.conversations)
 				if (this.conversations.unreadTotal > 0) {
 					uni.setTabBarBadge({
 						index: 1,
@@ -155,13 +190,13 @@
 			},
 			//搜索
 			search(e) {
-				console.log(e) //输入框的值
+				// console.log(e) //输入框的值
 			},
 
 			tonghua() {
-				 uni.navigateTo({
-					url: "call"
-				 })
+				// uni.navigateTo({
+				// url: "call"
+				// })
 				this.qiehuan = !this.qiehuan
 			},
 			goliaotian(e) {
@@ -185,9 +220,16 @@
 					url: urls
 				})
 			},
-			call() {
+			call(img, name,id,remark) {
+				let callObject = {
+					img: img+'',
+					name: name+'',
+					id:id,
+					remark:remark
+				}
+				// console.log(callObject)
 				uni.navigateTo({
-					url: "call"
+					url: 'call?callObject=' +  JSON.stringify(callObject),//跳转页面不能传对象,只能转为字符串
 				})
 			},
 			getcnversationList: async function() {

+ 4 - 2
pages/scheduling/month_Scheduling.vue

xqd
@@ -39,8 +39,10 @@
 		</u-popup>
 		<!-- 顶部标题和按钮 -->
 		<view class="flex justify-between align-center" style="margin: 40rpx 28rpx;">
-			<view style="font-size: 50rpx;flex-grow: 2;" @click="timeShow=true ">
-				<text style="padding: 15rpx;border: 1rpx solid #b0b0b0;border-radius: 30rpx;">{{year}}年{{month+1}}月</text>
+			<view style="flex-grow: 2;" class="drop-down"  @click="timeShow=true ">
+				<text>{{year}}年{{month+1}}月</text>
+				<u-icon name="arrow-down-fill" size="32" color="#848484" v-show="!timeShow"></u-icon>
+				<u-icon name="arrow-up-fill" size="32" color="#848484" v-show="timeShow"></u-icon>
 			</view>
 			<view class="flex justify-around align-center" style="flex-grow: 3;">
 				<view class="drop-down" @click="hospitalListShow=!hospitalListShow">