Browse Source

修改逻辑

渣渣宝 4 years ago
parent
commit
19df6200d2

+ 6 - 1
App.vue

xqd xqd
@@ -1,5 +1,8 @@
 <script>
 	export default {
+		globalData: {
+			login: false
+		},
 		onLaunch: function() {
 			console.log('App Launch')
 		},
@@ -14,10 +17,12 @@
 
 <style lang="scss">
 	@import "uview-ui/index.scss";
-	page{
+
+	page {
 		background-color: #f8f8f8;
 		width: 100%;
 	}
+
 	@import "@/components/colorui/main.css";
 	@import "@/components/colorui/icon.css";
 </style>

+ 92 - 42
pages/conversation/conversation.vue

xqd xqd xqd xqd
@@ -90,55 +90,68 @@
 			}
 		},
 		onShow() {
-			var i = 0;
-			while (i < 3) {
-				console.log('我是i', i);
-				if (typeof getApp().globalData.imService == 'undefined') {
-					let res = uni.getStorageSync('user');
-					getApp().globalData.imService = new IMService();
-					let loginResult = getApp().globalData.imService.login({
-						uuid: res.data.flag,
-						name: res.data.name,
-						avatar: res.data.avatar
-					});
-					if (loginResult) {
-						//连接IM
-						getApp().globalData.imService.connectIM();
+			if (getApp().globalData.login) {
+				var i = 0;
+				while (i < 3) {
+					console.log('我是i', i);
+					if (typeof getApp().globalData.imService == 'undefined') {
+						let res = uni.getStorageSync('user');
+						getApp().globalData.imService = new IMService();
+						let loginResult = getApp().globalData.imService.login({
+							uuid: res.data.flag,
+							name: res.data.name,
+							avatar: res.data.avatar
+						});
+						if (loginResult) {
+							//连接IM
+							getApp().globalData.imService.connectIM();
+						}
+					} else {
+						break;
 					}
-				} else {
-					break;
+					i++;
 				}
-				i++;
+
+				this.imService = getApp().globalData.imService;
+				this.imService.onConversationsUpdate = (conversations) => {
+					this.conversations = conversations;
+					this.setUnreadAmount();
+				};
+				var promise = this.imService.latestConversations();
+				promise.then(res => {
+					this.conversations = res.content;
+					console.log("conversations load successfully")
+					this.setUnreadAmount();
+					uni.hideLoading();
+				}).catch(e => {
+					console.log(e)
+				});
+				this.getcnversationList()
+			} else {
+				uni.showModal({
+					title: "提示",
+					content: "尚未登录,请前往登录",
+					confirmText: "去登录",
+					showCancel: false,
+					success() {
+						uni.navigateTo({
+							url: "../login/login"
+						})
+					}
+				})
 			}
 
-			this.imService = getApp().globalData.imService;
-			this.imService.onConversationsUpdate = (conversations) => {
-				this.conversations = conversations;
-				this.setUnreadAmount();
-			};
-			var promise = this.imService.latestConversations();
-			promise.then(res => {
-				this.conversations = res.content;
-				console.log("conversations load successfully")
-				this.setUnreadAmount();
-				uni.hideLoading();
-			}).catch(e => {
-				console.log(e)
-			});
-			this.getcnversationList()
 			// this.listPhone=[]
 
 		},
 		onLoad() {
 			this.getLists()
-			// console.log(this.imService.sendPrivateTextMessage())
-			// console.log(this.imService.getFrindList())
-
 		},
 		mounted() {},
 
 		data() {
 			return {
+				then: 0,
 				//控制聊天列表和通话记录
 				//false为通话记录,true为聊天列表
 				qiehuan: true,
@@ -155,7 +168,44 @@
 			}
 		},
 		methods: {
+			// 医生信息
+			getDocterInfo: async function() {
+				let res = await this.$request.post("doctor/doctorInfor", {}, false);
+				this.then = res.data.is_then
+				if (res.data.is_then != 1) {
+					uni.showModal({
+						title: "提示",
+						content: "请您先认证",
+						confirmText: "去认证",
+						showCancel: true,
+						success: function(res) {
+							if (res.confirm) {
+								uni.navigateTo({
+									url: '/pages/login/doctorRenzheng'
+								})
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
+					})
+				}
+			},
+			//通话列表
 			getLists: async function() {
+				if (!getApp().globalData.login) {
+					uni.showModal({
+						title: "提示",
+						content: "尚未登录,请前往登录",
+						confirmText: "去登录",
+						showCancel: false,
+						success() {
+							uni.navigateTo({
+								url: "../login/login"
+							})
+							return false
+						}
+					})
+				}
 				let res = await this.$request.post("Doctor/user_call");
 				if (res.status == 0) {
 					if (res.data.length != 0) {
@@ -167,7 +217,7 @@
 								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
 								// id: data[i].user.id, //日期
 							})
 						}
@@ -220,16 +270,16 @@
 					url: urls
 				})
 			},
-			call(img, name,id,remark) {
+			call(img, name, id, remark) {
 				let callObject = {
-					img: img+'',
-					name: name+'',
-					id:id,
-					remark:remark
+					img: img + '',
+					name: name + '',
+					id: id,
+					remark: remark
 				}
 				// console.log(callObject)
 				uni.navigateTo({
-					url: 'call?callObject=' +  JSON.stringify(callObject),//跳转页面不能传对象,只能转为字符串
+					url: 'call?callObject=' + JSON.stringify(callObject), //跳转页面不能传对象,只能转为字符串
 				})
 			},
 			getcnversationList: async function() {

+ 47 - 35
pages/index/index.vue

xqd xqd xqd xqd
@@ -35,9 +35,10 @@
 
 						</view>
 						<!-- 标签 -->
-						<view style="height: 60rpx;padding-left: 40rpx;padding-right: 40rpx;display: flex;" >
+						<view style="height: 60rpx;padding-left: 40rpx;padding-right: 40rpx;display: flex;">
 							<view v-for="item,index in doctorlabel" :key="index">
-								<u-tag :show="index<4" style="margin-left: 10rpx;" :text="item.label_name" bg-color="#E5F5FF" color="#0B73B9" border-color="#ffffff" shape="circle " size="mini"/>
+								<u-tag :show="index<4" style="margin-left: 10rpx;" :text="item.label_name" bg-color="#E5F5FF" color="#0B73B9"
+								 border-color="#ffffff" shape="circle " size="mini" />
 							</view>
 						</view>
 						<view class="pr m-xcenter plr20">
@@ -129,7 +130,7 @@
 							 shape="circle"></u-image>
 							<view class="grid-text margin-top-xs">我的评价</view>
 						</u-grid-item>
-						<u-grid-item  @click="gorz">
+						<u-grid-item @click="gorz">
 							<u-image width="120rpx" height="120rpx" src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/home/zzzx.png"
 							 shape="circle"></u-image>
 							<view class="grid-text margin-top-xs">认证中心</view>
@@ -228,20 +229,21 @@
 					service_persons: "0"
 				},
 				page: 1,
-				doctorlabel:[],
+				doctorlabel: [],
 				docterMessageList: [],
 				//认证弹窗
 				rzModal: false,
 				mzModal: false,
 				twModel: false,
 				dhModel: false,
-
+				password: '',
 				//没登录头像
 				nosrc: '../../static/login/moren.png',
 				//登陆的头像
 				src: '../../static/login/moren.png',
 				//认证
 				renzheng: false, //true已认证
+
 				//标签
 				lable1: '',
 				lable2: '',
@@ -265,51 +267,61 @@
 			}
 		},
 		onShow() {
-			// if (!this.hasLogin) {
-			// 	uni.showModal({
-			// 		title: "提示",
-			// 		content: "尚未登录,请前往登录",
-			// 		confirmText: "去登录",
-			// 		showCancel: false,
-			// 		success() {
-			// 			uni.navigateTo({
-			// 				url: "../login/login"
-			// 			})
-			// 		}
-			// 	})
-			// };
 			// 获取当前登陆人信息
 			this.getDocterInfo();
 			// 获取当前登录人接收消息
 			this.getDocterMessage();
 
 			this.getStatus();
+			console.log('hasLogin',this.hasLogin)
+			getApp().globalData.text = this.hasLogin
 		},
-
 		mounted() {
 
 		},
 		methods: {
 			getDocterInfo: async function() {
 				let res = await this.$request.post("doctor/doctorInfor", {}, false);
-				if (res.data.name.length > 5) {
-					this.docterInfo.name = res.data.name.substring(0, 5) + "...";
-				} else {
-					this.docterInfo.name = res.data.name;
-				}
+				if (res.data != null) {
+					if (res.data.name.length > 5) {
+						this.docterInfo.name = res.data.name.substring(0, 5) + "...";
+					} else {
+						this.docterInfo.name = res.data.name;
+					}
 
-				this.src = res.data.avatar;
-				this.docterInfo.eva_num = res.data.eva_num;
-				this.docterInfo.is_then = res.data.is_then;
-				
-				this.doctorlabel = res.data.label;
-				console.log("res.data",this.doctorlabel)
-				this.docterInfo.sign = res.data.sign;
-				this.docterInfo.score = res.data.score;
-				this.docterInfo.service_days = res.data.service_days;
-				this.docterInfo.service_persons = res.data.service_persons;
-				console.log('认证', this.docterInfo.is_then)
+					this.src = res.data.avatar;
+					this.docterInfo.eva_num = res.data.eva_num;
+					this.docterInfo.is_then = res.data.is_then;
+					// console.log(res.data.password)
+					this.password = res.data.password;
+					this.doctorlabel = res.data.label;
+					console.log("res.data", this.doctorlabel)
+					this.docterInfo.sign = res.data.sign;
+					this.docterInfo.score = res.data.score;
+					this.docterInfo.service_days = res.data.service_days;
+					this.docterInfo.service_persons = res.data.service_persons;
+					this.setPassword()
+					console.log('医生信息', res.data)
+				}
+			},
+			// 跳到新增密码
+			setPassword() {
+				if (this.password != '' || this.password != null) {
+					uni.showModal({
+						content: '您未设置密码,为了保证账户安全,建议前去设置密码',
+						confirmText: '前去设置',
+						cancelText: '暂不设置',
+						success: function(res) {
+							if (res.confirm) {
+								uni.navigateTo({
+									url: '../information/modifypassword?state=' + 1,
+								})
+							}
+						}
+					})
+				}
 			},
+			//通知数据
 			getDocterMessage: async function() {
 
 				let res = await this.$request.post("docterMessage/docterMessageList", {

+ 6 - 2
pages/information/modifypassword.vue

xqd xqd
@@ -2,7 +2,7 @@
 
 	<view style="width: 100%;height: 100%;">
 		<view style="margin-top: 20rpx;background-color: #FFFFFF;">
-			<view style="padding: 45rpx 28rpx;">
+			<view style="padding: 45rpx 28rpx;" v-if="state==0">
 				<input placeholder="请输入原密码" style="height: 30rpx" @blur="blur1" />
 			</view>
 			<view style="padding: 45rpx 28rpx;">
@@ -21,9 +21,13 @@
 
 <script>
 	export default {
+		onLoad(obj) {
+			this.state = obj.state
+			console.log(state.state)
+		},
 		data() {
 			return {
-				
+				state:0,//判断状态,如果有密码就显示原密码框
 				//原密码
 				value1: '',
 				//新密码

+ 1 - 1
pages/login/login.vue

xqd
@@ -82,7 +82,7 @@
 		    <button open-type="getPhoneNumber" style="width: 100%;font-size: 32rpx;position: absolute;bottom: 0;"
 		     @getphonenumber="getPhoneNumber">确认授权</button>
 		   </view>
-		  </u-popup>
+		</u-popup>
 	</view>
 </template>
 

+ 66 - 58
pages/scheduling/month_Scheduling.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -39,7 +39,7 @@
 		</u-popup>
 		<!-- 顶部标题和按钮 -->
 		<view class="flex justify-between align-center" style="margin: 40rpx 28rpx;">
-			<view style="flex-grow: 2;" class="drop-down"  @click="timeShow=true ">
+			<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>
@@ -68,23 +68,21 @@
 							:'height: 100rpx;width: 100rpx;border-radius:50%;background:#00aaff;color:#fff;font-weight: bold;'">{{item.text}}</view>
 					<!-- 排班情况 -->
 					<view style="color: #FFF;text-align: center;font-size: 28rpx;">
-						<view :style="item.mon==1?
+						<view :style="item.mon > 0?'opacity:1.0':'opacity:0.0'">
+							<view :style="item.mon==1?
 							'margin: 5rpx 10rpx;background:#00aaff;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0;'
-							:'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'
-						"
-						 v-if="item.mon > 0">上午</view>
-
-						<view :style="item.aft==1?
+							:'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'">上午</view>
+						</view>
+						<view :style="item.aft > 0?'opacity:1.0':'opacity:0.0'">
+							<view :style="item.aft==1?
 							'margin: 5rpx 10rpx;background:#ffaa00;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0;'
-							:'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'
-						"
-						 v-if="item.aft > 0">下午</view>
-
-						<view :style="item.nig==1?
+							:'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'">下午</view>
+						</view>
+						<view :style="item.nig > 0?'opacity:1.0':'opacity:0.0'">
+							<view :style="item.nig==1?
 							'margin: 5rpx 10rpx;background:#55aa00;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0;'
-							:'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'
-						"
-						 v-if="item.nig > 0">晚上</view>
+							:'margin: 5rpx 10rpx;background:#cccccc;border-radius: 50rpx;font-size: 20rpx;padding:6rpx 0'">晚上</view>
+						</view>
 					</view>
 				</view>
 			</view>
@@ -108,13 +106,23 @@
 				// this.getNowmonth()
 				console.log("s", this.schedulingList)
 			})
-
 		},
 		onShow() {
+			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
+			}
 
 		},
 		data() {
 			return {
+				refresh:false,
 				timeShow: false,
 				timeList: [],
 				year: 0, //年
@@ -167,34 +175,6 @@
 					margin: '20rpx 0 10rpx 0'
 				},
 				saveDay: 0,
-				//上午按钮样式
-				monStyle: {
-					backgroundColor: '#5667c8',
-					color: '#fff',
-					fontWeight: "bold",
-					margin: '20rpx 0 10rpx 0'
-				},
-				//下午按钮样式
-				aftStyle: {
-					backgroundColor: '#ec9d75',
-					color: '#fff',
-					fontWeight: "bold",
-					margin: '20rpx 0 10rpx 0'
-				},
-				//晚上按钮样式
-				nigStyle: {
-					backgroundColor: '#55aa7f',
-					color: '#fff',
-					fontWeight: "bold",
-					margin: '20rpx 0 10rpx 0'
-				},
-				//其他医院按钮样式
-				otherStyle: {
-					backgroundColor: '#989898',
-					color: '#fff',
-					fontWeight: "bold",
-					margin: '20rpx 0 10rpx 0'
-				}
 			}
 		},
 		methods: {
@@ -290,26 +270,46 @@
 					this.getListTime(this.hospitalList[0].value)
 					this.hospital = this.hospitalList[0].label
 					this.hospitalID = this.hospitalList[0].value + ""
+					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.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 ?
 							1 : 2
 						this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this.hospitalID ?
 							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
+					// 	this.monthList[x + this.empty - a].nig = this.schedulingList[x - a].nig == "0" ? 0 : 2
+					// }
 				}
 			},
+			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())
+					return false
+				}else{return true}
+				
+			}
+			,
 			getMonthList: async function() {
 				console.log("请求数据", this.mothonStart, this.mothonEnd)
 				let res = await this.$request.post("doctor/monthDetail", {
 					'start_day': this.mothonStart,
 					'end_day': this.mothonEnd
 				});
+				console.log("收到数据", res)
 				if (res.status == 0) {
 					let data = res.data;
 					let newList = [];
 					for (let i = 0; i < data.length; i++) {
+						+
+						// console.log(i)
 						this.schedulingList.push({
 							mon: data[i].ident.zao,
 							aft: data[i].ident.xia,
@@ -376,7 +376,6 @@
 				this.mothonStart = this.year + '-' + (this.month + 1) + '-' + '01'
 
 				this.mothonEnd = this.year + '-' + (this.month + 1) + '-' + date.getDate()
-
 				for (let c = 0; c < date.getDate(); c++) {
 					let months = (this.month + 1);
 					if (months < 10) {
@@ -393,10 +392,11 @@
 						select: false,
 						//判断方法,通过判断是不是选中的医院ID
 						//0没有排班,1有排班,2有排班,但不是这个医院
-						mon: this.schedulingList[c].mon == "0" ? 0 : this.schedulingList[c].mon == this.hospitalID ? 1 : 2,
-						aft: this.schedulingList[c].aft == "0" ? 0 : this.schedulingList[c].aft == this.hospitalID ? 1 : 2,
-						nig: this.schedulingList[c].nig == "0" ? 0 : this.schedulingList[c].nig == this.hospitalID ? 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
 					})
+
 				}
 				console.log(this.monthList)
 
@@ -518,11 +518,19 @@
 			yearConfirm(e) {
 				this.year = e[0].value
 				this.month = e[1].value - 1
-				this.monthList = []
-				this.schedulingList = []
-				this.getMonthList();
-				this.day = 0
-				console.log(e)
+				let d = new Date();
+				this.mothonStart = this.year + '-' + (this.month + 1) + '-' + '01'
+				d.setFullYear(this.year, this.month + 1, 0);
+				this.mothonEnd = this.year + '-' + (this.month + 1) + '-' + d.getDate()
+				this.monthList.splice(0, this.monthList.length);
+				this.schedulingList.splice(0, this.schedulingList.length);
+				this.$nextTick(function() {
+					this.getHostail()
+					this.getMonthList();
+					this.day = 0
+					console.log("s", this.schedulingList)
+				})
+
 			},
 			/**
 			 * 日视图按钮点击
@@ -622,7 +630,7 @@
 		font-weight: bold;
 		margin: 20rpx 0 10rpx 0;
 	}
-	
+
 	,
 	/* //上午按钮样式 */
 	.monStyle {
@@ -635,7 +643,7 @@
 		fontWeight: bold;
 		margin: 20rpx 0 10rpx 0;
 	}
-	
+
 	,
 	/* //下午按钮样式 */
 	.aftStyle {
@@ -649,7 +657,7 @@
 		font-weight: bold;
 		margin: 20rpx 0 10rpx 0;
 	}
-	
+
 	,
 	/* //晚上按钮样式 */
 	.nigStyle {
@@ -662,7 +670,7 @@
 		font-weight: bold;
 		margin: 20rpx 0 10rpx 0;
 	}
-	
+
 	,
 	/* //其他医院按钮样式 */
 	.otherStyle {

+ 3 - 0
pages/scheduling/week_Scheduling.vue

xqd
@@ -262,6 +262,9 @@
 						duration: 2000,
 						title: '排班成功',
 						success() {
+							let pages = getCurrentPages();
+							let prevPage = pages[pages.length - 2];
+							prevPage.$vm.refresh = true;
 							uni.navigateBack({
 								delta: 1
 							})

+ 1 - 1
pages/service/setservice.vue

xqd
@@ -64,7 +64,7 @@
 				}, {
 					zhonglei: '图文咨询',
 					state: false,
-					Opening: 1,
+					Opening: 0,
 					disp:true,
 				}, {
 					zhonglei: '门诊预约',