فهرست منبع

提交,修复聊天

渣渣宝 5 سال پیش
والد
کامیت
f825a46b64

+ 5 - 1
pages/conversation/conversation.vue

xqd xqd
@@ -46,7 +46,7 @@
 						<!-- 用户昵称 -->
 						<text class="text-cut">{{item.name}}</text>
 						<!-- 备注 -->
-						<view class="cu-tag round bg-orange sm" v-if="item.remark!=null">{{item.remark}}</view>
+						<view class="cu-tag round bg-orange sm" v-if="item.remark!=null&&item.remark!=''">{{item.remark}}</view>
 					</view>
 				</view>
 				<view class="action">
@@ -77,6 +77,10 @@
 			formatData() {
 				let arr = []
 				this.list.forEach(item => {
+					console.log(this.conversations.conversations.length)
+					if(this.conversations.conversations.length==0){
+						return this.list
+					}
 					this.conversations.conversations.forEach(ite => {
 						if (item.flag == ite.userId) {
 							item.unread = ite.unread

+ 26 - 18
pages/conversation/conversationWindow.vue

xqd xqd xqd xqd xqd
@@ -35,7 +35,8 @@
 				</view>
 			</view>
 		</view>
-		<view :class="InputBottom!=0?'cu-bar foot tab input cur':'cu-bar foot input'" :style="'bottom:'+InputBottom+'px'" v-show="sures">
+		<view :class="InputBottom!=0?'cu-bar foot tab input cur':'cu-bar foot input'" :style="'bottom:'+InputBottom+'px'"
+		 v-show="sures">
 			<view class="action" @click="sendvoice">
 				<text class="cuIcon-sound text-grey"></text>
 			</view>
@@ -63,38 +64,40 @@
 		components: {
 			GoEasyAudioPlayer
 		},
-		onLoad :function(op) {
-			
-			if(op.type==2){
-				this.sures=false;
+		onLoad: function(op) {
+			this.messages = []
+			this.self_messages = []
+			if (op.type == 2) {
+				this.sures = false;
 			}
 			this.imService = getApp().globalData.imService;
 			this.doctorInfo = JSON.parse(op.patient)
-			 this.getMessage("member_" + this.doctorInfo.user_id)
+			this.getMessage("member_" + this.doctorInfo.user_id)
 			//对话数据
 			this.friend = {
 				uuid: "member_" + this.doctorInfo.user_id,
 				name: this.doctorInfo.user_name,
 				avatar: this.doctorInfo.user_avatar
 			};
-			
+
 			this.currentUser = this.imService.currentUser;
-			console.log('打印数据:',)
+
 			let privateMessages = this.imService.getPrivateMessages(this.friend.uuid);
 			this.messages = privateMessages.sentMessages;
 			this.pendingMessages = privateMessages.pendingMessages;
 			uni.setNavigationBarTitle({
 				title: this.friend.name
 			});
-
+			console.log('打印数据:', this.messages)
+			console.log('打印数据:', this.pendingMessages)
 			this.initialListeners();
 			//每次进入聊天页面,总是滚动到底部
-			
+
 			//收到的消息设置为已读
 			if (this.messages.length != 0) {
 				this.imService.markPrivateMessageAsRead(this.friend.uuid);
 			}
-			 this.loadMoreHistoryMessage();
+			this.loadMoreHistoryMessage();
 
 		},
 		mounted() {
@@ -102,7 +105,7 @@
 		},
 		data() {
 			return {
-				sures:true,
+				sures: true,
 				keyword: "",
 				InputBottom: 0,
 				isvoice: false,
@@ -124,19 +127,23 @@
 			this.loadMoreHistoryMessage();
 		},
 		onUnload() {
+			console.log("页面卸载")
+			this.messages.splice(0,this.messages.length)
 			//退出聊天页面之前,清空页面传入的监听器
 			if (this.imService) {
 				this.imService.onNewPrivateMessageReceive = (friendId, message) => {};
 			}
 		},
 		methods: {
-			
-			getMessage:async function(flag){
-				let res = await this.$request.post("doctor/getImList",{'flag':flag});
-				if(res.status==0){
-					if(res.data.length!=0){
+
+			getMessage: async function(flag) {
+				let res = await this.$request.post("doctor/getImList", {
+					'flag': flag
+				});
+				if (res.status == 0) {
+					if (res.data.length != 0) {
 						let newList = [];
-						for(let i=0;i<res.data.length;i++){
+						for (let i = 0; i < res.data.length; i++) {
 							this.messages.push(res.data[i]);
 							// newList.push(res.data[i]);
 						}
@@ -178,6 +185,7 @@
 					if (friendId == this.friend.uuid) {
 						this.imService.markPrivateMessageAsRead(friendId);
 						//收到新消息,是滚动到最底部
+
 						this.scrollToBottom()
 					}
 				};

+ 1 - 1
pages/index/index.vue

xqd
@@ -188,7 +188,7 @@
 						<view v-else>
 							<text class="margin-left-xs" style="font-size: 24rpx;color: #747474;">已读</text>
 						</view>
-						<text class="flex-sub text-right">{{item.created_at}}</text>
+						<text class="flex-sub text-right">{{item.created_at==null?'':item.created_at}}</text>
 					</view>
 					<view class="margin-top-sm">
 						{{item.content}}

+ 27 - 19
pages/login/login.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -42,16 +42,22 @@
 				</view>
 				<input v-model="password" placeholder="请输入密码" :password="true" style="height: 28rpx;" />
 			</view>
+			<view class="flex align-center justify-between" style="margin: 30rpx 0 100rpx 0;color: #00aaff;font-weight: bold;">
+				<view style="text-align: center;">
+					<text @click="ispwdlogin = !ispwdlogin">{{ispwdlogin?'验证码':'手机号密码'}}登录</text>
+				</view>
+				<view style="text-align: center;">
+					<text @click="goreg">注册账号</text>
+				</view>
+			</view>
 		</view>
 		<!-- 按钮 -->
-		<view style="height: 30vh;padding: 0 80rpx;">
-			<!-- 登录 -->
-			<u-button @click="startReg()" type="primary" shape="circle" :loading="isRotate" :custom-style="customStyle">登录</u-button>
-
+		<view style="height: 30vh;padding: 100rpx 80rpx 0 80rpx;">
 
 
 
-			<view class="flex align-center justify-between" style="margin: 70rpx 0 100rpx 0;">
+			<!-- 
+			<view class="flex align-center justify-between" style="margin: 30rpx 0 100rpx 0;">
 				<view style="width: 50%;text-align: center;">
 					<text style="text-decoration:underline; color: #666666;" @click="goreg">注册账号</text>
 				</view>
@@ -59,11 +65,13 @@
 					<text style="text-decoration:underline ; color: #666666;" @click="ispwdlogin = !ispwdlogin">{{ispwdlogin?'验证码':'手机号密码'}}登录</text>
 				</view>
 			</view>
+ -->
+			<!-- 登录 -->
+			<u-button @click="startReg()" type="primary" shape="circle" :loading="isRotate" :custom-style="customStyle">登录</u-button>
 
-
-			<view class="flex align-center justify-center" style="margin-top: 100rpx;">
-				<button size="default" :class="" style="box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.08);border-radius: 60rpx;border: 0.3rpx solid #dedede;margin: 0;width: 80%;"
-				 open-type="getUserInfo" @getuserinfo="getinfo" >
+			<view class="flex align-center justify-center" style="margin-top: 50rpx;">
+				<button size="default" :class="" style="border: 1rpx solid #84BB43;box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.08);border-radius: 60rpx;border: 0.3rpx solid #dedede;margin: 0;width: 100%;"
+				 open-type="getUserInfo" @getuserinfo="getinfo">
 					<view :class="rotate_loop" style="font-size: 28rpx;color: #84BB43;">
 						<slot name="icon">
 							<u-icon name="weixin-fill" style="margin-right: 20rpx;" size="30"></u-icon>
@@ -71,7 +79,6 @@
 						<slot name="text">微信授权一键登录</slot>
 					</view>
 				</button>
-
 			</view>
 		</view>
 		<u-popup v-model="show" mode="center" :mask-close-able="false" border-radius="16">
@@ -82,7 +89,8 @@
 				<view class="text-gray margin-top-sm text-lg">
 					请授权手机号方便注册!
 				</view>
-				<button style="width: 100%;font-size: 32rpx;position: absolute;bottom: 0;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">确认授权</button>
+				<button style="width: 100%;font-size: 32rpx;position: absolute;bottom: 0;" open-type="getPhoneNumber"
+				 @getphonenumber="getPhoneNumber">确认授权</button>
 			</view>
 		</u-popup>
 	</view>
@@ -239,8 +247,8 @@
 						store.commit('setJwt', res.data.token);
 						store.commit('setUser', res.data);
 						store.commit('login');
-					
-						uni.removeStorage('verfiyCode')				
+
+						uni.removeStorage('verfiyCode')
 						getApp().globalData.imService = new IMService();
 						let loginResult = getApp().globalData.imService.login({
 							uuid: res.data.data.flag,
@@ -322,7 +330,7 @@
 									uni.navigateBack({
 										delta: 1
 									})
-							
+
 								}, 2000)
 								return false;
 							} else {
@@ -351,7 +359,7 @@
 					_this.isRotate = false
 				}, 3000)
 			},
-			
+
 			goreg() {
 				uni.navigateTo({
 					url: "./reg"
@@ -364,7 +372,7 @@
 			getinfo: async function(e) {
 				let that = this;
 				let meToken = user.loginByWeixin(e.detail.userInfo).then(res => {
-					console.log('返回的res',res)
+					console.log('返回的res', res)
 					if (res.status == 0) {
 						uni.showToast({
 							title: "登录成功",
@@ -373,7 +381,7 @@
 						})
 						console.log(res.data);
 						if (typeof res.data.token != 'undefined') {
-							 
+
 							console.log('我登录来 !');
 							console.log(res.data)
 							getApp().globalData.imService = new IMService();
@@ -430,7 +438,7 @@
 							icon: "none",
 							duration: 2000
 						})
-						
+
 						console.log('我登录来 !');
 						console.log(res.data)
 						getApp().globalData.imService = new IMService();
@@ -448,7 +456,7 @@
 							uni.navigateBack({
 								delta: 1
 							})
-						
+
 						}, 2000)
 					}
 				}

+ 45 - 46
pages/scheduling/month_Scheduling.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -1,7 +1,7 @@
 <template>
 	<view style="width: 100%;height: 100%;">
 		<!--医院列表 -->
-		<u-select v-model="hospitalListShow" :list="hospitalList" @confirm="setSelectHospital" ></u-select>
+		<u-select v-model="hospitalListShow" :list="hospitalList" @confirm="setSelectHospital"></u-select>
 		<u-select v-model="timeShow" mode="mutil-column-auto" :list="timeList" @confirm="yearConfirm" :default-value="defaultIndex"></u-select>
 		<!--日视图弹出层-->
 		<u-popup v-model="popupShow" mode="bottom" border-radius="50">
@@ -104,28 +104,29 @@
 				this.getMonthList();
 				// this.getMonthList();
 				// this.getNowmonth()
-				console.log("s", this.schedulingList)
+				console.log("排班数据", this.schedulingList)
 			})
 		},
 		onShow() {
+			this.defaultIndex= [0,0]
+			this.getNowTime()
 			if (this.refresh) {
 				this.monthList.splice(0, this.monthList.length);
 				this.schedulingList.splice(0, this.schedulingList.length);
 				this.$nextTick(function() {
 					this.getHostail()
-					this.getNowTime()
 					this.getMonthList();
 				})
-				this.refresh=false
+				this.refresh = false
 			}
 
 		},
 		data() {
 			return {
 				//保存医院下标
-				defaultIndex:[0,0],
-				
-				refresh:false,
+				defaultIndex: [0, 0],
+
+				refresh: false,
 				timeShow: false,
 				timeList: [],
 				year: 0, //年
@@ -191,22 +192,19 @@
 					if (this.hospitalID != 0) {
 						if (this.saveDayType.mon == this.hospitalID) {
 							SaveLists.push(1)
+						} else if (this.saveDayType.mon == 0) {
+							SaveLists.push(0)
 						}
-						//else if(this.saveDayType.mon == 0){
-						// SaveLists.push(0)
-						// }
 						if (this.saveDayType.aft == this.hospitalID) {
 							SaveLists.push(2)
+						} else if (this.saveDayType.aft == 0) {
+							SaveLists.push(0)
 						}
-						//else if(this.saveDayType.aft == 0){
-						// 	SaveLists.push(0)
-						// }
 						if (this.saveDayType.nig == this.hospitalID) {
 							SaveLists.push(3)
+						} else if (this.saveDayType.nig == 0) {
+							SaveLists.push(0)
 						}
-						//else if(this.saveDayType.nig == 0){
-						// 	SaveLists.push(0)
-						// }
 						if (SaveLists.length != 0) {
 							let s = SaveLists.join(",");
 							let tj = {
@@ -215,7 +213,7 @@
 								'type': s,
 								'organization_id': this.hospitalID,
 							}
-							console.log(tj);
+							console.log("提交时间的数组",tj);
 							// if(typeof tj=='object'){
 							//  tj = JSON.stringify(tj);
 							// }
@@ -276,14 +274,17 @@
 					let day = new Date();
 					let a = day.getDate()
 					for (let x = 0; x < this.monthList.length - this.empty; x++) {
-						this.monthList[x + this.empty].mon = this.schedulingList[x].mon == "0" ? 0 : this.schedulingList[x].mon == this.hospitalID&&this.overdue(x) ?
+						this.monthList[x + this.empty].mon = this.schedulingList[x].mon == "0" ? 0 : this.schedulingList[x].mon == this.hospitalID &&
+							this.overdue(x) ?
 							1 : 2
-						this.monthList[x + this.empty].aft = this.schedulingList[x].aft == "0" ? 0 : this.schedulingList[x].aft == this.hospitalID&&this.overdue(x) ?
+						this.monthList[x + this.empty].aft = this.schedulingList[x].aft == "0" ? 0 : this.schedulingList[x].aft == this.hospitalID &&
+							this.overdue(x) ?
 							1 : 2
-						this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this.hospitalID&&this.overdue(x)  ?
+						this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this.hospitalID &&
+							this.overdue(x) ?
 							1 : 2
 					}
-					
+
 					// for (let x = 0; x < this.monthList.length - this.empty - a; x++) {
 					// 	this.monthList[x + this.empty - a].mon = this.schedulingList[x - a].mon == "0" ? 0 : 2
 					// 	this.monthList[x + this.empty - a].aft = this.schedulingList[x - a].aft == "0" ? 0 : 2
@@ -291,15 +292,15 @@
 					// }
 				}
 			},
-			overdue(day){
+			overdue(day) {
 				let date = new Date();
-				if(this.year==date.getFullYear()&&this.month==date.getMonth()&&day+1<date.getDate()){
-					console.log("123123",day+1,date.getDate(),this.year,date.getFullYear(),this.month,date.getMonth())
+				if (this.year == date.getFullYear() && this.month == date.getMonth() && day + 1 < date.getDate()) {
 					return false
-				}else{return true}
-				
-			}
-			,
+				} else {
+					return true
+				}
+
+			},
 			getMonthList: async function() {
 				console.log("请求数据", this.mothonStart, this.mothonEnd)
 				let res = await this.$request.post("doctor/monthDetail", {
@@ -344,9 +345,10 @@
 					yearList.push({
 						label: x + "月",
 						value: x,
-						extra:x-1
+						extra: x - 1
 					})
 				}
+				this.timeList.splice(0, this.timeList.length)
 				for (let x = 0; x < 3; x++) {
 					this.timeList.push({
 						label: (this.year + x) + "年",
@@ -374,9 +376,6 @@
 				this.empty = date.getDay()
 
 				date.setFullYear(this.year, this.month + 1, 0); //查看这个月有几天
-				console.log('查看这个月有几天:', date.setFullYear(this.year, this.month + 1, 0));
-				console.log(this.year, this.month)
-				console.log("本月最后一号", date.getDate());
 
 				this.mothonStart = this.year + '-' + (this.month + 1) + '-' + '01'
 
@@ -397,9 +396,12 @@
 						select: false,
 						//判断方法,通过判断是不是选中的医院ID
 						//0没有排班,1有排班,2有排班,但不是这个医院
-						mon: this.schedulingList[c].mon == "0" ? 0 : this.schedulingList[c].mon == this.hospitalID&&this.overdue(c) ? 1 : 2,
-						aft: this.schedulingList[c].aft == "0" ? 0 : this.schedulingList[c].aft == this.hospitalID&&this.overdue(c) ? 1 : 2,
-						nig: this.schedulingList[c].nig == "0" ? 0 : this.schedulingList[c].nig == this.hospitalID&&this.overdue(c) ? 1 : 2
+						mon: this.schedulingList[c].mon == "0" ? 0 : this.schedulingList[c].mon == this.hospitalID && this.overdue(c) ?
+							1 : 2,
+						aft: this.schedulingList[c].aft == "0" ? 0 : this.schedulingList[c].aft == this.hospitalID && this.overdue(c) ?
+							1 : 2,
+						nig: this.schedulingList[c].nig == "0" ? 0 : this.schedulingList[c].nig == this.hospitalID && this.overdue(c) ?
+							1 : 2
 					})
 
 				}
@@ -415,9 +417,7 @@
 			},
 
 			getimePate(str) {
-				console.log(str);
 				var date = new Date(str.replace(/-/g, '/'));
-				console.log(date)
 				return Date.parse(date);
 
 			},
@@ -462,13 +462,13 @@
 				console.log('月份:', this.monthList);
 				for (let x = 0; x < this.monthList.length - this.empty; x++) {
 					this.monthList[x + this.empty].mon = this.schedulingList[x].mon == "0" ? 0 : this.schedulingList[x].mon == this
-						.hospitalID ?
+						.hospitalID && this.overdue(x) ?
 						1 : 2
 					this.monthList[x + this.empty].aft = this.schedulingList[x].aft == "0" ? 0 : this.schedulingList[x].aft == this
-						.hospitalID ?
+						.hospitalID && this.overdue(x) ?
 						1 : 2
 					this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this
-						.hospitalID ?
+						.hospitalID && this.overdue(x) ?
 						1 : 2
 				}
 			},
@@ -496,9 +496,9 @@
 					this.monthList.map(val => {
 						val.select = false
 					})
-					this.saveDayType.mon = this.schedulingList[index - 2].mon;
-					this.saveDayType.aft = this.schedulingList[index - 2].aft;
-					this.saveDayType.nig = this.schedulingList[index - 2].nig;
+					this.saveDayType.mon = this.schedulingList[index - this.empty].mon;
+					this.saveDayType.aft = this.schedulingList[index - this.empty].aft;
+					this.saveDayType.nig = this.schedulingList[index - this.empty].nig;
 					this.monthList[index].select = true
 					this.day = text
 					this.popupShow = true
@@ -520,10 +520,10 @@
 			 * 确认选择年月
 			 * */
 			yearConfirm(e) {
-				console.log("选择了年月",e)
+				console.log("选择了年月", e)
 				this.defaultIndex[0] = e[0].extra
 				this.defaultIndex[1] = e[1].extra
-				
+
 				this.year = e[0].value
 				this.month = e[1].value - 1
 				let d = new Date();
@@ -536,7 +536,6 @@
 					this.getHostail()
 					this.getMonthList();
 					this.day = 0
-					console.log("s", this.schedulingList)
 				})
 
 			},

BIN
static/login/moren.png